From owner-svn-src-head@freebsd.org Sun May 22 00:07:02 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09E05B457D0; Sun, 22 May 2016 00:07:02 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id BFFE813DF; Sun, 22 May 2016 00:07:01 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 6ADD51A7BA4; Sun, 22 May 2016 10:06:48 +1000 (AEST) Date: Sun, 22 May 2016 10:06:48 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> X-X-Sender: bde@besplex.bde.org To: Pedro Giffuni <pfg@freebsd.org> cc: cem@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300377 - head/sys/compat/ndis In-Reply-To: <262938a6-50bd-b6f4-24c9-895b837a368e@FreeBSD.org> Message-ID: <20160522091455.A1014@besplex.bde.org> References: <201605211752.u4LHqiHQ031457@repo.freebsd.org> <CAG6CVpXjU3tHdar7d=xyr+Tmffg0NrQu3q7SD=b6+jF=yvVr-Q@mail.gmail.com> <a88c14ea-ee78-54de-6142-08a561a49d98@FreeBSD.org> <CAG6CVpV_3++Wqg2X23=RM942zaDkyL6fxH2YN0TXUqpPjneCOw@mail.gmail.com> <262938a6-50bd-b6f4-24c9-895b837a368e@FreeBSD.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=c+ZWOkJl c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=nlC_4_pT8q9DhB4Ho9EA:9 a=6I5d2MoRAAAA:8 a=CwWljFd69-WAYMiV5OEA:9 a=45ClL6m2LaAA:10 a=IjZwj45LgO3ly-622nXo:22 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 00:07:02 -0000 On Sat, 21 May 2016, Pedro Giffuni wrote: > On 05/21/16 16:55, Conrad Meyer wrote: >> On Sat, May 21, 2016 at 1:40 PM, Pedro Giffuni <pfg@freebsd.org> wrote: >>>=20 >>>=20 >>> On 05/21/16 14:05, Conrad Meyer wrote: >>>> Won't this still return a negative integer in many cases? >>>>=20 >>>> random(9) returns u_long, whereas this rand() routine returns 'int'. >>>>=20 >>>> Even on architectures where long is the same size as ordinary >>>> integers, the range of possible results of the 'random() / 2 + 1' >>>> expression, before implicit cast to signed, is [1, 2^31] (inclusive). >>>=20 >>> According to: >>> sys/libkern/random.c >>>=20 >>> The result is uniform on [0, 2^31 - 1]. >>=20 >> Ah, I missed that. Sorry! In that case, I'm not sure why this is >> needed =E2=80=94 the result fits in a non-negative 2's complement signed >> integer. > > Actually, I had missed it too. And I also had no idea we were working aro= und=20 > the zero singularity. > > I will revert the change and will do an adjustment for the case where > we use 0 as a seed (which in MS should be equivalent to 1). The libc version has complications related to this. The libkern version has rotted by not being kept up to date with the libc version. 4.4BSD-Lite has sort of the reverse bitrot -- in libc, it only has the bad LCG that copied from an example in the 1990 C standard, while it has the better LCG copied from 1988 Communications in the ACM in libkern= =2E FreeBSD still has the ACM version in libkern, and has a fixed copy of that in libc, with the bad old version under an ifdef. The libc version now adjusts the range from [0, 0x7fffffff] to 0, 0x7ffffffd] and reduces RAND_MAX by 2 to match. The claimed uniformity for the larger range is very wrong, since the ACM algorithm can only produce numbers in the range [1(or is it 0?), 0x7ffffffe] starting from a seed in the range [1, 0x7ffffffe(or is it 1 higher?)]. There are problems at both extremities, and it isn't clear if the new or old adjustments to avoid them preserve uniformity. It is clear that the range was at least 1 too high, since the ACM algorithm does a modulo by 0x7fffffff. Bruce From owner-svn-src-head@freebsd.org Sun May 22 00:18:46 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13390B459FB; Sun, 22 May 2016 00:18:46 +0000 (UTC) (envelope-from andriyvos@gmail.com) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com [209.85.217.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F4A41A7D; Sun, 22 May 2016 00:18:45 +0000 (UTC) (envelope-from andriyvos@gmail.com) Received: by mail-lb0-f174.google.com with SMTP id k7so24830044lbm.0; Sat, 21 May 2016 17:18:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=mpZEUB2IAz8c49r7+L9IniXA/4F8THQZDDFsBde6e6o=; b=jKzIr2dvaGlkEUm8JztjyqzakSx7YrVDip5KS1wmMdf9qtlZI05ATQBzKfyFaE3np7 qZNIW8+jW59vQSZUEdN6+SMKDc7eVccyzM3/IZsl21qox94AC023IO3zF8gU84iLXZjQ xKyjxS4k/+KhmwjBS+tGofpOUDCbR35iVa6/MkOiQDQpHfpuD3TOMMbclNAsniRztGF0 vJhKHnruSJq4lbyrP1BLuIGCmbSefrQs7RvJC2VyqtTKFJTg0NU/8cV/MVWw7sbcK+Jx Aj2itQ6cL2cZ7Z2132ZINgaSpCdNtl8LcYU7sMFwRjTjgdhbb1lQP9h8RqcpQB9aBAfQ lNsg== X-Gm-Message-State: AOPr4FV7LXJFai3RRh/1nBF7Uh9p4+2ImewIGQU/1Suhq0/ysBtq2/ZCFvfKutREwZi+WA== X-Received: by 10.112.154.5 with SMTP id vk5mr3530789lbb.126.1463873048615; Sat, 21 May 2016 16:24:08 -0700 (PDT) Received: from localhost (host-176-37-109-22.la.net.ua. [176.37.109.22]) by smtp.gmail.com with ESMTPSA id d63sm2977547lfb.48.2016.05.21.16.24.07 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 21 May 2016 16:24:08 -0700 (PDT) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: src-committers@freebsd.org, svn-src-all@freebsd.org, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Subject: Re: svn commit: r300383 - head/sys/net80211 References: <201605212321.u4LNLgDI029432@repo.freebsd.org> Date: Sun, 22 May 2016 02:24:03 +0300 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Andriy Voskoboinyk" <avos@freebsd.org> Message-ID: <op.yht5yd094dikkl@localhost> In-Reply-To: <201605212321.u4LNLgDI029432@repo.freebsd.org> User-Agent: Opera Mail/12.16 (FreeBSD) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 00:18:46 -0000 Tested with wpi(4) and urtwn(4) in STA mode. From owner-svn-src-head@freebsd.org Sun May 22 00:29:26 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0345B45B51; Sun, 22 May 2016 00:29:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BDBFD1EDC; Sun, 22 May 2016 00:29:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M0TPsZ050124; Sun, 22 May 2016 00:29:25 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M0TPI6050123; Sun, 22 May 2016 00:29:25 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201605220029.u4M0TPI6050123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" <pfg@FreeBSD.org> Date: Sun, 22 May 2016 00:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300384 - head/sys/compat/ndis X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 00:29:27 -0000 Author: pfg Date: Sun May 22 00:29:25 2016 New Revision: 300384 URL: https://svnweb.freebsd.org/changeset/base/300384 Log: ndis(4): adjustments for our random() specific implementation. - Revert r300377: The implementation claims to return a value within the range. [1] - Adjust the value for the case of a zero seed, whihc according to standards should be equivalent to a seed of value 1. Pointed out by: cem Modified: head/sys/compat/ndis/subr_ntoskrnl.c Modified: head/sys/compat/ndis/subr_ntoskrnl.c ============================================================================== --- head/sys/compat/ndis/subr_ntoskrnl.c Sat May 21 23:21:42 2016 (r300383) +++ head/sys/compat/ndis/subr_ntoskrnl.c Sun May 22 00:29:25 2016 (r300384) @@ -3189,13 +3189,15 @@ static int rand(void) { - return (random() / 2 + 1); + return (random()); } static void srand(unsigned int seed) { + if (seed == 0) + seed = 1; srandom(seed); } From owner-svn-src-head@freebsd.org Sun May 22 00:58:17 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6030B3B2DF; Sun, 22 May 2016 00:58:17 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 9D6F81D73; Sun, 22 May 2016 00:58:16 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 87C631047D8C; Sun, 22 May 2016 10:58:06 +1000 (AEST) Date: Sun, 22 May 2016 10:58:05 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> X-X-Sender: bde@besplex.bde.org To: Conrad Meyer <cem@freebsd.org> cc: Bruce Evans <brde@optusnet.com.au>, Konstantin Belousov <kib@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300332 - in head/sys: amd64/amd64 i386/i386 In-Reply-To: <CAG6CVpVZd-2wm_0NKggXjDQMnTvhqRM9sGCLEzyCgA7kwO3gww@mail.gmail.com> Message-ID: <20160522101943.U1190@besplex.bde.org> References: <201605201950.u4KJoWA5028092@repo.freebsd.org> <20160521081930.I1098@besplex.bde.org> <CAG6CVpUtz49L0VWfPcCXFvEMiV41AwxhJ8tGjenLqgPJt_kpyA@mail.gmail.com> <20160521103528.I1539@besplex.bde.org> <CAG6CVpXoTxFyo_-mD5NfpUEHJmxrrry6Nnw-Hr5mR0z2_JzHrQ@mail.gmail.com> <20160521123908.V1914@besplex.bde.org> <CAG6CVpVZd-2wm_0NKggXjDQMnTvhqRM9sGCLEzyCgA7kwO3gww@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=M8SwUHEs c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=hCGAsxolkOEVDU5JMAgA:9 a=CjuIK1q_8ugA:10 a=Oa0T6EYmKFNB-xRHvYM1:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 00:58:17 -0000 On Sat, 21 May 2016, Conrad Meyer wrote: > On Fri, May 20, 2016 at 9:13 PM, Bruce Evans <brde@optusnet.com.au> wrote: >> On Fri, 20 May 2016, Conrad Meyer wrote: >> >>> On Fri, May 20, 2016 at 6:10 PM, Bruce Evans <brde@optusnet.com.au> wrote: >>>> >>>> >>>> Signed integers are easier to understand provided calculations with them >>>> don't overflow. >>> >>> How? >> >> For the same reasons as in applying mathematics. Applying mathematics >> ... >> Ordinary (real) numbers (including negative ones) also have good ordering >> properties for all operations. >> >> Computer arithmetic can't represent all ordinary numbers, but gets closest >> by representing ordinary integers as C signed integers perfectly when no >> overflow occurs. >> >> By using C unsigned integers unnecessarily, you throw out invention of >> negative numbers and might have to work with the unfamiliar and badly >> behaved ordering on them. C programmers have some experience with this >> ordering, but apparently not enough to usually avoid bugs. >> ... > Thanks for explaining. > > Can you explain a little bit about the badly behaved ordering of > unsigned integers? I am not familiar with that. The strongest ordering properties for real numbers depend on the existence of negative numbers (and zero). E.g., x >= y if and only if x - y >= 0. To apply that, you need the more basic property that the ordering keeps negative numbers separate from strictly positive numbers and zero. Without negative numbers, we can hope for weaker properties. One is that x1 <= x2 implies x1 + y <= x2 + y. The is true for C signed and unsigned integers if there is no overflow, but for the unsigned case overflow is often considered normal and is technically not described as overflow. Ordering for multiplication breaks down similarly. Division has complications before considering ordering, so don't consider it. Ordering for subtraction breaks down more than for addition, despite it working perfectly as a (reversible) algebraic operator for the unsigned case. Overflow causes problems as usual, and subtraction of unsigned values x - y always "overflows" if y is larger. Signed integers work especially well for subtraction if the operands are non-negative, since then it never overflows. Bruce From owner-svn-src-head@freebsd.org Sun May 22 01:29:58 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E30A5B3BBF4; Sun, 22 May 2016 01:29:58 +0000 (UTC) (envelope-from torek@torek.net) Received: from elf.torek.net (mail.torek.net [96.90.199.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CD28A1F30; Sun, 22 May 2016 01:29:58 +0000 (UTC) (envelope-from torek@torek.net) Received: from elf.torek.net (localhost [127.0.0.1]) by elf.torek.net (8.14.9/8.14.9) with ESMTP id u4M1Topw010808; Sat, 21 May 2016 18:29:51 -0700 (PDT) (envelope-from torek@torek.net) Message-Id: <201605220129.u4M1Topw010808@elf.torek.net> From: Chris Torek <torek@torek.net> To: Bruce Evans <brde@optusnet.com.au> cc: Conrad Meyer <cem@freebsd.org>, Konstantin Belousov <kib@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300332 - in head/sys: amd64/amd64 i386/i386 In-reply-to: Your message of "Sun, 22 May 2016 10:58:05 +1000." <20160522101943.U1190@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10806.1463880590.1@elf.torek.net> Date: Sat, 21 May 2016 18:29:50 -0700 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (elf.torek.net [127.0.0.1]); Sat, 21 May 2016 18:29:51 -0700 (PDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 01:29:59 -0000 >> Can you explain a little bit about the badly behaved ordering of >> unsigned integers? I am not familiar with that. > >The strongest ordering properties for real numbers depend on the existence >of negative numbers (and zero). E.g., x >= y if and only if x - y >= 0. >To apply that, you need the more basic property that the ordering keeps >negative numbers separate from strictly positive numbers and zero. > >Without negative numbers, we can hope for weaker properties. One is >that x1 <= x2 implies x1 + y <= x2 + y. The is true for C signed and >unsigned integers if there is no overflow, but for the unsigned case >overflow is often considered normal and is technically not described >as overflow. On the other hand, since most C compilers don't bother to trap signed integer overflow, but some can, signed integers may behave just as badly. :-) Overall I personally find the rules simpler for unsigned integers (occasionally surprising, but predictable and provable behavior in the mod-2^k ring) than for signed integers (occasionally surprising, possible trap on overflow, possible nonsense on overflow, unpredictable and hence unprovable in general). The ANSI C folks in 1989 made a mess with the "value preserving" rules where unsigned integers become signed integers if the widened type is capable of representing all the values of the narrower type, but become wider unsigned integers if the widened type is not capable of representing all these values. Even restricting operation to two's complement, 8-bit-byte, conventional systems, this means we have several realistic cases: * 16-bit int, 32-bit long, 64-bit long long ("I16L32"): unsigned char widens to signed int, but unsigned short widens to unsigned int. (This model is does not run BSD but is still used in some embedded systems.) * 32-bit int, 32-bit long, 64-bit long long ("IL32"): unsigned char and unsigned short widen to signed int; unsigned int stays unsigned. Mixing unsigned int or unsigned long with signed long long gives you signed behavior. * 32-bit int, 64-bit long, 64-bit long long ("I32L64"): mostly behaves like IL32, but mixing unsigned long with signed long long gives you unsigned behavior. The byte length of pointers may be any of these, and the short-hand notation names usually have a "P" in there, e.g., ILP32 means all are 32 bit, I32LP64 means 32-bit int but 64-bit long and pointers, and so on. Exotic machines with variable-length or variable-format pointers (depending on the data type) are rarer now, although some still make code pointers much longer than data pointers. (Some bypass the problem by using data pointers to descriptors instead of raw code pointers. That is, for void (*fp)(), fp need not point directly to the code to run: it can point instead to a data descriptor that may include both a raw code address and some sort of context, for instance.) --- Ultimately, assuming "i" and "limit" are (a) both signed, or have the same type except that "limit" is unsigned, and (b) "limit" is sane (is nonnegative), using: if (i >= 0 && i < limit) and: if ((unsigned T)i < (unsigned T)limit) do the same thing. But the second form obviously requires knowing what type-name T to insert, and knowing something about "limit" (that it is nonnegative). It used to generate significantly better code to write just the one unsigned-cast test, but these days it's better to just spell out the ">= 0" and let the compiler optimize when possible. Chris From owner-svn-src-head@freebsd.org Sun May 22 01:45:16 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC28CB4305A; Sun, 22 May 2016 01:45:16 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 962471767; Sun, 22 May 2016 01:45:16 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M1jFxl074851; Sun, 22 May 2016 01:45:15 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M1jFaS074850; Sun, 22 May 2016 01:45:15 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605220145.u4M1jFaS074850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper <ngie@FreeBSD.org> Date: Sun, 22 May 2016 01:45:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300385 - head/lib/libc/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 01:45:16 -0000 Author: ngie Date: Sun May 22 01:45:15 2016 New Revision: 300385 URL: https://svnweb.freebsd.org/changeset/base/300385 Log: Don't leak `tmp` if `p->nc_lookups` can't be malloced MFC after: 1 week Reported by: cppcheck Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libc/rpc/getnetconfig.c Modified: head/lib/libc/rpc/getnetconfig.c ============================================================================== --- head/lib/libc/rpc/getnetconfig.c Sun May 22 00:29:25 2016 (r300384) +++ head/lib/libc/rpc/getnetconfig.c Sun May 22 01:45:15 2016 (r300385) @@ -722,6 +722,7 @@ dup_ncp(struct netconfig *ncp) if (p->nc_lookups == NULL) { free(p->nc_netid); free(p); + free(tmp); return(NULL); } for (i=0; i < p->nc_nlookups; i++) { From owner-svn-src-head@freebsd.org Sun May 22 02:02:19 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 833A4B433B2; Sun, 22 May 2016 02:02:19 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53BA61F10; Sun, 22 May 2016 02:02:19 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M22IZN080751; Sun, 22 May 2016 02:02:18 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M22IYe080750; Sun, 22 May 2016 02:02:18 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605220202.u4M22IYe080750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper <ngie@FreeBSD.org> Date: Sun, 22 May 2016 02:02:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300386 - head/lib/libc/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 02:02:19 -0000 Author: ngie Date: Sun May 22 02:02:18 2016 New Revision: 300386 URL: https://svnweb.freebsd.org/changeset/base/300386 Log: Don't leak `handle` if svc_tp_create(..) succeeds and allocating a new struct xlist object fails MFC after: 1 week Reported by: Coverity CID: 978277 Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libc/rpc/svc_generic.c Modified: head/lib/libc/rpc/svc_generic.c ============================================================================== --- head/lib/libc/rpc/svc_generic.c Sun May 22 01:45:15 2016 (r300385) +++ head/lib/libc/rpc/svc_generic.c Sun May 22 02:02:18 2016 (r300386) @@ -122,7 +122,8 @@ svc_create(void (*dispatch)(struct svc_r if (l == NULL) { warnx("svc_create: no memory"); mutex_unlock(&xprtlist_lock); - return (0); + num = 0; + goto done; } l->xprt = xprt; l->next = xprtlist; @@ -132,6 +133,7 @@ svc_create(void (*dispatch)(struct svc_r } mutex_unlock(&xprtlist_lock); } +done: __rpc_endconf(handle); /* * In case of num == 0; the error messages are generated by the From owner-svn-src-head@freebsd.org Sun May 22 02:15:52 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83392B436C9; Sun, 22 May 2016 02:15:52 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 4F36B1450; Sun, 22 May 2016 02:15:52 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 2FB56782F47; Sun, 22 May 2016 12:15:41 +1000 (AEST) Date: Sun, 22 May 2016 12:15:41 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> X-X-Sender: bde@besplex.bde.org To: "Pedro F. Giffuni" <pfg@freebsd.org> cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300384 - head/sys/compat/ndis In-Reply-To: <201605220029.u4M0TPI6050123@repo.freebsd.org> Message-ID: <20160522112323.N1388@besplex.bde.org> References: <201605220029.u4M0TPI6050123@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=EfU1O6SC c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=E5bWiKrETEzLNUIpf3EA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 02:15:52 -0000 On Sun, 22 May 2016, Pedro F. Giffuni wrote: > Log: > ndis(4): adjustments for our random() specific implementation. > > - Revert r300377: The implementation claims to return a value > within the range. [1] > - Adjust the value for the case of a zero seed, whihc according > to standards should be equivalent to a seed of value 1. This was already correct. Standards don't say that a seed of 0 for srand() means the same as a seed of 1 passed to srand(). They say that if srand() is not called, then the sequence shall be the same as if it had been called with a seed of 1. This is already implemented by using an internal initial value of the seed that is the result of srand(1). The commit gives the following bugs: - srand() is less random. srand(0) now gives the same sequence as srand(0) - srand(0) is not binary compatible. My previous mail pointed out the version in libc is the kernel version with some bugs fixed. It also has some regressions. In the libc version, srand(seed) sets the internal seed almost directly (it just adds 1 for technical reasons). The kernel version advances the seed through 50 iterations of random(). This doesn't really increase randomness but it makes the linearity relation in the LCG less obvious. Bruce From owner-svn-src-head@freebsd.org Sun May 22 02:24:39 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9505EB43A30; Sun, 22 May 2016 02:24:39 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5BC301A3E; Sun, 22 May 2016 02:24:39 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M2OcAG087001; Sun, 22 May 2016 02:24:38 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M2Ocs2087000; Sun, 22 May 2016 02:24:38 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605220224.u4M2Ocs2087000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper <ngie@FreeBSD.org> Date: Sun, 22 May 2016 02:24:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300387 - head/lib/libc/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 02:24:39 -0000 Author: ngie Date: Sun May 22 02:24:38 2016 New Revision: 300387 URL: https://svnweb.freebsd.org/changeset/base/300387 Log: getnetid(..): consistently fclose fd at the end of the function This mutes a false positive with cppcheck, but also helps eliminate future potential issues with this variable MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libc/rpc/netnamer.c Modified: head/lib/libc/rpc/netnamer.c ============================================================================== --- head/lib/libc/rpc/netnamer.c Sun May 22 02:02:18 2016 (r300386) +++ head/lib/libc/rpc/netnamer.c Sun May 22 02:24:38 2016 (r300387) @@ -243,6 +243,9 @@ getnetid(char *key, char *ret) char *lookup; int len; #endif + int rv; + + rv = 0; fd = fopen(NETIDFILE, "r"); if (fd == NULL) { @@ -253,13 +256,11 @@ getnetid(char *key, char *ret) return (0); #endif } - for (;;) { - if (fd == NULL) - return (0); /* getnetidyp brings us here */ + while (fd != NULL) { res = fgets(buf, sizeof(buf), fd); if (res == NULL) { - fclose(fd); - return (0); + rv = 0; + goto done; } if (res[0] == '#') continue; @@ -282,9 +283,8 @@ getnetid(char *key, char *ret) lookup[len] = 0; strcpy(ret, lookup); free(lookup); - if (fd != NULL) - fclose(fd); - return (2); + rv = 2; + goto done; #else /* YP */ #ifdef DEBUG fprintf(stderr, @@ -310,10 +310,14 @@ getnetid(char *key, char *ret) } if (strcmp(mkey, key) == 0) { strcpy(ret, mval); - fclose(fd); - return (1); - + rv = 1; + goto done; } } } + +done: + if (fd != NULL) + fclose(fd); + return (rv); } From owner-svn-src-head@freebsd.org Sun May 22 02:43:31 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5536CB43DC8 for <svn-src-head@mailman.ysv.freebsd.org>; Sun, 22 May 2016 02:43:31 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F259112D3 for <svn-src-head@freebsd.org>; Sun, 22 May 2016 02:43:30 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f65.google.com with SMTP id p10so4590086lfb.2 for <svn-src-head@freebsd.org>; Sat, 21 May 2016 19:43:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=CuZHZSSB4p1fh5P81EYerCM+1/6rCj2QECk3nZLMt0c=; b=gGCPywCHRwOox/UCoQehPLR3QAM23KQH9TroSX5WDXjPX6IAxNz9r2kL+P4eSHZV17 XRLyTRHPZ8/Veqjj9yuYolQ3s0q46iD9Zie2DcMCnRqpUH9vhLoRKUjQl5KkvWUrtkXO rZN/qWCIMJMrKuzY+x1J795INft8dT9pxjTuMkEIQuaIo2+ycXmIGkYqLFzFUdhj3Nys Dn4yQIE/oUsap/AA4vtcuI9Laz9fMHtqE4xEquhuHdDemhrvO6nqZ8TIQVOqGAbogHFa m6bEp8Ho0JDlT6vUXhqKa4z+jBPOC3pB3GOVicjFF4ClEggCt3dArsUbfOWatPqfPMrY CZgw== X-Gm-Message-State: ALyK8tIXIVx6eCM/xtQMZRTm32Shv4SnBfWBFeTk3uIPytZ4UVIDODWGrALfhDrTD7wBSQ== X-Received: by 10.25.77.195 with SMTP id a186mr2263990lfb.159.1463885003394; Sat, 21 May 2016 19:43:23 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id d63sm3069447lfb.48.2016.05.21.19.43.22 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 21 May 2016 19:43:22 -0700 (PDT) Subject: Re: svn commit: r300377 - head/sys/compat/ndis To: Bruce Evans <brde@optusnet.com.au>, Pedro Giffuni <pfg@freebsd.org> References: <201605211752.u4LHqiHQ031457@repo.freebsd.org> <CAG6CVpXjU3tHdar7d=xyr+Tmffg0NrQu3q7SD=b6+jF=yvVr-Q@mail.gmail.com> <a88c14ea-ee78-54de-6142-08a561a49d98@FreeBSD.org> <CAG6CVpV_3++Wqg2X23=RM942zaDkyL6fxH2YN0TXUqpPjneCOw@mail.gmail.com> <262938a6-50bd-b6f4-24c9-895b837a368e@FreeBSD.org> <20160522091455.A1014@besplex.bde.org> Cc: cem@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Andrey Chernov <ache@freebsd.org> Message-ID: <8bd5428f-6955-72c3-0294-72f7ef936e16@freebsd.org> Date: Sun, 22 May 2016 05:43:20 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <20160522091455.A1014@besplex.bde.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 02:43:31 -0000 On 22.05.2016 3:06, Bruce Evans wrote: > On Sat, 21 May 2016, Pedro Giffuni wrote: > >> On 05/21/16 16:55, Conrad Meyer wrote: >>> On Sat, May 21, 2016 at 1:40 PM, Pedro Giffuni <pfg@freebsd.org> wrote: >>>> >>>> >>>> On 05/21/16 14:05, Conrad Meyer wrote: >>>>> Won't this still return a negative integer in many cases? >>>>> >>>>> random(9) returns u_long, whereas this rand() routine returns 'int'. >>>>> >>>>> Even on architectures where long is the same size as ordinary >>>>> integers, the range of possible results of the 'random() / 2 + 1' >>>>> expression, before implicit cast to signed, is [1, 2^31] (inclusive). >>>> >>>> According to: >>>> sys/libkern/random.c >>>> >>>> The result is uniform on [0, 2^31 - 1]. >>> >>> Ah, I missed that. Sorry! In that case, I'm not sure why this is >>> needed — the result fits in a non-negative 2's complement signed >>> integer. >> >> Actually, I had missed it too. And I also had no idea we were working >> around the zero singularity. >> >> I will revert the change and will do an adjustment for the case where >> we use 0 as a seed (which in MS should be equivalent to 1). > > The libc version has complications related to this. The libkern > version has rotted by not being kept up to date with the libc version. > 4.4BSD-Lite has sort of the reverse bitrot -- in libc, it only has the > bad LCG that copied from an example in the 1990 C standard, while > it has the better LCG copied from 1988 Communications in the ACM in > libkern. > FreeBSD still has the ACM version in libkern, and has a fixed copy > of that in libc, with the bad old version under an ifdef. > > The libc version now adjusts the range from [0, 0x7fffffff] to > 0, 0x7ffffffd] and reduces RAND_MAX by 2 to match. The claimed uniformity > for the larger range is very wrong, since the ACM algorithm can only > produce numbers in the range [1(or is it 0?), 0x7ffffffe] starting from a > seed in the range [1, 0x7ffffffe(or is it 1 higher?)]. There are problems > at both extremities, and it isn't clear if the new or old adjustments to > avoid them preserve uniformity. It is clear that the range was at least > 1 too high, since the ACM algorithm does a modulo by 0x7fffffff. libc version does range adjustment for better uniformity only for rand(3), not for random(3). There is no RAND_MAX constant in the random(3) API. POSIX require that random(3) should stay in [0, 2^31-1]. From owner-svn-src-head@freebsd.org Sun May 22 02:52:19 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE80BB3B0BF for <svn-src-head@mailman.ysv.freebsd.org>; Sun, 22 May 2016 02:52:19 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lb0-f193.google.com (mail-lb0-f193.google.com [209.85.217.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 435F019C2 for <svn-src-head@freebsd.org>; Sun, 22 May 2016 02:52:18 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lb0-f193.google.com with SMTP id mx9so7414841lbb.2 for <svn-src-head@freebsd.org>; Sat, 21 May 2016 19:52:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=cm2CZxXkYU2IicJHMe6FExtcQ1nEhROEagDaHKmLTy8=; b=NiQ4t7hByhsU5qEZQqar1S6rVnI0I+xYkHP9hIKNrxA3HJybvqAKttE070DkSN5/bK axXFlNIMV9YDgDru2G3UxhUgR7aDurrNX4N8ckVmq2MTB/aXpr31Oh+EspC21MUtMcty LomfwnD3BDMVJ4QLtDwyz7/6MsGqFIqoo50zeVwjyXlDoEy/6Dcl/9a00FA8qHY+oeBm bnnfIAMHOzFZrE+S/APRPNIHclaWlSt5Mwe6Au+c3kIvDpQqMETYEF2QoZaTVnoPMXPq jX7K4NIY2an+W5EMQbD79HhGytI7ahigO6TUkwlewiBm9TDOj7UUbns/e8sMWUsPnlr7 p5dQ== X-Gm-Message-State: AOPr4FUJcSSoEz7wFzsbzn77axi8zHhLh/nYGB3JPYpD03exMlX38NgIF0eHIM/EATYELA== X-Received: by 10.112.65.71 with SMTP id v7mr3655138lbs.52.1463881566943; Sat, 21 May 2016 18:46:06 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id dw6sm4466361lbc.10.2016.05.21.18.46.05 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 21 May 2016 18:46:06 -0700 (PDT) Subject: Re: svn commit: r300384 - head/sys/compat/ndis To: "Pedro F. Giffuni" <pfg@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201605220029.u4M0TPI6050123@repo.freebsd.org> From: Andrey Chernov <ache@freebsd.org> Message-ID: <82b74a0b-7551-31ed-6b89-42925e072900@freebsd.org> Date: Sun, 22 May 2016 04:46:03 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <201605220029.u4M0TPI6050123@repo.freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 02:52:19 -0000 On 22.05.2016 3:29, Pedro F. Giffuni wrote: > static void > srand(unsigned int seed) > { > > + if (seed == 0) > + seed = 1; > srandom(seed); > } IMHO it is not needed. srandom() already handles seed == 0 case, there is no point to remap it to another constant. From owner-svn-src-head@freebsd.org Sun May 22 02:53:12 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD237B3B0EF; Sun, 22 May 2016 02:53:12 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7AE971A0D; Sun, 22 May 2016 02:53:12 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M2rBHZ095911; Sun, 22 May 2016 02:53:11 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M2rBIS095910; Sun, 22 May 2016 02:53:11 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605220253.u4M2rBIS095910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper <ngie@FreeBSD.org> Date: Sun, 22 May 2016 02:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300388 - head/lib/libc/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 02:53:12 -0000 Author: ngie Date: Sun May 22 02:53:11 2016 New Revision: 300388 URL: https://svnweb.freebsd.org/changeset/base/300388 Log: Call endnetconfig on nc_handle sooner to avoid leaking nc_handle if tmpnconf was NULL This would theoretically happen if the netconfig protocol family and protocol semantics were never matched. MFC after: 2 weeks Reported by: Coverity CID: 978179 Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libc/rpc/rpcb_clnt.c Modified: head/lib/libc/rpc/rpcb_clnt.c ============================================================================== --- head/lib/libc/rpc/rpcb_clnt.c Sun May 22 02:24:38 2016 (r300387) +++ head/lib/libc/rpc/rpcb_clnt.c Sun May 22 02:53:11 2016 (r300388) @@ -499,6 +499,7 @@ try_nconf: hostname = IN6_LOCALHOST_STRING; } } + endnetconfig(nc_handle); if (tmpnconf == NULL) { rpc_createerr.cf_stat = RPC_UNKNOWNPROTO; mutex_unlock(&loopnconf_lock); @@ -506,7 +507,6 @@ try_nconf: } loopnconf = getnetconfigent(tmpnconf->nc_netid); /* loopnconf is never freed */ - endnetconfig(nc_handle); } mutex_unlock(&loopnconf_lock); client = getclnthandle(hostname, loopnconf, NULL); From owner-svn-src-head@freebsd.org Sun May 22 02:54:33 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27C91B3B154 for <svn-src-head@mailman.ysv.freebsd.org>; Sun, 22 May 2016 02:54:33 +0000 (UTC) (envelope-from pfg@freebsd.org) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1.freebsd.org (Postfix) with SMTP id 0DFC91BA6 for <svn-src-head@freebsd.org>; Sun, 22 May 2016 02:54:32 +0000 (UTC) (envelope-from pfg@freebsd.org) Received: (qmail 63232 invoked by uid 99); 22 May 2016 02:54:26 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 22 May 2016 02:54:26 +0000 Received: from [192.168.0.100] (unknown [181.55.232.163]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id D2BB31A0118; Sun, 22 May 2016 02:54:24 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: svn commit: r300384 - head/sys/compat/ndis From: Pedro Giffuni <pfg@freebsd.org> In-Reply-To: <20160522112323.N1388@besplex.bde.org> Date: Sat, 21 May 2016 21:54:22 -0500 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <214223B1-89C7-403B-84F1-8F9B539D29C5@freebsd.org> References: <201605220029.u4M0TPI6050123@repo.freebsd.org> <20160522112323.N1388@besplex.bde.org> To: Bruce Evans <brde@optusnet.com.au> X-Mailer: Apple Mail (2.2104) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 02:54:33 -0000 > Il giorno 21/mag/2016, alle ore 21:15, Bruce Evans = <brde@optusnet.com.au> ha scritto: >=20 > On Sun, 22 May 2016, Pedro F. Giffuni wrote: >=20 >> Log: >> ndis(4): adjustments for our random() specific implementation. >>=20 >> - Revert r300377: The implementation claims to return a value >> within the range. [1] >> - Adjust the value for the case of a zero seed, whihc according >> to standards should be equivalent to a seed of value 1. >=20 > This was already correct. Standards don't say that a seed of 0 for > srand() means the same as a seed of 1 passed to srand(). They say > that if srand() is not called, then the sequence shall be the same > as if it had been called with a seed of 1. This is already > implemented by using an internal initial value of the seed that is > the result of srand(1). >=20 OK. I misunderstood the standard. I will revert the if seed thing. (Tomorrow). > The commit gives the following bugs: > - srand() is less random. srand(0) now gives the same sequence as > srand(0) > - srand(0) is not binary compatible. >=20 > My previous mail pointed out the version in libc is the kernel version > with some bugs fixed. It also has some regressions. In the libc > version, srand(seed) sets the internal seed almost directly (it just > adds 1 for technical reasons). The kernel version advances the seed > through 50 iterations of random(). This doesn't really increase > randomness but it makes the linearity relation in the LCG less = obvious. >=20 Merging both is out of scope from what I expected to be a much simpler cleanup for ndis(4). I would have liked to replace completely random() with something like Mersenne Twister + unpredictable seed but that is basically a waste of time: developers seem sufficiently happy with random() and when not arc4random() can be used. :-/ Thanks for all this feedback. Pedro. >=20 From owner-svn-src-head@freebsd.org Sun May 22 03:05:28 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8966CB3B503; Sun, 22 May 2016 03:05:28 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A3DF16AC; Sun, 22 May 2016 03:05:28 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M35RVH099531; Sun, 22 May 2016 03:05:27 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M35RTW099530; Sun, 22 May 2016 03:05:27 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605220305.u4M35RTW099530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper <ngie@FreeBSD.org> Date: Sun, 22 May 2016 03:05:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300389 - head/lib/libc/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 03:05:28 -0000 Author: ngie Date: Sun May 22 03:05:27 2016 New Revision: 300389 URL: https://svnweb.freebsd.org/changeset/base/300389 Log: nis_rpcent: don't leak resultbuf from yp_first(..)/yp_next(..) If the buffer couldn't be adequately resized to accomodate an additional "\n", it would leak resultbuf by breaking from the loop early MFC after: 2 weeks Reported by: Coverity CID: 1016702 Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libc/rpc/getrpcent.c Modified: head/lib/libc/rpc/getrpcent.c ============================================================================== --- head/lib/libc/rpc/getrpcent.c Sun May 22 02:53:11 2016 (r300388) +++ head/lib/libc/rpc/getrpcent.c Sun May 22 03:05:27 2016 (r300389) @@ -511,6 +511,7 @@ nis_rpcent(void *retval, void *mdata, va sizeof(char *)) { *errnop = ERANGE; rv = NS_RETURN; + free(resultbuf); break; } @@ -520,6 +521,7 @@ nis_rpcent(void *retval, void *mdata, va if (aliases_size < 1) { *errnop = ERANGE; rv = NS_RETURN; + free(resultbuf); break; } From owner-svn-src-head@freebsd.org Sun May 22 03:10:12 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED116B3B57B; Sun, 22 May 2016 03:10:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id A6A29186D; Sun, 22 May 2016 03:10:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 521241A28E2; Sun, 22 May 2016 13:10:10 +1000 (AEST) Date: Sun, 22 May 2016 13:10:09 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> X-X-Sender: bde@besplex.bde.org To: Andrey Chernov <ache@freebsd.org> cc: Bruce Evans <brde@optusnet.com.au>, Pedro Giffuni <pfg@freebsd.org>, cem@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300377 - head/sys/compat/ndis In-Reply-To: <8bd5428f-6955-72c3-0294-72f7ef936e16@freebsd.org> Message-ID: <20160522124923.I1697@besplex.bde.org> References: <201605211752.u4LHqiHQ031457@repo.freebsd.org> <CAG6CVpXjU3tHdar7d=xyr+Tmffg0NrQu3q7SD=b6+jF=yvVr-Q@mail.gmail.com> <a88c14ea-ee78-54de-6142-08a561a49d98@FreeBSD.org> <CAG6CVpV_3++Wqg2X23=RM942zaDkyL6fxH2YN0TXUqpPjneCOw@mail.gmail.com> <262938a6-50bd-b6f4-24c9-895b837a368e@FreeBSD.org> <20160522091455.A1014@besplex.bde.org> <8bd5428f-6955-72c3-0294-72f7ef936e16@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=EfU1O6SC c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=8wdhbwkFtMgtjcdClAAA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 03:10:13 -0000 On Sun, 22 May 2016, Andrey Chernov wrote: > On 22.05.2016 3:06, Bruce Evans wrote: >> ... >> FreeBSD still has the ACM version in libkern, and has a fixed copy >> of that in libc, with the bad old version under an ifdef. >> >> The libc version now adjusts the range from [0, 0x7fffffff] to >> 0, 0x7ffffffd] and reduces RAND_MAX by 2 to match. The claimed uniformity >> for the larger range is very wrong, since the ACM algorithm can only >> produce numbers in the range [1(or is it 0?), 0x7ffffffe] starting from a >> seed in the range [1, 0x7ffffffe(or is it 1 higher?)]. There are problems >> at both extremities, and it isn't clear if the new or old adjustments to >> avoid them preserve uniformity. It is clear that the range was at least >> 1 too high, since the ACM algorithm does a modulo by 0x7fffffff. > > libc version does range adjustment for better uniformity only for > rand(3), not for random(3). There is no RAND_MAX constant in the > random(3) API. POSIX require that random(3) should stay in [0, 2^31-1]. The one in the kernel is random(9) being used to implement rand(9). This doesn't have to conform to POSIX or be very good. random(9) is actually really rand(9) under a different name. It uses a LCG with a small period, but random(3) is specified to be the BSD one, with wording too similar to that in the FreeBSD man page -- it must use a nonlinear method with a default period of 16 times larger than 2**31-1, and must give a period larger than 2**69 with a state table size of 256. The default should have been changed to much more than 16 times larger long before POSIX standardized the 1980's default. Bruce From owner-svn-src-head@freebsd.org Sun May 22 03:12:50 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54AB1B3B724; Sun, 22 May 2016 03:12:50 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 220DC1CFB; Sun, 22 May 2016 03:12:50 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M3CnDN002553; Sun, 22 May 2016 03:12:49 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M3CnMb002552; Sun, 22 May 2016 03:12:49 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201605220312.u4M3CnMb002552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza <loos@FreeBSD.org> Date: Sun, 22 May 2016 03:12:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300390 - head/sys/dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 03:12:50 -0000 Author: loos Date: Sun May 22 03:12:49 2016 New Revision: 300390 URL: https://svnweb.freebsd.org/changeset/base/300390 Log: Fix probe routine to return BUS_PROBE_DEFAULT instead of BUS_PROBE_SPECIFIC. While here fix a few style(9) issues. Modified: head/sys/dev/gpio/gpioled.c Modified: head/sys/dev/gpio/gpioled.c ============================================================================== --- head/sys/dev/gpio/gpioled.c Sun May 22 03:05:27 2016 (r300389) +++ head/sys/dev/gpio/gpioled.c Sun May 22 03:12:49 2016 (r300390) @@ -54,12 +54,11 @@ __FBSDID("$FreeBSD$"); */ #define GPIOLED_PIN 0 -#define GPIOLED_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define GPIOLED_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define GPIOLED_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) -#define GPIOLED_LOCK_INIT(_sc) \ - mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->sc_dev), \ - "gpioled", MTX_DEF) -#define GPIOLED_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); +#define GPIOLED_LOCK_INIT(_sc) mtx_init(&(_sc)->sc_mtx, \ + device_get_nameunit((_sc)->sc_dev), "gpioled", MTX_DEF) +#define GPIOLED_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx) struct gpioled_softc { @@ -159,7 +158,7 @@ gpioled_probe(device_t dev) #endif device_set_desc(dev, "GPIO led"); - return (0); + return (BUS_PROBE_DEFAULT); } static int From owner-svn-src-head@freebsd.org Sun May 22 03:34:20 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16C20B3BB25; Sun, 22 May 2016 03:34:20 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B51A614FF; Sun, 22 May 2016 03:34:19 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M3YI2u008753; Sun, 22 May 2016 03:34:18 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M3YIgG008752; Sun, 22 May 2016 03:34:18 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201605220334.u4M3YIgG008752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza <loos@FreeBSD.org> Date: Sun, 22 May 2016 03:34:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300391 - head/sys/dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 03:34:20 -0000 Author: loos Date: Sun May 22 03:34:18 2016 New Revision: 300391 URL: https://svnweb.freebsd.org/changeset/base/300391 Log: Use a better prefix for defines, return BUS_PROBE_DEFAULT for probe routine. Refuse to attach if the number of given pins is not enough for our needs. Modified: head/sys/dev/gpio/gpioiic.c Modified: head/sys/dev/gpio/gpioiic.c ============================================================================== --- head/sys/dev/gpio/gpioiic.c Sun May 22 03:12:49 2016 (r300390) +++ head/sys/dev/gpio/gpioiic.c Sun May 22 03:34:18 2016 (r300391) @@ -53,8 +53,9 @@ __FBSDID("$FreeBSD$"); #include "iicbb_if.h" -#define SCL_PIN_DEFAULT 0 /* default index of SCL pin on gpiobus */ -#define SDA_PIN_DEFAULT 1 +#define GPIOIIC_SCL_DFLT 0 +#define GPIOIIC_SDA_DFLT 1 +#define GPIOIIC_MIN_PINS 2 struct gpioiic_softc { @@ -79,14 +80,24 @@ static int gpioiic_reset(device_t, u_cha static int gpioiic_probe(device_t dev) { + struct gpiobus_ivar *devi; #ifdef FDT + if (!ofw_bus_status_okay(dev)) + return (ENXIO); if (!ofw_bus_is_compatible(dev, "gpioiic")) return (ENXIO); #endif + devi = GPIOBUS_IVAR(dev); + if (devi->npins < GPIOIIC_MIN_PINS) { + device_printf(dev, + "gpioiic needs at least %d GPIO pins (only %d given).\n", + GPIOIIC_MIN_PINS, devi->npins); + return (ENXIO); + } device_set_desc(dev, "GPIO I2C bit-banging driver"); - return (0); + return (BUS_PROBE_DEFAULT); } static int @@ -105,10 +116,10 @@ gpioiic_attach(device_t dev) sc->sc_busdev = device_get_parent(dev); if (resource_int_value(device_get_name(dev), device_get_unit(dev), "scl", &sc->scl_pin)) - sc->scl_pin = SCL_PIN_DEFAULT; + sc->scl_pin = GPIOIIC_SCL_DFLT; if (resource_int_value(device_get_name(dev), device_get_unit(dev), "sda", &sc->sda_pin)) - sc->sda_pin = SDA_PIN_DEFAULT; + sc->sda_pin = GPIOIIC_SDA_DFLT; #ifdef FDT if ((node = ofw_bus_get_node(dev)) == -1) @@ -120,9 +131,9 @@ gpioiic_attach(device_t dev) #endif if (sc->scl_pin < 0 || sc->scl_pin > 1) - sc->scl_pin = SCL_PIN_DEFAULT; + sc->scl_pin = GPIOIIC_SCL_DFLT; if (sc->sda_pin < 0 || sc->sda_pin > 1) - sc->sda_pin = SDA_PIN_DEFAULT; + sc->sda_pin = GPIOIIC_SDA_DFLT; devi = GPIOBUS_IVAR(dev); device_printf(dev, "SCL pin: %d, SDA pin: %d\n", From owner-svn-src-head@freebsd.org Sun May 22 03:55:58 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DAB67B410B1; Sun, 22 May 2016 03:55:58 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9DEA91DDE; Sun, 22 May 2016 03:55:58 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M3tvss014895; Sun, 22 May 2016 03:55:57 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M3tvsM014893; Sun, 22 May 2016 03:55:57 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201605220355.u4M3tvsM014893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza <loos@FreeBSD.org> Date: Sun, 22 May 2016 03:55:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300392 - head/sys/dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 03:55:59 -0000 Author: loos Date: Sun May 22 03:55:57 2016 New Revision: 300392 URL: https://svnweb.freebsd.org/changeset/base/300392 Log: Get rid of two consumers of gpiobus acquire/release. The GPIO hardware should not be owned by a single device, this defeats any chance of use of the GPIO controller as an interrupt source. ow(4) is now the only consumer of this 'feature' before we can remove it for good. Discussed with: ian, bsdimp Modified: head/sys/dev/gpio/gpioiic.c head/sys/dev/gpio/gpioled.c Modified: head/sys/dev/gpio/gpioiic.c ============================================================================== --- head/sys/dev/gpio/gpioiic.c Sun May 22 03:34:18 2016 (r300391) +++ head/sys/dev/gpio/gpioiic.c Sun May 22 03:55:57 2016 (r300392) @@ -70,7 +70,6 @@ static int gpioiic_attach(device_t); /* iicbb interface */ static void gpioiic_reset_bus(device_t); -static int gpioiic_callback(device_t, int, caddr_t); static void gpioiic_setsda(device_t, int); static void gpioiic_setscl(device_t, int); static int gpioiic_getsda(device_t); @@ -161,30 +160,6 @@ gpioiic_reset_bus(device_t dev) GPIO_PIN_INPUT); } -static int -gpioiic_callback(device_t dev, int index, caddr_t data) -{ - struct gpioiic_softc *sc = device_get_softc(dev); - int error, how; - - how = GPIOBUS_DONTWAIT; - if (data != NULL && *(int*)data == IIC_WAIT) - how = GPIOBUS_WAIT; - error = 0; - switch (index) { - case IIC_REQUEST_BUS: - error = GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev, how); - break; - case IIC_RELEASE_BUS: - GPIOBUS_RELEASE_BUS(sc->sc_busdev, sc->sc_dev); - break; - default: - error = EINVAL; - } - - return (error); -} - static void gpioiic_setsda(device_t dev, int val) { @@ -271,7 +246,6 @@ static device_method_t gpioiic_methods[] DEVMETHOD(device_detach, bus_generic_detach), /* iicbb interface */ - DEVMETHOD(iicbb_callback, gpioiic_callback), DEVMETHOD(iicbb_setsda, gpioiic_setsda), DEVMETHOD(iicbb_setscl, gpioiic_setscl), DEVMETHOD(iicbb_getsda, gpioiic_getsda), Modified: head/sys/dev/gpio/gpioled.c ============================================================================== --- head/sys/dev/gpio/gpioled.c Sun May 22 03:34:18 2016 (r300391) +++ head/sys/dev/gpio/gpioled.c Sun May 22 03:55:57 2016 (r300392) @@ -76,23 +76,15 @@ static int gpioled_detach(device_t); static void gpioled_control(void *priv, int onoff) { - int error; struct gpioled_softc *sc; sc = (struct gpioled_softc *)priv; GPIOLED_LOCK(sc); - error = GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev, - GPIOBUS_DONTWAIT); - if (error != 0) { - GPIOLED_UNLOCK(sc); - return; - } - error = GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, - GPIOLED_PIN, GPIO_PIN_OUTPUT); - if (error == 0) + if (GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, + GPIO_PIN_OUTPUT) == 0) { GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, onoff ? GPIO_PIN_HIGH : GPIO_PIN_LOW); - GPIOBUS_RELEASE_BUS(sc->sc_busdev, sc->sc_dev); + } GPIOLED_UNLOCK(sc); } From owner-svn-src-head@freebsd.org Sun May 22 04:02:36 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35C5FB41237; Sun, 22 May 2016 04:02:36 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF4FB1193; Sun, 22 May 2016 04:02:35 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M42Z3Y017779; Sun, 22 May 2016 04:02:35 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M42Z2u017778; Sun, 22 May 2016 04:02:35 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201605220402.u4M42Z2u017778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza <loos@FreeBSD.org> Date: Sun, 22 May 2016 04:02:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300393 - head/sys/dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 04:02:36 -0000 Author: loos Date: Sun May 22 04:02:34 2016 New Revision: 300393 URL: https://svnweb.freebsd.org/changeset/base/300393 Log: Sort and remove a couple of unnecessary headers. Modified: head/sys/dev/gpio/gpioiic.c Modified: head/sys/dev/gpio/gpioiic.c ============================================================================== --- head/sys/dev/gpio/gpioiic.c Sun May 22 03:55:57 2016 (r300392) +++ head/sys/dev/gpio/gpioiic.c Sun May 22 04:02:34 2016 (r300393) @@ -33,24 +33,20 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> -#include <sys/conf.h> +#include <sys/gpio.h> #include <sys/kernel.h> #include <sys/module.h> -#include <sys/gpio.h> -#include "gpiobus_if.h" - #ifdef FDT -#include <dev/ofw/ofw_bus.h> -#include <dev/ofw/ofw_bus_subr.h> #include <dev/fdt/fdt_common.h> +#include <dev/ofw/ofw_bus.h> #endif #include <dev/gpio/gpiobusvar.h> - #include <dev/iicbus/iiconf.h> #include <dev/iicbus/iicbus.h> +#include "gpiobus_if.h" #include "iicbb_if.h" #define GPIOIIC_SCL_DFLT 0 From owner-svn-src-head@freebsd.org Sun May 22 04:09:07 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2ABEBB414CF; Sun, 22 May 2016 04:09:07 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBEC0166A; Sun, 22 May 2016 04:09:06 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M496V0018034; Sun, 22 May 2016 04:09:06 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M495ZP018032; Sun, 22 May 2016 04:09:05 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201605220409.u4M495ZP018032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza <loos@FreeBSD.org> Date: Sun, 22 May 2016 04:09:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300394 - head/sys/dev/iicbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 04:09:07 -0000 Author: loos Date: Sun May 22 04:09:05 2016 New Revision: 300394 URL: https://svnweb.freebsd.org/changeset/base/300394 Log: Remove a couple of extra blank lines. Modified: head/sys/dev/iicbus/iicbb_if.m head/sys/dev/iicbus/iiconf.c Modified: head/sys/dev/iicbus/iicbb_if.m ============================================================================== --- head/sys/dev/iicbus/iicbb_if.m Sun May 22 04:02:34 2016 (r300393) +++ head/sys/dev/iicbus/iicbb_if.m Sun May 22 04:09:05 2016 (r300394) @@ -42,7 +42,6 @@ CODE { static void null_post_xfer(device_t dev) - { } Modified: head/sys/dev/iicbus/iiconf.c ============================================================================== --- head/sys/dev/iicbus/iiconf.c Sun May 22 04:02:34 2016 (r300393) +++ head/sys/dev/iicbus/iiconf.c Sun May 22 04:09:05 2016 (r300394) @@ -136,7 +136,6 @@ iicbus_request_bus(device_t bus, device_ } } - IICBUS_UNLOCK(sc); return (error); From owner-svn-src-head@freebsd.org Sun May 22 04:17:03 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41E3BB417E8; Sun, 22 May 2016 04:17:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EDCE1ACB; Sun, 22 May 2016 04:17:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M4H25b020953; Sun, 22 May 2016 04:17:02 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M4H12O020940; Sun, 22 May 2016 04:17:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605220417.u4M4H12O020940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper <ngie@FreeBSD.org> Date: Sun, 22 May 2016 04:17:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300395 - head/contrib/top X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 04:17:03 -0000 Author: ngie Date: Sun May 22 04:17:00 2016 New Revision: 300395 URL: https://svnweb.freebsd.org/changeset/base/300395 Log: Silence top(1) compiler warnings The contrib/top code is no longer maintained upstream (last pulled 16 years ago). The K&R-style followed by the code spews -Wimplicit-int and -Wreturn-type warnings, amongst others. This silences 131 warnings with as little modification as possible by adding necessary return types, definitions, headers, and header guards, and missing header includes. The 5 warnings that remain are due to undeclared ncurses references. I didn't include curses.h and term.h because there are several local functions and macros that conflict with those definitions. MFC after: 3 weeks Reviewed by: cem, ngie Submitted by: Randy Westlund <rwestlun@gmail.com> Differential Revision: https://reviews.freebsd.org/D6468 Added: head/contrib/top/commands.h (contents, props changed) head/contrib/top/username.h (contents, props changed) Modified: head/contrib/top/commands.c head/contrib/top/display.c head/contrib/top/display.h head/contrib/top/machine.h head/contrib/top/screen.c head/contrib/top/screen.h head/contrib/top/top.c head/contrib/top/top.h head/contrib/top/username.c head/contrib/top/utils.h head/contrib/top/version.c Modified: head/contrib/top/commands.c ============================================================================== --- head/contrib/top/commands.c Sun May 22 04:09:05 2016 (r300394) +++ head/contrib/top/commands.c Sun May 22 04:17:00 2016 (r300395) @@ -19,16 +19,21 @@ */ #include "os.h" -#include <ctype.h> -#include <signal.h> -#include <errno.h> + #include <sys/time.h> #include <sys/resource.h> +#include <ctype.h> +#include <errno.h> +#include <signal.h> +#include <unistd.h> + +#include "commands.h" #include "sigdesc.h" /* generated automatically */ #include "top.h" #include "boolean.h" #include "utils.h" +#include "machine.h" extern int errno; @@ -39,12 +44,15 @@ extern int overstrike; int err_compar(); char *err_string(); +static int str_adderr(char *str, int len, int err); +static int str_addarg(char *str, int len, char *arg, int first); /* * show_help() - display the help screen; invoked in response to * either 'h' or '?'. */ +void show_help() { @@ -123,6 +131,7 @@ register char *str; return(*str == '\0' ? NULL : str); } +int scanint(str, intp) char *str; @@ -262,6 +271,7 @@ char *err_string() * the string "str". */ +static int str_adderr(str, len, err) char *str; @@ -289,6 +299,7 @@ int err; * is set (indicating that a comma should NOT be added to the front). */ +static int str_addarg(str, len, arg, first) char *str; @@ -321,6 +332,7 @@ int first; * for sorting errors. */ +int err_compar(p1, p2) register struct errs *p1, *p2; @@ -339,6 +351,7 @@ register struct errs *p1, *p2; * error_count() - return the number of errors currently logged. */ +int error_count() { @@ -349,6 +362,7 @@ error_count() * show_errors() - display on stdout the current log of errors. */ +void show_errors() { Added: head/contrib/top/commands.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/top/commands.h Sun May 22 04:17:00 2016 (r300395) @@ -0,0 +1,21 @@ +/* + * Top users/processes display for Unix + * Version 3 + * + * This program may be freely redistributed, + * but this entire comment MUST remain intact. + * + * Copyright (c) 1984, 1989, William LeFebvre, Rice University + * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University + * Copyright (c) 2016, Randy Westlund + * + * $FreeBSD$ + */ +#ifndef COMMANDS_H +#define COMMANDS_H + +void show_errors(void); +int error_count(void); +void show_help(void); + +#endif /* COMMANDS_H */ Modified: head/contrib/top/display.c ============================================================================== --- head/contrib/top/display.c Sun May 22 04:09:05 2016 (r300394) +++ head/contrib/top/display.c Sun May 22 04:17:00 2016 (r300395) @@ -29,9 +29,12 @@ */ #include "os.h" + +#include <sys/time.h> + #include <ctype.h> #include <time.h> -#include <sys/time.h> +#include <unistd.h> #include "screen.h" /* interface to screen package */ #include "layout.h" /* defines for screen position layout */ @@ -56,7 +59,6 @@ static int display_width = MAX_COLS; #define lineindex(l) ((l)*display_width) -char *printable(); /* things initialized by display_init and used thruout */ @@ -239,6 +241,7 @@ struct statics *statics; return(lines); } +void i_loadave(mpid, avenrun) int mpid; @@ -267,6 +270,7 @@ double *avenrun; lmpid = mpid; } +void u_loadave(mpid, avenrun) int mpid; @@ -306,6 +310,7 @@ double *avenrun; } } +void i_timeofday(tod) time_t *tod; @@ -351,6 +356,7 @@ static char procstates_buffer[MAX_COLS]; * lastline is valid */ +void i_procstates(total, brkdn) int total; @@ -378,6 +384,7 @@ int *brkdn; memcpy(lprocstates, brkdn, num_procstates * sizeof(int)); } +void u_procstates(total, brkdn) int total; @@ -460,9 +467,10 @@ char *cpustates_tag() } #endif +void i_cpustates(states) -register int *states; +int *states; { register int i = 0; @@ -505,9 +513,10 @@ for (cpu = 0; cpu < num_cpus; cpu++) { memcpy(lcpustates, states, num_cpustates * sizeof(int) * num_cpus); } +void u_cpustates(states) -register int *states; +int *states; { register int value; @@ -557,6 +566,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) { } } +void z_cpustates() { @@ -606,6 +616,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) { char memory_buffer[MAX_COLS]; +void i_memory(stats) int *stats; @@ -619,6 +630,7 @@ int *stats; fputs(memory_buffer, stdout); } +void u_memory(stats) int *stats; @@ -639,13 +651,14 @@ int *stats; */ char arc_buffer[MAX_COLS]; +void i_arc(stats) int *stats; { if (arc_names == NULL) - return (0); + return; fputs("\nARC: ", stdout); lastline++; @@ -655,6 +668,7 @@ int *stats; fputs(arc_buffer, stdout); } +void u_arc(stats) int *stats; @@ -663,7 +677,7 @@ int *stats; static char new[MAX_COLS]; if (arc_names == NULL) - return (0); + return; /* format the new line */ summary_format(new, stats, arc_names); @@ -680,6 +694,7 @@ int *stats; char swap_buffer[MAX_COLS]; +void i_swap(stats) int *stats; @@ -693,6 +708,7 @@ int *stats; fputs(swap_buffer, stdout); } +void u_swap(stats) int *stats; @@ -724,6 +740,7 @@ static int msglen = 0; /* Invariant: msglen is always the length of the message currently displayed on the screen (even when next_msg doesn't contain that message). */ +void i_message() { @@ -745,6 +762,7 @@ i_message() } } +void u_message() { @@ -786,6 +804,7 @@ char *text; * Assumptions: cursor is on the previous line and lastline is consistent */ +void i_header(text) char *text; @@ -811,9 +830,10 @@ char *text; } /*ARGSUSED*/ +void u_header(text) -char *text; /* ignored */ +char *text __unused; /* ignored */ { @@ -832,6 +852,7 @@ char *text; /* ignored */ * Assumptions: lastline is consistent */ +void i_process(line, thisline) int line; @@ -862,6 +883,7 @@ char *thisline; memzero(p, display_width - (p - base)); } +void u_process(line, newline) int line; @@ -909,9 +931,10 @@ char *newline; } } +void u_endscreen(hi) -register int hi; +int hi; { register int screen_line = hi + Header_lines; @@ -969,6 +992,7 @@ register int hi; } } +void display_header(t) int t; @@ -985,6 +1009,7 @@ int t; } /*VARARGS2*/ +void new_message(type, msgfmt, a1, a2, a3) int type; @@ -1025,6 +1050,7 @@ caddr_t a1, a2, a3; } } +void clear_message() { @@ -1034,6 +1060,7 @@ clear_message() } } +int readline(buffer, size, numeric) char *buffer; @@ -1336,6 +1363,7 @@ char *str; return(str); } +void i_uptime(bt, tod) struct timeval* bt; Modified: head/contrib/top/display.h ============================================================================== --- head/contrib/top/display.h Sun May 22 04:09:05 2016 (r300394) +++ head/contrib/top/display.h Sun May 22 04:17:00 2016 (r300395) @@ -5,3 +5,37 @@ #define MT_standout 1 #define MT_delayed 2 +#include "machine.h" + +int display_updatecpus(struct statics *statics); +void clear_message(void); +int display_resize(void); +void i_header(char *text); +char *printable(char *string); +char *cpustates_tag(void); +void display_header(int t); +int display_init(struct statics *statics); +void i_arc(int *stats); +void i_cpustates(int *states); +void i_loadave(int mpid, double *avenrun); +void i_memory(int *stats); +void i_message(void); +void i_process(int line, char *thisline); +void i_procstates(int total, int *brkdn); +void i_swap(int *stats); +void i_timeofday(time_t *tod); +void i_uptime(struct timeval *bt, time_t *tod); +void new_message(); +int readline(char *buffer, int size, int numeric); +char *trim_header(char *text); +void u_arc(int *stats); +void u_cpustates(int *states); +void u_endscreen(int hi); +void u_header(char *text); +void u_loadave(int mpid, double *avenrun); +void u_memory(int *stats); +void u_message(void); +void u_process(int line, char *newline); +void u_procstates(int total, int *brkdn); +void u_swap(int *stats); +void z_cpustates(void); Modified: head/contrib/top/machine.h ============================================================================== --- head/contrib/top/machine.h Sun May 22 04:09:05 2016 (r300394) +++ head/contrib/top/machine.h Sun May 22 04:17:00 2016 (r300395) @@ -7,6 +7,10 @@ * module. It is NOT machine dependent and should not need to be changed * for any specific machine. */ +#ifndef MACHINE_H +#define MACHINE_H + +#include "top.h" /* * the statics struct is filled in by machine_init @@ -74,8 +78,14 @@ struct process_select /* routines defined by the machine dependent module */ -char *format_header(); -char *format_next_process(); +char *format_header(); +char *format_next_process(); +void toggle_pcpustats(void); +void get_system_info(struct system_info *si); +int machine_init(struct statics *statics, char do_unames); +int proc_owner(int pid); /* non-int routines typically used by the machine dependent module */ -char *printable(); +char *printable(); + +#endif /* MACHINE_H */ Modified: head/contrib/top/screen.c ============================================================================== --- head/contrib/top/screen.c Sun May 22 04:09:05 2016 (r300394) +++ head/contrib/top/screen.c Sun May 22 04:17:00 2016 (r300395) @@ -50,7 +50,6 @@ extern char *myname; -int putstdout(); int overstrike; int screen_length; @@ -236,6 +235,7 @@ int interactive; #endif } +void init_screen() { @@ -326,6 +326,7 @@ init_screen() } } +void end_screen() { @@ -356,6 +357,7 @@ end_screen() } } +void reinit_screen() { @@ -383,6 +385,7 @@ reinit_screen() } } +void get_screensize() { @@ -428,6 +431,7 @@ get_screensize() lower_left[sizeof(lower_left) - 1] = '\0'; } +void standout(msg) char *msg; @@ -445,6 +449,7 @@ char *msg; } } +void clear() { @@ -454,6 +459,7 @@ clear() } } +int clear_eol(len) int len; @@ -478,6 +484,7 @@ int len; return(-1); } +void go_home() { @@ -489,6 +496,7 @@ go_home() /* This has to be defined as a subroutine for tputs (instead of a macro) */ +void putstdout(ch) char ch; Modified: head/contrib/top/screen.h ============================================================================== --- head/contrib/top/screen.h Sun May 22 04:09:05 2016 (r300394) +++ head/contrib/top/screen.h Sun May 22 04:17:00 2016 (r300395) @@ -28,4 +28,14 @@ extern int screen_length; extern int screen_width; /* a function that puts a single character on stdout */ -int putstdout(); +void putstdout(char ch); +int clear_eol(int len); +void standout(char *msg); +void clear(void); +void go_home(void); +void reinit_screen(void); +void get_screensize(void); +void init_termcap(int interactive); +void end_screen(void); +void init_screen(void); + Modified: head/contrib/top/top.c ============================================================================== --- head/contrib/top/top.c Sun May 22 04:09:05 2016 (r300394) +++ head/contrib/top/top.c Sun May 22 04:17:00 2016 (r300395) @@ -34,15 +34,19 @@ char *copyright = */ #include "os.h" -#include <errno.h> -#include <signal.h> -#include <setjmp.h> -#include <ctype.h> + #include <sys/jail.h> #include <sys/time.h> + +#include <ctype.h> +#include <errno.h> #include <jail.h> +#include <setjmp.h> +#include <signal.h> +#include <unistd.h> /* includes specific to top */ +#include "commands.h" #include "display.h" /* interface to display package */ #include "screen.h" /* interface to screen package */ #include "top.h" @@ -50,6 +54,7 @@ char *copyright = #include "boolean.h" #include "machine.h" #include "utils.h" +#include "username.h" /* Size of the stdio buffer given to stdout */ #define Buffersize 2048 @@ -114,38 +119,21 @@ caddr_t get_process_info(); char *username(); char *itoa7(); -/* display routines that need to be predeclared */ -int i_loadave(); -int u_loadave(); -int i_procstates(); -int u_procstates(); -int i_cpustates(); -int u_cpustates(); -int i_memory(); -int u_memory(); -int i_arc(); -int u_arc(); -int i_swap(); -int u_swap(); -int i_message(); -int u_message(); -int i_header(); -int u_header(); -int i_process(); -int u_process(); - /* pointers to display routines */ -int (*d_loadave)() = i_loadave; -int (*d_procstates)() = i_procstates; -int (*d_cpustates)() = i_cpustates; -int (*d_memory)() = i_memory; -int (*d_arc)() = i_arc; -int (*d_swap)() = i_swap; -int (*d_message)() = i_message; -int (*d_header)() = i_header; -int (*d_process)() = i_process; +void (*d_loadave)() = i_loadave; +void (*d_procstates)() = i_procstates; +void (*d_cpustates)() = i_cpustates; +void (*d_memory)() = i_memory; +void (*d_arc)() = i_arc; +void (*d_swap)() = i_swap; +void (*d_message)() = i_message; +void (*d_header)() = i_header; +void (*d_process)() = i_process; + +void reset_display(void); +int main(argc, argv) int argc; @@ -1178,6 +1166,7 @@ restart: * screen will get redrawn. */ +void reset_display() { Modified: head/contrib/top/top.h ============================================================================== --- head/contrib/top/top.h Sun May 22 04:09:05 2016 (r300394) +++ head/contrib/top/top.h Sun May 22 04:17:00 2016 (r300395) @@ -7,6 +7,9 @@ * General (global) definitions */ +#ifndef TOP_H +#define TOP_H + /* Current major version number */ #define VERSION 3 @@ -47,3 +50,5 @@ enum displaymodes { DISP_CPU = 0, DISP_I extern enum displaymodes displaymode; extern int pcpu_stats; + +#endif /* TOP_H */ Modified: head/contrib/top/username.c ============================================================================== --- head/contrib/top/username.c Sun May 22 04:09:05 2016 (r300394) +++ head/contrib/top/username.c Sun May 22 04:17:00 2016 (r300395) @@ -32,11 +32,15 @@ #include <sys/param.h> #include <sys/types.h> -#include <stdio.h> + #include <pwd.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "top.local.h" #include "utils.h" +#include "username.h" struct hash_el { int uid; @@ -55,6 +59,8 @@ struct hash_el { /* We depend on that for hash_table and YOUR compiler had BETTER do it! */ struct hash_el hash_table[Table_size]; + +void init_hash() { @@ -67,7 +73,7 @@ init_hash() char *username(uid) -register int uid; +int uid; { register int hashindex; @@ -106,8 +112,8 @@ char *username; int enter_user(uid, name, wecare) -register int uid; -register char *name; +int uid; +char *name; int wecare; /* 1 = enter it always, 0 = nice to have */ { @@ -142,7 +148,7 @@ int wecare; /* 1 = enter it always, 0 = int get_user(uid) -register int uid; +int uid; { struct passwd *pwd; Added: head/contrib/top/username.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/top/username.h Sun May 22 04:17:00 2016 (r300395) @@ -0,0 +1,23 @@ +/* + * Top users/processes display for Unix + * Version 3 + * + * This program may be freely redistributed, + * but this entire comment MUST remain intact. + * + * Copyright (c) 1984, 1989, William LeFebvre, Rice University + * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University + * Copyright (c) 2016, Randy Westlund + * + * $FreeBSD$ + */ +#ifndef USERNAME_H +#define USERNAME_H + +int enter_user(int uid, char *name, int wecare); +int get_user(int uid); +void init_hash(void); +char *username(int uid); +int userid(char *username); + +#endif /* USERNAME_H */ Modified: head/contrib/top/utils.h ============================================================================== --- head/contrib/top/utils.h Sun May 22 04:09:05 2016 (r300394) +++ head/contrib/top/utils.h Sun May 22 04:17:00 2016 (r300395) @@ -22,3 +22,5 @@ char *errmsg(); char *format_time(); char *format_k(); char *format_k2(unsigned long long); +int string_index(char *string, char **array); + Modified: head/contrib/top/version.c ============================================================================== --- head/contrib/top/version.c Sun May 22 04:09:05 2016 (r300394) +++ head/contrib/top/version.c Sun May 22 04:17:00 2016 (r300395) @@ -9,6 +9,9 @@ * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University */ +#include <stdio.h> +#include <string.h> + #include "top.h" #include "patchlevel.h" From owner-svn-src-head@freebsd.org Sun May 22 05:36:06 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7FB7B43480; Sun, 22 May 2016 05:36:06 +0000 (UTC) (envelope-from joel@vnode.se) Received: from smtp.vnode.se (smtp.vnode.se [IPv6:2a07:6c0:1::3]) by mx1.freebsd.org (Postfix) with ESMTP id A294E1519; Sun, 22 May 2016 05:36:06 +0000 (UTC) (envelope-from joel@vnode.se) Received: from ymer.vnode.se (81-235-218-96-no20.tbcn.telia.com [81.235.218.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.vnode.se (Postfix) with ESMTPSA id 401517569; Sun, 22 May 2016 07:36:04 +0200 (CEST) Date: Sun, 22 May 2016 07:36:03 +0200 From: Joel Dahl <joel@vnode.se> To: Garrett Cooper <ngie@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300395 - head/contrib/top Message-ID: <20160522053603.GA61694@ymer.vnode.se> Mail-Followup-To: Garrett Cooper <ngie@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201605220417.u4M4H12O020940@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201605220417.u4M4H12O020940@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 05:36:07 -0000 On Sun, May 22, 2016 at 04:17:01AM +0000, Garrett Cooper wrote: > Author: ngie > Date: Sun May 22 04:17:00 2016 > New Revision: 300395 > URL: https://svnweb.freebsd.org/changeset/base/300395 > > Log: > Silence top(1) compiler warnings > > The contrib/top code is no longer maintained upstream (last pulled 16 years > ago). Move it out of contrib/? -- Joel From owner-svn-src-head@freebsd.org Sun May 22 05:40:57 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C90BBB43577; Sun, 22 May 2016 05:40:57 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x232.google.com (mail-pf0-x232.google.com [IPv6:2607:f8b0:400e:c00::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9AEEE17FE; Sun, 22 May 2016 05:40:57 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x232.google.com with SMTP id g64so885115pfb.2; Sat, 21 May 2016 22:40:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=m75vq6c4NUa2aWzZ7g1+auVm/IggiPddDetJqlIsb48=; b=Js5WwDaU7SIDbfegLw9vsORo8UOOgoef+MTcp4iPxk1ROl7sDI6IXjStn9q55e4JcE 3x5v8j32YMXfwQKJ/iViFWdBWd717Qj36Dk+ty/C6rkETFPLG1pKJ69i60YgtmhiEVnO 8DkI6sg8pJyy5nI4LPhFHrJDB+tx+SUh2j3K9W01N1LhMpy3KMRKx4Rnd8cqSZONNTum JORCcIULK3rVbqPfB41SmPVbVf0xbTqELBfcSHTIwGfXZdYyMkQdss3F1PWr8yECTl/J ksL2SqG1BeYU6x+iYflWf8A4/f2zfAmrsypM3GAtPEQJsNtolTyjfkm5i6CYRqxFX/or 8NHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=m75vq6c4NUa2aWzZ7g1+auVm/IggiPddDetJqlIsb48=; b=BwFsxT0pTw0blebzVxogtqpnw8/5Kesrnkj2g8EchSjA1396FLduNoIbH8iObrKWnh sXjiro3uiyfqfz5JwLZhrxaDzxXDB1+AoOpte7eqEEBYjOct48nbXkspDeCcLYOsCns+ TV3VzMchulq3HYxHpj3DXpktl7EK+3MJSID5/bMbRcDWIn0liarnS8llP4h6Yfm+L7uM S5rte6mKdtqllwWbBMrU45Xssi9MS51+6blyVm6NCHedw5wLrvuw5Z4IUnyHswIhLM/w wsFtJ74MbUPfHtmBmnIXdp4OlTb/2qVfHo/Z+j4eY7bWYfMZplJNd8KQsxL12IOYo3vs 2Rig== X-Gm-Message-State: AOPr4FWuW4vfgVLIRMiv/xVe695f3ZwGL6dheEvXiTnYmPO46KzyYq5rlXvUEkQ92pTl+w== X-Received: by 10.98.83.199 with SMTP id h190mr17322380pfb.15.1463895657104; Sat, 21 May 2016 22:40:57 -0700 (PDT) Received: from [192.168.20.7] (c-73-97-222-46.hsd1.wa.comcast.net. [73.97.222.46]) by smtp.gmail.com with ESMTPSA id u127sm37522373pfb.82.2016.05.21.22.40.56 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 21 May 2016 22:40:56 -0700 (PDT) Subject: Re: svn commit: r300395 - head/contrib/top Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_B05A0B46-C33F-40FE-B9C6-FA8FF7C2F377"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.6b2 From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com> In-Reply-To: <20160522053603.GA61694@ymer.vnode.se> Date: Sat, 21 May 2016 22:40:55 -0700 Cc: Garrett Cooper <ngie@FreeBSD.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <69236DC0-9A88-4B80-A66E-52F90EB0BB0F@gmail.com> References: <201605220417.u4M4H12O020940@repo.freebsd.org> <20160522053603.GA61694@ymer.vnode.se> To: Joel Dahl <joel@vnode.se> X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 05:40:57 -0000 --Apple-Mail=_B05A0B46-C33F-40FE-B9C6-FA8FF7C2F377 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On May 21, 2016, at 22:36, Joel Dahl <joel@vnode.se> wrote: >=20 > On Sun, May 22, 2016 at 04:17:01AM +0000, Garrett Cooper wrote: >> Author: ngie >> Date: Sun May 22 04:17:00 2016 >> New Revision: 300395 >> URL: https://svnweb.freebsd.org/changeset/base/300395 >>=20 >> Log: >> Silence top(1) compiler warnings >>=20 >> The contrib/top code is no longer maintained upstream (last pulled = 16 years >> ago). >=20 > Move it out of contrib/? Hi Joel, I spoke with the submitter and after doing some combined = research, it turns out the project is very much still alive on = SourceForge: http://www.unixtop.org . I=E2=80=99m working with the = submitter on reconciling our changes and upgrading the version to the = latest release copy. Thanks! -Ngie --Apple-Mail=_B05A0B46-C33F-40FE-B9C6-FA8FF7C2F377 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJXQUZoAAoJEPWDqSZpMIYVIb8P/2JnMtyA9KUWR4Mn4ODUhIuI YwRsfWNnScL4QqSjRfvrC6Kt/NMclequQXntz9AkLMSFNemmFvO41pJUfna0WNle tATX7ZL7AOPAbV/UG/ST5si1QaW5/h65pwqy0z5BCsz2qEsOq2icPKxCNXpMaxyh MjgEiat+xlrvf/4seUi4wuC22Sj/kyVZml1NKzmGO9uq33OybVSYjjslZ+z+GERq iPQ7EirrKSgbr85T/A5AOVmGGQK5O0+pjbLHMqvTZp6gNUP84c1BZyDtUzB+p2lA iEl0VambJzteTg/2gsnvohSobZMN/tKy2hVG8qJ1k0C+KXRObraRa1eP0cyEGM5L bEAsSzoDa7x602LggP/9AGyMFC28yTQhJwT6swGQ0Ql0myTyQ1SJbPxU/AWcuT6R 0RzP5fGGMscrW1PJ/VNp60rvlMO0fUoiiltZPdEy8MyS91wfLVQzZTOnYrx8t5cR xFJpArgKB27vyd4SKJaeexKfeHjptkD1amnV1Y97HAwZmO3B3UqUEjhr2wH0LFmB B++lqYJU0SvTvTlHizagrl5yuHdH9DkVnMers4zxW71kfEahQR7nj/4mZrjJbjtP vgJ+aqQAyo6o8bVjcqHjk2AtI0OeXIOQDI7xDNifWfe8bH1ORkKycbL9r9FryGho m1KdJ/tjF+C0sq8lUT9U =K6Gw -----END PGP SIGNATURE----- --Apple-Mail=_B05A0B46-C33F-40FE-B9C6-FA8FF7C2F377-- From owner-svn-src-head@freebsd.org Sun May 22 06:19:00 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DAC5B43AEE; Sun, 22 May 2016 06:19:00 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 334121353; Sun, 22 May 2016 06:19:00 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M6IxXB056870; Sun, 22 May 2016 06:18:59 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M6Ixif056869; Sun, 22 May 2016 06:18:59 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201605220618.u4M6Ixif056869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" <ache@FreeBSD.org> Date: Sun, 22 May 2016 06:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300397 - head/lib/libc/stdlib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 06:19:00 -0000 Author: ache Date: Sun May 22 06:18:59 2016 New Revision: 300397 URL: https://svnweb.freebsd.org/changeset/base/300397 Log: 1) POSIX prohibits printing errors to stderr here and require returning NULL: "Upon successful completion, initstate() and setstate() shall return a pointer to the previous state array; otherwise, a null pointer shall be returned. Although some implementations of random() have written messages to standard error, such implementations do not conform to POSIX.1-2008." 2) Move error detections earlier to prevent state modifying. MFC after: 1 week Modified: head/lib/libc/stdlib/random.c Modified: head/lib/libc/stdlib/random.c ============================================================================== --- head/lib/libc/stdlib/random.c Sun May 22 04:28:55 2016 (r300396) +++ head/lib/libc/stdlib/random.c Sun May 22 06:18:59 2016 (r300397) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/sysctl.h> #include <stdint.h> -#include <stdio.h> #include <stdlib.h> #include "un-namespace.h" @@ -341,15 +340,12 @@ initstate(unsigned long seed, char *arg_ char *ostate = (char *)(&state[-1]); uint32_t *int_arg_state = (uint32_t *)arg_state; + if (n < BREAK_0) + return (NULL); if (rand_type == TYPE_0) state[-1] = rand_type; else state[-1] = MAX_TYPES * (rptr - state) + rand_type; - if (n < BREAK_0) { - (void)fprintf(stderr, - "random: not enough state (%ld bytes); ignored.\n", n); - return (0); - } if (n < BREAK_1) { rand_type = TYPE_0; rand_deg = DEG_0; @@ -408,24 +404,23 @@ setstate(char *arg_state) uint32_t rear = new_state[0] / MAX_TYPES; char *ostate = (char *)(&state[-1]); - if (rand_type == TYPE_0) - state[-1] = rand_type; - else - state[-1] = MAX_TYPES * (rptr - state) + rand_type; switch(type) { case TYPE_0: case TYPE_1: case TYPE_2: case TYPE_3: case TYPE_4: - rand_type = type; - rand_deg = degrees[type]; - rand_sep = seps[type]; break; default: - (void)fprintf(stderr, - "random: state info corrupted; not changed.\n"); + return (NULL); } + if (rand_type == TYPE_0) + state[-1] = rand_type; + else + state[-1] = MAX_TYPES * (rptr - state) + rand_type; + rand_type = type; + rand_deg = degrees[type]; + rand_sep = seps[type]; state = new_state + 1; if (rand_type != TYPE_0) { rptr = &state[rear]; From owner-svn-src-head@freebsd.org Sun May 22 07:58:02 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4907BB44045; Sun, 22 May 2016 07:58:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BEAFF13D3; Sun, 22 May 2016 07:58:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u4M7vuON011666 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 22 May 2016 10:57:57 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u4M7vuON011666 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u4M7vsOI011665; Sun, 22 May 2016 10:57:54 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 22 May 2016 10:57:54 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Chris Torek <torek@torek.net> Cc: Bruce Evans <brde@optusnet.com.au>, Conrad Meyer <cem@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300332 - in head/sys: amd64/amd64 i386/i386 Message-ID: <20160522075754.GH89104@kib.kiev.ua> References: <20160522101943.U1190@besplex.bde.org> <201605220129.u4M1Topw010808@elf.torek.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201605220129.u4M1Topw010808@elf.torek.net> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 07:58:02 -0000 On Sat, May 21, 2016 at 06:29:50PM -0700, Chris Torek wrote: > On the other hand, since most C compilers don't bother to trap > signed integer overflow, but some can, signed integers may behave > just as badly. :-) > > Overall I personally find the rules simpler for unsigned integers > (occasionally surprising, but predictable and provable behavior in > the mod-2^k ring) than for signed integers (occasionally > surprising, possible trap on overflow, possible nonsense on > overflow, unpredictable and hence unprovable in general). > > The ANSI C folks in 1989 made a mess with the "value preserving" > rules where unsigned integers become signed integers if the > widened type is capable of representing all the values of the > narrower type, but become wider unsigned integers if the widened > type is not capable of representing all these values. The biggest mess in ANSI C is that STD left signed arithmetic undefined on overflow for 2-complement machines. It might be too bold, but IMO significant number, if not all, programmers have a model of signed integer operations on the typical modern real-machine (x86 or riscs) where signed op is done by bit-preserving convertion to unsigned and then doing unsigned op. It is quite possible that standard authors did not even considered that a practically useful compiler could do this differently. The hole was used by one of the compilers to get ever important additional .5% in an artifical benchmarks. Unfortunately gcc went the same route, adopting both undef behaviour claim and colored error messages. We use -fwrapv for kernel. From owner-svn-src-head@freebsd.org Sun May 22 08:20:31 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E80E7B4478F; Sun, 22 May 2016 08:20:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B91031033; Sun, 22 May 2016 08:20:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M8KU6C093579; Sun, 22 May 2016 08:20:30 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M8KUXZ093578; Sun, 22 May 2016 08:20:30 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201605220820.u4M8KUXZ093578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner <andrew@FreeBSD.org> Date: Sun, 22 May 2016 08:20:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300406 - head/lib/csu/aarch64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 08:20:32 -0000 Author: andrew Date: Sun May 22 08:20:30 2016 New Revision: 300406 URL: https://svnweb.freebsd.org/changeset/base/300406 Log: Stop dereferencing _end in crt1.c. This was only needed for brk/sbrk so is no longer needed. Sponsored by: ABT Systems Ltd Modified: head/lib/csu/aarch64/crt1.c Modified: head/lib/csu/aarch64/crt1.c ============================================================================== --- head/lib/csu/aarch64/crt1.c Sun May 22 07:50:10 2016 (r300405) +++ head/lib/csu/aarch64/crt1.c Sun May 22 08:20:30 2016 (r300406) @@ -71,17 +71,8 @@ __start(int argc, char *argv[], char *en if (&_DYNAMIC != NULL) atexit(cleanup); - else { - /* - * Hack to resolve _end so we read the correct symbol. - * Without this it will resolve to the copy in the library - * that firsts requests it. We should fix the toolchain, - * however this is is needed until this can take place. - */ - *(volatile long *)&_end; - + else _init_tls(); - } #ifdef GCRT atexit(_mcleanup); From owner-svn-src-head@freebsd.org Sun May 22 09:59:44 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C255EB4330F; Sun, 22 May 2016 09:59:44 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B343170F; Sun, 22 May 2016 09:59:44 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M9xhxa023918; Sun, 22 May 2016 09:59:43 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M9xhsY023917; Sun, 22 May 2016 09:59:43 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201605220959.u4M9xhsY023917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus <skra@FreeBSD.org> Date: Sun, 22 May 2016 09:59:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300409 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 09:59:44 -0000 Author: skra Date: Sun May 22 09:59:43 2016 New Revision: 300409 URL: https://svnweb.freebsd.org/changeset/base/300409 Log: Fix some format strings to make them either correct or uniform. No functional change. Modified: head/sys/arm/freescale/imx/imx_gpio.c Modified: head/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- head/sys/arm/freescale/imx/imx_gpio.c Sun May 22 08:43:36 2016 (r300408) +++ head/sys/arm/freescale/imx/imx_gpio.c Sun May 22 09:59:43 2016 (r300409) @@ -179,14 +179,14 @@ gpio_pic_map_fdt(device_t dev, u_int nce */ if (ncells != 2) { - device_printf(sc->dev, "Invalid #interrupt-cells"); + device_printf(sc->dev, "Invalid #interrupt-cells\n"); return (EINVAL); } irq = cells[0]; tripol = cells[1]; if (irq >= sc->gpio_npins) { - device_printf(sc->dev, "Invalid interrupt number %d", irq); + device_printf(sc->dev, "Invalid interrupt number %u\n", irq); return (EINVAL); } switch (tripol) { @@ -207,7 +207,7 @@ gpio_pic_map_fdt(device_t dev, u_int nce pol = INTR_POLARITY_LOW; break; default: - device_printf(sc->dev, "unsupported trigger/polarity 0x%2x\n", + device_printf(sc->dev, "Unsupported trigger/polarity 0x%2x\n", tripol); return (ENOTSUP); } From owner-svn-src-head@freebsd.org Sun May 22 11:42:35 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C51B0B4486A; Sun, 22 May 2016 11:42:35 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 96CD01E89; Sun, 22 May 2016 11:42:35 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MBgY18057597; Sun, 22 May 2016 11:42:34 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MBgY3i057596; Sun, 22 May 2016 11:42:34 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201605221142.u4MBgY3i057596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus <skra@FreeBSD.org> Date: Sun, 22 May 2016 11:42:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300410 - head/sys/arm/mv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 11:42:35 -0000 Author: skra Date: Sun May 22 11:42:34 2016 New Revision: 300410 URL: https://svnweb.freebsd.org/changeset/base/300410 Log: INTRNG - implement pic_post_filter method. This method is fundamental one and must always be implemented for a PIC. There is no default for it intentionally. Modified: head/sys/arm/mv/mpic.c Modified: head/sys/arm/mv/mpic.c ============================================================================== --- head/sys/arm/mv/mpic.c Sun May 22 09:59:43 2016 (r300409) +++ head/sys/arm/mv/mpic.c Sun May 22 11:42:34 2016 (r300410) @@ -368,6 +368,11 @@ mpic_post_ithread(device_t dev, struct i mpic_enable_intr(dev, isrc); } + +static void +mpic_post_filter(device_t dev, struct intr_irqsrc *isrc) +{ +} #endif static device_method_t mv_mpic_methods[] = { @@ -378,6 +383,7 @@ static device_method_t mv_mpic_methods[] DEVMETHOD(pic_disable_intr, mpic_disable_intr), DEVMETHOD(pic_enable_intr, mpic_enable_intr), DEVMETHOD(pic_map_intr, mpic_map_intr), + DEVMETHOD(pic_post_filter, mpic_post_filter), DEVMETHOD(pic_post_ithread, mpic_post_ithread), DEVMETHOD(pic_pre_ithread, mpic_pre_ithread), #endif From owner-svn-src-head@freebsd.org Sun May 22 12:26:04 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFAC0B3BD9A; Sun, 22 May 2016 12:26:04 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A134F13C9; Sun, 22 May 2016 12:26:04 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MCQ3os069851; Sun, 22 May 2016 12:26:03 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MCQ3Qg069850; Sun, 22 May 2016 12:26:03 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201605221226.u4MCQ3Qg069850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin <dchagin@FreeBSD.org> Date: Sun, 22 May 2016 12:26:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300411 - head/sys/compat/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 12:26:05 -0000 Author: dchagin Date: Sun May 22 12:26:03 2016 New Revision: 300411 URL: https://svnweb.freebsd.org/changeset/base/300411 Log: Minor style(9) cleanup, no functional changes. MFC after: 1 week Modified: head/sys/compat/linux/linux_file.c Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Sun May 22 11:42:34 2016 (r300410) +++ head/sys/compat/linux/linux_file.c Sun May 22 12:26:03 2016 (r300411) @@ -69,108 +69,106 @@ __FBSDID("$FreeBSD$"); int linux_creat(struct thread *td, struct linux_creat_args *args) { - char *path; - int error; - - LCONVPATHEXIST(td, args->path, &path); + char *path; + int error; + LCONVPATHEXIST(td, args->path, &path); #ifdef DEBUG if (ldebug(creat)) printf(ARGS(creat, "%s, %d"), path, args->mode); #endif - error = kern_openat(td, AT_FDCWD, path, UIO_SYSSPACE, - O_WRONLY | O_CREAT | O_TRUNC, args->mode); - LFREEPATH(path); - return (error); + error = kern_openat(td, AT_FDCWD, path, UIO_SYSSPACE, + O_WRONLY | O_CREAT | O_TRUNC, args->mode); + LFREEPATH(path); + return (error); } static int linux_common_open(struct thread *td, int dirfd, char *path, int l_flags, int mode) { - cap_rights_t rights; - struct proc *p = td->td_proc; - struct file *fp; - int fd; - int bsd_flags, error; - - bsd_flags = 0; - switch (l_flags & LINUX_O_ACCMODE) { - case LINUX_O_WRONLY: - bsd_flags |= O_WRONLY; - break; - case LINUX_O_RDWR: - bsd_flags |= O_RDWR; - break; - default: - bsd_flags |= O_RDONLY; - } - if (l_flags & LINUX_O_NDELAY) - bsd_flags |= O_NONBLOCK; - if (l_flags & LINUX_O_APPEND) - bsd_flags |= O_APPEND; - if (l_flags & LINUX_O_SYNC) - bsd_flags |= O_FSYNC; - if (l_flags & LINUX_O_NONBLOCK) - bsd_flags |= O_NONBLOCK; - if (l_flags & LINUX_FASYNC) - bsd_flags |= O_ASYNC; - if (l_flags & LINUX_O_CREAT) - bsd_flags |= O_CREAT; - if (l_flags & LINUX_O_TRUNC) - bsd_flags |= O_TRUNC; - if (l_flags & LINUX_O_EXCL) - bsd_flags |= O_EXCL; - if (l_flags & LINUX_O_NOCTTY) - bsd_flags |= O_NOCTTY; - if (l_flags & LINUX_O_DIRECT) - bsd_flags |= O_DIRECT; - if (l_flags & LINUX_O_NOFOLLOW) - bsd_flags |= O_NOFOLLOW; - if (l_flags & LINUX_O_DIRECTORY) - bsd_flags |= O_DIRECTORY; - /* XXX LINUX_O_NOATIME: unable to be easily implemented. */ - - error = kern_openat(td, dirfd, path, UIO_SYSSPACE, bsd_flags, mode); - if (error != 0) - goto done; - - if (bsd_flags & O_NOCTTY) - goto done; - - /* - * XXX In between kern_open() and fget(), another process - * having the same filedesc could use that fd without - * checking below. - */ - fd = td->td_retval[0]; - if (fget(td, fd, cap_rights_init(&rights, CAP_IOCTL), &fp) == 0) { - if (fp->f_type != DTYPE_VNODE) { - fdrop(fp, td); - goto done; - } - sx_slock(&proctree_lock); - PROC_LOCK(p); - if (SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) { - PROC_UNLOCK(p); - sx_sunlock(&proctree_lock); - /* XXXPJD: Verify if TIOCSCTTY is allowed. */ - (void) fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, - td->td_ucred, td); - } else { - PROC_UNLOCK(p); - sx_sunlock(&proctree_lock); - } - fdrop(fp, td); - } + cap_rights_t rights; + struct proc *p = td->td_proc; + struct file *fp; + int fd; + int bsd_flags, error; + + bsd_flags = 0; + switch (l_flags & LINUX_O_ACCMODE) { + case LINUX_O_WRONLY: + bsd_flags |= O_WRONLY; + break; + case LINUX_O_RDWR: + bsd_flags |= O_RDWR; + break; + default: + bsd_flags |= O_RDONLY; + } + if (l_flags & LINUX_O_NDELAY) + bsd_flags |= O_NONBLOCK; + if (l_flags & LINUX_O_APPEND) + bsd_flags |= O_APPEND; + if (l_flags & LINUX_O_SYNC) + bsd_flags |= O_FSYNC; + if (l_flags & LINUX_O_NONBLOCK) + bsd_flags |= O_NONBLOCK; + if (l_flags & LINUX_FASYNC) + bsd_flags |= O_ASYNC; + if (l_flags & LINUX_O_CREAT) + bsd_flags |= O_CREAT; + if (l_flags & LINUX_O_TRUNC) + bsd_flags |= O_TRUNC; + if (l_flags & LINUX_O_EXCL) + bsd_flags |= O_EXCL; + if (l_flags & LINUX_O_NOCTTY) + bsd_flags |= O_NOCTTY; + if (l_flags & LINUX_O_DIRECT) + bsd_flags |= O_DIRECT; + if (l_flags & LINUX_O_NOFOLLOW) + bsd_flags |= O_NOFOLLOW; + if (l_flags & LINUX_O_DIRECTORY) + bsd_flags |= O_DIRECTORY; + /* XXX LINUX_O_NOATIME: unable to be easily implemented. */ + + error = kern_openat(td, dirfd, path, UIO_SYSSPACE, bsd_flags, mode); + if (error != 0) + goto done; + if (bsd_flags & O_NOCTTY) + goto done; + + /* + * XXX In between kern_open() and fget(), another process + * having the same filedesc could use that fd without + * checking below. + */ + fd = td->td_retval[0]; + if (fget(td, fd, cap_rights_init(&rights, CAP_IOCTL), &fp) == 0) { + if (fp->f_type != DTYPE_VNODE) { + fdrop(fp, td); + goto done; + } + sx_slock(&proctree_lock); + PROC_LOCK(p); + if (SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) { + PROC_UNLOCK(p); + sx_sunlock(&proctree_lock); + /* XXXPJD: Verify if TIOCSCTTY is allowed. */ + (void) fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, + td->td_ucred, td); + } else { + PROC_UNLOCK(p); + sx_sunlock(&proctree_lock); + } + fdrop(fp, td); + } done: #ifdef DEBUG - if (ldebug(open)) - printf(LMSG("open returns error %d"), error); + if (ldebug(open)) + printf(LMSG("open returns error %d"), error); #endif - LFREEPATH(path); - return (error); + LFREEPATH(path); + return (error); } int @@ -195,44 +193,41 @@ linux_openat(struct thread *td, struct l int linux_open(struct thread *td, struct linux_open_args *args) { - char *path; - - if (args->flags & LINUX_O_CREAT) - LCONVPATHCREAT(td, args->path, &path); - else - LCONVPATHEXIST(td, args->path, &path); + char *path; + if (args->flags & LINUX_O_CREAT) + LCONVPATHCREAT(td, args->path, &path); + else + LCONVPATHEXIST(td, args->path, &path); #ifdef DEBUG if (ldebug(open)) printf(ARGS(open, "%s, 0x%x, 0x%x"), path, args->flags, args->mode); #endif - return (linux_common_open(td, AT_FDCWD, path, args->flags, args->mode)); } int linux_lseek(struct thread *td, struct linux_lseek_args *args) { - - struct lseek_args /* { - int fd; - int pad; - off_t offset; - int whence; - } */ tmp_args; - int error; + struct lseek_args /* { + int fd; + int pad; + off_t offset; + int whence; + } */ tmp_args; + int error; #ifdef DEBUG if (ldebug(lseek)) printf(ARGS(lseek, "%d, %ld, %d"), args->fdes, (long)args->off, args->whence); #endif - tmp_args.fd = args->fdes; - tmp_args.offset = (off_t)args->off; - tmp_args.whence = args->whence; - error = sys_lseek(td, &tmp_args); - return error; + tmp_args.fd = args->fdes; + tmp_args.offset = (off_t)args->off; + tmp_args.whence = args->whence; + error = sys_lseek(td, &tmp_args); + return (error); } #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) @@ -255,13 +250,13 @@ linux_llseek(struct thread *td, struct l bsd_args.whence = args->whence; if ((error = sys_lseek(td, &bsd_args))) - return error; + return (error); if ((error = copyout(td->td_retval, args->res, sizeof (off_t)))) - return error; + return (error); td->td_retval[0] = 0; - return 0; + return (0); } int @@ -272,7 +267,7 @@ linux_readdir(struct thread *td, struct lda.fd = args->fd; lda.dent = args->dent; lda.count = 1; - return linux_getdents(td, &lda); + return (linux_getdents(td, &lda)); } #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ @@ -949,7 +944,7 @@ linux_ftruncate(struct thread *td, struc int pad; off_t length; } */ nuap; - + nuap.fd = args->fd; nuap.length = args->length; return (sys_ftruncate(td, &nuap)); @@ -1021,7 +1016,7 @@ linux_fdatasync(td, uap) struct fsync_args bsd; bsd.fd = uap->fd; - return sys_fsync(td, &bsd); + return (sys_fsync(td, &bsd)); } int @@ -1038,9 +1033,7 @@ linux_pread(td, uap) bsd.buf = uap->buf; bsd.nbyte = uap->nbyte; bsd.offset = uap->offset; - error = sys_pread(td, &bsd); - if (error == 0) { /* This seems to violate POSIX but linux does it */ error = fgetvp(td, uap->fd, @@ -1053,7 +1046,6 @@ linux_pread(td, uap) } vrele(vp); } - return (error); } @@ -1068,7 +1060,7 @@ linux_pwrite(td, uap) bsd.buf = uap->buf; bsd.nbyte = uap->nbyte; bsd.offset = uap->offset; - return sys_pwrite(td, &bsd); + return (sys_pwrite(td, &bsd)); } int From owner-svn-src-head@freebsd.org Sun May 22 12:28:56 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83BE8B3BE6B; Sun, 22 May 2016 12:28:56 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 55F67172D; Sun, 22 May 2016 12:28:56 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MCSt8H070020; Sun, 22 May 2016 12:28:55 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MCStAT070019; Sun, 22 May 2016 12:28:55 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201605221228.u4MCStAT070019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin <dchagin@FreeBSD.org> Date: Sun, 22 May 2016 12:28:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300412 - head/sys/compat/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 12:28:56 -0000 Author: dchagin Date: Sun May 22 12:28:55 2016 New Revision: 300412 URL: https://svnweb.freebsd.org/changeset/base/300412 Log: Add my copyright as I rewrote most of the futex code. Minor style(9) cleanup while here. MFC after: 1 week Modified: head/sys/compat/linux/linux_futex.c Modified: head/sys/compat/linux/linux_futex.c ============================================================================== --- head/sys/compat/linux/linux_futex.c Sun May 22 12:26:03 2016 (r300411) +++ head/sys/compat/linux/linux_futex.c Sun May 22 12:28:55 2016 (r300412) @@ -1,7 +1,9 @@ /* $NetBSD: linux_futex.c,v 1.7 2006/07/24 19:01:49 manu Exp $ */ /*- - * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved. + * Copyright (c) 2009-2016 Dmitry Chagin + * Copyright (c) 2005 Emmanuel Dreyfus + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -604,7 +606,7 @@ futex_atomic_op(struct thread *td, int e LIN_SDT_PROBE4(futex, futex_atomic_op, decoded_op, op, cmp, oparg, cmparg); - + /* XXX: Linux verifies access here and returns EFAULT */ LIN_SDT_PROBE0(futex, futex_atomic_op, missing_access_check); @@ -996,7 +998,6 @@ linux_sys_futex(struct thread *td, struc return (ENOSYS); case LINUX_FUTEX_REQUEUE: - /* * Glibc does not use this operation since version 2.3.3, * as it is racy and replaced by FUTEX_CMP_REQUEUE operation. From owner-svn-src-head@freebsd.org Sun May 22 12:35:51 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79F40B4502B; Sun, 22 May 2016 12:35:51 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B9BE1CA4; Sun, 22 May 2016 12:35:51 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MCZoD2073116; Sun, 22 May 2016 12:35:50 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MCZolo073115; Sun, 22 May 2016 12:35:50 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201605221235.u4MCZolo073115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin <dchagin@FreeBSD.org> Date: Sun, 22 May 2016 12:35:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300413 - head/sys/compat/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 12:35:51 -0000 Author: dchagin Date: Sun May 22 12:35:50 2016 New Revision: 300413 URL: https://svnweb.freebsd.org/changeset/base/300413 Log: Due to lack the priority propagation feature replace sx by mutex. WIth this commit NPTL tests are ends in 1 minute faster. MFC after: 1 week Modified: head/sys/compat/linux/linux_futex.c Modified: head/sys/compat/linux/linux_futex.c ============================================================================== --- head/sys/compat/linux/linux_futex.c Sun May 22 12:28:55 2016 (r300412) +++ head/sys/compat/linux/linux_futex.c Sun May 22 12:35:50 2016 (r300413) @@ -54,9 +54,10 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex. #include <sys/queue.h> #include <sys/sched.h> #include <sys/sdt.h> -#include <sys/sx.h> #include <sys/umtx.h> +#include <vm/vm_extern.h> + #ifdef COMPAT_LINUX32 #include <machine/../linux32/linux.h> #include <machine/../linux32/linux32_proto.h> @@ -196,7 +197,7 @@ struct waiting_proc { }; struct futex { - struct sx f_lck; + struct mtx f_lck; uint32_t *f_uaddr; /* user-supplied value, for debug */ struct umtx_key f_key; uint32_t f_refcount; @@ -207,20 +208,22 @@ struct futex { struct futex_list futex_list; -#define FUTEX_LOCK(f) sx_xlock(&(f)->f_lck) -#define FUTEX_UNLOCK(f) sx_xunlock(&(f)->f_lck) +#define FUTEX_LOCK(f) mtx_lock(&(f)->f_lck) +#define FUTEX_LOCKED(f) mtx_owned(&(f)->f_lck) +#define FUTEX_UNLOCK(f) mtx_unlock(&(f)->f_lck) #define FUTEX_INIT(f) do { \ - sx_init_flags(&(f)->f_lck, "ftlk", \ - SX_DUPOK); \ + mtx_init(&(f)->f_lck, "ftlk", NULL, \ + MTX_DUPOK); \ LIN_SDT_PROBE1(futex, futex, create, \ &(f)->f_lck); \ } while (0) #define FUTEX_DESTROY(f) do { \ LIN_SDT_PROBE1(futex, futex, destroy, \ &(f)->f_lck); \ - sx_destroy(&(f)->f_lck); \ + mtx_destroy(&(f)->f_lck); \ } while (0) -#define FUTEX_ASSERT_LOCKED(f) sx_assert(&(f)->f_lck, SA_XLOCKED) +#define FUTEX_ASSERT_LOCKED(f) mtx_assert(&(f)->f_lck, MA_OWNED) +#define FUTEX_ASSERT_UNLOCKED(f) mtx_assert(&(f)->f_lck, MA_NOTOWNED) struct mtx futex_mtx; /* protects the futex list */ #define FUTEXES_LOCK do { \ @@ -239,6 +242,7 @@ struct mtx futex_mtx; /* protects the #define FUTEX_DONTCREATE 0x2 /* don't create futex if not exists */ #define FUTEX_DONTEXISTS 0x4 /* return EINVAL if futex exists */ #define FUTEX_SHARED 0x8 /* shared futex */ +#define FUTEX_DONTLOCK 0x10 /* don't lock futex */ /* wp_flags */ #define FUTEX_WP_REQUEUED 0x1 /* wp requeued - wp moved from wp_list @@ -258,6 +262,8 @@ static int futex_wake(struct futex *, in static int futex_requeue(struct futex *, int, struct futex *, int); static int futex_wait(struct futex *, struct waiting_proc *, int, uint32_t); +static void futex_lock(struct futex *); +static void futex_unlock(struct futex *); static int futex_atomic_op(struct thread *, int, uint32_t *); static int handle_futex_death(struct linux_emuldata *, uint32_t *, unsigned int); @@ -277,7 +283,6 @@ futex_put(struct futex *f, struct waitin { LIN_SDT_PROBE2(futex, futex_put, entry, f, wp); - FUTEX_ASSERT_LOCKED(f); if (wp != NULL) { if ((wp->wp_flags & FUTEX_WP_REMOVED) == 0) TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list); @@ -288,7 +293,8 @@ futex_put(struct futex *f, struct waitin if (--f->f_refcount == 0) { LIST_REMOVE(f, f_list); FUTEXES_UNLOCK; - FUTEX_UNLOCK(f); + if (FUTEX_LOCKED(f)) + futex_unlock(f); LIN_SDT_PROBE3(futex, futex_put, destroy, f->f_uaddr, f->f_refcount, f->f_key.shared); @@ -307,7 +313,8 @@ futex_put(struct futex *f, struct waitin LINUX_CTR3(sys_futex, "futex_put uaddr %p ref %d shared %d", f->f_uaddr, f->f_refcount, f->f_key.shared); FUTEXES_UNLOCK; - FUTEX_UNLOCK(f); + if (FUTEX_LOCKED(f)) + futex_unlock(f); LIN_SDT_PROBE0(futex, futex_put, return); } @@ -335,7 +342,8 @@ retry: LIST_FOREACH(f, &futex_list, f_list) { if (umtx_key_match(&f->f_key, &key)) { if (tmpf != NULL) { - FUTEX_UNLOCK(tmpf); + if (FUTEX_LOCKED(tmpf)) + futex_unlock(tmpf); FUTEX_DESTROY(tmpf); free(tmpf, M_FUTEX); } @@ -356,7 +364,8 @@ retry: FUTEXES_UNLOCK; umtx_key_release(&key); - FUTEX_LOCK(f); + if ((flags & FUTEX_DONTLOCK) == 0) + futex_lock(f); *newf = f; LIN_SDT_PROBE3(futex, futex_get0, shared, uaddr, f->f_refcount, f->f_key.shared); @@ -392,7 +401,8 @@ retry: * Lock the new futex before an insert into the futex_list * to prevent futex usage by other. */ - FUTEX_LOCK(tmpf); + if ((flags & FUTEX_DONTLOCK) == 0) + futex_lock(tmpf); goto retry; } @@ -440,6 +450,26 @@ futex_get(uint32_t *uaddr, struct waitin return (error); } +static inline void +futex_lock(struct futex *f) +{ + + LINUX_CTR3(sys_futex, "futex_lock uaddr %p ref %d shared %d", + f->f_uaddr, f->f_refcount, f->f_key.shared); + FUTEX_ASSERT_UNLOCKED(f); + FUTEX_LOCK(f); +} + +static inline void +futex_unlock(struct futex *f) +{ + + LINUX_CTR3(sys_futex, "futex_unlock uaddr %p ref %d shared %d", + f->f_uaddr, f->f_refcount, f->f_key.shared); + FUTEX_ASSERT_LOCKED(f); + FUTEX_UNLOCK(f); +} + static int futex_sleep(struct futex *f, struct waiting_proc *wp, int timeout) { @@ -449,7 +479,7 @@ futex_sleep(struct futex *f, struct wait LIN_SDT_PROBE3(futex, futex_sleep, entry, f, wp, timeout); LINUX_CTR4(sys_futex, "futex_sleep enter uaddr %p wp %p timo %d ref %d", f->f_uaddr, wp, timeout, f->f_refcount); - error = sx_sleep(wp, &f->f_lck, PCATCH, "futex", timeout); + error = mtx_sleep(wp, &f->f_lck, PCATCH, "futex", timeout); if (wp->wp_flags & FUTEX_WP_REQUEUED) { KASSERT(f != wp->wp_futex, ("futex != wp_futex")); @@ -465,7 +495,7 @@ futex_sleep(struct futex *f, struct wait wp->wp_futex->f_refcount); futex_put(f, NULL); f = wp->wp_futex; - FUTEX_LOCK(f); + futex_lock(f); } else { if (error) { LIN_SDT_PROBE3(futex, futex_sleep, sleep_error, error, @@ -676,7 +706,7 @@ linux_sys_futex(struct thread *td, struc struct timespec timeout; struct timeval utv, ctv; int timeout_hz; - int error; + int error, save; uint32_t flags, val; LIN_SDT_PROBE2(futex, linux_sys_futex, entry, td, args); @@ -749,6 +779,7 @@ linux_sys_futex(struct thread *td, struc } else timeout_hz = 0; +retry0: error = futex_get(args->uaddr, &wp, &f, flags | FUTEX_CREATE_WP); if (error) { @@ -756,14 +787,16 @@ linux_sys_futex(struct thread *td, struc return (error); } - error = copyin(args->uaddr, &val, sizeof(val)); + error = copyin_nofault(args->uaddr, &val, sizeof(val)); if (error) { + futex_put(f, wp); + error = copyin(args->uaddr, &val, sizeof(val)); + if (error == 0) + goto retry0; LIN_SDT_PROBE1(futex, linux_sys_futex, copyin_error, error); LINUX_CTR1(sys_futex, "WAIT copyin failed %d", error); - futex_put(f, wp); - LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); return (error); } @@ -831,7 +864,8 @@ linux_sys_futex(struct thread *td, struc return (EINVAL); } - error = futex_get(args->uaddr, NULL, &f, flags); +retry1: + error = futex_get(args->uaddr, NULL, &f, flags | FUTEX_DONTLOCK); if (error) { LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); return (error); @@ -845,22 +879,26 @@ linux_sys_futex(struct thread *td, struc * returned by FUTEX_CMP_REQUEUE. */ error = futex_get(args->uaddr2, NULL, &f2, - flags | FUTEX_DONTEXISTS); + flags | FUTEX_DONTEXISTS | FUTEX_DONTLOCK); if (error) { futex_put(f, NULL); LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); return (error); } - error = copyin(args->uaddr, &val, sizeof(val)); + futex_lock(f); + futex_lock(f2); + error = copyin_nofault(args->uaddr, &val, sizeof(val)); if (error) { + futex_put(f2, NULL); + futex_put(f, NULL); + error = copyin(args->uaddr, &val, sizeof(val)); + if (error == 0) + goto retry1; LIN_SDT_PROBE1(futex, linux_sys_futex, copyin_error, error); LINUX_CTR1(sys_futex, "CMP_REQUEUE copyin failed %d", error); - futex_put(f2, NULL); - futex_put(f, NULL); - LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); return (error); } @@ -890,50 +928,45 @@ linux_sys_futex(struct thread *td, struc args->uaddr, args->val, args->uaddr2, args->val3, args->timeout); - error = futex_get(args->uaddr, NULL, &f, flags); +retry2: + error = futex_get(args->uaddr, NULL, &f, flags | FUTEX_DONTLOCK); if (error) { LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); return (error); } if (args->uaddr != args->uaddr2) - error = futex_get(args->uaddr2, NULL, &f2, flags); + error = futex_get(args->uaddr2, NULL, &f2, + flags | FUTEX_DONTLOCK); if (error) { futex_put(f, NULL); LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); return (error); } + futex_lock(f); + futex_lock(f2); /* * This function returns positive number as results and * negative as errors */ + save = vm_fault_disable_pagefaults(); op_ret = futex_atomic_op(td, args->val3, args->uaddr2); + vm_fault_enable_pagefaults(save); LINUX_CTR2(sys_futex, "WAKE_OP atomic_op uaddr %p ret 0x%x", args->uaddr, op_ret); if (op_ret < 0) { - /* XXX: We don't handle the EFAULT yet. */ - if (op_ret != -EFAULT) { - if (f2 != NULL) - futex_put(f2, NULL); - futex_put(f, NULL); - - LIN_SDT_PROBE1(futex, linux_sys_futex, return, - -op_ret); - return (-op_ret); - } else { - LIN_SDT_PROBE0(futex, linux_sys_futex, - unhandled_efault); - } if (f2 != NULL) futex_put(f2, NULL); futex_put(f, NULL); - - LIN_SDT_PROBE1(futex, linux_sys_futex, return, EFAULT); - return (EFAULT); + error = copyin(args->uaddr2, &val, sizeof(val)); + if (error == 0) + goto retry2; + LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); + return (error); } ret = futex_wake(f, args->val, args->val3); From owner-svn-src-head@freebsd.org Sun May 22 12:37:41 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB646B45091; Sun, 22 May 2016 12:37:41 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E96A1E0D; Sun, 22 May 2016 12:37:41 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MCbeld073223; Sun, 22 May 2016 12:37:40 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MCbeQn073222; Sun, 22 May 2016 12:37:40 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201605221237.u4MCbeQn073222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin <dchagin@FreeBSD.org> Date: Sun, 22 May 2016 12:37:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300414 - head/sys/compat/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 12:37:41 -0000 Author: dchagin Date: Sun May 22 12:37:40 2016 New Revision: 300414 URL: https://svnweb.freebsd.org/changeset/base/300414 Log: For future use move futex timeout code to the separate function and switch to the high resolution sbintime_t. MFC after: 1 week Modified: head/sys/compat/linux/linux_futex.c Modified: head/sys/compat/linux/linux_futex.c ============================================================================== --- head/sys/compat/linux/linux_futex.c Sun May 22 12:35:50 2016 (r300413) +++ head/sys/compat/linux/linux_futex.c Sun May 22 12:37:40 2016 (r300414) @@ -109,7 +109,7 @@ LIN_SDT_PROBE_DEFINE3(futex, futex_get, LIN_SDT_PROBE_DEFINE0(futex, futex_get, error); LIN_SDT_PROBE_DEFINE1(futex, futex_get, return, "int"); LIN_SDT_PROBE_DEFINE3(futex, futex_sleep, entry, "struct futex *", - "struct waiting_proc **", "int"); + "struct waiting_proc **", "struct timespec *"); LIN_SDT_PROBE_DEFINE5(futex, futex_sleep, requeue_error, "int", "uint32_t *", "struct waiting_proc *", "uint32_t *", "uint32_t"); LIN_SDT_PROBE_DEFINE3(futex, futex_sleep, sleep_error, "int", "uint32_t *", @@ -128,7 +128,7 @@ LIN_SDT_PROBE_DEFINE3(futex, futex_reque "struct waiting_proc *", "uint32_t"); LIN_SDT_PROBE_DEFINE1(futex, futex_requeue, return, "int"); LIN_SDT_PROBE_DEFINE4(futex, futex_wait, entry, "struct futex *", - "struct waiting_proc **", "int", "uint32_t"); + "struct waiting_proc **", "struct timespec *", "uint32_t"); LIN_SDT_PROBE_DEFINE1(futex, futex_wait, sleep_error, "int"); LIN_SDT_PROBE_DEFINE1(futex, futex_wait, return, "int"); LIN_SDT_PROBE_DEFINE3(futex, futex_atomic_op, entry, "struct thread *", @@ -142,7 +142,6 @@ LIN_SDT_PROBE_DEFINE1(futex, futex_atomi LIN_SDT_PROBE_DEFINE2(futex, linux_sys_futex, entry, "struct thread *", "struct linux_sys_futex_args *"); LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, unimplemented_clockswitch); -LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, itimerfix_error, "int"); LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, copyin_error, "int"); LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, invalid_cmp_requeue_use); LIN_SDT_PROBE_DEFINE3(futex, linux_sys_futex, debug_wait, "uint32_t *", @@ -257,10 +256,12 @@ static void futex_put(struct futex *, st static int futex_get0(uint32_t *, struct futex **f, uint32_t); static int futex_get(uint32_t *, struct waiting_proc **, struct futex **, uint32_t); -static int futex_sleep(struct futex *, struct waiting_proc *, int); +static int futex_sleep(struct futex *, struct waiting_proc *, struct timespec *); static int futex_wake(struct futex *, int, uint32_t); static int futex_requeue(struct futex *, int, struct futex *, int); -static int futex_wait(struct futex *, struct waiting_proc *, int, +static int futex_copyin_timeout(int, struct l_timespec *, int, + struct timespec *); +static int futex_wait(struct futex *, struct waiting_proc *, struct timespec *, uint32_t); static void futex_lock(struct futex *); static void futex_unlock(struct futex *); @@ -278,6 +279,34 @@ int futex_andl(int oparg, uint32_t *uadd int futex_xorl(int oparg, uint32_t *uaddr, int *oldval); +static int +futex_copyin_timeout(int op, struct l_timespec *luts, int clockrt, + struct timespec *ts) +{ + struct l_timespec lts; + struct timespec kts; + int error; + + error = copyin(luts, <s, sizeof(lts)); + if (error) + return (error); + + error = linux_to_native_timespec(ts, <s); + if (error) + return (error); + if (ts->tv_nsec < 0 || ts->tv_nsec >= 1000000000) + return (EINVAL); + + if (clockrt) { + nanotime(&kts); + timespecsub(ts, &kts); + } else if (op == LINUX_FUTEX_WAIT_BITSET) { + nanouptime(&kts); + timespecsub(ts, &kts); + } + return (error); +} + static void futex_put(struct futex *f, struct waiting_proc *wp) { @@ -471,15 +500,35 @@ futex_unlock(struct futex *f) } static int -futex_sleep(struct futex *f, struct waiting_proc *wp, int timeout) +futex_sleep(struct futex *f, struct waiting_proc *wp, struct timespec *ts) { + struct timespec uts; + sbintime_t sbt, prec, tmp; + time_t over; int error; FUTEX_ASSERT_LOCKED(f); - LIN_SDT_PROBE3(futex, futex_sleep, entry, f, wp, timeout); - LINUX_CTR4(sys_futex, "futex_sleep enter uaddr %p wp %p timo %d ref %d", - f->f_uaddr, wp, timeout, f->f_refcount); - error = mtx_sleep(wp, &f->f_lck, PCATCH, "futex", timeout); + if (ts != NULL) { + uts = *ts; + if (uts.tv_sec > INT32_MAX / 2) { + over = uts.tv_sec - INT32_MAX / 2; + uts.tv_sec -= over; + } + tmp = tstosbt(uts); + if (TIMESEL(&sbt, tmp)) + sbt += tc_tick_sbt; + sbt += tmp; + prec = tmp; + prec >>= tc_precexp; + } else { + sbt = 0; + prec = 0; + } + LIN_SDT_PROBE3(futex, futex_sleep, entry, f, wp, sbt); + LINUX_CTR4(sys_futex, "futex_sleep enter uaddr %p wp %p timo %ld ref %d", + f->f_uaddr, wp, sbt, f->f_refcount); + + error = msleep_sbt(wp, &f->f_lck, PCATCH, "futex", sbt, prec, C_ABSOLUTE); if (wp->wp_flags & FUTEX_WP_REQUEUED) { KASSERT(f != wp->wp_futex, ("futex != wp_futex")); @@ -597,12 +646,12 @@ futex_requeue(struct futex *f, int n, st } static int -futex_wait(struct futex *f, struct waiting_proc *wp, int timeout_hz, +futex_wait(struct futex *f, struct waiting_proc *wp, struct timespec *ts, uint32_t bitset) { int error; - LIN_SDT_PROBE4(futex, futex_wait, entry, f, wp, timeout_hz, bitset); + LIN_SDT_PROBE4(futex, futex_wait, entry, f, wp, ts, bitset); if (bitset == 0) { LIN_SDT_PROBE1(futex, futex_wait, return, EINVAL); @@ -610,7 +659,7 @@ futex_wait(struct futex *f, struct waiti } f->f_bitset = bitset; - error = futex_sleep(f, wp, timeout_hz); + error = futex_sleep(f, wp, ts); if (error) LIN_SDT_PROBE1(futex, futex_wait, sleep_error, error); if (error == EWOULDBLOCK) @@ -702,10 +751,7 @@ linux_sys_futex(struct thread *td, struc struct linux_pemuldata *pem; struct waiting_proc *wp; struct futex *f, *f2; - struct l_timespec ltimeout; - struct timespec timeout; - struct timeval utv, ctv; - int timeout_hz; + struct timespec uts, *ts; int error, save; uint32_t flags, val; @@ -748,36 +794,17 @@ linux_sys_futex(struct thread *td, struc args->uaddr, args->val, args->val3); if (args->timeout != NULL) { - error = copyin(args->timeout, <imeout, sizeof(ltimeout)); + error = futex_copyin_timeout(args->op, args->timeout, + clockrt, &uts); if (error) { LIN_SDT_PROBE1(futex, linux_sys_futex, copyin_error, error); LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); return (error); } - error = linux_to_native_timespec(&timeout, <imeout); - if (error) - return (error); - TIMESPEC_TO_TIMEVAL(&utv, &timeout); - error = itimerfix(&utv); - if (error) { - LIN_SDT_PROBE1(futex, linux_sys_futex, itimerfix_error, - error); - LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); - return (error); - } - if (clockrt) { - microtime(&ctv); - timevalsub(&utv, &ctv); - } else if (args->op == LINUX_FUTEX_WAIT_BITSET) { - microuptime(&ctv); - timevalsub(&utv, &ctv); - } - if (utv.tv_sec < 0) - timevalclear(&utv); - timeout_hz = tvtohz(&utv); + ts = &uts; } else - timeout_hz = 0; + ts = NULL; retry0: error = futex_get(args->uaddr, &wp, &f, @@ -814,7 +841,7 @@ retry0: return (EWOULDBLOCK); } - error = futex_wait(f, wp, timeout_hz, args->val3); + error = futex_wait(f, wp, ts, args->val3); break; case LINUX_FUTEX_WAKE: From owner-svn-src-head@freebsd.org Sun May 22 12:46:36 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D31AB4532A; Sun, 22 May 2016 12:46:36 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49AF013AC; Sun, 22 May 2016 12:46:36 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MCkZ08076155; Sun, 22 May 2016 12:46:35 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MCkZfH076150; Sun, 22 May 2016 12:46:35 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201605221246.u4MCkZfH076150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin <dchagin@FreeBSD.org> Date: Sun, 22 May 2016 12:46:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300415 - in head/sys: amd64/amd64 i386/i386 powerpc/powerpc sparc64/sparc64 sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 12:46:36 -0000 Author: dchagin Date: Sun May 22 12:46:34 2016 New Revision: 300415 URL: https://svnweb.freebsd.org/changeset/base/300415 Log: Add macro to convert errno and use it when appropriate. MFC after: 1 week Modified: head/sys/amd64/amd64/vm_machdep.c head/sys/i386/i386/vm_machdep.c head/sys/powerpc/powerpc/exec_machdep.c head/sys/sparc64/sparc64/vm_machdep.c head/sys/sys/sysent.h Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Sun May 22 12:37:40 2016 (r300414) +++ head/sys/amd64/amd64/vm_machdep.c Sun May 22 12:46:34 2016 (r300415) @@ -414,13 +414,7 @@ cpu_set_syscall_retval(struct thread *td break; default: - if (td->td_proc->p_sysent->sv_errsize) { - if (error >= td->td_proc->p_sysent->sv_errsize) - error = -1; /* XXX */ - else - error = td->td_proc->p_sysent->sv_errtbl[error]; - } - td->td_frame->tf_rax = error; + td->td_frame->tf_rax = SV_ABI_ERRNO(td->td_proc, error); td->td_frame->tf_rflags |= PSL_C; break; } Modified: head/sys/i386/i386/vm_machdep.c ============================================================================== --- head/sys/i386/i386/vm_machdep.c Sun May 22 12:37:40 2016 (r300414) +++ head/sys/i386/i386/vm_machdep.c Sun May 22 12:46:34 2016 (r300415) @@ -451,13 +451,7 @@ cpu_set_syscall_retval(struct thread *td break; default: - if (td->td_proc->p_sysent->sv_errsize) { - if (error >= td->td_proc->p_sysent->sv_errsize) - error = -1; /* XXX */ - else - error = td->td_proc->p_sysent->sv_errtbl[error]; - } - td->td_frame->tf_eax = error; + td->td_frame->tf_eax = SV_ABI_ERRNO(td->td_proc, error); td->td_frame->tf_eflags |= PSL_C; break; } Modified: head/sys/powerpc/powerpc/exec_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/exec_machdep.c Sun May 22 12:37:40 2016 (r300414) +++ head/sys/powerpc/powerpc/exec_machdep.c Sun May 22 12:46:34 2016 (r300415) @@ -908,11 +908,7 @@ cpu_set_syscall_retval(struct thread *td tf->srr0 -= 4; break; default: - if (p->p_sysent->sv_errsize) { - error = (error < p->p_sysent->sv_errsize) ? - p->p_sysent->sv_errtbl[error] : -1; - } - tf->fixreg[FIRSTARG] = error; + tf->fixreg[FIRSTARG] = SV_ABI_ERRNO(p, error); tf->cr |= 0x10000000; /* Set summary overflow */ break; } Modified: head/sys/sparc64/sparc64/vm_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/vm_machdep.c Sun May 22 12:37:40 2016 (r300414) +++ head/sys/sparc64/sparc64/vm_machdep.c Sun May 22 12:46:34 2016 (r300415) @@ -167,13 +167,7 @@ cpu_set_syscall_retval(struct thread *td break; default: - if (td->td_proc->p_sysent->sv_errsize) { - if (error >= td->td_proc->p_sysent->sv_errsize) - error = -1; /* XXX */ - else - error = td->td_proc->p_sysent->sv_errtbl[error]; - } - td->td_frame->tf_out[0] = error; + td->td_frame->tf_out[0] = SV_ABI_ERRNO(td->td_proc, error); td->td_frame->tf_tstate |= TSTATE_XCC_C; break; } Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Sun May 22 12:37:40 2016 (r300414) +++ head/sys/sys/sysent.h Sun May 22 12:46:34 2016 (r300415) @@ -141,6 +141,8 @@ struct sysentvec { #define SV_TIMEKEEP 0x040000 #define SV_ABI_MASK 0xff +#define SV_ABI_ERRNO(p, e) ((p)->p_sysent->sv_errsize <= 0 ? e : \ + ((e) >= (p)->p_sysent->sv_errsize ? -1 : (p)->p_sysent->sv_errtbl[e])) #define SV_PROC_FLAG(p, x) ((p)->p_sysent->sv_flags & (x)) #define SV_PROC_ABI(p) ((p)->p_sysent->sv_flags & SV_ABI_MASK) #define SV_CURPROC_FLAG(x) SV_PROC_FLAG(curproc, x) From owner-svn-src-head@freebsd.org Sun May 22 12:49:09 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C726EB4552A; Sun, 22 May 2016 12:49:09 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97EEB1887; Sun, 22 May 2016 12:49:09 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MCn80k076511; Sun, 22 May 2016 12:49:08 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MCn8Fb076510; Sun, 22 May 2016 12:49:08 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201605221249.u4MCn8Fb076510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin <dchagin@FreeBSD.org> Date: Sun, 22 May 2016 12:49:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300416 - head/sys/compat/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 12:49:09 -0000 Author: dchagin Date: Sun May 22 12:49:08 2016 New Revision: 300416 URL: https://svnweb.freebsd.org/changeset/base/300416 Log: Add a missing errno translation for SO_ERROR optname. PR: 135458 Reported by: Stefan Schmidt @ stadtbuch.de MFC after: 1 week Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sun May 22 12:46:34 2016 (r300415) +++ head/sys/compat/linux/linux_socket.c Sun May 22 12:49:08 2016 (r300416) @@ -1608,10 +1608,10 @@ linux_getsockopt(struct thread *td, stru } */ bsd_args; l_timeval linux_tv; struct timeval tv; - socklen_t tv_len, xulen; + socklen_t tv_len, xulen, len; struct xucred xu; struct l_ucred lxu; - int error, name; + int error, name, newval; bsd_args.s = args->s; bsd_args.level = linux_to_bsd_sockopt_level(args->level); @@ -1650,6 +1650,15 @@ linux_getsockopt(struct thread *td, stru return (copyout(&lxu, PTRIN(args->optval), sizeof(lxu))); /* NOTREACHED */ break; + case SO_ERROR: + len = sizeof(newval); + error = kern_getsockopt(td, args->s, bsd_args.level, + name, &newval, UIO_SYSSPACE, &len); + if (error) + return (error); + newval = -SV_ABI_ERRNO(td->td_proc, newval); + return (copyout(&newval, PTRIN(args->optval), len)); + /* NOTREACHED */ default: break; } From owner-svn-src-head@freebsd.org Sun May 22 12:59:08 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F428B456FB; Sun, 22 May 2016 12:59:08 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 69A7E1E56; Sun, 22 May 2016 12:59:08 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MCx7RS079482; Sun, 22 May 2016 12:59:07 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MCx7Ot079481; Sun, 22 May 2016 12:59:07 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201605221259.u4MCx7Ot079481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin <bapt@FreeBSD.org> Date: Sun, 22 May 2016 12:59:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300417 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 12:59:08 -0000 Author: bapt Date: Sun May 22 12:59:07 2016 New Revision: 300417 URL: https://svnweb.freebsd.org/changeset/base/300417 Log: Fix typo in comments for the zfsboot script Submitted by: Colby Swandale <colby@taplaboratories.com.au> (via github) Modified: head/usr.sbin/bsdinstall/scripts/zfsboot Modified: head/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- head/usr.sbin/bsdinstall/scripts/zfsboot Sun May 22 12:49:08 2016 (r300416) +++ head/usr.sbin/bsdinstall/scripts/zfsboot Sun May 22 12:59:07 2016 (r300417) @@ -55,7 +55,7 @@ f_include $BSDCFG_SHARE/variable.subr : ${ZFSBOOT_BEROOT_NAME:=ROOT} # -# Default name for the primany boot environment +# Default name for the primary boot environment # : ${ZFSBOOT_BOOTFS_NAME:=default} From owner-svn-src-head@freebsd.org Sun May 22 13:04:46 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D875B45850; Sun, 22 May 2016 13:04:46 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 314951245; Sun, 22 May 2016 13:04:46 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MD4jwD082493; Sun, 22 May 2016 13:04:45 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MD4j6H082492; Sun, 22 May 2016 13:04:45 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201605221304.u4MD4j6H082492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin <bapt@FreeBSD.org> Date: Sun, 22 May 2016 13:04:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300418 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 13:04:46 -0000 Author: bapt Date: Sun May 22 13:04:45 2016 New Revision: 300418 URL: https://svnweb.freebsd.org/changeset/base/300418 Log: Fix typos in the comments Submitted by: cipherwraith666@gmail.com (via github) Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Sun May 22 12:59:07 2016 (r300417) +++ head/sys/kern/uipc_socket.c Sun May 22 13:04:45 2016 (r300418) @@ -550,7 +550,7 @@ SYSCTL_INT(_regression, OID_AUTO, sonewc /* * When an attempt at a new connection is noted on a socket which accepts * connections, sonewconn is called. If the connection is possible (subject - * to space constraints, etc.) then we allocate a new structure, propoerly + * to space constraints, etc.) then we allocate a new structure, properly * linked into the data structure of the original socket, and return this. * Connstatus may be 0, or SS_ISCONFIRMING, or SS_ISCONNECTED. * @@ -1164,7 +1164,7 @@ sosend_dgram(struct socket *so, struct s } /* * XXX all the SBS_CANTSENDMORE checks previously done could be out - * of date. We could have received a reset packet in an interrupt or + * of date. We could have recived a reset packet in an interrupt or * maybe we slept while doing page faults in uiomove() etc. We could * probably recheck again inside the locking protection here, but * there are probably other places that this also happens. We must @@ -2711,7 +2711,7 @@ sooptcopyout(struct sockopt *sopt, const * that we always tell the user precisely how much we copied, rather * than something useful like the total amount we had available for * her. Note that this interface is not idempotent; the entire - * answer must generated ahead of time. + * answer must be generated ahead of time. */ valsize = min(len, sopt->sopt_valsize); sopt->sopt_valsize = valsize; From owner-svn-src-head@freebsd.org Sun May 22 13:10:49 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E895B458C4; Sun, 22 May 2016 13:10:49 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12530145A; Sun, 22 May 2016 13:10:49 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MDAmpE082738; Sun, 22 May 2016 13:10:48 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MDAmub082737; Sun, 22 May 2016 13:10:48 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201605221310.u4MDAmub082737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin <bapt@FreeBSD.org> Date: Sun, 22 May 2016 13:10:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300419 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 13:10:49 -0000 Author: bapt Date: Sun May 22 13:10:48 2016 New Revision: 300419 URL: https://svnweb.freebsd.org/changeset/base/300419 Log: Fix typo introduced by me (not the submitter) when fixing typos Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Sun May 22 13:04:45 2016 (r300418) +++ head/sys/kern/uipc_socket.c Sun May 22 13:10:48 2016 (r300419) @@ -1164,7 +1164,7 @@ sosend_dgram(struct socket *so, struct s } /* * XXX all the SBS_CANTSENDMORE checks previously done could be out - * of date. We could have recived a reset packet in an interrupt or + * of date. We could have received a reset packet in an interrupt or * maybe we slept while doing page faults in uiomove() etc. We could * probably recheck again inside the locking protection here, but * there are probably other places that this also happens. We must From owner-svn-src-head@freebsd.org Sun May 22 13:32:46 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDD8EB45DD5; Sun, 22 May 2016 13:32:46 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85ED61F3B; Sun, 22 May 2016 13:32:46 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MDWjUI091278; Sun, 22 May 2016 13:32:45 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MDWjGn091277; Sun, 22 May 2016 13:32:45 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201605221332.u4MDWjGn091277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker <jilles@FreeBSD.org> Date: Sun, 22 May 2016 13:32:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300420 - head/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 13:32:46 -0000 Author: jilles Date: Sun May 22 13:32:45 2016 New Revision: 300420 URL: https://svnweb.freebsd.org/changeset/base/300420 Log: vfork(2): Mention some risks of calling vfork() from application code. MFC after: 1 week Modified: head/lib/libc/sys/vfork.2 Modified: head/lib/libc/sys/vfork.2 ============================================================================== --- head/lib/libc/sys/vfork.2 Sun May 22 13:10:48 2016 (r300419) +++ head/lib/libc/sys/vfork.2 Sun May 22 13:32:45 2016 (r300420) @@ -28,7 +28,7 @@ .\" @(#)vfork.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 6, 2015 +.Dd May 22, 2016 .Dt VFORK 2 .Os .Sh NAME @@ -41,11 +41,20 @@ .Ft pid_t .Fn vfork void .Sh DESCRIPTION +.Bf -symbolic +Since this function is hard to use correctly from application software, +it is recommended to use +.Xr posix_spawn 3 +or +.Xr fork 2 +instead. +.Ef +.Pp The .Fn vfork system call can be used to create new processes without fully copying the address -space of the old process, which is horrendously inefficient in a paged +space of the old process, which is inefficient in a paged environment. It is useful when the purpose of .Xr fork 2 @@ -56,13 +65,15 @@ The system call differs from .Xr fork 2 -in that the child borrows the parent's memory and thread of -control until a call to +in that the child borrows the parent process's address space and the +calling thread's stack +until a call to .Xr execve 2 or an exit (either by a call to .Xr _exit 2 or abnormally). -The parent process is suspended while the child is using its resources. +The calling thread is suspended while the child is using its resources. +Other threads continue to run. .Pp The .Fn vfork @@ -70,17 +81,21 @@ system call returns 0 in the child's context and (later) the pid of the child in the parent's context. .Pp -The -.Fn vfork -system call -can normally be used just like -.Xr fork 2 . -It does not work, however, to return while running in the child's context +Many problems can occur when replacing +.Xr fork 2 +with +.Fn vfork . +For example, it does not work to return while running in the child's context from the procedure that called .Fn vfork since the eventual return from .Fn vfork would then return to a no longer existent stack frame. +Also, changing process state which is partially implemented in user space +such as signal handlers with +.Xr libthr 3 +will corrupt the parent's state. +.Pp Be careful, also, to call .Xr _exit 2 rather than @@ -106,7 +121,8 @@ Same as for .Xr rfork 2 , .Xr sigaction 2 , .Xr wait 2 , -.Xr exit 3 +.Xr exit 3 , +.Xr posix_spawn 3 .Sh HISTORY The .Fn vfork From owner-svn-src-head@freebsd.org Sun May 22 13:58:35 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CFD5B451C0; Sun, 22 May 2016 13:58:35 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8AC31A93; Sun, 22 May 2016 13:58:34 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MDwYkd097525; Sun, 22 May 2016 13:58:34 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MDwW8u097510; Sun, 22 May 2016 13:58:32 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201605221358.u4MDwW8u097510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza <loos@FreeBSD.org> Date: Sun, 22 May 2016 13:58:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 13:58:35 -0000 Author: loos Date: Sun May 22 13:58:32 2016 New Revision: 300421 URL: https://svnweb.freebsd.org/changeset/base/300421 Log: Fix the deciKelvin to Celsius conversion in kernel. After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as 0C reference and as result, the temperature read in sysctl(8) now exibits a +0.1C difference. This commit fix the kernel references to match the reference value used in sysctl(8) after r285994. Sponsored by: Rubicon Communications (Netgate) Modified: head/sys/arm/allwinner/axp209.c head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c head/sys/arm/freescale/imx/imx6_anatop.c head/sys/arm/mv/mv_ts.c head/sys/dev/acpi_support/acpi_asus_wmi.c head/sys/dev/acpi_support/acpi_ibm.c head/sys/dev/acpi_support/atk0110.c head/sys/dev/acpica/acpi_thermal.c head/sys/dev/amdtemp/amdtemp.c head/sys/dev/coretemp/coretemp.c head/sys/dev/iicbus/ds3231reg.h head/sys/dev/iicbus/lm75.c head/sys/powerpc/powermac/powermac_thermal.h head/sys/powerpc/powermac/smu.c head/sys/powerpc/powermac/smusat.c Modified: head/sys/arm/allwinner/axp209.c ============================================================================== --- head/sys/arm/allwinner/axp209.c Sun May 22 13:32:45 2016 (r300420) +++ head/sys/arm/allwinner/axp209.c Sun May 22 13:58:32 2016 (r300421) @@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$"); #define AXP209_TEMPMON_L(a) ((a) & 0xf) #define AXP209_TEMPMON_MIN 1447 /* -144.7C */ -#define AXP209_0C_TO_K 2732 +#define AXP209_0C_TO_K 2731 struct axp209_softc { uint32_t addr; Modified: head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Sun May 22 13:32:45 2016 (r300420) +++ head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Sun May 22 13:58:32 2016 (r300421) @@ -82,7 +82,7 @@ __FBSDID("$FreeBSD$"); #define MSG_ERROR -999999999 #define MHZSTEP 100 #define HZSTEP (MHZ2HZ(MHZSTEP)) -#define TZ_ZEROC 2732 +#define TZ_ZEROC 2731 #define VC_LOCK(sc) do { \ sema_wait(&vc_sema); \ Modified: head/sys/arm/freescale/imx/imx6_anatop.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_anatop.c Sun May 22 13:32:45 2016 (r300420) +++ head/sys/arm/freescale/imx/imx6_anatop.c Sun May 22 13:58:32 2016 (r300421) @@ -139,7 +139,7 @@ static struct oppt { */ static uint32_t imx6_ocotp_mhz_tab[] = {792, 852, 996, 1200}; -#define TZ_ZEROC 2732 /* deci-Kelvin <-> deci-Celcius offset. */ +#define TZ_ZEROC 2731 /* deci-Kelvin <-> deci-Celcius offset. */ uint32_t imx6_anatop_read_4(bus_size_t offset) Modified: head/sys/arm/mv/mv_ts.c ============================================================================== --- head/sys/arm/mv/mv_ts.c Sun May 22 13:32:45 2016 (r300420) +++ head/sys/arm/mv/mv_ts.c Sun May 22 13:58:32 2016 (r300421) @@ -80,7 +80,7 @@ ts_probe(device_t dev) #define MV_TEMP_SENS_OFFS 10 #define MV_TEMP_SENS_MASK 0x1ff #define MV_TEMP_SENS_READ_MAX 16 -#define TZ_ZEROC 2732 +#define TZ_ZEROC 2731 #define MV_TEMP_CONVERT(x) ((((322 - x) * 100000) / 13625) + TZ_ZEROC) /* Modified: head/sys/dev/acpi_support/acpi_asus_wmi.c ============================================================================== --- head/sys/dev/acpi_support/acpi_asus_wmi.c Sun May 22 13:32:45 2016 (r300420) +++ head/sys/dev/acpi_support/acpi_asus_wmi.c Sun May 22 13:58:32 2016 (r300421) @@ -498,7 +498,7 @@ acpi_asus_wmi_sysctl_get(struct acpi_asu switch(dev_id) { case ASUS_WMI_DEVID_THERMAL_CTRL: - val = (val - 2732 + 5) / 10; + val = (val - 2731 + 5) / 10; break; case ASUS_WMI_DEVID_PROCESSOR_STATE: case ASUS_WMI_DEVID_FAN_CTRL: Modified: head/sys/dev/acpi_support/acpi_ibm.c ============================================================================== --- head/sys/dev/acpi_support/acpi_ibm.c Sun May 22 13:32:45 2016 (r300420) +++ head/sys/dev/acpi_support/acpi_ibm.c Sun May 22 13:58:32 2016 (r300421) @@ -941,7 +941,7 @@ acpi_ibm_thermal_sysctl(SYSCTL_HANDLER_A temp[i] = -1; else if (sc->thermal_updt_supported) /* Temperature is reported in tenth of Kelvin */ - temp[i] = (temp[i] - 2732 + 5) / 10; + temp[i] = (temp[i] - 2731 + 5) / 10; } error = sysctl_handle_opaque(oidp, &temp, 8*sizeof(int), req); Modified: head/sys/dev/acpi_support/atk0110.c ============================================================================== --- head/sys/dev/acpi_support/atk0110.c Sun May 22 13:32:45 2016 (r300420) +++ head/sys/dev/acpi_support/atk0110.c Sun May 22 13:58:32 2016 (r300421) @@ -344,9 +344,9 @@ aibs_sysctl(SYSCTL_HANDLER_ARGS) case AIBS_VOLT: break; case AIBS_TEMP: - v += 2732; - l += 2732; - h += 2732; + v += 2731; + l += 2731; + h += 2731; break; case AIBS_FAN: break; Modified: head/sys/dev/acpica/acpi_thermal.c ============================================================================== --- head/sys/dev/acpica/acpi_thermal.c Sun May 22 13:32:45 2016 (r300420) +++ head/sys/dev/acpica/acpi_thermal.c Sun May 22 13:58:32 2016 (r300421) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #define _COMPONENT ACPI_THERMAL ACPI_MODULE_NAME("THERMAL") -#define TZ_ZEROC 2732 +#define TZ_ZEROC 2731 #define TZ_KELVTOC(x) (((x) - TZ_ZEROC) / 10), abs(((x) - TZ_ZEROC) % 10) #define TZ_NOTIFY_TEMPERATURE 0x80 /* Temperature changed. */ Modified: head/sys/dev/amdtemp/amdtemp.c ============================================================================== --- head/sys/dev/amdtemp/amdtemp.c Sun May 22 13:32:45 2016 (r300420) +++ head/sys/dev/amdtemp/amdtemp.c Sun May 22 13:58:32 2016 (r300421) @@ -505,7 +505,7 @@ amdtemp_sysctl(SYSCTL_HANDLER_ARGS) return (error); } -#define AMDTEMP_ZERO_C_TO_K 2732 +#define AMDTEMP_ZERO_C_TO_K 2731 static int32_t amdtemp_gettemp0f(device_t dev, amdsensor_t sensor) Modified: head/sys/dev/coretemp/coretemp.c ============================================================================== --- head/sys/dev/coretemp/coretemp.c Sun May 22 13:32:45 2016 (r300420) +++ head/sys/dev/coretemp/coretemp.c Sun May 22 13:58:32 2016 (r300421) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #include <machine/cputypes.h> #include <machine/md_var.h> -#define TZ_ZEROC 2732 +#define TZ_ZEROC 2731 #define THERM_STATUS_LOG 0x02 #define THERM_STATUS 0x01 Modified: head/sys/dev/iicbus/ds3231reg.h ============================================================================== --- head/sys/dev/iicbus/ds3231reg.h Sun May 22 13:32:45 2016 (r300420) +++ head/sys/dev/iicbus/ds3231reg.h Sun May 22 13:58:32 2016 (r300421) @@ -73,6 +73,6 @@ #define DS3231_0250C 0x40 #define DS3231_MSB 0x8000 #define DS3231_NEG_BIT DS3231_MSB -#define TZ_ZEROC 2732 +#define TZ_ZEROC 2731 #endif /* _DS3231REG_H_ */ Modified: head/sys/dev/iicbus/lm75.c ============================================================================== --- head/sys/dev/iicbus/lm75.c Sun May 22 13:32:45 2016 (r300420) +++ head/sys/dev/iicbus/lm75.c Sun May 22 13:58:32 2016 (r300421) @@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$"); #define LM75_0125C 0x20 #define LM75_MSB 0x8000 #define LM75_NEG_BIT LM75_MSB -#define TZ_ZEROC 2732 +#define TZ_ZEROC 2731 /* LM75 supported models. */ #define HWTYPE_LM75 1 Modified: head/sys/powerpc/powermac/powermac_thermal.h ============================================================================== --- head/sys/powerpc/powermac/powermac_thermal.h Sun May 22 13:32:45 2016 (r300420) +++ head/sys/powerpc/powermac/powermac_thermal.h Sun May 22 13:58:32 2016 (r300421) @@ -29,7 +29,7 @@ #ifndef _POWERPC_POWERMAC_POWERMAC_THERMAL_H #define _POWERPC_POWERMAC_POWERMAC_THERMAL_H -#define ZERO_C_TO_K 2732 +#define ZERO_C_TO_K 2731 struct pmac_fan { int min_rpm, max_rpm, default_rpm; Modified: head/sys/powerpc/powermac/smu.c ============================================================================== --- head/sys/powerpc/powermac/smu.c Sun May 22 13:32:45 2016 (r300420) +++ head/sys/powerpc/powermac/smu.c Sun May 22 13:58:32 2016 (r300421) @@ -1110,7 +1110,7 @@ smu_sensor_read(struct smu_sensor *sens) value <<= 1; /* Convert from 16.16 fixed point degC into integer 0.1 K. */ - value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2732; + value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2731; break; case SMU_VOLTAGE_SENSOR: value *= sc->sc_cpu_volt_scale; @@ -1245,8 +1245,8 @@ smu_attach_sensors(device_t dev, phandle if (sens->type == SMU_TEMP_SENSOR) { /* Make up some numbers */ - sens->therm.target_temp = 500 + 2732; /* 50 C */ - sens->therm.max_temp = 900 + 2732; /* 90 C */ + sens->therm.target_temp = 500 + 2731; /* 50 C */ + sens->therm.max_temp = 900 + 2731; /* 90 C */ sens->therm.read = (int (*)(struct pmac_therm *))smu_sensor_read; Modified: head/sys/powerpc/powermac/smusat.c ============================================================================== --- head/sys/powerpc/powermac/smusat.c Sun May 22 13:32:45 2016 (r300420) +++ head/sys/powerpc/powermac/smusat.c Sun May 22 13:58:32 2016 (r300421) @@ -184,8 +184,8 @@ smusat_attach(device_t dev) if (sens->type == SMU_TEMP_SENSOR) { /* Make up some numbers */ - sens->therm.target_temp = 500 + 2732; /* 50 C */ - sens->therm.max_temp = 900 + 2732; /* 90 C */ + sens->therm.target_temp = 500 + 2731; /* 50 C */ + sens->therm.max_temp = 900 + 2731; /* 90 C */ sens->therm.read = (int (*)(struct pmac_therm *))smusat_sensor_read; pmac_thermal_sensor_register(&sens->therm); @@ -248,7 +248,7 @@ smusat_sensor_read(struct smu_sensor *se /* 16.16 */ value <<= 10; /* From 16.16 to 0.1 C */ - value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2732; + value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2731; break; case SMU_VOLTAGE_SENSOR: /* 16.16 */ From owner-svn-src-head@freebsd.org Sun May 22 14:13:21 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3643B456F6; Sun, 22 May 2016 14:13:21 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5AFF12D1; Sun, 22 May 2016 14:13:21 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MEDKoa003582; Sun, 22 May 2016 14:13:20 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MEDKYR003581; Sun, 22 May 2016 14:13:20 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201605221413.u4MEDKYR003581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" <pfg@FreeBSD.org> Date: Sun, 22 May 2016 14:13:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300422 - head/sys/compat/ndis X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 14:13:22 -0000 Author: pfg Date: Sun May 22 14:13:20 2016 New Revision: 300422 URL: https://svnweb.freebsd.org/changeset/base/300422 Log: ndis(4): Undo unneeded workarounds in ndis' rand(). - Revert the change for seed(0) in r300384. I misunderstood the standard and while our random() implementation in libkern may be improved, it handles the seed(0) case fine. Pointed out by: bde, ache Modified: head/sys/compat/ndis/subr_ntoskrnl.c Modified: head/sys/compat/ndis/subr_ntoskrnl.c ============================================================================== --- head/sys/compat/ndis/subr_ntoskrnl.c Sun May 22 13:58:32 2016 (r300421) +++ head/sys/compat/ndis/subr_ntoskrnl.c Sun May 22 14:13:20 2016 (r300422) @@ -3196,8 +3196,6 @@ static void srand(unsigned int seed) { - if (seed == 0) - seed = 1; srandom(seed); } From owner-svn-src-head@freebsd.org Sun May 22 14:31:21 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2E5AB45916; Sun, 22 May 2016 14:31:21 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90CB21A43; Sun, 22 May 2016 14:31:21 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MEVK0N007528; Sun, 22 May 2016 14:31:20 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MEVKXC007524; Sun, 22 May 2016 14:31:20 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201605221431.u4MEVKXC007524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo <kevlo@FreeBSD.org> Date: Sun, 22 May 2016 14:31:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300423 - in head/sys: fs/ext2fs ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 14:31:21 -0000 Author: kevlo Date: Sun May 22 14:31:20 2016 New Revision: 300423 URL: https://svnweb.freebsd.org/changeset/base/300423 Log: arc4random() returns 0 to (2**32)−1, use an alternative to initialize i_gen if it's zero rather than a divide by 2. With inputs from delphij, mckusick, rmacklem Reviewed by: mckusick Modified: head/sys/fs/ext2fs/ext2_alloc.c head/sys/fs/ext2fs/ext2_vfsops.c head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_alloc.c Sun May 22 14:13:20 2016 (r300422) +++ head/sys/fs/ext2fs/ext2_alloc.c Sun May 22 14:31:20 2016 (r300423) @@ -408,7 +408,8 @@ ext2_valloc(struct vnode *pvp, int mode, /* * Set up a new generation number for this inode. */ - ip->i_gen = arc4random(); + while (ip->i_gen == 0 || ++ip->i_gen == 0) + ip->i_gen = arc4random(); vfs_timestamp(&ts); ip->i_birthtime = ts.tv_sec; Modified: head/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vfsops.c Sun May 22 14:13:20 2016 (r300422) +++ head/sys/fs/ext2fs/ext2_vfsops.c Sun May 22 14:31:20 2016 (r300423) @@ -998,7 +998,8 @@ ext2_vget(struct mount *mp, ino_t ino, i * already have one. This should only happen on old filesystems. */ if (ip->i_gen == 0) { - ip->i_gen = random() + 1; + while (ip->i_gen == 0) + ip->i_gen = arc4random(); if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) ip->i_flag |= IN_MODIFIED; } Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Sun May 22 14:13:20 2016 (r300422) +++ head/sys/ufs/ffs/ffs_alloc.c Sun May 22 14:31:20 2016 (r300423) @@ -1102,8 +1102,8 @@ dup_alloc: /* * Set up a new generation number for this inode. */ - if (ip->i_gen == 0 || ++ip->i_gen == 0) - ip->i_gen = arc4random() / 2 + 1; + while (ip->i_gen == 0 || ++ip->i_gen == 0) + ip->i_gen = arc4random(); DIP_SET(ip, i_gen, ip->i_gen); if (fs->fs_magic == FS_UFS2_MAGIC) { vfs_timestamp(&ts); @@ -2080,7 +2080,8 @@ gotit: bzero(ibp->b_data, (int)fs->fs_bsize); dp2 = (struct ufs2_dinode *)(ibp->b_data); for (i = 0; i < INOPB(fs); i++) { - dp2->di_gen = arc4random() / 2 + 1; + while (dp2->di_gen == 0) + dp2->di_gen = arc4random(); dp2++; } /* Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Sun May 22 14:13:20 2016 (r300422) +++ head/sys/ufs/ffs/ffs_vfsops.c Sun May 22 14:31:20 2016 (r300423) @@ -1768,7 +1768,8 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags * already have one. This should only happen on old filesystems. */ if (ip->i_gen == 0) { - ip->i_gen = arc4random() / 2 + 1; + while (ip->i_gen == 0) + ip->i_gen = arc4random(); if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) { ip->i_flag |= IN_MODIFIED; DIP_SET(ip, i_gen, ip->i_gen); From owner-svn-src-head@freebsd.org Sun May 22 15:22:46 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2FC5B4557A; Sun, 22 May 2016 15:22:46 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B338A107A; Sun, 22 May 2016 15:22:46 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MFMjYZ024748; Sun, 22 May 2016 15:22:45 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MFMjrj024747; Sun, 22 May 2016 15:22:45 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201605221522.u4MFMjrj024747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" <ache@FreeBSD.org> Date: Sun, 22 May 2016 15:22:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300424 - head/sys/dev/cpuctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 15:22:47 -0000 Author: ache Date: Sun May 22 15:22:45 2016 New Revision: 300424 URL: https://svnweb.freebsd.org/changeset/base/300424 Log: Improve panic message by specifying on which cpu it really is. Modified: head/sys/dev/cpuctl/cpuctl.c Modified: head/sys/dev/cpuctl/cpuctl.c ============================================================================== --- head/sys/dev/cpuctl/cpuctl.c Sun May 22 14:31:20 2016 (r300423) +++ head/sys/dev/cpuctl/cpuctl.c Sun May 22 15:22:45 2016 (r300424) @@ -126,7 +126,7 @@ set_cpu(int cpu, struct thread *td) sched_bind(td, cpu); thread_unlock(td); KASSERT(td->td_oncpu == cpu, - ("[cpuctl,%d]: cannot bind to target cpu %d", __LINE__, cpu)); + ("[cpuctl,%d]: cannot bind to target cpu %d on cpu %d", __LINE__, cpu, td->td_oncpu)); } static void From owner-svn-src-head@freebsd.org Sun May 22 16:24:23 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13389B45FF5; Sun, 22 May 2016 16:24:23 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3B261A99; Sun, 22 May 2016 16:24:22 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MGOLVf043429; Sun, 22 May 2016 16:24:21 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MGOLou043428; Sun, 22 May 2016 16:24:21 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201605221624.u4MGOLou043428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude <allanjude@FreeBSD.org> Date: Sun, 22 May 2016 16:24:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300425 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 16:24:23 -0000 Author: allanjude Date: Sun May 22 16:24:21 2016 New Revision: 300425 URL: https://svnweb.freebsd.org/changeset/base/300425 Log: Fix default ZFS layout to work better by default with sysutils/beadm The root file system is mounted early via vfs.root.mountfrom. The canmount=noauto property only affects the zfs rc.d script. This ensures that the 'default' BE is not mounted overtop of another BE when one is selected from the beastie menu Sponsored by: ScaleEngine Inc. Modified: head/usr.sbin/bsdinstall/scripts/zfsboot Modified: head/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- head/usr.sbin/bsdinstall/scripts/zfsboot Sun May 22 15:22:45 2016 (r300424) +++ head/usr.sbin/bsdinstall/scripts/zfsboot Sun May 22 16:24:21 2016 (r300425) @@ -143,7 +143,7 @@ f_isset ZFSBOOT_DATASETS || ZFSBOOT_DATA # Boot Environment [BE] root and default boot dataset /$ZFSBOOT_BEROOT_NAME mountpoint=none - /$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME mountpoint=/ + /$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME mountpoint=/,canmount=noauto # Compress /tmp, allow exec but not setuid /tmp mountpoint=/tmp,exec=on,setuid=off From owner-svn-src-head@freebsd.org Sun May 22 18:16:27 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E0ACB45BE9; Sun, 22 May 2016 18:16:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06CC010F5; Sun, 22 May 2016 18:16:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MIGQ9i077481; Sun, 22 May 2016 18:16:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MIGQDo077479; Sun, 22 May 2016 18:16:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605221816.u4MIGQDo077479@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov <kib@FreeBSD.org> Date: Sun, 22 May 2016 18:16:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300427 - in head/sys/fs: cd9660 udf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 18:16:27 -0000 Author: kib Date: Sun May 22 18:16:25 2016 New Revision: 300427 URL: https://svnweb.freebsd.org/changeset/base/300427 Log: Remove drop/reacquire of Giant around geom calls for cd9660 and udf. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/fs/cd9660/cd9660_vfsops.c head/sys/fs/udf/udf_vfsops.c Modified: head/sys/fs/cd9660/cd9660_vfsops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vfsops.c Sun May 22 18:16:04 2016 (r300426) +++ head/sys/fs/cd9660/cd9660_vfsops.c Sun May 22 18:16:25 2016 (r300427) @@ -226,11 +226,9 @@ iso_mountfs(devvp, mp) dev = devvp->v_rdev; dev_ref(dev); - DROP_GIANT(); g_topology_lock(); error = g_vfs_open(devvp, &cp, "cd9660", 0); g_topology_unlock(); - PICKUP_GIANT(); VOP_UNLOCK(devvp, 0); if (error) goto out; @@ -481,11 +479,9 @@ out: if (supbp != NULL) brelse(supbp); if (cp != NULL) { - DROP_GIANT(); g_topology_lock(); g_vfs_close(cp); g_topology_unlock(); - PICKUP_GIANT(); } if (isomp) { free(isomp, M_ISOFSMNT); @@ -519,11 +515,9 @@ cd9660_unmount(mp, mntflags) if (isomp->im_l2d) cd9660_iconv->close(isomp->im_l2d); } - DROP_GIANT(); g_topology_lock(); g_vfs_close(isomp->im_cp); g_topology_unlock(); - PICKUP_GIANT(); vrele(isomp->im_devvp); dev_rel(isomp->im_dev); free(isomp, M_ISOFSMNT); Modified: head/sys/fs/udf/udf_vfsops.c ============================================================================== --- head/sys/fs/udf/udf_vfsops.c Sun May 22 18:16:04 2016 (r300426) +++ head/sys/fs/udf/udf_vfsops.c Sun May 22 18:16:25 2016 (r300427) @@ -325,11 +325,9 @@ udf_mountfs(struct vnode *devvp, struct dev = devvp->v_rdev; dev_ref(dev); - DROP_GIANT(); g_topology_lock(); error = g_vfs_open(devvp, &cp, "udf", 0); g_topology_unlock(); - PICKUP_GIANT(); VOP_UNLOCK(devvp, 0); if (error) goto bail; @@ -500,11 +498,9 @@ bail: if (bp != NULL) brelse(bp); if (cp != NULL) { - DROP_GIANT(); g_topology_lock(); g_vfs_close(cp); g_topology_unlock(); - PICKUP_GIANT(); } dev_rel(dev); return error; @@ -533,11 +529,9 @@ udf_unmount(struct mount *mp, int mntfla #endif } - DROP_GIANT(); g_topology_lock(); g_vfs_close(udfmp->im_cp); g_topology_unlock(); - PICKUP_GIANT(); vrele(udfmp->im_devvp); dev_rel(udfmp->im_dev); From owner-svn-src-head@freebsd.org Sun May 22 18:20:46 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED564B45DD1; Sun, 22 May 2016 18:20:46 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BAFC113D2; Sun, 22 May 2016 18:20:46 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MIKj74079665; Sun, 22 May 2016 18:20:45 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MIKjDd079664; Sun, 22 May 2016 18:20:45 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605221820.u4MIKjDd079664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper <ngie@FreeBSD.org> Date: Sun, 22 May 2016 18:20:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300428 - head/usr.bin/kdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 18:20:47 -0000 Author: ngie Date: Sun May 22 18:20:45 2016 New Revision: 300428 URL: https://svnweb.freebsd.org/changeset/base/300428 Log: Fix humanized decoding of struct stat with respect to .st_mtim st_mtim was being incorrectly described as "stime=", not "mtime=". This was introduced with the original feature commit (r176471). MFC after: 1 week PR: 209699 Submitted by: naddy Sponsored by: EMC / Isilon Storage Division Modified: head/usr.bin/kdump/kdump.c Modified: head/usr.bin/kdump/kdump.c ============================================================================== --- head/usr.bin/kdump/kdump.c Sun May 22 18:16:25 2016 (r300427) +++ head/usr.bin/kdump/kdump.c Sun May 22 18:20:45 2016 (r300428) @@ -1688,7 +1688,7 @@ ktrstat(struct stat *statp) printf(".%09ld, ", statp->st_atim.tv_nsec); else printf(", "); - printf("stime="); + printf("mtime="); if (resolv == 0) printf("%jd", (intmax_t)statp->st_mtim.tv_sec); else { From owner-svn-src-head@freebsd.org Sun May 22 18:51:38 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E3E7B457F6; Sun, 22 May 2016 18:51:38 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp003.me.com (mr11p00im-asmtp003.me.com [17.110.69.254]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5DC0317A2; Sun, 22 May 2016 18:51:38 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.mr11p00im-asmtp003.me.com by mr11p00im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.36.0 64bit (built Sep 8 2015)) id <0O7L00300DOMTK00@mr11p00im-asmtp003.me.com>; Sun, 22 May 2016 18:51:32 +0000 (GMT) Received: from [192.168.1.4] (c-67-169-142-6.hsd1.ca.comcast.net [67.169.142.6]) by mr11p00im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.36.0 64bit (built Sep 8 2015)) with ESMTPSA id <0O7L004EDDPUPC30@mr11p00im-asmtp003.me.com>; Sun, 22 May 2016 18:51:31 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-05-22_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510270003 definitions=main-1605220246 User-Agent: Microsoft-MacOutlook/f.16.0.160506 Date: Sun, 22 May 2016 11:51:37 -0700 Subject: Re: svn commit: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac From: Ravi Pokala <rpokala@mac.com> Sender: "Pokala, Ravi" <rpokala@panasas.com> To: Luiz Otavio O Souza <loos@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: <C66E915D-A4D7-4591-AF6C-0949AF184271@panasas.com> Thread-topic: svn commit: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac References: <201605221358.u4MDwW8u097510@repo.freebsd.org> In-reply-to: <201605221358.u4MDwW8u097510@repo.freebsd.org> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=4d515a; t=1463943092; bh=yAGSMmFeMzoe+4Hql8WSB1MK8oqC+x0heJ5z/yaa548=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=gNow/NPSnlTCJ7nAIBFWF0rd2ivQyy4hrSBLDS956ZhvKXOkZi9DXyYgst8y4MG14 WglEHdtXy3tyCSU8QtYzZ9RC9Bu0PqFBF0PsP2kTPE/b0sJgWafTSu3kaK9usKnrH5 r+fneU1CZb9w6KaUtXGNOlMGq9HsVwP1Aoxo5gmP29oVKjKzdSZZ2kkupGama0T84F RY3nbDNtA7xLJj4ZOEsoI5TJrAthWNqYG2JW9bdGxSdRA6ynbrk/MLgpIv6xJwB/0Y OdKqU6wYPJHrYdIN/ENDSyQbtf+tDDPm5GL4TD8b6xqAJ6YAZ1PGdkKVKf8TpxGjSl RUlq68OCfDQWA== X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 18:51:38 -0000 -----Original Message----- From: <owner-src-committers@freebsd.org> on behalf of Luiz Otavio O Souza <loos@FreeBSD.org> Date: 2016-05-22, Sunday at 06:58 To: <src-committers@freebsd.org>, <svn-src-all@freebsd.org>, <svn-src-head@freebsd.org> Subject: svn commit: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac >Author: loos >Date: Sun May 22 13:58:32 2016 >New Revision: 300421 >URL: https://svnweb.freebsd.org/changeset/base/300421 > >Log: > Fix the deciKelvin to Celsius conversion in kernel. > > After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as 0C > reference and as result, the temperature read in sysctl(8) now exibits a > +0.1C difference. Out of morbid curiosity, why do these things report in deciKelvin anyway? Are there sensors we support out there which report native Kelvin, or that report sub-degree precision? Thanks, Ravi (rpokala@) From owner-svn-src-head@freebsd.org Sun May 22 19:04:36 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13027B45C62; Sun, 22 May 2016 19:04:36 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4CAF1FCC; Sun, 22 May 2016 19:04:35 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MJ4YNf092344; Sun, 22 May 2016 19:04:34 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MJ4YbY092343; Sun, 22 May 2016 19:04:34 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201605221904.u4MJ4YbY092343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin <dchagin@FreeBSD.org> Date: Sun, 22 May 2016 19:04:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300429 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 19:04:36 -0000 Author: dchagin Date: Sun May 22 19:04:34 2016 New Revision: 300429 URL: https://svnweb.freebsd.org/changeset/base/300429 Log: Remove a now unused global declaration of some sysentvec struct. MFC after: 2 week Modified: head/sys/sys/sysent.h Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Sun May 22 18:20:45 2016 (r300428) +++ head/sys/sys/sysent.h Sun May 22 19:04:34 2016 (r300429) @@ -155,8 +155,6 @@ struct sysentvec { #ifdef _KERNEL extern struct sysentvec aout_sysvec; -extern struct sysentvec elf_freebsd_sysvec; -extern struct sysentvec null_sysvec; extern struct sysent sysent[]; extern const char *syscallnames[]; From owner-svn-src-head@freebsd.org Sun May 22 19:06:39 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3714FB45CFB; Sun, 22 May 2016 19:06:39 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 077951168; Sun, 22 May 2016 19:06:38 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MJ6chF092458; Sun, 22 May 2016 19:06:38 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MJ6cMA092457; Sun, 22 May 2016 19:06:38 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605221906.u4MJ6cMA092457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper <ngie@FreeBSD.org> Date: Sun, 22 May 2016 19:06:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300430 - head/usr.sbin/rpc.yppasswdd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 19:06:39 -0000 Author: ngie Date: Sun May 22 19:06:38 2016 New Revision: 300430 URL: https://svnweb.freebsd.org/changeset/base/300430 Log: Wrap EXPAND(..) macro with a do-while(0) loop and put a single statement on each line As a positive side-effect, this eliminates the double semicolons reported by Coverity: the macro contained a trailing semicolon, in addition to the semicolon placed on each line where EXPAND(..) was called. MFC after: 1 week Reported by: Coverity CID: 1194269 Sponsored by: EMC / Isilon Storage Division Modified: head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c Modified: head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c ============================================================================== --- head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c Sun May 22 19:04:34 2016 (r300429) +++ head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c Sun May 22 19:06:38 2016 (r300430) @@ -103,7 +103,10 @@ copy_yp_pass(char *p, int x, int m) } t = buf; -#define EXPAND(e) e = t; while ((*t++ = *p++)); +#define EXPAND(e) do { \ + e = t; \ + while ((*t++ = *p++)); \ +} while (0) EXPAND(yp_password.pw_name); yp_password.pw_fields |= _PWF_NAME; EXPAND(yp_password.pw_passwd); From owner-svn-src-head@freebsd.org Sun May 22 19:08:30 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7A37B45DA9; Sun, 22 May 2016 19:08:30 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A2381350; Sun, 22 May 2016 19:08:30 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MJ8TVd092561; Sun, 22 May 2016 19:08:29 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MJ8Ti7092560; Sun, 22 May 2016 19:08:29 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201605221908.u4MJ8Ti7092560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin <dchagin@FreeBSD.org> Date: Sun, 22 May 2016 19:08:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300431 - head/sys/compat/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 19:08:30 -0000 Author: dchagin Date: Sun May 22 19:08:29 2016 New Revision: 300431 URL: https://svnweb.freebsd.org/changeset/base/300431 Log: Convert proto family in both directions. The linux and native values for local and inet are identical, but for inet6 values differ. PR: 155040 Reported by: Simon Walton MFC after: 2 week Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sun May 22 19:06:38 2016 (r300430) +++ head/sys/compat/linux/linux_socket.c Sun May 22 19:08:29 2016 (r300431) @@ -462,12 +462,16 @@ bsd_to_linux_sockaddr(struct sockaddr *a { struct sockaddr sa; size_t sa_len = sizeof(struct sockaddr); - int error; + int error, bdom; if ((error = copyin(arg, &sa, sa_len))) return (error); - *(u_short *)&sa = sa.sa_family; + bdom = bsd_to_linux_domain(sa.sa_family); + if (bdom == -1) + return (EAFNOSUPPORT); + + *(u_short *)&sa = bdom; return (copyout(&sa, arg, sa_len)); } @@ -476,12 +480,16 @@ linux_to_bsd_sockaddr(struct sockaddr *a { struct sockaddr sa; size_t sa_len = sizeof(struct sockaddr); - int error; + int error, bdom; if ((error = copyin(arg, &sa, sa_len))) return (error); - sa.sa_family = *(sa_family_t *)&sa; + bdom = linux_to_bsd_domain(*(sa_family_t *)&sa); + if (bdom == -1) + return (EAFNOSUPPORT); + + sa.sa_family = bdom; sa.sa_len = len; return (copyout(&sa, arg, sa_len)); } From owner-svn-src-head@freebsd.org Sun May 22 19:12:26 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6947B45FAE; Sun, 22 May 2016 19:12:26 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-oi0-x229.google.com (mail-oi0-x229.google.com [IPv6:2607:f8b0:4003:c06::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 80BF41A19; Sun, 22 May 2016 19:12:26 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-oi0-x229.google.com with SMTP id j1so11543186oih.3; Sun, 22 May 2016 12:12:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=rzDkVK2+csrdK7owQU4ebAmGmtAgRdFFHgX1+JTw960=; b=jeunP/7VtKBHMGyTXTyuYhS0cbiJt7Y6lF9RI4DlQsvmZLPexLVFC16+Asl6PBggqt F/eF248l5jXAmohqyRnyFgS6QrBhhfXlsI8O//+6vxRTKk7hVYXEspKriBxEkc2dyJCQ ei202/MM5n/1uRonZ2EVTdTlJ2JfLXHv7LhhqdnSDrxh47m1sN19unduaDL17T+2vdUO ZDU0e4PdESyGN0U7Q54RL3ogm9zs8SrrIjtvh1SjXtDzJYMNS79abLJF76liF2DMSF5L Tb5xWA47kTkjwDRsUPfQbgL8APlwsoQcxAvkDETBFoi7AXUtk95I1tTmrYpFvTLme8uK 0BYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=rzDkVK2+csrdK7owQU4ebAmGmtAgRdFFHgX1+JTw960=; b=bp3iBcVezrLZM8bWrrPZO6UWA5SMwYvlOLD5rwrI7Zvy77Id7g4ekXVNezHdujAvBs CFgsnEU+bAY8yxT7aVbEJVEJlmwZTezswvbRKIY/D0zU68dD1ciFUSkOOUL9dlLteth3 FhfMU0RAcDYvJMZqjYKjEKS8VSoEsHerIK44nedm3rtd4SxfD/aPvQnYYA7x1VvotOau mb/sjmv7Gc1yEgNvpbXqM4DlEqHiRcaiU47hS6SpSkCJbeQCn+PR8F7w9NSauAO7ucde e9eU6SD9tA4hDzcuwdZOG2sNrsMZyp27jhCtXLUYrtcDl4AzSMfLYsRc6K6vDfa9SLyC oQNg== X-Gm-Message-State: ALyK8tJI49R1PqDGxSGv7PnlXmEylj97hFZBhfWd4Z7a9R0B2IaTOGbtDLfBtsgAOwFABVkOizr7gAQbSyNCSA== MIME-Version: 1.0 X-Received: by 10.157.47.181 with SMTP id r50mr3180590otb.51.1463944345211; Sun, 22 May 2016 12:12:25 -0700 (PDT) Received: by 10.182.105.74 with HTTP; Sun, 22 May 2016 12:12:24 -0700 (PDT) Received: by 10.182.105.74 with HTTP; Sun, 22 May 2016 12:12:24 -0700 (PDT) In-Reply-To: <C66E915D-A4D7-4591-AF6C-0949AF184271@panasas.com> References: <201605221358.u4MDwW8u097510@repo.freebsd.org> <C66E915D-A4D7-4591-AF6C-0949AF184271@panasas.com> Date: Sun, 22 May 2016 14:12:24 -0500 Message-ID: <CAHSQbTAVt6QgVNz0M_yCVpTwSc=-YFU5O0uhaqKC6XOPOmJCkQ@mail.gmail.com> Subject: Re: svn commit: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac From: Justin Hibbits <chmeeedalf@gmail.com> To: Ravi Pokala <rpokala@mac.com> Cc: src-committers <src-committers@freebsd.org>, svn-src-head@freebsd.org, Luiz Otavio O Souza <loos@freebsd.org>, svn-src-all@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 19:12:26 -0000 On May 22, 2016 13:51, "Ravi Pokala" <rpokala@mac.com> wrote: > > -----Original Message----- > From: <owner-src-committers@freebsd.org> on behalf of Luiz Otavio O Souza <loos@FreeBSD.org> > Date: 2016-05-22, Sunday at 06:58 > To: <src-committers@freebsd.org>, <svn-src-all@freebsd.org>, < svn-src-head@freebsd.org> > Subject: svn commit: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac > > >Author: loos > >Date: Sun May 22 13:58:32 2016 > >New Revision: 300421 > >URL: https://svnweb.freebsd.org/changeset/base/300421 > > > >Log: > > Fix the deciKelvin to Celsius conversion in kernel. > > > > After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as 0C > > reference and as result, the temperature read in sysctl(8) now exibits a > > +0.1C difference. > > Out of morbid curiosity, why do these things report in deciKelvin anyway? Are there sensors we support out there which report native Kelvin, or that report sub-degree precision? > > Thanks, > > Ravi (rpokala@) > There are many i2c sensors which report in sub-degree centigrade. Though some of them are in 1/8 (or other power of 2) degree precision, not 1/10. - Justin From owner-svn-src-head@freebsd.org Sun May 22 19:25:55 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2583CB46449; Sun, 22 May 2016 19:25:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E2C6C1241; Sun, 22 May 2016 19:25:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MJPstc098719; Sun, 22 May 2016 19:25:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MJPsDF098718; Sun, 22 May 2016 19:25:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605221925.u4MJPsDF098718@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov <kib@FreeBSD.org> Date: Sun, 22 May 2016 19:25:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300432 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 19:25:55 -0000 Author: kib Date: Sun May 22 19:25:53 2016 New Revision: 300432 URL: https://svnweb.freebsd.org/changeset/base/300432 Log: Remove false claim. Giant is dropped by mi_startup() before passing the control to swapper. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/vm/vm_glue.c Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Sun May 22 19:08:29 2016 (r300431) +++ head/sys/vm/vm_glue.c Sun May 22 19:25:53 2016 (r300432) @@ -731,8 +731,6 @@ faultin(p) * This swapin algorithm attempts to swap-in processes only if there * is enough space for them. Of course, if a process waits for a long * time, it will be swapped in anyway. - * - * Giant is held on entry. */ void swapper(void) From owner-svn-src-head@freebsd.org Sun May 22 19:43:42 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59AC5B466F8; Sun, 22 May 2016 19:43:42 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0AA7E1AA3; Sun, 22 May 2016 19:43:41 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MJhfLB004645; Sun, 22 May 2016 19:43:41 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MJhftZ004642; Sun, 22 May 2016 19:43:41 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605221943.u4MJhftZ004642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk <avos@FreeBSD.org> Date: Sun, 22 May 2016 19:43:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300433 - head/sys/dev/urtwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 19:43:42 -0000 Author: avos Date: Sun May 22 19:43:40 2016 New Revision: 300433 URL: https://svnweb.freebsd.org/changeset/base/300433 Log: urtwn: setup per-frame retry limit. Override global retry limit (which is set in R92C_RL) via per-frame TX descriptor field. Obsoletes D3840 (should work better with 2+ vaps). Tested with RTL8188EU and RTL8192CUS in STA mode (maxretry = [3-9]). Modified: head/sys/dev/urtwn/if_urtwn.c head/sys/dev/urtwn/if_urtwnreg.h Modified: head/sys/dev/urtwn/if_urtwn.c ============================================================================== --- head/sys/dev/urtwn/if_urtwn.c Sun May 22 19:25:53 2016 (r300432) +++ head/sys/dev/urtwn/if_urtwn.c Sun May 22 19:43:40 2016 (r300433) @@ -2838,7 +2838,7 @@ urtwn_tx_data(struct urtwn_softc *sc, st struct ieee80211_channel *chan; struct ieee80211_frame *wh; struct r92c_tx_desc *txd; - uint8_t macid, raid, rate, ridx, subtype, type, tid, qsel; + uint8_t macid, raid, rate, ridx, subtype, type, tid, qos, qsel; int hasqos, ismcast; URTWN_ASSERT_LOCKED(sc); @@ -2854,10 +2854,12 @@ urtwn_tx_data(struct urtwn_softc *sc, st /* Select TX ring for this frame. */ if (hasqos) { - tid = ((const struct ieee80211_qosframe *)wh)->i_qos[0]; - tid &= IEEE80211_QOS_TID; - } else + qos = ((const struct ieee80211_qosframe *)wh)->i_qos[0]; + tid = qos & IEEE80211_QOS_TID; + } else { + qos = 0; tid = 0; + } chan = (ni->ni_chan != IEEE80211_CHAN_ANYC) ? ni->ni_chan : ic->ic_curchan; @@ -2923,6 +2925,14 @@ urtwn_tx_data(struct urtwn_softc *sc, st txd->txdw0 |= htole32(R92C_TXDW0_BMCAST); if (!ismcast) { + /* Unicast frame, check if an ACK is expected. */ + if (!qos || (qos & IEEE80211_QOS_ACKPOLICY) != + IEEE80211_QOS_ACKPOLICY_NOACK) { + txd->txdw5 |= htole32(R92C_TXDW5_RTY_LMT_ENA); + txd->txdw5 |= htole32(SM(R92C_TXDW5_RTY_LMT, + tp->maxretry)); + } + if (sc->chip & URTWN_CHIP_88E) { struct urtwn_node *un = URTWN_NODE(ni); macid = un->id; @@ -3102,6 +3112,11 @@ urtwn_tx_raw(struct urtwn_softc *sc, str if (IEEE80211_IS_MULTICAST(wh->i_addr1)) txd->txdw0 |= htole32(R92C_TXDW0_BMCAST); + if ((params->ibp_flags & IEEE80211_BPF_NOACK) == 0) { + txd->txdw5 |= htole32(R92C_TXDW5_RTY_LMT_ENA); + txd->txdw5 |= htole32(SM(R92C_TXDW5_RTY_LMT, + params->ibp_try0)); + } if (params->ibp_flags & IEEE80211_BPF_RTS) txd->txdw4 |= htole32(R92C_TXDW4_RTSEN); if (params->ibp_flags & IEEE80211_BPF_CTS) Modified: head/sys/dev/urtwn/if_urtwnreg.h ============================================================================== --- head/sys/dev/urtwn/if_urtwnreg.h Sun May 22 19:25:53 2016 (r300432) +++ head/sys/dev/urtwn/if_urtwnreg.h Sun May 22 19:43:40 2016 (r300433) @@ -1198,6 +1198,9 @@ struct r92c_tx_desc { #define R92C_TXDW5_DATARATE_M 0x0000003f #define R92C_TXDW5_DATARATE_S 0 #define R92C_TXDW5_SGI 0x00000040 +#define R92C_TXDW5_RTY_LMT_ENA 0x00020000 +#define R92C_TXDW5_RTY_LMT_M 0x00fc0000 +#define R92C_TXDW5_RTY_LMT_S 18 #define R92C_TXDW5_AGGNUM_M 0xff000000 #define R92C_TXDW5_AGGNUM_S 24 From owner-svn-src-head@freebsd.org Sun May 22 19:48:44 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92A5AB467FB; Sun, 22 May 2016 19:48:44 +0000 (UTC) (envelope-from andriyvos@gmail.com) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com [209.85.217.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 211AA1D5A; Sun, 22 May 2016 19:48:43 +0000 (UTC) (envelope-from andriyvos@gmail.com) Received: by mail-lb0-f170.google.com with SMTP id h1so49556895lbj.3; Sun, 22 May 2016 12:48:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=Ne88Juo6W9iI0s+ofteUhyr05H5O2a8AHh5yj46aF2k=; b=QDrGgmAemt8J+gs8psqMy+E/LmD9FlripgETs1+k85gbd7AZ3R3AO6C1TqqJyGbGjF i9MBbVEYF+oVFQNqG852dNif+utCJRjH9b2Mc76Rgvj3GX7OI7LyaN6+2DJ8+q9IOf+l 445N2Kdv1L4x1TD8gFgpj0oetRCPkyXboLcEMih/10JurUMkjvMOTIhEFsy1uI2NlXiY BZmxPVtLpFvfsJaCDAqXFuAfJn+X1+qF88Q5/Vs0ts2YzfDfMG0z5hYvtuyNN6DQhy2Y asNVfItO4Qw65QOk9K6rg+iPLC1HuR9f5UbAhoGTz5NVvw4BJK6ABMUkMaUTRKcXghqN 6zEA== X-Gm-Message-State: ALyK8tIbhSAVepIOtwbSWf3VcpgW1Jv8RWZ4TM69j6XXiRSSTMWb6TyS9kV5llbtBEyXSA== X-Received: by 10.112.6.231 with SMTP id e7mr428767lba.45.1463946516568; Sun, 22 May 2016 12:48:36 -0700 (PDT) Received: from localhost (host-176-37-109-22.la.net.ua. [176.37.109.22]) by smtp.gmail.com with ESMTPSA id a131sm5279665lfe.1.2016.05.22.12.48.35 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 22 May 2016 12:48:36 -0700 (PDT) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300433 - head/sys/dev/urtwn References: <201605221943.u4MJhftZ004642@repo.freebsd.org> Date: Sun, 22 May 2016 22:48:29 +0300 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Andriy Voskoboinyk" <avos@freebsd.org> Message-ID: <op.yhvqm3us4dikkl@localhost> In-Reply-To: <201605221943.u4MJhftZ004642@repo.freebsd.org> User-Agent: Opera Mail/12.16 (FreeBSD) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 19:48:44 -0000 > RTL8192CUS RTL8188CUS of course. From owner-svn-src-head@freebsd.org Sun May 22 20:12:09 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3725DB46B59; Sun, 22 May 2016 20:12:09 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0478018C1; Sun, 22 May 2016 20:12:08 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MKC8dm013755; Sun, 22 May 2016 20:12:08 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MKC8lF013754; Sun, 22 May 2016 20:12:08 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605222012.u4MKC8lF013754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk <avos@FreeBSD.org> Date: Sun, 22 May 2016 20:12:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300434 - head/sys/dev/urtwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 20:12:09 -0000 Author: avos Date: Sun May 22 20:12:07 2016 New Revision: 300434 URL: https://svnweb.freebsd.org/changeset/base/300434 Log: urtwn: cleanup some unused code in urtwn_tx_data(). - Drop unused 'subtype' variable. - Remove obsolete comment (hardware crypto support was added in r292175). Modified: head/sys/dev/urtwn/if_urtwn.c Modified: head/sys/dev/urtwn/if_urtwn.c ============================================================================== --- head/sys/dev/urtwn/if_urtwn.c Sun May 22 19:43:40 2016 (r300433) +++ head/sys/dev/urtwn/if_urtwn.c Sun May 22 20:12:07 2016 (r300434) @@ -2838,17 +2838,13 @@ urtwn_tx_data(struct urtwn_softc *sc, st struct ieee80211_channel *chan; struct ieee80211_frame *wh; struct r92c_tx_desc *txd; - uint8_t macid, raid, rate, ridx, subtype, type, tid, qos, qsel; + uint8_t macid, raid, rate, ridx, type, tid, qos, qsel; int hasqos, ismcast; URTWN_ASSERT_LOCKED(sc); - /* - * Software crypto. - */ wh = mtod(m, struct ieee80211_frame *); type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; - subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; hasqos = IEEE80211_QOS_HAS_SEQ(wh); ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1); From owner-svn-src-head@freebsd.org Sun May 22 20:17:57 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BFC3B46CE6; Sun, 22 May 2016 20:17:57 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E01BA1CA6; Sun, 22 May 2016 20:17:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MKHua6013977; Sun, 22 May 2016 20:17:56 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MKHudV013976; Sun, 22 May 2016 20:17:56 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201605222017.u4MKHudV013976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" <pfg@FreeBSD.org> Date: Sun, 22 May 2016 20:17:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300435 - head/gnu/usr.bin/grep X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 20:17:57 -0000 Author: pfg Date: Sun May 22 20:17:55 2016 New Revision: 300435 URL: https://svnweb.freebsd.org/changeset/base/300435 Log: gnugrep: Update the configuration. The only effect is that it will use our native iconv(3). Relnotes: yes Modified: head/gnu/usr.bin/grep/config.h Modified: head/gnu/usr.bin/grep/config.h ============================================================================== --- head/gnu/usr.bin/grep/config.h Sun May 22 20:12:07 2016 (r300434) +++ head/gnu/usr.bin/grep/config.h Sun May 22 20:17:55 2016 (r300435) @@ -98,7 +98,7 @@ #define HAVE_GETUID 1 /* Define if you have the iconv() function. */ -/* #undef HAVE_ICONV */ +#define HAVE_ICONV 1 /* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and declares uintmax_t. */ @@ -260,7 +260,7 @@ /* #undef HAVE___ARGZ_STRINGIFY */ /* Define as const if the declaration of iconv() needs const. */ -/* #undef ICONV_CONST */ +#define ICONV_CONST /* Name of package */ #define PACKAGE "grep" From owner-svn-src-head@freebsd.org Sun May 22 20:31:54 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 167E8B451FE; Sun, 22 May 2016 20:31:54 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9F4E1939; Sun, 22 May 2016 20:31:53 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MKVqq1017740; Sun, 22 May 2016 20:31:52 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MKVqDv017739; Sun, 22 May 2016 20:31:52 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201605222031.u4MKVqDv017739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude <allanjude@FreeBSD.org> Date: Sun, 22 May 2016 20:31:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300436 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 20:31:54 -0000 Author: allanjude Date: Sun May 22 20:31:52 2016 New Revision: 300436 URL: https://svnweb.freebsd.org/changeset/base/300436 Log: bsdinstall/zfsboot GPT+BIOS+GELI installs now make use of GELIBOOT In this configuration, a separate bootpool is not required. This allows ZFS Boot Environments to be used with GELI encrypted ZFS pools. Support for GPT+EFI+GELI is planned for the future. Tested by: Joseph Mingrone, HardenedBSD Relnotes: yes Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D5869 Modified: head/usr.sbin/bsdinstall/scripts/zfsboot Modified: head/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- head/usr.sbin/bsdinstall/scripts/zfsboot Sun May 22 20:17:55 2016 (r300435) +++ head/usr.sbin/bsdinstall/scripts/zfsboot Sun May 22 20:31:52 2016 (r300436) @@ -1,6 +1,6 @@ #!/bin/sh #- -# Copyright (c) 2013-2015 Allan Jude +# Copyright (c) 2013-2016 Allan Jude # Copyright (c) 2013-2015 Devin Teske # All rights reserved. # @@ -189,8 +189,10 @@ CHMOD_MODE='chmod %s "%s"' DD_WITH_OPTIONS='dd if="%s" of="%s" %s' ECHO_APPEND='echo "%s" >> "%s"' GELI_ATTACH='geli attach -j - -k "%s" "%s"' +GELI_ATTACH_NOKEY='geli attach -j - "%s"' GELI_DETACH_F='geli detach -f "%s"' GELI_PASSWORD_INIT='geli init -b -B "%s" -e %s -J - -K "%s" -l 256 -s 4096 "%s"' +GELI_PASSWORD_GELIBOOT_INIT='geli init -bg -e %s -J - -l 256 -s 4096 "%s"' GPART_ADD_ALIGN='gpart add %s -t %s "%s"' GPART_ADD_ALIGN_INDEX='gpart add %s -i %s -t %s "%s"' GPART_ADD_ALIGN_INDEX_WITH_SIZE='gpart add %s -i %s -t %s -s %s "%s"' @@ -205,6 +207,7 @@ GPART_SET_ACTIVE='gpart set -a active -i GPART_SET_LENOVOFIX='gpart set -a lenovofix "%s"' GPART_SET_PMBR_ACTIVE='gpart set -a active "%s"' GRAID_DELETE='graid delete "%s"' +KLDLOAD='kldload %s' LN_SF='ln -sf "%s" "%s"' MKDIR_P='mkdir -p "%s"' MOUNT_TYPE='mount -t %s "%s" "%s"' @@ -755,21 +758,6 @@ zfs_create_diskpart() esac # - # Enable boot pool if encryption is desired - # - [ "$ZFSBOOT_GELI_ENCRYPTION" ] && ZFSBOOT_BOOT_POOL=1 - - # - # ZFSBOOT_BOOT_POOL and BIOS+UEFI boot type are incompatible - # - if [ "$ZFSBOOT_BOOT_POOL" -a "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ]; then - f_dprintf "$funcname: ZFSBOOT_BOOT_POOL is incompatible with BIOS+UEFI boot type" - msg_error="$msg_error: $funcname" f_show_err \ - "ZFSBOOT_BOOT_POOL is incompatible with BIOS+UEFI boot type" - return $FAILURE - fi - - # # Destroy whatever partition layout is currently on disk. # NOTE: `-F' required to destroy if partitions still exist. # NOTE: Failure is ok here, blank disk will have nothing to destroy. @@ -821,9 +809,14 @@ zfs_create_diskpart() fi # - # 2. Add small freebsd-boot or efi partition + # 2. Add small freebsd-boot and/or efi partition # if [ "$ZFSBOOT_BOOT_TYPE" = "UEFI" -o "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ]; then + # + # Enable boot pool if encryption is desired + # + [ "$ZFSBOOT_GELI_ENCRYPTION" ] && ZFSBOOT_BOOT_POOL=1 + f_eval_catch $funcname gpart \ "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \ "$align_small" efiboot$index efi 800k $disk || @@ -916,6 +909,10 @@ zfs_create_diskpart() MBR) f_dprintf "$funcname: Creating MBR layout..." # + # Enable boot pool if encryption is desired + # + [ "$ZFSBOOT_GELI_ENCRYPTION" ] && ZFSBOOT_BOOT_POOL=1 + # # 1. Create MBR layout (no labels) # f_eval_catch $funcname gpart "$GPART_CREATE" mbr $disk || @@ -1190,6 +1187,10 @@ zfs_create_boot() # Create the geli(8) GEOMS # if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then + # + # Load the AES-NI kernel module to accelerate encryption + # + f_eval_catch -d $funcname kldload "$KLDLOAD" "aesni" # Prompt user for password (twice) if ! msg_enter_new_password="$msg_geli_password" \ f_dialog_input_password @@ -1203,27 +1204,51 @@ zfs_create_boot() for disk in $disks; do f_dialog_info "$msg_geli_setup" \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - if ! echo "$pw_password" | f_eval_catch \ - $funcname geli "$GELI_PASSWORD_INIT" \ - "$bootpool/boot/$disk$targetpart.eli" \ - AES-XTS "$bootpool/$zroot_key" \ - $disk$targetpart - then - f_interactive || f_die - unset pw_password # Sensitive info - return $FAILURE - fi - if ! echo "$pw_password" | f_eval_catch \ - $funcname geli "$GELI_ATTACH" \ - "$bootpool/$zroot_key" $disk$targetpart - then - f_interactive || f_die - unset pw_password # Sensitive info - return $FAILURE + if [ "$ZFSBOOT_BOOT_POOL" ]; then + if ! echo "$pw_password" | f_eval_catch \ + $funcname geli "$GELI_PASSWORD_INIT" \ + "$bootpool/boot/$disk$targetpart.eli" \ + AES-XTS "$bootpool/$zroot_key" \ + $disk$targetpart + then + f_interactive || f_die + unset pw_password # Sensitive info + return $FAILURE + fi + if ! echo "$pw_password" | f_eval_catch \ + $funcname geli "$GELI_ATTACH" \ + "$bootpool/$zroot_key" $disk$targetpart + then + f_interactive || f_die + unset pw_password # Sensitive info + return $FAILURE + fi + else + # With no bootpool, there is no place to store + # the key files, use only a password + if ! echo "$pw_password" | f_eval_catch \ + $funcname geli \ + "$GELI_PASSWORD_GELIBOOT_INIT" AES-XTS \ + $disk$targetpart + then + f_interactive || f_die + unset pw_password # Sensitive info + return $FAILURE + fi + if ! echo "$pw_password" | f_eval_catch \ + $funcname geli "$GELI_ATTACH_NOKEY" \ + $disk$targetpart + then + f_interactive || f_die + unset pw_password # Sensitive info + return $FAILURE + fi fi done unset pw_password # Sensitive info + fi + if [ "$ZFSBOOT_BOOT_POOL" ]; then # Clean up f_eval_catch $funcname zfs "$ZFS_UNMOUNT" "$bootpool_name" || return $FAILURE @@ -1369,29 +1394,6 @@ zfs_create_boot() return $FAILURE fi - # We're all done unless we should go on for boot pool - [ "$ZFSBOOT_BOOT_POOL" ] || return $SUCCESS - - # Set cachefile for boot pool so it auto-imports at system start - f_dprintf "$funcname: Configuring zpool.cache for boot pool..." - f_eval_catch $funcname zpool "$ZPOOL_SET" \ - "cachefile=\"$BSDINSTALL_CHROOT/boot/zfs/zpool.cache\"" \ - "$bootpool_name" || return $FAILURE - - # Some additional geli(8) requirements for loader.conf(5) - for option in \ - 'zpool_cache_load=\"YES\"' \ - 'zpool_cache_type=\"/boot/zfs/zpool.cache\"' \ - 'zpool_cache_name=\"/boot/zfs/zpool.cache\"' \ - ; do - f_eval_catch $funcname echo "$ECHO_APPEND" "$option" \ - $BSDINSTALL_TMPBOOT/loader.conf.zfs || - return $FAILURE - done - f_eval_catch $funcname printf "$PRINTF_CONF" vfs.root.mountfrom \ - "\"zfs:$zroot_name/$zroot_bootfs\"" \ - $BSDINSTALL_TMPBOOT/loader.conf.root || return $FAILURE - # We're all done unless we should go on to do encryption [ "$ZFSBOOT_GELI_ENCRYPTION" ] || return $SUCCESS @@ -1403,9 +1405,10 @@ zfs_create_boot() $BSDINSTALL_TMPBOOT/loader.conf.aesni || return $FAILURE f_eval_catch $funcname echo "$ECHO_APPEND" 'geom_eli_load=\"YES\"' \ $BSDINSTALL_TMPBOOT/loader.conf.geli || return $FAILURE - f_eval_catch $funcname echo "$ECHO_APPEND" \ - 'geom_eli_passphrase_prompt=\"YES\"' \ - $BSDINSTALL_TMPBOOT/loader.conf.geli || return $FAILURE + + # We're all done unless we should go on for boot pool + [ "$ZFSBOOT_BOOT_POOL" ] || return $SUCCESS + for disk in $disks; do f_eval_catch $funcname printf "$PRINTF_CONF" \ geli_%s_keyfile0_load "$disk$targetpart YES" \ @@ -1423,6 +1426,27 @@ zfs_create_boot() return $FAILURE done + # Set cachefile for boot pool so it auto-imports at system start + f_dprintf "$funcname: Configuring zpool.cache for boot pool..." + f_eval_catch $funcname zpool "$ZPOOL_SET" \ + "cachefile=\"$BSDINSTALL_CHROOT/boot/zfs/zpool.cache\"" \ + "$bootpool_name" || return $FAILURE + + # Some additional geli(8) requirements for loader.conf(5) + for option in \ + 'zpool_cache_load=\"YES\"' \ + 'zpool_cache_type=\"/boot/zfs/zpool.cache\"' \ + 'zpool_cache_name=\"/boot/zfs/zpool.cache\"' \ + 'geom_eli_passphrase_prompt=\"YES\"' \ + ; do + f_eval_catch $funcname echo "$ECHO_APPEND" "$option" \ + $BSDINSTALL_TMPBOOT/loader.conf.zfs || + return $FAILURE + done + f_eval_catch $funcname printf "$PRINTF_CONF" vfs.root.mountfrom \ + "\"zfs:$zroot_name/$zroot_bootfs\"" \ + $BSDINSTALL_TMPBOOT/loader.conf.root || return $FAILURE + return $SUCCESS } From owner-svn-src-head@freebsd.org Sun May 22 21:31:21 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72759B46A4A; Sun, 22 May 2016 21:31:21 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38BFC16FD; Sun, 22 May 2016 21:31:21 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MLVKM0037129; Sun, 22 May 2016 21:31:20 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MLVKLV037128; Sun, 22 May 2016 21:31:20 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201605222131.u4MLVKLV037128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore <ian@FreeBSD.org> Date: Sun, 22 May 2016 21:31:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300438 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 21:31:21 -0000 Author: ian Date: Sun May 22 21:31:20 2016 New Revision: 300438 URL: https://svnweb.freebsd.org/changeset/base/300438 Log: Restore the translation of armv6hf->arm when generating MACHINE_CPUARCH. It turns out we need to leave this in place for a while so that people running self-hosting armv6hf systems can do the builds necessary to update to armv6 (which is now hardfloat by default). Modified: head/share/mk/sys.mk Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Sun May 22 20:44:11 2016 (r300437) +++ head/share/mk/sys.mk Sun May 22 21:31:20 2016 (r300438) @@ -13,7 +13,7 @@ unix ?= We run FreeBSD, not UNIX. # and/or endian. This is called MACHINE_CPU in NetBSD, but that's used # for something different in FreeBSD. # -MACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/:C/riscv64/riscv/} +MACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc64/powerpc/:C/riscv64/riscv/} .endif From owner-svn-src-head@freebsd.org Sun May 22 23:25:02 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80BC8B3BCAE; Sun, 22 May 2016 23:25:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4ADE11BF5; Sun, 22 May 2016 23:25:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MNP1A9071365; Sun, 22 May 2016 23:25:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MNP1vo071364; Sun, 22 May 2016 23:25:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605222325.u4MNP1vo071364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov <kib@FreeBSD.org> Date: Sun, 22 May 2016 23:25:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300439 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 23:25:02 -0000 Author: kib Date: Sun May 22 23:25:01 2016 New Revision: 300439 URL: https://svnweb.freebsd.org/changeset/base/300439 Log: Replace hand-made exclusive lock, protecting against parallel swapon/swapoff invocations, with sx. Reviewed by: alc (as part of larger patch) Sponsored by: The FreeBSD Foundation Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sun May 22 21:31:20 2016 (r300438) +++ head/sys/vm/swap_pager.c Sun May 22 23:25:01 2016 (r300439) @@ -152,7 +152,7 @@ static TAILQ_HEAD(, swdevt) swtailq = TA static struct swdevt *swdevhd; /* Allocate from here next */ static int nswapdev; /* Number of swap devices */ int swap_pager_avail; -static int swdev_syscall_active = 0; /* serialize swap(on|off) */ +static struct sx swdev_syscall_lock; /* serialize swap(on|off) */ static vm_ooffset_t swap_total; SYSCTL_QUAD(_vm, OID_AUTO, swap_total, CTLFLAG_RD, &swap_total, 0, @@ -487,6 +487,7 @@ swap_pager_init(void) TAILQ_INIT(&swap_pager_object_list[i]); mtx_init(&sw_alloc_mtx, "swap_pager list", NULL, MTX_DEF); mtx_init(&sw_dev_mtx, "swapdev", NULL, MTX_DEF); + sx_init(&swdev_syscall_lock, "swsysc"); /* * Device Stripe, in PAGE_SIZE'd blocks @@ -1664,7 +1665,7 @@ swap_pager_swapoff(struct swdevt *sp) struct swblock *swap; int i, j, retries; - GIANT_REQUIRED; + sx_assert(&swdev_syscall_lock, SA_XLOCKED); retries = 0; full_rescan: @@ -2005,10 +2006,7 @@ sys_swapon(struct thread *td, struct swa if (error) return (error); - mtx_lock(&Giant); - while (swdev_syscall_active) - tsleep(&swdev_syscall_active, PUSER - 1, "swpon", 0); - swdev_syscall_active = 1; + sx_xlock(&swdev_syscall_lock); /* * Swap metadata may not fit in the KVM if we have physical @@ -2043,9 +2041,7 @@ sys_swapon(struct thread *td, struct swa if (error) vrele(vp); done: - swdev_syscall_active = 0; - wakeup_one(&swdev_syscall_active); - mtx_unlock(&Giant); + sx_xunlock(&swdev_syscall_lock); return (error); } @@ -2175,10 +2171,7 @@ sys_swapoff(struct thread *td, struct sw if (error) return (error); - mtx_lock(&Giant); - while (swdev_syscall_active) - tsleep(&swdev_syscall_active, PUSER - 1, "swpoff", 0); - swdev_syscall_active = 1; + sx_xlock(&swdev_syscall_lock); NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->name, td); @@ -2200,9 +2193,7 @@ sys_swapoff(struct thread *td, struct sw } error = swapoff_one(sp, td->td_ucred); done: - swdev_syscall_active = 0; - wakeup_one(&swdev_syscall_active); - mtx_unlock(&Giant); + sx_xunlock(&swdev_syscall_lock); return (error); } @@ -2214,7 +2205,7 @@ swapoff_one(struct swdevt *sp, struct uc int error; #endif - mtx_assert(&Giant, MA_OWNED); + sx_assert(&swdev_syscall_lock, SA_XLOCKED); #ifdef MAC (void) vn_lock(sp->sw_vp, LK_EXCLUSIVE | LK_RETRY); error = mac_system_check_swapoff(cred, sp->sw_vp); @@ -2276,10 +2267,7 @@ swapoff_all(void) const char *devname; int error; - mtx_lock(&Giant); - while (swdev_syscall_active) - tsleep(&swdev_syscall_active, PUSER - 1, "swpoff", 0); - swdev_syscall_active = 1; + sx_xlock(&swdev_syscall_lock); mtx_lock(&sw_dev_mtx); TAILQ_FOREACH_SAFE(sp, &swtailq, sw_list, spt) { @@ -2299,9 +2287,7 @@ swapoff_all(void) } mtx_unlock(&sw_dev_mtx); - swdev_syscall_active = 0; - wakeup_one(&swdev_syscall_active); - mtx_unlock(&Giant); + sx_xunlock(&swdev_syscall_lock); } void From owner-svn-src-head@freebsd.org Sun May 22 23:28:24 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93B3CB3BE8D; Sun, 22 May 2016 23:28:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 654741F60; Sun, 22 May 2016 23:28:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MNSNxF071513; Sun, 22 May 2016 23:28:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MNSNgM071512; Sun, 22 May 2016 23:28:23 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605222328.u4MNSNgM071512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov <kib@FreeBSD.org> Date: Sun, 22 May 2016 23:28:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300440 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 22 May 2016 23:28:24 -0000 Author: kib Date: Sun May 22 23:28:23 2016 New Revision: 300440 URL: https://svnweb.freebsd.org/changeset/base/300440 Log: Mark swap-related proc sysctls as not requiring Giant. Reviewed by: alc (as part of larger patch) Sponsored by: The FreeBSD Foundation Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sun May 22 23:25:01 2016 (r300439) +++ head/sys/vm/swap_pager.c Sun May 22 23:28:23 2016 (r300440) @@ -325,8 +325,9 @@ static int nsw_wcount_async_max;/* assig static int nsw_cluster_max; /* maximum VOP I/O allowed */ static int sysctl_swap_async_max(SYSCTL_HANDLER_ARGS); -SYSCTL_PROC(_vm, OID_AUTO, swap_async_max, CTLTYPE_INT | CTLFLAG_RW, - NULL, 0, sysctl_swap_async_max, "I", "Maximum running async swap ops"); +SYSCTL_PROC(_vm, OID_AUTO, swap_async_max, CTLTYPE_INT | CTLFLAG_RW | + CTLFLAG_MPSAFE, NULL, 0, sysctl_swap_async_max, "I", + "Maximum running async swap ops"); static struct swblock **swhash; static int swhash_mask; @@ -2356,7 +2357,8 @@ sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) SYSCTL_INT(_vm, OID_AUTO, nswapdev, CTLFLAG_RD, &nswapdev, 0, "Number of swap devices"); -SYSCTL_NODE(_vm, OID_AUTO, swap_info, CTLFLAG_RD, sysctl_vm_swap_info, +SYSCTL_NODE(_vm, OID_AUTO, swap_info, CTLFLAG_RD | CTLFLAG_MPSAFE, + sysctl_vm_swap_info, "Swap statistics by device"); /* From owner-svn-src-head@freebsd.org Mon May 23 01:01:25 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 107B7B45682; Mon, 23 May 2016 01:01:25 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE59419D7; Mon, 23 May 2016 01:01:24 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N11NIV098623; Mon, 23 May 2016 01:01:23 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N11Nr9098622; Mon, 23 May 2016 01:01:23 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230101.u4N11Nr9098622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Mon, 23 May 2016 01:01:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300442 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 01:01:25 -0000 Author: truckman Date: Mon May 23 01:01:23 2016 New Revision: 300442 URL: https://svnweb.freebsd.org/changeset/base/300442 Log: Hopefully fix Coverity CID 1008328 (Out-of-bounds write) in /bin/sh. Replace the magic constant 127 in the loop interation count with "PROMPTLEN - 1". gethostname() is not guaranteed to NUL terminate the destination string if it is too short. Decrease the length passed to gethostname() by one, and add a NUL at the end of the buffer to make sure the following loop to find the end of the name properly terminates. The default: case is the likely cause of Coverity CID 1008328. If i is 126 at the top of the loop interation where the default case is triggered, i will be incremented to 127 by the default case, then incremented to 128 at the top of the loop before being compared to 127 (PROMPTLENT - 1) and terminating the loop. Then the NUL termination code after the loop will write to ps[128]. Fix by checking for overflow before incrementing the index and storing the second character in the buffer. These fixes are not guaranteed to satisfy Coverity. The code that increments i in the 'h'/'H' and 'w'/'W' cases may be beyond its capability to analyze, but the code appears to be safe. Reported by: Coverity CID: 1008328 Reviewed by: jilles, cem MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6482 Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Mon May 23 00:58:52 2016 (r300441) +++ head/bin/sh/parser.c Mon May 23 01:01:23 2016 (r300442) @@ -1998,7 +1998,7 @@ getprompt(void *unused __unused) /* * Format prompt string. */ - for (i = 0; (i < 127) && (*fmt != '\0'); i++, fmt++) + for (i = 0; (i < PROMPTLEN - 1) && (*fmt != '\0'); i++, fmt++) if (*fmt == '\\') switch (*++fmt) { @@ -2011,7 +2011,8 @@ getprompt(void *unused __unused) case 'h': case 'H': ps[i] = '\0'; - gethostname(&ps[i], PROMPTLEN - i); + gethostname(&ps[i], PROMPTLEN - i - 1); + ps[PROMPTLEN - 1] = '\0'; /* Skip to end of hostname. */ trim = (*fmt == 'h') ? '.' : '\0'; while ((ps[i] != '\0') && (ps[i] != trim)) @@ -2061,8 +2062,9 @@ getprompt(void *unused __unused) * Emit unrecognized formats verbatim. */ default: - ps[i++] = '\\'; - ps[i] = *fmt; + ps[i] = '\\'; + if (i < PROMPTLEN - 1) + ps[++i] = *fmt; break; } else From owner-svn-src-head@freebsd.org Mon May 23 03:29:45 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C72FB46225; Mon, 23 May 2016 03:29:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3FC91366; Mon, 23 May 2016 03:29:44 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N3ThrQ043998; Mon, 23 May 2016 03:29:43 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N3ThxB043997; Mon, 23 May 2016 03:29:43 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605230329.u4N3ThxB043997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Mon, 23 May 2016 03:29:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300443 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 03:29:45 -0000 Author: adrian Date: Mon May 23 03:29:43 2016 New Revision: 300443 URL: https://svnweb.freebsd.org/changeset/base/300443 Log: [bhnd] Fix DEFINE_CLASS_(2|3) multiple inheritance support. This diff updates DEFINE_CLASS_2/_3 to support the specification of class name separately from the class variable name, bringing them into sync with their API documentation, as well as the behavior of DEFINE_CLASS_0/_1. Nothing in the tree currently uses the _2/_3 variants, and I can't find any references to the API outside of commits to the kobj.h header itself; given the limitation that currently exists, I'd be surprised if they've ever been used. Submitted by: Landon Fuller <landonf@landonf.org> Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D6491 Modified: head/sys/sys/kobj.h Modified: head/sys/sys/kobj.h ============================================================================== --- head/sys/sys/kobj.h Mon May 23 01:01:23 2016 (r300442) +++ head/sys/sys/kobj.h Mon May 23 03:29:43 2016 (r300443) @@ -146,13 +146,13 @@ struct kobj_class classvar = { \ * DEFINE_CLASS_2(foo, foo_class, foo_methods, sizeof(foo_softc), * bar, baz); */ -#define DEFINE_CLASS_2(name, methods, size, \ +#define DEFINE_CLASS_2(name, classvar, methods, size, \ base1, base2) \ \ static kobj_class_t name ## _baseclasses[] = \ { &base1, \ &base2, NULL }; \ -struct kobj_class name ## _class = { \ +struct kobj_class classvar = { \ #name, methods, size, name ## _baseclasses \ } @@ -162,14 +162,14 @@ struct kobj_class name ## _class = { \ * DEFINE_CLASS_3(foo, foo_class, foo_methods, sizeof(foo_softc), * bar, baz, foobar); */ -#define DEFINE_CLASS_3(name, methods, size, \ +#define DEFINE_CLASS_3(name, classvar, methods, size, \ base1, base2, base3) \ \ static kobj_class_t name ## _baseclasses[] = \ { &base1, \ &base2, \ &base3, NULL }; \ -struct kobj_class name ## _class = { \ +struct kobj_class classvar = { \ #name, methods, size, name ## _baseclasses \ } From owner-svn-src-head@freebsd.org Mon May 23 03:46:37 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69E40B466FC; Mon, 23 May 2016 03:46:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39A4D1F94; Mon, 23 May 2016 03:46:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N3ka6S049859; Mon, 23 May 2016 03:46:36 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N3kaih049858; Mon, 23 May 2016 03:46:36 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605230346.u4N3kaih049858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Mon, 23 May 2016 03:46:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300444 - head/sys/dev/ixl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 03:46:37 -0000 Author: adrian Date: Mon May 23 03:46:36 2016 New Revision: 300444 URL: https://svnweb.freebsd.org/changeset/base/300444 Log: [ixl] fix build for RSS. Untested. Modified: head/sys/dev/ixl/if_ixl.c Modified: head/sys/dev/ixl/if_ixl.c ============================================================================== --- head/sys/dev/ixl/if_ixl.c Mon May 23 03:29:43 2016 (r300443) +++ head/sys/dev/ixl/if_ixl.c Mon May 23 03:46:36 2016 (r300444) @@ -2264,6 +2264,10 @@ ixl_setup_queue_tqs(struct ixl_vsi *vsi) { struct ixl_queue *que = vsi->queues; device_t dev = vsi->dev; +#ifdef RSS + cpuset_t cpu_mask; + int cpu_id; +#endif /* Create queue tasks and start queue taskqueues */ for (int i = 0; i < vsi->num_queues; i++, que++) { @@ -2272,6 +2276,7 @@ ixl_setup_queue_tqs(struct ixl_vsi *vsi) que->tq = taskqueue_create_fast("ixl_que", M_NOWAIT, taskqueue_thread_enqueue, &que->tq); #ifdef RSS + cpu_id = rss_getcpu(i % rss_getnumbuckets()); CPU_SETOF(cpu_id, &cpu_mask); taskqueue_start_threads_cpuset(&que->tq, 1, PI_NET, &cpu_mask, "%s (bucket %d)", @@ -2355,9 +2360,6 @@ ixl_setup_queue_msix(struct ixl_vsi *vsi struct ixl_queue *que = vsi->queues; struct tx_ring *txr; int error, rid, vector = 1; -#ifdef RSS - cpuset_t cpu_mask; -#endif /* Queue interrupt vector numbers start at 1 (adminq intr is 0) */ for (int i = 0; i < vsi->num_queues; i++, vector++, que++) { From owner-svn-src-head@freebsd.org Mon May 23 03:47:46 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14CD9B46828; Mon, 23 May 2016 03:47:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E53E71159; Mon, 23 May 2016 03:47:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N3ljng050020; Mon, 23 May 2016 03:47:45 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N3lihA050009; Mon, 23 May 2016 03:47:44 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605230347.u4N3lihA050009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Mon, 23 May 2016 03:47:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300445 - in head/sys: conf dev/bhnd dev/bhnd/bcma dev/bhnd/bhndb dev/bhnd/siba dev/bhnd/soc modules/bhnd/bhndb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 03:47:46 -0000 Author: adrian Date: Mon May 23 03:47:44 2016 New Revision: 300445 URL: https://svnweb.freebsd.org/changeset/base/300445 Log: [bhnd] Add support for querying the attachment type of the bhnd bus. This adds a BHND_BUS_GET_ATTACH_TYPE(); the primary use-case is to let chipc make a coarse-grained determination as to whether UART, SPI, etc drivers ought to be attached, and on fullmac devices, whether a real CPU driver ought to be skipped for the ARM core, etc. Tested: * BCM4331 (BHND) * BCM4312 (SIBA) Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6492 Added: head/sys/dev/bhnd/bhndb/bhnd_bhndb.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/bhnd/bcma/bcma_bhndb.c head/sys/dev/bhnd/bhnd.h head/sys/dev/bhnd/bhnd_bus_if.m head/sys/dev/bhnd/bhnd_types.h head/sys/dev/bhnd/bhndb/bhndb.h head/sys/dev/bhnd/siba/siba_bhndb.c head/sys/dev/bhnd/soc/bhnd_soc.c head/sys/modules/bhnd/bhndb/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon May 23 03:46:36 2016 (r300444) +++ head/sys/conf/files Mon May 23 03:47:44 2016 (r300445) @@ -1125,6 +1125,7 @@ dev/bge/if_bge.c optional bge dev/bhnd/bhnd.c optional bhndbus | bhnd dev/bhnd/bhnd_subr.c optional bhndbus | bhnd dev/bhnd/bhnd_bus_if.m optional bhndbus | bhnd +dev/bhnd/bhndb/bhnd_bhndb.c optional bhndbus | bhndb dev/bhnd/bhndb/bhndb.c optional bhndbus | bhndb dev/bhnd/bhndb/bhndb_bus_if.m optional bhndbus | bhndb dev/bhnd/bhndb/bhndb_hwdata.c optional bhndbus | bhndb Modified: head/sys/dev/bhnd/bcma/bcma_bhndb.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_bhndb.c Mon May 23 03:46:36 2016 (r300444) +++ head/sys/dev/bhnd/bcma/bcma_bhndb.c Mon May 23 03:47:44 2016 (r300445) @@ -166,20 +166,6 @@ bcma_bhndb_resume_child(device_t dev, de return (0); } -static int -bcma_bhndb_read_board_info(device_t dev, device_t child, - struct bhnd_board_info *info) -{ - int error; - - /* Initialize with NVRAM-derived values */ - if ((error = bhnd_bus_generic_read_board_info(dev, child, info))) - return (error); - - /* Let the bridge fill in any additional data */ - return (BHNDB_POPULATE_BOARD_INFO(device_get_parent(dev), dev, info)); -} - static device_method_t bcma_bhndb_methods[] = { /* Device interface */ DEVMETHOD(device_probe, bcma_bhndb_probe), @@ -189,14 +175,11 @@ static device_method_t bcma_bhndb_method DEVMETHOD(bus_suspend_child, bcma_bhndb_suspend_child), DEVMETHOD(bus_resume_child, bcma_bhndb_resume_child), - /* BHND interface */ - DEVMETHOD(bhnd_bus_read_board_info, bcma_bhndb_read_board_info), - DEVMETHOD_END }; -DEFINE_CLASS_1(bhnd, bcma_bhndb_driver, bcma_bhndb_methods, - sizeof(struct bcma_softc), bcma_driver); +DEFINE_CLASS_2(bhnd, bcma_bhndb_driver, bcma_bhndb_methods, + sizeof(struct bcma_softc), bhnd_bhndb_driver, bcma_driver); DRIVER_MODULE(bcma_bhndb, bhndb, bcma_bhndb_driver, bhnd_devclass, NULL, NULL); Modified: head/sys/dev/bhnd/bhnd.h ============================================================================== --- head/sys/dev/bhnd/bhnd.h Mon May 23 03:46:36 2016 (r300444) +++ head/sys/dev/bhnd/bhnd.h Mon May 23 03:47:44 2016 (r300445) @@ -561,6 +561,21 @@ bhnd_get_chipid(device_t dev) { }; /** + * Return the BHND attachment type of the parent bhnd bus. + * + * @param dev A bhnd bus child device. + * + * @retval BHND_ATTACH_ADAPTER if the bus is resident on a bridged adapter, + * such as a WiFi chipset. + * @retval BHND_ATTACH_NATIVE if the bus provides hardware services (clock, + * CPU, etc) to a directly attached native host. + */ +static inline bhnd_attach_type +bhnd_get_attach_type (device_t dev) { + return (BHND_BUS_GET_ATTACH_TYPE(device_get_parent(dev), dev)); +} + +/** * Attempt to read the BHND board identification from the bhnd bus. * * This relies on NVRAM access, and will fail if a valid NVRAM device cannot Modified: head/sys/dev/bhnd/bhnd_bus_if.m ============================================================================== --- head/sys/dev/bhnd/bhnd_bus_if.m Mon May 23 03:46:36 2016 (r300444) +++ head/sys/dev/bhnd/bhnd_bus_if.m Mon May 23 03:47:44 2016 (r300445) @@ -55,6 +55,12 @@ CODE { panic("bhnd_bus_get_chipid unimplemented"); } + static bhnd_attach_type + bhnd_bus_null_get_attach_type(device_t dev, device_t child) + { + panic("bhnd_bus_get_attach_type unimplemented"); + } + static int bhnd_bus_null_read_board_info(device_t dev, device_t child, struct bhnd_board_info *info) @@ -184,6 +190,22 @@ METHOD const struct bhnd_chipid * get_ch } DEFAULT bhnd_bus_null_get_chipid; /** + * Return the BHND attachment type of the parent bus. + * + * @param dev The device whose child is being examined. + * @param child The child device. + * + * @retval BHND_ATTACH_ADAPTER if the bus is resident on a bridged adapter, + * such as a WiFi chipset. + * @retval BHND_ATTACH_NATIVE if the bus provides hardware services (clock, + * CPU, etc) to a directly attached native host. + */ +METHOD bhnd_attach_type get_attach_type { + device_t dev; + device_t child; +} DEFAULT bhnd_bus_null_get_attach_type; + +/** * Attempt to read the BHND board identification from the parent bus. * * This relies on NVRAM access, and will fail if a valid NVRAM device cannot Modified: head/sys/dev/bhnd/bhnd_types.h ============================================================================== --- head/sys/dev/bhnd/bhnd_types.h Mon May 23 03:46:36 2016 (r300444) +++ head/sys/dev/bhnd/bhnd_types.h Mon May 23 03:47:44 2016 (r300445) @@ -73,6 +73,15 @@ typedef enum { BHND_PORT_AGENT = 2, /**< interconnect agent/wrapper */ } bhnd_port_type; +/** + * bhnd(4) attachment types. + */ +typedef enum { + BHND_ATTACH_ADAPTER = 0, /**< A bridged card, such as a PCI WiFi chipset */ + BHND_ATTACH_NATIVE = 1 /**< A bus resident on the native host, such as + * the primary or secondary bus of an embedded + * SoC */ +} bhnd_attach_type; /** Evaluates to true if @p cls is a device class that can be configured * as a host bridge device. */ Added: head/sys/dev/bhnd/bhndb/bhnd_bhndb.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/bhnd/bhndb/bhnd_bhndb.c Mon May 23 03:47:44 2016 (r300445) @@ -0,0 +1,77 @@ +/*- + * Copyright (c) 2015-2016 Landon Fuller <landon@landonf.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGES. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/param.h> +#include <sys/kernel.h> +#include <sys/bus.h> +#include <sys/module.h> + +#include <dev/bhnd/bhnd_ids.h> +#include <dev/bhnd/bhnd.h> + +#include "bhndbvar.h" + +/* + * bhnd(4) driver mix-in providing a shared common methods for + * bhnd devices attached via a bhndb bridge. + */ + +static int +bhnd_bhndb_read_board_info(device_t dev, device_t child, + struct bhnd_board_info *info) +{ + int error; + + /* Initialize with NVRAM-derived values */ + if ((error = bhnd_bus_generic_read_board_info(dev, child, info))) + return (error); + + /* Let the bridge fill in any additional data */ + return (BHNDB_POPULATE_BOARD_INFO(device_get_parent(dev), dev, info)); +} + +static bhnd_attach_type +bhnd_bhndb_get_attach_type(device_t dev, device_t child) +{ + /* It's safe to assume that a bridged device is always an adapter */ + return (BHND_ATTACH_ADAPTER); +} + +static device_method_t bhnd_bhndb_methods[] = { + /* BHND interface */ + DEVMETHOD(bhnd_bus_get_attach_type, bhnd_bhndb_get_attach_type), + DEVMETHOD(bhnd_bus_read_board_info, bhnd_bhndb_read_board_info), + + DEVMETHOD_END +}; + +DEFINE_CLASS_0(bhnd, bhnd_bhndb_driver, bhnd_bhndb_methods, 0); Modified: head/sys/dev/bhnd/bhndb/bhndb.h ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb.h Mon May 23 03:46:36 2016 (r300444) +++ head/sys/dev/bhnd/bhndb/bhndb.h Mon May 23 03:47:44 2016 (r300445) @@ -44,6 +44,7 @@ #include "bhndb_bus_if.h" extern devclass_t bhndb_devclass; +DECLARE_CLASS(bhnd_bhndb_driver); int bhndb_attach_bridge(device_t parent, device_t *bhndb, int unit); Modified: head/sys/dev/bhnd/siba/siba_bhndb.c ============================================================================== --- head/sys/dev/bhnd/siba/siba_bhndb.c Mon May 23 03:46:36 2016 (r300444) +++ head/sys/dev/bhnd/siba/siba_bhndb.c Mon May 23 03:47:44 2016 (r300445) @@ -205,20 +205,6 @@ siba_bhndb_resume_child(device_t dev, de return (0); } -static int -siba_bhndb_read_board_info(device_t dev, device_t child, - struct bhnd_board_info *info) -{ - int error; - - /* Initialize with NVRAM-derived values */ - if ((error = bhnd_bus_generic_read_board_info(dev, child, info))) - return (error); - - /* Let the bridge fill in any additional data */ - return (BHNDB_POPULATE_BOARD_INFO(device_get_parent(dev), dev, info)); -} - /* Work-around implementation for SIBA_QUIRK_PCIE_D11_SB_TIMEOUT */ static int siba_bhndb_wars_pcie_clear_d11_timeout(struct siba_softc *sc) @@ -285,14 +271,11 @@ static device_method_t siba_bhndb_method DEVMETHOD(bus_suspend_child, siba_bhndb_suspend_child), DEVMETHOD(bus_resume_child, siba_bhndb_resume_child), - /* BHND interface */ - DEVMETHOD(bhnd_bus_read_board_info, siba_bhndb_read_board_info), - DEVMETHOD_END }; -DEFINE_CLASS_1(bhnd, siba_bhndb_driver, siba_bhndb_methods, - sizeof(struct siba_softc), siba_driver); +DEFINE_CLASS_2(bhnd, siba_bhndb_driver, siba_bhndb_methods, + sizeof(struct siba_softc), bhnd_bhndb_driver, siba_driver); DRIVER_MODULE(siba_bhndb, bhndb, siba_bhndb_driver, bhnd_devclass, NULL, NULL); Modified: head/sys/dev/bhnd/soc/bhnd_soc.c ============================================================================== --- head/sys/dev/bhnd/soc/bhnd_soc.c Mon May 23 03:46:36 2016 (r300444) +++ head/sys/dev/bhnd/soc/bhnd_soc.c Mon May 23 03:47:44 2016 (r300445) @@ -216,6 +216,12 @@ bhnd_soc_is_hw_disabled(device_t dev, de return false; } +static int +bhnd_soc_get_attach_type(device_t dev, device_t child) +{ + return (BHND_ATTACH_NATIVE); +} + /* * **************************** DRIVER METADATA **************************** */ @@ -247,6 +253,7 @@ static device_method_t bhnd_soc_methods[ DEVMETHOD(bhnd_bus_activate_resource, bhnd_soc_activate_resource), DEVMETHOD(bhnd_bus_is_hw_disabled, bhnd_soc_is_hw_disabled), DEVMETHOD(bhnd_bus_get_chipid, bhnd_soc_get_chipid), + DEVMETHOD(bhnd_bus_get_attach_type, bhnd_soc_get_attach_type), DEVMETHOD_END }; Modified: head/sys/modules/bhnd/bhndb/Makefile ============================================================================== --- head/sys/modules/bhnd/bhndb/Makefile Mon May 23 03:46:36 2016 (r300444) +++ head/sys/modules/bhnd/bhndb/Makefile Mon May 23 03:47:44 2016 (r300445) @@ -4,6 +4,7 @@ KMOD= bhndb SRCS= bhndb.c bhndb_subr.c bhndb_hwdata.c \ + bhnd_bhndb.c \ bhndb_bus_if.c bhndb_bus_if.h \ bhndb_if.c bhndb_if.h SRCS+= bhnd_bus_if.h \ From owner-svn-src-head@freebsd.org Mon May 23 03:51:16 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76187B46D75; Mon, 23 May 2016 03:51:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A5731BF2; Mon, 23 May 2016 03:51:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N3pFBH055075; Mon, 23 May 2016 03:51:15 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N3pFZF055074; Mon, 23 May 2016 03:51:15 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605230351.u4N3pFZF055074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Mon, 23 May 2016 03:51:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300446 - head/sys/dev/nvram2env X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 03:51:16 -0000 Author: adrian Date: Mon May 23 03:51:15 2016 New Revision: 300446 URL: https://svnweb.freebsd.org/changeset/base/300446 Log: [nvram2env] fix nvram2env to scan all of memory, not 1/4th The variable "size" stores number of words (4bytes). But the loop over memory uses size as number of bytes to scan memory. As result it fetches only 1/4th of memory. This patch solves this problem and nvram2env fetches all NVRAM variables. Test plan: Pre-requisites: any MIPS board with ASCII-based NVRAM mapped into memory * Add "device nvram2env" into kernel configuration * Specify hints: base is mandatory (according to nvram2env(4)) hint.nvram.0.base=0x1c7f8000 (it's valid address for Asus RT-N53 with flags = 0x4) * Build & load kernel with bootverbose Actual result: only part of nvram variables are found Expected result: all variables are found Submitted by: Michael Zhilin <mizhka@gmail.com> Differential Revision: https://reviews.freebsd.org/D6466 Modified: head/sys/dev/nvram2env/nvram2env.c Modified: head/sys/dev/nvram2env/nvram2env.c ============================================================================== --- head/sys/dev/nvram2env/nvram2env.c Mon May 23 03:47:44 2016 (r300445) +++ head/sys/dev/nvram2env/nvram2env.c Mon May 23 03:51:15 2016 (r300446) @@ -193,10 +193,12 @@ static uint32_t read_4(struct nvram2env_ static int nvram2env_attach(device_t dev) { - struct nvram2env_softc * sc = device_get_softc(dev); - struct nvram * nv; + struct nvram2env_softc *sc; + struct nvram *nv; char *pair, *value, *assign; - uint32_t sig, size, i; + uint32_t sig, size, i, *tmp; + + sc = device_get_softc(dev); if (sc->bst == 0 || sc->addr == 0) return (ENXIO); @@ -217,16 +219,22 @@ nvram2env_attach(device_t dev) if (sig == sc->sig || (sc->flags & NVRAM_FLAGS_UBOOT)) { - /* align and shift size to 32bit size*/ + /* align size to 32bit size*/ size += 3; - size >>= 2; + size &= ~3; - nv = malloc(size<<2, M_DEVBUF, M_WAITOK | M_ZERO); + nv = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); if (!nv) return (ENOMEM); + /* set tmp pointer to begin of NVRAM */ + tmp = (uint32_t *) nv; - for (i = 0; i < size; i ++) - ((uint32_t *)nv)[i] = read_4(sc, i<<2); + /* use read_4 to swap bytes if it's required */ + for (i = 0; i < size; i += 4) { + *tmp = read_4(sc, i); + tmp++; + } + /* now tmp pointer is end of NVRAM */ if (sc->flags & NVRAM_FLAGS_BROADCOM) { device_printf(dev, "sig = %#x\n", nv->sig); @@ -246,49 +254,47 @@ nvram2env_attach(device_t dev) else pair = (char*)nv+4; - for ( ; - (u_int32_t)pair < ((u_int32_t)nv + size - 4); - pair = pair + strlen(pair) + 1 + strlen(value) + 1 ) { + /* iterate over buffer till end. tmp points to end of NVRAM */ + for ( ; pair < (char*)tmp; + pair += strlen(pair) + strlen(value) + 2 ) { - if (pair && strlen(pair)) { + if (!pair || (strlen(pair) == 0)) + break; -#if 0 - printf("ENV: %s\n", pair); -#endif - /* hint.nvram.0. */ - assign = strchr(pair,'='); - assign[0] = '\0'; - value = assign+1; + /* hint.nvram.0. */ + assign = strchr(pair,'='); + assign[0] = '\0'; + value = assign+1; #if 1 - if (bootverbose) - printf("ENV: %s=%s\n", pair, value); + if (bootverbose) + printf("ENV: %s=%s\n", pair, value); +#else + printf("ENV: %s\n", pair); #endif - kern_setenv(pair, value); + kern_setenv(pair, value); - if (strcasecmp(pair, "WAN_MAC_ADDR") == 0) { - /* Alias for MAC address of eth0 */ - if (bootverbose) - printf("ENV: aliasing " - "WAN_MAC_ADDR to ethaddr" - " = %s\n", value); - kern_setenv("ethaddr", value); - } - else if (strcasecmp(pair, "LAN_MAC_ADDR") == 0){ - /* Alias for MAC address of eth1 */ - if (bootverbose) - printf("ENV: aliasing " - "LAN_MAC_ADDR to eth1addr" - " = %s\n", value); - kern_setenv("eth1addr", value); - } - - if (strcmp(pair, "bootverbose") == 0) - bootverbose = strtoul(value, 0, 0); - if (strcmp(pair, "boothowto" ) == 0) - boothowto = strtoul(value, 0, 0); + if (strcasecmp(pair, "WAN_MAC_ADDR") == 0) { + /* Alias for MAC address of eth0 */ + if (bootverbose) + printf("ENV: aliasing " + "WAN_MAC_ADDR to ethaddr" + " = %s\n", value); + kern_setenv("ethaddr", value); } - else - break; + else if (strcasecmp(pair, "LAN_MAC_ADDR") == 0){ + /* Alias for MAC address of eth1 */ + if (bootverbose) + printf("ENV: aliasing " + "LAN_MAC_ADDR to eth1addr" + " = %s\n", value); + kern_setenv("eth1addr", value); + } + + if (strcmp(pair, "bootverbose") == 0) + bootverbose = strtoul(value, 0, 0); + if (strcmp(pair, "boothowto" ) == 0) + boothowto = strtoul(value, 0, 0); + } free(nv, M_DEVBUF); } From owner-svn-src-head@freebsd.org Mon May 23 04:07:42 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CE38B448C8; Mon, 23 May 2016 04:07:42 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A6CF106C; Mon, 23 May 2016 04:07:42 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N47fva062980; Mon, 23 May 2016 04:07:41 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N47fvb062979; Mon, 23 May 2016 04:07:41 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201605230407.u4N47fvb062979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore <ian@FreeBSD.org> Date: Mon, 23 May 2016 04:07:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300447 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 04:07:42 -0000 Author: ian Date: Mon May 23 04:07:41 2016 New Revision: 300447 URL: https://svnweb.freebsd.org/changeset/base/300447 Log: Add a note on how to update a self-hosted armv6hf system to the entry describing the armv6hf->armv6 change. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon May 23 03:51:15 2016 (r300446) +++ head/UPDATING Mon May 23 04:07:41 2016 (r300447) @@ -45,6 +45,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 and packages may fail or need manual intervention to run. New packages will be needed. + To update an existing self-hosted armv6hf system, you must add + TARGET_ARCH=armv6 on the make command line for both the build + and the install steps. + 20160510: Kernel modules compiled outside of a kernel build now default to installing to /boot/modules instead of /boot/kernel. Many kernel From owner-svn-src-head@freebsd.org Mon May 23 04:17:28 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA410B44C72; Mon, 23 May 2016 04:17:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8C67416A2; Mon, 23 May 2016 04:17:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N4HRoL065936; Mon, 23 May 2016 04:17:27 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N4HRKl065935; Mon, 23 May 2016 04:17:27 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605230417.u4N4HRKl065935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Mon, 23 May 2016 04:17:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300448 - head/sys/gnu/dev/bwn/phy_n X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 04:17:28 -0000 Author: adrian Date: Mon May 23 04:17:27 2016 New Revision: 300448 URL: https://svnweb.freebsd.org/changeset/base/300448 Log: [bwn] convert another PHY-N workaround to the freebsd bwn format. These were hidden behind an #ifdef that we weren't setting. I don't have the hardware in question to check. Modified: head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c Modified: head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c ============================================================================== --- head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c Mon May 23 04:07:41 2016 (r300447) +++ head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c Mon May 23 04:17:27 2016 (r300448) @@ -6635,16 +6635,12 @@ bwn_nphy_op_prepare_structs(struct bwn_m if (mac->mac_phy.rev >= 2 && (siba_sprom_get_bf2_lo(sc->sc_dev) & BWN_BFL2_TXPWRCTRL_EN)) { nphy->txpwrctrl = true; -#ifdef CONFIG_BWN_SSB - if (dev->dev->bus_type == BWN_BUS_SSB && - dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI) { - struct pci_dev *pdev = - dev->dev->sdev->bus->host_pci; - if (pdev->device == 0x4328 || - pdev->device == 0x432a) + if (bwn_is_bus_siba(mac) && + (siba_get_type(sc->sc_dev) == SIBA_TYPE_PCI)) { + if ((siba_get_pci_device(sc->sc_dev) == 0x4328) || + (siba_get_pci_device(sc->sc_dev) == 0x432a)) nphy->pwg_gain_5ghz = true; } -#endif } else if (siba_sprom_get_bf2_lo(sc->sc_dev) & BWN_BFL2_5G_PWRGAIN) { nphy->pwg_gain_5ghz = true; } From owner-svn-src-head@freebsd.org Mon May 23 04:49:24 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADE84B4631F; Mon, 23 May 2016 04:49:24 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) by mx1.freebsd.org (Postfix) with ESMTP id 9309E12EB; Mon, 23 May 2016 04:49:24 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (unknown [10.1.1.2]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id 70400D3D4; Mon, 23 May 2016 04:49:23 +0000 (UTC) Subject: Re: svn commit: r298946 - head/usr.sbin/bsdinstall/scripts To: Andriy Voskoboinyk <avos@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201605022140.u42LeYFK051507@repo.freebsd.org> From: Allan Jude <allanjude@freebsd.org> Message-ID: <186c070f-eb81-370d-b215-1d9f370918b8@freebsd.org> Date: Mon, 23 May 2016 00:49:22 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <201605022140.u42LeYFK051507@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 04:49:24 -0000 On 2016-05-02 17:40, Andriy Voskoboinyk wrote: > Author: avos > Date: Mon May 2 21:40:34 2016 > New Revision: 298946 > URL: https://svnweb.freebsd.org/changeset/base/298946 > > Log: > bsdinstall: fix static address assignment for protected wireless networks. > > Filter out IFCONFIG_PREFIX variable (which may contain WPA keyword) > from ifconfig parameters. > > PR: 169199 > > Modified: > head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 > > Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 > ============================================================================== > --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Mon May 2 21:23:05 2016 (r298945) > +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Mon May 2 21:40:34 2016 (r298946) > @@ -84,7 +84,7 @@ retval=$? > > if [ "$BSDINSTALL_CONFIGCURRENT" ]; then > . $BSDINSTALL_TMPETC/._rc.conf.net > - ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE` > + ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE | sed "s|$2||"` > if [ "$defaultrouter" ]; then > route delete -inet default > route add -inet default $defaultrouter > This breaks static assignment of IP addresses to wired interfaces: sed: first RE may not be empty -- Allan Jude From owner-svn-src-head@freebsd.org Mon May 23 05:00:29 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A99AEB46591; Mon, 23 May 2016 05:00:29 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) by mx1.freebsd.org (Postfix) with ESMTP id 7A1E41B44; Mon, 23 May 2016 05:00:29 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (unknown [10.1.1.2]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id 69782D402; Mon, 23 May 2016 05:00:28 +0000 (UTC) Subject: Re: svn commit: r298946 - head/usr.sbin/bsdinstall/scripts To: Andriy Voskoboinyk <avos@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201605022140.u42LeYFK051507@repo.freebsd.org> <186c070f-eb81-370d-b215-1d9f370918b8@freebsd.org> From: Allan Jude <allanjude@freebsd.org> Message-ID: <e01538e8-0b18-754a-5949-47a85533ecab@freebsd.org> Date: Mon, 23 May 2016 01:00:27 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <186c070f-eb81-370d-b215-1d9f370918b8@freebsd.org> Content-Type: multipart/mixed; boundary="------------26E0DFE394FD6CFD610C9DF3" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 05:00:29 -0000 This is a multi-part message in MIME format. --------------26E0DFE394FD6CFD610C9DF3 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 2016-05-23 00:49, Allan Jude wrote: > On 2016-05-02 17:40, Andriy Voskoboinyk wrote: >> Author: avos >> Date: Mon May 2 21:40:34 2016 >> New Revision: 298946 >> URL: https://svnweb.freebsd.org/changeset/base/298946 >> >> Log: >> bsdinstall: fix static address assignment for protected wireless networks. >> >> Filter out IFCONFIG_PREFIX variable (which may contain WPA keyword) >> from ifconfig parameters. >> >> PR: 169199 >> >> Modified: >> head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 >> >> Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 >> ============================================================================== >> --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Mon May 2 21:23:05 2016 (r298945) >> +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Mon May 2 21:40:34 2016 (r298946) >> @@ -84,7 +84,7 @@ retval=$? >> >> if [ "$BSDINSTALL_CONFIGCURRENT" ]; then >> . $BSDINSTALL_TMPETC/._rc.conf.net >> - ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE` >> + ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE | sed "s|$2||"` >> if [ "$defaultrouter" ]; then >> route delete -inet default >> route add -inet default $defaultrouter >> > > This breaks static assignment of IP addresses to wired interfaces: > > sed: first RE may not be empty > > I wrote this patch for the issue. Unless you see a better way to do it? -- Allan Jude --------------26E0DFE394FD6CFD610C9DF3 Content-Type: text/plain; charset=UTF-8; name="bsdinstall_netif.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="bsdinstall_netif.patch" SW5kZXg6IHVzci5zYmluL2JzZGluc3RhbGwvc2NyaXB0cy9uZXRjb25maWdfaXB2NAo9PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09Ci0tLSB1c3Iuc2Jpbi9ic2RpbnN0YWxsL3NjcmlwdHMvbmV0Y29uZmlnX2lw djQJKHJldmlzaW9uIDMwMDQzNikKKysrIHVzci5zYmluL2JzZGluc3RhbGwvc2NyaXB0cy9u ZXRjb25maWdfaXB2NAkod29ya2luZyBjb3B5KQpAQCAtODQsNyArODQsMTEgQEAKIAogaWYg WyAiJEJTRElOU1RBTExfQ09ORklHQ1VSUkVOVCIgXTsgdGhlbgogCS4gJEJTRElOU1RBTExf VE1QRVRDLy5fcmMuY29uZi5uZXQKLQlpZmNvbmZpZyAkSU5URVJGQUNFIGBldmFsIGVjaG8g XFxcJGlmY29uZmlnXyRJTlRFUkZBQ0UgfCBzZWQgInN8JDJ8fCJgCisJaWYgWyAtbiAiJDIi IF07IHRoZW4KKwkJaWZjb25maWcgJElOVEVSRkFDRSBgZXZhbCBlY2hvIFxcXCRpZmNvbmZp Z18kSU5URVJGQUNFIHwgc2VkICJzfCQyfHwiYAorCWVsc2UKKwkJaWZjb25maWcgJElOVEVS RkFDRSBgZXZhbCBlY2hvIFxcXCRpZmNvbmZpZ18kSU5URVJGQUNFYAorCWZpCiAJaWYgWyAi JGRlZmF1bHRyb3V0ZXIiIF07IHRoZW4KIAkJcm91dGUgZGVsZXRlIC1pbmV0IGRlZmF1bHQK IAkJcm91dGUgYWRkIC1pbmV0IGRlZmF1bHQgJGRlZmF1bHRyb3V0ZXIK --------------26E0DFE394FD6CFD610C9DF3-- From owner-svn-src-head@freebsd.org Mon May 23 05:11:40 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 269DDB468F2; Mon, 23 May 2016 05:11:40 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF42814E6; Mon, 23 May 2016 05:11:39 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5BcIp082232; Mon, 23 May 2016 05:11:38 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5Bcp8082230; Mon, 23 May 2016 05:11:38 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605230511.u4N5Bcp8082230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Mon, 23 May 2016 05:11:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300455 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 05:11:40 -0000 Author: sephe Date: Mon May 23 05:11:38 2016 New Revision: 300455 URL: https://svnweb.freebsd.org/changeset/base/300455 Log: hyperv: Move guest id setup to early place And - Rework the guest id composition. - Nuke useless saved guest_id. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6430 Modified: head/sys/dev/hyperv/vmbus/hv_hv.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_hv.c Mon May 23 05:11:31 2016 (r300454) +++ head/sys/dev/hyperv/vmbus/hv_hv.c Mon May 23 05:11:38 2016 (r300455) @@ -50,6 +50,35 @@ __FBSDID("$FreeBSD$"); #define HYPERV_INTERFACE 0x31237648 /* HV#1 */ +/* + * The guest OS needs to register the guest ID with the hypervisor. + * The guest ID is a 64 bit entity and the structure of this ID is + * specified in the Hyper-V specification: + * + * http://msdn.microsoft.com/en-us/library/windows/ + * hardware/ff542653%28v=vs.85%29.aspx + * + * While the current guideline does not specify how FreeBSD guest ID(s) + * need to be generated, our plan is to publish the guidelines for + * FreeBSD and other guest operating systems that currently are hosted + * on Hyper-V. The implementation here conforms to this yet + * unpublished guidelines. + * + * Bit(s) + * 63 - Indicates if the OS is Open Source or not; 1 is Open Source + * 62:56 - Os Type: FreeBSD is 0x02 + * 55:48 - Distro specific identification + * 47:16 - FreeBSD kernel version number + * 15:0 - Distro specific identification + */ +#define HYPERV_GUESTID_OSS (0x1ULL << 63) +#define HYPERV_GUESTID_FREEBSD (0x02ULL << 56) +#define HYPERV_GUESTID(id) \ + (HYPERV_GUESTID_OSS | HYPERV_GUESTID_FREEBSD | \ + (((uint64_t)(((id) & 0xff0000) >> 16)) << 48) |\ + (((uint64_t)__FreeBSD_version) << 16) | \ + ((uint64_t)((id) & 0x00ffff))) + static u_int hv_get_timecount(struct timecounter *tc); u_int hyperv_features; @@ -143,13 +172,6 @@ hv_vmbus_init(void) goto cleanup; /* - * Write our OS info - */ - uint64_t os_guest_info = HV_FREEBSD_GUEST_ID; - wrmsr(HV_X64_MSR_GUEST_OS_ID, os_guest_info); - hv_vmbus_g_context.guest_id = os_guest_info; - - /* * See if the hypercall page is already set */ hypercall_msr.as_uint64_t = rdmsr(HV_X64_MSR_HYPERCALL); @@ -192,16 +214,13 @@ hv_vmbus_init(void) void hv_vmbus_cleanup(void) { - hv_vmbus_x64_msr_hypercall_contents hypercall_msr; + if (hv_vmbus_g_context.hypercall_page != NULL) { + hv_vmbus_x64_msr_hypercall_contents hypercall_msr; - if (hv_vmbus_g_context.guest_id == HV_FREEBSD_GUEST_ID) { - if (hv_vmbus_g_context.hypercall_page != NULL) { hypercall_msr.as_uint64_t = 0; - wrmsr(HV_X64_MSR_HYPERCALL, - hypercall_msr.as_uint64_t); + wrmsr(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64_t); free(hv_vmbus_g_context.hypercall_page, M_DEVBUF); hv_vmbus_g_context.hypercall_page = NULL; - } } } @@ -508,6 +527,9 @@ hyperv_init(void *dummy __unused) return; } + /* Write guest id */ + wrmsr(HV_X64_MSR_GUEST_OS_ID, HYPERV_GUESTID(0)); + if (hyperv_features & HV_FEATURE_MSR_TIME_REFCNT) { /* Register virtual timecount */ tc_init(&hv_timecounter); Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon May 23 05:11:31 2016 (r300454) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon May 23 05:11:38 2016 (r300455) @@ -198,7 +198,6 @@ enum { #define HV_HYPERCALL_PARAM_ALIGN sizeof(uint64_t) typedef struct { - uint64_t guest_id; void* hypercall_page; hv_bool_uint8_t syn_ic_initialized; @@ -763,44 +762,6 @@ void hv_et_intr(struct trapframe*); /* Wait for device creation */ void vmbus_scan(void); -/* - * The guest OS needs to register the guest ID with the hypervisor. - * The guest ID is a 64 bit entity and the structure of this ID is - * specified in the Hyper-V specification: - * - * http://msdn.microsoft.com/en-us/library/windows/ - * hardware/ff542653%28v=vs.85%29.aspx - * - * While the current guideline does not specify how FreeBSD guest ID(s) - * need to be generated, our plan is to publish the guidelines for - * FreeBSD and other guest operating systems that currently are hosted - * on Hyper-V. The implementation here conforms to this yet - * unpublished guidelines. - * - * Bit(s) - * 63 - Indicates if the OS is Open Source or not; 1 is Open Source - * 62:56 - Os Type; Linux is 0x100, FreeBSD is 0x200 - * 55:48 - Distro specific identification - * 47:16 - FreeBSD kernel version number - * 15:0 - Distro specific identification - * - */ - -#define HV_FREEBSD_VENDOR_ID 0x8200 -#define HV_FREEBSD_GUEST_ID hv_generate_guest_id(0,0) - -static inline uint64_t hv_generate_guest_id( - uint8_t distro_id_part1, - uint16_t distro_id_part2) -{ - uint64_t guest_id; - guest_id = (((uint64_t)HV_FREEBSD_VENDOR_ID) << 48); - guest_id |= (((uint64_t)(distro_id_part1)) << 48); - guest_id |= (((uint64_t)(__FreeBSD_version)) << 16); /* in param.h */ - guest_id |= ((uint64_t)(distro_id_part2)); - return guest_id; -} - typedef struct { unsigned int vector; void *page_buffers[2 * MAXCPU]; From owner-svn-src-head@freebsd.org Mon May 23 05:52:48 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBF9FB469C9; Mon, 23 May 2016 05:52:48 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE9E81313; Mon, 23 May 2016 05:52:48 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5qlLI097784; Mon, 23 May 2016 05:52:47 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5ql1O097783; Mon, 23 May 2016 05:52:47 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605230552.u4N5ql1O097783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Mon, 23 May 2016 05:52:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300474 - head/sys/dev/siba X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 05:52:49 -0000 Author: adrian Date: Mon May 23 05:52:47 2016 New Revision: 300474 URL: https://svnweb.freebsd.org/changeset/base/300474 Log: [siba] update device ids. Tested: * BCM4322 11abgn, STA mode Modified: head/sys/dev/siba/siba_bwn.c Modified: head/sys/dev/siba/siba_bwn.c ============================================================================== --- head/sys/dev/siba/siba_bwn.c Mon May 23 05:45:52 2016 (r300473) +++ head/sys/dev/siba/siba_bwn.c Mon May 23 05:52:47 2016 (r300474) @@ -93,9 +93,9 @@ static const struct siba_dev { { PCI_VENDOR_BROADCOM, 0x4324, "Broadcom BCM4309 802.11a/b/g Wireless" }, { PCI_VENDOR_BROADCOM, 0x4325, "Broadcom BCM4306 802.11b/g Wireless" }, - { PCI_VENDOR_BROADCOM, 0x4328, "Broadcom BCM4321 802.11a/b/g Wireless" }, + { PCI_VENDOR_BROADCOM, 0x4328, "Broadcom BCM4321 802.11a/b/g/n Wireless" }, { PCI_VENDOR_BROADCOM, 0x4329, "Unknown" }, - { PCI_VENDOR_BROADCOM, 0x432b, "Unknown" } + { PCI_VENDOR_BROADCOM, 0x432b, "Broadcom BCM4322 802.11a/b/g/n Wireless" } }; int siba_core_attach(struct siba_softc *); From owner-svn-src-head@freebsd.org Mon May 23 06:35:12 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E68A0B464B0; Mon, 23 May 2016 06:35:12 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A9DB51AD2; Mon, 23 May 2016 06:35:12 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N6ZBpx010726; Mon, 23 May 2016 06:35:11 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N6ZBQJ010721; Mon, 23 May 2016 06:35:11 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605230635.u4N6ZBQJ010721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Mon, 23 May 2016 06:35:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300478 - in head/sys: conf dev/hyperv/include dev/hyperv/vmbus modules/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 06:35:13 -0000 Author: sephe Date: Mon May 23 06:35:11 2016 New Revision: 300478 URL: https://svnweb.freebsd.org/changeset/base/300478 Log: hyperv: Add helpers for busdma(9) operation MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6443 Added: head/sys/dev/hyperv/include/hyperv_busdma.h (contents, props changed) head/sys/dev/hyperv/vmbus/hyperv_busdma.c (contents, props changed) Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/hyperv/vmbus/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Mon May 23 06:13:35 2016 (r300477) +++ head/sys/conf/files.amd64 Mon May 23 06:35:11 2016 (r300478) @@ -277,6 +277,7 @@ dev/hyperv/vmbus/hv_hv.c optional hyp dev/hyperv/vmbus/hv_et.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c optional hyperv +dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/amd64/hv_vector.S optional hyperv dev/nfe/if_nfe.c optional nfe pci dev/ntb/if_ntb/if_ntb.c optional if_ntb Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Mon May 23 06:13:35 2016 (r300477) +++ head/sys/conf/files.i386 Mon May 23 06:35:11 2016 (r300478) @@ -252,6 +252,7 @@ dev/hyperv/vmbus/hv_hv.c optional hyp dev/hyperv/vmbus/hv_et.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c optional hyperv +dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/i386/hv_vector.S optional hyperv dev/ichwd/ichwd.c optional ichwd dev/if_ndis/if_ndis.c optional ndis Added: head/sys/dev/hyperv/include/hyperv_busdma.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/include/hyperv_busdma.h Mon May 23 06:35:11 2016 (r300478) @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _HYPERV_BUSDMA_H_ +#define _HYPERV_BUSDMA_H_ + +struct hyperv_dma { + bus_addr_t hv_paddr; + bus_dma_tag_t hv_dtag; + bus_dmamap_t hv_dmap; +}; + +void hyperv_dma_map_paddr(void *arg, bus_dma_segment_t *segs, int nseg, + int error); +void *hyperv_dmamem_alloc(bus_dma_tag_t parent_dtag, bus_size_t alignment, + bus_addr_t boundary, bus_size_t size, struct hyperv_dma *dma, + int flags); +void hyperv_dmamem_free(struct hyperv_dma *dma, void *ptr); + +#endif /* !_HYPERV_BUSDMA_H_ */ Added: head/sys/dev/hyperv/vmbus/hyperv_busdma.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/vmbus/hyperv_busdma.c Mon May 23 06:35:11 2016 (r300478) @@ -0,0 +1,98 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, 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 <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/bus.h> + +#include <machine/bus.h> + +#include <dev/hyperv/include/hyperv_busdma.h> + +#define HYPERV_DMA_WAITMASK (BUS_DMA_WAITOK | BUS_DMA_NOWAIT) + +void +hyperv_dma_map_paddr(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + bus_addr_t *paddr = arg; + + if (error) + return; + + KASSERT(nseg == 1, ("too many segments %d!", nseg)); + *paddr = segs->ds_addr; +} + +void * +hyperv_dmamem_alloc(bus_dma_tag_t parent_dtag, bus_size_t alignment, + bus_addr_t boundary, bus_size_t size, struct hyperv_dma *dma, int flags) +{ + void *ret; + int error; + + error = bus_dma_tag_create(parent_dtag, /* parent */ + alignment, /* alignment */ + boundary, /* boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + size, /* maxsize */ + 1, /* nsegments */ + size, /* maxsegsize */ + 0, /* flags */ + NULL, /* lockfunc */ + NULL, /* lockfuncarg */ + &dma->hv_dtag); + if (error) + return NULL; + + error = bus_dmamem_alloc(dma->hv_dtag, &ret, + (flags & HYPERV_DMA_WAITMASK) | BUS_DMA_COHERENT, &dma->hv_dmap); + if (error) { + bus_dma_tag_destroy(dma->hv_dtag); + return NULL; + } + + error = bus_dmamap_load(dma->hv_dtag, dma->hv_dmap, ret, size, + hyperv_dma_map_paddr, &dma->hv_paddr, BUS_DMA_NOWAIT); + if (error) { + bus_dmamem_free(dma->hv_dtag, ret, dma->hv_dmap); + bus_dma_tag_destroy(dma->hv_dtag); + return NULL; + } + return ret; +} + +void +hyperv_dmamem_free(struct hyperv_dma *dma, void *ptr) +{ + bus_dmamap_unload(dma->hv_dtag, dma->hv_dmap); + bus_dmamem_free(dma->hv_dtag, ptr, dma->hv_dmap); + bus_dma_tag_destroy(dma->hv_dtag); +} Modified: head/sys/modules/hyperv/vmbus/Makefile ============================================================================== --- head/sys/modules/hyperv/vmbus/Makefile Mon May 23 06:13:35 2016 (r300477) +++ head/sys/modules/hyperv/vmbus/Makefile Mon May 23 06:35:11 2016 (r300478) @@ -11,7 +11,8 @@ SRCS= hv_channel.c \ hv_hv.c \ hv_ring_buffer.c \ hv_vmbus_drv_freebsd.c \ - hv_vmbus_priv.h + hv_vmbus_priv.h \ + hyperv_busdma.c SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h # XXX: for assym.s From owner-svn-src-head@freebsd.org Mon May 23 06:52:43 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 482BFB46811; Mon, 23 May 2016 06:52:43 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1553911C6; Mon, 23 May 2016 06:52:43 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N6qgmE016503; Mon, 23 May 2016 06:52:42 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N6qgXo016502; Mon, 23 May 2016 06:52:42 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605230652.u4N6qgXo016502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Mon, 23 May 2016 06:52:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300479 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 06:52:43 -0000 Author: sephe Date: Mon May 23 06:52:42 2016 New Revision: 300479 URL: https://svnweb.freebsd.org/changeset/base/300479 Log: hyperv/hn: Use hyperv busdma(9) helper. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6444 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon May 23 06:35:11 2016 (r300478) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon May 23 06:52:42 2016 (r300479) @@ -113,6 +113,7 @@ __FBSDID("$FreeBSD$"); #include <machine/in_cksum.h> #include <dev/hyperv/include/hyperv.h> +#include <dev/hyperv/include/hyperv_busdma.h> #include "hv_net_vsc.h" #include "hv_rndis.h" #include "hv_rndis_filter.h" @@ -2171,18 +2172,6 @@ hn_check_iplen(const struct mbuf *m, int } static void -hn_dma_map_paddr(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - bus_addr_t *paddr = arg; - - if (error) - return; - - KASSERT(nseg == 1, ("too many segments %d!", nseg)); - *paddr = segs->ds_addr; -} - -static void hn_create_rx_data(struct hn_softc *sc, int ring_cnt) { struct sysctl_oid_list *child; @@ -2472,7 +2461,7 @@ hn_create_tx_ring(struct hn_softc *sc, i error = bus_dmamap_load(txr->hn_tx_rndis_dtag, txd->rndis_msg_dmap, txd->rndis_msg, HN_RNDIS_MSG_LEN, - hn_dma_map_paddr, &txd->rndis_msg_paddr, + hyperv_dma_map_paddr, &txd->rndis_msg_paddr, BUS_DMA_NOWAIT); if (error) { device_printf(sc->hn_dev, From owner-svn-src-head@freebsd.org Mon May 23 07:06:54 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECFEEB469FB; Mon, 23 May 2016 07:06:54 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D4431807; Mon, 23 May 2016 07:06:54 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N76rAK019745; Mon, 23 May 2016 07:06:53 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N76rov019741; Mon, 23 May 2016 07:06:53 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605230706.u4N76rov019741@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Mon, 23 May 2016 07:06:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300480 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 07:06:55 -0000 Author: sephe Date: Mon May 23 07:06:53 2016 New Revision: 300480 URL: https://svnweb.freebsd.org/changeset/base/300480 Log: hyperv: Move Hypercall setup to an early place. It does not belong to the vmbus. While I'm here rework the Hypercall setup, e.g. use busdma(9) and avoid bit fields. Discussed with: Jun Su <junsu microsoft com> MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6445 Added: head/sys/dev/hyperv/vmbus/hyperv_reg.h (contents, props changed) Modified: head/sys/dev/hyperv/vmbus/hv_hv.c head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_hv.c Mon May 23 06:52:42 2016 (r300479) +++ head/sys/dev/hyperv/vmbus/hv_hv.c Mon May 23 07:06:53 2016 (r300480) @@ -43,8 +43,9 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_param.h> #include <vm/pmap.h> - -#include "hv_vmbus_priv.h" +#include <dev/hyperv/include/hyperv_busdma.h> +#include <dev/hyperv/vmbus/hv_vmbus_priv.h> +#include <dev/hyperv/vmbus/hyperv_reg.h> #define HV_NANOSECONDS_PER_SEC 1000000000L @@ -79,6 +80,13 @@ __FBSDID("$FreeBSD$"); (((uint64_t)__FreeBSD_version) << 16) | \ ((uint64_t)((id) & 0x00ffff))) +struct hypercall_ctx { + void *hc_addr; + struct hyperv_dma hc_dma; +}; + +static struct hypercall_ctx hypercall_context; + static u_int hv_get_timecount(struct timecounter *tc); u_int hyperv_features; @@ -92,7 +100,6 @@ static u_int hyperv_features3; */ hv_vmbus_context hv_vmbus_g_context = { .syn_ic_initialized = FALSE, - .hypercall_page = NULL, }; static struct timecounter hv_timecounter = { @@ -116,7 +123,7 @@ hv_vmbus_do_hypercall(uint64_t control, uint64_t hv_status = 0; uint64_t input_address = (input) ? hv_get_phys_addr(input) : 0; uint64_t output_address = (output) ? hv_get_phys_addr(output) : 0; - volatile void* hypercall_page = hv_vmbus_g_context.hypercall_page; + volatile void *hypercall_page = hypercall_context.hc_addr; __asm__ __volatile__ ("mov %0, %%r8" : : "r" (output_address): "r8"); __asm__ __volatile__ ("call *%3" : "=a"(hv_status): @@ -134,7 +141,7 @@ hv_vmbus_do_hypercall(uint64_t control, uint64_t output_address = (output) ? hv_get_phys_addr(output) : 0; uint32_t output_address_high = output_address >> 32; uint32_t output_address_low = output_address & 0xFFFFFFFF; - volatile void* hypercall_page = hv_vmbus_g_context.hypercall_page; + volatile void *hypercall_page = hypercall_context.hc_addr; __asm__ __volatile__ ("call *%8" : "=d"(hv_status_high), "=a"(hv_status_low) : "d" (control_high), @@ -147,84 +154,6 @@ hv_vmbus_do_hypercall(uint64_t control, } /** - * @brief Main initialization routine. - * - * This routine must be called - * before any other routines in here are called - */ -int -hv_vmbus_init(void) -{ - hv_vmbus_x64_msr_hypercall_contents hypercall_msr; - void* virt_addr = NULL; - - memset( - hv_vmbus_g_context.syn_ic_event_page, - 0, - sizeof(hv_vmbus_handle) * MAXCPU); - - memset( - hv_vmbus_g_context.syn_ic_msg_page, - 0, - sizeof(hv_vmbus_handle) * MAXCPU); - - if (vm_guest != VM_GUEST_HV) - goto cleanup; - - /* - * See if the hypercall page is already set - */ - hypercall_msr.as_uint64_t = rdmsr(HV_X64_MSR_HYPERCALL); - virt_addr = malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO); - - hypercall_msr.u.enable = 1; - hypercall_msr.u.guest_physical_address = - (hv_get_phys_addr(virt_addr) >> PAGE_SHIFT); - wrmsr(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64_t); - - /* - * Confirm that hypercall page did get set up - */ - hypercall_msr.as_uint64_t = 0; - hypercall_msr.as_uint64_t = rdmsr(HV_X64_MSR_HYPERCALL); - - if (!hypercall_msr.u.enable) - goto cleanup; - - hv_vmbus_g_context.hypercall_page = virt_addr; - - return (0); - - cleanup: - if (virt_addr != NULL) { - if (hypercall_msr.u.enable) { - hypercall_msr.as_uint64_t = 0; - wrmsr(HV_X64_MSR_HYPERCALL, - hypercall_msr.as_uint64_t); - } - - free(virt_addr, M_DEVBUF); - } - return (ENOTSUP); -} - -/** - * @brief Cleanup routine, called normally during driver unloading or exiting - */ -void -hv_vmbus_cleanup(void) -{ - if (hv_vmbus_g_context.hypercall_page != NULL) { - hv_vmbus_x64_msr_hypercall_contents hypercall_msr; - - hypercall_msr.as_uint64_t = 0; - wrmsr(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64_t); - free(hv_vmbus_g_context.hypercall_page, M_DEVBUF); - hv_vmbus_g_context.hypercall_page = NULL; - } -} - -/** * @brief Post a message using the hypervisor message IPC. * (This involves a hypercall.) */ @@ -304,9 +233,6 @@ hv_vmbus_synic_init(void *arg) cpu = PCPU_GET(cpuid); - if (hv_vmbus_g_context.hypercall_page == NULL) - return; - /* * TODO: Check the version */ @@ -537,3 +463,74 @@ hyperv_init(void *dummy __unused) } SYSINIT(hyperv_initialize, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, hyperv_init, NULL); + +static void +hypercall_memfree(void) +{ + hyperv_dmamem_free(&hypercall_context.hc_dma, + hypercall_context.hc_addr); + hypercall_context.hc_addr = NULL; +} + +static void +hypercall_create(void *arg __unused) +{ + uint64_t hc, hc_orig; + + if (vm_guest != VM_GUEST_HV) + return; + + hypercall_context.hc_addr = hyperv_dmamem_alloc(NULL, PAGE_SIZE, 0, + PAGE_SIZE, &hypercall_context.hc_dma, BUS_DMA_WAITOK); + if (hypercall_context.hc_addr == NULL) { + printf("hyperv: Hypercall page allocation failed\n"); + /* Can't perform any Hyper-V specific actions */ + vm_guest = VM_GUEST_VM; + return; + } + + /* Get the 'reserved' bits, which requires preservation. */ + hc_orig = rdmsr(MSR_HV_HYPERCALL); + + /* + * Setup the Hypercall page. + * + * NOTE: 'reserved' bits MUST be preserved. + */ + hc = ((hypercall_context.hc_dma.hv_paddr >> PAGE_SHIFT) << + MSR_HV_HYPERCALL_PGSHIFT) | + (hc_orig & MSR_HV_HYPERCALL_RSVD_MASK) | + MSR_HV_HYPERCALL_ENABLE; + wrmsr(MSR_HV_HYPERCALL, hc); + + /* + * Confirm that Hypercall page did get setup. + */ + hc = rdmsr(MSR_HV_HYPERCALL); + if ((hc & MSR_HV_HYPERCALL_ENABLE) == 0) { + printf("hyperv: Hypercall setup failed\n"); + hypercall_memfree(); + /* Can't perform any Hyper-V specific actions */ + vm_guest = VM_GUEST_VM; + return; + } + if (bootverbose) + printf("hyperv: Hypercall created\n"); +} +SYSINIT(hypercall_ctor, SI_SUB_DRIVERS, SI_ORDER_FIRST, hypercall_create, NULL); + +static void +hypercall_destroy(void *arg __unused) +{ + if (hypercall_context.hc_addr == NULL) + return; + + /* Disable Hypercall */ + wrmsr(MSR_HV_HYPERCALL, 0); + hypercall_memfree(); + + if (bootverbose) + printf("hyperv: Hypercall destroyed\n"); +} +SYSUNINIT(hypercall_dtor, SI_SUB_DRIVERS, SI_ORDER_FIRST, hypercall_destroy, + NULL); Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Mon May 23 06:52:42 2016 (r300479) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Mon May 23 07:06:53 2016 (r300480) @@ -349,7 +349,7 @@ static int vmbus_probe(device_t dev) { if (ACPI_ID_PROBE(device_get_parent(dev), dev, vmbus_ids) == NULL || - device_get_unit(dev) != 0) + device_get_unit(dev) != 0 || vm_guest != VM_GUEST_HV) return (ENXIO); device_set_desc(dev, "Hyper-V Vmbus"); @@ -385,14 +385,6 @@ vmbus_bus_init(void) vmbus_inited = 1; sc = vmbus_get_softc(); - ret = hv_vmbus_init(); - - if (ret) { - if(bootverbose) - printf("Error VMBUS: Hypervisor Initialization Failed!\n"); - return (ret); - } - /* * Find a free IDT slot for vmbus callback. */ @@ -401,6 +393,7 @@ vmbus_bus_init(void) if(bootverbose) printf("Error VMBUS: Cannot find free IDT slot for " "vmbus callback!\n"); + ret = ENXIO; goto cleanup; } @@ -504,8 +497,6 @@ vmbus_bus_init(void) lapic_ipi_free(hv_vmbus_g_context.hv_cb_vector); cleanup: - hv_vmbus_cleanup(); - return (ret); } @@ -578,8 +569,6 @@ vmbus_detach(device_t dev) free(setup_args.page_buffers[i], M_DEVBUF); } - hv_vmbus_cleanup(); - /* remove swi */ CPU_FOREACH(i) { if (hv_vmbus_g_context.hv_event_queue[i] != NULL) { Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon May 23 06:52:42 2016 (r300479) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon May 23 07:06:53 2016 (r300480) @@ -198,7 +198,6 @@ enum { #define HV_HYPERCALL_PARAM_ALIGN sizeof(uint64_t) typedef struct { - void* hypercall_page; hv_bool_uint8_t syn_ic_initialized; hv_vmbus_handle syn_ic_msg_page[MAXCPU]; @@ -722,8 +721,6 @@ hv_vmbus_channel* hv_vmbus_allocate_chan void hv_vmbus_free_vmbus_channel(hv_vmbus_channel *channel); int hv_vmbus_request_channel_offers(void); void hv_vmbus_release_unattached_channels(void); -int hv_vmbus_init(void); -void hv_vmbus_cleanup(void); uint16_t hv_vmbus_post_msg_via_msg_ipc( hv_vmbus_connection_id connection_id, Added: head/sys/dev/hyperv/vmbus/hyperv_reg.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/vmbus/hyperv_reg.h Mon May 23 07:06:53 2016 (r300480) @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _HYPERV_REG_H_ +#define _HYPERV_REG_H_ + +#define MSR_HV_HYPERCALL 0x40000001 +#define MSR_HV_HYPERCALL_ENABLE 0x0001ULL +#define MSR_HV_HYPERCALL_RSVD_MASK 0x0ffeULL +#define MSR_HV_HYPERCALL_PGSHIFT 12 + +#endif /* !_HYPERV_REG_H_ */ From owner-svn-src-head@freebsd.org Mon May 23 07:14:05 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF4BCB46C43; Mon, 23 May 2016 07:14:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6BE41C8D; Mon, 23 May 2016 07:14:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N7E4TF022668; Mon, 23 May 2016 07:14:04 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N7E4LE022665; Mon, 23 May 2016 07:14:04 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605230714.u4N7E4LE022665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Mon, 23 May 2016 07:14:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300481 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 07:14:05 -0000 Author: sephe Date: Mon May 23 07:14:04 2016 New Revision: 300481 URL: https://svnweb.freebsd.org/changeset/base/300481 Log: hyperv/vmbus: Declare Synic message and event w/ proper types Avoid ugly casts. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6446 Modified: head/sys/dev/hyperv/vmbus/hv_connection.c head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Mon May 23 07:06:53 2016 (r300480) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Mon May 23 07:14:04 2016 (r300481) @@ -333,8 +333,8 @@ vmbus_event_proc(struct vmbus_softc *sc, { hv_vmbus_synic_event_flags *event; - event = ((hv_vmbus_synic_event_flags *) - hv_vmbus_g_context.syn_ic_event_page[cpu]) + HV_VMBUS_MESSAGE_SINT; + event = hv_vmbus_g_context.syn_ic_event_page[cpu] + + HV_VMBUS_MESSAGE_SINT; /* * On Host with Win8 or above, the event page can be checked directly @@ -349,8 +349,8 @@ vmbus_event_proc_compat(struct vmbus_sof { hv_vmbus_synic_event_flags *event; - event = ((hv_vmbus_synic_event_flags *) - hv_vmbus_g_context.syn_ic_event_page[cpu]) + HV_VMBUS_MESSAGE_SINT; + event = hv_vmbus_g_context.syn_ic_event_page[cpu] + + HV_VMBUS_MESSAGE_SINT; if (atomic_testandclear_int(&event->flags32[0], 0)) { vmbus_event_flags_proc( Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Mon May 23 07:06:53 2016 (r300480) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Mon May 23 07:14:04 2016 (r300481) @@ -79,8 +79,9 @@ vmbus_msg_task(void *arg __unused, int p { hv_vmbus_message *msg; - msg = ((hv_vmbus_message *)hv_vmbus_g_context.syn_ic_msg_page[curcpu]) + + msg = hv_vmbus_g_context.syn_ic_msg_page[curcpu] + HV_VMBUS_MESSAGE_SINT; + for (;;) { const hv_vmbus_channel_msg_table_entry *entry; hv_vmbus_channel_msg_header *hdr; @@ -134,9 +135,8 @@ static inline int hv_vmbus_isr(struct trapframe *frame) { struct vmbus_softc *sc = vmbus_get_softc(); + hv_vmbus_message *msg, *msg_base; int cpu = curcpu; - hv_vmbus_message *msg; - void *page_addr; /* * The Windows team has advised that we check for events @@ -146,8 +146,8 @@ hv_vmbus_isr(struct trapframe *frame) sc->vmbus_event_proc(sc, cpu); /* Check if there are actual msgs to be process */ - page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu]; - msg = ((hv_vmbus_message *)page_addr) + HV_VMBUS_TIMER_SINT; + msg_base = hv_vmbus_g_context.syn_ic_msg_page[cpu]; + msg = msg_base + HV_VMBUS_TIMER_SINT; /* we call eventtimer process the message */ if (msg->header.message_type == HV_MESSAGE_TIMER_EXPIRED) { @@ -178,7 +178,7 @@ hv_vmbus_isr(struct trapframe *frame) } } - msg = ((hv_vmbus_message *)page_addr) + HV_VMBUS_MESSAGE_SINT; + msg = msg_base + HV_VMBUS_MESSAGE_SINT; if (msg->header.message_type != HV_MESSAGE_TYPE_NONE) { taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[cpu], &hv_vmbus_g_context.hv_msg_task[cpu]); Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon May 23 07:06:53 2016 (r300480) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon May 23 07:14:04 2016 (r300481) @@ -197,11 +197,14 @@ enum { #define HV_HYPERCALL_PARAM_ALIGN sizeof(uint64_t) +struct vmbus_message; +union vmbus_event_flags; + typedef struct { hv_bool_uint8_t syn_ic_initialized; - hv_vmbus_handle syn_ic_msg_page[MAXCPU]; - hv_vmbus_handle syn_ic_event_page[MAXCPU]; + struct vmbus_message *syn_ic_msg_page[MAXCPU]; + union vmbus_event_flags *syn_ic_event_page[MAXCPU]; /* * For FreeBSD cpuid to Hyper-V vcpuid mapping. */ @@ -303,7 +306,7 @@ typedef struct { /* * Define synthetic interrupt controller message format */ -typedef struct { +typedef struct vmbus_message { hv_vmbus_msg_header header; union { uint64_t payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; @@ -578,7 +581,7 @@ typedef struct { /* * Define the synthetic interrupt controller event flags format */ -typedef union { +typedef union vmbus_event_flags { uint8_t flags8[HV_EVENT_FLAGS_BYTE_COUNT]; uint32_t flags32[HV_EVENT_FLAGS_DWORD_COUNT]; unsigned long flagsul[HV_EVENT_FLAGS_ULONG_COUNT]; From owner-svn-src-head@freebsd.org Mon May 23 07:23:20 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A311CB460F3; Mon, 23 May 2016 07:23:20 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66121198C; Mon, 23 May 2016 07:23:20 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N7NJgA025875; Mon, 23 May 2016 07:23:19 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N7NJUA025873; Mon, 23 May 2016 07:23:19 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605230723.u4N7NJUA025873@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Mon, 23 May 2016 07:23:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300486 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 07:23:20 -0000 Author: sephe Date: Mon May 23 07:23:19 2016 New Revision: 300486 URL: https://svnweb.freebsd.org/changeset/base/300486 Log: hyperv/vmbus: Get rid of vmbus_devp While I'm here, nuke useless print in vmbus_attach(). MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6447 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Mon May 23 07:21:16 2016 (r300485) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Mon May 23 07:23:19 2016 (r300486) @@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$"); struct vmbus_softc *vmbus_sc; -static device_t vmbus_devp; static int vmbus_inited; static hv_setup_args setup_args; /* only CPU 0 supported at this time */ @@ -324,7 +323,7 @@ hv_vmbus_child_device_register(struct hv printf("VMBUS: Class ID: %s\n", name); } - child = device_add_child(vmbus_devp, NULL, -1); + child = device_add_child(vmbus_get_device(), NULL, -1); child_dev->device = child; device_set_ivars(child, child_dev); @@ -340,7 +339,7 @@ hv_vmbus_child_device_unregister(struct * device_add_child() */ mtx_lock(&Giant); - ret = device_delete_child(vmbus_devp, child_dev->device); + ret = device_delete_child(vmbus_get_device(), child_dev->device); mtx_unlock(&Giant); return(ret); } @@ -471,8 +470,8 @@ vmbus_bus_init(void) hv_vmbus_request_channel_offers(); vmbus_scan(); - bus_generic_attach(vmbus_devp); - device_printf(vmbus_devp, "device scan, probe and attach done\n"); + bus_generic_attach(sc->vmbus_dev); + device_printf(sc->vmbus_dev, "device scan, probe and attach done\n"); return (ret); @@ -508,11 +507,8 @@ vmbus_event_proc_dummy(struct vmbus_soft static int vmbus_attach(device_t dev) { - if(bootverbose) - device_printf(dev, "VMBUS: attach dev: %p\n", dev); - - vmbus_devp = dev; vmbus_sc = device_get_softc(dev); + vmbus_sc->vmbus_dev = dev; /* * Event processing logic will be configured: Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Mon May 23 07:21:16 2016 (r300485) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Mon May 23 07:23:19 2016 (r300486) @@ -38,6 +38,7 @@ struct vmbus_pcpu_data { struct vmbus_softc { void (*vmbus_event_proc)(struct vmbus_softc *, int); struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; + device_t vmbus_dev; }; extern struct vmbus_softc *vmbus_sc; @@ -48,6 +49,12 @@ vmbus_get_softc(void) return vmbus_sc; } +static __inline device_t +vmbus_get_device(void) +{ + return vmbus_sc->vmbus_dev; +} + #define VMBUS_SC_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field #define VMBUS_SC_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field #define VMBUS_PCPU_GET(field, cpu) \ From owner-svn-src-head@freebsd.org Mon May 23 07:32:36 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79017B463AA; Mon, 23 May 2016 07:32:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37DCE1E01; Mon, 23 May 2016 07:32:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N7WZvn028805; Mon, 23 May 2016 07:32:35 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N7WZRG028801; Mon, 23 May 2016 07:32:35 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605230732.u4N7WZRG028801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Mon, 23 May 2016 07:32:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300487 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 07:32:36 -0000 Author: sephe Date: Mon May 23 07:32:34 2016 New Revision: 300487 URL: https://svnweb.freebsd.org/changeset/base/300487 Log: hyperv/vmbus: Move IDT vector to vmbus_softc Prepare to get rid of the hv_setup_arg. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6449 Modified: head/sys/dev/hyperv/vmbus/hv_hv.c head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_hv.c Mon May 23 07:23:19 2016 (r300486) +++ head/sys/dev/hyperv/vmbus/hv_hv.c Mon May 23 07:32:34 2016 (r300487) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include <dev/hyperv/include/hyperv_busdma.h> #include <dev/hyperv/vmbus/hv_vmbus_priv.h> #include <dev/hyperv/vmbus/hyperv_reg.h> +#include <dev/hyperv/vmbus/vmbus_var.h> #define HV_NANOSECONDS_PER_SEC 1000000000L @@ -220,8 +221,8 @@ hv_vmbus_signal_event(void *con_id) */ void hv_vmbus_synic_init(void *arg) - { + struct vmbus_softc *sc = vmbus_get_softc(); int cpu; uint64_t hv_vcpu_index; hv_vmbus_synic_simp simp; @@ -266,7 +267,7 @@ hv_vmbus_synic_init(void *arg) /*HV_SHARED_SINT_IDT_VECTOR + 0x20; */ shared_sint.as_uint64_t = 0; - shared_sint.u.vector = setup_args->vector; + shared_sint.u.vector = sc->vmbus_idtvec; shared_sint.u.masked = FALSE; shared_sint.u.auto_eoi = TRUE; Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Mon May 23 07:23:19 2016 (r300486) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Mon May 23 07:32:34 2016 (r300487) @@ -385,25 +385,18 @@ vmbus_bus_init(void) sc = vmbus_get_softc(); /* - * Find a free IDT slot for vmbus callback. + * Find a free IDT vector for vmbus messages/events. */ - hv_vmbus_g_context.hv_cb_vector = lapic_ipi_alloc(IDTVEC(hv_vmbus_callback)); - if (hv_vmbus_g_context.hv_cb_vector < 0) { - if(bootverbose) - printf("Error VMBUS: Cannot find free IDT slot for " - "vmbus callback!\n"); + sc->vmbus_idtvec = lapic_ipi_alloc(IDTVEC(hv_vmbus_callback)); + if (sc->vmbus_idtvec < 0) { + device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); ret = ENXIO; goto cleanup; } - - if(bootverbose) - printf("VMBUS: vmbus callback vector %d\n", - hv_vmbus_g_context.hv_cb_vector); - - /* - * Notify the hypervisor of our vector. - */ - setup_args.vector = hv_vmbus_g_context.hv_cb_vector; + if(bootverbose) { + device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n", + sc->vmbus_idtvec); + } CPU_FOREACH(j) { snprintf(buf, sizeof(buf), "cpu%d:hyperv", j); @@ -493,7 +486,7 @@ vmbus_bus_init(void) } } - lapic_ipi_free(hv_vmbus_g_context.hv_cb_vector); + lapic_ipi_free(sc->vmbus_idtvec); cleanup: return (ret); @@ -553,6 +546,7 @@ vmbus_sysinit(void *arg __unused) static int vmbus_detach(device_t dev) { + struct vmbus_softc *sc = device_get_softc(dev); int i; hv_vmbus_release_unattached_channels(); @@ -573,7 +567,7 @@ vmbus_detach(device_t dev) } } - lapic_ipi_free(hv_vmbus_g_context.hv_cb_vector); + lapic_ipi_free(sc->vmbus_idtvec); return (0); } Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon May 23 07:23:19 2016 (r300486) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon May 23 07:32:34 2016 (r300487) @@ -216,11 +216,6 @@ typedef struct { struct taskqueue *hv_event_queue[MAXCPU]; struct taskqueue *hv_msg_tq[MAXCPU]; struct task hv_msg_task[MAXCPU]; - /* - * Host use this vector to interrupt guest for vmbus channel - * event and msg. - */ - int hv_cb_vector; } hv_vmbus_context; /* @@ -763,7 +758,6 @@ void hv_et_intr(struct trapframe*); void vmbus_scan(void); typedef struct { - unsigned int vector; void *page_buffers[2 * MAXCPU]; } hv_setup_args; Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Mon May 23 07:23:19 2016 (r300486) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Mon May 23 07:32:34 2016 (r300487) @@ -39,6 +39,7 @@ struct vmbus_softc { void (*vmbus_event_proc)(struct vmbus_softc *, int); struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; device_t vmbus_dev; + int vmbus_idtvec; }; extern struct vmbus_softc *vmbus_sc; From owner-svn-src-head@freebsd.org Mon May 23 10:31:55 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72233B4770B; Mon, 23 May 2016 10:31:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 41D341036; Mon, 23 May 2016 10:31:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NAVsb2081313; Mon, 23 May 2016 10:31:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NAVspJ081312; Mon, 23 May 2016 10:31:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231031.u4NAVspJ081312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 10:31:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300489 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 10:31:55 -0000 Author: hselasky Date: Mon May 23 10:31:54 2016 New Revision: 300489 URL: https://svnweb.freebsd.org/changeset/base/300489 Log: Use DELAY() instead of _sleep() when SCHEDULER_STOPPED() is set inside pause_sbt(). This allows pause() to continue working during a panic() which is not invoking KDB. This is useful when debugging graphics drivers using the LinuxKPI. Obtained from: kmacy @ MFC after: 1 week Modified: head/sys/kern/kern_synch.c Modified: head/sys/kern/kern_synch.c ============================================================================== --- head/sys/kern/kern_synch.c Mon May 23 09:44:06 2016 (r300488) +++ head/sys/kern/kern_synch.c Mon May 23 10:31:54 2016 (r300489) @@ -327,7 +327,7 @@ pause_sbt(const char *wmesg, sbintime_t if (sbt == 0) sbt = tick_sbt; - if (cold || kdb_active) { + if (cold || kdb_active || SCHEDULER_STOPPED()) { /* * We delay one second at a time to avoid overflowing the * system specific DELAY() function(s): From owner-svn-src-head@freebsd.org Mon May 23 10:34:39 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81437B477D9; Mon, 23 May 2016 10:34:39 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from kif.fubar.geek.nz (kif.fubar.geek.nz [178.62.119.249]) by mx1.freebsd.org (Postfix) with ESMTP id 4B9E31241; Mon, 23 May 2016 10:34:38 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from zapp (global-5-144.nat-2.net.cam.ac.uk [131.111.5.144]) by kif.fubar.geek.nz (Postfix) with ESMTPSA id 37786D78FE; Mon, 23 May 2016 10:34:02 +0000 (UTC) Date: Mon, 23 May 2016 11:34:00 +0100 From: Andrew Turner <andrew@fubar.geek.nz> To: Bryan Drewery <bdrewery@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300348 - head Message-ID: <20160523113400.349b8bdc@zapp> In-Reply-To: <201605210132.u4L1W43X033151@repo.freebsd.org> References: <201605210132.u4L1W43X033151@repo.freebsd.org> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 10:34:39 -0000 On Sat, 21 May 2016 01:32:04 +0000 (UTC) Bryan Drewery <bdrewery@FreeBSD.org> wrote: > Author: bdrewery > Date: Sat May 21 01:32:04 2016 > New Revision: 300348 > URL: https://svnweb.freebsd.org/changeset/base/300348 > > Log: > Move external toolchain support earlier. > > This is to consolidate external toolchain and > WITHOUT_CROSS_COMPILER support. > Reviewed by: brooks, bapt > Sponsored by: EMC / Isilon Storage Division > Differential Revision: https://reviews.freebsd.org/D6353 > This seems to have broken the arm64 build. My guess is the wrong linker is being used, but I haven't looked into the issue too far. Andrew -------------------------------------------------------------- >>> stage 4.2: building libraries -------------------------------------------------------------- ===> gnu/lib/libssp/libssp_nonshared (obj,all,install) ===> gnu/lib/libgcc (obj,all,install) ===> lib/libcompiler_rt (obj,all,install) ===> gnu/lib/csu (obj,all,install) ===> lib/csu (obj,all,install) ===> lib/libcompiler_rt (obj,all,install) ===> lib/libc (obj,all,install) ===> lib/libc_nonshared (obj,all,install) ===> lib/csu/aarch64 (obj) ===> lib/csu/aarch64 (all) ===> lib/csu/aarch64 (install) /scratch/tmp/andrew/obj/arm64.aarch64/scratch/tmp/andrew/head-git/tmp/usr/lib/crti.o: file not recognized: File format not recognized cc: error: linker command failed with exit code 1 (use -v to see invocation) --- libc.so.7.full --- *** [libc.so.7.full] Error code 1 make[4]: stopped in /scratch/tmp/andrew/head-git/lib/libc 1 error make[4]: stopped in /scratch/tmp/andrew/head-git/lib/libc --- lib/libc__L --- *** [lib/libc__L] Error code 2 make[3]: stopped in /scratch/tmp/andrew/head-git 1 error make[3]: stopped in /scratch/tmp/andrew/head-git --- libraries --- *** [libraries] Error code 2 make[2]: stopped in /scratch/tmp/andrew/head-git From owner-svn-src-head@freebsd.org Mon May 23 11:02:06 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A064BB47C89; Mon, 23 May 2016 11:02:06 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from kif.fubar.geek.nz (kif.fubar.geek.nz [178.62.119.249]) by mx1.freebsd.org (Postfix) with ESMTP id 71E5B1E8C; Mon, 23 May 2016 11:02:06 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from zapp (global-5-144.nat-2.net.cam.ac.uk [131.111.5.144]) by kif.fubar.geek.nz (Postfix) with ESMTPSA id D069ED78FE; Mon, 23 May 2016 11:01:35 +0000 (UTC) Date: Mon, 23 May 2016 12:01:34 +0100 From: Andrew Turner <andrew@fubar.geek.nz> To: Bryan Drewery <bdrewery@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300348 - head Message-ID: <20160523120134.7d4c127d@zapp> In-Reply-To: <20160523113400.349b8bdc@zapp> References: <201605210132.u4L1W43X033151@repo.freebsd.org> <20160523113400.349b8bdc@zapp> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 11:02:06 -0000 On Mon, 23 May 2016 11:34:00 +0100 Andrew Turner <andrew@fubar.geek.nz> wrote: > On Sat, 21 May 2016 01:32:04 +0000 (UTC) > Bryan Drewery <bdrewery@FreeBSD.org> wrote: > > > Author: bdrewery > > Date: Sat May 21 01:32:04 2016 > > New Revision: 300348 > > URL: https://svnweb.freebsd.org/changeset/base/300348 > > > > Log: > > Move external toolchain support earlier. > > > > This is to consolidate external toolchain and > > WITHOUT_CROSS_COMPILER support. > > Reviewed by: brooks, bapt > > Sponsored by: EMC / Isilon Storage Division > > Differential Revision: https://reviews.freebsd.org/D6353 > > > > This seems to have broken the arm64 build. My guess is the wrong > linker is being used, but I haven't looked into the issue too far. The issue is you moved a block that depends on BROKEN_OPTIONS being defined to before the point we include share/mk/src.opts.mk, the place it is defined. Andrew From owner-svn-src-head@freebsd.org Mon May 23 11:41:36 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C52C5B474AB; Mon, 23 May 2016 11:41:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 974E310A0; Mon, 23 May 2016 11:41:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NBfZth004145; Mon, 23 May 2016 11:41:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NBfZ8c004144; Mon, 23 May 2016 11:41:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231141.u4NBfZ8c004144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 11:41:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300490 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 11:41:36 -0000 Author: hselasky Date: Mon May 23 11:41:35 2016 New Revision: 300490 URL: https://svnweb.freebsd.org/changeset/base/300490 Log: Add support for atomic_long_inc_not_zero() to the LinuxKPI. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/bitops.h Mon May 23 10:31:54 2016 (r300489) +++ head/sys/compat/linuxkpi/common/include/linux/bitops.h Mon May 23 11:41:35 2016 (r300490) @@ -46,7 +46,7 @@ #define BITS_TO_LONGS(n) howmany((n), BITS_PER_LONG) #define BIT_MASK(nr) (1UL << ((nr) & (BITS_PER_LONG - 1))) #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) -#define GENMASK(lo, hi) (((2UL << ((hi) - (lo))) - 1UL) << (lo)) +#define GENMASK(h, l) (((~0UL) >> (BITS_PER_LONG - (h) - 1)) & ((~0UL) << (l))) #define BITS_PER_BYTE 8 static inline int From owner-svn-src-head@freebsd.org Mon May 23 11:44:18 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF422B47524; Mon, 23 May 2016 11:44:18 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9BAAE12F2; Mon, 23 May 2016 11:44:18 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id CEAAD1FE024; Mon, 23 May 2016 13:44:15 +0200 (CEST) Subject: Re: svn commit: r300490 - head/sys/compat/linuxkpi/common/include/linux To: Hans Petter Selasky <hselasky@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201605231141.u4NBfZ8c004144@repo.freebsd.org> From: Hans Petter Selasky <hps@selasky.org> Message-ID: <e7ff6b79-bf0b-13bd-91d5-2f6a32a32213@selasky.org> Date: Mon, 23 May 2016 13:47:37 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <201605231141.u4NBfZ8c004144@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 11:44:18 -0000 On 05/23/16 13:41, Hans Petter Selasky wrote: > Author: hselasky > Date: Mon May 23 11:41:35 2016 > New Revision: 300490 > URL: https://svnweb.freebsd.org/changeset/base/300490 > > Log: > Add support for atomic_long_inc_not_zero() to the LinuxKPI. > > Obtained from: kmacy @ > MFC after: 1 week > Sponsored by: Mellanox Technologies > > Modified: > head/sys/compat/linuxkpi/common/include/linux/bitops.h > Correct commit message: Correct GENMASK() macro in the LinuxKPI. Else the same. --HPS From owner-svn-src-head@freebsd.org Mon May 23 11:44:47 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF150B47567; Mon, 23 May 2016 11:44:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 720AD1497; Mon, 23 May 2016 11:44:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NBikeD004955; Mon, 23 May 2016 11:44:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NBikhD004954; Mon, 23 May 2016 11:44:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231144.u4NBikhD004954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 11:44:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300491 - head/sys/compat/linuxkpi/common/include/asm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 11:44:47 -0000 Author: hselasky Date: Mon May 23 11:44:46 2016 New Revision: 300491 URL: https://svnweb.freebsd.org/changeset/base/300491 Log: Add support for atomic_long_inc_not_zero() to the LinuxKPI. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Mon May 23 11:41:35 2016 (r300490) +++ head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Mon May 23 11:44:46 2016 (r300491) @@ -41,6 +41,7 @@ typedef struct { #define atomic_long_add(i, v) atomic_long_add_return((i), (v)) #define atomic_long_inc_return(v) atomic_long_add_return(1, (v)) +#define atomic_long_inc_not_zero(v) atomic_long_inc_not_zero(v) static inline long atomic_long_add_return(long i, atomic_long_t *v) From owner-svn-src-head@freebsd.org Mon May 23 11:47:55 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E04AB4760D; Mon, 23 May 2016 11:47:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E99A1785; Mon, 23 May 2016 11:47:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NBlsFg005100; Mon, 23 May 2016 11:47:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NBlsr0005099; Mon, 23 May 2016 11:47:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231147.u4NBlsr0005099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 11:47:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300492 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 11:47:55 -0000 Author: hselasky Date: Mon May 23 11:47:54 2016 New Revision: 300492 URL: https://svnweb.freebsd.org/changeset/base/300492 Log: Add more GFP related defines to the LinuxKPI. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/gfp.h Mon May 23 11:44:46 2016 (r300491) +++ head/sys/compat/linuxkpi/common/include/linux/gfp.h Mon May 23 11:47:54 2016 (r300492) @@ -46,6 +46,14 @@ #define __GFP_NOWARN 0 #define __GFP_HIGHMEM 0 #define __GFP_ZERO M_ZERO +#define __GFP_NORETRY 0 +#define __GFP_RECLAIM 0 +#define __GFP_RECLAIMABLE 0 + +#define __GFP_IO 0 +#define __GFP_NO_KSWAPD 0 +#define __GFP_WAIT M_WAITOK +#define __GFP_DMA32 0 #define GFP_NOWAIT M_NOWAIT #define GFP_ATOMIC (M_NOWAIT | M_USE_RESERVE) @@ -55,6 +63,8 @@ #define GFP_HIGHUSER_MOVABLE M_WAITOK #define GFP_IOFS M_NOWAIT #define GFP_NOIO M_NOWAIT +#define GFP_DMA32 0 +#define GFP_TEMPORARY 0 static inline void * page_address(struct page *page) @@ -147,4 +157,7 @@ static inline uintptr_t __get_free_pages #define kmalloc_node(chunk, mask, node) kmalloc(chunk, mask) +#define SetPageReserved(page) do { } while (0) /* NOP */ +#define ClearPageReserved(page) do { } while (0) /* NOP */ + #endif /* _LINUX_GFP_H_ */ From owner-svn-src-head@freebsd.org Mon May 23 11:50:06 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85B33B476BB; Mon, 23 May 2016 11:50:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F91B1A13; Mon, 23 May 2016 11:50:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NBo5ZE005228; Mon, 23 May 2016 11:50:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NBo56Y005227; Mon, 23 May 2016 11:50:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231150.u4NBo56Y005227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 11:50:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300493 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 11:50:06 -0000 Author: hselasky Date: Mon May 23 11:50:05 2016 New Revision: 300493 URL: https://svnweb.freebsd.org/changeset/base/300493 Log: Add support for "cdev_add_ext()" to the LinuxKPI. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/cdev.h Mon May 23 11:47:54 2016 (r300492) +++ head/sys/compat/linuxkpi/common/include/linux/cdev.h Mon May 23 11:50:05 2016 (r300493) @@ -91,6 +91,18 @@ cdev_add(struct linux_cdev *cdev, dev_t return (0); } +static inline int +cdev_add_ext(struct linux_cdev *cdev, dev_t dev, uid_t uid, gid_t gid, int mode) +{ + cdev->cdev = make_dev(&linuxcdevsw, MINOR(dev), uid, gid, mode, + "%s/%d", kobject_name(&cdev->kobj), MINOR(dev)); + cdev->dev = dev; + cdev->cdev->si_drv1 = cdev; + + kobject_get(cdev->kobj.parent); + return (0); +} + static inline void cdev_del(struct linux_cdev *cdev) { From owner-svn-src-head@freebsd.org Mon May 23 11:53:02 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E939B47874; Mon, 23 May 2016 11:53:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2DB31E20; Mon, 23 May 2016 11:53:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NBr1wt007952; Mon, 23 May 2016 11:53:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NBr1M8007951; Mon, 23 May 2016 11:53:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231153.u4NBr1M8007951@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 11:53:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300494 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 11:53:02 -0000 Author: hselasky Date: Mon May 23 11:53:00 2016 New Revision: 300494 URL: https://svnweb.freebsd.org/changeset/base/300494 Log: Implement "_outb()" to the LinuxKPI for i386 and amd64 only. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/io.h Modified: head/sys/compat/linuxkpi/common/include/linux/io.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/io.h Mon May 23 11:50:05 2016 (r300493) +++ head/sys/compat/linuxkpi/common/include/linux/io.h Mon May 23 11:53:00 2016 (r300494) @@ -172,6 +172,14 @@ readl(const volatile void *addr) } #if defined(__i386__) || defined(__amd64__) +static inline void +_outb(u_char data, u_int port) +{ + __asm __volatile("outb %0, %w1" : : "a" (data), "Nd" (port)); +} +#endif + +#if defined(__i386__) || defined(__amd64__) void *_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr); #else #define _ioremap_attr(...) NULL From owner-svn-src-head@freebsd.org Mon May 23 11:57:24 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84F8BB479A5; Mon, 23 May 2016 11:57:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 54F8710E9; Mon, 23 May 2016 11:57:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NBvNqa008139; Mon, 23 May 2016 11:57:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NBvN14008138; Mon, 23 May 2016 11:57:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231157.u4NBvN14008138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 11:57:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300495 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 11:57:24 -0000 Author: hselasky Date: Mon May 23 11:57:23 2016 New Revision: 300495 URL: https://svnweb.freebsd.org/changeset/base/300495 Log: Make header file standalone by including definitions for needed linux_wait_xxx() functions. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/completion.h Modified: head/sys/compat/linuxkpi/common/include/linux/completion.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/completion.h Mon May 23 11:53:00 2016 (r300494) +++ head/sys/compat/linuxkpi/common/include/linux/completion.h Mon May 23 11:57:23 2016 (r300495) @@ -32,6 +32,7 @@ #define _LINUX_COMPLETION_H_ #include <linux/errno.h> +#include <linux/wait.h> struct completion { unsigned int done; From owner-svn-src-head@freebsd.org Mon May 23 12:03:41 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C672DB451AC; Mon, 23 May 2016 12:03:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A10D418F8; Mon, 23 May 2016 12:03:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NC3e6E010993; Mon, 23 May 2016 12:03:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NC3eHI010991; Mon, 23 May 2016 12:03:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231203.u4NC3eHI010991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 12:03:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300496 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 12:03:41 -0000 Author: hselasky Date: Mon May 23 12:03:40 2016 New Revision: 300496 URL: https://svnweb.freebsd.org/changeset/base/300496 Log: Add more list_xxx() functions to the LinuxKPI. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/list.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/list.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/list.h Mon May 23 11:57:23 2016 (r300495) +++ head/sys/compat/linuxkpi/common/include/linux/list.h Mon May 23 12:03:40 2016 (r300496) @@ -109,6 +109,13 @@ list_replace(struct list_head *old, stru } static inline void +list_replace_init(struct list_head *old, struct list_head *new) +{ + list_replace(old, new); + INIT_LIST_HEAD(old); +} + +static inline void linux_list_add(struct list_head *new, struct list_head *prev, struct list_head *next) { @@ -132,9 +139,18 @@ list_del_init(struct list_head *entry) #define list_first_entry(ptr, type, member) \ list_entry((ptr)->next, type, member) +#define list_last_entry(ptr, type, member) \ + list_entry((ptr)->prev, type, member) + +#define list_first_entry_or_null(ptr, type, member) \ + (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL) + #define list_next_entry(ptr, member) \ list_entry(((ptr)->member.next), typeof(*(ptr)), member) +#define list_prev_entry(ptr, member) \ + list_entry(((ptr)->member.prev), typeof(*(ptr)), member) + #define list_for_each(p, head) \ for (p = (head)->next; p != (head); p = (p)->next) @@ -436,4 +452,7 @@ static inline int list_is_last(const str (pos) && ({ n = (pos)->member.next; 1; }); \ pos = hlist_entry_safe(n, typeof(*(pos)), member)) +extern void list_sort(void *priv, struct list_head *head, int (*cmp)(void *priv, + struct list_head *a, struct list_head *b)); + #endif /* _LINUX_LIST_H_ */ Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Mon May 23 11:57:23 2016 (r300495) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Mon May 23 12:03:40 2016 (r300496) @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include <linux/interrupt.h> #include <linux/uaccess.h> #include <linux/kernel.h> +#include <linux/list.h> #include <vm/vm_pager.h> @@ -1358,6 +1359,47 @@ unregister_inetaddr_notifier(struct noti return (0); } +struct list_sort_thunk { + int (*cmp)(void *, struct list_head *, struct list_head *); + void *priv; +}; + +static inline int +linux_le_cmp(void *priv, const void *d1, const void *d2) +{ + struct list_head *le1, *le2; + struct list_sort_thunk *thunk; + + thunk = priv; + le1 = *(__DECONST(struct list_head **, d1)); + le2 = *(__DECONST(struct list_head **, d2)); + return ((thunk->cmp)(thunk->priv, le1, le2)); +} + +void +list_sort(void *priv, struct list_head *head, int (*cmp)(void *priv, + struct list_head *a, struct list_head *b)) +{ + struct list_sort_thunk thunk; + struct list_head **ar, *le; + size_t count, i; + + count = 0; + list_for_each(le, head) + count++; + ar = malloc(sizeof(struct list_head *) * count, M_KMALLOC, M_WAITOK); + i = 0; + list_for_each(le, head) + ar[i++] = le; + thunk.cmp = cmp; + thunk.priv = priv; + qsort_r(ar, count, sizeof(struct list_head *), &thunk, linux_le_cmp); + INIT_LIST_HEAD(head); + for (i = 0; i < count; i++) + list_add_tail(ar[i], head); + free(ar, M_KMALLOC); +} + void linux_irq_handler(void *ent) { From owner-svn-src-head@freebsd.org Mon May 23 12:06:35 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68B26B452F4; Mon, 23 May 2016 12:06:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 393D21BFE; Mon, 23 May 2016 12:06:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NC6YND011311; Mon, 23 May 2016 12:06:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NC6YHC011310; Mon, 23 May 2016 12:06:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231206.u4NC6YHC011310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 12:06:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300497 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 12:06:35 -0000 Author: hselasky Date: Mon May 23 12:06:34 2016 New Revision: 300497 URL: https://svnweb.freebsd.org/changeset/base/300497 Log: Implement "kref_put_mutex()" for the LinuxKPI. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/kref.h Modified: head/sys/compat/linuxkpi/common/include/linux/kref.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kref.h Mon May 23 12:03:40 2016 (r300496) +++ head/sys/compat/linuxkpi/common/include/linux/kref.h Mon May 23 12:06:34 2016 (r300497) @@ -36,6 +36,9 @@ #include <sys/refcount.h> #include <linux/compiler.h> +#include <linux/kernel.h> +#include <linux/mutex.h> + #include <asm/atomic.h> struct kref { @@ -88,4 +91,20 @@ kref_get_unless_zero(struct kref *kref) return atomic_add_unless(&kref->refcount, 1, 0); } +static inline int kref_put_mutex(struct kref *kref, + void (*release)(struct kref *kref), struct mutex *lock) +{ + WARN_ON(release == NULL); + if (unlikely(!atomic_add_unless(&kref->refcount, -1, 1))) { + mutex_lock(lock); + if (unlikely(!atomic_dec_and_test(&kref->refcount))) { + mutex_unlock(lock); + return 0; + } + release(kref); + return 1; + } + return 0; +} + #endif /* _LINUX_KREF_H_ */ From owner-svn-src-head@freebsd.org Mon May 23 12:10:29 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E959B454F7; Mon, 23 May 2016 12:10:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 601661EC6; Mon, 23 May 2016 12:10:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NCASs1011653; Mon, 23 May 2016 12:10:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NCASQG011652; Mon, 23 May 2016 12:10:28 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231210.u4NCASQG011652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 12:10:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300498 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 12:10:29 -0000 Author: hselasky Date: Mon May 23 12:10:28 2016 New Revision: 300498 URL: https://svnweb.freebsd.org/changeset/base/300498 Log: Add more ktime related functions to the LinuxKPI. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/ktime.h Modified: head/sys/compat/linuxkpi/common/include/linux/ktime.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/ktime.h Mon May 23 12:06:34 2016 (r300497) +++ head/sys/compat/linuxkpi/common/include/linux/ktime.h Mon May 23 12:10:28 2016 (r300498) @@ -51,6 +51,24 @@ ktime_to_ns(ktime_t kt) return kt.tv64; } +static inline int64_t +ktime_divns(const ktime_t kt, int64_t div) +{ + return kt.tv64 / div; +} + +static inline int64_t +ktime_to_us(ktime_t kt) +{ + return ktime_divns(kt, NSEC_PER_USEC); +} + +static inline int64_t +ktime_to_ms(ktime_t kt) +{ + return ktime_divns(kt, NSEC_PER_MSEC); +} + static inline struct timeval ktime_to_timeval(ktime_t kt) { @@ -89,6 +107,20 @@ ktime_sub(ktime_t lhs, ktime_t rhs) return (lhs); } +static inline int64_t +ktime_us_delta(ktime_t later, ktime_t earlier) +{ + ktime_t diff = ktime_sub(later, earlier); + return ktime_to_us(diff); +} + +static inline int64_t +ktime_ms_delta(ktime_t later, ktime_t earlier) +{ + ktime_t diff = ktime_sub(later, earlier); + return ktime_to_ms(diff); +} + static inline ktime_t ktime_add(ktime_t lhs, ktime_t rhs) { From owner-svn-src-head@freebsd.org Mon May 23 12:13:18 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12811B45719; Mon, 23 May 2016 12:13:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3ECC1320; Mon, 23 May 2016 12:13:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NCDGEG014393; Mon, 23 May 2016 12:13:16 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NCDGEc014392; Mon, 23 May 2016 12:13:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231213.u4NCDGEc014392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 12:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300499 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 12:13:18 -0000 Author: hselasky Date: Mon May 23 12:13:16 2016 New Revision: 300499 URL: https://svnweb.freebsd.org/changeset/base/300499 Log: Set an invalid IRQ number when no PCI IRQ is available in the LinuxKPI. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_pci.c Mon May 23 12:10:28 2016 (r300498) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Mon May 23 12:13:16 2016 (r300499) @@ -139,7 +139,7 @@ linux_pci_attach(device_t dev) if (rle) pdev->dev.irq = rle->start; else - pdev->dev.irq = 0; + pdev->dev.irq = 255; pdev->irq = pdev->dev.irq; mtx_unlock(&Giant); spin_lock(&pci_lock); From owner-svn-src-head@freebsd.org Mon May 23 12:35:08 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CC69B45E0C; Mon, 23 May 2016 12:35:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 32BB01039; Mon, 23 May 2016 12:35:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NCZ7Bl020534; Mon, 23 May 2016 12:35:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NCZ7s9020533; Mon, 23 May 2016 12:35:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231235.u4NCZ7s9020533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 12:35:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300500 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 12:35:08 -0000 Author: hselasky Date: Mon May 23 12:35:07 2016 New Revision: 300500 URL: https://svnweb.freebsd.org/changeset/base/300500 Log: Add more printf() related functions to the LinuxKPI. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon May 23 12:13:16 2016 (r300499) +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon May 23 12:35:07 2016 (r300500) @@ -52,6 +52,8 @@ #include <linux/log2.h> #include <asm/byteorder.h> +#include <machine/stdarg.h> + #define KERN_CONT "" #define KERN_EMERG "<0>" #define KERN_ALERT "<1>" @@ -124,7 +126,37 @@ #define DIV_ROUND_UP_ULL(x, n) DIV_ROUND_UP((unsigned long long)(x), (n)) #define FIELD_SIZEOF(t, f) sizeof(((t *)0)->f) -#define printk(X...) printf(X) +#define printk(...) printf(__VA_ARGS__) +#define vprintk(f, a) vprintf(f, a) + +struct va_format { + const char *fmt; + va_list *va; +}; + +static inline int +vscnprintf(char *buf, size_t size, const char *fmt, va_list args) +{ + ssize_t ssize = size; + int i; + + i = vsnprintf(buf, size, fmt, args); + + return ((i >= ssize) ? (ssize - 1) : i); +} + +static inline int +scnprintf(char *buf, size_t size, const char *fmt, ...) +{ + va_list args; + int i; + + va_start(args, fmt); + i = vscnprintf(buf, size, fmt, args); + va_end(args); + + return (i); +} /* * The "pr_debug()" and "pr_devel()" macros should produce zero code From owner-svn-src-head@freebsd.org Mon May 23 12:41:30 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B412B45FB6; Mon, 23 May 2016 12:41:30 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 558C613A2; Mon, 23 May 2016 12:41:30 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NCfTEt022763; Mon, 23 May 2016 12:41:29 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NCfTHd022762; Mon, 23 May 2016 12:41:29 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201605231241.u4NCfTHd022762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost <kp@FreeBSD.org> Date: Mon, 23 May 2016 12:41:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300501 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 12:41:30 -0000 Author: kp Date: Mon May 23 12:41:29 2016 New Revision: 300501 URL: https://svnweb.freebsd.org/changeset/base/300501 Log: pf: Fix ICMP translation Fix ICMP source address rewriting in rdr scenarios. PR: 201519 Submitted by: Max <maximos@als.nnov.ru> MFC after: 1 week Modified: head/sys/netpfil/pf/pf.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Mon May 23 12:35:07 2016 (r300500) +++ head/sys/netpfil/pf/pf.c Mon May 23 12:41:29 2016 (r300501) @@ -4784,8 +4784,7 @@ pf_test_state_icmp(struct pf_state **sta &nk->addr[pd2.didx], pd2.af) || nk->port[pd2.didx] != th.th_dport) pf_change_icmp(pd2.dst, &th.th_dport, - NULL, /* XXX Inbound NAT? */ - &nk->addr[pd2.didx], + saddr, &nk->addr[pd2.didx], nk->port[pd2.didx], NULL, pd2.ip_sum, icmpsum, pd->ip_sum, 0, pd2.af); @@ -4857,8 +4856,7 @@ pf_test_state_icmp(struct pf_state **sta &nk->addr[pd2.didx], pd2.af) || nk->port[pd2.didx] != uh.uh_dport) pf_change_icmp(pd2.dst, &uh.uh_dport, - NULL, /* XXX Inbound NAT? */ - &nk->addr[pd2.didx], + saddr, &nk->addr[pd2.didx], nk->port[pd2.didx], &uh.uh_sum, pd2.ip_sum, icmpsum, pd->ip_sum, 1, pd2.af); @@ -4925,8 +4923,7 @@ pf_test_state_icmp(struct pf_state **sta &nk->addr[pd2.didx], pd2.af) || nk->port[pd2.didx] != iih.icmp_id) pf_change_icmp(pd2.dst, &iih.icmp_id, - NULL, /* XXX Inbound NAT? */ - &nk->addr[pd2.didx], + saddr, &nk->addr[pd2.didx], nk->port[pd2.didx], NULL, pd2.ip_sum, icmpsum, pd->ip_sum, 0, AF_INET); @@ -4978,8 +4975,7 @@ pf_test_state_icmp(struct pf_state **sta &nk->addr[pd2.didx], pd2.af) || nk->port[pd2.didx] != iih.icmp6_id) pf_change_icmp(pd2.dst, &iih.icmp6_id, - NULL, /* XXX Inbound NAT? */ - &nk->addr[pd2.didx], + saddr, &nk->addr[pd2.didx], nk->port[pd2.didx], NULL, pd2.ip_sum, icmpsum, pd->ip_sum, 0, AF_INET6); @@ -5018,8 +5014,7 @@ pf_test_state_icmp(struct pf_state **sta if (PF_ANEQ(pd2.dst, &nk->addr[pd2.didx], pd2.af)) - pf_change_icmp(pd2.src, NULL, - NULL, /* XXX Inbound NAT? */ + pf_change_icmp(pd2.src, NULL, saddr, &nk->addr[pd2.didx], 0, NULL, pd2.ip_sum, icmpsum, pd->ip_sum, 0, pd2.af); From owner-svn-src-head@freebsd.org Mon May 23 12:52:24 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E96AB4645D; Mon, 23 May 2016 12:52:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3A4D1EF3; Mon, 23 May 2016 12:52:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NCqNOp026675; Mon, 23 May 2016 12:52:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NCqNae026674; Mon, 23 May 2016 12:52:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231252.u4NCqNae026674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 12:52:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300502 - head/sys/compat/linuxkpi/common/include/asm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 12:52:24 -0000 Author: hselasky Date: Mon May 23 12:52:22 2016 New Revision: 300502 URL: https://svnweb.freebsd.org/changeset/base/300502 Log: Define more copy to/from userspace functions in the LinuxKPI. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/asm/uaccess.h Modified: head/sys/compat/linuxkpi/common/include/asm/uaccess.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/asm/uaccess.h Mon May 23 12:41:29 2016 (r300501) +++ head/sys/compat/linuxkpi/common/include/asm/uaccess.h Mon May 23 12:52:22 2016 (r300502) @@ -40,6 +40,7 @@ copy_to_user(void *to, const void *from, return n; return 0; } +#define __copy_to_user(...) copy_to_user(__VA_ARGS__) static inline long copy_from_user(void *to, const void *from, unsigned long n) @@ -48,5 +49,7 @@ copy_from_user(void *to, const void *fro return n; return 0; } +#define __copy_from_user(...) copy_from_user(__VA_ARGS__) +#define __copy_in_user(...) copy_from_user(__VA_ARGS__) #endif /* _ASM_UACCESS_H_ */ From owner-svn-src-head@freebsd.org Mon May 23 12:53:19 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CDBBB464DF; Mon, 23 May 2016 12:53:19 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F042C10C0; Mon, 23 May 2016 12:53:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NCrIFc026748; Mon, 23 May 2016 12:53:18 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NCrIdI026747; Mon, 23 May 2016 12:53:18 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231253.u4NCrIdI026747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 12:53:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300503 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 12:53:19 -0000 Author: hselasky Date: Mon May 23 12:53:17 2016 New Revision: 300503 URL: https://svnweb.freebsd.org/changeset/base/300503 Log: Implement ror32() in the LinuxKPI. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/bitops.h Mon May 23 12:52:22 2016 (r300502) +++ head/sys/compat/linuxkpi/common/include/linux/bitops.h Mon May 23 12:53:17 2016 (r300503) @@ -73,6 +73,12 @@ __flsl(long mask) return (flsl(mask) - 1); } +static inline uint32_t +ror32(uint32_t word, unsigned int shift) +{ + + return ((word >> shift) | (word << (32 - shift))); +} #define ffz(mask) __ffs(~(mask)) From owner-svn-src-head@freebsd.org Mon May 23 12:58:25 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1996B46663; Mon, 23 May 2016 12:58:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81E43141E; Mon, 23 May 2016 12:58:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NCwO4F026967; Mon, 23 May 2016 12:58:24 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NCwOFd026966; Mon, 23 May 2016 12:58:24 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201605231258.u4NCwOFd026966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala <trasz@FreeBSD.org> Date: Mon, 23 May 2016 12:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300504 - head/usr.sbin/iscsid X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 12:58:25 -0000 Author: trasz Date: Mon May 23 12:58:24 2016 New Revision: 300504 URL: https://svnweb.freebsd.org/changeset/base/300504 Log: Build iscsid(8) with ICL_KERNEL_PROXY defined by default, as required for iSER. Obtained from: Mellanox Technologies MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/iscsid/Makefile Modified: head/usr.sbin/iscsid/Makefile ============================================================================== --- head/usr.sbin/iscsid/Makefile Mon May 23 12:53:17 2016 (r300503) +++ head/usr.sbin/iscsid/Makefile Mon May 23 12:58:24 2016 (r300504) @@ -6,7 +6,7 @@ SRCS= chap.c discovery.c iscsid.c keys. CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}/../../sys/cam CFLAGS+= -I${.CURDIR}/../../sys/dev/iscsi -#CFLAGS+= -DICL_KERNEL_PROXY +CFLAGS+= -DICL_KERNEL_PROXY MAN= iscsid.8 LIBADD= md util From owner-svn-src-head@freebsd.org Mon May 23 13:17:39 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DE85B46BC0; Mon, 23 May 2016 13:17:39 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E446E1EE1; Mon, 23 May 2016 13:17:38 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NDHcJv033019; Mon, 23 May 2016 13:17:38 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NDHchV033018; Mon, 23 May 2016 13:17:38 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201605231317.u4NDHchV033018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko <arybchik@FreeBSD.org> Date: Mon, 23 May 2016 13:17:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300505 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 13:17:39 -0000 Author: arybchik Date: Mon May 23 13:17:37 2016 New Revision: 300505 URL: https://svnweb.freebsd.org/changeset/base/300505 Log: sfxge(4): cleanup: remove unused EFX preempt macros The EFSYS_PREEMPT_DISABLE() and EFSYS_PREEMPT_ENABLE() macros were used to ensure correct timing of I2C operations. The APIs for I2C operations have been removed, so these macros have no callers. Submitted by: Andy Moreton <amoreton at solarflare.com> Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Modified: head/sys/dev/sfxge/common/efsys.h Modified: head/sys/dev/sfxge/common/efsys.h ============================================================================== --- head/sys/dev/sfxge/common/efsys.h Mon May 23 12:58:24 2016 (r300504) +++ head/sys/dev/sfxge/common/efsys.h Mon May 23 13:17:37 2016 (r300505) @@ -1110,22 +1110,6 @@ typedef struct efsys_lock_s { _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) -/* PREEMPT */ - -#define EFSYS_PREEMPT_DISABLE(_state) \ - do { \ - (_state) = (_state); \ - critical_enter(); \ - _NOTE(CONSTANTCONDITION) \ - } while (B_FALSE) - -#define EFSYS_PREEMPT_ENABLE(_state) \ - do { \ - (_state) = (_state); \ - critical_exit(_state); \ - _NOTE(CONSTANTCONDITION) \ - } while (B_FALSE) - /* STAT */ typedef uint64_t efsys_stat_t; From owner-svn-src-head@freebsd.org Mon May 23 13:18:16 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B821B46C3D; Mon, 23 May 2016 13:18:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 363851083; Mon, 23 May 2016 13:18:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NDIFfe033088; Mon, 23 May 2016 13:18:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NDIFsO033087; Mon, 23 May 2016 13:18:15 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231318.u4NDIFsO033087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 13:18:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300506 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 13:18:16 -0000 Author: hselasky Date: Mon May 23 13:18:15 2016 New Revision: 300506 URL: https://svnweb.freebsd.org/changeset/base/300506 Log: Fix some data types and add "inline" keyword for __reg_op() function. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/bitops.h Mon May 23 13:17:37 2016 (r300505) +++ head/sys/compat/linuxkpi/common/include/linux/bitops.h Mon May 23 13:18:15 2016 (r300506) @@ -93,7 +93,7 @@ static inline int get_count_order(unsign } static inline unsigned long -find_first_bit(unsigned long *addr, unsigned long size) +find_first_bit(const unsigned long *addr, unsigned long size) { long mask; int bit; @@ -115,7 +115,7 @@ find_first_bit(unsigned long *addr, unsi } static inline unsigned long -find_first_zero_bit(unsigned long *addr, unsigned long size) +find_first_zero_bit(const unsigned long *addr, unsigned long size) { long mask; int bit; @@ -137,7 +137,7 @@ find_first_zero_bit(unsigned long *addr, } static inline unsigned long -find_last_bit(unsigned long *addr, unsigned long size) +find_last_bit(const unsigned long *addr, unsigned long size) { long mask; int offs; @@ -163,7 +163,7 @@ find_last_bit(unsigned long *addr, unsig } static inline unsigned long -find_next_bit(unsigned long *addr, unsigned long size, unsigned long offset) +find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset) { long mask; int offs; @@ -202,7 +202,7 @@ find_next_bit(unsigned long *addr, unsig } static inline unsigned long -find_next_zero_bit(unsigned long *addr, unsigned long size, +find_next_zero_bit(const unsigned long *addr, unsigned long size, unsigned long offset) { long mask; @@ -306,23 +306,23 @@ bitmap_empty(unsigned long *addr, int si } #define __set_bit(i, a) \ - atomic_set_long(&((volatile long *)(a))[BIT_WORD(i)], BIT_MASK(i)) + atomic_set_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i)) #define set_bit(i, a) \ - atomic_set_long(&((volatile long *)(a))[BIT_WORD(i)], BIT_MASK(i)) + atomic_set_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i)) #define __clear_bit(i, a) \ - atomic_clear_long(&((volatile long *)(a))[BIT_WORD(i)], BIT_MASK(i)) + atomic_clear_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i)) #define clear_bit(i, a) \ - atomic_clear_long(&((volatile long *)(a))[BIT_WORD(i)], BIT_MASK(i)) + atomic_clear_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i)) #define test_bit(i, a) \ - !!(atomic_load_acq_long(&((volatile long *)(a))[BIT_WORD(i)]) & \ + !!(atomic_load_acq_long(&((volatile unsigned long *)(a))[BIT_WORD(i)]) & \ BIT_MASK(i)) -static inline long -test_and_clear_bit(long bit, long *var) +static inline int +test_and_clear_bit(long bit, volatile unsigned long *var) { long val; @@ -330,14 +330,14 @@ test_and_clear_bit(long bit, long *var) bit %= BITS_PER_LONG; bit = (1UL << bit); do { - val = *(volatile long *)var; + val = *var; } while (atomic_cmpset_long(var, val, val & ~bit) == 0); return !!(val & bit); } -static inline long -test_and_set_bit(long bit, long *var) +static inline int +test_and_set_bit(long bit, volatile unsigned long *var) { long val; @@ -345,7 +345,7 @@ test_and_set_bit(long bit, long *var) bit %= BITS_PER_LONG; bit = (1UL << bit); do { - val = *(volatile long *)var; + val = *var; } while (atomic_cmpset_long(var, val, val | bit) == 0); return !!(val & bit); @@ -399,7 +399,8 @@ enum { REG_OP_RELEASE, }; -static int __reg_op(unsigned long *bitmap, int pos, int order, int reg_op) +static inline int +__reg_op(unsigned long *bitmap, int pos, int order, int reg_op) { int nbits_reg; int index; From owner-svn-src-head@freebsd.org Mon May 23 13:19:21 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96B5CB46CA8; Mon, 23 May 2016 13:19:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 675D31212; Mon, 23 May 2016 13:19:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NDJKBV033166; Mon, 23 May 2016 13:19:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NDJKst033165; Mon, 23 May 2016 13:19:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231319.u4NDJKst033165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 13:19:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300507 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 13:19:21 -0000 Author: hselasky Date: Mon May 23 13:19:20 2016 New Revision: 300507 URL: https://svnweb.freebsd.org/changeset/base/300507 Log: A missing definition needed by ktime_to_ms(). Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/time.h Modified: head/sys/compat/linuxkpi/common/include/linux/time.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/time.h Mon May 23 13:18:15 2016 (r300506) +++ head/sys/compat/linuxkpi/common/include/linux/time.h Mon May 23 13:19:20 2016 (r300507) @@ -29,6 +29,7 @@ #define _LINUX_TIME_H_ #define NSEC_PER_USEC 1000L +#define NSEC_PER_MSEC 1000000L #define NSEC_PER_SEC 1000000000L #include <sys/time.h> From owner-svn-src-head@freebsd.org Mon May 23 13:59:50 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0059AB468DC; Mon, 23 May 2016 13:59:50 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB0551A7B; Mon, 23 May 2016 13:59:49 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NDxmxP045632; Mon, 23 May 2016 13:59:48 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NDxmaU045631; Mon, 23 May 2016 13:59:48 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201605231359.u4NDxmaU045631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost <kp@FreeBSD.org> Date: Mon, 23 May 2016 13:59:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300508 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 13:59:50 -0000 Author: kp Date: Mon May 23 13:59:48 2016 New Revision: 300508 URL: https://svnweb.freebsd.org/changeset/base/300508 Log: pf: Fix more ICMP mistranslation In the default case fix the substitution of the destination address. PR: 201519 Submitted by: Max <maximos@als.nnov.ru> MFC after: 1 week Modified: head/sys/netpfil/pf/pf.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Mon May 23 13:19:20 2016 (r300507) +++ head/sys/netpfil/pf/pf.c Mon May 23 13:59:48 2016 (r300508) @@ -5014,7 +5014,7 @@ pf_test_state_icmp(struct pf_state **sta if (PF_ANEQ(pd2.dst, &nk->addr[pd2.didx], pd2.af)) - pf_change_icmp(pd2.src, NULL, saddr, + pf_change_icmp(pd2.dst, NULL, saddr, &nk->addr[pd2.didx], 0, NULL, pd2.ip_sum, icmpsum, pd->ip_sum, 0, pd2.af); From owner-svn-src-head@freebsd.org Mon May 23 15:11:02 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E87BB47965; Mon, 23 May 2016 15:11:02 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F81111C9; Mon, 23 May 2016 15:11:02 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NFB1kI068765; Mon, 23 May 2016 15:11:01 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NFB1l9068764; Mon, 23 May 2016 15:11:01 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201605231511.u4NFB1l9068764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude <allanjude@FreeBSD.org> Date: Mon, 23 May 2016 15:11:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300509 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 15:11:02 -0000 Author: allanjude Date: Mon May 23 15:11:01 2016 New Revision: 300509 URL: https://svnweb.freebsd.org/changeset/base/300509 Log: Fix error in bsdinstall where additional filesystems cannot be mounted Do not set canmount=noauto on the boot environment at create time, because this causes / to not be mounted, and since the chroot is read only, new mountpoints cannot be created. The property is set later, when other properties are adjusted Reported by: HardenedBSD Sponsored by: ScaleEngine Inc. Modified: head/usr.sbin/bsdinstall/scripts/zfsboot Modified: head/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- head/usr.sbin/bsdinstall/scripts/zfsboot Mon May 23 13:59:48 2016 (r300508) +++ head/usr.sbin/bsdinstall/scripts/zfsboot Mon May 23 15:11:01 2016 (r300509) @@ -143,7 +143,7 @@ f_isset ZFSBOOT_DATASETS || ZFSBOOT_DATA # Boot Environment [BE] root and default boot dataset /$ZFSBOOT_BEROOT_NAME mountpoint=none - /$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME mountpoint=/,canmount=noauto + /$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME mountpoint=/ # Compress /tmp, allow exec but not setuid /tmp mountpoint=/tmp,exec=on,setuid=off @@ -1310,6 +1310,10 @@ zfs_create_boot() "mountpoint=/$zroot_name" "$zroot_name" || return $FAILURE + f_dprintf "$funcname: Set canmount=noauto for the root of the pool..." + f_eval_catch $funcname zfs "$ZFS_SET" "canmount=noauto" \ + "$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME" + # Touch up permissions on the tmp directories f_dprintf "$funcname: Modifying directory permissions..." local dir From owner-svn-src-head@freebsd.org Mon May 23 15:26:37 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2109BB47037; Mon, 23 May 2016 15:26:37 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DED691082; Mon, 23 May 2016 15:26:36 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NFQZo0072659; Mon, 23 May 2016 15:26:35 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NFQZH1072658; Mon, 23 May 2016 15:26:35 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201605231526.u4NFQZH1072658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner <andrew@FreeBSD.org> Date: Mon, 23 May 2016 15:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300510 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 15:26:37 -0000 Author: andrew Date: Mon May 23 15:26:35 2016 New Revision: 300510 URL: https://svnweb.freebsd.org/changeset/base/300510 Log: Add the needed hwpmc hooks to subr_intr.c. This is needed for the correct operation of hwpmc on, for example, arm64 with intrng. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/subr_intr.c Modified: head/sys/kern/subr_intr.c ============================================================================== --- head/sys/kern/subr_intr.c Mon May 23 15:11:01 2016 (r300509) +++ head/sys/kern/subr_intr.c Mon May 23 15:26:35 2016 (r300510) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include "opt_acpi.h" #include "opt_ddb.h" +#include "opt_hwpmc_hooks.h" #include "opt_platform.h" #include <sys/param.h> @@ -53,6 +54,10 @@ __FBSDID("$FreeBSD$"); #include <sys/rman.h> #include <sys/sched.h> #include <sys/smp.h> +#ifdef HWPMC_HOOKS +#include <sys/pmckern.h> +#endif + #include <machine/atomic.h> #include <machine/intr.h> #include <machine/cpu.h> @@ -311,6 +316,10 @@ intr_irq_handler(struct trapframe *tf) irq_root_filter(irq_root_arg); td->td_intr_frame = oldframe; critical_exit(); +#ifdef HWPMC_HOOKS + if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN)) + pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, tf); +#endif } /* From owner-svn-src-head@freebsd.org Mon May 23 15:27:21 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7D48B47112; Mon, 23 May 2016 15:27:21 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-ig0-x22b.google.com (mail-ig0-x22b.google.com [IPv6:2607:f8b0:4001:c05::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A1E8912A3; Mon, 23 May 2016 15:27:21 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-ig0-x22b.google.com with SMTP id bi2so35538217igb.0; Mon, 23 May 2016 08:27:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=8HUi/Krffc5+KNutmRGQwQZZAOgj0XdsyYq3ZMxTfhU=; b=NEr+5FJ+zZzvTdKiJGoIVb9C5Vm3EyLXjz7tTrdDon3ouQfxu9klEX9djCvxczbdOc 94raYj29ioWtyhLCfXuZvQF/0SThWyI/VIxfxYpdjycBhBugR+7JsfJnwKsDF/N3AUq8 ZYlSICPd9O+Mk46c/mrXc6jfgL7TQLKq6thrNL2ckW84wd63zu3QEpFiuCw9FINsJj8I mybCev1GpuZLUI9sQPjcIHoliVkuvOlDcSSq40Q2qSF1weibWcdtPgN0PRNENn1wsB00 w5DtJTZ2FqLCyDd7MEMse2XabDxa1w1cvXda8Gl8kT6LMgorE1LKcTwIBODis6dGw9rT xosQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=8HUi/Krffc5+KNutmRGQwQZZAOgj0XdsyYq3ZMxTfhU=; b=OdqWltCBjfuzQcyLD1zy55qj3rd0aAJbfS45fufXAedf/S4r+oNYtB7sHrSxd78LTo qB6zIemVY756BI/GoFG6USze25hFEkOgQMOcjPYxCPG8Ourc7WM2mo1XckQtLRE2lGkV PT64cwoXVWgjjBoK9gkgUP7CffsZhWYHJiVBkka0rvuwVlgKYjByk3Yz2bbpfugCLrtM 1p96G1yVQLJskUjWJTsdhimmPH7+IJB1yq0wtB3GGR68AvSsC/EPpKnlPs4KbNycIeIJ 0fuonHl04XBTSDitYnio4I+nkAIdoe3vk3GlkkpGvTbpiC6GddmRjY5xIm+Evko71Oeq lEIg== X-Gm-Message-State: AOPr4FWII/6XplF/hOIGKrQsPpagOHRJ87HMLQs4l3tko+FfnlP/d0hLp9Hib8vCEepsOg== X-Received: by 10.50.79.130 with SMTP id j2mr13585976igx.89.1464017241008; Mon, 23 May 2016 08:27:21 -0700 (PDT) Received: from [192.168.20.14] (c-73-97-222-46.hsd1.wa.comcast.net. [73.97.222.46]) by smtp.gmail.com with ESMTPSA id w25sm653033ioi.1.2016.05.23.08.27.19 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 May 2016 08:27:19 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r300491 - head/sys/compat/linuxkpi/common/include/asm From: Ngie Cooper <yaneurabeya@gmail.com> X-Mailer: iPhone Mail (13F69) In-Reply-To: <201605231144.u4NBikhD004954@repo.freebsd.org> Date: Mon, 23 May 2016 08:27:18 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <0B789C60-3EF9-4553-BD19-3245B451FB0A@gmail.com> References: <201605231144.u4NBikhD004954@repo.freebsd.org> To: Hans Petter Selasky <hselasky@FreeBSD.org> X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 15:27:21 -0000 > On May 23, 2016, at 04:44, Hans Petter Selasky <hselasky@FreeBSD.org> wrot= e: >=20 > Author: hselasky > Date: Mon May 23 11:44:46 2016 > New Revision: 300491 > URL: https://svnweb.freebsd.org/changeset/base/300491 >=20 > Log: > Add support for atomic_long_inc_not_zero() to the LinuxKPI. >=20 > Obtained from: kmacy @ > MFC after: 1 week > Sponsored by: Mellanox Technologies >=20 > Modified: > head/sys/compat/linuxkpi/common/include/asm/atomic-long.h >=20 > Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Mon May 2= 3 11:41:35 2016 (r300490) > +++ head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Mon May 2= 3 11:44:46 2016 (r300491) > @@ -41,6 +41,7 @@ typedef struct { >=20 > #define atomic_long_add(i, v) atomic_long_add_return((i), (v)) > #define atomic_long_inc_return(v) atomic_long_add_return(1, (v)) > +#define atomic_long_inc_not_zero(v) atomic_long_inc_not_zero(v) The same function name is used twice..? This seems a bit odd... > static inline long > atomic_long_add_return(long i, atomic_long_t *v) >=20 From owner-svn-src-head@freebsd.org Mon May 23 15:31:50 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87A80B472F1; Mon, 23 May 2016 15:31:50 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from webmail2.jnielsen.NET (webmail2.jnielsen.net [50.114.224.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "webmail2.jnielsen.net", Issuer "freebsdsolutions.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D6691A1E; Mon, 23 May 2016 15:31:50 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from [192.168.2.210] (c-73-65-219-132.hsd1.ut.comcast.net [73.65.219.132]) (authenticated bits=0) by webmail2.jnielsen.NET (8.15.2/8.15.2) with ESMTPSA id u4NFVkRN081358 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 23 May 2016 09:31:49 -0600 (MDT) (envelope-from lists@jnielsen.net) X-Authentication-Warning: webmail2.jnielsen.NET: Host c-73-65-219-132.hsd1.ut.comcast.net [73.65.219.132] claimed to be [192.168.2.210] Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r300418 - head/sys/kern From: John Nielsen <lists@jnielsen.net> In-Reply-To: <2A5AB488-4FA5-4262-A7BA-BFF391A4B03A@jnielsen.net> Date: Mon, 23 May 2016 09:31:45 -0600 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <3102F837-63C4-4B97-BC78-9DD114228C18@jnielsen.net> References: <201605221304.u4MD4j6H082492@repo.freebsd.org> <2A5AB488-4FA5-4262-A7BA-BFF391A4B03A@jnielsen.net> To: Baptiste Daroussin <bapt@freebsd.org> X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 15:31:50 -0000 > On May 23, 2016, at 9:20 AM, John Nielsen <lists@jnielsen.net> wrote: >=20 >> On May 22, 2016, at 7:04 AM, Baptiste Daroussin <bapt@freebsd.org> = wrote: >>=20 >> - * of date. We could have received a reset packet in an = interrupt or >> + * of date. We could have recived a reset packet in an = interrupt or >=20 > Not sure if there's another error in this line that I'm not seeing but = "received" was spelled right to begin with and is now incorrect. Oops, already fixed in a subsequent commit. Thanks and sorry for the = noise. JN From owner-svn-src-head@freebsd.org Mon May 23 15:33:57 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE0FCB4742B; Mon, 23 May 2016 15:33:57 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8AFE71C7F; Mon, 23 May 2016 15:33:57 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NFXuVh075564; Mon, 23 May 2016 15:33:56 GMT (envelope-from skreuzer@FreeBSD.org) Received: (from skreuzer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NFXuwx075563; Mon, 23 May 2016 15:33:56 GMT (envelope-from skreuzer@FreeBSD.org) Message-Id: <201605231533.u4NFXuwx075563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skreuzer set sender to skreuzer@FreeBSD.org using -f From: Steven Kreuzer <skreuzer@FreeBSD.org> Date: Mon, 23 May 2016 15:33:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300511 - head/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 15:33:57 -0000 Author: skreuzer (doc,ports committer) Date: Mon May 23 15:33:56 2016 New Revision: 300511 URL: https://svnweb.freebsd.org/changeset/base/300511 Log: Document r298192, file(1) updated to 5.26. Approved by: gjb@ (implicit with re@ hat on) Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.xml Mon May 23 15:26:35 2016 (r300510) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml Mon May 23 15:33:56 2016 (r300511) @@ -579,8 +579,8 @@ <para revision="288090">&man.jemalloc.3; has been updated to version 4.0.2.</para> - <para revision="288143">The &man.file.1; utility has been - updated to version 5.25.</para> + <para revision="298192">The &man.file.1; utility has been + updated to version 5.26.</para> <para revision="288303">The &man.nc.1; utility has been updated to the OpenBSD 5.8 version.</para> From owner-svn-src-head@freebsd.org Mon May 23 15:37:14 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06011B474E7; Mon, 23 May 2016 15:37:14 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA1851F11; Mon, 23 May 2016 15:37:13 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NFbCDN075840; Mon, 23 May 2016 15:37:12 GMT (envelope-from skreuzer@FreeBSD.org) Received: (from skreuzer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NFbCFO075839; Mon, 23 May 2016 15:37:12 GMT (envelope-from skreuzer@FreeBSD.org) Message-Id: <201605231537.u4NFbCFO075839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skreuzer set sender to skreuzer@FreeBSD.org using -f From: Steven Kreuzer <skreuzer@FreeBSD.org> Date: Mon, 23 May 2016 15:37:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300512 - head/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 15:37:14 -0000 Author: skreuzer (doc,ports committer) Date: Mon May 23 15:37:12 2016 New Revision: 300512 URL: https://svnweb.freebsd.org/changeset/base/300512 Log: Document r298161, sqlite3 updated to 3.12.1. Approved by: gjb@ (implicit with re@ hat on) Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.xml Mon May 23 15:33:56 2016 (r300511) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml Mon May 23 15:37:12 2016 (r300512) @@ -563,9 +563,9 @@ <para revision="286505">The &man.svnlite.1; utility has been updated to version 1.8.14.</para> - <para revision="286510">The <application>sqlite3</application> + <para revision="298161">The <application>sqlite3</application> library used by &man.svnlite.1; and &man.kerberos.8; has been - updated to version 3.8.11.1.</para> + updated to version 3.12.1.</para> <para revision="286750">Timezone data files have been updated to version 2015f.</para> From owner-svn-src-head@freebsd.org Mon May 23 15:39:16 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7259AB475FD; Mon, 23 May 2016 15:39:16 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from webmail2.jnielsen.NET (webmail2.jnielsen.net [50.114.224.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "webmail2.jnielsen.net", Issuer "freebsdsolutions.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A08711AF; Mon, 23 May 2016 15:39:16 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from [192.168.2.210] (c-73-65-219-132.hsd1.ut.comcast.net [73.65.219.132]) (authenticated bits=0) by webmail2.jnielsen.NET (8.15.2/8.15.2) with ESMTPSA id u4NFKXtc070061 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 23 May 2016 09:20:36 -0600 (MDT) (envelope-from lists@jnielsen.net) X-Authentication-Warning: webmail2.jnielsen.NET: Host c-73-65-219-132.hsd1.ut.comcast.net [73.65.219.132] claimed to be [192.168.2.210] Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r300418 - head/sys/kern From: John Nielsen <lists@jnielsen.net> In-Reply-To: <201605221304.u4MD4j6H082492@repo.freebsd.org> Date: Mon, 23 May 2016 09:20:32 -0600 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <2A5AB488-4FA5-4262-A7BA-BFF391A4B03A@jnielsen.net> References: <201605221304.u4MD4j6H082492@repo.freebsd.org> To: Baptiste Daroussin <bapt@freebsd.org> X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 15:39:16 -0000 > On May 22, 2016, at 7:04 AM, Baptiste Daroussin <bapt@freebsd.org> = wrote: >=20 > - * of date. We could have received a reset packet in an = interrupt or > + * of date. We could have recived a reset packet in an = interrupt or Not sure if there's another error in this line that I'm not seeing but = "received" was spelled right to begin with and is now incorrect. JN From owner-svn-src-head@freebsd.org Mon May 23 15:44:41 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 073C1B47760; Mon, 23 May 2016 15:44:41 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDBCD1717; Mon, 23 May 2016 15:44:40 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NFieMQ078718; Mon, 23 May 2016 15:44:40 GMT (envelope-from skreuzer@FreeBSD.org) Received: (from skreuzer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NFieAs078717; Mon, 23 May 2016 15:44:40 GMT (envelope-from skreuzer@FreeBSD.org) Message-Id: <201605231544.u4NFieAs078717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skreuzer set sender to skreuzer@FreeBSD.org using -f From: Steven Kreuzer <skreuzer@FreeBSD.org> Date: Mon, 23 May 2016 15:44:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300513 - head/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 15:44:41 -0000 Author: skreuzer (doc,ports committer) Date: Mon May 23 15:44:39 2016 New Revision: 300513 URL: https://svnweb.freebsd.org/changeset/base/300513 Log: Document r296190, openresolv updated to 3.7.3. Approved by: gjb@ (implicit with re@ hat on) Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.xml Mon May 23 15:37:12 2016 (r300512) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml Mon May 23 15:44:39 2016 (r300513) @@ -514,9 +514,9 @@ &man.hostapd.8; utilities have been updated to version 2.4.</para> - <para revision="282434" contrib="sponsor" sponsor="&ff;">The + <para revision="296190" contrib="sponsor" sponsor="&ff;">The &man.resolvconf.8; utility has been updated to version - 3.7.0.</para> + 3.7.3.</para> <para revision="284254"><application>bmake</application> has been updated to version 20150606.</para> From owner-svn-src-head@freebsd.org Mon May 23 16:04:59 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42679B47D5E; Mon, 23 May 2016 16:04:59 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 32FD1167F; Mon, 23 May 2016 16:04:59 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 2BE141B7F; Mon, 23 May 2016 16:04:59 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id C29091C2DE; Mon, 23 May 2016 16:04:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id AlnCew9cSU2P; Mon, 23 May 2016 16:04:51 +0000 (UTC) Subject: Re: svn commit: r300348 - head DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 230601C2D4 To: Andrew Turner <andrew@fubar.geek.nz> References: <201605210132.u4L1W43X033151@repo.freebsd.org> <20160523113400.349b8bdc@zapp> <20160523120134.7d4c127d@zapp> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Bryan Drewery <bdrewery@FreeBSD.org> Organization: FreeBSD Message-ID: <199286da-0b3f-cf0e-cc12-48bdf1910af4@FreeBSD.org> Date: Mon, 23 May 2016 09:04:48 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <20160523120134.7d4c127d@zapp> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 16:04:59 -0000 On 5/23/16 4:01 AM, Andrew Turner wrote: > On Mon, 23 May 2016 11:34:00 +0100 > Andrew Turner <andrew@fubar.geek.nz> wrote: > >> On Sat, 21 May 2016 01:32:04 +0000 (UTC) >> Bryan Drewery <bdrewery@FreeBSD.org> wrote: >> >>> Author: bdrewery >>> Date: Sat May 21 01:32:04 2016 >>> New Revision: 300348 >>> URL: https://svnweb.freebsd.org/changeset/base/300348 >>> >>> Log: >>> Move external toolchain support earlier. >>> >>> This is to consolidate external toolchain and >>> WITHOUT_CROSS_COMPILER support. >>> Reviewed by: brooks, bapt >>> Sponsored by: EMC / Isilon Storage Division >>> Differential Revision: https://reviews.freebsd.org/D6353 >>> >> >> This seems to have broken the arm64 build. My guess is the wrong >> linker is being used, but I haven't looked into the issue too far. > > The issue is you moved a block that depends on BROKEN_OPTIONS being > defined to before the point we include share/mk/src.opts.mk, the place > it is defined. > Looking at it now. -- Regards, Bryan Drewery From owner-svn-src-head@freebsd.org Mon May 23 16:19:52 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2A18B460CD; Mon, 23 May 2016 16:19:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF9F8105C; Mon, 23 May 2016 16:19:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NGJpcC088310; Mon, 23 May 2016 16:19:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NGJpki088309; Mon, 23 May 2016 16:19:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231619.u4NGJpki088309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Mon, 23 May 2016 16:19:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300517 - head/sys/compat/linuxkpi/common/include/asm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 16:19:53 -0000 Author: hselasky Date: Mon May 23 16:19:51 2016 New Revision: 300517 URL: https://svnweb.freebsd.org/changeset/base/300517 Log: Implement "atomic_long_add_unless()" in the LinuxKPI and fix the implementation of "atomic_long_inc_not_zero()". Found by: ngie @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Mon May 23 16:12:11 2016 (r300516) +++ head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Mon May 23 16:19:51 2016 (r300517) @@ -41,7 +41,7 @@ typedef struct { #define atomic_long_add(i, v) atomic_long_add_return((i), (v)) #define atomic_long_inc_return(v) atomic_long_add_return(1, (v)) -#define atomic_long_inc_not_zero(v) atomic_long_inc_not_zero(v) +#define atomic_long_inc_not_zero(v) atomic_long_add_unless((v), 1, 0) static inline long atomic_long_add_return(long i, atomic_long_t *v) @@ -73,6 +73,21 @@ atomic_long_dec(atomic_long_t *v) return atomic_fetchadd_long(&v->counter, -1) - 1; } +static inline int +atomic_long_add_unless(atomic_long_t *v, long a, long u) +{ + long c; + + for (;;) { + c = atomic_long_read(v); + if (unlikely(c == u)) + break; + if (likely(atomic_cmpset_long(&v->counter, c, c + a))) + break; + } + return (c != u); +} + static inline long atomic_long_dec_and_test(atomic_long_t *v) { From owner-svn-src-head@freebsd.org Mon May 23 16:21:02 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C19E2B46183; Mon, 23 May 2016 16:21:02 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A578136C; Mon, 23 May 2016 16:21:02 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 3B2911FE024; Mon, 23 May 2016 18:20:54 +0200 (CEST) Subject: Re: svn commit: r300491 - head/sys/compat/linuxkpi/common/include/asm To: Ngie Cooper <yaneurabeya@gmail.com> References: <201605231144.u4NBikhD004954@repo.freebsd.org> <0B789C60-3EF9-4553-BD19-3245B451FB0A@gmail.com> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Hans Petter Selasky <hps@selasky.org> Message-ID: <9d6fc2d2-e748-4b94-b77d-4cd56e7bd9bf@selasky.org> Date: Mon, 23 May 2016 18:24:15 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <0B789C60-3EF9-4553-BD19-3245B451FB0A@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 16:21:02 -0000 On 05/23/16 17:27, Ngie Cooper wrote: > >> On May 23, 2016, at 04:44, Hans Petter Selasky <hselasky@FreeBSD.org> wrote: >> >> Author: hselasky >> Date: Mon May 23 11:44:46 2016 >> New Revision: 300491 >> URL: https://svnweb.freebsd.org/changeset/base/300491 >> >> Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h >> ============================================================================== >> --- head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Mon May 23 11:41:35 2016 (r300490) >> +++ head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Mon May 23 11:44:46 2016 (r300491) >> @@ -41,6 +41,7 @@ typedef struct { >> >> #define atomic_long_add(i, v) atomic_long_add_return((i), (v)) >> #define atomic_long_inc_return(v) atomic_long_add_return(1, (v)) >> +#define atomic_long_inc_not_zero(v) atomic_long_inc_not_zero(v) > > The same function name is used twice..? This seems a bit odd... > Yes, it is odd. Fixed by r300517. Thank you! --HPS From owner-svn-src-head@freebsd.org Mon May 23 16:24:35 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2FB0B463C8; Mon, 23 May 2016 16:24:35 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE0C51B15; Mon, 23 May 2016 16:24:35 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NGOYRu091388; Mon, 23 May 2016 16:24:34 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NGOYgT091387; Mon, 23 May 2016 16:24:34 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201605231624.u4NGOYgT091387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery <bdrewery@FreeBSD.org> Date: Mon, 23 May 2016 16:24:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300519 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 16:24:35 -0000 Author: bdrewery Date: Mon May 23 16:24:34 2016 New Revision: 300519 URL: https://svnweb.freebsd.org/changeset/base/300519 Log: Move binutils handling after src.opts.mk. This fixes the arm64 build after r300348. Sponsored by: EMC / Isilon Storage Division Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon May 23 16:20:50 2016 (r300518) +++ head/Makefile.inc1 Mon May 23 16:24:34 2016 (r300519) @@ -59,20 +59,6 @@ CROSSENV+=CROSS_TOOLCHAIN="${CROSS_TOOLC .endif .if defined(CROSS_TOOLCHAIN_PREFIX) CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} -CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} -.endif -# If we do not have a bootstrap binutils (because the in-tree one does not -# support the target architecture), provide a default cross-binutils prefix. -# This allows aarch64 builds, for example, to automatically use the -# aarch64-binutils port or package. -.if !make(showconfig) -.if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \ - !defined(CROSS_BINUTILS_PREFIX) -CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebsd/bin/ -.if !exists(${CROSS_BINUTILS_PREFIX}) -.error In-tree binutils does not support the ${TARGET_ARCH} architecture. Install the ${TARGET_ARCH}-binutils port or package or set CROSS_BINUTILS_PREFIX. -.endif -.endif .endif XCOMPILERS= CC CXX CPP @@ -83,15 +69,6 @@ X${COMPILER}?= ${CROSS_COMPILER_PREFIX}$ X${COMPILER}?= ${${COMPILER}} .endif .endfor -XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS -.for BINUTIL in ${XBINUTILS} -.if defined(CROSS_BINUTILS_PREFIX) && \ - exists(${CROSS_BINUTILS_PREFIX}${${BINUTIL}}) -X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}} -.else -X${BINUTIL}?= ${${BINUTIL}} -.endif -.endfor # If a full path to an external cross compiler is given, don't build # a cross compiler. .if ${XCC:N${CCACHE_BIN}:M/*} @@ -151,6 +128,33 @@ CROSSENV+= COMPILER_VERSION=${COMPILER_V .endif # ${_expected_compiler_type} == ${COMPILER_TYPE} .endif # ${XCC:N${CCACHE_BIN}:M/*} +# Handle external binutils. +.if defined(CROSS_TOOLCHAIN_PREFIX) +CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} +.endif +# If we do not have a bootstrap binutils (because the in-tree one does not +# support the target architecture), provide a default cross-binutils prefix. +# This allows aarch64 builds, for example, to automatically use the +# aarch64-binutils port or package. +.if !make(showconfig) +.if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \ + !defined(CROSS_BINUTILS_PREFIX) +CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebsd/bin/ +.if !exists(${CROSS_BINUTILS_PREFIX}) +.error In-tree binutils does not support the ${TARGET_ARCH} architecture. Install the ${TARGET_ARCH}-binutils port or package or set CROSS_BINUTILS_PREFIX. +.endif +.endif +.endif +XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS +.for BINUTIL in ${XBINUTILS} +.if defined(CROSS_BINUTILS_PREFIX) && \ + exists(${CROSS_BINUTILS_PREFIX}${${BINUTIL}}) +X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}} +.else +X${BINUTIL}?= ${${BINUTIL}} +.endif +.endfor + # We must do lib/ and libexec/ before bin/ in case of a mid-install error to # keep the users system reasonably usable. For static->dynamic root upgrades, From owner-svn-src-head@freebsd.org Mon May 23 16:25:09 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDECEB46426; Mon, 23 May 2016 16:25:09 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id BDF861CE1; Mon, 23 May 2016 16:25:09 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id B6DF81939; Mon, 23 May 2016 16:25:09 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 701531C3B5; Mon, 23 May 2016 16:25:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id cWeu5oo99lbe; Mon, 23 May 2016 16:25:06 +0000 (UTC) Subject: Re: svn commit: r300348 - head DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 874111C3AD To: Andrew Turner <andrew@fubar.geek.nz> References: <201605210132.u4L1W43X033151@repo.freebsd.org> <20160523113400.349b8bdc@zapp> <20160523120134.7d4c127d@zapp> <199286da-0b3f-cf0e-cc12-48bdf1910af4@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Bryan Drewery <bdrewery@FreeBSD.org> Organization: FreeBSD Message-ID: <6f29d844-50df-3f62-e8fd-f467a2c61922@FreeBSD.org> Date: Mon, 23 May 2016 09:25:05 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <199286da-0b3f-cf0e-cc12-48bdf1910af4@FreeBSD.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 16:25:09 -0000 On 5/23/16 9:04 AM, Bryan Drewery wrote: > On 5/23/16 4:01 AM, Andrew Turner wrote: >> On Mon, 23 May 2016 11:34:00 +0100 >> Andrew Turner <andrew@fubar.geek.nz> wrote: >> >>> On Sat, 21 May 2016 01:32:04 +0000 (UTC) >>> Bryan Drewery <bdrewery@FreeBSD.org> wrote: >>> >>>> Author: bdrewery >>>> Date: Sat May 21 01:32:04 2016 >>>> New Revision: 300348 >>>> URL: https://svnweb.freebsd.org/changeset/base/300348 >>>> >>>> Log: >>>> Move external toolchain support earlier. >>>> >>>> This is to consolidate external toolchain and >>>> WITHOUT_CROSS_COMPILER support. >>>> Reviewed by: brooks, bapt >>>> Sponsored by: EMC / Isilon Storage Division >>>> Differential Revision: https://reviews.freebsd.org/D6353 >>>> >>> >>> This seems to have broken the arm64 build. My guess is the wrong >>> linker is being used, but I haven't looked into the issue too far. >> >> The issue is you moved a block that depends on BROKEN_OPTIONS being >> defined to before the point we include share/mk/src.opts.mk, the place >> it is defined. >> > > Looking at it now. > > Fixed in r300519. Sorry about that. I've installed the aarch64-binutils now to be sure I'm testing it as well. -- Regards, Bryan Drewery From owner-svn-src-head@freebsd.org Mon May 23 16:49:27 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C58BDB476DF; Mon, 23 May 2016 16:49:27 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 953811152; Mon, 23 May 2016 16:49:27 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NGnQOH098119; Mon, 23 May 2016 16:49:26 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NGnQaZ098118; Mon, 23 May 2016 16:49:26 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201605231649.u4NGnQaZ098118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude <allanjude@FreeBSD.org> Date: Mon, 23 May 2016 16:49:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300521 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 16:49:27 -0000 Author: allanjude Date: Mon May 23 16:49:26 2016 New Revision: 300521 URL: https://svnweb.freebsd.org/changeset/base/300521 Log: Fix missing pool name in zfs set command Modified: head/usr.sbin/bsdinstall/scripts/zfsboot Modified: head/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- head/usr.sbin/bsdinstall/scripts/zfsboot Mon May 23 16:37:04 2016 (r300520) +++ head/usr.sbin/bsdinstall/scripts/zfsboot Mon May 23 16:49:26 2016 (r300521) @@ -1312,7 +1312,7 @@ zfs_create_boot() f_dprintf "$funcname: Set canmount=noauto for the root of the pool..." f_eval_catch $funcname zfs "$ZFS_SET" "canmount=noauto" \ - "$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME" + "$zroot_name/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME" # Touch up permissions on the tmp directories f_dprintf "$funcname: Modifying directory permissions..." From owner-svn-src-head@freebsd.org Mon May 23 16:59:06 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8209DB478DC; Mon, 23 May 2016 16:59:06 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 397E91715; Mon, 23 May 2016 16:59:06 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NGx5lN001177; Mon, 23 May 2016 16:59:05 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NGx5jU001176; Mon, 23 May 2016 16:59:05 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201605231659.u4NGx5jU001176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox <alc@FreeBSD.org> Date: Mon, 23 May 2016 16:59:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300522 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 16:59:06 -0000 Author: alc Date: Mon May 23 16:59:05 2016 New Revision: 300522 URL: https://svnweb.freebsd.org/changeset/base/300522 Log: Correct an error in a comment: One of the conditions for page allocation is actually the opposite of that stated in the comment. Remove an unnecessary assignment. Use an assertion to document the fact that no assignment is needed. Rewrite another comment to clarify that the page is not completely valid. Reviewed by: kib Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Mon May 23 16:49:26 2016 (r300521) +++ head/sys/vm/vm_fault.c Mon May 23 16:59:05 2016 (r300522) @@ -496,11 +496,13 @@ fast_failed: goto readrest; break; } + KASSERT(fs.m == NULL, ("fs.m should be NULL, not %p", fs.m)); /* - * Page is not resident. If this is the search termination - * or the pager might contain the page, allocate a new page. - * Default objects are zero-fill, there is no real pager. + * Page is not resident. If the pager might contain the page + * or this is the beginning of the search, allocate a new + * page. (Default objects are zero-fill, so there is no real + * pager for them.) */ if (fs.object->type != OBJT_DEFAULT || fs.object == fs.first_object) { @@ -517,7 +519,6 @@ fast_failed: * there, and allocation can fail, causing * restart and new reading of the p_flag. */ - fs.m = NULL; if (!vm_page_count_severe() || P_KILLED(curproc)) { #if VM_NRESERVLEVEL > 0 vm_object_color(fs.object, atop(vaddr) - @@ -541,14 +542,12 @@ fast_failed: readrest: /* - * We have found a valid page or we have allocated a new page. - * The page thus may not be valid or may not be entirely - * valid. + * We have either allocated a new page or found an existing + * page that is only partially valid. * * Attempt to fault-in the page if there is a chance that the * pager has it, and potentially fault in additional pages - * at the same time. For default objects simply provide - * zero-filled pages. + * at the same time. */ if (fs.object->type != OBJT_DEFAULT) { int rv; From owner-svn-src-head@freebsd.org Mon May 23 17:04:15 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D28BB47B19; Mon, 23 May 2016 17:04:15 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBD1F1BBE; Mon, 23 May 2016 17:04:14 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NH4ETW004311; Mon, 23 May 2016 17:04:14 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NH4Etf004310; Mon, 23 May 2016 17:04:14 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201605231704.u4NH4Etf004310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude <allanjude@FreeBSD.org> Date: Mon, 23 May 2016 17:04:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300523 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 17:04:15 -0000 Author: allanjude Date: Mon May 23 17:04:13 2016 New Revision: 300523 URL: https://svnweb.freebsd.org/changeset/base/300523 Log: Only export and re-import the root pool if installing on MBR This step is required in order to dd the boot2 bits into the ZFS partition Sponsored by: ScaleEngine Inc. Modified: head/usr.sbin/bsdinstall/scripts/zfsboot Modified: head/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- head/usr.sbin/bsdinstall/scripts/zfsboot Mon May 23 16:59:05 2016 (r300522) +++ head/usr.sbin/bsdinstall/scripts/zfsboot Mon May 23 17:04:13 2016 (r300523) @@ -1310,10 +1310,6 @@ zfs_create_boot() "mountpoint=/$zroot_name" "$zroot_name" || return $FAILURE - f_dprintf "$funcname: Set canmount=noauto for the root of the pool..." - f_eval_catch $funcname zfs "$ZFS_SET" "canmount=noauto" \ - "$zroot_name/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME" - # Touch up permissions on the tmp directories f_dprintf "$funcname: Modifying directory permissions..." local dir @@ -1338,17 +1334,17 @@ zfs_create_boot() "bootfs=\"$zroot_name/$zroot_bootfs\"" "$zroot_name" || return $FAILURE - # Export the pool(s) - f_dprintf "$funcname: Temporarily exporting ZFS pool(s)..." - f_eval_catch $funcname zpool "$ZPOOL_EXPORT" "$zroot_name" || - return $FAILURE - if [ "$ZFSBOOT_BOOT_POOL" ]; then - f_eval_catch $funcname zpool "$ZPOOL_EXPORT" \ - "$bootpool_name" || return $FAILURE - fi - # MBR boot loader touch-up if [ "$ZFSBOOT_PARTITION_SCHEME" = "MBR" ]; then + # Export the pool(s) + f_dprintf "$funcname: Temporarily exporting ZFS pool(s)..." + f_eval_catch $funcname zpool "$ZPOOL_EXPORT" "$zroot_name" || + return $FAILURE + if [ "$ZFSBOOT_BOOT_POOL" ]; then + f_eval_catch $funcname zpool "$ZPOOL_EXPORT" \ + "$bootpool_name" || return $FAILURE + fi + f_dprintf "$funcname: Updating MBR boot loader on disks..." # Stick the ZFS boot loader in the "convenient hole" after # the ZFS internal metadata @@ -1357,17 +1353,17 @@ zfs_create_boot() /boot/zfsboot /dev/$disk$bootpart \ "skip=1 seek=1024" || return $FAILURE done - fi - # Re-import the ZFS pool(s) - f_dprintf "$funcname: Re-importing ZFS pool(s)..." - f_eval_catch $funcname zpool "$ZPOOL_IMPORT_WITH_OPTIONS" \ - "-o altroot=\"$BSDINSTALL_CHROOT\"" "$zroot_name" || - return $FAILURE - if [ "$ZFSBOOT_BOOT_POOL" ]; then + # Re-import the ZFS pool(s) + f_dprintf "$funcname: Re-importing ZFS pool(s)..." f_eval_catch $funcname zpool "$ZPOOL_IMPORT_WITH_OPTIONS" \ - "-o altroot=\"$BSDINSTALL_CHROOT\"" \ - "$bootpool_name" || return $FAILURE + "-o altroot=\"$BSDINSTALL_CHROOT\"" "$zroot_name" || + return $FAILURE + if [ "$ZFSBOOT_BOOT_POOL" ]; then + f_eval_catch $funcname zpool "$ZPOOL_IMPORT_WITH_OPTIONS" \ + "-o altroot=\"$BSDINSTALL_CHROOT\"" \ + "$bootpool_name" || return $FAILURE + fi fi # While this is apparently not needed, it seems to help MBR @@ -1378,6 +1374,14 @@ zfs_create_boot() "cachefile=\"$BSDINSTALL_CHROOT/boot/zfs/zpool.cache\"" \ "$zroot_name" || return $FAILURE + # + # Set canmount=noauto so that the default Boot Environment (BE) does not + # get mounted if a different BE is selected from the beastie menu + # + f_dprintf "$funcname: Set canmount=noauto for the root of the pool..." + f_eval_catch $funcname zfs "$ZFS_SET" "canmount=noauto" \ + "$zroot_name/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME" + # Last, but not least... required lines for rc.conf(5)/loader.conf(5) # NOTE: We later concatenate these into their destination f_dprintf "%s: Configuring rc.conf(5)/loader.conf(5) additions..." \ From owner-svn-src-head@freebsd.org Mon May 23 17:06:47 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A4CAB47BB9; Mon, 23 May 2016 17:06:47 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 371951D8F; Mon, 23 May 2016 17:06:47 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NH6kkc004448; Mon, 23 May 2016 17:06:46 GMT (envelope-from skreuzer@FreeBSD.org) Received: (from skreuzer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NH6kFC004447; Mon, 23 May 2016 17:06:46 GMT (envelope-from skreuzer@FreeBSD.org) Message-Id: <201605231706.u4NH6kFC004447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skreuzer set sender to skreuzer@FreeBSD.org using -f From: Steven Kreuzer <skreuzer@FreeBSD.org> Date: Mon, 23 May 2016 17:06:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300524 - head/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 17:06:47 -0000 Author: skreuzer (doc,ports committer) Date: Mon May 23 17:06:46 2016 New Revision: 300524 URL: https://svnweb.freebsd.org/changeset/base/300524 Log: Document r298998, OpenSSL updated to 1.0.2h. Approved by: gjb@ (implicit with re@ hat on) Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.xml Mon May 23 17:04:13 2016 (r300523) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml Mon May 23 17:06:46 2016 (r300524) @@ -540,8 +540,8 @@ <para revision="285275">The &man.tcpdump.1; utility has been updated to version 4.7.4.</para> - <para revision="285329"><application>OpenSSL</application> has - been updated to version 1.0.1p.</para> + <para revision="298998"><application>OpenSSL</application> has + been updated to version 1.0.2h.</para> <para revision="285642" contrib="sponsor" sponsor="&dell;">The &man.ssh.1; utility has been updated to re-implement hostname From owner-svn-src-head@freebsd.org Mon May 23 17:11:34 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F0E2B47D42; Mon, 23 May 2016 17:11:34 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0CDB1035; Mon, 23 May 2016 17:11:33 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NHBXB0005299; Mon, 23 May 2016 17:11:33 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NHBXR4005298; Mon, 23 May 2016 17:11:33 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201605231711.u4NHBXR4005298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery <bdrewery@FreeBSD.org> Date: Mon, 23 May 2016 17:11:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300525 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 17:11:34 -0000 Author: bdrewery Date: Mon May 23 17:11:32 2016 New Revision: 300525 URL: https://svnweb.freebsd.org/changeset/base/300525 Log: Use sed(1) to determine cc version rather than tail(1) since it is already in ITOOLS. This fixes 'tail: not found' warnings in installworld after r300351. Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/bsd.compiler.mk Modified: head/share/mk/bsd.compiler.mk ============================================================================== --- head/share/mk/bsd.compiler.mk Mon May 23 17:06:46 2016 (r300524) +++ head/share/mk/bsd.compiler.mk Mon May 23 17:11:32 2016 (r300525) @@ -156,7 +156,7 @@ ${X_}COMPILER_VERSION!=echo "${_v:M[1-9] .undef _v .endif .if !defined(${X_}COMPILER_FREEBSD_VERSION) -${X_}COMPILER_FREEBSD_VERSION!= { echo "__FreeBSD_cc_version" | ${${cc}} -E - 2>/dev/null || echo __FreeBSD_cc_version; } | tail -n 1 +${X_}COMPILER_FREEBSD_VERSION!= { echo "__FreeBSD_cc_version" | ${${cc}} -E - 2>/dev/null || echo __FreeBSD_cc_version; } | sed -n '$$p' # If we get a literal "__FreeBSD_cc_version" back then the compiler # is a non-FreeBSD build that doesn't support it or some other error # occurred. From owner-svn-src-head@freebsd.org Mon May 23 17:17:26 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 270D6B47E62; Mon, 23 May 2016 17:17:26 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07FAF1520; Mon, 23 May 2016 17:17:26 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 1B449B95B; Mon, 23 May 2016 13:17:25 -0400 (EDT) From: John Baldwin <jhb@freebsd.org> To: Hans Petter Selasky <hselasky@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300493 - head/sys/compat/linuxkpi/common/include/linux Date: Mon, 23 May 2016 10:00:20 -0700 Message-ID: <3455323.tBydyU5thm@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201605231150.u4NBo56Y005227@repo.freebsd.org> References: <201605231150.u4NBo56Y005227@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 23 May 2016 13:17:25 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 17:17:26 -0000 On Monday, May 23, 2016 11:50:05 AM Hans Petter Selasky wrote: > Author: hselasky > Date: Mon May 23 11:50:05 2016 > New Revision: 300493 > URL: https://svnweb.freebsd.org/changeset/base/300493 > > Log: > Add support for "cdev_add_ext()" to the LinuxKPI. > > Obtained from: kmacy @ > MFC after: 1 week > Sponsored by: Mellanox Technologies > > Modified: > head/sys/compat/linuxkpi/common/include/linux/cdev.h > > Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h > ============================================================================== > --- head/sys/compat/linuxkpi/common/include/linux/cdev.h Mon May 23 11:47:54 2016 (r300492) > +++ head/sys/compat/linuxkpi/common/include/linux/cdev.h Mon May 23 11:50:05 2016 (r300493) > @@ -91,6 +91,18 @@ cdev_add(struct linux_cdev *cdev, dev_t > return (0); > } > > +static inline int > +cdev_add_ext(struct linux_cdev *cdev, dev_t dev, uid_t uid, gid_t gid, int mode) > +{ > + cdev->cdev = make_dev(&linuxcdevsw, MINOR(dev), uid, gid, mode, > + "%s/%d", kobject_name(&cdev->kobj), MINOR(dev)); > + cdev->dev = dev; > + cdev->cdev->si_drv1 = cdev; > + > + kobject_get(cdev->kobj.parent); > + return (0); This should use make_dev_s() instead? -- John Baldwin From owner-svn-src-head@freebsd.org Mon May 23 17:27:44 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 171B2B47047; Mon, 23 May 2016 17:27:44 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC4FE1B16; Mon, 23 May 2016 17:27:43 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NHRheH010611; Mon, 23 May 2016 17:27:43 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NHRhnt010610; Mon, 23 May 2016 17:27:43 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201605231727.u4NHRhnt010610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery <bdrewery@FreeBSD.org> Date: Mon, 23 May 2016 17:27:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300526 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 17:27:44 -0000 Author: bdrewery Date: Mon May 23 17:27:42 2016 New Revision: 300526 URL: https://svnweb.freebsd.org/changeset/base/300526 Log: Properly allow META_MODE to be set from environment. Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/sys.mk Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Mon May 23 17:11:32 2016 (r300525) +++ head/share/mk/sys.mk Mon May 23 17:27:42 2016 (r300526) @@ -46,7 +46,7 @@ __ENV_ONLY_OPTIONS:= \ .sinclude <meta.sys.mk> .elif ${MK_META_MODE} == "yes" && defined(.MAKEFLAGS) && ${.MAKEFLAGS:M-B} == "" # verbose will show .MAKE.META.PREFIX for each target. -META_MODE= meta verbose +META_MODE+= meta verbose # silent will hide command output if a .meta file is created. .if !defined(NO_SILENT) META_MODE+= silent=yes From owner-svn-src-head@freebsd.org Mon May 23 17:37:52 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9C5BB4727D for <svn-src-head@mailman.ysv.freebsd.org>; Mon, 23 May 2016 17:37:52 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x229.google.com (mail-io0-x229.google.com [IPv6:2607:f8b0:4001:c06::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7A80B11CF for <svn-src-head@freebsd.org>; Mon, 23 May 2016 17:37:52 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x229.google.com with SMTP id 190so198114761iow.1 for <svn-src-head@freebsd.org>; Mon, 23 May 2016 10:37:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=TxwWGyvNyaGcfUtQNa0/4P7WDAFjJUWcTtmnYHjn9uA=; b=zqHX5OVupk5xSLWrCrVZXqBelLvvxZVT0H9/x3KpwUfbHu0qlHx6wy9R1fJEuHYqU7 91mfRRZTKoig6xiVjqvPnuMfENPvj7dwae3hHXhC0cEHfaIQbrqcq6wQWHlUHqwdEDHe fXL7nmH+/GiJFWWujd7Z8AaoyfZweTk7xWcyeNaQBMrP8X9Yzg4UUf6utz8KtZJA4yjF E0WRievyQVFmGNn2jxysoIT4wMmh2JiYtVy2sAfv179VQujLezcRAS84jM/CXA4hBW3u 22xiaGZCXgd1ei/ghYMBP4rTzr1gDqQM7CBDh+bGLH/XimPOccus6Dn6ygcp+HzB3p10 gqdg== 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:date :message-id:subject:from:to:cc; bh=TxwWGyvNyaGcfUtQNa0/4P7WDAFjJUWcTtmnYHjn9uA=; b=JtPeAq3AqS6nHsdA1DlbvJ27woDV1M9uPwaBeGx47lWQ7gw/yNWAvP+pykDfW9zfjX tZrYm0TJw2++UYM3P4NCIXKG0KTHLVcYiD3S5dxMtVRuE1D6exU+za+2WRR6SGPmnbAo 3XUGO9QlTLh0ev6gfkaogbLMsqhxfpk9bh4nUALzVQ80R7UEytkkHSqwPESbNWjZgj5G 2O/o9dON5cyJXmhM74zVZANpSCmvMxHiQikXEvAnpzmxx7o4LH0De/WvYmSjwAEbuP7/ P1JdKFHup4uhMEjfQDUGHzqcYBQjIVSJ4EQh28DNGTMGZ7ZD5bF4yxBSP7h4icuV63wq UgVA== X-Gm-Message-State: AOPr4FXCFDdGfXizFSF55iTnD3zBPdLgPwaYtuzn5aBU7Ij9Ac3HmwWiBSm0cO/JZmj7i3o7qAZWk04sozmOSA== MIME-Version: 1.0 X-Received: by 10.107.40.201 with SMTP id o192mr12647534ioo.183.1464025071558; Mon, 23 May 2016 10:37:51 -0700 (PDT) Sender: wlosh@bsdimp.com Received: by 10.79.75.68 with HTTP; Mon, 23 May 2016 10:37:51 -0700 (PDT) X-Originating-IP: [50.253.99.174] In-Reply-To: <CAHSQbTAVt6QgVNz0M_yCVpTwSc=-YFU5O0uhaqKC6XOPOmJCkQ@mail.gmail.com> References: <201605221358.u4MDwW8u097510@repo.freebsd.org> <C66E915D-A4D7-4591-AF6C-0949AF184271@panasas.com> <CAHSQbTAVt6QgVNz0M_yCVpTwSc=-YFU5O0uhaqKC6XOPOmJCkQ@mail.gmail.com> Date: Mon, 23 May 2016 11:37:51 -0600 X-Google-Sender-Auth: q1vk_GwQclxYQ5e4Zb6bIExvMC4 Message-ID: <CANCZdfpsEpgb_B2mbiZqFGuwOb-rcDxf5KJLaEcavw7mD+Hj0g@mail.gmail.com> Subject: Re: svn commit: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac From: Warner Losh <imp@bsdimp.com> To: Justin Hibbits <chmeeedalf@gmail.com> Cc: Ravi Pokala <rpokala@mac.com>, src-committers <src-committers@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, Luiz Otavio O Souza <loos@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org> Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 17:37:52 -0000 On Sun, May 22, 2016 at 1:12 PM, Justin Hibbits <chmeeedalf@gmail.com> wrote: > > On May 22, 2016 13:51, "Ravi Pokala" <rpokala@mac.com> wrote: >> >> -----Original Message----- >> From: <owner-src-committers@freebsd.org> on behalf of Luiz Otavio O Souza >> <loos@FreeBSD.org> >> Date: 2016-05-22, Sunday at 06:58 >> To: <src-committers@freebsd.org>, <svn-src-all@freebsd.org>, >> <svn-src-head@freebsd.org> >> Subject: svn commit: r300421 - in head/sys: arm/allwinner >> arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica >> dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac >> >> >Author: loos >> >Date: Sun May 22 13:58:32 2016 >> >New Revision: 300421 >> >URL: https://svnweb.freebsd.org/changeset/base/300421 >> > >> >Log: >> > Fix the deciKelvin to Celsius conversion in kernel. >> > >> > After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as >> > 0C >> > reference and as result, the temperature read in sysctl(8) now exibits >> > a >> > +0.1C difference. >> >> Out of morbid curiosity, why do these things report in deciKelvin anyway? >> Are there sensors we support out there which report native Kelvin, or that >> report sub-degree precision? >> >> Thanks, >> >> Ravi (rpokala@) >> > > There are many i2c sensors which report in sub-degree centigrade. Though > some of them are in 1/8 (or other power of 2) degree precision, not 1/10. ACPI reports in decikelvin, and it was the first thing we supported. Some 1 wire devices support 1/16th a degree, and we support it in millikelvin since 1/16th is 0.0625. So the precision needed is actually greater than what we're reporting. However, the accuracy of the measurement isn't +/- 0.001, it's closer to +/1 0.063 or so (well, that's a relative accuracy, absolute accuracy is closer to +/- 1 degree). We report the higher level of precision so that applications that use the relative temperature can use it to inform a control loop. We have no good way to report relative precision for a measurement, or the absolute accuracy. Warner From owner-svn-src-head@freebsd.org Mon May 23 18:12:53 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 811F4B47B24; Mon, 23 May 2016 18:12:53 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 451231A7D; Mon, 23 May 2016 18:12:53 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NICqf7026084; Mon, 23 May 2016 18:12:52 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NICqmM026083; Mon, 23 May 2016 18:12:52 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201605231812.u4NICqmM026083@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus <skra@FreeBSD.org> Date: Mon, 23 May 2016 18:12:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300528 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 18:12:53 -0000 Author: skra Date: Mon May 23 18:12:52 2016 New Revision: 300528 URL: https://svnweb.freebsd.org/changeset/base/300528 Log: INTRNG - use gpio generic interrupt modes definitions added in r298738. Reviewed by: ian Modified: head/sys/arm/freescale/imx/imx_gpio.c Modified: head/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- head/sys/arm/freescale/imx/imx_gpio.c Mon May 23 17:41:53 2016 (r300527) +++ head/sys/arm/freescale/imx/imx_gpio.c Mon May 23 18:12:52 2016 (r300528) @@ -95,8 +95,7 @@ __FBSDID("$FreeBSD$"); struct gpio_irqsrc { struct intr_irqsrc gi_isrc; u_int gi_irq; - enum intr_polarity gi_pol; - enum intr_trigger gi_trig; + uint32_t gi_mode; }; #endif @@ -158,12 +157,11 @@ static int imx51_gpio_pin_toggle(device_ #ifdef INTRNG static int gpio_pic_map_fdt(device_t dev, u_int ncells, pcell_t *cells, u_int *irqp, - enum intr_polarity *polp, enum intr_trigger *trigp) + uint32_t *modep) { struct imx51_gpio_softc *sc; u_int irq, tripol; - enum intr_polarity pol; - enum intr_trigger trig; + uint32_t mode; sc = device_get_softc(dev); @@ -191,31 +189,25 @@ gpio_pic_map_fdt(device_t dev, u_int nce } switch (tripol) { case 1: - trig = INTR_TRIGGER_EDGE; - pol = INTR_POLARITY_HIGH; + mode = GPIO_INTR_EDGE_RISING; break; case 2: - trig = INTR_TRIGGER_EDGE; - pol = INTR_POLARITY_LOW; + mode = GPIO_INTR_EDGE_FALLING; break; case 4: - trig = INTR_TRIGGER_LEVEL; - pol = INTR_POLARITY_HIGH; + mode = GPIO_INTR_LEVEL_HIGH; break; case 8: - trig = INTR_TRIGGER_LEVEL; - pol = INTR_POLARITY_LOW; + mode = GPIO_INTR_LEVEL_LOW; break; default: - device_printf(sc->dev, "Unsupported trigger/polarity 0x%2x\n", + device_printf(sc->dev, "Unsupported interrupt mode 0x%2x\n", tripol); return (ENOTSUP); } *irqp = irq; - if (polp != NULL) - *polp = pol; - if (trigp != NULL) - *trigp = trig; + if (modep != NULL) + *modep = mode; return (0); } @@ -232,8 +224,7 @@ gpio_pic_map_intr(device_t dev, struct i return (ENOTSUP); daf = (struct intr_map_data_fdt *)data; - error = gpio_pic_map_fdt(dev, daf->ncells, daf->cells, &irq, NULL, - NULL); + error = gpio_pic_map_fdt(dev, daf->ncells, daf->cells, &irq, NULL); if (error == 0) { sc = device_get_softc(dev); *isrcp = &sc->gpio_pic_irqsrc[irq].gi_isrc; @@ -251,8 +242,7 @@ gpio_pic_teardown_intr(device_t dev, str sc = device_get_softc(dev); if (isrc->isrc_handlers == 0) { gi = (struct gpio_irqsrc *)isrc; - gi->gi_pol = INTR_POLARITY_CONFORM; - gi->gi_trig = INTR_TRIGGER_CONFORM; + gi->gi_mode = GPIO_INTR_CONFORM; // XXX Not sure this is necessary mtx_lock_spin(&sc->sc_mtx); @@ -272,8 +262,7 @@ gpio_pic_setup_intr(device_t dev, struct struct gpio_irqsrc *gi; int error, icfg; u_int irq, reg, shift, wrk; - enum intr_trigger trig; - enum intr_polarity pol; + uint32_t mode; sc = device_get_softc(dev); gi = (struct gpio_irqsrc *)isrc; @@ -282,34 +271,30 @@ gpio_pic_setup_intr(device_t dev, struct if (data == NULL || data->type != INTR_MAP_DATA_FDT) return (ENOTSUP); daf = (struct intr_map_data_fdt *)data; - error = gpio_pic_map_fdt(dev, daf->ncells, daf->cells, &irq, &pol, - &trig); + error = gpio_pic_map_fdt(dev, daf->ncells, daf->cells, &irq, &mode); if (error != 0) return (error); if (gi->gi_irq != irq) return (EINVAL); /* Compare config if this is not first setup. */ - if (isrc->isrc_handlers != 0) { - if (pol != gi->gi_pol || trig != gi->gi_trig) - return (EINVAL); - else - return (0); - } + if (isrc->isrc_handlers != 0) + return (gi->gi_mode == mode ? 0 : EINVAL); - gi->gi_pol = pol; - gi->gi_trig = trig; - - if (trig == INTR_TRIGGER_LEVEL) { - if (pol == INTR_POLARITY_LOW) - icfg = GPIO_ICR_COND_LOW; - else - icfg = GPIO_ICR_COND_HIGH; - } else { - if (pol == INTR_POLARITY_HIGH) - icfg = GPIO_ICR_COND_FALL; - else - icfg = GPIO_ICR_COND_RISE; + gi->gi_mode = mode; + switch (mode) { + case GPIO_INTR_LEVEL_LOW: + icfg = GPIO_ICR_COND_LOW; + break; + case GPIO_INTR_LEVEL_HIGH: + icfg = GPIO_ICR_COND_HIGH; + break; + case GPIO_INTR_EDGE_RISING: + icfg = GPIO_ICR_COND_RISE; + break; + case GPIO_INTR_EDGE_FALLING: + icfg = GPIO_ICR_COND_FALL; + break; } if (irq < 16) { @@ -433,8 +418,7 @@ gpio_pic_register_isrcs(struct imx51_gpi name = device_get_nameunit(sc->dev); for (irq = 0; irq < NGPIO; irq++) { sc->gpio_pic_irqsrc[irq].gi_irq = irq; - sc->gpio_pic_irqsrc[irq].gi_pol = INTR_POLARITY_CONFORM; - sc->gpio_pic_irqsrc[irq].gi_trig = INTR_TRIGGER_CONFORM; + sc->gpio_pic_irqsrc[irq].gi_mode = GPIO_INTR_CONFORM; error = intr_isrc_register(&sc->gpio_pic_irqsrc[irq].gi_isrc, sc->dev, 0, "%s,%u", name, irq); From owner-svn-src-head@freebsd.org Mon May 23 18:16:22 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBAA7B47BFA; Mon, 23 May 2016 18:16:22 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F3571CB3; Mon, 23 May 2016 18:16:22 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NIGLJd026262; Mon, 23 May 2016 18:16:21 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NIGLwO026261; Mon, 23 May 2016 18:16:21 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201605231816.u4NIGLwO026261@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus <skra@FreeBSD.org> Date: Mon, 23 May 2016 18:16:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300529 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 18:16:22 -0000 Author: skra Date: Mon May 23 18:16:21 2016 New Revision: 300529 URL: https://svnweb.freebsd.org/changeset/base/300529 Log: INTRNG - support new interrupt mapping type INTR_MAP_DATA_GPIO introduced in r298738. Reviewed by: ian Modified: head/sys/arm/freescale/imx/imx_gpio.c Modified: head/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- head/sys/arm/freescale/imx/imx_gpio.c Mon May 23 18:12:52 2016 (r300528) +++ head/sys/arm/freescale/imx/imx_gpio.c Mon May 23 18:16:21 2016 (r300529) @@ -88,7 +88,14 @@ __FBSDID("$FreeBSD$"); #define IMX_GPIO_ISR_REG 0x018 /* Interrupt Status Register */ #define IMX_GPIO_EDGE_REG 0x01C /* Edge Detect Register */ +#ifdef INTRNG +#define DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ + GPIO_INTR_LEVEL_LOW | GPIO_INTR_LEVEL_HIGH | GPIO_INTR_EDGE_RISING | \ + GPIO_INTR_EDGE_FALLING ) +#else #define DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT) +#endif + #define NGPIO 32 #ifdef INTRNG @@ -156,15 +163,12 @@ static int imx51_gpio_pin_toggle(device_ #ifdef INTRNG static int -gpio_pic_map_fdt(device_t dev, u_int ncells, pcell_t *cells, u_int *irqp, - uint32_t *modep) +gpio_pic_map_fdt(struct imx51_gpio_softc *sc, struct intr_map_data_fdt *daf, + u_int *irqp, uint32_t *modep) { - struct imx51_gpio_softc *sc; - u_int irq, tripol; + u_int irq; uint32_t mode; - sc = device_get_softc(dev); - /* * From devicetree/bindings/gpio/fsl-imx-gpio.txt: * #interrupt-cells: 2. The first cell is the GPIO number. The second @@ -176,18 +180,17 @@ gpio_pic_map_fdt(device_t dev, u_int nce * We can do any single one of these modes, but nothing in combo. */ - if (ncells != 2) { + if (daf->ncells != 2) { device_printf(sc->dev, "Invalid #interrupt-cells\n"); return (EINVAL); } - irq = cells[0]; - tripol = cells[1]; + irq = daf->cells[0]; if (irq >= sc->gpio_npins) { device_printf(sc->dev, "Invalid interrupt number %u\n", irq); return (EINVAL); } - switch (tripol) { + switch (daf->cells[1]) { case 1: mode = GPIO_INTR_EDGE_RISING; break; @@ -202,7 +205,7 @@ gpio_pic_map_fdt(device_t dev, u_int nce break; default: device_printf(sc->dev, "Unsupported interrupt mode 0x%2x\n", - tripol); + daf->cells[1]); return (ENOTSUP); } *irqp = irq; @@ -212,23 +215,61 @@ gpio_pic_map_fdt(device_t dev, u_int nce } static int +gpio_pic_map_gpio(struct imx51_gpio_softc *sc, struct intr_map_data_gpio *dag, + u_int *irqp, uint32_t *modep) +{ + u_int irq; + uint32_t mode; + + irq = dag->gpio_pin_num; + if (irq >= sc->gpio_npins) { + device_printf(sc->dev, "Invalid interrupt number %u\n", irq); + return (EINVAL); + } + + mode = dag->gpio_intr_mode; + if (mode != GPIO_INTR_LEVEL_LOW && mode != GPIO_INTR_LEVEL_HIGH && + mode != GPIO_INTR_EDGE_RISING && mode != GPIO_INTR_EDGE_FALLING) { + device_printf(sc->dev, "Unsupported interrupt mode 0x%8x\n", + mode); + return (EINVAL); + } + + *irqp = irq; + if (modep != NULL) + *modep = mode; + return (0); +} + +static int +gpio_pic_map(struct imx51_gpio_softc *sc, struct intr_map_data *data, + u_int *irqp, uint32_t *modep) +{ + + switch (data->type) { + case INTR_MAP_DATA_FDT: + return (gpio_pic_map_fdt(sc, (struct intr_map_data_fdt *)data, + irqp, modep)); + case INTR_MAP_DATA_GPIO: + return (gpio_pic_map_gpio(sc, (struct intr_map_data_gpio *)data, + irqp, modep)); + default: + return (ENOTSUP); + } +} + +static int gpio_pic_map_intr(device_t dev, struct intr_map_data *data, struct intr_irqsrc **isrcp) { int error; u_int irq; - struct intr_map_data_fdt *daf; struct imx51_gpio_softc *sc; - if (data->type != INTR_MAP_DATA_FDT) - return (ENOTSUP); - - daf = (struct intr_map_data_fdt *)data; - error = gpio_pic_map_fdt(dev, daf->ncells, daf->cells, &irq, NULL); - if (error == 0) { - sc = device_get_softc(dev); + sc = device_get_softc(dev); + error = gpio_pic_map(sc, data, &irq, NULL); + if (error == 0) *isrcp = &sc->gpio_pic_irqsrc[irq].gi_isrc; - } return (error); } @@ -257,21 +298,20 @@ static int gpio_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc, struct resource *res, struct intr_map_data *data) { - struct intr_map_data_fdt *daf; struct imx51_gpio_softc *sc; struct gpio_irqsrc *gi; int error, icfg; u_int irq, reg, shift, wrk; uint32_t mode; + if (data == NULL) + return (ENOTSUP); + sc = device_get_softc(dev); gi = (struct gpio_irqsrc *)isrc; /* Get config for interrupt. */ - if (data == NULL || data->type != INTR_MAP_DATA_FDT) - return (ENOTSUP); - daf = (struct intr_map_data_fdt *)data; - error = gpio_pic_map_fdt(dev, daf->ncells, daf->cells, &irq, &mode); + error = gpio_pic_map(sc, data, &irq, &mode); if (error != 0) return (error); if (gi->gi_irq != irq) From owner-svn-src-head@freebsd.org Mon May 23 18:43:31 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89836B4727C; Mon, 23 May 2016 18:43:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B14B1DB7; Mon, 23 May 2016 18:43:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 493A8B95B; Mon, 23 May 2016 14:43:30 -0400 (EDT) From: John Baldwin <jhb@freebsd.org> To: Andriy Gapon <avg@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300372 - in head/sys: kern sys Date: Mon, 23 May 2016 11:43:27 -0700 Message-ID: <8562415.t0UfIz1aLk@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201605211451.u4LEpopu074806@repo.freebsd.org> References: <201605211451.u4LEpopu074806@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 23 May 2016 14:43:30 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 18:43:31 -0000 On Saturday, May 21, 2016 02:51:50 PM Andriy Gapon wrote: > Author: avg > Date: Sat May 21 14:51:49 2016 > New Revision: 300372 > URL: https://svnweb.freebsd.org/changeset/base/300372 > > Log: > fix loss of taskqueue wakeups (introduced in r300113) > > Submitted by: kmacy > Tested by: dchagin > > Modified: head/sys/sys/taskqueue.h > ============================================================================== > --- head/sys/sys/taskqueue.h Sat May 21 11:40:41 2016 (r300371) > +++ head/sys/sys/taskqueue.h Sat May 21 14:51:49 2016 (r300372) > @@ -114,7 +113,6 @@ void taskqueue_thread_enqueue(void *cont > */ > #define TASK_INIT(task, priority, func, context) do { \ > (task)->ta_pending = 0; \ > - (task)->ta_flags = 0; \ > (task)->ta_priority = (priority); \ > (task)->ta_func = (func); \ > (task)->ta_context = (context); \ > @@ -224,7 +222,6 @@ int taskqgroup_adjust(struct taskqgroup > > #define GTASK_INIT(task, priority, func, context) do { \ > (task)->ta_pending = 0; \ > - (task)->ta_flags = TASK_SKIP_WAKEUP; \ > (task)->ta_priority = (priority); \ > (task)->ta_func = (func); \ > (task)->ta_context = (context); \ Do we still need GTASK_INIT() now or can relevant tasks now use TASK_INIT instead and GTASK_INIT be retired? -- John Baldwin From owner-svn-src-head@freebsd.org Mon May 23 19:03:49 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5134B4763A; Mon, 23 May 2016 19:03:49 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ig0-f171.google.com (mail-ig0-f171.google.com [209.85.213.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A8E33188F; Mon, 23 May 2016 19:03:49 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ig0-f171.google.com with SMTP id c3so5821821igl.0; Mon, 23 May 2016 12:03:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :date:message-id:subject:from:to:cc; bh=vyCqyFRbs/7p1PjvMd31H5vrSYoiYzvVx1ohLJ7VR2E=; b=A5gZJhFQ6aZm/qq0eN3YG9JheFb0kSdzN7y/TAFnoKT4JD05tfGLWN46TaNtT0DTiG HmvtgA24UOTeFcncneQD5c3dur/Mye9uF+6zPOWt3zUvPSrVLP6p4yD5TyH70rFyTSiN A/SX1SPTDw9BQoubTJG6Qj958+XWlKTyZG2WXeThiO8f3OxGgqfP+5sA7PsX+BjxEpKV J2PDKcpF3Vxj5JyRuvlVdlKOWB3Z7lQUJyDRoUO0PeODWx6kDRW0xyKWUQ06qCG7LTuM Oyyj8Xi8+tWUB+FM4aWgZubMp7ko3badCodNuCijZ6jnMc3sPS4teW/9vKizGhdqbhFJ Cpzg== X-Gm-Message-State: AOPr4FV+J6H8sKSJAox1m/4oMBudFtTVc6iV8ND2hSxAI5W0g1wYWo/hKTlxR3pPNt5QeA== X-Received: by 10.50.17.197 with SMTP id q5mr13925989igd.57.1464030222983; Mon, 23 May 2016 12:03:42 -0700 (PDT) Received: from mail-ig0-f173.google.com (mail-ig0-f173.google.com. [209.85.213.173]) by smtp.gmail.com with ESMTPSA id o206sm4182546itg.9.2016.05.23.12.03.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 May 2016 12:03:42 -0700 (PDT) Received: by mail-ig0-f173.google.com with SMTP id fh2so28090479igd.1; Mon, 23 May 2016 12:03:42 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.50.244.180 with SMTP id xh20mr13559857igc.48.1464030222353; Mon, 23 May 2016 12:03:42 -0700 (PDT) Reply-To: cem@FreeBSD.org Received: by 10.36.205.70 with HTTP; Mon, 23 May 2016 12:03:42 -0700 (PDT) In-Reply-To: <201605231203.u4NC3eHI010991@repo.freebsd.org> References: <201605231203.u4NC3eHI010991@repo.freebsd.org> Date: Mon, 23 May 2016 12:03:42 -0700 X-Gmail-Original-Message-ID: <CAG6CVpVpmx1XgG72=3ux1PQzf6Ka5GdaFbt8e9F0vhnjULJaig@mail.gmail.com> Message-ID: <CAG6CVpVpmx1XgG72=3ux1PQzf6Ka5GdaFbt8e9F0vhnjULJaig@mail.gmail.com> Subject: Re: svn commit: r300496 - in head/sys/compat/linuxkpi/common: include/linux src From: Conrad Meyer <cem@FreeBSD.org> To: Hans Petter Selasky <hselasky@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 19:03:50 -0000 Didn't we already have list_sort in linuxkpi? Maybe I'm confused. On Mon, May 23, 2016 at 5:03 AM, Hans Petter Selasky <hselasky@freebsd.org> wrote: > Author: hselasky > Date: Mon May 23 12:03:40 2016 > New Revision: 300496 > URL: https://svnweb.freebsd.org/changeset/base/300496 > > Log: > Add more list_xxx() functions to the LinuxKPI. > > Obtained from: kmacy @ > MFC after: 1 week > Sponsored by: Mellanox Technologies > > Modified: > head/sys/compat/linuxkpi/common/include/linux/list.h > head/sys/compat/linuxkpi/common/src/linux_compat.c > > Modified: head/sys/compat/linuxkpi/common/include/linux/list.h > ============================================================================== > --- head/sys/compat/linuxkpi/common/include/linux/list.h Mon May 23 11:57:23 2016 (r300495) > +++ head/sys/compat/linuxkpi/common/include/linux/list.h Mon May 23 12:03:40 2016 (r300496) > @@ -109,6 +109,13 @@ list_replace(struct list_head *old, stru > } > > static inline void > +list_replace_init(struct list_head *old, struct list_head *new) > +{ > + list_replace(old, new); > + INIT_LIST_HEAD(old); > +} > + > +static inline void > linux_list_add(struct list_head *new, struct list_head *prev, > struct list_head *next) > { > @@ -132,9 +139,18 @@ list_del_init(struct list_head *entry) > #define list_first_entry(ptr, type, member) \ > list_entry((ptr)->next, type, member) > > +#define list_last_entry(ptr, type, member) \ > + list_entry((ptr)->prev, type, member) > + > +#define list_first_entry_or_null(ptr, type, member) \ > + (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL) > + > #define list_next_entry(ptr, member) \ > list_entry(((ptr)->member.next), typeof(*(ptr)), member) > > +#define list_prev_entry(ptr, member) \ > + list_entry(((ptr)->member.prev), typeof(*(ptr)), member) > + > #define list_for_each(p, head) \ > for (p = (head)->next; p != (head); p = (p)->next) > > @@ -436,4 +452,7 @@ static inline int list_is_last(const str > (pos) && ({ n = (pos)->member.next; 1; }); \ > pos = hlist_entry_safe(n, typeof(*(pos)), member)) > > +extern void list_sort(void *priv, struct list_head *head, int (*cmp)(void *priv, > + struct list_head *a, struct list_head *b)); > + > #endif /* _LINUX_LIST_H_ */ > > Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c > ============================================================================== > --- head/sys/compat/linuxkpi/common/src/linux_compat.c Mon May 23 11:57:23 2016 (r300495) > +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Mon May 23 12:03:40 2016 (r300496) > @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); > #include <linux/interrupt.h> > #include <linux/uaccess.h> > #include <linux/kernel.h> > +#include <linux/list.h> > > #include <vm/vm_pager.h> > > @@ -1358,6 +1359,47 @@ unregister_inetaddr_notifier(struct noti > return (0); > } > > +struct list_sort_thunk { > + int (*cmp)(void *, struct list_head *, struct list_head *); > + void *priv; > +}; > + > +static inline int > +linux_le_cmp(void *priv, const void *d1, const void *d2) > +{ > + struct list_head *le1, *le2; > + struct list_sort_thunk *thunk; > + > + thunk = priv; > + le1 = *(__DECONST(struct list_head **, d1)); > + le2 = *(__DECONST(struct list_head **, d2)); > + return ((thunk->cmp)(thunk->priv, le1, le2)); > +} > + > +void > +list_sort(void *priv, struct list_head *head, int (*cmp)(void *priv, > + struct list_head *a, struct list_head *b)) > +{ > + struct list_sort_thunk thunk; > + struct list_head **ar, *le; > + size_t count, i; > + > + count = 0; > + list_for_each(le, head) > + count++; > + ar = malloc(sizeof(struct list_head *) * count, M_KMALLOC, M_WAITOK); > + i = 0; > + list_for_each(le, head) > + ar[i++] = le; > + thunk.cmp = cmp; > + thunk.priv = priv; > + qsort_r(ar, count, sizeof(struct list_head *), &thunk, linux_le_cmp); > + INIT_LIST_HEAD(head); > + for (i = 0; i < count; i++) > + list_add_tail(ar[i], head); > + free(ar, M_KMALLOC); > +} > + > void > linux_irq_handler(void *ent) > { > From owner-svn-src-head@freebsd.org Mon May 23 19:32:26 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96E0DB46019; Mon, 23 May 2016 19:32:26 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp004.me.com (mr11p00im-asmtp004.me.com [17.110.69.135]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 788BE18DE; Mon, 23 May 2016 19:32:26 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.mr11p00im-asmtp004.me.com by mr11p00im-asmtp004.me.com (Oracle Communications Messaging Server 7.0.5.36.0 64bit (built Sep 8 2015)) id <0O7N00500A3MDS00@mr11p00im-asmtp004.me.com>; Mon, 23 May 2016 19:32:20 +0000 (GMT) Received: from [172.17.133.77] (dip-cali.panasas.com [64.80.217.3]) by mr11p00im-asmtp004.me.com (Oracle Communications Messaging Server 7.0.5.36.0 64bit (built Sep 8 2015)) with ESMTPSA id <0O7N002DPA9UT630@mr11p00im-asmtp004.me.com>; Mon, 23 May 2016 19:32:19 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-05-23_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510270003 definitions=main-1605230231 User-Agent: Microsoft-MacOutlook/f.16.0.160506 Date: Mon, 23 May 2016 12:32:31 -0700 Subject: Re: svn commit: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac From: Ravi Pokala <rpokala@mac.com> Sender: "Pokala, Ravi" <rpokala@panasas.com> To: Warner Losh <imp@bsdimp.com>, Justin Hibbits <chmeeedalf@gmail.com> Cc: src-committers <src-committers@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, Luiz Otavio O Souza <loos@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org> Message-id: <F5C36C53-1125-4109-9296-513C4E66660A@panasas.com> Thread-topic: svn commit: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac References: <201605221358.u4MDwW8u097510@repo.freebsd.org> <C66E915D-A4D7-4591-AF6C-0949AF184271@panasas.com> <CAHSQbTAVt6QgVNz0M_yCVpTwSc=-YFU5O0uhaqKC6XOPOmJCkQ@mail.gmail.com> <CANCZdfpsEpgb_B2mbiZqFGuwOb-rcDxf5KJLaEcavw7mD+Hj0g@mail.gmail.com> In-reply-to: <CANCZdfpsEpgb_B2mbiZqFGuwOb-rcDxf5KJLaEcavw7mD+Hj0g@mail.gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=4d515a; t=1464031940; bh=T1jlCeEx0Mge6HqjjJgxHiXbNfXsM0Z1gGlkn6xzdHo=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=TYHkD7MRfvsI7VM52bb+TW8+4+ljuGnHFkFzr5UGBCt83gr3tRwsjcfYVxRWdVfse /ULkNLXotpehKmy+aAQ4r6BERejwb2uW1YVpWLT9pNqTQ7ArCMM24EWNyvsYUqDfnO HWJ0Vw1miEEEgYpifDvB410PoA1AvG+B0eZYlYzUyd/1UXT2eHiPJxnL6GqfXevEhM nXd3GEsatde623g7isVTa4YmPzocbLwPisF2fgJy4uKGBHqmO4/qtWMxo6KxU5T+SY PmAf6bBlm0uS7LtlqFH6Qt++vFl8A0IzzrL1Q15ASUhWn3H1zVQmpoZmv5Aj8yd9Va x6N3Sd7IC1xpg== X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 19:32:26 -0000 -----Original Message----- From: <owner-src-committers@freebsd.org> on behalf of Warner Losh <imp@bsdimp.com> Date: 2016-05-23, Monday at 10:37 To: Justin Hibbits <chmeeedalf@gmail.com> Cc: Ravi Pokala <rpokala@mac.com>, src-committers <src-committers@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, Luiz Otavio O Souza <loos@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org> Subject: Re: svn commit: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac >On Sun, May 22, 2016 at 1:12 PM, Justin Hibbits <chmeeedalf@gmail.com> wrote: >> >> On May 22, 2016 13:51, "Ravi Pokala" <rpokala@mac.com> wrote: >>> >>> Out of morbid curiosity, why do these things report in deciKelvin anyway? >>> Are there sensors we support out there which report native Kelvin, or that >>> report sub-degree precision? >>> >>> Thanks, >>> >>> Ravi (rpokala@) >>> >> >> There are many i2c sensors which report in sub-degree centigrade. Though >> some of them are in 1/8 (or other power of 2) degree precision, not 1/10. > >ACPI reports in decikelvin, and it was the first thing we supported. Some 1 wire >devices support 1/16th a degree, and we support it in millikelvin since 1/16th >is 0.0625. So the precision needed is actually greater than what we're >reporting. >However, the accuracy of the measurement isn't +/- 0.001, it's closer >to +/1 0.063 >or so (well, that's a relative accuracy, absolute accuracy is closer >to +/- 1 degree). >We report the higher level of precision so that applications that use >the relative >temperature can use it to inform a control loop. We have no good way to report >relative precision for a measurement, or the absolute accuracy. > >Warner Good to know. Thanks guys. -Ravi From owner-svn-src-head@freebsd.org Mon May 23 19:46:59 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81ECEB4653A; Mon, 23 May 2016 19:46:59 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3ABE9105A; Mon, 23 May 2016 19:46:59 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NJkw7j060460; Mon, 23 May 2016 19:46:58 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NJkw0v060459; Mon, 23 May 2016 19:46:58 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201605231946.u4NJkw0v060459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" <cem@FreeBSD.org> Date: Mon, 23 May 2016 19:46:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300531 - head/sys/dev/ntb/ntb_hw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 19:46:59 -0000 Author: cem Date: Mon May 23 19:46:58 2016 New Revision: 300531 URL: https://svnweb.freebsd.org/changeset/base/300531 Log: ntb_hw(4): Only record the first three MSIX vectors Don't overrun the msix_data array by reading the (unused) link state interrupt information. Reported by: mav (earlier version) Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D6489 Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw.c Mon May 23 18:20:15 2016 (r300530) +++ head/sys/dev/ntb/ntb_hw/ntb_hw.c Mon May 23 19:46:58 2016 (r300531) @@ -333,7 +333,7 @@ static inline void db_iowrite(struct ntb static inline void db_iowrite_raw(struct ntb_softc *, uint64_t regoff, uint64_t); static int ntb_create_msix_vec(struct ntb_softc *ntb, uint32_t num_vectors); static void ntb_free_msix_vec(struct ntb_softc *ntb); -static void ntb_get_msix_info(struct ntb_softc *ntb, uint32_t num_vectors); +static void ntb_get_msix_info(struct ntb_softc *ntb); static void ntb_exchange_msix(void *); static struct ntb_hw_info *ntb_get_device_info(uint32_t device_id); static void ntb_detect_max_mw(struct ntb_softc *ntb); @@ -1067,10 +1067,18 @@ ntb_init_isr(struct ntb_softc *ntb) ntb->db_vec_shift = XEON_DB_TOTAL_SHIFT; rc = ntb_setup_legacy_interrupt(ntb); } else { + if (num_vectors - 1 != XEON_NONLINK_DB_MSIX_BITS && + HAS_FEATURE(NTB_SB01BASE_LOCKUP)) { + device_printf(ntb->device, + "Errata workaround expects %d doorbell bits\n", + XEON_NONLINK_DB_MSIX_BITS); + return (EINVAL); + } + ntb_create_msix_vec(ntb, num_vectors); rc = ntb_setup_msix(ntb, num_vectors); if (rc == 0 && HAS_FEATURE(NTB_SB01BASE_LOCKUP)) - ntb_get_msix_info(ntb, num_vectors); + ntb_get_msix_info(ntb); } if (rc != 0) { device_printf(ntb->device, @@ -1335,7 +1343,7 @@ ntb_free_msix_vec(struct ntb_softc *ntb) } static void -ntb_get_msix_info(struct ntb_softc *ntb, uint32_t num_vectors) +ntb_get_msix_info(struct ntb_softc *ntb) { struct pci_devinfo *dinfo; struct pcicfg_msix *msix; @@ -1346,7 +1354,9 @@ ntb_get_msix_info(struct ntb_softc *ntb, laddr = data = 0; - for (i = 0; i < num_vectors; i++) { + CTASSERT(XEON_NONLINK_DB_MSIX_BITS == nitems(ntb->msix_data)); + + for (i = 0; i < XEON_NONLINK_DB_MSIX_BITS; i++) { offset = msix->msix_table_offset + i * PCI_MSIX_ENTRY_SIZE; laddr = bus_read_4(msix->msix_table_res, offset + From owner-svn-src-head@freebsd.org Mon May 23 19:52:09 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFC2EB466D1; Mon, 23 May 2016 19:52:09 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81A1D14D2; Mon, 23 May 2016 19:52:09 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NJq8jB062659; Mon, 23 May 2016 19:52:08 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NJq8YH062658; Mon, 23 May 2016 19:52:08 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201605231952.u4NJq8YH062658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" <ken@FreeBSD.org> Date: Mon, 23 May 2016 19:52:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300532 - head/sys/cam/ata X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 19:52:09 -0000 Author: ken Date: Mon May 23 19:52:08 2016 New Revision: 300532 URL: https://svnweb.freebsd.org/changeset/base/300532 Log: Fix ada(4) trim support quirk setting. I broke broke the quirk in the ada(4) driver disabling NCQ trim support in revision 300207. The support flags were set before the quirks were loaded. sys/cam/ata/ata_da.c: Call adasetflags() after loading quirks, so that we'll set the flags accurately. Sponsored by: Spectra Logic Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Mon May 23 19:46:58 2016 (r300531) +++ head/sys/cam/ata/ata_da.c Mon May 23 19:52:08 2016 (r300532) @@ -1639,11 +1639,6 @@ adaregister(struct cam_periph *periph, v return(CAM_REQ_CMP_ERR); } - /* - * Set support flags based on the Identify data. - */ - adasetflags(softc, cgd); - periph->softc = softc; /* @@ -1683,6 +1678,12 @@ adaregister(struct cam_periph *periph, v snprintf(announce_buf, sizeof(announce_buf), "kern.cam.ada.%d.write_cache", periph->unit_number); TUNABLE_INT_FETCH(announce_buf, &softc->write_cache); + + /* + * Set support flags based on the Identify data and quirks. + */ + adasetflags(softc, cgd); + /* Disable queue sorting for non-rotational media by default. */ if (cgd->ident_data.media_rotation_rate == ATA_RATE_NON_ROTATING) { softc->rotating = 0; From owner-svn-src-head@freebsd.org Mon May 23 20:06:31 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C99B0B468CC; Mon, 23 May 2016 20:06:31 +0000 (UTC) (envelope-from andriyvos@gmail.com) Received: from mail-lb0-f195.google.com (mail-lb0-f195.google.com [209.85.217.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5DC0F1C0A; Mon, 23 May 2016 20:06:31 +0000 (UTC) (envelope-from andriyvos@gmail.com) Received: by mail-lb0-f195.google.com with SMTP id sh2so1621602lbb.2; Mon, 23 May 2016 13:06:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=oEd4QYafbz9z3Xl+1dLHnAPuIU/dbYTVhxxMT5oSAmw=; b=de02PmPjSMjC6O0jX5+ZfBnxmWaONzdetSgcQx1GT3tL3E4kFEPciO+2hD/M9qunS9 gFxiM3ZtDtsOVLLhKPqHRJMAb3BlENPL1Q3qms1FdrkNO5oHMyQLC57eY6GhrJ9tuyz2 JmFHn6CZKHQzQsN8pr1tFd29o329Cd5pMFRwtns2+pMlW37u9F1ryyd7HvRzba+5A6pv vCaORYwM2V+y+UPQP0RfkON4B9BLS/1oNpViFETbzWmaH2Po09Hoy1Xwk65uU4OIXA29 V0ixfcAFXtGa9I+CC+W3NI/8BKIXKLMSfz32KhhfAmmXl/4U4iUnvyrIQBrC/JRaGhtV W34w== X-Gm-Message-State: ALyK8tL5C2aUkWixsgRMWO8wb4BEoaOYGdZbQ2SCV0LaWWsCk5XRgZZLfElY6dTvSEaOgw== X-Received: by 10.112.170.161 with SMTP id an1mr2071787lbc.44.1464033982907; Mon, 23 May 2016 13:06:22 -0700 (PDT) Received: from localhost (host-176-37-109-22.la.net.ua. [176.37.109.22]) by smtp.gmail.com with ESMTPSA id r3sm6017528lbj.26.2016.05.23.13.06.21 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 23 May 2016 13:06:22 -0700 (PDT) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Allan Jude" <allanjude@freebsd.org> Subject: Re: svn commit: r298946 - head/usr.sbin/bsdinstall/scripts References: <201605022140.u42LeYFK051507@repo.freebsd.org> <186c070f-eb81-370d-b215-1d9f370918b8@freebsd.org> <e01538e8-0b18-754a-5949-47a85533ecab@freebsd.org> Date: Mon, 23 May 2016 23:06:16 +0300 MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable From: "Andriy Voskoboinyk" <avos@freebsd.org> Message-ID: <op.yhxl4qde4dikkl@localhost> In-Reply-To: <e01538e8-0b18-754a-5949-47a85533ecab@freebsd.org> User-Agent: Opera Mail/12.16 (FreeBSD) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 20:06:31 -0000 Mon, 23 May 2016 08:00:27 +0300 =D0=B1=D1=83=D0=BB=D0=BE =D0=BD=D0=B0=D0= =BF=D0=B8=D1=81=D0=B0=D0=BD=D0=BE Allan Jude = <allanjude@freebsd.org>: > On 2016-05-23 00:49, Allan Jude wrote: >> On 2016-05-02 17:40, Andriy Voskoboinyk wrote: >>> Author: avos >>> Date: Mon May 2 21:40:34 2016 >>> New Revision: 298946 >>> URL: https://svnweb.freebsd.org/changeset/base/298946 >>> >>> Log: >>> bsdinstall: fix static address assignment for protected wireless = >>> networks. >>> >>> Filter out IFCONFIG_PREFIX variable (which may contain WPA keyword= ) >>> from ifconfig parameters. >>> >>> PR: 169199 >>> >>> Modified: >>> head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 >>> >>> Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D >>> --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Mon May 2 = >>> 21:23:05 2016 (r298945) >>> +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Mon May 2 = >>> 21:40:34 2016 (r298946) >>> @@ -84,7 +84,7 @@ retval=3D$? >>> >>> if [ "$BSDINSTALL_CONFIGCURRENT" ]; then >>> . $BSDINSTALL_TMPETC/._rc.conf.net >>> - ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE` >>> + ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE | sed = >>> "s|$2||"` >>> if [ "$defaultrouter" ]; then >>> route delete -inet default >>> route add -inet default $defaultrouter >>> >> >> This breaks static assignment of IP addresses to wired interfaces: >> >> sed: first RE may not be empty >> >> > > I wrote this patch for the issue. Unless you see a better way to do it= ? > > No, I have no better ideas. From owner-svn-src-head@freebsd.org Mon May 23 20:07:19 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 860E3B4692D; Mon, 23 May 2016 20:07:19 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5CDC31D7A; Mon, 23 May 2016 20:07:19 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NK7IQS066431; Mon, 23 May 2016 20:07:18 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NK7HO7066421; Mon, 23 May 2016 20:07:17 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201605232007.u4NK7HO7066421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore <ian@FreeBSD.org> Date: Mon, 23 May 2016 20:07:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300533 - in head/sys/arm: arm at91 cavium/cns11xx include mv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 20:07:19 -0000 Author: ian Date: Mon May 23 20:07:17 2016 New Revision: 300533 URL: https://svnweb.freebsd.org/changeset/base/300533 Log: Use the new(-ish) CP15_SCTLR macro to generate system control reg accesses where possible. In the places that doesn't work (multi-line inline asm, and places where the old armv4 cpufuncs mechanism is used), annotate the accesses with a comment that includes SCTLR. Now a grep -i sctlr can find all the system control register manipulations. No functional changes. Modified: head/sys/arm/arm/cpufunc.c head/sys/arm/arm/cpufunc_asm.S head/sys/arm/arm/cpufunc_asm_xscale.S head/sys/arm/arm/elf_trampoline.c head/sys/arm/arm/locore-v4.S head/sys/arm/arm/machdep.c head/sys/arm/at91/at91_machdep.c head/sys/arm/cavium/cns11xx/econa_machdep.c head/sys/arm/include/cpu-v4.h head/sys/arm/mv/mv_machdep.c Modified: head/sys/arm/arm/cpufunc.c ============================================================================== --- head/sys/arm/arm/cpufunc.c Mon May 23 19:52:08 2016 (r300532) +++ head/sys/arm/arm/cpufunc.c Mon May 23 20:07:17 2016 (r300533) @@ -886,7 +886,7 @@ arm9_setup(void) /* Clear out the cache */ cpu_idcache_wbinv_all(); - /* Set the control register */ + /* Set the control register (SCTLR) */ cpu_control(cpuctrlmask, cpuctrl); } Modified: head/sys/arm/arm/cpufunc_asm.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm.S Mon May 23 19:52:08 2016 (r300532) +++ head/sys/arm/arm/cpufunc_asm.S Mon May 23 20:07:17 2016 (r300533) @@ -68,7 +68,7 @@ ENTRY(cpu_ident) END(cpu_ident) ENTRY(cpu_get_control) - mrc p15, 0, r0, c1, c0, 0 + mrc CP15_SCTLR(r0) RET END(cpu_get_control) @@ -98,13 +98,6 @@ END(cpu_faultaddress) * All other registers are CPU architecture specific */ -#if 0 /* See below. */ -ENTRY(cpufunc_control) - mcr p15, 0, r0, c1, c0, 0 - RET -END(cpufunc_control) -#endif - ENTRY(cpu_domains) mcr p15, 0, r0, c3, c0, 0 RET @@ -121,13 +114,13 @@ END(cpu_domains) */ ENTRY(cpufunc_control) - mrc p15, 0, r3, c1, c0, 0 /* Read the control register */ + mrc CP15_SCTLR(r3) /* Read the control register */ bic r2, r3, r0 /* Clear bits */ eor r2, r2, r1 /* XOR bits */ teq r2, r3 /* Only write if there is a change */ - mcrne p15, 0, r2, c1, c0, 0 /* Write new control register */ + mcrne CP15_SCTLR(r2) /* Write new control register */ mov r0, r3 /* Return old value */ RET Modified: head/sys/arm/arm/cpufunc_asm_xscale.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_xscale.S Mon May 23 19:52:08 2016 (r300532) +++ head/sys/arm/arm/cpufunc_asm_xscale.S Mon May 23 20:07:17 2016 (r300533) @@ -111,13 +111,13 @@ END(xscale_cpwait) * changes in the control register. */ ENTRY(xscale_control) - mrc p15, 0, r3, c1, c0, 0 /* Read the control register */ + mrc CP15_SCTLR(r3) /* Read the control register */ bic r2, r3, r0 /* Clear bits */ eor r2, r2, r1 /* XOR bits */ teq r2, r3 /* Only write if there was a change */ mcrne p15, 0, r0, c7, c5, 6 /* Invalidate the BTB */ - mcrne p15, 0, r2, c1, c0, 0 /* Write new control register */ + mcrne CP15_SCTLR(r3) /* Write new control register */ mov r0, r3 /* Return old value */ CPWAIT_AND_RETURN(r1) Modified: head/sys/arm/arm/elf_trampoline.c ============================================================================== --- head/sys/arm/arm/elf_trampoline.c Mon May 23 19:52:08 2016 (r300532) +++ head/sys/arm/arm/elf_trampoline.c Mon May 23 20:07:17 2016 (r300533) @@ -227,14 +227,14 @@ _startC(void) "bic %0, %0, #0xff000000\n" "and %1, %1, #0xff000000\n" "orr %0, %0, %1\n" - "mrc p15, 0, %1, c1, c0, 0\n" + "mrc p15, 0, %1, c1, c0, 0\n" /* CP15_SCTLR(%1)*/ "bic %1, %1, #1\n" /* Disable MMU */ "orr %1, %1, #(4 | 8)\n" /* Add DC enable, WBUF enable */ "orr %1, %1, #0x1000\n" /* Add IC enable */ "orr %1, %1, #(0x800)\n" /* BPRD enable */ - "mcr p15, 0, %1, c1, c0, 0\n" + "mcr p15, 0, %1, c1, c0, 0\n" /* CP15_SCTLR(%1)*/ "nop\n" "nop\n" "nop\n" @@ -599,9 +599,9 @@ load_kernel(unsigned int kstart, unsigne __asm __volatile("mcr p15, 0, %0, c7, c5, 0\n" "mcr p15, 0, %0, c7, c10, 4\n" : : "r" (curaddr)); - __asm __volatile("mrc p15, 0, %0, c1, c0, 0\n" + __asm __volatile("mrc p15, 0, %0, c1, c0, 0\n" /* CP15_SCTLR(%0)*/ "bic %0, %0, #1\n" /* MMU_ENABLE */ - "mcr p15, 0, %0, c1, c0, 0\n" + "mcr p15, 0, %0, c1, c0, 0\n" /* CP15_SCTLR(%0)*/ : "=r" (ssym)); /* Jump to the entry point. */ ((void(*)(void))(entry_point - KERNVIRTADDR + curaddr))(); @@ -643,9 +643,9 @@ setup_pagetables(unsigned int pt_addr, v __asm __volatile("mcr p15, 0, %1, c2, c0, 0\n" /* set TTB */ "mcr p15, 0, %1, c8, c7, 0\n" /* Flush TTB */ "mcr p15, 0, %2, c3, c0, 0\n" /* Set DAR */ - "mrc p15, 0, %0, c1, c0, 0\n" + "mrc p15, 0, %0, c1, c0, 0\n" /* CP15_SCTLR(%0)*/ "orr %0, %0, #1\n" /* MMU_ENABLE */ - "mcr p15, 0, %0, c1, c0, 0\n" + "mcr p15, 0, %0, c1, c0, 0\n" /* CP15_SCTLR(%0)*/ "mrc p15, 0, %0, c2, c0, 0\n" /* CPWAIT */ "mov r0, r0\n" "sub pc, pc, #4\n" : @@ -700,9 +700,9 @@ __start(void) */ cpu_idcache_wbinv_all(); cpu_l2cache_wbinv_all(); - __asm __volatile("mrc p15, 0, %0, c1, c0, 0\n" + __asm __volatile("mrc p15, 0, %0, c1, c0, 0\n" /* CP15_SCTLR(%0)*/ "bic %0, %0, #1\n" /* MMU_DISABLE */ - "mcr p15, 0, %0, c1, c0, 0\n" + "mcr p15, 0, %0, c1, c0, 0\n" /* CP15_SCTLR(%0)*/ :"=r" (pt_addr)); } else #endif Modified: head/sys/arm/arm/locore-v4.S ============================================================================== --- head/sys/arm/arm/locore-v4.S Mon May 23 19:52:08 2016 (r300532) +++ head/sys/arm/arm/locore-v4.S Mon May 23 20:07:17 2016 (r300533) @@ -114,7 +114,7 @@ ASENTRY_NP(_start) * If we're running with MMU disabled, test against the * physical address instead. */ - mrc p15, 0, r2, c1, c0, 0 + mrc CP15_SCTLR(r2) ands r2, r2, #CPU_CONTROL_MMU_ENABLE ldreq r6, =PHYSADDR ldrne r6, =LOADERRAMADDR @@ -146,12 +146,12 @@ from_ram: disable_mmu: /* Disable MMU for a while */ - mrc p15, 0, r2, c1, c0, 0 + mrc CP15_SCTLR(r2) bic r2, r2, #(CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_DC_ENABLE |\ CPU_CONTROL_WBUF_ENABLE) bic r2, r2, #(CPU_CONTROL_IC_ENABLE) bic r2, r2, #(CPU_CONTROL_BPRD_ENABLE) - mcr p15, 0, r2, c1, c0, 0 + mcr CP15_SCTLR(r2) nop nop @@ -213,9 +213,9 @@ Lunmapped: /* * Enable MMU. */ - mrc p15, 0, r0, c1, c0, 0 + mrc CP15_SCTLR(r0) orr r0, r0, #(CPU_CONTROL_MMU_ENABLE) - mcr p15, 0, r0, c1, c0, 0 + mcr CP15_SCTLR(r0) nop nop nop @@ -398,7 +398,7 @@ ENTRY_NP(cpu_halt) * Hurl ourselves into the ROM */ mov r0, #(CPU_CONTROL_32BP_ENABLE | CPU_CONTROL_32BD_ENABLE) - mcr p15, 0, r0, c1, c0, 0 + mcr CP15_SCTLR(r0) mcrne p15, 0, r2, c8, c7, 0 /* nail I+D TLB on ARMv4 and greater */ mov pc, r4 Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Mon May 23 19:52:08 2016 (r300532) +++ head/sys/arm/arm/machdep.c Mon May 23 20:07:17 2016 (r300533) @@ -416,20 +416,15 @@ arm_vector_init(vm_offset_t va, int whic if (va == ARM_VECTORS_HIGH) { /* - * Assume the MD caller knows what it's doing here, and - * really does want the vector page relocated. + * Enable high vectors in the system control reg (SCTLR). + * + * Assume the MD caller knows what it's doing here, and really + * does want the vector page relocated. * * Note: This has to be done here (and not just in * cpu_setup()) because the vector page needs to be * accessible *before* cpu_startup() is called. * Think ddb(9) ... - * - * NOTE: If the CPU control register is not readable, - * this will totally fail! We'll just assume that - * any system that has high vector support has a - * readable CPU control register, for now. If we - * ever encounter one that does not, we'll have to - * rethink this. */ cpu_control(CPU_CONTROL_VECRELOC, CPU_CONTROL_VECRELOC); } Modified: head/sys/arm/at91/at91_machdep.c ============================================================================== --- head/sys/arm/at91/at91_machdep.c Mon May 23 19:52:08 2016 (r300532) +++ head/sys/arm/at91/at91_machdep.c Mon May 23 20:07:17 2016 (r300533) @@ -584,6 +584,10 @@ initarm(struct arm_boot_params *abp) memsize = 16 * 1024 * 1024; } + /* Enable MMU (set SCTLR), and do other cpu-specific setup. */ + cpu_control(CPU_CONTROL_MMU_ENABLE, CPU_CONTROL_MMU_ENABLE); + cpu_setup(); + /* * Pages were allocated during the secondary bootstrap for the * stacks for different CPU modes. @@ -592,9 +596,6 @@ initarm(struct arm_boot_params *abp) * Since the ARM stacks use STMFD etc. we must set r13 to the top end * of the stack memory. */ - cpu_control(CPU_CONTROL_MMU_ENABLE, CPU_CONTROL_MMU_ENABLE); - cpu_setup(); - set_stackptrs(0); /* Modified: head/sys/arm/cavium/cns11xx/econa_machdep.c ============================================================================== --- head/sys/arm/cavium/cns11xx/econa_machdep.c Mon May 23 19:52:08 2016 (r300532) +++ head/sys/arm/cavium/cns11xx/econa_machdep.c Mon May 23 20:07:17 2016 (r300533) @@ -272,6 +272,9 @@ initarm(struct arm_boot_params *abp) mem_info = ((*ddr) >> 4) & 0x3; memsize = (8<<mem_info)*1024*1024; + /* Enable MMU in system control register (SCTLR). */ + cpu_control(CPU_CONTROL_MMU_ENABLE, CPU_CONTROL_MMU_ENABLE); + /* * Pages were allocated during the secondary bootstrap for the * stacks for different CPU modes. @@ -280,8 +283,6 @@ initarm(struct arm_boot_params *abp) * Since the ARM stacks use STMFD etc. we must set r13 to the top end * of the stack memory. */ - cpu_control(CPU_CONTROL_MMU_ENABLE, CPU_CONTROL_MMU_ENABLE); - set_stackptrs(0); /* Modified: head/sys/arm/include/cpu-v4.h ============================================================================== --- head/sys/arm/include/cpu-v4.h Mon May 23 19:52:08 2016 (r300532) +++ head/sys/arm/include/cpu-v4.h Mon May 23 20:07:17 2016 (r300533) @@ -105,6 +105,7 @@ _RF0(cp15_midr_get, CP15_MIDR(%0)) _RF0(cp15_ctr_get, CP15_CTR(%0)) _RF0(cp15_tcmtr_get, CP15_TCMTR(%0)) _RF0(cp15_tlbtr_get, CP15_TLBTR(%0)) +_RF0(cp15_sctlr_get, CP15_SCTLR(%0)) #undef _FX #undef _RF0 Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Mon May 23 19:52:08 2016 (r300532) +++ head/sys/arm/mv/mv_machdep.c Mon May 23 20:07:17 2016 (r300533) @@ -50,11 +50,18 @@ __FBSDID("$FreeBSD$"); #include <vm/vm.h> #include <vm/pmap.h> +#include <machine/acle-compat.h> #include <machine/bus.h> #include <machine/fdt.h> #include <machine/machdep.h> #include <machine/platform.h> +#if __ARM_ARCH < 6 +#include <machine/cpu-v4.h> +#else +#include <machine/cpu-v6.h> +#endif + #include <arm/mv/mvreg.h> /* XXX */ #include <arm/mv/mvvar.h> /* XXX eventually this should be eliminated */ #include <arm/mv/mvwin.h> @@ -453,9 +460,9 @@ DB_SHOW_COMMAND(cp15, db_show_cp15) __asm __volatile("mrc p15, 0, %0, c0, c0, 1" : "=r" (reg)); db_printf("Current Cache Lvl ID: 0x%08x\n",reg); - __asm __volatile("mrc p15, 0, %0, c1, c0, 0" : "=r" (reg)); + reg = cp15_sctlr_get(); db_printf("Ctrl: 0x%08x\n",reg); - __asm __volatile("mrc p15, 0, %0, c1, c0, 1" : "=r" (reg)); + reg = cp15_actlr_get(); db_printf("Aux Ctrl: 0x%08x\n",reg); __asm __volatile("mrc p15, 0, %0, c0, c1, 0" : "=r" (reg)); From owner-svn-src-head@freebsd.org Mon May 23 20:12:39 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE6D8B46B98; Mon, 23 May 2016 20:12:39 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0CEB128A; Mon, 23 May 2016 20:12:39 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NKCcJ1069291; Mon, 23 May 2016 20:12:38 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NKCcS1069290; Mon, 23 May 2016 20:12:38 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201605232012.u4NKCcS1069290@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore <ian@FreeBSD.org> Date: Mon, 23 May 2016 20:12:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300534 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 20:12:39 -0000 Author: ian Date: Mon May 23 20:12:38 2016 New Revision: 300534 URL: https://svnweb.freebsd.org/changeset/base/300534 Log: Oops, fix a paste-o commited in r300533. Modified: head/sys/arm/arm/cpufunc_asm_xscale.S Modified: head/sys/arm/arm/cpufunc_asm_xscale.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_xscale.S Mon May 23 20:07:17 2016 (r300533) +++ head/sys/arm/arm/cpufunc_asm_xscale.S Mon May 23 20:12:38 2016 (r300534) @@ -117,7 +117,7 @@ ENTRY(xscale_control) teq r2, r3 /* Only write if there was a change */ mcrne p15, 0, r0, c7, c5, 6 /* Invalidate the BTB */ - mcrne CP15_SCTLR(r3) /* Write new control register */ + mcrne CP15_SCTLR(r2) /* Write new control register */ mov r0, r3 /* Return old value */ CPWAIT_AND_RETURN(r1) From owner-svn-src-head@freebsd.org Mon May 23 20:13:18 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93953B46C0E; Mon, 23 May 2016 20:13:18 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6398C1471; Mon, 23 May 2016 20:13:18 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NKDHDx069360; Mon, 23 May 2016 20:13:17 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NKDHif069359; Mon, 23 May 2016 20:13:17 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201605232013.u4NKDHif069359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore <ian@FreeBSD.org> Date: Mon, 23 May 2016 20:13:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300535 - head/sys/arm/cavium/cns11xx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 20:13:18 -0000 Author: ian Date: Mon May 23 20:13:17 2016 New Revision: 300535 URL: https://svnweb.freebsd.org/changeset/base/300535 Log: Spaces->tab in comment. Modified: head/sys/arm/cavium/cns11xx/econa_machdep.c Modified: head/sys/arm/cavium/cns11xx/econa_machdep.c ============================================================================== --- head/sys/arm/cavium/cns11xx/econa_machdep.c Mon May 23 20:12:38 2016 (r300534) +++ head/sys/arm/cavium/cns11xx/econa_machdep.c Mon May 23 20:13:17 2016 (r300535) @@ -272,7 +272,7 @@ initarm(struct arm_boot_params *abp) mem_info = ((*ddr) >> 4) & 0x3; memsize = (8<<mem_info)*1024*1024; - /* Enable MMU in system control register (SCTLR). */ + /* Enable MMU in system control register (SCTLR). */ cpu_control(CPU_CONTROL_MMU_ENABLE, CPU_CONTROL_MMU_ENABLE); /* From owner-svn-src-head@freebsd.org Mon May 23 20:15:09 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54CCFB46C7C; Mon, 23 May 2016 20:15:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2613E1731; Mon, 23 May 2016 20:15:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NKF8WN069488; Mon, 23 May 2016 20:15:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NKF8Vn069487; Mon, 23 May 2016 20:15:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201605232015.u4NKF8Vn069487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston <markj@FreeBSD.org> Date: Mon, 23 May 2016 20:15:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300536 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 20:15:09 -0000 Author: markj Date: Mon May 23 20:15:08 2016 New Revision: 300536 URL: https://svnweb.freebsd.org/changeset/base/300536 Log: Acquire the nd6 lock in the prefix list sysctl handler. The nd6 lock will be used to synchronize access to the NDP prefix list. MFC after: 2 weeks Tested by: Jason Wolfe (as part of a larger change) Modified: head/sys/netinet6/nd6.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Mon May 23 20:13:17 2016 (r300535) +++ head/sys/netinet6/nd6.c Mon May 23 20:15:08 2016 (r300536) @@ -2610,15 +2610,17 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS) if (req->newptr) return (EPERM); + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + bzero(&p, sizeof(p)); p.origin = PR_ORIG_RA; bzero(&s6, sizeof(s6)); s6.sin6_family = AF_INET6; s6.sin6_len = sizeof(s6); - /* - * XXX locking - */ + ND6_RLOCK(); LIST_FOREACH(pr, &V_nd_prefix, ndpr_entry) { p.prefix = pr->ndpr_prefix; if (sa6_recoverscope(&p.prefix)) { @@ -2651,7 +2653,7 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS) p.advrtrs++; error = SYSCTL_OUT(req, &p, sizeof(p)); if (error != 0) - return (error); + break; LIST_FOREACH(pfr, &pr->ndpr_advrtrs, pfr_entry) { s6.sin6_addr = pfr->router->rtaddr; if (sa6_recoverscope(&s6)) @@ -2660,8 +2662,9 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS) ip6_sprintf(ip6buf, &pfr->router->rtaddr)); error = SYSCTL_OUT(req, &s6, sizeof(s6)); if (error != 0) - return (error); + break; } } - return (0); + ND6_RUNLOCK(); + return (error); } From owner-svn-src-head@freebsd.org Mon May 23 20:18:12 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69C24B46CF8; Mon, 23 May 2016 20:18:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C3051AE7; Mon, 23 May 2016 20:18:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NKIBWH069623; Mon, 23 May 2016 20:18:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NKIBfR069622; Mon, 23 May 2016 20:18:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201605232018.u4NKIBfR069622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston <markj@FreeBSD.org> Date: Mon, 23 May 2016 20:18:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300537 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 20:18:12 -0000 Author: markj Date: Mon May 23 20:18:11 2016 New Revision: 300537 URL: https://svnweb.freebsd.org/changeset/base/300537 Log: Mark the prefix and default router list sysctl handlers MPSAFE. MFC after: 2 weeks Modified: head/sys/netinet6/nd6.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Mon May 23 20:15:08 2016 (r300536) +++ head/sys/netinet6/nd6.c Mon May 23 20:18:11 2016 (r300537) @@ -2548,13 +2548,16 @@ clear_llinfo_pqueue(struct llentry *ln) static int nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS); static int nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS); -#ifdef SYSCTL_DECL + SYSCTL_DECL(_net_inet6_icmp6); -#endif -SYSCTL_NODE(_net_inet6_icmp6, ICMPV6CTL_ND6_DRLIST, nd6_drlist, - CTLFLAG_RD, nd6_sysctl_drlist, ""); -SYSCTL_NODE(_net_inet6_icmp6, ICMPV6CTL_ND6_PRLIST, nd6_prlist, - CTLFLAG_RD, nd6_sysctl_prlist, ""); +SYSCTL_PROC(_net_inet6_icmp6, ICMPV6CTL_ND6_DRLIST, nd6_drlist, + CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, + NULL, 0, nd6_sysctl_drlist, "S,in6_defrouter", + "NDP default router list"); +SYSCTL_PROC(_net_inet6_icmp6, ICMPV6CTL_ND6_PRLIST, nd6_prlist, + CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, + NULL, 0, nd6_sysctl_prlist, "S,in6_prefix", + "NDP prefix list"); SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MAXQLEN, nd6_maxqueuelen, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nd6_maxqueuelen), 1, ""); SYSCTL_INT(_net_inet6_icmp6, OID_AUTO, nd6_gctimer, From owner-svn-src-head@freebsd.org Mon May 23 20:19:08 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57188B46E53; Mon, 23 May 2016 20:19:08 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 298241D64; Mon, 23 May 2016 20:19:08 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NKJ7DU069886; Mon, 23 May 2016 20:19:07 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NKJ7ad069885; Mon, 23 May 2016 20:19:07 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201605232019.u4NKJ7ad069885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers <asomers@FreeBSD.org> Date: Mon, 23 May 2016 20:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300538 - head/tests/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 20:19:08 -0000 Author: asomers Date: Mon May 23 20:19:07 2016 New Revision: 300538 URL: https://svnweb.freebsd.org/changeset/base/300538 Log: Commit a missing change from 299090 tests/sys/kern/Makefile Reenable a disabled compiler warning, the need for which was eliminated by r299090. Reviewed by: ngie MFC after: 4 weeks X-MFC-With: 299090 Sponsored by: Spectra Logic Corp Modified: head/tests/sys/kern/Makefile Modified: head/tests/sys/kern/Makefile ============================================================================== --- head/tests/sys/kern/Makefile Mon May 23 20:18:11 2016 (r300537) +++ head/tests/sys/kern/Makefile Mon May 23 20:19:07 2016 (r300538) @@ -26,8 +26,6 @@ LIBADD.mqueue_test+= rt # included in userland. But as far as subr_unit_test goes, they're effectively # static. So it's ok to disable -Wmissing-prototypes for this program. CFLAGS.subr_unit.c+= -Wno-missing-prototypes -# XXX: -Wno-sign-compare will be eliminated as part of D6004 -CFLAGS.subr_unit.c+= -Wno-sign-compare SRCS.subr_unit_test+= subr_unit.c WARNS?= 5 From owner-svn-src-head@freebsd.org Mon May 23 20:28:53 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1556B470C8; Mon, 23 May 2016 20:28:53 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 99BA31333; Mon, 23 May 2016 20:28:52 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 336021FE024; Mon, 23 May 2016 22:28:50 +0200 (CEST) Subject: Re: svn commit: r300496 - in head/sys/compat/linuxkpi/common: include/linux src To: cem@FreeBSD.org References: <201605231203.u4NC3eHI010991@repo.freebsd.org> <CAG6CVpVpmx1XgG72=3ux1PQzf6Ka5GdaFbt8e9F0vhnjULJaig@mail.gmail.com> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Hans Petter Selasky <hps@selasky.org> Message-ID: <0d27a519-b1ca-d6da-b3e3-8a7776c5e9e3@selasky.org> Date: Mon, 23 May 2016 22:32:10 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <CAG6CVpVpmx1XgG72=3ux1PQzf6Ka5GdaFbt8e9F0vhnjULJaig@mail.gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 20:28:53 -0000 On 05/23/16 21:03, Conrad Meyer wrote: > Didn't we already have list_sort in linuxkpi? Maybe I'm confused. No, it is new from what I can see. --HPS From owner-svn-src-head@freebsd.org Mon May 23 20:29:19 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 701A2B4711B; Mon, 23 May 2016 20:29:19 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39852164E; Mon, 23 May 2016 20:29:18 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 242F31FE024; Mon, 23 May 2016 22:29:17 +0200 (CEST) Subject: Re: svn commit: r300493 - head/sys/compat/linuxkpi/common/include/linux To: John Baldwin <jhb@freebsd.org> References: <201605231150.u4NBo56Y005227@repo.freebsd.org> <3455323.tBydyU5thm@ralph.baldwin.cx> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Hans Petter Selasky <hps@selasky.org> Message-ID: <28d6d086-7195-fd81-12b5-125e6b99000a@selasky.org> Date: Mon, 23 May 2016 22:32:38 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <3455323.tBydyU5thm@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 20:29:19 -0000 On 05/23/16 19:00, John Baldwin wrote: > On Monday, May 23, 2016 11:50:05 AM Hans Petter Selasky wrote: >> Author: hselasky >> Date: Mon May 23 11:50:05 2016 >> New Revision: 300493 >> URL: https://svnweb.freebsd.org/changeset/base/300493 >> >> Log: >> Add support for "cdev_add_ext()" to the LinuxKPI. >> >> Obtained from: kmacy @ >> MFC after: 1 week >> Sponsored by: Mellanox Technologies >> >> Modified: >> head/sys/compat/linuxkpi/common/include/linux/cdev.h >> >> Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h >> ============================================================================== >> --- head/sys/compat/linuxkpi/common/include/linux/cdev.h Mon May 23 11:47:54 2016 (r300492) >> +++ head/sys/compat/linuxkpi/common/include/linux/cdev.h Mon May 23 11:50:05 2016 (r300493) >> @@ -91,6 +91,18 @@ cdev_add(struct linux_cdev *cdev, dev_t >> return (0); >> } >> >> +static inline int >> +cdev_add_ext(struct linux_cdev *cdev, dev_t dev, uid_t uid, gid_t gid, int mode) >> +{ >> + cdev->cdev = make_dev(&linuxcdevsw, MINOR(dev), uid, gid, mode, >> + "%s/%d", kobject_name(&cdev->kobj), MINOR(dev)); >> + cdev->dev = dev; >> + cdev->cdev->si_drv1 = cdev; >> + >> + kobject_get(cdev->kobj.parent); >> + return (0); > > This should use make_dev_s() instead? > Good idea. I'll fix it. --HPS From owner-svn-src-head@freebsd.org Mon May 23 20:29:20 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4593BB47120; Mon, 23 May 2016 20:29:20 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FE4D1652; Mon, 23 May 2016 20:29:20 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NKTJvH072947; Mon, 23 May 2016 20:29:19 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NKTIjK072941; Mon, 23 May 2016 20:29:18 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201605232029.u4NKTIjK072941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers <asomers@FreeBSD.org> Date: Mon, 23 May 2016 20:29:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300539 - in head: . share/man/man3 sys/kern sys/sys tests/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 20:29:20 -0000 Author: asomers Date: Mon May 23 20:29:18 2016 New Revision: 300539 URL: https://svnweb.freebsd.org/changeset/base/300539 Log: Add bit_count to the bitstring(3) api Add a bit_count function, which efficiently counts the number of bits set in a bitstring. sys/sys/bitstring.h tests/sys/sys/bitstring_test.c share/man/man3/bitstring.3 Add bit_alloc sys/kern/subr_unit.c Use bit_count instead of a naive counting loop in check_unrhdr, used when INVARIANTS are enabled. The userland test runs about 6x faster in a generic build, or 8.5x faster when built for Nehalem, which has the POPCNT instruction. sys/sys/param.h Bump __FreeBSD_version due to the addition of bit_alloc UPDATING Add a note about the ABI incompatibility of the bitstring(3) changes, as suggested by lidl. Suggested by: gibbs Reviewed by: gibbs, ngie MFC after: 9 days X-MFC-With: 299090, 300538 Relnotes: yes Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D6255 Modified: head/UPDATING head/share/man/man3/bitstring.3 head/sys/kern/subr_unit.c head/sys/sys/bitstring.h head/sys/sys/param.h head/tests/sys/sys/bitstring_test.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon May 23 20:19:07 2016 (r300538) +++ head/UPDATING Mon May 23 20:29:18 2016 (r300539) @@ -31,6 +31,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20160523: + The bitstring(3) API has been updated with new functionality and + improved performance. But it is binary-incompatible with the old API. + Objects built with the new headers may not be linked against objects + built with the old headers. + 20160520: The brk and sbrk functions have been removed from libc on arm64. Binutils from ports has been updated to not link to these Modified: head/share/man/man3/bitstring.3 ============================================================================== --- head/share/man/man3/bitstring.3 Mon May 23 20:19:07 2016 (r300538) +++ head/share/man/man3/bitstring.3 Mon May 23 20:29:18 2016 (r300539) @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" Copyright (c) 2014 Spectra Logic Corporation +.\" Copyright (c) 2014,2016 Spectra Logic Corporation .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -58,12 +58,13 @@ .\" @(#)bitstring.3 8.1 (Berkeley) 7/19/93 .\" $FreeBSD$ .\" -.Dd May 4, 2016 +.Dd May 23, 2016 .Dt BITSTRING 3 .Os .Sh NAME .Nm bit_alloc , .Nm bit_clear , +.Nm bit_count , .Nm bit_decl , .Nm bit_ffc , .Nm bit_ffs , @@ -84,6 +85,8 @@ .Ft void .Fn bit_clear "bitstr_t *name" "int bit" .Ft void +.Fn bit_count "bitstr_t *name" "int count" "int nbits" "int *value" +.Ft void .Fn bit_ffc "bitstr_t *name" "int nbits" "int *value" .Ft void .Fn bit_ffs "bitstr_t *name" "int nbits" "int *value" @@ -225,6 +228,17 @@ the location referenced by .Fa value is set to \-1. .Pp +The +.Fn bit_count +function stores in the location referenced by +.Fa value +the number of bits set in the array of +.Fa nbits +bits referenced by +.Fa name , +at or after the zero-based bit index +.Fa start . +.Pp The arguments in bit string macros are evaluated only once and may safely have side effects. .Sh EXAMPLES Modified: head/sys/kern/subr_unit.c ============================================================================== --- head/sys/kern/subr_unit.c Mon May 23 20:19:07 2016 (r300538) +++ head/sys/kern/subr_unit.c Mon May 23 20:29:18 2016 (r300539) @@ -224,7 +224,8 @@ check_unrhdr(struct unrhdr *uh, int line { struct unr *up; struct unrb *ub; - u_int x, y, z, w; + int w; + u_int y, z; y = uh->first; z = 0; @@ -237,9 +238,7 @@ check_unrhdr(struct unrhdr *uh, int line up->len, NBITS, line)); z++; w = 0; - for (x = 0; x < up->len; x++) - if (bit_test(ub->map, x)) - w++; + bit_count(ub->map, 0, up->len, &w); y += w; } else if (up->ptr != NULL) y += up->len; Modified: head/sys/sys/bitstring.h ============================================================================== --- head/sys/sys/bitstring.h Mon May 23 20:19:07 2016 (r300538) +++ head/sys/sys/bitstring.h Mon May 23 20:29:18 2016 (r300539) @@ -65,6 +65,7 @@ #ifdef _KERNEL #include <sys/libkern.h> #include <sys/malloc.h> +#include <sys/types.h> #endif typedef unsigned long bitstr_t; @@ -202,7 +203,7 @@ bit_ffs_at(bitstr_t *_bitstr, int _start _test &= _bit_make_mask(_start, _BITSTR_BITS - 1); while (_test == 0 && _curbitstr < _stopbitstr) _test = *(++_curbitstr); - + _offset = ffsl(_test); _value = ((_curbitstr - _bitstr) * _BITSTR_BITS) + _offset - 1; if (_offset == 0 || _value >= _nbits) @@ -231,7 +232,7 @@ bit_ffc_at(bitstr_t *_bitstr, int _start _test |= _bit_make_mask(0, _start - 1); while (_test == _BITSTR_MASK && _curbitstr < _stopbitstr) _test = *(++_curbitstr); - + _offset = ffsl(~_test); _value = ((_curbitstr - _bitstr) * _BITSTR_BITS) + _offset - 1; if (_offset == 0 || _value >= _nbits) @@ -256,4 +257,40 @@ bit_ffc(bitstr_t *_bitstr, int _nbits, i bit_ffc_at(_bitstr, /*start*/0, _nbits, _result); } +/* Count the number of bits set in a bitstr of size _nbits at or after _start */ +static inline void +bit_count(bitstr_t *_bitstr, int _start, int _nbits, int *_result) +{ + bitstr_t *_curbitstr, mask; + int _value = 0, curbitstr_len; + + if (_start >= _nbits) + goto out; + + _curbitstr = _bitstr + _bit_idx(_start); + _nbits -= _BITSTR_BITS * _bit_idx(_start); + _start -= _BITSTR_BITS * _bit_idx(_start); + + if (_start > 0) { + curbitstr_len = (int)_BITSTR_BITS < _nbits ? + (int)_BITSTR_BITS : _nbits; + mask = _bit_make_mask(_start, _bit_offset(curbitstr_len - 1)); + _value += __bitcountl(*_curbitstr & mask); + _curbitstr++; + _nbits -= _BITSTR_BITS; + } + while (_nbits >= (int)_BITSTR_BITS) { + _value += __bitcountl(*_curbitstr); + _curbitstr++; + _nbits -= _BITSTR_BITS; + } + if (_nbits > 0) { + mask = _bit_make_mask(0, _bit_offset(_nbits - 1)); + _value += __bitcountl(*_curbitstr & mask); + } + +out: + *_result = _value; +} + #endif /* _SYS_BITSTRING_H_ */ Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon May 23 20:19:07 2016 (r300538) +++ head/sys/sys/param.h Mon May 23 20:29:18 2016 (r300539) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100111 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100112 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/tests/sys/sys/bitstring_test.c ============================================================================== --- head/tests/sys/sys/bitstring_test.c Mon May 23 20:19:07 2016 (r300538) +++ head/tests/sys/sys/bitstring_test.c Mon May 23 20:29:18 2016 (r300539) @@ -342,6 +342,67 @@ BITSTRING_TC_DEFINE(bit_nset) } } +BITSTRING_TC_DEFINE(bit_count) +/* bitstr_t *bitstr, int nbits, const char *memloc */ +{ + int result, s, e, expected; + + /* Empty bitstr */ + memset(bitstr, 0, bitstr_size(nbits)); + bit_count(bitstr, 0, nbits, &result); + ATF_CHECK_MSG(0 == result, + "bit_count_%d_%s_%s: Failed with result %d", + nbits, "clear", memloc, result); + + /* Full bitstr */ + memset(bitstr, 0xFF, bitstr_size(nbits)); + bit_count(bitstr, 0, nbits, &result); + ATF_CHECK_MSG(nbits == result, + "bit_count_%d_%s_%s: Failed with result %d", + nbits, "set", memloc, result); + + /* Invalid _start value */ + memset(bitstr, 0xFF, bitstr_size(nbits)); + bit_count(bitstr, nbits, nbits, &result); + ATF_CHECK_MSG(0 == result, + "bit_count_%d_%s_%s: Failed with result %d", + nbits, "invalid_start", memloc, result); + + /* Alternating bitstr, starts with 0 */ + memset(bitstr, 0xAA, bitstr_size(nbits)); + bit_count(bitstr, 0, nbits, &result); + ATF_CHECK_MSG(nbits / 2 == result, + "bit_count_%d_%s_%d_%s: Failed with result %d", + nbits, "alternating", 0, memloc, result); + + /* Alternating bitstr, starts with 1 */ + memset(bitstr, 0x55, bitstr_size(nbits)); + bit_count(bitstr, 0, nbits, &result); + ATF_CHECK_MSG((nbits + 1) / 2 == result, + "bit_count_%d_%s_%d_%s: Failed with result %d", + nbits, "alternating", 1, memloc, result); + + /* Varying start location */ + memset(bitstr, 0xAA, bitstr_size(nbits)); + for (s = 0; s < nbits; s++) { + expected = s % 2 == 0 ? (nbits - s) / 2 : (nbits - s + 1) / 2; + bit_count(bitstr, s, nbits, &result); + ATF_CHECK_MSG(expected == result, + "bit_count_%d_%s_%d_%s: Failed with result %d", + nbits, "vary_start", s, memloc, result); + } + + /* Varying end location */ + memset(bitstr, 0xAA, bitstr_size(nbits)); + for (e = 0; e < nbits; e++) { + bit_count(bitstr, 0, e, &result); + ATF_CHECK_MSG(e / 2 == result, + "bit_count_%d_%s_%d_%s: Failed with result %d", + nbits, "vary_end", e, memloc, result); + } + +} + ATF_TP_ADD_TCS(tp) { @@ -354,6 +415,7 @@ ATF_TP_ADD_TCS(tp) BITSTRING_TC_ADD(tp, bit_ffc_at); BITSTRING_TC_ADD(tp, bit_nclear); BITSTRING_TC_ADD(tp, bit_nset); + BITSTRING_TC_ADD(tp, bit_count); return (atf_no_error()); } From owner-svn-src-head@freebsd.org Mon May 23 20:30:17 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A03C7B471EF; Mon, 23 May 2016 20:30:17 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi0-x22a.google.com (mail-oi0-x22a.google.com [IPv6:2607:f8b0:4003:c06::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 63AA519B5; Mon, 23 May 2016 20:30:17 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi0-x22a.google.com with SMTP id b65so152444488oia.1; Mon, 23 May 2016 13:30:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=EzJGHdNFwfJRUF+LeiBAXy5nx39idkDpEf1UYkH7eUc=; b=aiyfpFPJhv7vE/vuk/DIP7MjQLeh5THKMusQcfXUChM4S383m/R19NBXJNweNjJZaG hh7EqK01Zt/jADBYGSYfZr9fJPkYalkBUIFOE/FB07VauxN6YKSeEkfdCSvfHKd9iEBt 0lC/lZ02UBcLh/qpxsgXu13Y52JrucBgMovoGTgelGgPNT2Evo2xMdL/GOZvxHW8U5S0 UwTk8W+u3Gzu2Vy1/xJtlNYH4JXL1O/HRMyg4mStSIQp32Mb0jpKtpx7qIouzwYmB7lV gr25Iico7x7/siq7BICqnTAduwWf1LgP/Jg/tq7h1BxYA/49p2OFBqDMH++Y+9Ui0sed imwQ== 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:date :message-id:subject:from:to:cc; bh=EzJGHdNFwfJRUF+LeiBAXy5nx39idkDpEf1UYkH7eUc=; b=CGmIaQxRx87C7fWXocDD90Y+xs0SJ2ZmacmdaRN8HUqEWK1u+H88ZBxacviGaBRM6v 3AOeoroBDreo6w4HcstV4jIza9HbgBr22Pz3Xa23BQz89Sxl9WTbaAKAYIYozIXHVhoF kxPtuLxvvtRkPTUcLd+ulGX0JTlyi12szCp0i6u2FYq0WkFbOc+6tFjWresj70EtOrdI +l6aXQBYXqqpCWCQzOPJscfV/vOb47bwpX+svNpL0ihLwDD/bPzM09Xht6HWhlDWA7dI ZqWRCrCjtgkxrrvJQIC1BZ5adGd06jIcXLfEpQSUxpJegVsLf8fXzN1FTlZQnCx+YgeO xvIg== X-Gm-Message-State: ALyK8tIH1KQ0wNDao5ih2wcPrASvgJam9mdS6rrLFlvUbwYK24kaOGwxB11dc/iCqri1goNpfBOMxmD2yOT+Mg== MIME-Version: 1.0 X-Received: by 10.157.27.173 with SMTP id z42mr493194otd.192.1464035416580; Mon, 23 May 2016 13:30:16 -0700 (PDT) Sender: asomers@gmail.com Received: by 10.202.4.200 with HTTP; Mon, 23 May 2016 13:30:16 -0700 (PDT) In-Reply-To: <684f4a82-f48c-b2bb-6a72-5c1dfea11a39@pix.net> References: <201605042234.u44MYBMX054443@repo.freebsd.org> <2368543.Vvp613SNcD@ralph.baldwin.cx> <684f4a82-f48c-b2bb-6a72-5c1dfea11a39@pix.net> Date: Mon, 23 May 2016 14:30:16 -0600 X-Google-Sender-Auth: uNB6gvzIkIIOrgOc5nyA8TuCFDM Message-ID: <CAOtMX2iKmX9yOg5P5931E2JSRgS2QO4wRDuE8SmcvmR4JxO_Fw@mail.gmail.com> Subject: Re: svn commit: r299090 - in head: etc/mtree include lib/libbluetooth sbin/hastd share/man/man3 sys/dev/xen/blkback sys/kern sys/net sys/sys tests/sys tests/sys/sys usr.sbin/bluetooth/hccontrol From: Alan Somers <asomers@freebsd.org> To: Kurt Lidl <lidl@pix.net> Cc: John Baldwin <jhb@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 20:30:17 -0000 On Fri, May 6, 2016 at 8:45 AM, Kurt Lidl <lidl@pix.net> wrote: > On 5/5/16 12:31 PM, John Baldwin wrote: > >> On Wednesday, May 04, 2016 10:34:11 PM Alan Somers wrote: >> >>> Author: asomers >>> Date: Wed May 4 22:34:11 2016 >>> New Revision: 299090 >>> URL: https://svnweb.freebsd.org/changeset/base/299090 >>> >>> Log: >>> Improve performance and functionality of the bitstring(3) api >>> >>> Two new functions are provided, bit_ffs_at() and bit_ffc_at(), which >>> allow >>> for efficient searching of set or cleared bits starting from any bit >>> offset >>> within the bit string. >>> >>> Performance is improved by operating on longs instead of bytes and >>> using >>> ffsl() for searches within a long. ffsl() is a compiler builtin in both >>> clang and gcc for most architectures, converting what was a brute force >>> while loop search into a couple of instructions. >>> >>> All of the bitstring(3) API continues to be contained in the header >>> file. >>> Some of the functions are large enough that perhaps they should be >>> uninlined >>> and moved to a library, but that is beyond the scope of this commit. >>> >> >> Doesn't switching from bytes to longs break the ABI? That is, setting >> bit 9 >> now has a different representation on big-endian systems (0x00 0x01 >> before, >> now 0x00 0x00 0x01 0x00 on 32-bit BE, and 4 more leading 0 bytes on >> 64-bit). >> This means you can't have an object file compiled against the old header >> pass a bitstring to an object file compiled against the new header on >> big-endian >> systems. >> >> Even on little-endian systems if an old object file allocates storage for >> a >> bitstring the new code might read off the end of it and fault (or return >> garbage if bits are set in the extra bytes it reads off the end)? >> >> Is the API is so little used we don't care? >> >> > Just as a note - at my prior job (Pi-Coral, now defunct) we used this > API everywhere in the dataplane code of our product. Since the company > is gone, that particular use-case doesn't matter anymore. > > At the very least, this deserves a mention in the release notes, and > also UPDATING! > > -Kurt > > UPDATING is updated as of r300539. Any objection to merging this to stable/10? From owner-svn-src-head@freebsd.org Mon May 23 20:47:19 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29281B47940; Mon, 23 May 2016 20:47:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id D8CC4186D; Mon, 23 May 2016 20:47:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id XAA13134; Mon, 23 May 2016 23:47:10 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1b4wko-0002ya-4p; Mon, 23 May 2016 23:47:10 +0300 Subject: Re: svn commit: r300372 - in head/sys: kern sys To: John Baldwin <jhb@FreeBSD.org> References: <201605211451.u4LEpopu074806@repo.freebsd.org> <8562415.t0UfIz1aLk@ralph.baldwin.cx> Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org From: Andriy Gapon <avg@FreeBSD.org> Message-ID: <c0e1ee40-32de-48c4-363c-264801801bd1@FreeBSD.org> Date: Mon, 23 May 2016 23:46:14 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <8562415.t0UfIz1aLk@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 20:47:19 -0000 I don't know, I was just a proxy. Kip is the author. On 23/05/2016 21:43, John Baldwin wrote: > On Saturday, May 21, 2016 02:51:50 PM Andriy Gapon wrote: >> Author: avg >> Date: Sat May 21 14:51:49 2016 >> New Revision: 300372 >> URL: https://svnweb.freebsd.org/changeset/base/300372 >> >> Log: >> fix loss of taskqueue wakeups (introduced in r300113) >> >> Submitted by: kmacy >> Tested by: dchagin >> >> Modified: head/sys/sys/taskqueue.h >> ============================================================================== >> --- head/sys/sys/taskqueue.h Sat May 21 11:40:41 2016 (r300371) >> +++ head/sys/sys/taskqueue.h Sat May 21 14:51:49 2016 (r300372) >> @@ -114,7 +113,6 @@ void taskqueue_thread_enqueue(void *cont >> */ >> #define TASK_INIT(task, priority, func, context) do { \ >> (task)->ta_pending = 0; \ >> - (task)->ta_flags = 0; \ >> (task)->ta_priority = (priority); \ >> (task)->ta_func = (func); \ >> (task)->ta_context = (context); \ >> @@ -224,7 +222,6 @@ int taskqgroup_adjust(struct taskqgroup >> >> #define GTASK_INIT(task, priority, func, context) do { \ >> (task)->ta_pending = 0; \ >> - (task)->ta_flags = TASK_SKIP_WAKEUP; \ >> (task)->ta_priority = (priority); \ >> (task)->ta_func = (func); \ >> (task)->ta_context = (context); \ > > Do we still need GTASK_INIT() now or can relevant tasks now use > TASK_INIT instead and GTASK_INIT be retired? > -- Andriy Gapon From owner-svn-src-head@freebsd.org Mon May 23 21:29:59 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2034AB47531; Mon, 23 May 2016 21:29:59 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E57791A2D; Mon, 23 May 2016 21:29:58 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NLTw0i094361; Mon, 23 May 2016 21:29:58 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NLTwpF094360; Mon, 23 May 2016 21:29:58 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201605232129.u4NLTwpF094360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery <bdrewery@FreeBSD.org> Date: Mon, 23 May 2016 21:29:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300540 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 21:29:59 -0000 Author: bdrewery Date: Mon May 23 21:29:57 2016 New Revision: 300540 URL: https://svnweb.freebsd.org/changeset/base/300540 Log: Be more clear about LOCKLEAF being exclusive and add LOCKSHARED. Modified: head/share/man/man9/namei.9 Modified: head/share/man/man9/namei.9 ============================================================================== --- head/share/man/man9/namei.9 Mon May 23 20:29:18 2016 (r300539) +++ head/share/man/man9/namei.9 Mon May 23 21:29:57 2016 (r300540) @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 6, 2015 +.Dd May 23, 2015 .Dt NAMEI 9 .Os .Sh NAME @@ -121,8 +121,12 @@ function takes the following set of that influence its operation: .Bl -tag -width ".Dv WANTPARENT" .It Dv LOCKLEAF -Lock vnode on return. -This is a full lock of the vnode; the +Lock vnode on return with +.Dv LK_EXCLUSIVE +unless +.Dv LOCKSHARED +is also set. +The .Xr VOP_UNLOCK 9 should be used to release the lock (or @@ -149,6 +153,19 @@ or .Xr VOP_UNLOCK 9 and .Xr vrele 9 . +.It Dv LOCKSHARED +Lock vnode on return with +.Dv LK_SHARED . +The +.Xr VOP_UNLOCK 9 +should be used +to release the lock (or +.Xr vput 9 +which is equivalent to calling +.Xr VOP_UNLOCK 9 +followed by +.Xr vrele 9 , +all in one). .It Dv WANTPARENT This flag allows the .Fn namei From owner-svn-src-head@freebsd.org Mon May 23 22:01:08 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 112E7B471D5; Mon, 23 May 2016 22:01:08 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A53811863; Mon, 23 May 2016 22:01:07 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NM16fr005767; Mon, 23 May 2016 22:01:06 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NM1639005766; Mon, 23 May 2016 22:01:06 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201605232201.u4NM1639005766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin <bapt@FreeBSD.org> Date: Mon, 23 May 2016 22:01:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300542 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 22:01:08 -0000 Author: bapt Date: Mon May 23 22:01:06 2016 New Revision: 300542 URL: https://svnweb.freebsd.org/changeset/base/300542 Log: Update pci_vendors to 2016.05.23 Modified: head/share/misc/pci_vendors Modified: head/share/misc/pci_vendors ============================================================================== --- head/share/misc/pci_vendors Mon May 23 21:58:47 2016 (r300541) +++ head/share/misc/pci_vendors Mon May 23 22:01:06 2016 (r300542) @@ -3,8 +3,8 @@ # # List of PCI ID's # -# Version: 2016.02.27 -# Date: 2016-02-27 03:15:01 +# Version: 2016.05.23 +# Date: 2016-05-23 03:15:02 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at http://pci-ids.ucw.cz/. @@ -273,6 +273,7 @@ 103c 12c5 Ultra320 SCSI [A7173A] 103c 1323 Core I/O LAN/SCSI Combo [AB314A] 103c 3108 Single Channel Ultra320 SCSI HBA G2 + 103c 322a SC11Xe Ultra320 Single Channel PCIe x4 SCSI Host Bus Adapter (412911-B21) 124b 1170 PMC-USCSI320 # VMware's emulation of this device. Was missing from the list. 15ad 1976 LSI Logic Parallel SCSI Controller @@ -480,6 +481,21 @@ 007c MegaRAID SAS 1078DE 1014 0395 ServeRAID-AR10is SAS/SATA Controller 007e SSS6200 PCI-Express Flash SSD + 1000 0504 Nytro NWD-BLP4-800 + 1000 0507 Nytro NWD-BLP4-1600 + 1000 0581 Nytro NWD-BLP4-400 + 1000 100d Nytro NWD-BFH6-1200 + 1000 100e Nytro NWD-BFH8-1600 + 1000 107e Nytro NWD-BFH8-3200 + 1000 1310 Nytro XP6302-8B1536 + 1000 1311 Nytro XP6302-8B2048 + 1000 1314 Nytro XP6302-8B4096 + 1000 150c Nytro XP6210-4A2048 + 1000 150f Nytro XP6210-4B2048 + 1000 160b Nytro XP6209-4A1024 + 1000 1613 Nytro XP6209-4B2048 + 108e 050a Nytro ELP4x200_4d_n + 108e 0581 Nytro ELP4x100_4d_n 0080 SAS2208 PCI-Express Fusion-MPT SAS-2 0081 SAS2208 PCI-Express Fusion-MPT SAS-2 0082 SAS2208 PCI-Express Fusion-MPT SAS-2 @@ -1509,6 +1525,8 @@ 6646 Bonaire XT [Radeon R9 M280X] 6647 Bonaire PRO [Radeon R9 M270X] 6649 Bonaire [FirePro W5100] + 1002 0b0c FirePro W4300 + 103c 0b0c Bonaire [FirePro W4300] 6650 Bonaire 6651 Bonaire 6658 Bonaire XTX [Radeon R7 260X/360] @@ -2085,6 +2103,7 @@ 679f Tahiti 67a0 Hawaii XT GL [FirePro W9100] 1002 0335 FirePro S9150 + 1002 0735 FirePro S9170 1028 031f FirePro W9100 1028 0335 FirePro S9150 67a1 Hawaii PRO GL [FirePro W8100] @@ -2094,30 +2113,53 @@ 67a8 Hawaii 67a9 Hawaii 67aa Hawaii - 67b0 Hawaii XT [Radeon R9 290X] + 67b0 Hawaii XT / Grenada XT [Radeon R9 290X/390X] + 1028 0b00 Grenada XT [Radeon R9 390X] + 103c 6566 Radeon R9 390X 1043 046a R9 290X DirectCU II 1043 046c R9 290X DirectCU II OC 1043 0474 Matrix R9 290X Platinum 1043 0476 ARES III + 1043 04d7 Radeon R9 390X + 1043 04db Radeon R9 390X + 1043 04df Radeon R9 390X + 1043 04e9 Radeon R9 390X 1458 227c R9 290X WindForce 3X OC 1458 2281 R9 290X WindForce 3X OC 1458 228c R9 290X WindForce 3X 1458 228d R9 290X WindForce 3X OC 1458 2290 R9 290X WindForce 3X + 1458 22bc Radeon R9 390X 1458 22c1 Grenada PRO [Radeon R9 390] + 1462 2015 Radeon R9 390X 1462 3070 R9 290X Lightning 1462 3071 R9 290X Lightning 1462 3072 R9 290X Lightning LE 1462 3080 R9 290X Gaming 1462 3082 R9 290X Gaming OC 148c 2347 Devil 13 Dual Core R9 290X + 148c 2357 Grenada XT [Radeon R9 390X] 1682 9290 Double Dissipation R9 290X + 1682 9395 Grenada XT [Radeon R9 390X] + 174b 0e34 Radeon R9 390X 174b e282 Vapor-X R9 290X Tri-X OC 174b e285 R9 290X Tri-X OC + 174b e324 Grenada XT2 [Radeon R9 390X] 1787 2020 R9 290X IceQ X² Turbo - 67b1 Hawaii PRO [Radeon R9 290] + 1787 2357 Grenada XT [Radeon R9 390X] + 67b1 Hawaii PRO [Radeon R9 290/390] + 1043 04dd STRIX R9 390 + 148c 2358 Radeon R9 390 67b9 Vesuvius [Radeon R9 295X2] 67be Hawaii LE + 67c0 Ellesmere [Polaris10] + 67df Ellesmere [Polaris10] + 67e0 Baffin [Polaris11] + 67e1 Baffin [Polaris11] + 67e8 Baffin [Polaris11] + 67e9 Baffin [Polaris11] + 67eb Baffin [Polaris11] + 67ff Baffin [Polaris11] 6800 Wimbledon XT [Radeon HD 7970M] 1002 0124 Radeon HD 7970M 8086 2110 Radeon HD 7970M @@ -2803,8 +2845,15 @@ 6929 Tonga XT GL [FirePro S7150] 692b Tonga PRO GL [FirePro W7100] 692f Tonga XTV GL [FirePro S7150V] - 6938 Tonga XT / Amethyst XT [Radeon R9 380X / R9 M295X Mac Edition] + 6938 Tonga XT / Amethyst XT [Radeon R9 380X / R9 M295X] + 1043 04f5 Radeon R9 380X + 1043 04f7 Radeon R9 380X + 106b 013a Radeon R9 M295X Mac Edition + 1458 22c8 Radeon R9 380X + 148c 2350 Radeon R9 380X + 1682 9385 Radeon R9 380X 174b e308 Radeon R9 380X Nitro 4G D5 + 17af 2006 Radeon R9 380X 6939 Tonga PRO [Radeon R9 285/380] 148c 9380 Radeon R9 380 # Make naming scheme consistent @@ -3279,6 +3328,7 @@ # I have a Tonga card and this is the HDMI Audio part aad8 Tonga HDMI Audio [Radeon R9 285/380] 174b aad8 Radeon R9 285/380 HDMI Audio + aae8 Fiji HDMI/DP Audio Controller ac00 Theater 600 Pro ac02 TV Wonder HD 600 PCIe ac12 Theater HD T507 (DVB-T) TV tuner/capture device @@ -5860,6 +5910,7 @@ 1644 FastLinQ QL45000 Series 100GbE Controller 1077 e4f8 FastLinQ QL45611H 100GbE Adapter 1656 FastLinQ QL45000 Series 25GbE Controller + 1077 02a7 QL45212-DE 25GbE Adapter 1077 e4f6 FastLinQ QL45211H 25GbE Adapter 1077 e4f7 FastLinQ QL45212H 25GbE Adapter 165c FastLinQ QL45000 Series 40GbE Controller (FCoE) @@ -5910,6 +5961,7 @@ 103c 7040 FC1142SR 4Gb 1-port PCIe Fibre Channel Host Bus Adapter [HPAE311A] 2532 ISP2532-based 8Gb Fibre Channel to PCI Express HBA 103c 3262 StorageWorks 81Q + 103c 3263 StorageWorks 82Q 1077 0167 QME2572 Dual Port FC8 HBA Mezzanine 1590 00fc HPE StoreFabric 84Q 8Gb Quad Port Fibre Channel Host Bus Adapter 3022 ISP4022-based Ethernet NIC @@ -7383,7 +7435,7 @@ 10b5 1123 Sectra KK631 encryption board 10b5 9080 9080 [real subsystem ID not set] 12d9 0002 PCI Prosody Card - 12df 4422 4422PCI ["Do-All" Telemetry Data Aquisition System] + 12df 4422 4422PCI ["Do-All" Telemetry Data Acquisition System] 1369 9601 PCX822np 1369 a102 PCX822v2 1369 a201 PCX442 @@ -8079,7 +8131,7 @@ 1043 0c11 A7N8X Mainboard a0a0 03b4 UK79G-1394 motherboard 006a nForce2 AC97 Audio Controler (MCP) - 1043 8095 nForce2 AC97 Audio Controler (MCP) + 1043 8095 nForce2 AC97 Audio Controller (MCP) a0a0 0304 UK79G-1394 motherboard 006b nForce Audio Processing Unit 10de 006b nForce2 MCP Audio Processing Unit @@ -9766,6 +9818,7 @@ 0f01 GF108 [GeForce GT 620] 0f02 GF108 [GeForce GT 730] 0f06 GF108 [GeForce GT 730] + 0fb0 GM200 High Definition Audio 0fbb GM204 High Definition Audio Controller 0fc0 GK107 [GeForce GT 640 OEM] 0fc1 GK107 [GeForce GT 640] @@ -9907,6 +9960,7 @@ 103c 2afb GeForce 705A 17aa 309d GeForce 705A 17aa 30b1 GeForce 800A + 17aa 30f3 GeForce 705A 17aa 36a1 GeForce 800A 107c GF119 [NVS 315] 107d GF119 [NVS 310] @@ -10385,7 +10439,7 @@ 1287 GK208 [GeForce GT 730] 1288 GK208 [GeForce GT 720] 1289 GK208 [GeForce GT 710] - 128b GK208 [GeForce GT 710] + 128b GK208 [GeForce GT 710B] 1290 GK208M [GeForce GT 730M] 103c 2afa GeForce GT 730A 103c 2b04 GeForce GT 730A @@ -10410,6 +10464,9 @@ 1296 GK208M [GeForce 825M] 1298 GK208M [GeForce GT 720M] 1299 GK208M [GeForce 920M] + 17aa 30bb GeForce 920A + 17aa 36a7 GeForce 920A + 17aa 36af GeForce 920M 129a GK208M [GeForce 910M] 12a0 GK208 12b9 GK208GLM [Quadro K610M] @@ -10423,10 +10480,13 @@ 1344 GM108M [GeForce 845M] 1346 GM108M [GeForce 930M] 1347 GM108M [GeForce 940M] - 1348 GM108M [GeForce 945A] + 1348 GM108M [GeForce 945M / 945A] 1349 GM108M [GeForce 930M] 134d GM108M [GeForce 940MX] - 137a GM108GLM [Quadro K620M] + 134e GM108M [GeForce 930MX] + 134f GM108M [GeForce 920MX] + 137a GM108GLM [Quadro K620M / Quadro M500M] + 17aa 505a Quadro M500M 137d GM108M [GeForce 940A] 1380 GM107 [GeForce GTX 750 Ti] 1381 GM107 [GeForce GTX 750] @@ -10444,10 +10504,12 @@ 17aa 362f GeForce GTX 950A 17aa 363f GeForce GTX 950A 17aa 3640 GeForce GTX 950A + 17aa 3647 GeForce GTX 950A 17aa 36b9 GeForce GTX 950A 139b GM107M [GeForce GTX 960M] 103c 2b4c GeForce GTX 960A 139c GM107M [GeForce 940M] + 139d GM107M [GeForce GTX 750 Ti] 13b0 GM107GLM [Quadro M2000M] 13b1 GM107GLM [Quadro M1000M] 13b2 GM107GLM [Quadro M600M] @@ -10473,10 +10535,13 @@ 13f8 GM204GLM [Quadro M5000M] 13f9 GM204GLM [Quadro M4000M] 13fa GM204GLM [Quadro M3000M] + 13fb GM204GLM [Quadro M5500] 1401 GM206 [GeForce GTX 960] 1402 GM206 [GeForce GTX 950] + 1406 GM206 [GeForce GTX 960] 1407 GM206 [GeForce GTX 750 v2] 1427 GM206M [GeForce GTX 965M] + 1430 GM206GL [Quadro M2000] 1431 GM206GL [Tesla M4] 1617 GM204M [GeForce GTX 980M] 1618 GM204M [GeForce GTX 970M] @@ -10486,7 +10551,9 @@ 17c2 GM200 [GeForce GTX TITAN X] 17c8 GM200 [GeForce GTX 980 Ti] 17f0 GM200GL [Quadro M6000] + 17f1 GM200GL [Quadro M6000 24GB] 17fd GM200GL [Tesla M40] + 1b80 GP104 [GeForce GTX 1080] 10df Emulex Corporation 0720 OneConnect NIC (Skyhawk) 103c 1934 FlexFabric 20Gb 2-port 650M Adapter @@ -10517,6 +10584,7 @@ e240 OneConnect iSCSI Initiator (Lancer) e260 OneConnect FCoE Initiator (Lancer) e268 OneConnect 10Gb FCoE Converged Network Adapter (Lancer-VF) + e300 Lancer Gen6: LPe32000 Fibre Channel Host Adapter f011 Saturn: LightPulse Fibre Channel Host Adapter f015 Saturn: LightPulse Fibre Channel Host Adapter f085 LP850 Fibre Channel Host Adapter @@ -10739,7 +10807,6 @@ 103c 1611 Pavilion DM1Z-3000 103c 1950 ProBook 450/455 103c 2a6f Asus IPIBL-LB Motherboard - 1043 11f5 A6J-Q008 1043 16d5 U6V/U31J laptop 1043 81aa P5B 1043 82c6 M3A78 Series Motherboard @@ -12982,6 +13049,7 @@ 2a55 88W8864 [Avastar] 802.11ac Wireless 2b36 88W8764 [Avastar] 802.11n Wireless 2b38 88W8897 [AVASTAR] 802.11ac Wireless + 2b40 88W8964 [Avastar] 802.11ac Wireless 4101 OLPC Cafe Controller Secure Digital Controller 4320 88E8001 Gigabit Ethernet Controller 1019 0f38 Marvell 88E8001 Gigabit Ethernet Controller (ECS) @@ -15712,6 +15780,7 @@ 5099 T580-5099 Unified Wire Ethernet Controller 509a T520-509A Unified Wire Ethernet Controller 509b T540-509B Unified Wire Ethernet Controller + 509c T520-509C Unified Wire Ethernet Controller 5401 T520-CR Unified Wire Ethernet Controller 5402 T522-CR Unified Wire Ethernet Controller 5403 T540-CR Unified Wire Ethernet Controller @@ -15757,6 +15826,7 @@ 5499 T580-5099 Unified Wire Ethernet Controller 549a T520-509A Unified Wire Ethernet Controller 549b T540-509B Unified Wire Ethernet Controller + 549c T520-509C Unified Wire Ethernet Controller 5501 T520-CR Unified Wire Storage Controller 5502 T522-CR Unified Wire Storage Controller 5503 T540-CR Unified Wire Storage Controller @@ -15802,6 +15872,7 @@ 5599 T580-5099 Unified Wire Storage Controller 559a T520-509A Unified Wire Storage Controller 559b T540-509B Unified Wire Storage Controller + 559c T520-509C Unified Wire Storage Controller 5601 T520-CR Unified Wire Storage Controller 5602 T522-CR Unified Wire Storage Controller 5603 T540-CR Unified Wire Storage Controller @@ -15847,6 +15918,7 @@ 5699 T580-5099 Unified Wire Storage Controller 569a T520-509A Unified Wire Storage Controller 569b T540-509B Unified Wire Storage Controller + 569c T520-509C Unified Wire Storage Controller 5701 T520-CR Unified Wire Ethernet Controller 5702 T522-CR Unified Wire Ethernet Controller 5703 T540-CR Unified Wire Ethernet Controller @@ -15931,6 +16003,7 @@ 5899 T580-5099 Unified Wire Ethernet Controller [VF] 589a T520-509A Unified Wire Ethernet Controller [VF] 589b T540-509B Unified Wire Ethernet Controller [VF] + 589c T520-509C Unified Wire Ethernet Controller [VF] a000 PE10K Unified Wire Ethernet Controller 1426 Storage Technology Corp. 1427 Better On-Line Solutions @@ -16115,6 +16188,7 @@ 3064 TPCI100 (2 Slot IndustryPack PCI Carrier) 30c8 TPCI200 4 Slot IndustryPack PCI Carrier 70c8 TPCE200 4 Slot IndustryPack PCIe Carrier + 9177 TXMC375 8 channel RS232/RS422/RS485 programmable serial interface 1499 EMTEC CO., Ltd 149a ANDOR Technology Ltd 149b SEIKO Instruments Inc @@ -16292,7 +16366,7 @@ 1028 0236 PowerEdge R610 BCM5709 Gigabit Ethernet 1028 0237 PowerEdge T610 BCM5709 Gigabit Ethernet 103c 7055 NC382i Integrated Multi-port PCI Express Gigabit Server Adapter - 103c 7059 NC382T PCI Express Dual Port Multifunction Gigabit Server Adapter + 103c 7059 NC382T PCIe Dual Port Multifunction Gigabit Server Adapter 10a9 8027 Quad port Gigabit Ethernet Controller 163a NetXtreme II BCM5709S Gigabit Ethernet 1028 027b PowerEdge M805 Broadcom NetXtreme II BCM5709S @@ -16363,7 +16437,7 @@ 1647 NetXtreme BCM5703 Gigabit Ethernet 0e11 0099 NC7780 1000BaseTX 0e11 009a NC7770 1000BaseTX - 10a9 8010 SGI IO9 Gigabit Ethernet (Copper) + 10a9 8010 IO9 Gigabit Ethernet (Copper) 14e4 0009 BCM5703 1000BaseTX 14e4 000a BCM5703 1000BaseSX 14e4 000b BCM5703 1000BaseTX @@ -16420,6 +16494,7 @@ 1657 NetXtreme BCM5719 Gigabit Ethernet PCIe 103c 169d Ethernet 1Gb 4-port 331FLR Adapter 103c 22be Ethernet 1Gb 4-port 331i Adapter + 103c 3383 Ethernet 1Gb 4-port 331T Adapter 1659 NetXtreme BCM5721 Gigabit Ethernet PCI Express 1014 02c6 eServer xSeries server mainboard 1028 01e6 PowerEdge 860 @@ -16861,6 +16936,7 @@ 43a3 BCM4350 802.11ac Wireless Network Adapter 43a9 BCM43217 802.11b/g/n 43aa BCM43131 802.11b/g/n + 43ae BCM43162 802.11ac Wireless Network Adapter 43b1 BCM4352 802.11ac Wireless Network Adapter 43ba BCM43602 802.11ac Wireless LAN SoC 43bb BCM43602 802.11ac Wireless LAN SoC @@ -17217,6 +17293,7 @@ 4254 980c T980C 8880 CX23887/8 PCIe Broadcast Audio and Video Decoder with 3D Comb 0070 2259 WinTV HVR-1250 + 0070 6a18 WinTV-quadHD 0070 c108 WinTV-HVR-4400-HD model 1278 5654 2389 GoTView X5 DVD Hybrid PCI-E 5654 2390 GoTView X5 3D HYBRID PCI-E @@ -17550,6 +17627,7 @@ 15aa Moreton Bay 15ab Bluesteel Networks Inc 15ac North Atlantic Instruments + 6893 3U OpenVPX Multi-function I/O Board [Model 68C3] 15ad VMware 0405 SVGA II Adapter 0710 SVGA Adapter @@ -17566,6 +17644,7 @@ 07e0 SATA AHCI controller 0801 Virtual Machine Interface 15ad 0800 Hypervisor ROM Interface + 0820 Paravirtual RDMA controller 1977 HD Audio Controller 15ae Amersham Pharmacia Biotech 15b0 Zoltrix International Ltd @@ -17659,6 +17738,9 @@ 7123 NPS-600 network interface VF # SwitchX-2, 40GbE switch c738 MT51136 + c739 MT51136 GW + c838 MT52236 + c839 MT52236 router caf1 ConnectX-4 CAPI Function # Spectrum, 100GbE Switch cb84 MT52100 @@ -18192,6 +18274,7 @@ 1a56 1525 Killer N1525 Wireless-AC 0040 QCA9980/9990 802.11ac Wireless Network Adapter 0041 QCA6164 802.11ac Wireless Network Adapter + 0042 QCA9377 802.11ac Wireless Network Adapter 0050 QCA9887 802.11ac Wireless Network Adapter 0207 AR5210 Wireless Network Adapter [AR5000 802.11a] 1014 AR5212 802.11abg NIC @@ -18403,6 +18486,13 @@ 0095 Octeon III CN78XX Network Processor 0096 Octeon III CN70XX Network Processor 9700 Octeon III CN73XX Network Processor + 9702 CN23XX [LiquidIO II] Intelligent Adapter + 177d 0003 CN2350 [LiquidIO II] 2-port 10GbE Intelligent adapter + 177d 0004 CN2350 [LiquidIO II] 2-port 25GbE Intelligent adapter + 9703 CN23XX [LiquidIO II] NVMe Controller + 9712 CN23XX [LiquidIO II] SRIOV Virtual Function + 177d 0003 CN2350 [LiquidIO II] 2-port 10GbE SRIOV Virtual Function + 9713 CN23XX [LiquidIO II] NVMe SRIOV Virtual Function 9800 Octeon Fusion CNF75XX Processor a001 THUNDERX MRML Bridge a002 THUNDERX PCC Bridge @@ -19065,13 +19155,20 @@ 1924 800c SFN7x22F-R3 Flareon Ultra 7000 Series 10G Adapter 1924 800d SFN7x02F-R3 Flareon 7000 Series 10G Adapter 1924 8010 SFA7942Q-R1 QSFP+ AOE Adapter + 1924 8015 SFA7942Q-A5-0-R1 QSFP+ AOE Adapter 0923 SFC9140 1924 800b SFN7x42Q-R1 Flareon Ultra 7000 Series 10/40G Adapter 1924 800e SFN7x42Q-R2 Flareon Ultra 7000 Series 10/40G Adapter 1924 800f SFN7xx4F-R1 Flareon Ultra 7000 Series 10G Adapter 0a03 SFC9220 + 1924 8011 SFN 8022-R1 Solarflare Flareon 8000 Series 10G Adapter 1924 8012 SFN8522-R1 Flareon Ultra 8000 Series 10G Adapter + 1924 8013 SFN8042-R1 Solarflare Flareon 8000 Series 10/40G Adapter 1924 8014 SFN8542-R1 Flareon Ultra 8000 Series 10/40G Adapter + 1924 8016 SFN8022-R2 Flareon 8000 Series 10G Adapter + 1924 8017 SFN8522-R2 Flareon Ultra 8000 Series 10G Adapter + 1924 8018 SFN8042-R2 Flareon 8000 Series 10/40G Adapter + 1924 8019 SFN8542-R2 Flareon Ultra 8000 Series 10/40G Adapter 1803 SFC9020 Virtual Function [Solarstorm] 1813 SFL9021 Virtual Function [Solarstorm] 1903 SFC9120 Virtual Function @@ -19096,15 +19193,19 @@ 000c Qualcomm MSM6275 UMTS chip 1932 DiBcom 193c MAXIM Integrated Products -193f Comtech AHA Corp. +193f AHA Products Group 0001 AHA36x-PCIX 0360 AHA360-PCIe 0363 AHA363-PCIe 0364 AHA364-PCIe 0367 AHA367-PCIe 0370 AHA370-PCIe + 0604 AHA604 + 0605 AHA605 3641 AHA3641 3642 AHA3642 + 6101 AHA6101 + 6102 AHA6102 1942 ClearSpeed Technology plc e511 Advance X620 accelerator card e521 Advance e620 accelerator card @@ -19188,6 +19289,7 @@ 0401 P4080 0408 P4040E 0409 P4040 + 041f P3041 0440 T4240 with security 0441 T4240 without security 0446 T4160 with security @@ -19481,6 +19583,9 @@ 9100 TPRO-PCI-66U Timecode Reader/Generator 1ade Spin Master Ltd. 1501 Swipetech barcode scanner + 3038 PCIe Video Bridge + 13c2 3016 TT-budget S2-4200 Twin + 4254 0552 S952 v3 1ae0 Google, Inc. 1ae7 First Wise Media GmbH 0520 HFC-S PCI A [X-TENSIONS XC-520] @@ -19527,8 +19632,24 @@ 1004 Virtio SCSI 1005 Virtio RNG 1009 Virtio filesystem - 1010 Virtio GPU - 1012 Virtio input device +# virtio 1.0 + 1041 Virtio network device +# virtio 1.0 + 1042 Virtio block device +# virtio 1.0 + 1043 Virtio console +# virtio 1.0 + 1044 Virtio RNG +# virtio 1.0 + 1045 Virtio memory balloon +# virtio 1.0 + 1048 Virtio SCSI +# virtio 1.0 + 1049 Virtio filesystem +# virtio 1.0 + 1050 Virtio GPU +# virtio 1.0 + 1052 Virtio input 1110 Inter-VM shared memory 1af4 1100 QEMU Virtual Machine 1af5 Netezza Corp. @@ -19618,6 +19739,7 @@ 9485 88SE9485 SAS/SATA 6Gb/s controller 1b55 NetUP Inc. 18f6 Dual DVB Universal CI card + 18f7 Dual DVB Universal CI card rev 1.4 2a2c Dual DVB-S2-CI card e2e4 Dual DVB-T/C-CI RF card # 2xHDMI and 2xHD-SDI inputs @@ -19640,6 +19762,7 @@ d230 D230 Dual-port E1/T1 card (2nd generation) d410 D410/430 Quad-port E1/T1 card d430 D410/430 Quad-port E1/T1 card +1b79 Absolute Analysis 1b85 OCZ Technology Group, Inc. 1041 RevoDrive 3 X2 PCI-Express SSD 240 GB (Marvell Controller) 8788 RevoDrive Hybrid @@ -19700,6 +19823,7 @@ 4254 10G-PCIE3-8D-2S 4255 10G-PCIE3-8D-Q 4256 10G-PCIE3-8D-2S + 4258 10G-PCIE3-8E-2S 1c1c Symphony 0001 82C101 1c28 Lite-On IT Corp. / Plextor @@ -19728,8 +19852,8 @@ # A Western Digital Subsidiary 1c58 HGST, Inc. 0003 Ultrastar SN100 Series NVMe SSD - 1014 04f5 PCIe3 1.6TB NVMe Adapter - 1014 04f6 PCIe3 3.2TB NVMe Adapter + 1014 04f5 PCIe3 1.6TB NVMe Flash Adapter + 1014 04f6 PCIe3 3.2TB NVMe Flash Adapter # http://www.nicevt.ru/ (in Russian) 1c63 Science and Research Centre of Computer Technology (JSC "NICEVT") # http://www.radiotec.ru/catalog.php?cat=jr8&art=14109 @@ -19743,6 +19867,9 @@ 1cb1 Collion UG & Co.KG 1cc5 Embedded Intelligence, Inc. 0100 CAN-PCIe-02 +1cc7 Radian Memory Systems Inc. + 0200 RMS-200 + 0250 RMS-250 1cd2 SesKion GmbH 0301 Simulyzer-RT CompactPCI Serial DIO-1 card 0302 Simulyzer-RT CompactPCI Serial PSI5-ECU-1 card @@ -19782,6 +19909,11 @@ 1005 ZC706-Z045 1006 KCU105-KU040 1007 XUSP3S-VU095 [Jasper] + 1008 XUSPL4-VU065 [Mustang UltraScale] + 1009 XUSPL4-VU3P [Mustang UltraScale+] + 100a A10PL4-A10GX115 + 100b K35-2SFP + 100c K35-4SFP 4200 A5PL-E1-10GETI [10 GbE Ethernet Traffic Instrument] 1de1 Tekram Technology Co.,Ltd. 0391 TRM-S1040 [DC-315 / DC-395 series] @@ -19823,11 +19955,15 @@ 4010 TN4010 Clean SROM 4020 TN9030 10GbE CX4 Ethernet Adapter 4022 TN9310 10GbE SFP+ Ethernet Adapter + 1043 8709 XG-C100F 10GbE SFP+ Ethernet Adapter 1186 4d00 DXE-810S 10GbE SFP+ Ethernet Adapter + 1432 8103 EN-8102PF 10GbE SPF+ Ethernet Adapter 1fc9 3015 Ethernet Adapter 4024 TN9210 10GBase-T Ethernet Adapter 4025 TN9510 10GBase-T/NBASE-T Ethernet Adapter + 105a 7203 SANLink3 NBase-T1 1186 2900 DXE-810T 10GBase-T Ethernet Adapter + 1432 8102 EN-8102P 10GbE Ethernet Adapter 1fc9 3015 Ethernet Adapter 4026 TN9610 10GbE SFP+ Ethernet Adapter 4027 TN9710 10GBase-T/NBASE-T Ethernet Adapter @@ -20091,58 +20227,128 @@ 1960 RedCreek PCI adapter 4943 Growth Networks 494f ACCES I/O Products, Inc. - 0520 PCI-IDO-48 - 0920 PCI-IDI-48 - 0c50 PCI-DIO-24H - 0c51 PCI-DIO-24D - 0c60 PCI-DIO-48(H) - 0c68 PCI-DIO-72 - 0c70 PCI-DIO-96 - 0c78 PCI-DIO-120 - 0dc8 PCI-IDIO-16 - 0e50 PCI-DIO-24S - 0e51 PCI-DIO-24H(C) - 0e52 PCI-DIO-24D(C) - 0e60 PCI-DIO-48S(H) - 0e61 P104-DIO-24S - 0f00 PCI-IIRO-8 - 0f01 LPCI-IIRO-8 - 0f08 PCI-IIRO-16 - 1050 PCI-422/485-2 - 1058 PCI-COM422/4 - 1059 PCI-COM485/4 - 1068 PCI-COM422/8 - 1069 PCI-COM485/8 - 1088 PCI-COM232/1 - 1090 PCI-COM232/2 - 10a8 P104-COM232-8 - 10c9 PCI-COM-1S - 10d0 PCI-COM2S - 10e8 PCI-COM-8SM - 1148 PCI-ICM-1S - 1150 PCI-ICM-2S - 1158 PCI-ICM422/4 - 1159 PCI-ICM485/4 - 1250 PCI-WDG-2S + 0508 PCI-IDO-16A FET Output Card + 0518 PCI-IDO-32A FET Output Card + 0520 PCI-IDO-48 FET Output Card + 0521 PCI-IDO-48A FET Output Card + 0703 PCIe-RO-4 Electromechanical Relay Output Card + 07d0 PCIe-IDO-24 FET Output Card + 0920 PCI-IDI-48 Isolated Digital Input Card + 0bd0 PCIe-IDI-24 Isolated Digital Input Card + 0c50 PCI-DIO-24H 1x 8255 Digital Input / Output Card + 0c51 PCI-DIO-24D 1x 8255 Digital Input / Output Card + 0c52 PCIe-DIO-24 1x 8255 Digital Input / Output Card + 0c53 PCIe-DIO-24H 8255 Digital Input / Output Card + 0c57 mPCIe-DIO-24 8255 Digital Input / Output Card + 0c60 PCI-DIO-48H 8255 Digital Input / Output Card + 0c61 PCIe-DIO-48 8255 Digital Input / Output Card + 0c62 P104-DIO-48 8255 Digital Input / Output Card + 0c68 PCI-DIO-72 8255 Digital Input / Output Card + 0c69 P104-DIO-96 8255 Digital Input / Output Card + 0c70 PCI-DIO-96 8255 Digital Input / Output Card + 0c78 PCI-DIO-120 8255 Digital Input / Output Card + 0dc8 PCI-IDIO-16 Isolated Digital Input / FET Output Card + 0e50 PCI-DIO-24S 8255 Digital Input / Output Card + 0e51 PCI-DIO-24H(C) 8255 Digital Input / Output Card + 0e52 PCI-DIO-24D(C) 8255 Digital Input / Output Card + 0e53 PCIe-DIO-24S 8255 Digital Input / Output Card + 0e54 PCIe-DIO-24HS 8255 Digital Input / Output Card + 0e55 PCIe-DIO-24DC 8255 Digital Input / Output Card + 0e56 PCIe-DIO-24DCS 8255 Digital Input / Output Card + 0e57 mPCIe-DIO-24S 8255 Digital Input / Output Card + 0e60 PCI-DIO-48S 2x 8255 Digital Input / Output Card + 0e61 PCIe-DIO-48S 2x 8255 Digital Input / Output Card + 0e62 P104-DIO-48S 2x 8255 Digital Input / Output Card + 0f00 PCI-IIRO-8 Isolated Digital / Relay Output Card + 0f01 LPCI-IIRO-8 Isolated Digital / Relay Output Card + 0f02 PCIe-IIRO-8 Isolated Digital / Relay Output Card + 0f08 PCI-IIRO-16 Isolated Digital / Relay Output Card + 0f09 PCIe-IIRO-16 Isolated Digital / Relay Output Card + 0fc0 PCIe-IDIO-12 Isolated Digital Input / FET Output Card + 0fc1 PCIe-IDI-12 Isolated Digital Input Card + 0fc2 PCIe-IDO-12 FET Output Card + 0fd0 PCIe-IDIO-24 Isolated Digital Input / FET Output Card + 1050 PCI-422/485-2 2x RS422/RS484 Card + 1051 PCIe-COM-2SRJ 2x RS422/RS484 Card w/RJ45 Connectors + 1052 104I-COM-2S 2x RS422/RS484 PCI/104 Board + 1053 mPCIe-COM-2S 2x RS422/RS484 PCI Express Mini Card + 1058 PCI-COM422/4 4x RS422 Card + 1059 PCI-COM485/4 4x RS485 Card + 105a PCIe-COM422-4 4x RS422 Card + 105b PCIe-COM485-4 4x RS485 Card + 105c PCIe-COM-4SRJ 4x RS422/RS485 Card w/RJ45 Connectors + 105d 104I-COM-4S 4x RS422/RS484 PCI/104 Board + 105e mPCIe-COM-4S 4x RS422/RS484 PCI Express Mini Card + 1068 PCI-COM422/8 8x RS422 Card + 1069 PCI-COM485/8 8x RS485 Card + 106a PCIe-COM422-8 8x RS422 Card + 106b PCIe-COM485-8 8x RS485 Card + 106c 104I-COM-8S 8x RS422/RS485 PCI/104 Board + 1088 PCI-COM232/1 1x RS232 Card + 1090 PCI-COM232/2 2x RS232 Card + 1091 PCIe-COM232-2RJ 2x RS232 Card w/RJ45 Connectors + 1093 mPCIe-COM232-2 2x RS232 PCI Express Mini Card + 1098 PCIe-COM232-4 4x RS232 Card + 1099 PCIe-COM232-4RJ 4x RS232 Card w/RJ45 Connectors + 109b mPCIe-COM232-4 4x RS232 PCI Express Mini Card + 10a8 P104-COM232-8 8x RS232 PC-104+ Board + 10a9 PCIe-COM232-8 8x RS232 Card + 10c9 PCI-COM-1S 1x RS422/RS485 Card + 10d0 PCI-COM2S 2x RS422/RS485 Card + 10d1 PCIe-COM-2SMRJ 2x RS232/RS422/RS485 Card w/RJ45 Connectors + 10d2 104I-COM-2SM 2x RS232/RS422/RS485 PCI/104 Board + 10d3 mPCIe-COM-2SM 2x RS232/RS422/RS485 PCI Express Mini Card + 10d8 PCI-COM-4SM 4x RS232/RS422/RS485 Card + 10d9 PCIe-COM-4SM 4x RS232/RS422/RS485 Card + 10da PCIe-COM-4SMRJ 4x RS232/RS422/RS485 Card w/RJ45 Connectors + 10db 104I-COM-4SM 4x RS232/RS422/RS485 PCI/104 Board + 10dc mPCIe-COM-4SM 4x RS232/RS422/RS485 PCI Express Mini Card + 10e8 PCI-COM-8SM 8x RS232/RS422/RS485 Card + 10e9 PCIe-COM-8SM 8x RS232/RS422/RS485 Card + 10ea 104I-COM-8SM 8x RS232/RS422/RS485 PCI-104 Board + 1108 mPCIe-ICM485-1 1x Isolated RS485 PCI Express Mini Card + 1110 mPCIe-ICM422-2 2x Isolated RS422 PCI Express Mini Card + 1111 mPCIe-ICM485-2 2x Isolated RS485 PCI Express Mini Card + 1118 mPCIe-ICM422-4 4x Isolated RS422 PCI Express Mini Card + 1119 mPCIe-ICM485-4 4x Isolated RS485 PCI Express Mini Card + 1148 PCI-ICM-1S 1x Isolated RS422/RS485 Card + 1150 PCI-ICM-2S 2x Isolated RS422/RS485 Card + 1152 PCIe-ICM-2S 2x Isolated RS422/RS485 Card + 1158 PCI-ICM422/4 4x Isolated RS422 Card + 1159 PCI-ICM485/4 4x Isolated RS485 Card + 115a PCIe-ICM-4S 4x Isolated RS422/RS485 Card + 1190 PCIe-ICM232-2 2x Isolated RS232 Card + 1191 mPCIe-ICM232-2 2x Isolated RS232 PCI Express Mini Card + 1198 PCIe-ICM232-4 4x Isolated RS232 Card + 1199 mPCIe-ICM232-4 4x Isolated RS422 PCI Express Mini Card + 11d0 PCIe-ICM-2SM 2x Isolated RS232/RS422/RS485 Card + 11d8 PCIe-ICM-4SM 4x Isolated RS232/RS422/RS485 Card + 1250 PCI-WDG-2S Watchdog and 2x Serial Card 12d0 PCI-WDG-IMPAC - 22c0 PCI-WDG-CSM - 2c50 PCI-DIO-96CT - 2c58 PCI-DIO-96C3 + 2230 PCI-QUAD-8 8x Quadrature Input Card + 2231 PCI-QUAD-4 4x Quadrature Input Card + 22c0 PCI-WDG-CSM Watchdog Card + 25c0 P104-WDG-E Watchdog PC/104+ Board + 2c50 PCI-DIO-96CT 96x Digital Input / Output Card + 2c58 PCI-DIO-96C3 96x Digital Input / Output Card w/3x 8254 Counter Card + 2ee0 PCIe-DIO24S-CTR12 24x Digital Input / Output Card w/4x 8254 Counter Card + 2fc0 P104-WDG-CSM Watchdog PC/104+ Board + 2fc1 P104-WDG-CSMA Advanced Watchdog PC/104+ Board 5ed0 PCI-DAC - 6c90 PCI-DA12-2 - 6c98 PCI-DA12-4 - 6ca0 PCI-DA12-6 - 6ca8 PCI-DA12-8 + 6c90 PCI-DA12-2 2x 12-bit Analog Output Card + 6c98 PCI-DA12-4 4x 12-bit Analog Output Card + 6ca0 PCI-DA12-6 6x 12-bit Analog Output Card + 6ca8 PCI-DA12-8 8x 12-bit Analog Output Card 6ca9 PCI-DA12-8V - 6cb0 PCI-DA12-16 + 6cb0 PCI-DA12-16 16x 12-bit Analog Output Card 6cb1 PCI-DA12-16V 8ef0 P104-FAS16-16 - aca8 PCI-AI12-16 - aca9 PCI-AI12-16A - eca8 PCI-AIO12-16 - eca9 PCI-A12-16 - ecaa PCI-A12-16A - ece8 PCI-A16-16 + aca8 PCI-AI12-16 12-bit 100kHz Analog Input Card + aca9 PCI-AI12-16A 12-bit 100kHz Analog Input w/FIFO Card + eca8 PCI-AIO12-16 12-bit 100kHz Analog Input w/2x Analog Output and FIFO Card + ecaa PCI-A12-16A 12-bit 100kHz Analog Input w/2x Analog Output and FIFO Card + ece8 LPCI-A16-16A 16-bit 500kHz Analog Input low-profile Card + ece9 LPCI-AIO16A 16-bit 500kHz Analog Input low-profile Card 4978 Axil Computer Inc 4a14 NetVin 5000 NV5000SC @@ -22042,6 +22248,7 @@ 1093 76b1 PCIe-8237R-S Ethernet Adapter 1093 775b PCIe-8237 Ethernet Adapter 10a9 802a UV2-BaseIO dual-port GbE + 15d9 0652 Dual Port i350 GbE MicroLP [AOC-CGP-i2] 17aa 1074 ThinkServer I350-T4 AnyFabric 17aa 4005 I350 Gigabit Network Connection 8086 0001 Ethernet Server Adapter I350-T4 @@ -22143,6 +22350,8 @@ 1563 Ethernet Controller 10G X550T 8086 0001 Ethernet Converged Network Adapter X550-T2 8086 001a Ethernet Converged Network Adapter X550-T2 + 8086 0022 Ethernet Converged Network Adapter X550-T2 + 1565 X550 Virtual Function 1566 DSL4410 Thunderbolt NHI [Redwood Ridge 2C 2013] 1567 DSL4410 Thunderbolt Bridge [Redwood Ridge 2C 2013] 1568 DSL4510 Thunderbolt NHI [Redwood Ridge 4C 2013] @@ -22192,14 +22401,16 @@ 1028 0000 Ethernet 10G X710-k bNDC 1028 1f98 Ethernet 10G 4P X710-k bNDC 1028 1f9e Ethernet 10G 2P X710-k bNDC + 1590 0000 Ethernet 2-port 563i Adapter + 1590 00f8 Ethernet 2-port 563i Adapter 8086 0000 Ethernet Converged Network Adapter XL710-Q2 1583 Ethernet Controller XL710 for 40GbE QSFP+ 1028 0000 Ethernet 40G 2P XL710 QSFP+ rNDC 1028 1f9f Ethernet 40G 2P XL710 QSFP+ rNDC 108e 0000 10 Gb/40 Gb Ethernet Adapter 108e 7b1b 10 Gb/40 Gb Ethernet Adapter - 1137 0000 Ethernet Converged NIC XL710-Q2 - 1137 013c Ethernet Converged NIC XL710-Q2 + 1137 0000 Ethernet Converged NIC XL710-QDA2 + 1137 013c Ethernet Converged NIC XL710-QDA2 8086 0000 Ethernet Converged Network Adapter XL710-Q2 8086 0001 Ethernet Converged Network Adapter XL710-Q2 8086 0002 Ethernet Converged Network Adapter XL710-Q2 @@ -22223,6 +22434,8 @@ 103c 0000 HP Flex-20 20Gb 2-port 660M Adapter 103c 22ff HP Flex-20 20Gb 2-port 660M Adapter 1589 Ethernet Controller X710/X557-AT 10GBASE-T + 108e 0000 Quad Port 10GBase-T Adapter + 108e 7b1c Quad Port 10GBase-T Adapter 8086 0000 Ethernet Converged Network Adapter X710-T 8086 0001 Ethernet Converged Network Adapter X710-T4 8086 0002 Ethernet Converged Network Adapter X710-T4 @@ -22243,9 +22456,12 @@ 15b7 Ethernet Connection (2) I219-LM 15b8 Ethernet Connection (2) I219-V 15b9 Ethernet Connection (3) I219-LM + 15d0 Ethernet SDI Adapter FM10420-100GbE-QDA2 15d1 Ethernet Controller 10G X550T 8086 0002 Ethernet Converged Network Adapter X550-T1 + 8086 0021 Ethernet Converged Network Adapter X550-T1 8086 00a2 Ethernet Converged Network Adapter X550-T1 + 15d5 Ethernet SDI Adapter FM10420-25GbE-DA2 15d6 Ethernet Connection (5) I219-V 15d7 Ethernet Connection (4) I219-LM 15d8 Ethernet Connection (4) I219-V @@ -22256,7 +22472,7 @@ 1603 Broadwell-U Processor Thermal Subsystem 1604 Broadwell-U Host Bridge -OPI 1605 Broadwell-U PCI Express x8 Controller - 1606 Broadwell-U Integrated Graphics + 1606 HD Graphics 1607 Broadwell-U CHAPS Device 1608 Broadwell-U Host Bridge -OPI 1609 Broadwell-U x4 PCIe @@ -22267,19 +22483,19 @@ 160e Broadwell-U Integrated Graphics 160f Broadwell-U SoftSKU 1610 Broadwell-U Host Bridge - DMI - 1612 Broadwell-U Integrated Graphics + 1612 HD Graphics 5600 1614 Broadwell-U Host Bridge - DMI - 1616 Broadwell-U Integrated Graphics + 1616 HD Graphics 5500 103c 2216 ZBook 15u G2 Mobile Workstation 1618 Broadwell-U Host Bridge - DMI 161a Broadwell-U Integrated Graphics 161b Broadwell-U Integrated Graphics 161d Broadwell-U Integrated Graphics - 161e Broadwell-U Integrated Graphics - 1622 Broadwell-U Integrated Graphics - 1626 Broadwell-U Integrated Graphics - 162a Broadwell-U Integrated Graphics - 162b Broadwell-U Integrated Graphics + 161e HD Graphics 5300 + 1622 Iris Pro Graphics 6200 + 1626 HD Graphics 6000 + 162a Iris Pro Graphics P6300 + 162b Iris Graphics 6100 162d Broadwell-U Integrated Graphics 162e Broadwell-U Integrated Graphics 1632 Broadwell-U Integrated Graphics @@ -22290,25 +22506,34 @@ 163e Broadwell-U Integrated Graphics 1900 Skylake Host Bridge/DRAM Registers 1901 Skylake PCIe Controller (x16) + 1902 HD Graphics 510 1903 Skylake Processor Thermal Subsystem 1904 Skylake Host Bridge/DRAM Registers 1905 Skylake PCIe Controller (x8) + 1906 HD Graphics 510 1908 Skylake Host Bridge/DRAM Registers 1909 Skylake PCIe Controller (x4) 190c Skylake Host Bridge/DRAM Registers 190f Skylake Host Bridge/DRAM Registers 1910 Skylake Host Bridge/DRAM Registers 1911 Skylake Gaussian Mixture Model - 1912 Skylake Integrated Graphics - 1916 Skylake Integrated Graphics + 1912 HD Graphics 530 + 1916 HD Graphics 520 1918 Skylake Host Bridge/DRAM Registers 1919 Skylake Imaging Unit - 191b Skylake Integrated Graphics - 191e Skylake Integrated Graphics + 191b HD Graphics 530 + 191d HD Graphics P530 + 191e HD Graphics 515 191f Skylake Host Bridge/DRAM Registers - 1926 Skylake Integrated Graphics - 1932 Skylake Integrated Graphics - 193b Skylake Integrated Graphics + 1921 HD Graphics 520 + 1926 Iris Graphics 540 + 1927 Iris Graphics 550 + 192b Iris Graphics 555 + 192d Iris Graphics P555 + 1932 Iris Pro Graphics 580 + 193a Iris Pro Graphics P580 + 193b Iris Pro Graphics 580 + 193d Iris Pro Graphics P580 1960 80960RP (i960RP) Microprocessor 101e 0431 MegaRAID 431 RAID Controller 101e 0438 MegaRAID 438 Ultra2 LVD RAID Controller @@ -22766,6 +22991,37 @@ 225c Xeon Phi coprocessor SE10/7120 series 225d Xeon Phi coprocessor 3120 series 225e Xeon Phi coprocessor 31S1 + 2280 Braswell SoC Transaction Router + 2284 Braswell HD Audio Controller + 2286 Braswell Serial I/O DMA + 228a Braswell Serial I/O HSUART Port 1 + 228c Braswell Serial I/O HSUART Port 2 + 2292 Braswell Platform Controller Unit SMBus + 2294 Braswell Storage Cluster Control MMC Port + 2295 Braswell Storage Cluster Control SDIO Port + 2296 Braswell Storage Cluster Control SD Port + 2298 Braswell Trusted Execution Engine Interface + 229c Braswell Platform Controller Unit LPC + 22a3 Braswell SATA Controller + 22a4 Braswell SATA AHCI Controller + 22a8 Braswell Low Power Engine Audio + 22b0 Braswell PCI Configuration Registers + 22b1 Braswell Integrated Graphics Controller + 22b5 Braswell USB xHCI Host Controller + 22b8 Braswell ISP Camera + 22c0 Braswell Serial I/O DMA + 22c1 Braswell Serial I/O I2C Port 1 + 22c2 Braswell Serial I/O I2C Port 2 + 22c3 Braswell Serial I/O I2C Port 3 + 22c4 Braswell Serial I/O I2C Port 4 + 22c5 Braswell Serial I/O I2C Port 5 + 22c6 Braswell Serial I/O I2C Port 6 + 22c7 Braswell Serial I/O I2C Port 7 + 22c8 Braswell PCIe Port 1 + 22ca Braswell PCIe Port 2 + 22cc Braswell PCIe Port 3 + 22ce Braswell PCIe Port 4 + 22dc Braswell P-Unit Power Management 2310 DH89xxCC LPC Controller 2323 DH89xxCC 4 Port SATA AHCI Controller 2330 DH89xxCC SMBus Controller @@ -23433,8 +23689,11 @@ 24df 82801ER (ICH5R) SATA Controller 1028 0168 Precision Workstation 670 Mainboard 24f0 Omni-Path HFI Silicon 100 Series [discrete] - 10a9 802e Omni-path HFI 100 Series, 1-port - 10a9 802f Omni-path HFI 100 Series, 2-port + 10a9 802e Omni-path HFI 100 Series, 1-port A-board + 10a9 802f Omni-path HFI 100 Series, 2-port A-board + 10a9 8030 Omni-path HFI 100 Series, 1-port B-board + 10a9 8031 Omni-path HFI 100 Series, 2-port B-board + 15d9 0934 Omni-Path HFI Adapter 100 Series, 1 Port, PCIe x16, SIOM Module 8086 2628 Omni-Path HFI Adapter 100 Series, 1 Port, PCIe x16 8086 2629 Omni-Path HFI Adapter 100 Series, 1 Port, PCIe x8 8086 262a Omni-Path HFI Adapter 100 Series, 2 Ports, Split PCIe x16 @@ -23849,7 +24108,7 @@ 103c 0934 Compaq nw8240/nx8220 103c 099c NX6110/NC6120 266e 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Audio Controller - 1014 0581 ThinkPad X41 + 1014 0581 ThinkPad X41 (Analog Devices AD1981B codec) 1025 006a Realtek ALC 655 codec (in Acer TravelMate 2410 serie laptop) 1028 0177 Dimension 8400 1028 0179 Optiplex GX280 @@ -25546,6 +25805,14 @@ 372b Xeon C5500/C3500 Core 372c Xeon C5500/C3500 Reserved 373f Xeon C5500/C3500 IOxAPIC + 37cd X722 Virtual Function + 37ce Ethernet Connection X722 for 10GbE backplane + 37cf Ethernet Connection X722 for 10GbE QSFP+ + 37d0 Ethernet Connection X722 for 10GbE SFP+ + 37d1 Ethernet Connection X722 for 1GbE + 37d2 Ethernet Connection X722 for 10GBASE-T + 37d3 Ethernet Connection X722 for 10GbE SFP+ + 37d4 Ethernet Connection X722 for 10GbE QSFP+ 3a00 82801JD/DO (ICH10 Family) 4-port SATA IDE Controller 3a02 82801JD/DO (ICH10 Family) SATA AHCI Controller 3a05 82801JD/DO (ICH10 Family) SATA RAID Controller @@ -26931,7 +27198,8 @@ 8384 SigmaTel 8401 TRENDware International Inc. 8686 ScaleMP - 1010 vSMPowered system controller [vSMP CTL] + 1010 vSMP Foundation controller [vSMP CTL] + 1011 vSMP Foundation MEX/FLX controller [vSMP CTL] 8800 Trigem Computer Inc. 2008 Video assistant component 8866 T-Square Design Inc. @@ -27436,6 +27704,11 @@ bdbd Blackmagic Design a137 DeckLink Studio 4K a138 Decklink SDI 4K a139 Intensity Pro 4K + a13b DeckLink Micro Recorder + a13d DeckLink 4K Pro + a13e UltraStudio 4K Extreme + a13f DeckLink Quad 2 + a140 DeckLink Duo 2 c001 TSI Telsys c0a9 Micron/Crucial Technology c0de Motorola From owner-svn-src-head@freebsd.org Mon May 23 22:27:46 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 124B7B477AC; Mon, 23 May 2016 22:27:46 +0000 (UTC) (envelope-from peter@wemm.org) Received: from smtp2.wemm.org (smtp2.wemm.org [192.203.228.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp2.wemm.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED60C194C; Mon, 23 May 2016 22:27:45 +0000 (UTC) (envelope-from peter@wemm.org) Received: from overcee.wemm.org (canning.wemm.org [192.203.228.65]) by smtp2.wemm.org (Postfix) with ESMTP id 98996EE4; Mon, 23 May 2016 15:27:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=m20140428; t=1464042464; bh=aeD062kFsckSsq4/DslITD9O+y0vRUzoAuzgNvCGnPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=t995pXJ4kT1tbj/gQyGnMZTFg3aAg0cCNokcDcy90GqpiU9pfua2SWyg148zW9YUt R59IoGIq8CCwlwNwoIEG64yp/+CHdQU/Nozm4zkC6TqOUy0PX4ct4tf+EpLAQSnDjf mIE0kl/RI1xmo9+iW0OPHnGI0d9TTRsMHfTlGvrE= From: Peter Wemm <peter@wemm.org> To: svn-src-head@freebsd.org Cc: Ed Maste <emaste@freebsd.org>, Alan Somers <asomers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org> Subject: Re: svn commit: r299090 - in head: etc/mtree include lib/libbluetooth sbin/hastd share/man/man3 sys/dev/xen/blkback sys/kern sys/net sys/sys tests/sys tests/sys/sys usr.sbin/bluetooth/hccontrol Date: Mon, 23 May 2016 15:27:38 -0700 Message-ID: <1800889.cA7PpKnr6e@overcee.wemm.org> User-Agent: KMail/4.14.3 (FreeBSD/11.0-CURRENT; KDE/4.14.3; amd64; ; ) In-Reply-To: <CAPyFy2Dy4fUzMk=ZYLHu0t+PVe4diOqvE_Z_zeTXqe-SsnYrPg@mail.gmail.com> References: <201605042234.u44MYBMX054443@repo.freebsd.org> <CAPyFy2Dy4fUzMk=ZYLHu0t+PVe4diOqvE_Z_zeTXqe-SsnYrPg@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1751466.a2GuLocyWL"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 22:27:46 -0000 --nextPart1751466.a2GuLocyWL Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" On Thursday, May 05, 2016 10:57:16 AM Ed Maste wrote: > On 4 May 2016 at 18:34, Alan Somers <asomers@freebsd.org> wrote: > > Author: asomers > > Date: Wed May 4 22:34:11 2016 > > New Revision: 299090 > > URL: https://svnweb.freebsd.org/changeset/base/299090 > >=20 > > Log: > > Improve performance and functionality of the bitstring(3) api >=20 > tinderbox is failing on (at least) powerpc now with: >=20 > --- all_subdir_tests --- > cc1: warnings being treated as errors > /scratch/tmp/emaste/freebsd/sys/kern/subr_unit.c: In function 'main':= > /scratch/tmp/emaste/freebsd/sys/kern/subr_unit.c:1029: warning: forma= t > '%lu' expects type 'long unsigned int', but argument 2 has type > 'unsigned int' > *** [subr_unit.o] Error code 1 > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.or= g" It also breaks i386: In file included from /usr/src/usr.sbin/apmd/apmd.c:36: In file included from /usr/obj/usr/src/tmp/usr/include/bitstring.h:34: /usr/obj/usr/src/tmp/usr/include/sys/bitstring.h:278:13: error: implici= t=20 declaration of function '__bitcountl' is invalid in C99 [-Werror,-Wimpl= icit- function-declaration] _value +=3D __bitcountl(*_curbitstr & mask); ^ =2D-=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI= 6FJV UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246 --nextPart1751466.a2GuLocyWL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJXQ4PbAAoJEDXWlwnsgJ4EgGEH/jUA3AtPrf4exugTuO7ClIv3 DjFKJDg9eRmwHI1I6fJZ8lZKOGvKNkycykv8p0umWtrmwSPLTEItpISrN7EHiRPj yYuimEkcpCdRgt0CGe6n0O8IDxxlzs92R5O8icOVdfF8MYeTs/+3uyWCFjj4ytYV u/GR0rvW2gwb4Wn1+DAtzxDaqUAnZ/wbESP1N/t3VIF+LRAX1Vqf2qFSh8Gt0Qr5 /umQD1U64Yus7HQ5bUtktRgEK13YYqGsKEu4QDLVg3QDC/dFBR0NjikBUhToUeLr xmkEWQzQqg8kdvIFuMPezLRDtnwQhtJbPm06YIObBKUMbUHON8ouNdvJgiBkfus= =M3rj -----END PGP SIGNATURE----- --nextPart1751466.a2GuLocyWL-- From owner-svn-src-head@freebsd.org Mon May 23 22:31:29 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77F18B478AB; Mon, 23 May 2016 22:31:29 +0000 (UTC) (envelope-from peter@wemm.org) Received: from smtp2.wemm.org (smtp2.wemm.org [IPv6:2001:470:67:39d::78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp2.wemm.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 646A51C4C; Mon, 23 May 2016 22:31:29 +0000 (UTC) (envelope-from peter@wemm.org) Received: from overcee.wemm.org (canning.wemm.org [192.203.228.65]) by smtp2.wemm.org (Postfix) with ESMTP id 0DC7DEEA; Mon, 23 May 2016 15:31:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=m20140428; t=1464042689; bh=bQ9lw4U1CZE297HIStMo3HQLqg2E6u60OIhmL20Ukfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ILgvxYRN8S4HrKdDscYxrjmnyKzuxfVpodjebBryN8A4fFLZ9fY7XWzTkI6Fbu07m xw/t/2Z0JRKNYUu3rEsO5h71v9WCkRaTcAtB8S92GlPHznd1oZHpFElLvkXaBr2Z0X kvvz5Ulq2rimRpRbK/9PxTS3eJT6uKVdDmaqU8I4= From: Peter Wemm <peter@wemm.org> To: Alan Somers <asomers@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300539 - in head: . share/man/man3 sys/kern sys/sys tests/sys/sys Date: Mon, 23 May 2016 15:31:28 -0700 Message-ID: <1554849.4hxx0PqhhX@overcee.wemm.org> User-Agent: KMail/4.14.3 (FreeBSD/11.0-CURRENT; KDE/4.14.3; amd64; ; ) In-Reply-To: <201605232029.u4NKTIjK072941@repo.freebsd.org> References: <201605232029.u4NKTIjK072941@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1508528.SQmjUx9Luv"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 22:31:29 -0000 --nextPart1508528.SQmjUx9Luv Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" On Monday, May 23, 2016 08:29:18 PM Alan Somers wrote: > Author: asomers > Date: Mon May 23 20:29:18 2016 > New Revision: 300539 > URL: https://svnweb.freebsd.org/changeset/base/300539 >=20 > Log: > Add bit_count to the bitstring(3) api >=20 (My aplogies, I replied to the wrong commit.) This breaks i386: In file included from /usr/src/usr.sbin/apmd/apmd.c:36: In file included from /usr/obj/usr/src/tmp/usr/include/bitstring.h:34: /usr/obj/usr/src/tmp/usr/include/sys/bitstring.h:278:13: error: implici= t=20 declaration of function '__bitcountl' is invalid in C99 [-Werror,-Wimpl= icit- function-declaration] _value +=3D __bitcountl(*_curbitstr & mask); ... This is coming from the inline below: > @@ -256,4 +257,40 @@ bit_ffc(bitstr_t *_bitstr, int _nbits, i > =09bit_ffc_at(_bitstr, /*start*/0, _nbits, _result); > } >=20 > +/* Count the number of bits set in a bitstr of size _nbits at or aft= er > _start */ +static inline void > +bit_count(bitstr_t *_bitstr, int _start, int _nbits, int *_result) > +{ > +=09bitstr_t *_curbitstr, mask; > +=09int _value =3D 0, curbitstr_len; > + > +=09if (_start >=3D _nbits) > +=09=09goto out; > + > +=09_curbitstr =3D _bitstr + _bit_idx(_start); > +=09_nbits -=3D _BITSTR_BITS * _bit_idx(_start); > +=09_start -=3D _BITSTR_BITS * _bit_idx(_start); > + > +=09if (_start > 0) { > +=09=09curbitstr_len =3D (int)_BITSTR_BITS < _nbits ? > +=09=09=09=09(int)_BITSTR_BITS : _nbits; > +=09=09mask =3D _bit_make_mask(_start, _bit_offset(curbitstr_len - 1)= ); > +=09=09_value +=3D __bitcountl(*_curbitstr & mask); > +=09=09_curbitstr++; > +=09=09_nbits -=3D _BITSTR_BITS; > +=09} > +=09while (_nbits >=3D (int)_BITSTR_BITS) { > +=09=09_value +=3D __bitcountl(*_curbitstr); > +=09=09_curbitstr++; > +=09=09_nbits -=3D _BITSTR_BITS; > +=09} > +=09if (_nbits > 0) { > +=09=09mask =3D _bit_make_mask(0, _bit_offset(_nbits - 1)); > +=09=09_value +=3D __bitcountl(*_curbitstr & mask); > +=09} > + > +out: > +=09*_result =3D _value; > +} =2D-=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI= 6FJV UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246 --nextPart1508528.SQmjUx9Luv Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJXQ4TAAAoJEDXWlwnsgJ4E+dwIANI2Tq8KFlSlsAffqN5BIj3N tpNOYrz2TEQ+Ix/30b7CKhOUC0Q+RHEvX2J8UPEYOCIrVvIxlk1sEZfqp2JCfgzt eaU2ynhVypjSIItBaT8ClHypFBgYjTiPclc0Km7e0FV8Ueq4wP5RCC8Yll5aDMMJ vgmnEbszdOG6sNlOqWTthe+5hdSgCt+eAntiLH5I3NroQSjiEy/skLV9gMvqAGZA U1Np7j8+9UQ4FEMhJLqBNH6idOChlZ4iT4EDT7if5SEHuh52RrNeMta/AM5EcfEd QZcrGbJayT9UwcMK6XL1S6bxfIim7EcW2KOGlQMrYnooBNMkS33hhhYOU/dEm8s= =6uJL -----END PGP SIGNATURE----- --nextPart1508528.SQmjUx9Luv-- From owner-svn-src-head@freebsd.org Mon May 23 22:33:17 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D822B479D6; Mon, 23 May 2016 22:33:17 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi0-x22f.google.com (mail-oi0-x22f.google.com [IPv6:2607:f8b0:4003:c06::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 028271E87; Mon, 23 May 2016 22:33:17 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi0-x22f.google.com with SMTP id j1so63389243oih.3; Mon, 23 May 2016 15:33:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=gNOtNrPU8yNJXoEP/yeGx1yCNrVZ+Nn2tSwW1sY2IYI=; b=Y1nMF/TerFluMtFTangDdknsqZxZaWtwlf22H37KeDdCH5Gb5xL1agi6Xrvff+PcEP GFlgp3PFq9g6swVHXp8Vis2XuD6wKlspt/wxPR8L34jhH5lperJTeH2HZPs11dX14BgK iK4eRyqyn+xT7K3/4L/KPbQ7vwzQV+vR61hpVcUFk+vZYGGzU/n46HtPWXuEbuZ5DhkZ 0xvWHb6rKq5A9ND3VT9rXvbXk3yayV9k4A93rkLTKI3oTCzUzczkpXRBvyx/0RwILZq0 G72/Ehfo+C5VBozTdm2uIDmiMrTVJPxrlTkSVd8745scU7fLpAgABlaP3BpywJl9FzVR 6+Uw== 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:date :message-id:subject:from:to:cc; bh=gNOtNrPU8yNJXoEP/yeGx1yCNrVZ+Nn2tSwW1sY2IYI=; b=I+5jtnEt9C+zGB2aQb+VA5jUDXvORLMUiKO8KkzwAn7QmSuwZBdzh8NEpwzLdKKfzY +BW2ud+5ySwIKAGHSOLe4BwObSSTx+SfIBEMgXHx9powgrmxsf2znRjlDlbsU5i4He16 vr5WxUuW4nOQPoi1K9rXkLVETRIdb8APRKa2oZntiTnpDeEs3tasv8TqTDaAjmEtYPFb XUfodkVuVWbSePf4U+pbgagADeVr9zH93dW4FCfhBZkENIJrbLcHeECcktg1MyyEKsxQ BKwC49ZJFzoCeMUnBJEWuG/FaOWkmHPjUh9AMlcJcnV3n0Li5QLDjKvq5mLEntek+2QZ zAvw== X-Gm-Message-State: AOPr4FXpzjmzZdFGNPS6qQN86kredo9HF76FZYZJijoOnv/Xa/EFvgXaDVr522nxh6jMGm4xSiLuLiwhyaNHlg== MIME-Version: 1.0 X-Received: by 10.202.73.72 with SMTP id w69mr10791552oia.176.1464042796464; Mon, 23 May 2016 15:33:16 -0700 (PDT) Sender: asomers@gmail.com Received: by 10.202.4.200 with HTTP; Mon, 23 May 2016 15:33:16 -0700 (PDT) In-Reply-To: <1554849.4hxx0PqhhX@overcee.wemm.org> References: <201605232029.u4NKTIjK072941@repo.freebsd.org> <1554849.4hxx0PqhhX@overcee.wemm.org> Date: Mon, 23 May 2016 16:33:16 -0600 X-Google-Sender-Auth: A1EcGHcuHB08G7tr3RDy2cL8A4M Message-ID: <CAOtMX2iAGr3JB1hHcfZhWFCHSSiy852+sHstevrqw1sEn5LM+Q@mail.gmail.com> Subject: Re: svn commit: r300539 - in head: . share/man/man3 sys/kern sys/sys tests/sys/sys From: Alan Somers <asomers@freebsd.org> To: Peter Wemm <peter@wemm.org> Cc: "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 22:33:17 -0000 On Mon, May 23, 2016 at 4:31 PM, Peter Wemm <peter@wemm.org> wrote: > On Monday, May 23, 2016 08:29:18 PM Alan Somers wrote: > > Author: asomers > > Date: Mon May 23 20:29:18 2016 > > New Revision: 300539 > > URL: https://svnweb.freebsd.org/changeset/base/300539 > > > > Log: > > Add bit_count to the bitstring(3) api > > > > (My aplogies, I replied to the wrong commit.) > > > This breaks i386: > > In file included from /usr/src/usr.sbin/apmd/apmd.c:36: > In file included from /usr/obj/usr/src/tmp/usr/include/bitstring.h:34: > /usr/obj/usr/src/tmp/usr/include/sys/bitstring.h:278:13: error: implicit > declaration of function '__bitcountl' is invalid in C99 > [-Werror,-Wimplicit- > function-declaration] > _value += __bitcountl(*_curbitstr & mask); > ... > Oops. I'll fix it. From owner-svn-src-head@freebsd.org Mon May 23 22:59:08 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D368AB4715F; Mon, 23 May 2016 22:59:08 +0000 (UTC) (envelope-from lidl@pix.net) Received: from hydra.pix.net (hydra.pix.net [IPv6:2001:470:e254::4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.pix.net", Issuer "Pix.Com Technologies, LLC CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id ADDD11D32; Mon, 23 May 2016 22:59:08 +0000 (UTC) (envelope-from lidl@pix.net) Received: from torb.pix.net (torb.pix.net [192.168.16.32]) (authenticated bits=0) by hydra.pix.net (8.15.2/8.15.2) with ESMTPA id u4NMx7KZ030783; Mon, 23 May 2016 18:59:07 -0400 (EDT) (envelope-from lidl@pix.net) Subject: Re: svn commit: r299090 - in head: etc/mtree include lib/libbluetooth sbin/hastd share/man/man3 sys/dev/xen/blkback sys/kern sys/net sys/sys tests/sys tests/sys/sys usr.sbin/bluetooth/hccontrol To: Alan Somers <asomers@freebsd.org> References: <201605042234.u44MYBMX054443@repo.freebsd.org> <2368543.Vvp613SNcD@ralph.baldwin.cx> <684f4a82-f48c-b2bb-6a72-5c1dfea11a39@pix.net> <CAOtMX2iKmX9yOg5P5931E2JSRgS2QO4wRDuE8SmcvmR4JxO_Fw@mail.gmail.com> Cc: John Baldwin <jhb@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> From: Kurt Lidl <lidl@pix.net> Message-ID: <c70d1345-5073-0a53-c074-57f232dbdcc5@pix.net> Date: Mon, 23 May 2016 18:59:07 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <CAOtMX2iKmX9yOg5P5931E2JSRgS2QO4wRDuE8SmcvmR4JxO_Fw@mail.gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 22:59:08 -0000 On 5/23/16 4:30 PM, Alan Somers wrote: > On Fri, May 6, 2016 at 8:45 AM, Kurt Lidl <lidl@pix.net > <mailto:lidl@pix.net>> wrote: > > On 5/5/16 12:31 PM, John Baldwin wrote: > > On Wednesday, May 04, 2016 10:34:11 PM Alan Somers wrote: > > Author: asomers > Date: Wed May 4 22:34:11 2016 > New Revision: 299090 > URL: https://svnweb.freebsd.org/changeset/base/299090 > > Log: > Improve performance and functionality of the bitstring(3) api > > Two new functions are provided, bit_ffs_at() and > bit_ffc_at(), which allow > for efficient searching of set or cleared bits starting > from any bit offset > within the bit string. > > Performance is improved by operating on longs instead of > bytes and using > ffsl() for searches within a long. ffsl() is a compiler > builtin in both > clang and gcc for most architectures, converting what was > a brute force > while loop search into a couple of instructions. > > All of the bitstring(3) API continues to be contained in > the header file. > Some of the functions are large enough that perhaps they > should be uninlined > and moved to a library, but that is beyond the scope of > this commit. > > > Doesn't switching from bytes to longs break the ABI? That is, > setting bit 9 > now has a different representation on big-endian systems (0x00 > 0x01 before, > now 0x00 0x00 0x01 0x00 on 32-bit BE, and 4 more leading 0 bytes > on 64-bit). > This means you can't have an object file compiled against the > old header > pass a bitstring to an object file compiled against the new > header on big-endian > systems. > > Even on little-endian systems if an old object file allocates > storage for a > bitstring the new code might read off the end of it and fault > (or return > garbage if bits are set in the extra bytes it reads off the end)? > > Is the API is so little used we don't care? > > > Just as a note - at my prior job (Pi-Coral, now defunct) we used this > API everywhere in the dataplane code of our product. Since the company > is gone, that particular use-case doesn't matter anymore. > > At the very least, this deserves a mention in the release notes, and > also UPDATING! > > -Kurt > > > UPDATING is updated as of r300539. Any objection to merging this to > stable/10? Not to me - as I mentioned, the company went out of business, so catering to its needs is a NOP. Go for it! -Kurt From owner-svn-src-head@freebsd.org Mon May 23 23:00:49 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26834B47294; Mon, 23 May 2016 23:00:49 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8BEB1ED6; Mon, 23 May 2016 23:00:48 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NN0mHm022466; Mon, 23 May 2016 23:00:48 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NN0m3v022465; Mon, 23 May 2016 23:00:48 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201605232300.u4NN0m3v022465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim <jkim@FreeBSD.org> Date: Mon, 23 May 2016 23:00:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300543 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 23:00:49 -0000 Author: jkim Date: Mon May 23 23:00:47 2016 New Revision: 300543 URL: https://svnweb.freebsd.org/changeset/base/300543 Log: Document POPCNT erratum for 6th Generation Intel Core processors. Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon May 23 22:01:06 2016 (r300542) +++ head/sys/amd64/amd64/pmap.c Mon May 23 23:00:47 2016 (r300543) @@ -3139,6 +3139,7 @@ retry: * Reference numbers for erratas are * 4th Gen Core: HSD146 * 5th Gen Core: BDM85 + * 6th Gen Core: SKL029 */ static int popcnt_pc_map_elem_pq(uint64_t elem) From owner-svn-src-head@freebsd.org Mon May 23 23:13:14 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FE87B475AA; Mon, 23 May 2016 23:13:14 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 5CB41196E; Mon, 23 May 2016 23:13:14 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 569C51827; Mon, 23 May 2016 23:13:14 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 12A541CEA8; Mon, 23 May 2016 23:13:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id JwrG2wbtvTnT; Mon, 23 May 2016 23:13:11 +0000 (UTC) Subject: Re: svn commit: r299090 - in head: etc/mtree include lib/libbluetooth sbin/hastd share/man/man3 sys/dev/xen/blkback sys/kern sys/net sys/sys tests/sys tests/sys/sys usr.sbin/bluetooth/hccontrol DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 047331CEA0 To: Alan Somers <asomers@freebsd.org>, Kurt Lidl <lidl@pix.net> References: <201605042234.u44MYBMX054443@repo.freebsd.org> <2368543.Vvp613SNcD@ralph.baldwin.cx> <684f4a82-f48c-b2bb-6a72-5c1dfea11a39@pix.net> <CAOtMX2iKmX9yOg5P5931E2JSRgS2QO4wRDuE8SmcvmR4JxO_Fw@mail.gmail.com> Cc: John Baldwin <jhb@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> From: Bryan Drewery <bdrewery@FreeBSD.org> Organization: FreeBSD Message-ID: <8074ef26-cb70-2397-b71e-b897a1270d22@FreeBSD.org> Date: Mon, 23 May 2016 16:13:08 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <CAOtMX2iKmX9yOg5P5931E2JSRgS2QO4wRDuE8SmcvmR4JxO_Fw@mail.gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 23:13:14 -0000 On 5/23/16 1:30 PM, Alan Somers wrote: > UPDATING is updated as of r300539. Any objection to merging this to > stable/10? If any port uses it then yes. Binaries are built from 10.1 and expected to work on 10.1, 10.2, 10.3, 10.4, etc. -- Regards, Bryan Drewery From owner-svn-src-head@freebsd.org Mon May 23 23:34:42 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F22EB47B1E; Mon, 23 May 2016 23:34:42 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi0-x233.google.com (mail-oi0-x233.google.com [IPv6:2607:f8b0:4003:c06::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3F52812DA; Mon, 23 May 2016 23:34:42 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi0-x233.google.com with SMTP id k23so961547oih.0; Mon, 23 May 2016 16:34:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=/04Rh7AcMXLau9xbrToIzd2Xa4nz7pcnZ4VtqDBeRa4=; b=tDioSeepRZJAK0m1lNyYxj+Nj4DTip5dVRYLrJHBBF6lgfOtZ+mUoFaltaZqzQWWm/ 7wZZa6NuoTvsZWfBOE4ivvzMowmyFrWC0mdvBCKWVQ/jdMBUV6JkDAccLRzfYDWrYq/g Lj1SKAmKV7VAjkfdD+T3hMSCvhC7YjHK7dh6XthAz1tHlz8JpyrKByX2psHwp0dehgQc i4m1nxczDnLhkAFXXxvIf0SLuynHAlBbR5JZ5FKpW305yWaoRuhJOpBr65qrmSCQYTWy Kw9xmPPnEUHtzdIQVlSJwRm7OX32p+weByIPiflZEbS5Jks3jwWMPfuX+pXEXOuGyJ6p Yc+w== 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:date :message-id:subject:from:to:cc; bh=/04Rh7AcMXLau9xbrToIzd2Xa4nz7pcnZ4VtqDBeRa4=; b=DEx2rRdaqqawkjQpO5Tbe4cSPXiMff1EnyO7RTzLGmxt+XVwmcgwygydLFri/HkSJr k+bY0zjug19YQK0PQ0yVxdGtCKIVHBZ3FDwwZgOKg0OdY7Rnlfg7iyJSSPK7iTDuZTPy aipFZ4RN30rZbYtrwJHKlfF16Im/iHz9CEHP96haAuy6n4cINrServSmFkUNOhXQa5Xg gNyOd79ZM6ukOsLfuORwju3lcGpxQTArlJij6io/77S8xquvUklbr/t/SfcJAn8+Uk1X 23U0ShB0ELemVFaoncQYp2fMDWSaKW+erMLkWO5jYIqjnN9sv4syCzkafg64xU3u2/5J kbTg== X-Gm-Message-State: ALyK8tI9vR8kgu9c7C5z+jG2SCpk1uLB3Wx3whvE/PCwqenzM4lnCh1ArSTgdcD4xy+cJAvnFoyp+S5eFZHW0w== MIME-Version: 1.0 X-Received: by 10.157.34.12 with SMTP id o12mr948254ota.55.1464046481509; Mon, 23 May 2016 16:34:41 -0700 (PDT) Sender: asomers@gmail.com Received: by 10.202.4.200 with HTTP; Mon, 23 May 2016 16:34:41 -0700 (PDT) In-Reply-To: <8074ef26-cb70-2397-b71e-b897a1270d22@FreeBSD.org> References: <201605042234.u44MYBMX054443@repo.freebsd.org> <2368543.Vvp613SNcD@ralph.baldwin.cx> <684f4a82-f48c-b2bb-6a72-5c1dfea11a39@pix.net> <CAOtMX2iKmX9yOg5P5931E2JSRgS2QO4wRDuE8SmcvmR4JxO_Fw@mail.gmail.com> <8074ef26-cb70-2397-b71e-b897a1270d22@FreeBSD.org> Date: Mon, 23 May 2016 17:34:41 -0600 X-Google-Sender-Auth: WE6t_rpuZlYsCRxRAjqkar7yTEo Message-ID: <CAOtMX2iJPZS8YY6sLZVi4SsCPYJH6LVtu0Lgj5MWbsP73Jt8Tw@mail.gmail.com> Subject: Re: svn commit: r299090 - in head: etc/mtree include lib/libbluetooth sbin/hastd share/man/man3 sys/dev/xen/blkback sys/kern sys/net sys/sys tests/sys tests/sys/sys usr.sbin/bluetooth/hccontrol From: Alan Somers <asomers@freebsd.org> To: Bryan Drewery <bdrewery@freebsd.org> Cc: Kurt Lidl <lidl@pix.net>, John Baldwin <jhb@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 23:34:42 -0000 On Mon, May 23, 2016 at 5:13 PM, Bryan Drewery <bdrewery@freebsd.org> wrote: > On 5/23/16 1:30 PM, Alan Somers wrote: > > UPDATING is updated as of r300539. Any objection to merging this to > > stable/10? > > If any port uses it then yes. Binaries are built from 10.1 and expected > to work on 10.1, 10.2, 10.3, 10.4, etc. > > -- > Regards, > Bryan Drewery > Most ports that use bitstring should work. The only ports that won't are ports that either store bitstrings on disk or transmit them across a network without an explicit serialization step. A few other weird cases would break too, like building a port on 10.3, updating sys/bitstring.h, then rebuilding some object files but not others. Is there any way to figure out what ports might be using this header? OpenHub code search didn't turn up anything. -Alan From owner-svn-src-head@freebsd.org Mon May 23 23:53:44 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72230B47EB2; Mon, 23 May 2016 23:53:44 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ig0-f193.google.com (mail-ig0-f193.google.com [209.85.213.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 429331CC8; Mon, 23 May 2016 23:53:43 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ig0-f193.google.com with SMTP id c3so379792igl.3; Mon, 23 May 2016 16:53:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :date:message-id:subject:from:to:cc; bh=XMiH53Ea3uvy8C2dw1mMB38Hyx4iMOXuZGhCVaSdLAI=; b=X5YLfPUZaMvDMyOirFRsFzDQXFvnQNefLzIvUW43YZ2ZExVKq6YXH3qxXepD/lLCyg 0kA4ihI7YKzvOcLwt7AoLa+pL+GHrSlUsD0Ae6i++KiTu0wp7tgfLZJ9LhNq/yDEtilm 9+RGRI/KfRGJrJ08gOcF86qZjSQt/HhCEffO87/H0PxfEhNDD0CC4NfDeZMjRutVUzn5 2QMoLyct8FgO8KeoUr9Ckt82gblIhe+k6qABmYxIEZEzcLLE/k58V+GgKd74VUqqucmP 5CZt0e+x1NyFohv7uj43FeXKfP+bDntf/6SSgzHa2oSl9GP5CxAlMyEDX2juovT354dc 0chw== X-Gm-Message-State: ALyK8tJCDs0PRfkuP0Uq4oYR0TW27h2Lvj7+kvFmUXLQZp28/cVOaPlFFCGRu1LPc0ejiA== X-Received: by 10.50.228.47 with SMTP id sf15mr3680499igc.63.1464046938128; Mon, 23 May 2016 16:42:18 -0700 (PDT) Received: from mail-ig0-f179.google.com (mail-ig0-f179.google.com. [209.85.213.179]) by smtp.gmail.com with ESMTPSA id wh5sm4529189igb.19.2016.05.23.16.42.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 May 2016 16:42:17 -0700 (PDT) Received: by mail-ig0-f179.google.com with SMTP id bi2so43036295igb.0; Mon, 23 May 2016 16:42:17 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.50.4.101 with SMTP id j5mr15337130igj.8.1464046937141; Mon, 23 May 2016 16:42:17 -0700 (PDT) Reply-To: cem@FreeBSD.org Received: by 10.36.205.70 with HTTP; Mon, 23 May 2016 16:42:17 -0700 (PDT) In-Reply-To: <CAOtMX2iJPZS8YY6sLZVi4SsCPYJH6LVtu0Lgj5MWbsP73Jt8Tw@mail.gmail.com> References: <201605042234.u44MYBMX054443@repo.freebsd.org> <2368543.Vvp613SNcD@ralph.baldwin.cx> <684f4a82-f48c-b2bb-6a72-5c1dfea11a39@pix.net> <CAOtMX2iKmX9yOg5P5931E2JSRgS2QO4wRDuE8SmcvmR4JxO_Fw@mail.gmail.com> <8074ef26-cb70-2397-b71e-b897a1270d22@FreeBSD.org> <CAOtMX2iJPZS8YY6sLZVi4SsCPYJH6LVtu0Lgj5MWbsP73Jt8Tw@mail.gmail.com> Date: Mon, 23 May 2016 16:42:17 -0700 X-Gmail-Original-Message-ID: <CAG6CVpXAfbf_bONUh9nsonEUpT+14zMfp6saRZTmVAjHJB1isw@mail.gmail.com> Message-ID: <CAG6CVpXAfbf_bONUh9nsonEUpT+14zMfp6saRZTmVAjHJB1isw@mail.gmail.com> Subject: Re: svn commit: r299090 - in head: etc/mtree include lib/libbluetooth sbin/hastd share/man/man3 sys/dev/xen/blkback sys/kern sys/net sys/sys tests/sys tests/sys/sys usr.sbin/bluetooth/hccontrol From: Conrad Meyer <cem@FreeBSD.org> To: Alan Somers <asomers@freebsd.org> Cc: Bryan Drewery <bdrewery@freebsd.org>, Kurt Lidl <lidl@pix.net>, John Baldwin <jhb@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 23 May 2016 23:53:44 -0000 On Mon, May 23, 2016 at 4:34 PM, Alan Somers <asomers@freebsd.org> wrote: > On Mon, May 23, 2016 at 5:13 PM, Bryan Drewery <bdrewery@freebsd.org> wrote: >> >> On 5/23/16 1:30 PM, Alan Somers wrote: >> > UPDATING is updated as of r300539. Any objection to merging this to >> > stable/10? >> >> If any port uses it then yes. Binaries are built from 10.1 and expected >> to work on 10.1, 10.2, 10.3, 10.4, etc. > > > Most ports that use bitstring should work. The only ports that won't are > ports that either store bitstrings on disk or transmit them across a network > without an explicit serialization step. A few other weird cases would break > too, like building a port on 10.3, updating sys/bitstring.h, then rebuilding > some object files but not others. Is there any way to figure out what ports > might be using this header? OpenHub code search didn't turn up anything. It seems to me like this is exactly the sort of ABI breakage the stable/* branches promise not to make. On the other hand, it seems to me like the majority of the benefit of this patch could be gained without breaking ABI. (Optimistically iterate longs rather than bytes if the pointer's alignment is suitable.) Best, Conrad From owner-svn-src-head@freebsd.org Tue May 24 00:15:00 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A572B476E5; Tue, 24 May 2016 00:15:00 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D08EE1960; Tue, 24 May 2016 00:14:59 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O0Ex2V045500; Tue, 24 May 2016 00:14:59 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O0EwKT045498; Tue, 24 May 2016 00:14:58 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201605240014.u4O0EwKT045498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers <asomers@FreeBSD.org> Date: Tue, 24 May 2016 00:14:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300544 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 00:15:00 -0000 Author: asomers Date: Tue May 24 00:14:58 2016 New Revision: 300544 URL: https://svnweb.freebsd.org/changeset/base/300544 Log: Fix build of kern/subr_unit.c, broken by r300539 Reported by: peter Pointyhat to: asomers Sponsored by: Spectra Logic Corp Modified: head/sys/kern/subr_unit.c head/sys/sys/bitstring.h Modified: head/sys/kern/subr_unit.c ============================================================================== --- head/sys/kern/subr_unit.c Mon May 23 23:00:47 2016 (r300543) +++ head/sys/kern/subr_unit.c Tue May 24 00:14:58 2016 (r300544) @@ -984,9 +984,9 @@ main(int argc, char **argv) struct unrhdr *uh; char *a; long count = 10000; /* Number of unrs to test */ - long reps = 1; + long reps = 1, m; int ch; - u_int i, x, m, j; + u_int i, x, j; verbose = false; @@ -1043,7 +1043,7 @@ main(int argc, char **argv) print_unrhdr(uh); check_unrhdr(uh, __LINE__); } - for (i = 0; i < count; i++) { + for (i = 0; i < (u_int)count; i++) { if (a[i]) { if (verbose) { printf("C %u\n", i); Modified: head/sys/sys/bitstring.h ============================================================================== --- head/sys/sys/bitstring.h Mon May 23 23:00:47 2016 (r300543) +++ head/sys/sys/bitstring.h Tue May 24 00:14:58 2016 (r300544) @@ -65,9 +65,10 @@ #ifdef _KERNEL #include <sys/libkern.h> #include <sys/malloc.h> -#include <sys/types.h> #endif +#include <sys/types.h> + typedef unsigned long bitstr_t; /*---------------------- Private Implementation Details ----------------------*/ From owner-svn-src-head@freebsd.org Tue May 24 00:22:30 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F98EB47987; Tue, 24 May 2016 00:22:30 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 17CEC1E0C; Tue, 24 May 2016 00:22:30 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O0MT2h048398; Tue, 24 May 2016 00:22:29 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O0MTTG048397; Tue, 24 May 2016 00:22:29 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201605240022.u4O0MTTG048397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude <allanjude@FreeBSD.org> Date: Tue, 24 May 2016 00:22:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300545 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 00:22:30 -0000 Author: allanjude Date: Tue May 24 00:22:29 2016 New Revision: 300545 URL: https://svnweb.freebsd.org/changeset/base/300545 Log: Add support for RAID 1+0 (striped mirrors) to bsdinstall/zfsboot Sponsored by: ScaleEngine Inc. Modified: head/usr.sbin/bsdinstall/scripts/zfsboot Modified: head/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- head/usr.sbin/bsdinstall/scripts/zfsboot Tue May 24 00:14:58 2016 (r300544) +++ head/usr.sbin/bsdinstall/scripts/zfsboot Tue May 24 00:22:29 2016 (r300545) @@ -272,6 +272,7 @@ msg_not_enough_disks_selected="Not enoug msg_null_disk_argument="NULL disk argument" msg_null_index_argument="NULL index argument" msg_null_poolname="NULL poolname" +msg_odd_disk_selected="An even number of disks must be selected to create a RAID 1+0. (%u selected)" msg_ok="OK" msg_partition_scheme="Partition Scheme" msg_partition_scheme_help="Select partitioning scheme. GPT is recommended." @@ -284,6 +285,8 @@ msg_pool_name_help="Customize the name o msg_pool_type_disks="Pool Type/Disks:" msg_pool_type_disks_help="Choose type of ZFS Virtual Device and disks to use (Required)" msg_processing_selection="Processing selection..." +msg_raid10_desc="RAID 1+0 - n x 2-Way Mirrors" +msg_raid10_help="[4+ Disks] Striped Mirrors provides the best performance, but the least storage" msg_raidz1_desc="RAID-Z1 - Single Redundant RAID" msg_raidz1_help="[3+ Disks] Withstand failure of 1 disk. Recommended for: 3, 5 or 9 disks" msg_raidz2_desc="RAID-Z2 - Double Redundant RAID" @@ -478,6 +481,7 @@ dialog_menu_layout() local vdev_menu_list=" 'stripe' '$msg_stripe_desc' '$msg_stripe_help' 'mirror' '$msg_mirror_desc' '$msg_mirror_help' + 'raid10' '$msg_raid10_desc' '$msg_raid10_help' 'raidz1' '$msg_raidz1_desc' '$msg_raidz1_help' 'raidz2' '$msg_raidz2_desc' '$msg_raidz2_help' 'raidz3' '$msg_raidz3_desc' '$msg_raidz3_help' @@ -488,7 +492,7 @@ dialog_menu_layout() # Warn the user if vdev type is not valid case "$ZFSBOOT_VDEV_TYPE" in - stripe|mirror|raidz1|raidz2|raidz3) : known good ;; + stripe|mirror|raid10|raidz1|raidz2|raidz3) : known good ;; *) f_dprintf "%s: Invalid virtual device type \`%s'" \ $funcname "$ZFSBOOT_VDEV_TYPE" @@ -575,6 +579,7 @@ dialog_menu_layout() case "$ZFSBOOT_VDEV_TYPE" in stripe) want_disks=1 ;; mirror) want_disks=2 ;; + raid10) want_disks=4 ;; raidz1) want_disks=3 ;; raidz2) want_disks=4 ;; raidz3) want_disks=5 ;; @@ -683,6 +688,21 @@ dialog_menu_layout() "$ZFSBOOT_DISKS" f_count ndisks $ZFSBOOT_DISKS + + if [ "$ZFSBOOT_VDEV_TYPE" == "raid10" ] && + [ $(( $ndisks % 2 )) -ne 0 ]; then + f_dprintf "$funcname: %s: %s (%u %% 2 = %u)" \ + "$ZFSBOOT_VDEV_TYPE" \ + "Number of disks not even:" \ + $ndisks $(( $ndisks % 2 )) + msg_yes="$msg_change_selection" \ + msg_no="$msg_cancel" \ + f_yesno "%s: $msg_odd_disk_selected" \ + "$ZFSBOOT_VDEV_TYPE" $ndisks || + break + continue + fi + [ $ndisks -ge $want_disks ] && breakout=break && break @@ -1271,10 +1291,25 @@ zfs_create_boot() # f_dprintf "$funcname: Creating root pool..." create_options="$ZFSBOOT_POOL_CREATE_OPTIONS" - f_eval_catch $funcname zpool "$ZPOOL_CREATE_WITH_OPTIONS" \ - "-o altroot=$BSDINSTALL_CHROOT $create_options -m none -f" \ - "$zroot_name" "$zroot_vdevtype" "$zroot_vdevs" || - return $FAILURE + if [ "$zroot_vdevtype" == "raid10" ]; then + raid10_vdevs="" + for vdev in $zroot_vdevs; do + f_count nvdev $raid10_vdevs + if [ $(( $nvdev % 3 )) -eq 0 ]; then + raid10_vdevs="$raid10_vdevs mirror" + fi + raid10_vdevs="$raid10_vdevs $vdev" + done + f_eval_catch $funcname zpool "$ZPOOL_CREATE_WITH_OPTIONS" \ + "-o altroot=$BSDINSTALL_CHROOT $create_options -m none -f" \ + "$zroot_name" "" "$raid10_vdevs" || + return $FAILURE + else + f_eval_catch $funcname zpool "$ZPOOL_CREATE_WITH_OPTIONS" \ + "-o altroot=$BSDINSTALL_CHROOT $create_options -m none -f" \ + "$zroot_name" "$zroot_vdevtype" "$zroot_vdevs" || + return $FAILURE + fi # # Create ZFS dataset layout within the new root pool From owner-svn-src-head@freebsd.org Tue May 24 00:23:40 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54D21B47A50; Tue, 24 May 2016 00:23:40 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 26CC81045; Tue, 24 May 2016 00:23:40 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O0Nd5v048478; Tue, 24 May 2016 00:23:39 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O0Ndws048477; Tue, 24 May 2016 00:23:39 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201605240023.u4O0Ndws048477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude <allanjude@FreeBSD.org> Date: Tue, 24 May 2016 00:23:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300546 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 00:23:40 -0000 Author: allanjude Date: Tue May 24 00:23:39 2016 New Revision: 300546 URL: https://svnweb.freebsd.org/changeset/base/300546 Log: Only set kern.geom.part.mbr.enforce_chs=0 once, instead of once per disk Sponsored by: ScaleEngine Inc. Modified: head/usr.sbin/bsdinstall/scripts/zfsboot Modified: head/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- head/usr.sbin/bsdinstall/scripts/zfsboot Tue May 24 00:22:29 2016 (r300545) +++ head/usr.sbin/bsdinstall/scripts/zfsboot Tue May 24 00:23:39 2016 (r300546) @@ -806,7 +806,6 @@ zfs_create_diskpart() if [ "$ZFSBOOT_FORCE_4K_SECTORS" ]; then align_small="-a 4k" align_big="-a 1m" - sysctl kern.geom.part.mbr.enforce_chs=0 fi case "$ZFSBOOT_PARTITION_SCHEME" in @@ -1133,6 +1132,7 @@ zfs_create_boot() f_dprintf "$funcname: With 4K sectors..." f_eval_catch $funcname sysctl "$SYSCTL_ZFS_MIN_ASHIFT_12" \ || return $FAILURE + sysctl kern.geom.part.mbr.enforce_chs=0 fi local n=0 for disk in $disks; do From owner-svn-src-head@freebsd.org Tue May 24 00:57:13 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 719EFB4810E; Tue, 24 May 2016 00:57:13 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 376401F0E; Tue, 24 May 2016 00:57:13 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O0vCDW057684; Tue, 24 May 2016 00:57:12 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O0vBfL057675; Tue, 24 May 2016 00:57:11 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605240057.u4O0vBfL057675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Tue, 24 May 2016 00:57:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300547 - in head: lib/libcam sbin/camcontrol sbin/iscontrol sys/cam usr.sbin/camdd usr.sbin/mptutil X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 00:57:13 -0000 Author: truckman Date: Tue May 24 00:57:11 2016 New Revision: 300547 URL: https://svnweb.freebsd.org/changeset/base/300547 Log: Fix multiple Coverity Out-of-bounds access false postive issues in CAM The currently used idiom for clearing the part of a ccb after its header generates one or two Coverity errors for each time it is used. All instances generate an Out-of-bounds access (ARRAY_VS_SINGLETON) error because of the treatment of the header as a two element array, with a pointer to the non-existent second element being passed as the starting address to bzero(). Some instances also alsp generate Out-of-bounds access (OVERRUN) errors, probably because the space being cleared is larger than the sizeofstruct ccb_hdr). In addition, this idiom is difficult for humans to understand and it is error prone. The user has to chose the proper struct ccb_* type (which does not appear in the surrounding code) for the sizeof() in the length calculation. I found several instances where the length was incorrect, which could cause either an actual out of bounds write, or incompletely clear the ccb. A better way is to write the code to clear the ccb itself starting at sizeof(ccb_hdr) bytes from the start of the ccb, and calculate the length based on the specific type of struct ccb_* being cleared as specified by the union ccb member being used. The latter can normally be seen in the nearby code. This is friendlier for Coverity and other static analysis tools because they will see that the intent is to clear the trailing part of the ccb. Wrap all of the boilerplate code in a convenient macro that only requires a pointer to the desired union ccb member (or a pointer to the union ccb itself) as an argument. Reported by: Coverity CID: 1007578, 1008684, 1009724, 1009773, 1011304, 1011306 CID: 1011307, 1011308, 1011309, 1011310, 1011311, 1011312 CID: 1011313, 1011314, 1011315, 1011316, 1011317, 1011318 CID: 1011319, 1011320, 1011321, 1011322, 1011324, 1011325 CID: 1011326, 1011327, 1011328, 1011329, 1011330, 1011374 CID: 1011390, 1011391, 1011392, 1011393, 1011394, 1011395 CID: 1011396, 1011397, 1011398, 1011399, 1011400, 1011401 CID: 1011402, 1011403, 1011404, 1011405, 1011406, 1011408 CID: 1011409, 1011410, 1011411, 1011412, 1011413, 1011414 CID: 1017461, 1018387, 1086860, 1086874, 1194257, 1229897 CID: 1229968, 1306229, 1306234, 1331282, 1331283, 1331294 CID: 1331295, 1331535, 1331536, 1331539, 1331540, 1341623 CID: 1341624, 1341637, 1341638, 1355264, 1355324 Reviewed by: scottl, ken, delphij, imp MFH: 1 month Differential Revision: https://reviews.freebsd.org/D6496 Modified: head/lib/libcam/camlib.c head/sbin/camcontrol/attrib.c head/sbin/camcontrol/camcontrol.c head/sbin/camcontrol/fwdownload.c head/sbin/camcontrol/persist.c head/sbin/iscontrol/fsm.c head/sys/cam/cam_ccb.h head/usr.sbin/camdd/camdd.c head/usr.sbin/mptutil/mpt_cam.c Modified: head/lib/libcam/camlib.c ============================================================================== --- head/lib/libcam/camlib.c Tue May 24 00:23:39 2016 (r300546) +++ head/lib/libcam/camlib.c Tue May 24 00:57:11 2016 (r300547) @@ -619,7 +619,7 @@ cam_real_open_device(const char *path, i /* * Zero the payload, the kernel does look at the flags. */ - bzero(&(&ccb.ccb_h)[1], sizeof(struct ccb_trans_settings)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb.cts); /* * Get transfer settings for this device. Modified: head/sbin/camcontrol/attrib.c ============================================================================== --- head/sbin/camcontrol/attrib.c Tue May 24 00:23:39 2016 (r300546) +++ head/sbin/camcontrol/attrib.c Tue May 24 00:57:11 2016 (r300547) @@ -137,8 +137,7 @@ scsiattrib(struct cam_device *device, in goto bailout; } - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); STAILQ_INIT(&write_attr_list); Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Tue May 24 00:23:39 2016 (r300546) +++ head/sbin/camcontrol/camcontrol.c Tue May 24 00:57:11 2016 (r300547) @@ -842,8 +842,7 @@ scsiinquiry(struct cam_device *device, i } /* cam_getccb cleans up the header, caller has to zero the payload */ - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); inq_buf = (struct scsi_inquiry_data *)malloc( sizeof(struct scsi_inquiry_data)); @@ -958,8 +957,7 @@ scsiserial(struct cam_device *device, in } /* cam_getccb cleans up the header, caller has to zero the payload */ - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); serial_buf = (struct scsi_vpd_unit_serial_number *) malloc(sizeof(*serial_buf)); @@ -1051,8 +1049,7 @@ camxferrate(struct cam_device *device) return(1); } - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_trans_settings) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cts); ccb->ccb_h.func_code = XPT_GET_TRAN_SETTINGS; ccb->cts.type = CTS_TYPE_CURRENT_SETTINGS; @@ -1605,8 +1602,7 @@ ata_do_pass_16(struct cam_device *device ata_flags |= AP_FLAG_TLEN_NO_DATA; } - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); scsi_ata_pass_16(&ccb->csio, retries, @@ -1667,8 +1663,7 @@ ata_do_28bit_cmd(struct cam_device *devi timeout, quiet); } - bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_ataio) - - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->ataio); cam_fill_ataio(&ccb->ataio, retries, NULL, @@ -1737,8 +1732,7 @@ ata_do_cmd(struct cam_device *device, un return (error); } - bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_ataio) - - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->ataio); cam_fill_ataio(&ccb->ataio, retries, NULL, @@ -3187,8 +3181,7 @@ rescan_or_reset_bus(path_id_t bus, int r * no-op, sending a rescan to the xpt bus would result in a status of * CAM_REQ_INVALID. */ - bzero(&(&matchccb.ccb_h)[1], - sizeof(struct ccb_dev_match) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&matchccb.cdm); matchccb.ccb_h.func_code = XPT_DEV_MATCH; matchccb.ccb_h.path_id = CAM_BUS_WILDCARD; bufsize = sizeof(struct dev_match_result) * 20; @@ -3536,8 +3529,7 @@ next_batch: * cam_getccb() zeros the CCB header only. So we need to zero the * payload portion of the ccb. */ - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); scsi_read_defects(&ccb->csio, /*retries*/ retry_count, @@ -3990,8 +3982,7 @@ mode_sense(struct cam_device *device, in if (ccb == NULL) errx(1, "mode_sense: couldn't allocate CCB"); - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); scsi_mode_sense(&ccb->csio, /* retries */ retry_count, @@ -4040,8 +4031,7 @@ mode_select(struct cam_device *device, i if (ccb == NULL) errx(1, "mode_select: couldn't allocate CCB"); - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); scsi_mode_select(&ccb->csio, /* retries */ retry_count, @@ -4158,8 +4148,7 @@ scsicmd(struct cam_device *device, int a return(1); } - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(ccb); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { @@ -4660,8 +4649,7 @@ tagcontrol(struct cam_device *device, in cam_path_string(device, pathstr, sizeof(pathstr)); if (numtags >= 0) { - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_relsim) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->crs); ccb->ccb_h.func_code = XPT_REL_SIMQ; ccb->ccb_h.flags = CAM_DEV_QFREEZE; ccb->crs.release_flags = RELSIM_ADJUST_OPENINGS; @@ -4688,8 +4676,7 @@ tagcontrol(struct cam_device *device, in pathstr, ccb->crs.openings); } - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_getdevstats) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cgds); ccb->ccb_h.func_code = XPT_GDEV_STATS; @@ -4889,8 +4876,7 @@ get_cpi(struct cam_device *device, struc warnx("get_cpi: couldn't allocate CCB"); return(1); } - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_pathinq) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cpi); ccb->ccb_h.func_code = XPT_PATH_INQ; if (cam_send_ccb(device, ccb) < 0) { warn("get_cpi: error sending Path Inquiry CCB"); @@ -4928,8 +4914,7 @@ get_cgd(struct cam_device *device, struc warnx("get_cgd: couldn't allocate CCB"); return(1); } - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_pathinq) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cgd); ccb->ccb_h.func_code = XPT_GDEV_TYPE; if (cam_send_ccb(device, ccb) < 0) { warn("get_cgd: error sending Path Inquiry CCB"); @@ -4974,8 +4959,7 @@ dev_has_vpd_page(struct cam_device *dev, } /* cam_getccb cleans up the header, caller has to zero the payload */ - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); bzero(&sup_pages, sizeof(sup_pages)); @@ -5449,8 +5433,7 @@ get_print_cts(struct cam_device *device, return(1); } - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_trans_settings) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cts); ccb->ccb_h.func_code = XPT_GET_TRAN_SETTINGS; @@ -5590,8 +5573,7 @@ ratecontrol(struct cam_device *device, i break; } } - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_pathinq) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cpi); /* * Grab path inquiry information, so we can determine whether * or not the initiator is capable of the things that the user @@ -5617,8 +5599,7 @@ ratecontrol(struct cam_device *device, i goto ratecontrol_bailout; } bcopy(&ccb->cpi, &cpi, sizeof(struct ccb_pathinq)); - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_trans_settings) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cts); if (quiet == 0) { fprintf(stdout, "%s parameters:\n", user_settings ? "User" : "Current"); @@ -5871,8 +5852,7 @@ scsiformat(struct cam_device *device, in return(1); } - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { @@ -6020,8 +6000,7 @@ doreport: do { cam_status status; - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); /* * There's really no need to do error recovery or @@ -6168,8 +6147,7 @@ scsisanitize(struct cam_device *device, return(1); } - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { @@ -6430,8 +6408,7 @@ doreport: do { cam_status status; - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); /* * There's really no need to do error recovery or @@ -6573,8 +6550,7 @@ scsireportluns(struct cam_device *device return (1); } - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); countonly = 0; lunsonly = 0; @@ -6822,8 +6798,7 @@ scsireadcapacity(struct cam_device *devi return (1); } - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { @@ -7027,8 +7002,7 @@ smpcmd(struct cam_device *device, int ar return (1); } - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { @@ -7221,8 +7195,7 @@ smpreportgeneral(struct cam_device *devi return (1); } - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { @@ -7284,8 +7257,7 @@ try_long: if ((response->long_response & SMP_RG_LONG_RESPONSE) && (long_response == 0)) { ccb->ccb_h.status = CAM_REQ_INPROG; - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio); long_response = 1; goto try_long; } @@ -7367,8 +7339,7 @@ smpphycontrol(struct cam_device *device, return (1); } - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { @@ -7625,8 +7596,7 @@ smpmaninfo(struct cam_device *device, in return (1); } - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { @@ -7720,8 +7690,7 @@ getdevid(struct cam_devitem *item) goto bailout; } - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cdai); /* * On the first try, we just probe for the size of the data, and @@ -8006,8 +7975,7 @@ smpphylist(struct cam_device *device, in return (1); } - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio); STAILQ_INIT(&devlist.dev_queue); rgrequest = malloc(sizeof(*rgrequest)); @@ -8111,8 +8079,7 @@ smpphylist(struct cam_device *device, in char tmpstr[256]; int j; - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio); ccb->ccb_h.status = CAM_REQ_INPROG; ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; @@ -8401,8 +8368,7 @@ scsigetopcodes(struct cam_device *device } /* cam_getccb cleans up the header, caller has to zero the payload */ - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); if (opcode_set != 0) { options |= RSO_OPTIONS_OC; @@ -8841,8 +8807,7 @@ scsireprobe(struct cam_device *device) return (1); } - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); ccb->ccb_h.func_code = XPT_REPROBE_LUN; Modified: head/sbin/camcontrol/fwdownload.c ============================================================================== --- head/sbin/camcontrol/fwdownload.c Tue May 24 00:23:39 2016 (r300546) +++ head/sbin/camcontrol/fwdownload.c Tue May 24 00:57:11 2016 (r300547) @@ -459,8 +459,7 @@ fw_validate_ibm(struct cam_device *dev, } /* cam_getccb cleans up the header, caller has to zero the payload */ - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); bzero(&vpd_page, sizeof(vpd_page)); @@ -666,8 +665,7 @@ fw_check_device_ready(struct cam_device goto bailout; } - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(ccb); if (devtype != CC_DT_SCSI) { dxfer_len = sizeof(struct ata_params); @@ -798,8 +796,7 @@ fw_download_img(struct cam_device *cam_d goto bailout; } - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(ccb); max_pkt_size = vp->max_pkt_size; if (max_pkt_size == 0) @@ -830,8 +827,7 @@ fw_download_img(struct cam_device *cam_d vp->cdb_byte2; cdb.buffer_id = vp->inc_cdb_buffer_id ? pkt_count : 0; /* Zero out payload of ccb union after ccb header. */ - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); /* * Copy previously constructed cdb into ccb_scsiio * struct. Modified: head/sbin/camcontrol/persist.c ============================================================================== --- head/sbin/camcontrol/persist.c Tue May 24 00:23:39 2016 (r300546) +++ head/sbin/camcontrol/persist.c Tue May 24 00:57:11 2016 (r300547) @@ -450,8 +450,7 @@ scsipersist(struct cam_device *device, i goto bailout; } - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { Modified: head/sbin/iscontrol/fsm.c ============================================================================== --- head/sbin/iscontrol/fsm.c Tue May 24 00:23:39 2016 (r300546) +++ head/sbin/iscontrol/fsm.c Tue May 24 00:57:11 2016 (r300547) @@ -372,7 +372,7 @@ doCAM(isess_t *sess) debug(2, "pathstr=%s", pathstr); ccb = cam_getccb(sess->camdev); - bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_relsim) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->crs); ccb->ccb_h.func_code = XPT_REL_SIMQ; ccb->crs.release_flags = RELSIM_ADJUST_OPENINGS; ccb->crs.openings = sess->op->tags; Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Tue May 24 00:23:39 2016 (r300546) +++ head/sys/cam/cam_ccb.h Tue May 24 00:57:11 2016 (r300547) @@ -1230,6 +1230,10 @@ union ccb { struct ccb_async casync; }; +#define CCB_CLEAR_ALL_EXCEPT_HDR(ccbp) \ + bzero((char *)(ccbp) + sizeof((ccbp)->ccb_h), \ + sizeof(*(ccbp)) - sizeof((ccbp)->ccb_h)) + __BEGIN_DECLS static __inline void cam_fill_csio(struct ccb_scsiio *csio, u_int32_t retries, Modified: head/usr.sbin/camdd/camdd.c ============================================================================== --- head/usr.sbin/camdd/camdd.c Tue May 24 00:23:39 2016 (r300546) +++ head/usr.sbin/camdd/camdd.c Tue May 24 00:57:11 2016 (r300547) @@ -1305,8 +1305,7 @@ camdd_probe_pass(struct cam_device *cam_ goto bailout; } - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); scsi_read_capacity(&ccb->csio, /*retries*/ probe_retry_count, @@ -1387,8 +1386,7 @@ rcap_done: goto bailout_error; } - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cpi); ccb->ccb_h.func_code = XPT_PATH_INQ; ccb->ccb_h.flags = CAM_DIR_NONE; @@ -2439,8 +2437,7 @@ camdd_pass_run(struct camdd_dev *dev) data = &buf->buf_type_spec.data; ccb = &data->ccb; - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); /* * In almost every case the number of blocks should be the device Modified: head/usr.sbin/mptutil/mpt_cam.c ============================================================================== --- head/usr.sbin/mptutil/mpt_cam.c Tue May 24 00:23:39 2016 (r300546) +++ head/usr.sbin/mptutil/mpt_cam.c Tue May 24 00:57:11 2016 (r300547) @@ -241,8 +241,7 @@ fetch_scsi_capacity(struct cam_device *d return (ENOMEM); /* Zero the rest of the ccb. */ - bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_scsiio) - - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); scsi_read_capacity(&ccb->csio, 1, NULL, MSG_SIMPLE_Q_TAG, &rcap, SSD_FULL_SIZE, 5000); @@ -273,8 +272,7 @@ fetch_scsi_capacity(struct cam_device *d } /* Zero the rest of the ccb. */ - bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_scsiio) - - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); scsi_read_capacity_16(&ccb->csio, 1, NULL, MSG_SIMPLE_Q_TAG, 0, 0, 0, (uint8_t *)&rcaplong, sizeof(rcaplong), SSD_FULL_SIZE, 5000); @@ -355,8 +353,7 @@ fetch_scsi_inquiry(struct cam_device *de return (ENOMEM); /* Zero the rest of the ccb. */ - bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_scsiio) - - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); inq_buf = calloc(1, sizeof(*inq_buf)); if (inq_buf == NULL) { From owner-svn-src-head@freebsd.org Tue May 24 01:12:21 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F823B4860C; Tue, 24 May 2016 01:12:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E8791BF5; Tue, 24 May 2016 01:12:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O1CKtP063658; Tue, 24 May 2016 01:12:20 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O1CJOt063645; Tue, 24 May 2016 01:12:19 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605240112.u4O1CJOt063645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Tue, 24 May 2016 01:12:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300548 - in head/sys: conf dev/bhnd dev/bhnd/bhndb dev/bhnd/cores/chipc dev/bhnd/nvram dev/bhnd/siba modules/bhnd modules/bhnd/cores/bhnd_chipc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 01:12:21 -0000 Author: adrian Date: Tue May 24 01:12:19 2016 New Revision: 300548 URL: https://svnweb.freebsd.org/changeset/base/300548 Log: [bhnd] Implement pass-through resource management for ChipCommon. This patchset adds support to bhnd_chipc for sharing SYS_RES_MEMORY resources with its children, allowing us to hang devices off of bhnd_chipc that rely on access to a subset of the device register space that bhnd_chipc itself must also allocate. We could avoid most of this heavy lifting if RF_SHAREABLE+SYS_RES_MEMORY wasn't limited to use with allocations at the same size/offset. As a work-around, I implemented something similar to vga_pci.c, which implements similar reference counting of of PCI BAR resources for its children. With these changes, chipc will use reference counting of SYS_RES_MEMORY allocation/activation requests, to decide when to allocate/activate/ deactivate/release resources from the parent bhnd(4) bus. The requesting child device is allocated a new resource from chipc's rman, pointing to (possibly a subregion of) the refcounted bhnd resources allocated by chipc. Other resource types are just passed directly to the parent bhnd bus; RF_SHAREABLE works just fine with IRQs. I also lifted the SPROM device code out into a common driver, since this now allows me to hang simple subclasses off of a common driver off of both bhndb_pci and bhnd_chipc. Tested: * (landonf) Tested against BCM4331 and BCM4312, confirmed that SPROM still attaches and can be queried. Submitted by: Landon Fuller <landonf@landonf.org> Reviewed by: mizkha@gmail.com Differential Revision: https://reviews.freebsd.org/D6471 Added: head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c (contents, props changed) head/sys/dev/bhnd/cores/chipc/chipc_private.h (contents, props changed) head/sys/dev/bhnd/cores/chipc/chipc_subr.c (contents, props changed) head/sys/dev/bhnd/nvram/bhnd_sprom_subr.c - copied, changed from r300546, head/sys/dev/bhnd/nvram/bhnd_sprom.c Modified: head/sys/conf/files head/sys/dev/bhnd/bhnd_subr.c head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c head/sys/dev/bhnd/cores/chipc/bhnd_chipc_if.m head/sys/dev/bhnd/cores/chipc/chipc.c head/sys/dev/bhnd/cores/chipc/chipc.h head/sys/dev/bhnd/cores/chipc/chipcreg.h head/sys/dev/bhnd/cores/chipc/chipcvar.h head/sys/dev/bhnd/nvram/bhnd_nvram.h head/sys/dev/bhnd/nvram/bhnd_sprom.c head/sys/dev/bhnd/nvram/bhnd_spromvar.h head/sys/dev/bhnd/siba/siba.c head/sys/dev/bhnd/siba/siba_subr.c head/sys/dev/bhnd/siba/sibavar.h head/sys/modules/bhnd/Makefile head/sys/modules/bhnd/cores/bhnd_chipc/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue May 24 00:57:11 2016 (r300547) +++ head/sys/conf/files Tue May 24 01:12:19 2016 (r300548) @@ -1139,7 +1139,9 @@ dev/bhnd/bcma/bcma_bhndb.c optional bhn dev/bhnd/bcma/bcma_erom.c optional bhndbus | bcma dev/bhnd/bcma/bcma_subr.c optional bhndbus | bcma dev/bhnd/cores/chipc/chipc.c optional bhndbus | bhnd +dev/bhnd/cores/chipc/chipc_subr.c optional bhndbus | bhnd dev/bhnd/cores/chipc/bhnd_chipc_if.m optional bhndbus | bhnd +dev/bhnd/cores/chipc/bhnd_sprom_chipc.c optional bhndbus | bhnd dev/bhnd/cores/pci/bhnd_pci.c optional bhndbus pci | bhnd pci dev/bhnd/cores/pci/bhnd_pci_hostb.c optional bhndbus pci | bhndb pci dev/bhnd/cores/pci/bhnd_pcib.c optional bhnd_pcib bhnd pci @@ -1148,6 +1150,7 @@ dev/bhnd/cores/pcie2/bhnd_pcie2_hostb.c dev/bhnd/cores/pcie2/bhnd_pcie2b.c optional bhnd_pcie2b bhnd pci dev/bhnd/nvram/bhnd_nvram_if.m optional bhndbus | bhnd dev/bhnd/nvram/bhnd_sprom.c optional bhndbus | bhnd +dev/bhnd/nvram/bhnd_sprom_subr.c optional bhndbus | bhnd dev/bhnd/nvram/nvram_subr.c optional bhndbus | bhnd dev/bhnd/siba/siba.c optional bhndbus | siba dev/bhnd/siba/siba_bhndb.c optional bhndbus | siba bhndb Modified: head/sys/dev/bhnd/bhnd_subr.c ============================================================================== --- head/sys/dev/bhnd/bhnd_subr.c Tue May 24 00:57:11 2016 (r300547) +++ head/sys/dev/bhnd/bhnd_subr.c Tue May 24 01:12:19 2016 (r300548) @@ -797,11 +797,11 @@ bhnd_parse_chipid(uint32_t idreg, bhnd_a struct bhnd_chipid result; /* Fetch the basic chip info */ - result.chip_id = CHIPC_GET_ATTR(idreg, ID_CHIP); - result.chip_pkg = CHIPC_GET_ATTR(idreg, ID_PKG); - result.chip_rev = CHIPC_GET_ATTR(idreg, ID_REV); - result.chip_type = CHIPC_GET_ATTR(idreg, ID_BUS); - result.ncores = CHIPC_GET_ATTR(idreg, ID_NUMCORE); + result.chip_id = CHIPC_GET_BITS(idreg, CHIPC_ID_CHIP); + result.chip_pkg = CHIPC_GET_BITS(idreg, CHIPC_ID_PKG); + result.chip_rev = CHIPC_GET_BITS(idreg, CHIPC_ID_REV); + result.chip_type = CHIPC_GET_BITS(idreg, CHIPC_ID_BUS); + result.ncores = CHIPC_GET_BITS(idreg, CHIPC_ID_NUMCORE); result.enum_addr = enum_addr; @@ -1020,15 +1020,11 @@ find_nvram_child(device_t dev) if (device_get_devclass(dev) != bhnd_devclass) return (NULL); - /* Look for a ChipCommon device */ + /* Look for a ChipCommon-attached NVRAM device */ if ((chipc = bhnd_find_child(dev, BHND_DEVCLASS_CC, -1)) != NULL) { - bhnd_nvram_src_t src; - - /* Query the NVRAM source and determine whether it's - * accessible via the ChipCommon device */ - src = BHND_CHIPC_NVRAM_SRC(chipc); - if (BHND_NVRAM_SRC_CC(src)) - return (chipc); + nvram = device_find_child(chipc, "bhnd_nvram", 0); + if (nvram != NULL) + return (nvram); } /* Not found */ Modified: head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c Tue May 24 00:57:11 2016 (r300547) +++ head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c Tue May 24 01:12:19 2016 (r300548) @@ -53,29 +53,15 @@ __FBSDID("$FreeBSD$"); #include <dev/bhnd/nvram/bhnd_spromvar.h> #include "bhnd_nvram_if.h" + #include "bhndb_pcireg.h" #include "bhndb_pcivar.h" -struct bhndb_pci_sprom_softc { - device_t dev; - struct bhnd_resource *sprom_res; /**< SPROM resource */ - int sprom_rid; /**< SPROM RID */ - struct bhnd_sprom shadow; /**< SPROM shadow */ - struct mtx mtx; /**< SPROM shadow mutex */ -}; - -#define SPROM_LOCK_INIT(sc) \ - mtx_init(&(sc)->mtx, device_get_nameunit((sc)->dev), \ - "BHND PCI SPROM lock", MTX_DEF) -#define SPROM_LOCK(sc) mtx_lock(&(sc)->mtx) -#define SPROM_UNLOCK(sc) mtx_unlock(&(sc)->mtx) -#define SPROM_LOCK_ASSERT(sc, what) mtx_assert(&(sc)->mtx, what) -#define SPROM_LOCK_DESTROY(sc) mtx_destroy(&(sc)->mtx) - static int bhndb_pci_sprom_probe(device_t dev) { device_t bridge, bus; + int error; /* Our parent must be a PCI-BHND bridge with an attached bhnd bus */ bridge = device_get_parent(dev); @@ -86,125 +72,23 @@ bhndb_pci_sprom_probe(device_t dev) if (bus == NULL) return (ENXIO); - /* Found */ - device_set_desc(dev, "PCI-BHNDB SPROM/OTP"); - if (!bootverbose) - device_quiet(dev); + /* Defer to default driver implementation */ + if ((error = bhnd_sprom_probe(dev)) > 0) + return (error); - /* Refuse wildcard attachments */ return (BUS_PROBE_NOWILDCARD); } -static int -bhndb_pci_sprom_attach(device_t dev) -{ - struct bhndb_pci_sprom_softc *sc; - int error; - - sc = device_get_softc(dev); - sc->dev = dev; - - /* Allocate SPROM resource */ - sc->sprom_rid = 0; - sc->sprom_res = bhnd_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->sprom_rid, RF_ACTIVE); - if (sc->sprom_res == NULL) { - device_printf(dev, "failed to allocate resources\n"); - return (ENXIO); - } - - /* Initialize SPROM shadow */ - if ((error = bhnd_sprom_init(&sc->shadow, sc->sprom_res, 0))) { - device_printf(dev, "unrecognized SPROM format\n"); - goto failed; - } - - /* Initialize mutex */ - SPROM_LOCK_INIT(sc); - - return (0); - -failed: - bhnd_release_resource(dev, SYS_RES_MEMORY, sc->sprom_rid, - sc->sprom_res); - return (error); -} - -static int -bhndb_pci_sprom_resume(device_t dev) -{ - return (0); -} - -static int -bhndb_pci_sprom_suspend(device_t dev) -{ - return (0); -} - -static int -bhndb_pci_sprom_detach(device_t dev) -{ - struct bhndb_pci_sprom_softc *sc; - - sc = device_get_softc(dev); - - bhnd_release_resource(dev, SYS_RES_MEMORY, sc->sprom_rid, - sc->sprom_res); - bhnd_sprom_fini(&sc->shadow); - SPROM_LOCK_DESTROY(sc); - - return (0); -} - -static int -bhndb_pci_sprom_getvar(device_t dev, const char *name, void *buf, size_t *len) -{ - struct bhndb_pci_sprom_softc *sc; - int error; - - sc = device_get_softc(dev); - - SPROM_LOCK(sc); - error = bhnd_sprom_getvar(&sc->shadow, name, buf, len); - SPROM_UNLOCK(sc); - - return (error); -} - -static int -bhndb_pci_sprom_setvar(device_t dev, const char *name, const void *buf, - size_t len) -{ - struct bhndb_pci_sprom_softc *sc; - int error; - - sc = device_get_softc(dev); - - SPROM_LOCK(sc); - error = bhnd_sprom_setvar(&sc->shadow, name, buf, len); - SPROM_UNLOCK(sc); - - return (error); -} static device_method_t bhndb_pci_sprom_methods[] = { /* Device interface */ DEVMETHOD(device_probe, bhndb_pci_sprom_probe), - DEVMETHOD(device_attach, bhndb_pci_sprom_attach), - DEVMETHOD(device_resume, bhndb_pci_sprom_resume), - DEVMETHOD(device_suspend, bhndb_pci_sprom_suspend), - DEVMETHOD(device_detach, bhndb_pci_sprom_detach), - - /* NVRAM interface */ - DEVMETHOD(bhnd_nvram_getvar, bhndb_pci_sprom_getvar), - DEVMETHOD(bhnd_nvram_setvar, bhndb_pci_sprom_setvar), - DEVMETHOD_END }; -DEFINE_CLASS_0(bhnd_nvram, bhndb_pci_sprom_driver, bhndb_pci_sprom_methods, sizeof(struct bhndb_pci_sprom_softc)); +DEFINE_CLASS_1(bhnd_nvram, bhndb_pci_sprom_driver, bhndb_pci_sprom_methods, sizeof(struct bhnd_sprom_softc), bhnd_sprom_driver); DRIVER_MODULE(bhndb_pci_sprom, bhndb, bhndb_pci_sprom_driver, bhnd_nvram_devclass, NULL, NULL); MODULE_DEPEND(bhndb_pci_sprom, bhnd, 1, 1, 1); +MODULE_DEPEND(bhndb_pci_sprom, bhnd_sprom, 1, 1, 1); MODULE_VERSION(bhndb_pci_sprom, 1); Modified: head/sys/dev/bhnd/cores/chipc/bhnd_chipc_if.m ============================================================================== --- head/sys/dev/bhnd/cores/chipc/bhnd_chipc_if.m Tue May 24 00:57:11 2016 (r300547) +++ head/sys/dev/bhnd/cores/chipc/bhnd_chipc_if.m Tue May 24 01:12:19 2016 (r300548) @@ -36,6 +36,11 @@ INTERFACE bhnd_chipc; # bhnd(4) ChipCommon interface. # +HEADER { + /* forward declarations */ + struct chipc_caps; +} + /** * Return the preferred NVRAM data source. * @@ -63,3 +68,35 @@ METHOD void write_chipctrl { uint32_t value; uint32_t mask; } + +/** + * Return a borrowed reference to ChipCommon's capability + * table. + * + * @param dev A bhnd(4) ChipCommon device + */ +METHOD struct chipc_caps * get_caps { + device_t dev; +} + +/** + * Enable hardware access to the SPROM. + * + * @param sc chipc driver state. + * + * @retval 0 success + * @retval EBUSY If enabling the hardware may conflict with + * other active devices. + */ +METHOD int enable_sprom { + device_t dev; +} + +/** + * Release hardware access to the SPROM. + * + * @param sc chipc driver state. + */ +METHOD void disable_sprom { + device_t dev; +} Added: head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c Tue May 24 01:12:19 2016 (r300548) @@ -0,0 +1,101 @@ +/*- + * Copyright (c) 2015-2016 Landon Fuller <landon@landonf.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGES. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +/* + * ChipCommon SPROM driver. + */ + +#include <sys/param.h> +#include <sys/kernel.h> +#include <sys/bus.h> +#include <sys/limits.h> +#include <sys/malloc.h> +#include <sys/module.h> +#include <sys/systm.h> + +#include <dev/bhnd/bhnd.h> +#include <dev/bhnd/nvram/bhnd_nvram.h> +#include <dev/bhnd/nvram/bhnd_spromvar.h> + +#include "bhnd_chipc_if.h" +#include "bhnd_nvram_if.h" + +static int +chipc_sprom_probe(device_t dev) +{ + device_t chipc; + int error; + + chipc = device_get_parent(dev); + + /* Only match on SPROM devices */ + if (BHND_CHIPC_NVRAM_SRC(chipc) != BHND_NVRAM_SRC_SPROM) + return (ENXIO); + + /* Defer to default driver implementation */ + if ((error = bhnd_sprom_probe(dev)) > 0) + return (error); + + return (BUS_PROBE_NOWILDCARD); +} + +static int +chipc_sprom_attach(device_t dev) +{ + device_t chipc; + int error; + + /* Request that ChipCommon enable access to SPROM hardware before + * delegating attachment (and SPROM parsing) to the common driver */ + chipc = device_get_parent(dev); + if ((error = BHND_CHIPC_ENABLE_SPROM(chipc))) + return (error); + + error = bhnd_sprom_attach(dev); + BHND_CHIPC_DISABLE_SPROM(chipc); + return (error); +} + +static device_method_t chipc_sprom_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, chipc_sprom_probe), + DEVMETHOD(device_attach, chipc_sprom_attach), + DEVMETHOD_END +}; + +DEFINE_CLASS_1(bhnd_nvram, chipc_sprom_driver, chipc_sprom_methods, sizeof(struct bhnd_sprom_softc), bhnd_sprom_driver); +DRIVER_MODULE(bhnd_chipc_sprom, bhnd_chipc, chipc_sprom_driver, bhnd_nvram_devclass, NULL, NULL); + +MODULE_DEPEND(bhnd_chipc_sprom, bhnd, 1, 1, 1); +MODULE_DEPEND(bhnd_chipc_sprom, bhnd_chipc, 1, 1, 1); +MODULE_DEPEND(bhnd_chipc_sprom, bhnd_sprom, 1, 1, 1); +MODULE_VERSION(bhnd_chipc_sprom, 1); Modified: head/sys/dev/bhnd/cores/chipc/chipc.c ============================================================================== --- head/sys/dev/bhnd/cores/chipc/chipc.c Tue May 24 00:57:11 2016 (r300547) +++ head/sys/dev/bhnd/cores/chipc/chipc.c Tue May 24 01:12:19 2016 (r300548) @@ -1,5 +1,6 @@ /*- - * Copyright (c) 2015 Landon Fuller <landon@landonf.org> + * Copyright (c) 2015-2016 Landon Fuller <landon@landonf.org> + * Copyright (c) 2016 Michael Zhilin <mizhka@gmail.com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,8 +43,11 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/kernel.h> +#include <sys/lock.h> #include <sys/bus.h> +#include <sys/malloc.h> #include <sys/module.h> +#include <sys/mutex.h> #include <sys/systm.h> #include <machine/bus.h> @@ -51,19 +55,14 @@ __FBSDID("$FreeBSD$"); #include <machine/resource.h> #include <dev/bhnd/bhnd.h> - -#include "bhnd_nvram_if.h" +#include <dev/bhnd/bhndvar.h> #include "chipcreg.h" #include "chipcvar.h" +#include "chipc_private.h" devclass_t bhnd_chipc_devclass; /**< bhnd(4) chipcommon device class */ -static const struct resource_spec chipc_rspec[CHIPC_MAX_RSPEC] = { - { SYS_RES_MEMORY, 0, RF_ACTIVE }, - { -1, -1, 0 } -}; - static struct bhnd_device_quirk chipc_quirks[]; static struct bhnd_chip_quirk chipc_chip_quirks[]; @@ -77,7 +76,10 @@ static const struct bhnd_device chipc_de /* Device quirks table */ static struct bhnd_device_quirk chipc_quirks[] = { { BHND_HWREV_GTE (32), CHIPC_QUIRK_SUPPORTS_SPROM }, - { BHND_HWREV_GTE (35), CHIPC_QUIRK_SUPPORTS_NFLASH }, + { BHND_HWREV_GTE (35), CHIPC_QUIRK_SUPPORTS_CAP_EXT }, + { BHND_HWREV_EQ (38), CHIPC_QUIRK_4706_NFLASH }, /*BCM5357 ?*/ + { BHND_HWREV_GTE (49), CHIPC_QUIRK_IPX_OTPLAYOUT_SIZE }, + BHND_DEVICE_QUIRK_END }; @@ -111,15 +113,37 @@ static struct bhnd_chip_quirk chipc_chip {{ BHND_CHIP_IR(43602, HWREV_LTE(2)) }, CHIPC_QUIRK_4360_FEM_MUX_SPROM }, + /* BCM4706 */ + {{ BHND_CHIP_ID(4306) }, + CHIPC_QUIRK_4706_NFLASH }, + BHND_CHIP_QUIRK_END }; +static int chipc_try_activate_resource( + struct chipc_softc *sc, device_t child, + int type, int rid, struct resource *r, + bool req_direct); + +static int chipc_read_caps(struct chipc_softc *sc, + struct chipc_caps *caps); + +static int chipc_nvram_attach(struct chipc_softc *sc); +static bhnd_nvram_src_t chipc_nvram_identify(struct chipc_softc *sc); +static bool chipc_should_enable_sprom( + struct chipc_softc *sc); + +static int chipc_init_rman(struct chipc_softc *sc); +static void chipc_free_rman(struct chipc_softc *sc); +static struct rman *chipc_get_rman(struct chipc_softc *sc, + int type); + /* quirk and capability flag convenience macros */ #define CHIPC_QUIRK(_sc, _name) \ ((_sc)->quirks & CHIPC_QUIRK_ ## _name) #define CHIPC_CAP(_sc, _name) \ - ((_sc)->caps & CHIPC_ ## _name) + ((_sc)->caps._name) #define CHIPC_ASSERT_QUIRK(_sc, name) \ KASSERT(CHIPC_QUIRK((_sc), name), ("quirk " __STRING(_name) " not set")) @@ -127,12 +151,6 @@ static struct bhnd_chip_quirk chipc_chip #define CHIPC_ASSERT_CAP(_sc, name) \ KASSERT(CHIPC_CAP((_sc), name), ("capability " __STRING(_name) " not set")) -static bhnd_nvram_src_t chipc_nvram_identify(struct chipc_softc *sc); -static int chipc_sprom_init(struct chipc_softc *); -static int chipc_enable_sprom_pins(struct chipc_softc *); -static int chipc_disable_sprom_pins(struct chipc_softc *); - - static int chipc_probe(device_t dev) { @@ -159,19 +177,36 @@ chipc_attach(device_t dev) sc->dev = dev; sc->quirks = bhnd_device_quirks(dev, chipc_devices, sizeof(chipc_devices[0])); - + sc->sprom_refcnt = 0; + CHIPC_LOCK_INIT(sc); + STAILQ_INIT(&sc->mem_regions); - /* Allocate bus resources */ - memcpy(sc->rspec, chipc_rspec, sizeof(sc->rspec)); - if ((error = bhnd_alloc_resources(dev, sc->rspec, sc->res))) - return (error); + /* Set up resource management */ + if ((error = chipc_init_rman(sc))) { + device_printf(sc->dev, + "failed to initialize chipc resource state: %d\n", error); + goto failed; + } + + /* Allocate the region containing our core registers */ + if ((sc->core_region = chipc_find_region_by_rid(sc, 0)) == NULL) { + error = ENXIO; + goto failed; + } + + error = chipc_retain_region(sc, sc->core_region, + RF_ALLOCATED|RF_ACTIVE); + if (error) { + sc->core_region = NULL; + goto failed; + } else { + sc->core = sc->core_region->cr_res; + } - sc->core = sc->res[0]; - /* Fetch our chipset identification data */ ccid_reg = bhnd_bus_read_4(sc->core, CHIPC_ID); - chip_type = CHIPC_GET_ATTR(ccid_reg, ID_BUS); + chip_type = CHIPC_GET_BITS(ccid_reg, CHIPC_ID_BUS); switch (chip_type) { case BHND_CHIPTYPE_SIBA: @@ -185,44 +220,36 @@ chipc_attach(device_t dev) default: device_printf(dev, "unsupported chip type %hhu\n", chip_type); error = ENODEV; - goto cleanup; + goto failed; } sc->ccid = bhnd_parse_chipid(ccid_reg, enum_addr); - /* Fetch capability and status register values */ - sc->caps = bhnd_bus_read_4(sc->core, CHIPC_CAPABILITIES); - sc->cst = bhnd_bus_read_4(sc->core, CHIPC_CHIPST); - - /* Identify NVRAM source */ - sc->nvram_src = chipc_nvram_identify(sc); - - /* Read NVRAM data */ - switch (sc->nvram_src) { - case BHND_NVRAM_SRC_OTP: - // TODO (requires access to OTP hardware) - device_printf(sc->dev, "NVRAM-OTP unsupported\n"); - break; + /* Fetch and parse capability register(s) */ + if ((error = chipc_read_caps(sc, &sc->caps))) + goto failed; - case BHND_NVRAM_SRC_NFLASH: - // TODO (requires access to NFLASH hardware) - device_printf(sc->dev, "NVRAM-NFLASH unsupported\n"); - break; + if (bootverbose) + chipc_print_caps(sc->dev, &sc->caps); - case BHND_NVRAM_SRC_SPROM: - if ((error = chipc_sprom_init(sc))) - goto cleanup; - break; + /* Identify NVRAM source and add child device. */ + sc->nvram_src = chipc_nvram_identify(sc); + if ((error = chipc_nvram_attach(sc))) + goto failed; - case BHND_NVRAM_SRC_UNKNOWN: - /* Handled externally */ - break; - } + /* Standard bus probe */ + if ((error = bus_generic_attach(dev))) + goto failed; return (0); -cleanup: - bhnd_release_resources(dev, sc->rspec, sc->res); +failed: + if (sc->core_region != NULL) { + chipc_release_region(sc, sc->core_region, + RF_ALLOCATED|RF_ACTIVE); + } + + chipc_free_rman(sc); CHIPC_LOCK_DESTROY(sc); return (error); } @@ -231,9 +258,15 @@ static int chipc_detach(device_t dev) { struct chipc_softc *sc; + int error; sc = device_get_softc(dev); - bhnd_release_resources(dev, sc->rspec, sc->res); + + if ((error = bus_generic_detach(dev))) + return (error); + + chipc_release_region(sc, sc->core_region, RF_ALLOCATED|RF_ACTIVE); + chipc_free_rman(sc); bhnd_sprom_fini(&sc->sprom); CHIPC_LOCK_DESTROY(sc); @@ -241,58 +274,131 @@ chipc_detach(device_t dev) return (0); } +/* Read and parse chipc capabilities */ static int -chipc_suspend(device_t dev) +chipc_read_caps(struct chipc_softc *sc, struct chipc_caps *caps) { - return (0); -} + uint32_t cap_reg; + uint32_t cap_ext_reg; + uint32_t regval; + + /* Fetch cap registers */ + cap_reg = bhnd_bus_read_4(sc->core, CHIPC_CAPABILITIES); + cap_ext_reg = 0; + if (CHIPC_QUIRK(sc, SUPPORTS_CAP_EXT)) + cap_ext_reg = bhnd_bus_read_4(sc->core, CHIPC_CAPABILITIES_EXT); + + /* Extract values */ + caps->num_uarts = CHIPC_GET_BITS(cap_reg, CHIPC_CAP_NUM_UART); + caps->mipseb = CHIPC_GET_FLAG(cap_reg, CHIPC_CAP_MIPSEB); + caps->uart_gpio = CHIPC_GET_FLAG(cap_reg, CHIPC_CAP_UARTGPIO); + caps->uart_clock = CHIPC_GET_BITS(cap_reg, CHIPC_CAP_UCLKSEL); + + caps->extbus_type = CHIPC_GET_BITS(cap_reg, CHIPC_CAP_EXTBUS); + caps->power_control = CHIPC_GET_FLAG(cap_reg, CHIPC_CAP_PWR_CTL); + caps->jtag_master = CHIPC_GET_FLAG(cap_reg, CHIPC_CAP_JTAGP); + + caps->pll_type = CHIPC_GET_BITS(cap_reg, CHIPC_CAP_PLL); + caps->backplane_64 = CHIPC_GET_FLAG(cap_reg, CHIPC_CAP_BKPLN64); + caps->boot_rom = CHIPC_GET_FLAG(cap_reg, CHIPC_CAP_ROM); + caps->pmu = CHIPC_GET_FLAG(cap_reg, CHIPC_CAP_PMU); + caps->eci = CHIPC_GET_FLAG(cap_reg, CHIPC_CAP_ECI); + caps->sprom = CHIPC_GET_FLAG(cap_reg, CHIPC_CAP_SPROM); + caps->otp_size = CHIPC_GET_BITS(cap_reg, CHIPC_CAP_OTP_SIZE); + + caps->seci = CHIPC_GET_FLAG(cap_ext_reg, CHIPC_CAP2_SECI); + caps->gsio = CHIPC_GET_FLAG(cap_ext_reg, CHIPC_CAP2_GSIO); + caps->aob = CHIPC_GET_FLAG(cap_ext_reg, CHIPC_CAP2_AOB); + + /* Fetch OTP size for later IPX controller revisions */ + if (CHIPC_QUIRK(sc, IPX_OTPLAYOUT_SIZE)) { + regval = bhnd_bus_read_4(sc->core, CHIPC_OTPLAYOUT); + caps->otp_size = CHIPC_GET_BITS(regval, CHIPC_OTPL_SIZE); + } + + /* Determine flash type and paramters */ + caps->cfi_width = 0; + + switch (CHIPC_GET_BITS(cap_reg, CHIPC_CAP_FLASH)) { + case CHIPC_CAP_SFLASH_ST: + caps->flash_type = CHIPC_SFLASH_ST; + break; + case CHIPC_CAP_SFLASH_AT: + caps->flash_type = CHIPC_SFLASH_AT; + break; + case CHIPC_CAP_NFLASH: + caps->flash_type = CHIPC_NFLASH; + break; + case CHIPC_CAP_PFLASH: + caps->flash_type = CHIPC_PFLASH_CFI; + + /* determine cfi width */ + regval = bhnd_bus_read_4(sc->core, CHIPC_FLASH_CFG); + if (CHIPC_GET_FLAG(regval, CHIPC_FLASH_CFG_DS)) + caps->cfi_width = 2; + else + caps->cfi_width = 1; + + break; + case CHIPC_CAP_FLASH_NONE: + caps->flash_type = CHIPC_FLASH_NONE; + break; + + } + + /* Handle 4706_NFLASH fallback */ + if (CHIPC_QUIRK(sc, 4706_NFLASH) && + CHIPC_GET_FLAG(cap_reg, CHIPC_CAP_4706_NFLASH)) + { + caps->flash_type = CHIPC_NFLASH_4706; + } -static int -chipc_resume(device_t dev) -{ return (0); } /** - * Initialize local SPROM shadow, if required. - * - * @param sc chipc driver state. + * If supported, add an appropriate NVRAM child device. */ static int -chipc_sprom_init(struct chipc_softc *sc) +chipc_nvram_attach(struct chipc_softc *sc) { - int error; + device_t nvram_dev; + rman_res_t start; + int error; - KASSERT(sc->nvram_src == BHND_NVRAM_SRC_SPROM, - ("non-SPROM source (%u)\n", sc->nvram_src)); + switch (sc->nvram_src) { + case BHND_NVRAM_SRC_OTP: + // TODO OTP support + device_printf(sc->dev, "OTP nvram source unsupported\n"); + return (0); - /* Enable access to the SPROM */ - CHIPC_LOCK(sc); - if ((error = chipc_enable_sprom_pins(sc))) - goto failed; + case BHND_NVRAM_SRC_SPROM: + /* Add OTP/SPROM device */ + nvram_dev = BUS_ADD_CHILD(sc->dev, 0, "bhnd_nvram", -1); + if (nvram_dev == NULL) { + device_printf(sc->dev, "failed to add NVRAM device\n"); + return (ENXIO); + } + + start = rman_get_start(sc->core->res) + CHIPC_SPROM_OTP; + error = bus_set_resource(nvram_dev, SYS_RES_MEMORY, 0, start, + CHIPC_SPROM_OTP_SIZE); + return (error); - /* Initialize SPROM parser */ - error = bhnd_sprom_init(&sc->sprom, sc->core, CHIPC_SPROM_OTP); - if (error) { - device_printf(sc->dev, "SPROM identification failed: %d\n", - error); + case BHND_NVRAM_SRC_FLASH: + // TODO flash support + device_printf(sc->dev, "flash nvram source unsupported\n"); + return (0); - chipc_disable_sprom_pins(sc); - goto failed; - } + case BHND_NVRAM_SRC_UNKNOWN: + /* Handled externally */ + return (0); - /* Drop access to the SPROM lines */ - if ((error = chipc_disable_sprom_pins(sc))) { - bhnd_sprom_fini(&sc->sprom); - goto failed; + default: + device_printf(sc->dev, "invalid nvram source: %u\n", + sc->nvram_src); + return (ENXIO); } - CHIPC_UNLOCK(sc); - - return (0); - -failed: - CHIPC_UNLOCK(sc); - return (error); } /** @@ -317,27 +423,645 @@ chipc_nvram_identify(struct chipc_softc * We check for hardware presence in order of precedence. For example, * SPROM is is always used in preference to internal OTP if found. */ - if (CHIPC_CAP(sc, CAP_SPROM)) { + if (CHIPC_CAP(sc, sprom)) { srom_ctrl = bhnd_bus_read_4(sc->core, CHIPC_SPROM_CTRL); if (srom_ctrl & CHIPC_SRC_PRESENT) return (BHND_NVRAM_SRC_SPROM); } /* Check for OTP */ - if (CHIPC_CAP(sc, CAP_OTP_SIZE)) + if (CHIPC_CAP(sc, otp_size) != 0) return (BHND_NVRAM_SRC_OTP); - /* - * Finally, Northstar chipsets (and possibly other chipsets?) support - * external NAND flash. - */ - if (CHIPC_QUIRK(sc, SUPPORTS_NFLASH) && CHIPC_CAP(sc, CAP_NFLASH)) - return (BHND_NVRAM_SRC_NFLASH); + /* Check for flash */ + if (CHIPC_CAP(sc, flash_type) != CHIPC_FLASH_NONE) + return (BHND_NVRAM_SRC_FLASH); /* No NVRAM hardware capability declared */ return (BHND_NVRAM_SRC_UNKNOWN); } +static int +chipc_suspend(device_t dev) +{ + return (bus_generic_suspend(dev)); +} + +static int +chipc_resume(device_t dev) +{ + return (bus_generic_resume(dev)); +} + +static void +chipc_probe_nomatch(device_t dev, device_t child) +{ + struct resource_list *rl; + const char *name; + + name = device_get_name(child); + if (name == NULL) + name = "unknown device"; + + device_printf(dev, "<%s> at", name); + + rl = BUS_GET_RESOURCE_LIST(dev, child); + if (rl != NULL) { + resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#jx"); + resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%jd"); + } + + printf(" (no driver attached)\n"); +} + +static int +chipc_print_child(device_t dev, device_t child) +{ + struct resource_list *rl; + int retval = 0; + + retval += bus_print_child_header(dev, child); + + rl = BUS_GET_RESOURCE_LIST(dev, child); + if (rl != NULL) { + retval += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, + "%#jx"); + retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, + "%jd"); + } + + retval += bus_print_child_domain(dev, child); + retval += bus_print_child_footer(dev, child); + + return (retval); +} + +static int +chipc_child_pnpinfo_str(device_t dev, device_t child, char *buf, + size_t buflen) +{ + if (buflen == 0) + return (EOVERFLOW); + + *buf = '\0'; + return (0); +} + +static int +chipc_child_location_str(device_t dev, device_t child, char *buf, + size_t buflen) +{ + if (buflen == 0) + return (EOVERFLOW); + + *buf = '\0'; + return (ENXIO); +} + +static device_t +chipc_add_child(device_t dev, u_int order, const char *name, int unit) +{ + struct chipc_devinfo *dinfo; + device_t child; + + child = device_add_child_ordered(dev, order, name, unit); + if (child == NULL) + return (NULL); + + dinfo = malloc(sizeof(struct chipc_devinfo), M_BHND, M_NOWAIT); + if (dinfo == NULL) { + device_delete_child(dev, child); + return (NULL); + } + + resource_list_init(&dinfo->resources); + + device_set_ivars(child, dinfo); + + return (child); +} + +static void +chipc_child_deleted(device_t dev, device_t child) +{ + struct chipc_devinfo *dinfo = device_get_ivars(child); + + if (dinfo != NULL) { + resource_list_free(&dinfo->resources); + free(dinfo, M_BHND); + } + + device_set_ivars(child, NULL); +} + +static struct resource_list * +chipc_get_resource_list(device_t dev, device_t child) +{ + struct chipc_devinfo *dinfo = device_get_ivars(child); + return (&dinfo->resources); +} + + +/* Allocate region records for the given port, and add the port's memory + * range to the mem_rman */ +static int +chipc_rman_init_regions (struct chipc_softc *sc, bhnd_port_type type, + u_int port) +{ + struct chipc_region *cr; + rman_res_t start, end; + u_int num_regions; + int error; + + num_regions = bhnd_get_region_count(sc->dev, port, port); + for (u_int region = 0; region < num_regions; region++) { + /* Allocate new region record */ + cr = chipc_alloc_region(sc, type, port, region); + if (cr == NULL) + return (ENODEV); + + /* Can't manage regions that cannot be allocated */ + if (cr->cr_rid < 0) { + BHND_DEBUG_DEV(sc->dev, "no rid for chipc region " + "%s%u.%u", bhnd_port_type_name(type), port, region); + chipc_free_region(sc, cr); + continue; + } + + /* Add to rman's managed range */ + start = cr->cr_addr; + end = cr->cr_end; + if ((error = rman_manage_region(&sc->mem_rman, start, end))) { + chipc_free_region(sc, cr); + return (error); + } + + /* Add to region list */ + STAILQ_INSERT_TAIL(&sc->mem_regions, cr, cr_link); + } + + return (0); +} + +/* Initialize memory state for all chipc port regions */ +static int +chipc_init_rman(struct chipc_softc *sc) +{ + u_int num_ports; + int error; + + /* Port types for which we'll register chipc_region mappings */ + bhnd_port_type types[] = { + BHND_PORT_DEVICE + }; + + /* Initialize resource manager */ + sc->mem_rman.rm_start = 0; + sc->mem_rman.rm_end = BUS_SPACE_MAXADDR; + sc->mem_rman.rm_type = RMAN_ARRAY; + sc->mem_rman.rm_descr = "ChipCommon Device Memory"; + if ((error = rman_init(&sc->mem_rman))) { + device_printf(sc->dev, "could not initialize mem_rman: %d\n", + error); + return (error); + } + + /* Populate per-port-region state */ + for (u_int i = 0; i < nitems(types); i++) { + num_ports = bhnd_get_port_count(sc->dev, types[i]); + for (u_int port = 0; port < num_ports; port++) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue May 24 01:20:32 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72C6CB48772; Tue, 24 May 2016 01:20:32 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 280731F41; Tue, 24 May 2016 01:20:32 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O1KVhm064077; Tue, 24 May 2016 01:20:31 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O1KVOT064075; Tue, 24 May 2016 01:20:31 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605240120.u4O1KVOT064075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Tue, 24 May 2016 01:20:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300549 - head/sys/dev/bwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 01:20:32 -0000 Author: adrian Date: Tue May 24 01:20:30 2016 New Revision: 300549 URL: https://svnweb.freebsd.org/changeset/base/300549 Log: [bwn] add extra debugging for non-SIBA devices. This is a no-op at the present moment, but will eventually remind me where the SIBA specific demons lie. Tested: * BCM4322, STA mode Modified: head/sys/dev/bwn/if_bwn.c head/sys/dev/bwn/if_bwn_phy_common.c Modified: head/sys/dev/bwn/if_bwn.c ============================================================================== --- head/sys/dev/bwn/if_bwn.c Tue May 24 01:12:19 2016 (r300548) +++ head/sys/dev/bwn/if_bwn.c Tue May 24 01:20:30 2016 (r300549) @@ -4712,11 +4712,9 @@ bwn_rf_turnoff(struct bwn_mac *mac) /* * SSB PHY reset. - * - * XXX TODO: BCMA PHY reset. */ static void -bwn_phy_reset(struct bwn_mac *mac) +bwn_phy_reset_siba(struct bwn_mac *mac) { struct bwn_softc *sc = mac->mac_sc; @@ -4729,6 +4727,17 @@ bwn_phy_reset(struct bwn_mac *mac) DELAY(1000); } +static void +bwn_phy_reset(struct bwn_mac *mac) +{ + + if (bwn_is_bus_siba(mac)) { + bwn_phy_reset_siba(mac); + } else { + BWN_ERRPRINTF(mac->mac_sc, "%s: unknown bus!\n", __func__); + } +} + static int bwn_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) { Modified: head/sys/dev/bwn/if_bwn_phy_common.c ============================================================================== --- head/sys/dev/bwn/if_bwn_phy_common.c Tue May 24 01:12:19 2016 (r300548) +++ head/sys/dev/bwn/if_bwn_phy_common.c Tue May 24 01:20:30 2016 (r300549) @@ -157,6 +157,8 @@ bwn_phy_force_clock(struct bwn_mac *mac, else tmp &= ~SIBA_TGSLOW_FGC; siba_write_4(sc->sc_dev, SIBA_TGSLOW, tmp); + } else { + BWN_ERRPRINTF(sc, "%s: unknown bus!\n", __func__); } } @@ -190,6 +192,8 @@ bwn_mac_phy_clock_set(struct bwn_mac *ma else val &= ~BWN_TGSLOW_MACPHYCLKEN; siba_write_4(sc->sc_dev, SIBA_TGSLOW, val); + } else { + BWN_ERRPRINTF(sc, "%s: unknown bus!\n", __func__); } } @@ -205,5 +209,7 @@ bwn_wireless_core_phy_pll_reset(struct b siba_cc_mask32(sc->sc_dev, SIBA_CC_CHIPCTL_DATA, ~0x4); siba_cc_set32(sc->sc_dev, SIBA_CC_CHIPCTL_DATA, 0x4); siba_cc_mask32(sc->sc_dev, SIBA_CC_CHIPCTL_DATA, ~0x4); + } else { + BWN_ERRPRINTF(sc, "%s: unknown bus!\n", __func__); } } From owner-svn-src-head@freebsd.org Tue May 24 01:33:51 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25C78B48C68; Tue, 24 May 2016 01:33:51 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F14491887; Tue, 24 May 2016 01:33:50 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O1Xo2H069859; Tue, 24 May 2016 01:33:50 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O1XnFI069856; Tue, 24 May 2016 01:33:49 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201605240133.u4O1XnFI069856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza <loos@FreeBSD.org> Date: Tue, 24 May 2016 01:33:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300550 - in head/sys: conf dev/iicbus dev/ofw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 01:33:51 -0000 Author: loos Date: Tue May 24 01:33:49 2016 New Revision: 300550 URL: https://svnweb.freebsd.org/changeset/base/300550 Log: Move the OFW iicbus code to dev/iicbus to stop polluting dev/ofw with unrelated code. Discussed with: nwhitehorn (a long time ago) Added: head/sys/dev/iicbus/ofw_iicbus.c - copied unchanged from r300549, head/sys/dev/ofw/ofw_iicbus.c Deleted: head/sys/dev/ofw/ofw_iicbus.c Modified: head/sys/conf/files head/sys/conf/files.powerpc Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue May 24 01:20:30 2016 (r300549) +++ head/sys/conf/files Tue May 24 01:33:49 2016 (r300550) @@ -1575,6 +1575,7 @@ dev/iicbus/iicsmb.c optional iicsmb dependency "iicbus_if.h" dev/iicbus/iicoc.c optional iicoc dev/iicbus/lm75.c optional lm75 +dev/iicbus/ofw_iicbus.c optional fdt iicbus dev/iicbus/pcf8563.c optional pcf8563 dev/iicbus/s35390a.c optional s35390a dev/iir/iir.c optional iir @@ -2174,7 +2175,6 @@ dev/ofw/ofw_bus_if.m optional fdt dev/ofw/ofw_bus_subr.c optional fdt dev/ofw/ofw_fdt.c optional fdt dev/ofw/ofw_if.m optional fdt -dev/ofw/ofw_iicbus.c optional fdt iicbus dev/ofw/ofw_subr.c optional fdt dev/ofw/ofwbus.c optional fdt dev/ofw/openfirm.c optional fdt Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Tue May 24 01:20:30 2016 (r300549) +++ head/sys/conf/files.powerpc Tue May 24 01:33:49 2016 (r300550) @@ -44,6 +44,7 @@ dev/iicbus/adt746x.c optional ad dev/iicbus/ds1631.c optional ds1631 powermac dev/iicbus/ds1775.c optional ds1775 powermac dev/iicbus/max6690.c optional max6690 powermac +dev/iicbus/ofw_iicbus.c optional iicbus aim dev/nand/nfc_fsl.c optional nand mpc85xx dev/nand/nfc_rb.c optional nand mpc85xx # ofw can be either aim or fdt: fdt case handled in files. aim only powerpc specific. @@ -55,7 +56,6 @@ dev/ofw/ofw_if.m optional aim dev/ofw/ofw_bus_subr.c optional aim dev/ofw/ofw_console.c optional aim dev/ofw/ofw_disk.c optional ofwd aim -dev/ofw/ofw_iicbus.c optional iicbus aim dev/ofw/ofwbus.c optional aim | fdt dev/ofw/ofwpci.c optional pci dev/ofw/ofw_standard.c optional aim powerpc Copied: head/sys/dev/iicbus/ofw_iicbus.c (from r300549, head/sys/dev/ofw/ofw_iicbus.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/ofw_iicbus.c Tue May 24 01:33:49 2016 (r300550, copy of r300549, head/sys/dev/ofw/ofw_iicbus.c) @@ -0,0 +1,238 @@ +/*- + * Copyright (c) 2009, Nathan Whitehorn <nwhitehorn@FreeBSD.org> + * 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 unmodified, 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 <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/param.h> +#include <sys/bus.h> +#include <sys/kernel.h> +#include <sys/libkern.h> +#include <sys/lock.h> +#include <sys/module.h> +#include <sys/mutex.h> + +#include <dev/iicbus/iicbus.h> +#include <dev/iicbus/iiconf.h> +#include <dev/ofw/ofw_bus.h> +#include <dev/ofw/ofw_bus_subr.h> +#include <dev/ofw/openfirm.h> + +#include "iicbus_if.h" + +/* Methods */ +static device_probe_t ofw_iicbus_probe; +static device_attach_t ofw_iicbus_attach; +static device_t ofw_iicbus_add_child(device_t dev, u_int order, + const char *name, int unit); +static const struct ofw_bus_devinfo *ofw_iicbus_get_devinfo(device_t bus, + device_t dev); + +static device_method_t ofw_iicbus_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ofw_iicbus_probe), + DEVMETHOD(device_attach, ofw_iicbus_attach), + + /* Bus interface */ + DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str), + DEVMETHOD(bus_add_child, ofw_iicbus_add_child), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_devinfo, ofw_iicbus_get_devinfo), + DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), + DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), + DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), + DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), + DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), + + DEVMETHOD_END +}; + +struct ofw_iicbus_devinfo { + struct iicbus_ivar opd_dinfo; /* Must be the first. */ + struct ofw_bus_devinfo opd_obdinfo; +}; + +devclass_t ofwiicbus_devclass; + +DEFINE_CLASS_1(iicbus, ofw_iicbus_driver, ofw_iicbus_methods, + sizeof(struct iicbus_softc), iicbus_driver); +EARLY_DRIVER_MODULE(ofw_iicbus, iicbb, ofw_iicbus_driver, ofwiicbus_devclass, + 0, 0, BUS_PASS_BUS); +EARLY_DRIVER_MODULE(ofw_iicbus, iichb, ofw_iicbus_driver, ofwiicbus_devclass, + 0, 0, BUS_PASS_BUS); +MODULE_VERSION(ofw_iicbus, 1); +MODULE_DEPEND(ofw_iicbus, iicbus, 1, 1, 1); + +static int +ofw_iicbus_probe(device_t dev) +{ + + if (ofw_bus_get_node(dev) == -1) + return (ENXIO); + device_set_desc(dev, "OFW I2C bus"); + + return (0); +} + +static int +ofw_iicbus_attach(device_t dev) +{ + struct iicbus_softc *sc = IICBUS_SOFTC(dev); + struct ofw_iicbus_devinfo *dinfo; + phandle_t child, node, root; + pcell_t freq, paddr; + device_t childdev; + ssize_t compatlen; + char compat[255]; + char *curstr; + u_int iic_addr_8bit = 0; + + sc->dev = dev; + mtx_init(&sc->lock, "iicbus", NULL, MTX_DEF); + + /* + * If there is a clock-frequency property for the device node, use it as + * the starting value for the bus frequency. Then call the common + * routine that handles the tunable/sysctl which allows the FDT value to + * be overridden by the user. + */ + node = ofw_bus_get_node(dev); + freq = 0; + OF_getencprop(node, "clock-frequency", &freq, sizeof(freq)); + iicbus_init_frequency(dev, freq); + + iicbus_reset(dev, IIC_FASTEST, 0, NULL); + + bus_generic_probe(dev); + bus_enumerate_hinted_children(dev); + + /* + * Check if we're running on a PowerMac, needed for the I2C + * address below. + */ + root = OF_peer(0); + compatlen = OF_getprop(root, "compatible", compat, + sizeof(compat)); + if (compatlen != -1) { + for (curstr = compat; curstr < compat + compatlen; + curstr += strlen(curstr) + 1) { + if (strncmp(curstr, "MacRISC", 7) == 0) + iic_addr_8bit = 1; + } + } + + /* + * Attach those children represented in the device tree. + */ + for (child = OF_child(node); child != 0; child = OF_peer(child)) { + /* + * Try to get the I2C address first from the i2c-address + * property, then try the reg property. It moves around + * on different systems. + */ + if (OF_getencprop(child, "i2c-address", &paddr, + sizeof(paddr)) == -1) + if (OF_getencprop(child, "reg", &paddr, + sizeof(paddr)) == -1) + continue; + + /* + * Now set up the I2C and OFW bus layer devinfo and add it + * to the bus. + */ + dinfo = malloc(sizeof(struct ofw_iicbus_devinfo), M_DEVBUF, + M_NOWAIT | M_ZERO); + if (dinfo == NULL) + continue; + /* + * FreeBSD drivers expect I2C addresses to be expressed as + * 8-bit values. Apple OFW data contains 8-bit values, but + * Linux FDT data contains 7-bit values, so shift them up to + * 8-bit format. + */ + if (iic_addr_8bit) + dinfo->opd_dinfo.addr = paddr; + else + dinfo->opd_dinfo.addr = paddr << 1; + + if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != + 0) { + free(dinfo, M_DEVBUF); + continue; + } + + childdev = device_add_child(dev, NULL, -1); + resource_list_init(&dinfo->opd_dinfo.rl); + ofw_bus_intr_to_rl(childdev, child, + &dinfo->opd_dinfo.rl, NULL); + device_set_ivars(childdev, dinfo); + } + + /* Register bus */ + OF_device_register_xref(OF_xref_from_node(node), dev); + return (bus_generic_attach(dev)); +} + +static device_t +ofw_iicbus_add_child(device_t dev, u_int order, const char *name, int unit) +{ + device_t child; + struct ofw_iicbus_devinfo *devi; + + child = device_add_child_ordered(dev, order, name, unit); + if (child == NULL) + return (child); + devi = malloc(sizeof(struct ofw_iicbus_devinfo), M_DEVBUF, + M_NOWAIT | M_ZERO); + if (devi == NULL) { + device_delete_child(dev, child); + return (0); + } + + /* + * NULL all the OFW-related parts of the ivars for non-OFW + * children. + */ + devi->opd_obdinfo.obd_node = -1; + devi->opd_obdinfo.obd_name = NULL; + devi->opd_obdinfo.obd_compat = NULL; + devi->opd_obdinfo.obd_type = NULL; + devi->opd_obdinfo.obd_model = NULL; + + device_set_ivars(child, devi); + + return (child); +} + +static const struct ofw_bus_devinfo * +ofw_iicbus_get_devinfo(device_t bus, device_t dev) +{ + struct ofw_iicbus_devinfo *dinfo; + + dinfo = device_get_ivars(dev); + return (&dinfo->opd_obdinfo); +} From owner-svn-src-head@freebsd.org Tue May 24 01:42:22 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9384B48E5C; Tue, 24 May 2016 01:42:22 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E7551DA4; Tue, 24 May 2016 01:42:22 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O1gLvi072955; Tue, 24 May 2016 01:42:21 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O1gLiH072954; Tue, 24 May 2016 01:42:21 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201605240142.u4O1gLiH072954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno <sbruno@FreeBSD.org> Date: Tue, 24 May 2016 01:42:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300551 - head/sys/dev/ciss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 01:42:23 -0000 Author: sbruno Date: Tue May 24 01:42:21 2016 New Revision: 300551 URL: https://svnweb.freebsd.org/changeset/base/300551 Log: Update some of the TBD entries in ciss(4) to match what's in the pci IDS data. Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> MFC after: 2 weeks Modified: head/sys/dev/ciss/ciss.c Modified: head/sys/dev/ciss/ciss.c ============================================================================== --- head/sys/dev/ciss/ciss.c Tue May 24 01:33:49 2016 (r300550) +++ head/sys/dev/ciss/ciss.c Tue May 24 01:42:21 2016 (r300551) @@ -345,21 +345,22 @@ static struct { 0x103C, 0x1928, CISS_BOARD_SA5, "HP Smart Array P230i" }, { 0x103C, 0x1929, CISS_BOARD_SA5, "HP Smart Array P530" }, { 0x103C, 0x192A, CISS_BOARD_SA5, "HP Smart Array P531" }, - { 0x103C, 0x21BD, CISS_BOARD_SA5, "HP Smart Array TBD" }, - { 0x103C, 0x21BE, CISS_BOARD_SA5, "HP Smart Array TBD" }, - { 0x103C, 0x21BF, CISS_BOARD_SA5, "HP Smart Array TBD" }, - { 0x103C, 0x21C0, CISS_BOARD_SA5, "HP Smart Array TBD" }, - { 0x103C, 0x21C2, CISS_BOARD_SA5, "HP Smart Array TBD" }, - { 0x103C, 0x21C3, CISS_BOARD_SA5, "HP Smart Array TBD" }, - { 0x103C, 0x21C5, CISS_BOARD_SA5, "HP Smart Array TBD" }, - { 0x103C, 0x21C6, CISS_BOARD_SA5, "HP Smart Array TBD" }, - { 0x103C, 0x21C7, CISS_BOARD_SA5, "HP Smart Array TBD" }, - { 0x103C, 0x21C8, CISS_BOARD_SA5, "HP Smart Array TBD" }, - { 0x103C, 0x21CA, CISS_BOARD_SA5, "HP Smart Array TBD" }, - { 0x103C, 0x21CB, CISS_BOARD_SA5, "HP Smart Array TBD" }, + { 0x103C, 0x21BD, CISS_BOARD_SA5, "HP Smart Array P244br" }, + { 0x103C, 0x21BE, CISS_BOARD_SA5, "HP Smart Array P741m" }, + { 0x103C, 0x21BF, CISS_BOARD_SA5, "HP Smart Array H240ar" }, + { 0x103C, 0x21C0, CISS_BOARD_SA5, "HP Smart Array P440ar" }, + { 0x103C, 0x21C1, CISS_BOARD_SA5, "HP Smart Array P840ar" }, + { 0x103C, 0x21C2, CISS_BOARD_SA5, "HP Smart Array P440" }, + { 0x103C, 0x21C3, CISS_BOARD_SA5, "HP Smart Array P441" }, + { 0x103C, 0x21C5, CISS_BOARD_SA5, "HP Smart Array P841" }, + { 0x103C, 0x21C6, CISS_BOARD_SA5, "HP Smart Array H244br" }, + { 0x103C, 0x21C7, CISS_BOARD_SA5, "HP Smart Array H240" }, + { 0x103C, 0x21C8, CISS_BOARD_SA5, "HP Smart Array H241" }, + { 0x103C, 0x21CA, CISS_BOARD_SA5, "HP Smart Array P246br" }, + { 0x103C, 0x21CB, CISS_BOARD_SA5, "HP Smart Array P840" }, { 0x103C, 0x21CC, CISS_BOARD_SA5, "HP Smart Array TBD" }, - { 0x103C, 0x21CD, CISS_BOARD_SA5, "HP Smart Array TBD" }, - { 0x103C, 0x21CE, CISS_BOARD_SA5, "HP Smart Array TBD" }, + { 0x103C, 0x21CD, CISS_BOARD_SA5, "HP Smart Array P240nr" }, + { 0x103C, 0x21CE, CISS_BOARD_SA5, "HP Smart Array H240nr" }, { 0, 0, 0, NULL } }; From owner-svn-src-head@freebsd.org Tue May 24 02:27:27 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDE32B47A93; Tue, 24 May 2016 02:27:27 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from gw.catspoiler.org (unknown [IPv6:2602:304:b010:ef20::f2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gw.catspoiler.org", Issuer "gw.catspoiler.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id AFCA71767; Tue, 24 May 2016 02:27:27 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.15.2/8.15.2) with ESMTP id u4O2RIOc099919; Mon, 23 May 2016 19:27:23 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <201605240227.u4O2RIOc099919@gw.catspoiler.org> Date: Mon, 23 May 2016 19:27:18 -0700 (PDT) From: Don Lewis <truckman@FreeBSD.org> Subject: Re: svn commit: r300547 - in head: lib/libcam sbin/camcontrol sbin/iscontrol sys/cam usr.sbin/camdd usr.sbin/mptutil To: src-committers@freebsd.org cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201605240057.u4O0vBfL057675@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 02:27:28 -0000 On 24 May, To: src-committers@freebsd.org wrote: > Author: truckman > Date: Tue May 24 00:57:11 2016 > New Revision: 300547 > URL: https://svnweb.freebsd.org/changeset/base/300547 > > Log: > Fix multiple Coverity Out-of-bounds access false postive issues in CAM > > The currently used idiom for clearing the part of a ccb after its > header generates one or two Coverity errors for each time it is > used. All instances generate an Out-of-bounds access (ARRAY_VS_SINGLETON) > error because of the treatment of the header as a two element array, > with a pointer to the non-existent second element being passed as > the starting address to bzero(). Some instances also alsp generate > Out-of-bounds access (OVERRUN) errors, probably because the space > being cleared is larger than the sizeofstruct ccb_hdr). > > In addition, this idiom is difficult for humans to understand and > it is error prone. The user has to chose the proper struct ccb_* > type (which does not appear in the surrounding code) for the sizeof() > in the length calculation. I found several instances where the > length was incorrect, which could cause either an actual out of > bounds write, or incompletely clear the ccb. > > A better way is to write the code to clear the ccb itself starting > at sizeof(ccb_hdr) bytes from the start of the ccb, and calculate > the length based on the specific type of struct ccb_* being cleared > as specified by the union ccb member being used. The latter can > normally be seen in the nearby code. This is friendlier for Coverity > and other static analysis tools because they will see that the > intent is to clear the trailing part of the ccb. > > Wrap all of the boilerplate code in a convenient macro that only > requires a pointer to the desired union ccb member (or a pointer > to the union ccb itself) as an argument. [snip] > Reviewed by: scottl, ken, delphij, imp > MFH: 1 month > Differential Revision: https://reviews.freebsd.org/D6496 grr ... that should be: MFC after: 1 month This mistake is too easy to make ... From owner-svn-src-head@freebsd.org Tue May 24 03:13:28 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B457B48721; Tue, 24 May 2016 03:13:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52F03167D; Tue, 24 May 2016 03:13:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O3DRQH001599; Tue, 24 May 2016 03:13:27 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O3DRMl001597; Tue, 24 May 2016 03:13:27 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201605240313.u4O3DRMl001597@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin <jhb@FreeBSD.org> Date: Tue, 24 May 2016 03:13:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300556 - in head: sys/kern tests/sys/aio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 03:13:28 -0000 Author: jhb Date: Tue May 24 03:13:27 2016 New Revision: 300556 URL: https://svnweb.freebsd.org/changeset/base/300556 Log: Don't prematurely return short completions on blocking sockets. Always requeue an AIO job at the head of the socket buffer's queue if sosend() or soreceive() returns EWOULDBLOCK on a blocking socket. Previously, requests were only requeued if they returned EWOULDBLOCK and completed no data. Now after a partial completion on a blocking socket the request is queued and the remaining request is retried when the socket is ready. This allows writes larger than the currently available space on a blocking socket to fully complete. Reads on a blocking socket that satifsy the low watermark can still return a short read (same as read()). In order to track previously completed data, the internal 'status' field of the AIO job is used to store the amount of previously computed data. Non-blocking sockets continue to return short completions for both reads and writes. Add a test for a "large" AIO write on a blocking socket that writes twice the socket buffer size to a UNIX domain socket. Sponsored by: Chelsio Communications Modified: head/sys/kern/sys_socket.c head/tests/sys/aio/aio_test.c Modified: head/sys/kern/sys_socket.c ============================================================================== --- head/sys/kern/sys_socket.c Tue May 24 03:08:32 2016 (r300555) +++ head/sys/kern/sys_socket.c Tue May 24 03:13:27 2016 (r300556) @@ -556,7 +556,7 @@ soaio_process_job(struct socket *so, str struct file *fp; struct uio uio; struct iovec iov; - size_t cnt; + size_t cnt, done; int error, flags; SOCKBUF_UNLOCK(sb); @@ -567,8 +567,9 @@ retry: td_savedcred = td->td_ucred; td->td_ucred = job->cred; - cnt = job->uaiocb.aio_nbytes; - iov.iov_base = (void *)(uintptr_t)job->uaiocb.aio_buf; + done = job->uaiocb._aiocb_private.status; + cnt = job->uaiocb.aio_nbytes - done; + iov.iov_base = (void *)((uintptr_t)job->uaiocb.aio_buf + done); iov.iov_len = cnt; uio.uio_iov = &iov; uio.uio_iovcnt = 1; @@ -602,42 +603,52 @@ retry: } } - cnt -= uio.uio_resid; + done += cnt - uio.uio_resid; + job->uaiocb._aiocb_private.status = done; td->td_ucred = td_savedcred; - if (cnt != 0 && (error == ERESTART || error == EINTR || - error == EWOULDBLOCK)) - error = 0; if (error == EWOULDBLOCK) { /* - * A read() or write() on the socket raced with this - * request. If the socket is now ready, try again. - * If it is not, place this request at the head of the + * The request was either partially completed or not + * completed at all due to racing with a read() or + * write() on the socket. If the socket is + * non-blocking, return with any partial completion. + * If the socket is blocking or if no progress has + * been made, requeue this request at the head of the * queue to try again when the socket is ready. */ - SOCKBUF_LOCK(sb); - empty_results++; - if (soaio_ready(so, sb)) { - empty_retries++; - SOCKBUF_UNLOCK(sb); - goto retry; - } - - if (!aio_set_cancel_function(job, soo_aio_cancel)) { - MPASS(cnt == 0); - SOCKBUF_UNLOCK(sb); - aio_cancel(job); - SOCKBUF_LOCK(sb); - } else { - TAILQ_INSERT_HEAD(&sb->sb_aiojobq, job, list); - } - } else { - if (error) - aio_complete(job, -1, error); - else - aio_complete(job, cnt, 0); + MPASS(done != job->uaiocb.aio_nbytes); SOCKBUF_LOCK(sb); - } + if (done == 0 || !(so->so_state & SS_NBIO)) { + empty_results++; + if (soaio_ready(so, sb)) { + empty_retries++; + SOCKBUF_UNLOCK(sb); + goto retry; + } + + if (!aio_set_cancel_function(job, soo_aio_cancel)) { + SOCKBUF_UNLOCK(sb); + if (done != 0) + aio_complete(job, done, 0); + else + aio_cancel(job); + SOCKBUF_LOCK(sb); + } else { + TAILQ_INSERT_HEAD(&sb->sb_aiojobq, job, list); + } + return; + } + SOCKBUF_UNLOCK(sb); + } + if (done != 0 && (error == ERESTART || error == EINTR || + error == EWOULDBLOCK)) + error = 0; + if (error) + aio_complete(job, -1, error); + else + aio_complete(job, done, 0); + SOCKBUF_LOCK(sb); } static void @@ -758,6 +769,7 @@ soo_aio_queue(struct file *fp, struct ka if (!aio_set_cancel_function(job, soo_aio_cancel)) panic("new job was cancelled"); TAILQ_INSERT_TAIL(&sb->sb_aiojobq, job, list); + job->uaiocb._aiocb_private.status = 0; if (!(sb->sb_flags & SB_AIO_RUNNING)) { if (soaio_ready(so, sb)) sowakeup_aio(so, sb); Modified: head/tests/sys/aio/aio_test.c ============================================================================== --- head/tests/sys/aio/aio_test.c Tue May 24 03:08:32 2016 (r300555) +++ head/tests/sys/aio/aio_test.c Tue May 24 03:13:27 2016 (r300556) @@ -781,6 +781,70 @@ ATF_TC_BODY(aio_socket_two_reads, tc) close(s[0]); } +/* + * This test ensures that aio_write() on a blocking socket of a "large" + * buffer does not return a short completion. + */ +ATF_TC_WITHOUT_HEAD(aio_socket_blocking_short_write); +ATF_TC_BODY(aio_socket_blocking_short_write, tc) +{ + struct aiocb iocb, *iocbp; + char *buffer[2]; + ssize_t done; + int buffer_size, sb_size; + socklen_t len; + int s[2]; + + ATF_REQUIRE_KERNEL_MODULE("aio"); + + ATF_REQUIRE(socketpair(PF_UNIX, SOCK_STREAM, 0, s) != -1); + + len = sizeof(sb_size); + ATF_REQUIRE(getsockopt(s[0], SOL_SOCKET, SO_RCVBUF, &sb_size, &len) != + -1); + ATF_REQUIRE(len == sizeof(sb_size)); + buffer_size = sb_size; + + ATF_REQUIRE(getsockopt(s[1], SOL_SOCKET, SO_SNDBUF, &sb_size, &len) != + -1); + ATF_REQUIRE(len == sizeof(sb_size)); + if (sb_size > buffer_size) + buffer_size = sb_size; + + /* + * Use twice the size of the MAX(receive buffer, send buffer) + * to ensure that the write is split up into multiple writes + * internally. + */ + buffer_size *= 2; + + buffer[0] = malloc(buffer_size); + ATF_REQUIRE(buffer[0] != NULL); + buffer[1] = malloc(buffer_size); + ATF_REQUIRE(buffer[1] != NULL); + + srandomdev(); + aio_fill_buffer(buffer[1], buffer_size, random()); + + memset(&iocb, 0, sizeof(iocb)); + iocb.aio_fildes = s[1]; + iocb.aio_buf = buffer[1]; + iocb.aio_nbytes = buffer_size; + ATF_REQUIRE(aio_write(&iocb) == 0); + + done = recv(s[0], buffer[0], buffer_size, MSG_WAITALL); + ATF_REQUIRE(done == buffer_size); + + done = aio_waitcomplete(&iocbp, NULL); + ATF_REQUIRE(iocbp == &iocb); + ATF_REQUIRE(done == buffer_size); + + ATF_REQUIRE(memcmp(buffer[0], buffer[1], buffer_size) == 0); + + close(s[1]); + close(s[0]); +} + ATF_TP_ADD_TCS(tp) { @@ -792,6 +856,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, aio_md_test); ATF_TP_ADD_TC(tp, aio_large_read_test); ATF_TP_ADD_TC(tp, aio_socket_two_reads); + ATF_TP_ADD_TC(tp, aio_socket_blocking_short_write); return (atf_no_error()); } From owner-svn-src-head@freebsd.org Tue May 24 03:15:47 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD10CB487B2; Tue, 24 May 2016 03:15:47 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A1E3185D; Tue, 24 May 2016 03:15:47 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O3Fk05001720; Tue, 24 May 2016 03:15:46 GMT (envelope-from peter@FreeBSD.org) Received: (from peter@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O3FkMt001717; Tue, 24 May 2016 03:15:46 GMT (envelope-from peter@FreeBSD.org) Message-Id: <201605240315.u4O3FkMt001717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: peter set sender to peter@FreeBSD.org using -f From: Peter Wemm <peter@FreeBSD.org> Date: Tue, 24 May 2016 03:15:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300557 - head/usr.sbin/apmd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 03:15:47 -0000 Author: peter Date: Tue May 24 03:15:46 2016 New Revision: 300557 URL: https://svnweb.freebsd.org/changeset/base/300557 Log: It seems <sys/types.h> is a new prerequisite for <bitstring.h> after r300539. Attempt to fix the build for i386. Modified: head/usr.sbin/apmd/apmd.c head/usr.sbin/apmd/apmdlex.l head/usr.sbin/apmd/apmdparse.y Modified: head/usr.sbin/apmd/apmd.c ============================================================================== --- head/usr.sbin/apmd/apmd.c Tue May 24 03:13:27 2016 (r300556) +++ head/usr.sbin/apmd/apmd.c Tue May 24 03:15:46 2016 (r300557) @@ -32,6 +32,7 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ +#include <sys/types.h> #include <assert.h> #include <bitstring.h> #include <err.h> @@ -45,7 +46,6 @@ static const char rcsid[] = #include <syslog.h> #include <unistd.h> #include <sys/ioctl.h> -#include <sys/types.h> #include <sys/time.h> #include <sys/wait.h> #include <machine/apm_bios.h> Modified: head/usr.sbin/apmd/apmdlex.l ============================================================================== --- head/usr.sbin/apmd/apmdlex.l Tue May 24 03:13:27 2016 (r300556) +++ head/usr.sbin/apmd/apmdlex.l Tue May 24 03:15:46 2016 (r300557) @@ -30,6 +30,7 @@ * $FreeBSD$ */ +#include <sys/types.h> #include <string.h> #include <syslog.h> #include <bitstring.h> Modified: head/usr.sbin/apmd/apmdparse.y ============================================================================== --- head/usr.sbin/apmd/apmdparse.y Tue May 24 03:13:27 2016 (r300556) +++ head/usr.sbin/apmd/apmdparse.y Tue May 24 03:15:46 2016 (r300557) @@ -30,6 +30,7 @@ * $FreeBSD$ */ +#include <sys/types.h> #include <stdio.h> #include <bitstring.h> #include <stdlib.h> From owner-svn-src-head@freebsd.org Tue May 24 03:21:47 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA5D2B4897D; Tue, 24 May 2016 03:21:47 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A50D1C2E; Tue, 24 May 2016 03:21:47 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 6985EB94C; Mon, 23 May 2016 23:21:46 -0400 (EDT) From: John Baldwin <jhb@freebsd.org> To: Adrian Chadd <adrian@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300548 - in head/sys: conf dev/bhnd dev/bhnd/bhndb dev/bhnd/cores/chipc dev/bhnd/nvram dev/bhnd/siba modules/bhnd modules/bhnd/cores/bhnd_chipc Date: Mon, 23 May 2016 20:18:26 -0700 Message-ID: <2018441.udrSCt4JcK@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201605240112.u4O1CJOt063645@repo.freebsd.org> References: <201605240112.u4O1CJOt063645@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 23 May 2016 23:21:46 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 03:21:47 -0000 On Tuesday, May 24, 2016 01:12:19 AM Adrian Chadd wrote: > Author: adrian > Date: Tue May 24 01:12:19 2016 > New Revision: 300548 > URL: https://svnweb.freebsd.org/changeset/base/300548 > > Log: > [bhnd] Implement pass-through resource management for ChipCommon. > > This patchset adds support to bhnd_chipc for sharing SYS_RES_MEMORY > resources with its children, allowing us to hang devices off of > bhnd_chipc that rely on access to a subset of the device register space > that bhnd_chipc itself must also allocate. > > We could avoid most of this heavy lifting if RF_SHAREABLE+SYS_RES_MEMORY > wasn't limited to use with allocations at the same size/offset. > > As a work-around, I implemented something similar to vga_pci.c, which > implements similar reference counting of of PCI BAR resources for its > children. > > With these changes, chipc will use reference counting of SYS_RES_MEMORY > allocation/activation requests, to decide when to allocate/activate/ > deactivate/release resources from the parent bhnd(4) bus. > > The requesting child device is allocated a new resource from chipc's > rman, pointing to (possibly a subregion of) the refcounted bhnd resources > allocated by chipc. > > Other resource types are just passed directly to the parent bhnd bus; > RF_SHAREABLE works just fine with IRQs. > > I also lifted the SPROM device code out into a common driver, since this > now allows me to hang simple subclasses off of a common driver off of both > bhndb_pci and bhnd_chipc. Hmm, what the PCI-PCI bridge driver does with NEW_PCIB is to allocate a single resource from its parent bus for each I/O window it decodes. It then creates a rman that is populated with the addresses in that resource and suballocates from that rman. This allows child devices to allocate non-overlapping resources exclusively (they could also do shareable mappings for subsets if applicable). Right now NEW_PCIB assumes it can pass one of these "child" resources up to the nexus to have it "mapped" via bus_activate_resource(). However, the recently added bus_map_resource() provides a cleaner way to do this where a bridge device can request a mapping for the sub-range of the resource on its "upstream" side that corresponds to the range used by a resource for a child device. -- John Baldwin From owner-svn-src-head@freebsd.org Tue May 24 03:24:42 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2A82B489E0; Tue, 24 May 2016 03:24:42 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi0-x233.google.com (mail-oi0-x233.google.com [IPv6:2607:f8b0:4003:c06::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 88D591F21; Tue, 24 May 2016 03:24:42 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi0-x233.google.com with SMTP id b65so6923427oia.1; Mon, 23 May 2016 20:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=pwhdFgA/ZZOKCKi6dxfwuUjwmMa3J3f6JzkexjQuqcc=; b=dmFe5+gBEGKVAfOuXxQ9obuDVj7M+u0QLdD8/vXVqvS+5owcUs7n7JeKqxxq2dkzJG J6j/dRdOVEFiPVZYSBhqVfHkxf7Dche+zr20WIrHfbxUDcAka8gUhRnUrpk1r7MzZfid jRhYlA5kDigpURzKx2cL4FGHhoc/2Q+Kl6BRS1iDNNAhkk6yB5FB6xNV7RvFJrgD5MGE OHY5ZO2CidxOodAw9jOuTaP+QhNvh4dbZ9nAl33dHLyiSze4tj5AGglFH+bMxp1l6Brr tw8QdMnuBPzfGJraILsUh9d8o+p1sJTBkTcvK1kivtknUyvVhvkMgFfCUqNW4rd/Bngo 0XSw== 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:date :message-id:subject:from:to:cc; bh=pwhdFgA/ZZOKCKi6dxfwuUjwmMa3J3f6JzkexjQuqcc=; b=mKwXxALvpOZiTGX/C9zrw1fCjUKBS7Sci+3CUhJWL1rG3FGTxvgTW9uEbriIxt7yyb 0dx0XGnygRo9//30mZqCOshbvuyWv7aQBQ94B5TK9pPyJEbaDWbFK59B0f1UfUBwq/VJ n749U1G/WV+SmVt2vP18p8CJZoKN+Gs9GZsuidoBF/89gzwDyk77AI7Q7smlvaO6xUWm /xjm0zurpeBmilIUQjg1bpdF9k7lRJTly7pz5Ks0ZQ/LsQadq538wmn0qB5CJ1gZ/1aN L0l23wlawTPNjavDWqOrAIsoMISBblbmHFhXE77cjkq88v8YZhOH9w+YKkVnlwOHuORz jXTA== X-Gm-Message-State: AOPr4FWZugXDjkd0tWaSMU/v9I7/w3oD7vsCgzwsdIK3cvp9gXycu7eCHQcNrcaJkz3pRIqsJFj4rd2PErgzCg== MIME-Version: 1.0 X-Received: by 10.202.94.132 with SMTP id s126mr11623104oib.34.1464060281634; Mon, 23 May 2016 20:24:41 -0700 (PDT) Sender: asomers@gmail.com Received: by 10.202.4.200 with HTTP; Mon, 23 May 2016 20:24:41 -0700 (PDT) In-Reply-To: <201605240315.u4O3FkMt001717@repo.freebsd.org> References: <201605240315.u4O3FkMt001717@repo.freebsd.org> Date: Mon, 23 May 2016 21:24:41 -0600 X-Google-Sender-Auth: 0HUOxK01NL7vz3sIZ5ITlyx7ZKM Message-ID: <CAOtMX2jU=GNKbGUeMrSHZsxd8GLe9gd-ycYZS8ST_85+ai+JBA@mail.gmail.com> Subject: Re: svn commit: r300557 - head/usr.sbin/apmd From: Alan Somers <asomers@freebsd.org> To: Peter Wemm <peter@freebsd.org> Cc: "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 03:24:42 -0000 On Mon, May 23, 2016 at 9:15 PM, Peter Wemm <peter@freebsd.org> wrote: > Author: peter > Date: Tue May 24 03:15:46 2016 > New Revision: 300557 > URL: https://svnweb.freebsd.org/changeset/base/300557 > > Log: > It seems <sys/types.h> is a new prerequisite for <bitstring.h> after > r300539. Attempt to fix the build for i386. > > Modified: > head/usr.sbin/apmd/apmd.c > head/usr.sbin/apmd/apmdlex.l > head/usr.sbin/apmd/apmdparse.y > > Are you sure this is necessary, even after 300544? From owner-svn-src-head@freebsd.org Tue May 24 04:09:56 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D905B47080; Tue, 24 May 2016 04:09:56 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id EC56B129C; Tue, 24 May 2016 04:09:55 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id E4EA2135E; Tue, 24 May 2016 04:09:55 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 983D92036D; Tue, 24 May 2016 04:09:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id ecElPX2MXQAf; Tue, 24 May 2016 04:09:52 +0000 (UTC) Subject: Re: svn commit: r299090 - in head: etc/mtree include lib/libbluetooth sbin/hastd share/man/man3 sys/dev/xen/blkback sys/kern sys/net sys/sys tests/sys tests/sys/sys usr.sbin/bluetooth/hccontrol DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com EEAB820364 To: cem@FreeBSD.org, Alan Somers <asomers@freebsd.org> References: <201605042234.u44MYBMX054443@repo.freebsd.org> <2368543.Vvp613SNcD@ralph.baldwin.cx> <684f4a82-f48c-b2bb-6a72-5c1dfea11a39@pix.net> <CAOtMX2iKmX9yOg5P5931E2JSRgS2QO4wRDuE8SmcvmR4JxO_Fw@mail.gmail.com> <8074ef26-cb70-2397-b71e-b897a1270d22@FreeBSD.org> <CAOtMX2iJPZS8YY6sLZVi4SsCPYJH6LVtu0Lgj5MWbsP73Jt8Tw@mail.gmail.com> <CAG6CVpXAfbf_bONUh9nsonEUpT+14zMfp6saRZTmVAjHJB1isw@mail.gmail.com> Cc: Kurt Lidl <lidl@pix.net>, John Baldwin <jhb@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> From: Bryan Drewery <bdrewery@FreeBSD.org> Organization: FreeBSD Message-ID: <fa854dad-21c0-2056-494f-c95f99f03aab@FreeBSD.org> Date: Mon, 23 May 2016 21:09:49 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <CAG6CVpXAfbf_bONUh9nsonEUpT+14zMfp6saRZTmVAjHJB1isw@mail.gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 04:09:56 -0000 On 5/23/16 4:42 PM, Conrad Meyer wrote: > On Mon, May 23, 2016 at 4:34 PM, Alan Somers <asomers@freebsd.org> wrote: >> On Mon, May 23, 2016 at 5:13 PM, Bryan Drewery <bdrewery@freebsd.org> wrote: >>> >>> On 5/23/16 1:30 PM, Alan Somers wrote: >>>> UPDATING is updated as of r300539. Any objection to merging this to >>>> stable/10? >>> >>> If any port uses it then yes. Binaries are built from 10.1 and expected >>> to work on 10.1, 10.2, 10.3, 10.4, etc. >> >> >> Most ports that use bitstring should work. The only ports that won't are >> ports that either store bitstrings on disk or transmit them across a network >> without an explicit serialization step. A few other weird cases would break >> too, like building a port on 10.3, updating sys/bitstring.h, then rebuilding >> some object files but not others. Is there any way to figure out what ports >> might be using this header? OpenHub code search didn't turn up anything. > > It seems to me like this is exactly the sort of ABI breakage the > stable/* branches promise not to make. I just noticed that this is not a library. It's only macros. So I take back what I said. -- Regards, Bryan Drewery From owner-svn-src-head@freebsd.org Tue May 24 04:55:02 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1610B47CB9; Tue, 24 May 2016 04:55:02 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E6491CFC; Tue, 24 May 2016 04:55:02 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O4t0BS032129; Tue, 24 May 2016 04:55:00 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O4t0q5032128; Tue, 24 May 2016 04:55:00 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605240455.u4O4t0q5032128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Tue, 24 May 2016 04:55:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300562 - head/sys/dev/bwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 04:55:02 -0000 Author: adrian Date: Tue May 24 04:55:00 2016 New Revision: 300562 URL: https://svnweb.freebsd.org/changeset/base/300562 Log: [bwn] add BCM43225 to the BHND device list. This is all for the bhnd(4) work in progress. It's enough to probe/attach all the bhnd internals, but we're missing OTP support and some cleanup code. And, well, all the rest of the bhnd(4) migration. So no, this won't give you BCM43225 support. Sorry! Modified: head/sys/dev/bwn/if_bwn_pci.c Modified: head/sys/dev/bwn/if_bwn_pci.c ============================================================================== --- head/sys/dev/bwn/if_bwn_pci.c Tue May 24 04:49:58 2016 (r300561) +++ head/sys/dev/bwn/if_bwn_pci.c Tue May 24 04:55:00 2016 (r300562) @@ -104,6 +104,7 @@ static const struct bwn_pci_device bcma_ BWN_BCM_DEV(BCM4331_D11N, "BCM4331 802.11n Dual-Band", 0), BWN_BCM_DEV(BCM4331_D11N2G, "BCM4331 802.11n 2GHz", 0), BWN_BCM_DEV(BCM4331_D11N5G, "BCM4331 802.11n 5GHz", 0), + BWN_BCM_DEV(BCM43225_D11N2G, "BCM43225 802.11n 2GHz", 0), { 0, 0, NULL, 0} }; From owner-svn-src-head@freebsd.org Tue May 24 04:59:03 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D64DB47D48; Tue, 24 May 2016 04:59:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4661A1EB8; Tue, 24 May 2016 04:59:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O4wwHe032267; Tue, 24 May 2016 04:58:58 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O4wweK032266; Tue, 24 May 2016 04:58:58 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605240458.u4O4wweK032266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Tue, 24 May 2016 04:58:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300563 - head/sys/dev/bwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 04:59:03 -0000 Author: adrian Date: Tue May 24 04:58:58 2016 New Revision: 300563 URL: https://svnweb.freebsd.org/changeset/base/300563 Log: [bwn] begin separating out the attach path from the SIBA specific bits. * convert phy_getinfo() to take a "gmode" flag, rather than the siba TGSHIGH flags and then check for 2GHz. This should ensure that gmode is set correctly even on DUALPHY NICs. * move the siba_powerup() call and the TGSHIGH decoding into a call to bwn_is_bus_siba(), and return an error if it's called on anything else. We don't yet do anything else, but when we do.. Tested: * BCM4322, 11a STA Modified: head/sys/dev/bwn/if_bwn.c Modified: head/sys/dev/bwn/if_bwn.c ============================================================================== --- head/sys/dev/bwn/if_bwn.c Tue May 24 04:55:00 2016 (r300562) +++ head/sys/dev/bwn/if_bwn.c Tue May 24 04:58:58 2016 (r300563) @@ -1148,46 +1148,41 @@ bwn_attach_core(struct bwn_mac *mac) { struct bwn_softc *sc = mac->mac_sc; int error, have_bg = 0, have_a = 0; - uint32_t high; KASSERT(siba_get_revid(sc->sc_dev) >= 5, ("unsupported revision %d", siba_get_revid(sc->sc_dev))); - siba_powerup(sc->sc_dev, 0); + if (bwn_is_bus_siba(mac)) { + uint32_t high; - high = siba_read_4(sc->sc_dev, SIBA_TGSHIGH); + siba_powerup(sc->sc_dev, 0); + high = siba_read_4(sc->sc_dev, SIBA_TGSHIGH); + have_a = (high & BWN_TGSHIGH_HAVE_5GHZ) ? 1 : 0; + have_bg = (high & BWN_TGSHIGH_HAVE_2GHZ) ? 1 : 0; + if (high & BWN_TGSHIGH_DUALPHY) { + have_bg = 1; + have_a = 1; + } + } else { + device_printf(sc->sc_dev, "%s: not siba; bailing\n", __func__); + error = ENXIO; + goto fail; + } /* * Guess at whether it has A-PHY or G-PHY. * This is just used for resetting the core to probe things; * we will re-guess once it's all up and working. - * - * XXX TODO: there's the TGSHIGH DUALPHY flag based on - * the PHY revision. */ - bwn_reset_core(mac, !!(high & BWN_TGSHIGH_HAVE_2GHZ)); + bwn_reset_core(mac, have_bg); /* * Get the PHY version. */ - error = bwn_phy_getinfo(mac, high); + error = bwn_phy_getinfo(mac, have_bg); if (error) goto fail; - /* XXX TODO need bhnd */ - if (bwn_is_bus_siba(mac)) { - have_a = (high & BWN_TGSHIGH_HAVE_5GHZ) ? 1 : 0; - have_bg = (high & BWN_TGSHIGH_HAVE_2GHZ) ? 1 : 0; - if (high & BWN_TGSHIGH_DUALPHY) { - have_bg = 1; - have_a = 1; - } - } else { - device_printf(sc->sc_dev, "%s: not siba; bailing\n", __func__); - error = ENXIO; - goto fail; - } - #if 0 device_printf(sc->sc_dev, "%s: high=0x%08x, have_a=%d, have_bg=%d," " deviceid=0x%04x, siba_deviceid=0x%04x\n", @@ -1379,7 +1374,7 @@ bwn_reset_core(struct bwn_mac *mac, int } static int -bwn_phy_getinfo(struct bwn_mac *mac, int tgshigh) +bwn_phy_getinfo(struct bwn_mac *mac, int gmode) { struct bwn_phy *phy = &mac->mac_phy; struct bwn_softc *sc = mac->mac_sc; @@ -1387,7 +1382,7 @@ bwn_phy_getinfo(struct bwn_mac *mac, int /* PHY */ tmp = BWN_READ_2(mac, BWN_PHYVER); - phy->gmode = !! (tgshigh & BWN_TGSHIGH_HAVE_2GHZ); + phy->gmode = gmode; phy->rf_on = 1; phy->analog = (tmp & BWN_PHYVER_ANALOG) >> 12; phy->type = (tmp & BWN_PHYVER_TYPE) >> 8; From owner-svn-src-head@freebsd.org Tue May 24 05:02:25 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E655CB47EF1; Tue, 24 May 2016 05:02:25 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B539212AB; Tue, 24 May 2016 05:02:25 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O52Owi035034; Tue, 24 May 2016 05:02:24 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O52OPO035033; Tue, 24 May 2016 05:02:24 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605240502.u4O52OPO035033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Tue, 24 May 2016 05:02:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300564 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 05:02:26 -0000 Author: truckman Date: Tue May 24 05:02:24 2016 New Revision: 300564 URL: https://svnweb.freebsd.org/changeset/base/300564 Log: Fix CID 1006692 in /usr/sbin/pw pw_log() function and other fixes The length of the name returned from the $LOGNAME and $USER can be very long and it was being concatenated to a fixed length buffer with no bounds checking. Fix this problem by limiting the length of the name copied. Additionally, this name is actually used to create a format string to be used in adding log file entries so embedded % characters in the name could confuse *printf(), and embedded whitespace could confuse a log file parser. Handle the former by escaping each % with an additional %, and handle the latter by simply stripping it out. Clean up the code by moving the variable declarations to the top of the function, formatting them to conform with style, and moving intialization elsewhere. Reduce code indentation by returning early in a couple of places. Reported by: Coverity CID: 1006692 Reviewed by: markj (previous version) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D6490 Modified: head/usr.sbin/pw/pw_log.c Modified: head/usr.sbin/pw/pw_log.c ============================================================================== --- head/usr.sbin/pw/pw_log.c Tue May 24 04:58:58 2016 (r300563) +++ head/usr.sbin/pw/pw_log.c Tue May 24 05:02:24 2016 (r300564) @@ -29,40 +29,90 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ +#include <ctype.h> +#include <err.h> #include <fcntl.h> #include <string.h> #include <stdarg.h> #include "pw.h" -static FILE *logfile = NULL; +static FILE *logfile = NULL; void pw_log(struct userconf * cnf, int mode, int which, char const * fmt,...) { - if (cnf->logfile && *cnf->logfile) { - if (logfile == NULL) { /* With umask==0 we need to control file access modes on create */ - int fd = open(cnf->logfile, O_WRONLY | O_CREAT | O_APPEND, 0600); + va_list argp; + time_t now; + const char *cp, *name; + struct tm *t; + int fd, i, rlen; + char nfmt[256], sname[32]; - if (fd != -1) - logfile = fdopen(fd, "a"); + if (cnf->logfile == NULL || cnf->logfile[0] == '\0') { + return; + } + + if (logfile == NULL) { + /* With umask==0 we need to control file access modes on create */ + fd = open(cnf->logfile, O_WRONLY | O_CREAT | O_APPEND, 0600); + if (fd == -1) { + return; } - if (logfile != NULL) { - va_list argp; - time_t now = time(NULL); - struct tm *t = localtime(&now); - char nfmt[256]; - const char *name; - - if ((name = getenv("LOGNAME")) == NULL && (name = getenv("USER")) == NULL) - name = "unknown"; - /* ISO 8601 International Standard Date format */ - strftime(nfmt, sizeof nfmt, "%Y-%m-%d %T ", t); - sprintf(nfmt + strlen(nfmt), "[%s:%s%s] %s\n", name, Which[which], Modes[mode], fmt); - va_start(argp, fmt); - vfprintf(logfile, nfmt, argp); - va_end(argp); - fflush(logfile); + logfile = fdopen(fd, "a"); + if (logfile == NULL) { + return; } } + + if ((name = getenv("LOGNAME")) == NULL && + (name = getenv("USER")) == NULL) { + strcpy(sname, "unknown"); + } else { + /* + * Since "name" will be embedded in a printf-like format, + * we must sanitize it: + * + * Limit its length so other information in the message + * is not truncated + * + * Squeeze out embedded whitespace for the benefit of + * log file parsers + * + * Escape embedded % characters with another % + */ + for (i = 0, cp = name; + *cp != '\0' && i < (int)sizeof(sname) - 1; cp++) { + if (*cp == '%') { + if (i < (int)sizeof(sname) - 2) { + sname[i++] = '%'; + sname[i++] = '%'; + } else { + break; + } + } else if (!isspace(*cp)) { + sname[i++] = *cp; + } /* else do nothing */ + } + if (i == 0) { + strcpy(sname, "unknown"); + } else { + sname[i] = '\0'; + } + } + now = time(NULL); + t = localtime(&now); + /* ISO 8601 International Standard Date format */ + strftime(nfmt, sizeof nfmt, "%Y-%m-%d %T ", t); + rlen = sizeof(nfmt) - strlen(nfmt); + if (rlen <= 0 || snprintf(nfmt + strlen(nfmt), rlen, + "[%s:%s%s] %s\n", sname, Which[which], Modes[mode], + fmt) >= rlen) { + warnx("log format overflow, user name=%s", sname); + } else { + va_start(argp, fmt); + vfprintf(logfile, nfmt, argp); + va_end(argp); + fflush(logfile); + } } From owner-svn-src-head@freebsd.org Tue May 24 05:06:02 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C67C1B48060; Tue, 24 May 2016 05:06:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 762001794; Tue, 24 May 2016 05:06:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O561J2035180; Tue, 24 May 2016 05:06:01 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O5614t035178; Tue, 24 May 2016 05:06:01 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605240506.u4O5614t035178@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Tue, 24 May 2016 05:06:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300565 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 05:06:02 -0000 Author: sephe Date: Tue May 24 05:06:01 2016 New Revision: 300565 URL: https://svnweb.freebsd.org/changeset/base/300565 Log: hyperv/vmbus: Move vmbus interrupt counter into vmbus softc MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6497 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 05:02:24 2016 (r300564) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 05:06:01 2016 (r300565) @@ -186,12 +186,11 @@ hv_vmbus_isr(struct trapframe *frame) return (FILTER_HANDLED); } -u_long *hv_vmbus_intr_cpu[MAXCPU]; - void hv_vector_handler(struct trapframe *trap_frame) { - int cpu; + struct vmbus_softc *sc = vmbus_get_softc(); + int cpu = curcpu; /* * Disable preemption. @@ -201,8 +200,7 @@ hv_vector_handler(struct trapframe *trap /* * Do a little interrupt counting. */ - cpu = PCPU_GET(cpuid); - (*hv_vmbus_intr_cpu[cpu])++; + (*VMBUS_SC_PCPU_GET(sc, intr_cnt, cpu))++; hv_vmbus_isr(trap_frame); @@ -400,7 +398,7 @@ vmbus_bus_init(void) CPU_FOREACH(j) { snprintf(buf, sizeof(buf), "cpu%d:hyperv", j); - intrcnt_add(buf, &hv_vmbus_intr_cpu[j]); + intrcnt_add(buf, VMBUS_SC_PCPU_PTR(sc, intr_cnt, j)); for (i = 0; i < 2; i++) setup_args.page_buffers[2 * j + i] = NULL; Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Tue May 24 05:02:24 2016 (r300564) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Tue May 24 05:06:01 2016 (r300565) @@ -33,6 +33,7 @@ struct vmbus_pcpu_data { int event_flag_cnt; /* # of event flags */ + u_long *intr_cnt; } __aligned(CACHE_LINE_SIZE); struct vmbus_softc { From owner-svn-src-head@freebsd.org Tue May 24 05:18:28 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AF07B4833B; Tue, 24 May 2016 05:18:28 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 152A71FF8; Tue, 24 May 2016 05:18:27 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O5IQWD038481; Tue, 24 May 2016 05:18:26 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O5IQUT038480; Tue, 24 May 2016 05:18:26 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605240518.u4O5IQUT038480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Tue, 24 May 2016 05:18:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300567 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 05:18:28 -0000 Author: sephe Date: Tue May 24 05:18:26 2016 New Revision: 300567 URL: https://svnweb.freebsd.org/changeset/base/300567 Log: hyperv/vmbus: Pass vmbus_softc and curcpu to hv_vmbus_isr() MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6498 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 05:11:55 2016 (r300566) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 05:18:26 2016 (r300567) @@ -131,11 +131,9 @@ handled: * message to process - an event or a channel message. */ static inline int -hv_vmbus_isr(struct trapframe *frame) +hv_vmbus_isr(struct vmbus_softc *sc, struct trapframe *frame, int cpu) { - struct vmbus_softc *sc = vmbus_get_softc(); hv_vmbus_message *msg, *msg_base; - int cpu = curcpu; /* * The Windows team has advised that we check for events @@ -202,7 +200,7 @@ hv_vector_handler(struct trapframe *trap */ (*VMBUS_SC_PCPU_GET(sc, intr_cnt, cpu))++; - hv_vmbus_isr(trap_frame); + hv_vmbus_isr(sc, trap_frame, cpu); /* * Enable preemption. From owner-svn-src-head@freebsd.org Tue May 24 05:26:54 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AED4B4852A; Tue, 24 May 2016 05:26:54 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1AA78173E; Tue, 24 May 2016 05:26:54 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O5QrkC041766; Tue, 24 May 2016 05:26:53 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O5Qrnt041765; Tue, 24 May 2016 05:26:53 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605240526.u4O5Qrnt041765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Tue, 24 May 2016 05:26:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300568 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 05:26:54 -0000 Author: sephe Date: Tue May 24 05:26:52 2016 New Revision: 300568 URL: https://svnweb.freebsd.org/changeset/base/300568 Log: hyperv/busdma: Take BUS_DMA_ZERO into account MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6499 Modified: head/sys/dev/hyperv/vmbus/hyperv_busdma.c Modified: head/sys/dev/hyperv/vmbus/hyperv_busdma.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv_busdma.c Tue May 24 05:18:26 2016 (r300567) +++ head/sys/dev/hyperv/vmbus/hyperv_busdma.c Tue May 24 05:26:52 2016 (r300568) @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include <dev/hyperv/include/hyperv_busdma.h> -#define HYPERV_DMA_WAITMASK (BUS_DMA_WAITOK | BUS_DMA_NOWAIT) +#define HYPERV_DMA_MASK (BUS_DMA_WAITOK | BUS_DMA_NOWAIT | BUS_DMA_ZERO) void hyperv_dma_map_paddr(void *arg, bus_dma_segment_t *segs, int nseg, int error) @@ -73,7 +73,7 @@ hyperv_dmamem_alloc(bus_dma_tag_t parent return NULL; error = bus_dmamem_alloc(dma->hv_dtag, &ret, - (flags & HYPERV_DMA_WAITMASK) | BUS_DMA_COHERENT, &dma->hv_dmap); + (flags & HYPERV_DMA_MASK) | BUS_DMA_COHERENT, &dma->hv_dmap); if (error) { bus_dma_tag_destroy(dma->hv_dtag); return NULL; From owner-svn-src-head@freebsd.org Tue May 24 05:29:43 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66216B485A7; Tue, 24 May 2016 05:29:43 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D86818F8; Tue, 24 May 2016 05:29:43 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O5TgYf041894; Tue, 24 May 2016 05:29:42 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O5Tg2k041893; Tue, 24 May 2016 05:29:42 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201605240529.u4O5Tg2k041893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin <dchagin@FreeBSD.org> Date: Tue, 24 May 2016 05:29:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300569 - head/sys/compat/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 05:29:43 -0000 Author: dchagin Date: Tue May 24 05:29:41 2016 New Revision: 300569 URL: https://svnweb.freebsd.org/changeset/base/300569 Log: Don't leak fp in case where fo_ioctl() returns an error. Reported by: C Turt <ecturt@gmail.com> MFC after: 1 week Modified: head/sys/compat/linux/linux_ioctl.c Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Tue May 24 05:26:52 2016 (r300568) +++ head/sys/compat/linux/linux_ioctl.c Tue May 24 05:29:41 2016 (r300569) @@ -977,7 +977,7 @@ linux_ioctl_termio(struct thread *td, st error = fo_ioctl(fp, TIOCGETD, (caddr_t)&bsd_line, td->td_ucred, td); if (error) - return (error); + break; switch (bsd_line) { case TTYDISC: linux_line = LINUX_N_TTY; From owner-svn-src-head@freebsd.org Tue May 24 05:43:58 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67C7FB4896A; Tue, 24 May 2016 05:43:58 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 143581299; Tue, 24 May 2016 05:43:57 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O5ht4Q047510; Tue, 24 May 2016 05:43:55 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O5ht5F047509; Tue, 24 May 2016 05:43:55 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605240543.u4O5ht5F047509@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Tue, 24 May 2016 05:43:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300570 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 05:43:58 -0000 Author: sephe Date: Tue May 24 05:43:55 2016 New Revision: 300570 URL: https://svnweb.freebsd.org/changeset/base/300570 Log: hyperv/vmbus: Rename local variable and break long lines No functional changes. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6500 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 05:29:41 2016 (r300569) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 05:43:55 2016 (r300570) @@ -370,7 +370,7 @@ static int vmbus_bus_init(void) { struct vmbus_softc *sc; - int i, j, n, ret; + int i, n, ret, cpu; char buf[MAXCOMLEN + 1]; cpuset_t cpu_mask; @@ -394,44 +394,49 @@ vmbus_bus_init(void) sc->vmbus_idtvec); } - CPU_FOREACH(j) { - snprintf(buf, sizeof(buf), "cpu%d:hyperv", j); - intrcnt_add(buf, VMBUS_SC_PCPU_PTR(sc, intr_cnt, j)); + CPU_FOREACH(cpu) { + snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu); + intrcnt_add(buf, VMBUS_SC_PCPU_PTR(sc, intr_cnt, cpu)); for (i = 0; i < 2; i++) - setup_args.page_buffers[2 * j + i] = NULL; + setup_args.page_buffers[2 * cpu + i] = NULL; } /* * Per cpu setup. */ - CPU_FOREACH(j) { + CPU_FOREACH(cpu) { /* * Setup taskqueue to handle events */ - hv_vmbus_g_context.hv_event_queue[j] = taskqueue_create_fast("hyperv event", M_WAITOK, - taskqueue_thread_enqueue, &hv_vmbus_g_context.hv_event_queue[j]); - CPU_SETOF(j, &cpu_mask); - taskqueue_start_threads_cpuset(&hv_vmbus_g_context.hv_event_queue[j], 1, PI_NET, &cpu_mask, - "hvevent%d", j); + hv_vmbus_g_context.hv_event_queue[cpu] = + taskqueue_create_fast("hyperv event", M_WAITOK, + taskqueue_thread_enqueue, + &hv_vmbus_g_context.hv_event_queue[cpu]); + CPU_SETOF(cpu, &cpu_mask); + taskqueue_start_threads_cpuset( + &hv_vmbus_g_context.hv_event_queue[cpu], 1, PI_NET, + &cpu_mask, "hvevent%d", cpu); /* * Setup per-cpu tasks and taskqueues to handle msg. */ - hv_vmbus_g_context.hv_msg_tq[j] = taskqueue_create_fast( + hv_vmbus_g_context.hv_msg_tq[cpu] = taskqueue_create_fast( "hyperv msg", M_WAITOK, taskqueue_thread_enqueue, - &hv_vmbus_g_context.hv_msg_tq[j]); - CPU_SETOF(j, &cpu_mask); - taskqueue_start_threads_cpuset(&hv_vmbus_g_context.hv_msg_tq[j], - 1, PI_NET, &cpu_mask, "hvmsg%d", j); - TASK_INIT(&hv_vmbus_g_context.hv_msg_task[j], 0, + &hv_vmbus_g_context.hv_msg_tq[cpu]); + CPU_SETOF(cpu, &cpu_mask); + taskqueue_start_threads_cpuset( + &hv_vmbus_g_context.hv_msg_tq[cpu], 1, PI_NET, + &cpu_mask, "hvmsg%d", cpu); + TASK_INIT(&hv_vmbus_g_context.hv_msg_task[cpu], 0, vmbus_msg_task, NULL); /* - * Prepare the per cpu msg and event pages to be called on each cpu. + * Prepare the per cpu msg and event pages to be called on + * each cpu. */ for(i = 0; i < 2; i++) { - setup_args.page_buffers[2 * j + i] = + setup_args.page_buffers[2 * cpu + i] = malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO); } } @@ -475,10 +480,10 @@ vmbus_bus_init(void) /* * remove swi and vmbus callback vector; */ - CPU_FOREACH(j) { - if (hv_vmbus_g_context.hv_event_queue[j] != NULL) { - taskqueue_free(hv_vmbus_g_context.hv_event_queue[j]); - hv_vmbus_g_context.hv_event_queue[j] = NULL; + CPU_FOREACH(cpu) { + if (hv_vmbus_g_context.hv_event_queue[cpu] != NULL) { + taskqueue_free(hv_vmbus_g_context.hv_event_queue[cpu]); + hv_vmbus_g_context.hv_event_queue[cpu] = NULL; } } From owner-svn-src-head@freebsd.org Tue May 24 05:52:01 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F107B48C33; Tue, 24 May 2016 05:52:01 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9AE781A21; Tue, 24 May 2016 05:52:00 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O5pqMK049586; Tue, 24 May 2016 05:51:52 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O5ppPk049558; Tue, 24 May 2016 05:51:51 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605240551.u4O5ppPk049558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Tue, 24 May 2016 05:51:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300571 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 05:52:01 -0000 Author: sephe Date: Tue May 24 05:51:51 2016 New Revision: 300571 URL: https://svnweb.freebsd.org/changeset/base/300571 Log: hyperv/vmbus: Move SynIC setup/teardown from hyperv file to vmbus file Avoid unnecessary exposure. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6501 Modified: head/sys/dev/hyperv/vmbus/hv_hv.c head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_hv.c Tue May 24 05:43:55 2016 (r300570) +++ head/sys/dev/hyperv/vmbus/hv_hv.c Tue May 24 05:51:51 2016 (r300571) @@ -216,132 +216,6 @@ hv_vmbus_signal_event(void *con_id) return (status); } -/** - * @brief hv_vmbus_synic_init - */ -void -hv_vmbus_synic_init(void *arg) -{ - struct vmbus_softc *sc = vmbus_get_softc(); - int cpu; - uint64_t hv_vcpu_index; - hv_vmbus_synic_simp simp; - hv_vmbus_synic_siefp siefp; - hv_vmbus_synic_scontrol sctrl; - hv_vmbus_synic_sint shared_sint; - uint64_t version; - hv_setup_args* setup_args = (hv_setup_args *)arg; - - cpu = PCPU_GET(cpuid); - - /* - * TODO: Check the version - */ - version = rdmsr(HV_X64_MSR_SVERSION); - - hv_vmbus_g_context.syn_ic_msg_page[cpu] = - setup_args->page_buffers[2 * cpu]; - hv_vmbus_g_context.syn_ic_event_page[cpu] = - setup_args->page_buffers[2 * cpu + 1]; - - /* - * Setup the Synic's message page - */ - - simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); - simp.u.simp_enabled = 1; - simp.u.base_simp_gpa = ((hv_get_phys_addr( - hv_vmbus_g_context.syn_ic_msg_page[cpu])) >> PAGE_SHIFT); - - wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); - - /* - * Setup the Synic's event page - */ - siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); - siefp.u.siefp_enabled = 1; - siefp.u.base_siefp_gpa = ((hv_get_phys_addr( - hv_vmbus_g_context.syn_ic_event_page[cpu])) >> PAGE_SHIFT); - - wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); - - /*HV_SHARED_SINT_IDT_VECTOR + 0x20; */ - shared_sint.as_uint64_t = 0; - shared_sint.u.vector = sc->vmbus_idtvec; - shared_sint.u.masked = FALSE; - shared_sint.u.auto_eoi = TRUE; - - wrmsr(HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT, - shared_sint.as_uint64_t); - - wrmsr(HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT, - shared_sint.as_uint64_t); - - /* Enable the global synic bit */ - sctrl.as_uint64_t = rdmsr(HV_X64_MSR_SCONTROL); - sctrl.u.enable = 1; - - wrmsr(HV_X64_MSR_SCONTROL, sctrl.as_uint64_t); - - hv_vmbus_g_context.syn_ic_initialized = TRUE; - - /* - * Set up the cpuid mapping from Hyper-V to FreeBSD. - * The array is indexed using FreeBSD cpuid. - */ - hv_vcpu_index = rdmsr(HV_X64_MSR_VP_INDEX); - hv_vmbus_g_context.hv_vcpu_index[cpu] = (uint32_t)hv_vcpu_index; - - return; -} - -/** - * @brief Cleanup routine for hv_vmbus_synic_init() - */ -void hv_vmbus_synic_cleanup(void *arg) -{ - hv_vmbus_synic_sint shared_sint; - hv_vmbus_synic_simp simp; - hv_vmbus_synic_siefp siefp; - - if (!hv_vmbus_g_context.syn_ic_initialized) - return; - - shared_sint.as_uint64_t = rdmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT); - - shared_sint.u.masked = 1; - - /* - * Disable the interrupt 0 - */ - wrmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT, - shared_sint.as_uint64_t); - - shared_sint.as_uint64_t = rdmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT); - - shared_sint.u.masked = 1; - - /* - * Disable the interrupt 1 - */ - wrmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT, - shared_sint.as_uint64_t); - simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); - simp.u.simp_enabled = 0; - simp.u.base_simp_gpa = 0; - - wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); - - siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); - siefp.u.siefp_enabled = 0; - siefp.u.base_siefp_gpa = 0; - - wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); -} static bool hyperv_identify(void) Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 05:43:55 2016 (r300570) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 05:51:51 2016 (r300571) @@ -208,6 +208,126 @@ hv_vector_handler(struct trapframe *trap critical_exit(); } +static void +vmbus_synic_setup(void *arg) +{ + struct vmbus_softc *sc = vmbus_get_softc(); + int cpu; + uint64_t hv_vcpu_index; + hv_vmbus_synic_simp simp; + hv_vmbus_synic_siefp siefp; + hv_vmbus_synic_scontrol sctrl; + hv_vmbus_synic_sint shared_sint; + uint64_t version; + hv_setup_args* setup_args = (hv_setup_args *)arg; + + cpu = PCPU_GET(cpuid); + + /* + * TODO: Check the version + */ + version = rdmsr(HV_X64_MSR_SVERSION); + + hv_vmbus_g_context.syn_ic_msg_page[cpu] = + setup_args->page_buffers[2 * cpu]; + hv_vmbus_g_context.syn_ic_event_page[cpu] = + setup_args->page_buffers[2 * cpu + 1]; + + /* + * Setup the Synic's message page + */ + + simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); + simp.u.simp_enabled = 1; + simp.u.base_simp_gpa = ((hv_get_phys_addr( + hv_vmbus_g_context.syn_ic_msg_page[cpu])) >> PAGE_SHIFT); + + wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); + + /* + * Setup the Synic's event page + */ + siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); + siefp.u.siefp_enabled = 1; + siefp.u.base_siefp_gpa = ((hv_get_phys_addr( + hv_vmbus_g_context.syn_ic_event_page[cpu])) >> PAGE_SHIFT); + + wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); + + /*HV_SHARED_SINT_IDT_VECTOR + 0x20; */ + shared_sint.as_uint64_t = 0; + shared_sint.u.vector = sc->vmbus_idtvec; + shared_sint.u.masked = FALSE; + shared_sint.u.auto_eoi = TRUE; + + wrmsr(HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT, + shared_sint.as_uint64_t); + + wrmsr(HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT, + shared_sint.as_uint64_t); + + /* Enable the global synic bit */ + sctrl.as_uint64_t = rdmsr(HV_X64_MSR_SCONTROL); + sctrl.u.enable = 1; + + wrmsr(HV_X64_MSR_SCONTROL, sctrl.as_uint64_t); + + hv_vmbus_g_context.syn_ic_initialized = TRUE; + + /* + * Set up the cpuid mapping from Hyper-V to FreeBSD. + * The array is indexed using FreeBSD cpuid. + */ + hv_vcpu_index = rdmsr(HV_X64_MSR_VP_INDEX); + hv_vmbus_g_context.hv_vcpu_index[cpu] = (uint32_t)hv_vcpu_index; +} + +static void +vmbus_synic_teardown(void *arg) +{ + hv_vmbus_synic_sint shared_sint; + hv_vmbus_synic_simp simp; + hv_vmbus_synic_siefp siefp; + + if (!hv_vmbus_g_context.syn_ic_initialized) + return; + + shared_sint.as_uint64_t = rdmsr( + HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT); + + shared_sint.u.masked = 1; + + /* + * Disable the interrupt 0 + */ + wrmsr( + HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT, + shared_sint.as_uint64_t); + + shared_sint.as_uint64_t = rdmsr( + HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT); + + shared_sint.u.masked = 1; + + /* + * Disable the interrupt 1 + */ + wrmsr( + HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT, + shared_sint.as_uint64_t); + simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); + simp.u.simp_enabled = 0; + simp.u.base_simp_gpa = 0; + + wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); + + siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); + siefp.u.siefp_enabled = 0; + siefp.u.base_siefp_gpa = 0; + + wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); +} + static int vmbus_read_ivar( device_t dev, @@ -445,7 +565,7 @@ vmbus_bus_init(void) printf("VMBUS: Calling smp_rendezvous, smp_started = %d\n", smp_started); - smp_rendezvous(NULL, hv_vmbus_synic_init, NULL, &setup_args); + smp_rendezvous(NULL, vmbus_synic_setup, NULL, &setup_args); /* * Connect to VMBus in the root partition @@ -553,7 +673,7 @@ vmbus_detach(device_t dev) hv_vmbus_release_unattached_channels(); hv_vmbus_disconnect(); - smp_rendezvous(NULL, hv_vmbus_synic_cleanup, NULL, NULL); + smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL); for(i = 0; i < 2 * MAXCPU; i++) { if (setup_args.page_buffers[i] != NULL) Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue May 24 05:43:55 2016 (r300570) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue May 24 05:51:51 2016 (r300571) @@ -727,8 +727,6 @@ uint16_t hv_vmbus_post_msg_via_msg_ipc( size_t payload_size); uint16_t hv_vmbus_signal_event(void *con_id); -void hv_vmbus_synic_init(void *irq_arg); -void hv_vmbus_synic_cleanup(void *arg); struct hv_device* hv_vmbus_child_device_create( hv_guid device_type, From owner-svn-src-head@freebsd.org Tue May 24 06:01:50 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AA23B48F5B; Tue, 24 May 2016 06:01:50 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E0A81EFA; Tue, 24 May 2016 06:01:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O61eMb054552; Tue, 24 May 2016 06:01:40 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O61emP054548; Tue, 24 May 2016 06:01:40 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605240601.u4O61emP054548@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Tue, 24 May 2016 06:01:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300572 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 06:01:50 -0000 Author: sephe Date: Tue May 24 06:01:39 2016 New Revision: 300572 URL: https://svnweb.freebsd.org/changeset/base/300572 Log: hyperv/vmbus: Use busdma(9) for messages and event flags And - Move message and event flags to vmbus_softc per-cpu data. - Get rid of hv_setup_arg, which serves no purpose now. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6502 Modified: head/sys/dev/hyperv/vmbus/hv_connection.c head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Tue May 24 05:51:51 2016 (r300571) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Tue May 24 06:01:39 2016 (r300572) @@ -333,13 +333,11 @@ vmbus_event_proc(struct vmbus_softc *sc, { hv_vmbus_synic_event_flags *event; - event = hv_vmbus_g_context.syn_ic_event_page[cpu] + - HV_VMBUS_MESSAGE_SINT; - /* * On Host with Win8 or above, the event page can be checked directly * to get the id of the channel that has the pending interrupt. */ + event = VMBUS_SC_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; vmbus_event_flags_proc(event->flagsul, VMBUS_SC_PCPU_GET(sc, event_flag_cnt, cpu)); } @@ -349,9 +347,7 @@ vmbus_event_proc_compat(struct vmbus_sof { hv_vmbus_synic_event_flags *event; - event = hv_vmbus_g_context.syn_ic_event_page[cpu] + - HV_VMBUS_MESSAGE_SINT; - + event = VMBUS_SC_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; if (atomic_testandclear_int(&event->flags32[0], 0)) { vmbus_event_flags_proc( hv_vmbus_g_connection.recv_interrupt_page, Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 05:51:51 2016 (r300571) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 06:01:39 2016 (r300572) @@ -69,18 +69,16 @@ __FBSDID("$FreeBSD$"); struct vmbus_softc *vmbus_sc; static int vmbus_inited; -static hv_setup_args setup_args; /* only CPU 0 supported at this time */ static char *vmbus_ids[] = { "VMBUS", NULL }; static void -vmbus_msg_task(void *arg __unused, int pending __unused) +vmbus_msg_task(void *xsc, int pending __unused) { + struct vmbus_softc *sc = xsc; hv_vmbus_message *msg; - msg = hv_vmbus_g_context.syn_ic_msg_page[curcpu] + - HV_VMBUS_MESSAGE_SINT; - + msg = VMBUS_SC_PCPU_GET(sc, message, curcpu) + HV_VMBUS_MESSAGE_SINT; for (;;) { const hv_vmbus_channel_msg_table_entry *entry; hv_vmbus_channel_msg_header *hdr; @@ -143,7 +141,7 @@ hv_vmbus_isr(struct vmbus_softc *sc, str sc->vmbus_event_proc(sc, cpu); /* Check if there are actual msgs to be process */ - msg_base = hv_vmbus_g_context.syn_ic_msg_page[cpu]; + msg_base = VMBUS_SC_PCPU_GET(sc, message, cpu); msg = msg_base + HV_VMBUS_TIMER_SINT; /* we call eventtimer process the message */ @@ -209,7 +207,7 @@ hv_vector_handler(struct trapframe *trap } static void -vmbus_synic_setup(void *arg) +vmbus_synic_setup(void *arg __unused) { struct vmbus_softc *sc = vmbus_get_softc(); int cpu; @@ -219,7 +217,6 @@ vmbus_synic_setup(void *arg) hv_vmbus_synic_scontrol sctrl; hv_vmbus_synic_sint shared_sint; uint64_t version; - hv_setup_args* setup_args = (hv_setup_args *)arg; cpu = PCPU_GET(cpuid); @@ -228,19 +225,13 @@ vmbus_synic_setup(void *arg) */ version = rdmsr(HV_X64_MSR_SVERSION); - hv_vmbus_g_context.syn_ic_msg_page[cpu] = - setup_args->page_buffers[2 * cpu]; - hv_vmbus_g_context.syn_ic_event_page[cpu] = - setup_args->page_buffers[2 * cpu + 1]; - /* * Setup the Synic's message page */ - simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); simp.u.simp_enabled = 1; - simp.u.base_simp_gpa = ((hv_get_phys_addr( - hv_vmbus_g_context.syn_ic_msg_page[cpu])) >> PAGE_SHIFT); + simp.u.base_simp_gpa = + VMBUS_SC_PCPU_GET(sc, message_dma.hv_paddr, cpu) >> PAGE_SHIFT; wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); @@ -249,8 +240,8 @@ vmbus_synic_setup(void *arg) */ siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); siefp.u.siefp_enabled = 1; - siefp.u.base_siefp_gpa = ((hv_get_phys_addr( - hv_vmbus_g_context.syn_ic_event_page[cpu])) >> PAGE_SHIFT); + siefp.u.base_siefp_gpa = + VMBUS_SC_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT; wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); @@ -328,6 +319,47 @@ vmbus_synic_teardown(void *arg) wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); } +static void +vmbus_dma_alloc(struct vmbus_softc *sc) +{ + int cpu; + + CPU_FOREACH(cpu) { + /* + * Per-cpu messages and event flags. + */ + VMBUS_SC_PCPU_GET(sc, message, cpu) = hyperv_dmamem_alloc( + bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE, + VMBUS_SC_PCPU_PTR(sc, message_dma, cpu), + BUS_DMA_WAITOK | BUS_DMA_ZERO); + VMBUS_SC_PCPU_GET(sc, event_flag, cpu) = hyperv_dmamem_alloc( + bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE, + VMBUS_SC_PCPU_PTR(sc, event_flag_dma, cpu), + BUS_DMA_WAITOK | BUS_DMA_ZERO); + } +} + +static void +vmbus_dma_free(struct vmbus_softc *sc) +{ + int cpu; + + CPU_FOREACH(cpu) { + if (VMBUS_SC_PCPU_GET(sc, message, cpu) != NULL) { + hyperv_dmamem_free( + VMBUS_SC_PCPU_PTR(sc, message_dma, cpu), + VMBUS_SC_PCPU_GET(sc, message, cpu)); + VMBUS_SC_PCPU_GET(sc, message, cpu) = NULL; + } + if (VMBUS_SC_PCPU_GET(sc, event_flag, cpu) != NULL) { + hyperv_dmamem_free( + VMBUS_SC_PCPU_PTR(sc, event_flag_dma, cpu), + VMBUS_SC_PCPU_GET(sc, event_flag, cpu)); + VMBUS_SC_PCPU_GET(sc, event_flag, cpu) = NULL; + } + } +} + static int vmbus_read_ivar( device_t dev, @@ -490,7 +522,7 @@ static int vmbus_bus_init(void) { struct vmbus_softc *sc; - int i, n, ret, cpu; + int ret, cpu; char buf[MAXCOMLEN + 1]; cpuset_t cpu_mask; @@ -517,9 +549,6 @@ vmbus_bus_init(void) CPU_FOREACH(cpu) { snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu); intrcnt_add(buf, VMBUS_SC_PCPU_PTR(sc, intr_cnt, cpu)); - - for (i = 0; i < 2; i++) - setup_args.page_buffers[2 * cpu + i] = NULL; } /* @@ -549,23 +578,18 @@ vmbus_bus_init(void) &hv_vmbus_g_context.hv_msg_tq[cpu], 1, PI_NET, &cpu_mask, "hvmsg%d", cpu); TASK_INIT(&hv_vmbus_g_context.hv_msg_task[cpu], 0, - vmbus_msg_task, NULL); - - /* - * Prepare the per cpu msg and event pages to be called on - * each cpu. - */ - for(i = 0; i < 2; i++) { - setup_args.page_buffers[2 * cpu + i] = - malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO); - } + vmbus_msg_task, sc); } + /* + * Allocate vmbus DMA stuffs. + */ + vmbus_dma_alloc(sc); + if (bootverbose) printf("VMBUS: Calling smp_rendezvous, smp_started = %d\n", smp_started); - - smp_rendezvous(NULL, vmbus_synic_setup, NULL, &setup_args); + smp_rendezvous(NULL, vmbus_synic_setup, NULL, NULL); /* * Connect to VMBus in the root partition @@ -589,13 +613,8 @@ vmbus_bus_init(void) return (ret); - cleanup1: - /* - * Free pages alloc'ed - */ - for (n = 0; n < 2 * MAXCPU; n++) - if (setup_args.page_buffers[n] != NULL) - free(setup_args.page_buffers[n], M_DEVBUF); +cleanup1: + vmbus_dma_free(sc); /* * remove swi and vmbus callback vector; @@ -675,10 +694,7 @@ vmbus_detach(device_t dev) smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL); - for(i = 0; i < 2 * MAXCPU; i++) { - if (setup_args.page_buffers[i] != NULL) - free(setup_args.page_buffers[i], M_DEVBUF); - } + vmbus_dma_free(sc); /* remove swi */ CPU_FOREACH(i) { Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue May 24 05:51:51 2016 (r300571) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue May 24 06:01:39 2016 (r300572) @@ -203,8 +203,6 @@ union vmbus_event_flags; typedef struct { hv_bool_uint8_t syn_ic_initialized; - struct vmbus_message *syn_ic_msg_page[MAXCPU]; - union vmbus_event_flags *syn_ic_event_page[MAXCPU]; /* * For FreeBSD cpuid to Hyper-V vcpuid mapping. */ @@ -755,8 +753,4 @@ void hv_et_intr(struct trapframe*); /* Wait for device creation */ void vmbus_scan(void); -typedef struct { - void *page_buffers[2 * MAXCPU]; -} hv_setup_args; - #endif /* __HYPERV_PRIV_H__ */ Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Tue May 24 05:51:51 2016 (r300571) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Tue May 24 06:01:39 2016 (r300572) @@ -30,10 +30,18 @@ #define _VMBUS_VAR_H_ #include <sys/param.h> +#include <sys/bus_dma.h> +#include <dev/hyperv/include/hyperv_busdma.h> struct vmbus_pcpu_data { - int event_flag_cnt; /* # of event flags */ - u_long *intr_cnt; + u_long *intr_cnt; /* Hyper-V interrupt counter */ + struct vmbus_message *message; /* shared messages */ + int event_flag_cnt; /* # of event flags */ + union vmbus_event_flags *event_flag; /* shared event flags */ + + /* Rarely used fields */ + struct hyperv_dma message_dma; /* busdma glue */ + struct hyperv_dma event_flag_dma; /* busdma glue */ } __aligned(CACHE_LINE_SIZE); struct vmbus_softc { From owner-svn-src-head@freebsd.org Tue May 24 06:10:22 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC6DCB48093; Tue, 24 May 2016 06:10:22 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF2101320; Tue, 24 May 2016 06:10:22 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O6ALgJ054828; Tue, 24 May 2016 06:10:21 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O6ALXV054825; Tue, 24 May 2016 06:10:21 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605240610.u4O6ALXV054825@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Tue, 24 May 2016 06:10:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300573 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 06:10:23 -0000 Author: sephe Date: Tue May 24 06:10:21 2016 New Revision: 300573 URL: https://svnweb.freebsd.org/changeset/base/300573 Log: hyperv/vmbus: Git rid of sc version of pcpu data extraction macro MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6503 Modified: head/sys/dev/hyperv/vmbus/hv_connection.c head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Tue May 24 06:01:39 2016 (r300572) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Tue May 24 06:10:21 2016 (r300573) @@ -337,9 +337,9 @@ vmbus_event_proc(struct vmbus_softc *sc, * On Host with Win8 or above, the event page can be checked directly * to get the id of the channel that has the pending interrupt. */ - event = VMBUS_SC_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; + event = VMBUS_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; vmbus_event_flags_proc(event->flagsul, - VMBUS_SC_PCPU_GET(sc, event_flag_cnt, cpu)); + VMBUS_PCPU_GET(sc, event_flag_cnt, cpu)); } void @@ -347,7 +347,7 @@ vmbus_event_proc_compat(struct vmbus_sof { hv_vmbus_synic_event_flags *event; - event = VMBUS_SC_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; + event = VMBUS_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; if (atomic_testandclear_int(&event->flags32[0], 0)) { vmbus_event_flags_proc( hv_vmbus_g_connection.recv_interrupt_page, @@ -415,7 +415,8 @@ vmbus_on_channel_open(const struct hv_vm int flag_cnt; flag_cnt = (chan->offer_msg.child_rel_id / HV_CHANNEL_ULONG_LEN) + 1; - flag_cnt_ptr = VMBUS_PCPU_PTR(event_flag_cnt, chan->target_cpu); + flag_cnt_ptr = VMBUS_PCPU_PTR(vmbus_get_softc(), event_flag_cnt, + chan->target_cpu); for (;;) { int old_flag_cnt; Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 06:01:39 2016 (r300572) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 06:10:21 2016 (r300573) @@ -78,7 +78,7 @@ vmbus_msg_task(void *xsc, int pending __ struct vmbus_softc *sc = xsc; hv_vmbus_message *msg; - msg = VMBUS_SC_PCPU_GET(sc, message, curcpu) + HV_VMBUS_MESSAGE_SINT; + msg = VMBUS_PCPU_GET(sc, message, curcpu) + HV_VMBUS_MESSAGE_SINT; for (;;) { const hv_vmbus_channel_msg_table_entry *entry; hv_vmbus_channel_msg_header *hdr; @@ -141,7 +141,7 @@ hv_vmbus_isr(struct vmbus_softc *sc, str sc->vmbus_event_proc(sc, cpu); /* Check if there are actual msgs to be process */ - msg_base = VMBUS_SC_PCPU_GET(sc, message, cpu); + msg_base = VMBUS_PCPU_GET(sc, message, cpu); msg = msg_base + HV_VMBUS_TIMER_SINT; /* we call eventtimer process the message */ @@ -196,7 +196,7 @@ hv_vector_handler(struct trapframe *trap /* * Do a little interrupt counting. */ - (*VMBUS_SC_PCPU_GET(sc, intr_cnt, cpu))++; + (*VMBUS_PCPU_GET(sc, intr_cnt, cpu))++; hv_vmbus_isr(sc, trap_frame, cpu); @@ -231,7 +231,7 @@ vmbus_synic_setup(void *arg __unused) simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); simp.u.simp_enabled = 1; simp.u.base_simp_gpa = - VMBUS_SC_PCPU_GET(sc, message_dma.hv_paddr, cpu) >> PAGE_SHIFT; + VMBUS_PCPU_GET(sc, message_dma.hv_paddr, cpu) >> PAGE_SHIFT; wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); @@ -241,7 +241,7 @@ vmbus_synic_setup(void *arg __unused) siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); siefp.u.siefp_enabled = 1; siefp.u.base_siefp_gpa = - VMBUS_SC_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT; + VMBUS_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT; wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); @@ -328,13 +328,13 @@ vmbus_dma_alloc(struct vmbus_softc *sc) /* * Per-cpu messages and event flags. */ - VMBUS_SC_PCPU_GET(sc, message, cpu) = hyperv_dmamem_alloc( + VMBUS_PCPU_GET(sc, message, cpu) = hyperv_dmamem_alloc( bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE, - VMBUS_SC_PCPU_PTR(sc, message_dma, cpu), + VMBUS_PCPU_PTR(sc, message_dma, cpu), BUS_DMA_WAITOK | BUS_DMA_ZERO); - VMBUS_SC_PCPU_GET(sc, event_flag, cpu) = hyperv_dmamem_alloc( + VMBUS_PCPU_GET(sc, event_flag, cpu) = hyperv_dmamem_alloc( bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE, - VMBUS_SC_PCPU_PTR(sc, event_flag_dma, cpu), + VMBUS_PCPU_PTR(sc, event_flag_dma, cpu), BUS_DMA_WAITOK | BUS_DMA_ZERO); } } @@ -345,17 +345,17 @@ vmbus_dma_free(struct vmbus_softc *sc) int cpu; CPU_FOREACH(cpu) { - if (VMBUS_SC_PCPU_GET(sc, message, cpu) != NULL) { + if (VMBUS_PCPU_GET(sc, message, cpu) != NULL) { hyperv_dmamem_free( - VMBUS_SC_PCPU_PTR(sc, message_dma, cpu), - VMBUS_SC_PCPU_GET(sc, message, cpu)); - VMBUS_SC_PCPU_GET(sc, message, cpu) = NULL; + VMBUS_PCPU_PTR(sc, message_dma, cpu), + VMBUS_PCPU_GET(sc, message, cpu)); + VMBUS_PCPU_GET(sc, message, cpu) = NULL; } - if (VMBUS_SC_PCPU_GET(sc, event_flag, cpu) != NULL) { + if (VMBUS_PCPU_GET(sc, event_flag, cpu) != NULL) { hyperv_dmamem_free( - VMBUS_SC_PCPU_PTR(sc, event_flag_dma, cpu), - VMBUS_SC_PCPU_GET(sc, event_flag, cpu)); - VMBUS_SC_PCPU_GET(sc, event_flag, cpu) = NULL; + VMBUS_PCPU_PTR(sc, event_flag_dma, cpu), + VMBUS_PCPU_GET(sc, event_flag, cpu)); + VMBUS_PCPU_GET(sc, event_flag, cpu) = NULL; } } } @@ -548,7 +548,7 @@ vmbus_bus_init(void) CPU_FOREACH(cpu) { snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu); - intrcnt_add(buf, VMBUS_SC_PCPU_PTR(sc, intr_cnt, cpu)); + intrcnt_add(buf, VMBUS_PCPU_PTR(sc, intr_cnt, cpu)); } /* Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Tue May 24 06:01:39 2016 (r300572) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Tue May 24 06:10:21 2016 (r300573) @@ -65,12 +65,8 @@ vmbus_get_device(void) return vmbus_sc->vmbus_dev; } -#define VMBUS_SC_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field -#define VMBUS_SC_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field -#define VMBUS_PCPU_GET(field, cpu) \ - VMBUS_SC_PCPU_GET(vmbus_get_softc(), field, (cpu)) -#define VMBUS_PCPU_PTR(field, cpu) \ - VMBUS_SC_PCPU_PTR(vmbus_get_softc(), field, (cpu)) +#define VMBUS_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field +#define VMBUS_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field void vmbus_on_channel_open(const struct hv_vmbus_channel *); void vmbus_event_proc(struct vmbus_softc *, int); From owner-svn-src-head@freebsd.org Tue May 24 06:42:15 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DDA87B488BA; Tue, 24 May 2016 06:42:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B486C1736; Tue, 24 May 2016 06:42:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O6gEC7066580; Tue, 24 May 2016 06:42:14 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O6gE47066579; Tue, 24 May 2016 06:42:14 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605240642.u4O6gE47066579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Tue, 24 May 2016 06:42:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300574 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 06:42:16 -0000 Author: sephe Date: Tue May 24 06:42:14 2016 New Revision: 300574 URL: https://svnweb.freebsd.org/changeset/base/300574 Log: hyperv/vmbus: Factor out functions for vmbus interrupt set/teardown This paves way for further cleanup and fix. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6505 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 06:10:21 2016 (r300573) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 06:42:14 2016 (r300574) @@ -72,6 +72,8 @@ static int vmbus_inited; static char *vmbus_ids[] = { "VMBUS", NULL }; +extern inthand_t IDTVEC(hv_vmbus_callback); + static void vmbus_msg_task(void *xsc, int pending __unused) { @@ -361,6 +363,82 @@ vmbus_dma_free(struct vmbus_softc *sc) } static int +vmbus_intr_setup(struct vmbus_softc *sc) +{ + int cpu; + + /* + * Find a free IDT vector for vmbus messages/events. + */ + sc->vmbus_idtvec = lapic_ipi_alloc(IDTVEC(hv_vmbus_callback)); + if (sc->vmbus_idtvec < 0) { + device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); + return ENXIO; + } + if(bootverbose) { + device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n", + sc->vmbus_idtvec); + } + + CPU_FOREACH(cpu) { + char buf[MAXCOMLEN + 1]; + + snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu); + intrcnt_add(buf, VMBUS_PCPU_PTR(sc, intr_cnt, cpu)); + } + + /* + * Per cpu setup. + */ + CPU_FOREACH(cpu) { + cpuset_t cpu_mask; + + /* + * Setup taskqueue to handle events + */ + hv_vmbus_g_context.hv_event_queue[cpu] = + taskqueue_create_fast("hyperv event", M_WAITOK, + taskqueue_thread_enqueue, + &hv_vmbus_g_context.hv_event_queue[cpu]); + CPU_SETOF(cpu, &cpu_mask); + taskqueue_start_threads_cpuset( + &hv_vmbus_g_context.hv_event_queue[cpu], 1, PI_NET, + &cpu_mask, "hvevent%d", cpu); + + /* + * Setup per-cpu tasks and taskqueues to handle msg. + */ + hv_vmbus_g_context.hv_msg_tq[cpu] = taskqueue_create_fast( + "hyperv msg", M_WAITOK, taskqueue_thread_enqueue, + &hv_vmbus_g_context.hv_msg_tq[cpu]); + CPU_SETOF(cpu, &cpu_mask); + taskqueue_start_threads_cpuset( + &hv_vmbus_g_context.hv_msg_tq[cpu], 1, PI_NET, + &cpu_mask, "hvmsg%d", cpu); + TASK_INIT(&hv_vmbus_g_context.hv_msg_task[cpu], 0, + vmbus_msg_task, sc); + } + return 0; +} + +static void +vmbus_intr_teardown(struct vmbus_softc *sc) +{ + int cpu; + + CPU_FOREACH(cpu) { + if (hv_vmbus_g_context.hv_event_queue[cpu] != NULL) { + taskqueue_free(hv_vmbus_g_context.hv_event_queue[cpu]); + hv_vmbus_g_context.hv_event_queue[cpu] = NULL; + } + } + if (sc->vmbus_idtvec >= 0) { + lapic_ipi_free(sc->vmbus_idtvec); + sc->vmbus_idtvec = -1; + } +} + +static int vmbus_read_ivar( device_t dev, device_t child, @@ -504,8 +582,6 @@ vmbus_probe(device_t dev) return (BUS_PROBE_DEFAULT); } -extern inthand_t IDTVEC(hv_vmbus_callback); - /** * @brief Main vmbus driver initialization routine. * @@ -522,9 +598,7 @@ static int vmbus_bus_init(void) { struct vmbus_softc *sc; - int ret, cpu; - char buf[MAXCOMLEN + 1]; - cpuset_t cpu_mask; + int ret; if (vmbus_inited) return (0); @@ -533,56 +607,14 @@ vmbus_bus_init(void) sc = vmbus_get_softc(); /* - * Find a free IDT vector for vmbus messages/events. + * Setup interrupt. */ - sc->vmbus_idtvec = lapic_ipi_alloc(IDTVEC(hv_vmbus_callback)); - if (sc->vmbus_idtvec < 0) { - device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); - ret = ENXIO; + ret = vmbus_intr_setup(sc); + if (ret != 0) goto cleanup; - } - if(bootverbose) { - device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n", - sc->vmbus_idtvec); - } - - CPU_FOREACH(cpu) { - snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu); - intrcnt_add(buf, VMBUS_PCPU_PTR(sc, intr_cnt, cpu)); - } /* - * Per cpu setup. - */ - CPU_FOREACH(cpu) { - /* - * Setup taskqueue to handle events - */ - hv_vmbus_g_context.hv_event_queue[cpu] = - taskqueue_create_fast("hyperv event", M_WAITOK, - taskqueue_thread_enqueue, - &hv_vmbus_g_context.hv_event_queue[cpu]); - CPU_SETOF(cpu, &cpu_mask); - taskqueue_start_threads_cpuset( - &hv_vmbus_g_context.hv_event_queue[cpu], 1, PI_NET, - &cpu_mask, "hvevent%d", cpu); - - /* - * Setup per-cpu tasks and taskqueues to handle msg. - */ - hv_vmbus_g_context.hv_msg_tq[cpu] = taskqueue_create_fast( - "hyperv msg", M_WAITOK, taskqueue_thread_enqueue, - &hv_vmbus_g_context.hv_msg_tq[cpu]); - CPU_SETOF(cpu, &cpu_mask); - taskqueue_start_threads_cpuset( - &hv_vmbus_g_context.hv_msg_tq[cpu], 1, PI_NET, - &cpu_mask, "hvmsg%d", cpu); - TASK_INIT(&hv_vmbus_g_context.hv_msg_task[cpu], 0, - vmbus_msg_task, sc); - } - - /* - * Allocate vmbus DMA stuffs. + * Allocate DMA stuffs. */ vmbus_dma_alloc(sc); @@ -597,7 +629,7 @@ vmbus_bus_init(void) ret = hv_vmbus_connect(); if (ret != 0) - goto cleanup1; + goto cleanup; if (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008 || hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7) @@ -613,22 +645,10 @@ vmbus_bus_init(void) return (ret); -cleanup1: +cleanup: vmbus_dma_free(sc); + vmbus_intr_teardown(sc); - /* - * remove swi and vmbus callback vector; - */ - CPU_FOREACH(cpu) { - if (hv_vmbus_g_context.hv_event_queue[cpu] != NULL) { - taskqueue_free(hv_vmbus_g_context.hv_event_queue[cpu]); - hv_vmbus_g_context.hv_event_queue[cpu] = NULL; - } - } - - lapic_ipi_free(sc->vmbus_idtvec); - - cleanup: return (ret); } @@ -642,6 +662,7 @@ vmbus_attach(device_t dev) { vmbus_sc = device_get_softc(dev); vmbus_sc->vmbus_dev = dev; + vmbus_sc->vmbus_idtvec = -1; /* * Event processing logic will be configured: @@ -687,7 +708,6 @@ static int vmbus_detach(device_t dev) { struct vmbus_softc *sc = device_get_softc(dev); - int i; hv_vmbus_release_unattached_channels(); hv_vmbus_disconnect(); @@ -695,16 +715,7 @@ vmbus_detach(device_t dev) smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL); vmbus_dma_free(sc); - - /* remove swi */ - CPU_FOREACH(i) { - if (hv_vmbus_g_context.hv_event_queue[i] != NULL) { - taskqueue_free(hv_vmbus_g_context.hv_event_queue[i]); - hv_vmbus_g_context.hv_event_queue[i] = NULL; - } - } - - lapic_ipi_free(sc->vmbus_idtvec); + vmbus_intr_teardown(sc); return (0); } From owner-svn-src-head@freebsd.org Tue May 24 07:06:05 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C72DFB48F5B; Tue, 24 May 2016 07:06:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7EFBC1391; Tue, 24 May 2016 07:06:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O764h1072999; Tue, 24 May 2016 07:06:04 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7644X072998; Tue, 24 May 2016 07:06:04 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605240706.u4O7644X072998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Tue, 24 May 2016 07:06:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300575 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 07:06:05 -0000 Author: hselasky Date: Tue May 24 07:06:04 2016 New Revision: 300575 URL: https://svnweb.freebsd.org/changeset/base/300575 Log: Use make_dev_s() instead of make_dev() to avoid race setting "si_drv1". Convert panic() into regular error while at it. Suggested by: jhb @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/cdev.h Tue May 24 06:42:14 2016 (r300574) +++ head/sys/compat/linuxkpi/common/include/linux/cdev.h Tue May 24 07:06:04 2016 (r300575) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -80,12 +80,27 @@ cdev_put(struct linux_cdev *p) static inline int cdev_add(struct linux_cdev *cdev, dev_t dev, unsigned count) { + struct make_dev_args args; + int error; + if (count != 1) - panic("cdev_add: Unsupported count: %d", count); - cdev->cdev = make_dev(&linuxcdevsw, MINOR(dev), 0, 0, 0700, - "%s", kobject_name(&cdev->kobj)); + return (-EINVAL); + cdev->dev = dev; - cdev->cdev->si_drv1 = cdev; + + /* Setup arguments for make_dev_s() */ + make_dev_args_init(&args); + args.mda_devsw = &linuxcdevsw; + args.mda_uid = 0; + args.mda_gid = 0; + args.mda_mode = 0700; + args.mda_si_drv1 = cdev; + args.mda_unit = MINOR(dev); + + error = make_dev_s(&args, &cdev->cdev, "%s", + kobject_name(&cdev->kobj)); + if (error) + return (-error); kobject_get(cdev->kobj.parent); return (0); @@ -94,10 +109,24 @@ cdev_add(struct linux_cdev *cdev, dev_t static inline int cdev_add_ext(struct linux_cdev *cdev, dev_t dev, uid_t uid, gid_t gid, int mode) { - cdev->cdev = make_dev(&linuxcdevsw, MINOR(dev), uid, gid, mode, - "%s/%d", kobject_name(&cdev->kobj), MINOR(dev)); + struct make_dev_args args; + int error; + cdev->dev = dev; - cdev->cdev->si_drv1 = cdev; + + /* Setup arguments for make_dev_s() */ + make_dev_args_init(&args); + args.mda_devsw = &linuxcdevsw; + args.mda_uid = uid; + args.mda_gid = gid; + args.mda_mode = mode; + args.mda_si_drv1 = cdev; + args.mda_unit = MINOR(dev); + + error = make_dev_s(&args, &cdev->cdev, "%s/%d", + kobject_name(&cdev->kobj), MINOR(dev)); + if (error) + return (-error); kobject_get(cdev->kobj.parent); return (0); From owner-svn-src-head@freebsd.org Tue May 24 07:07:12 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E9F8B4702F; Tue, 24 May 2016 07:07:12 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B6871843; Tue, 24 May 2016 07:07:12 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O77BeB073232; Tue, 24 May 2016 07:07:11 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O77BFu073231; Tue, 24 May 2016 07:07:11 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605240707.u4O77BFu073231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Tue, 24 May 2016 07:07:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300576 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 07:07:12 -0000 Author: sephe Date: Tue May 24 07:07:11 2016 New Revision: 300576 URL: https://svnweb.freebsd.org/changeset/base/300576 Log: hyperv/vmbus: Free message taskqueue during interrupt teardown MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6506 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 07:06:04 2016 (r300575) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue May 24 07:07:11 2016 (r300576) @@ -431,6 +431,12 @@ vmbus_intr_teardown(struct vmbus_softc * taskqueue_free(hv_vmbus_g_context.hv_event_queue[cpu]); hv_vmbus_g_context.hv_event_queue[cpu] = NULL; } + if (hv_vmbus_g_context.hv_msg_tq[cpu] != NULL) { + taskqueue_drain(hv_vmbus_g_context.hv_msg_tq[cpu], + &hv_vmbus_g_context.hv_msg_task[cpu]); + taskqueue_free(hv_vmbus_g_context.hv_msg_tq[cpu]); + hv_vmbus_g_context.hv_msg_tq[cpu] = NULL; + } } if (sc->vmbus_idtvec >= 0) { lapic_ipi_free(sc->vmbus_idtvec); From owner-svn-src-head@freebsd.org Tue May 24 07:46:22 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C2E0B480B2; Tue, 24 May 2016 07:46:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F319F10EC; Tue, 24 May 2016 07:46:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O7kLG0085995; Tue, 24 May 2016 07:46:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7kLLi085991; Tue, 24 May 2016 07:46:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605240746.u4O7kLLi085991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Tue, 24 May 2016 07:46:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300590 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 07:46:22 -0000 Author: hselasky Date: Tue May 24 07:46:20 2016 New Revision: 300590 URL: https://svnweb.freebsd.org/changeset/base/300590 Log: Set "current" for all PCI enumeration callbacks. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/compat.h head/sys/compat/linuxkpi/common/src/linux_compat.c head/sys/compat/linuxkpi/common/src/linux_pci.c Modified: head/sys/compat/linuxkpi/common/include/linux/compat.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/compat.h Tue May 24 07:21:23 2016 (r300589) +++ head/sys/compat/linuxkpi/common/include/linux/compat.h Tue May 24 07:46:20 2016 (r300590) @@ -31,4 +31,10 @@ #ifndef _LINUX_COMPAT_H_ #define _LINUX_COMPAT_H_ +struct thread; +struct task_struct; + +void linux_set_current(struct thread *td, struct task_struct *t); +void linux_clear_current(struct thread *td); + #endif /* _LINUX_COMPAT_H_ */ Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Tue May 24 07:21:23 2016 (r300589) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Tue May 24 07:46:20 2016 (r300590) @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include <linux/uaccess.h> #include <linux/kernel.h> #include <linux/list.h> +#include <linux/compat.h> #include <vm/vm_pager.h> @@ -380,7 +381,7 @@ kobject_init_and_add(struct kobject *kob return kobject_add_complete(kobj, parent); } -static void +void linux_set_current(struct thread *td, struct task_struct *t) { memset(t, 0, sizeof(*t)); @@ -388,7 +389,7 @@ linux_set_current(struct thread *td, str task_struct_set(td, t); } -static void +void linux_clear_current(struct thread *td) { task_struct_set(td, NULL); Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_pci.c Tue May 24 07:21:23 2016 (r300589) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Tue May 24 07:46:20 2016 (r300590) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include <linux/io.h> #include <linux/vmalloc.h> #include <linux/pci.h> +#include <linux/compat.h> static device_probe_t linux_pci_probe; static device_attach_t linux_pci_attach; @@ -120,8 +121,12 @@ linux_pci_attach(device_t dev) struct pci_dev *pdev; struct pci_driver *pdrv; const struct pci_device_id *id; + struct task_struct t; + struct thread *td; int error; + td = curthread; + linux_set_current(td, &t); pdrv = linux_pci_find(dev, &id); pdev = device_get_softc(dev); pdev->dev.parent = &linux_root_device; @@ -152,16 +157,21 @@ linux_pci_attach(device_t dev) list_del(&pdev->links); spin_unlock(&pci_lock); put_device(&pdev->dev); - return (-error); + error = -error; } - return (0); + linux_clear_current(td); + return (error); } static int linux_pci_detach(device_t dev) { struct pci_dev *pdev; + struct task_struct t; + struct thread *td; + td = curthread; + linux_set_current(td, &t); pdev = device_get_softc(dev); mtx_unlock(&Giant); pdev->pdrv->remove(pdev); @@ -170,6 +180,7 @@ linux_pci_detach(device_t dev) list_del(&pdev->links); spin_unlock(&pci_lock); put_device(&pdev->dev); + linux_clear_current(td); return (0); } @@ -179,13 +190,18 @@ linux_pci_suspend(device_t dev) { struct pm_message pm = { }; struct pci_dev *pdev; + struct task_struct t; + struct thread *td; int err; + td = curthread; + linux_set_current(td, &t); pdev = device_get_softc(dev); if (pdev->pdrv->suspend != NULL) err = -pdev->pdrv->suspend(pdev, pm); else err = 0; + linux_clear_current(td); return (err); } @@ -193,13 +209,18 @@ static int linux_pci_resume(device_t dev) { struct pci_dev *pdev; + struct task_struct t; + struct thread *td; int err; + td = curthread; + linux_set_current(td, &t); pdev = device_get_softc(dev); if (pdev->pdrv->resume != NULL) err = -pdev->pdrv->resume(pdev); else err = 0; + linux_clear_current(td); return (err); } @@ -207,13 +228,18 @@ static int linux_pci_shutdown(device_t dev) { struct pci_dev *pdev; + struct task_struct t; + struct thread *td; + td = curthread; + linux_set_current(td, &t); pdev = device_get_softc(dev); if (pdev->pdrv->shutdown != NULL) { DROP_GIANT(); pdev->pdrv->shutdown(pdev); PICKUP_GIANT(); } + linux_clear_current(td); return (0); } From owner-svn-src-head@freebsd.org Tue May 24 07:52:55 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17AE4B48324; Tue, 24 May 2016 07:52:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DDEB31979; Tue, 24 May 2016 07:52:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O7qsfx089302; Tue, 24 May 2016 07:52:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7qs1n089301; Tue, 24 May 2016 07:52:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605240752.u4O7qs1n089301@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Tue, 24 May 2016 07:52:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300591 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 07:52:55 -0000 Author: hselasky Date: Tue May 24 07:52:53 2016 New Revision: 300591 URL: https://svnweb.freebsd.org/changeset/base/300591 Log: Use the DROP_GIANT() and PICKUP_GIANT() macros instead of making assumptions about how the Giant mutex is locked. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_pci.c Tue May 24 07:46:20 2016 (r300590) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Tue May 24 07:52:53 2016 (r300591) @@ -146,12 +146,12 @@ linux_pci_attach(device_t dev) else pdev->dev.irq = 255; pdev->irq = pdev->dev.irq; - mtx_unlock(&Giant); + DROP_GIANT(); spin_lock(&pci_lock); list_add(&pdev->links, &pci_devices); spin_unlock(&pci_lock); error = pdrv->probe(pdev, id); - mtx_lock(&Giant); + PICKUP_GIANT(); if (error) { spin_lock(&pci_lock); list_del(&pdev->links); @@ -173,9 +173,9 @@ linux_pci_detach(device_t dev) td = curthread; linux_set_current(td, &t); pdev = device_get_softc(dev); - mtx_unlock(&Giant); + DROP_GIANT(); pdev->pdrv->remove(pdev); - mtx_lock(&Giant); + PICKUP_GIANT(); spin_lock(&pci_lock); list_del(&pdev->links); spin_unlock(&pci_lock); From owner-svn-src-head@freebsd.org Tue May 24 08:44:47 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6667BB48B78; Tue, 24 May 2016 08:44:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40B1A19B3; Tue, 24 May 2016 08:44:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O8ikb1005089; Tue, 24 May 2016 08:44:46 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O8ijkn005083; Tue, 24 May 2016 08:44:45 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201605240844.u4O8ijkn005083@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala <trasz@FreeBSD.org> Date: Tue, 24 May 2016 08:44:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300592 - in head/sys: cam/ctl dev/cxgbe/cxgbei dev/iscsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 08:44:47 -0000 Author: trasz Date: Tue May 24 08:44:45 2016 New Revision: 300592 URL: https://svnweb.freebsd.org/changeset/base/300592 Log: Add mechanism for choosing iSER-capable ICL modules. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c head/sys/dev/iscsi/icl.c head/sys/dev/iscsi/icl.h head/sys/dev/iscsi/icl_soft.c head/sys/dev/iscsi/iscsi.c Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.c Tue May 24 07:52:53 2016 (r300591) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Tue May 24 08:44:45 2016 (r300592) @@ -1264,7 +1264,7 @@ cfiscsi_session_new(struct cfiscsi_softc cv_init(&cs->cs_login_cv, "cfiscsi_login"); #endif - cs->cs_conn = icl_new_conn(offload, "cfiscsi", &cs->cs_lock); + cs->cs_conn = icl_new_conn(offload, false, "cfiscsi", &cs->cs_lock); if (cs->cs_conn == NULL) { free(cs, M_CFISCSI); return (NULL); @@ -1793,7 +1793,8 @@ cfiscsi_ioctl_limits(struct ctl_iscsi *c cilp = (struct ctl_iscsi_limits_params *)&(ci->data); - error = icl_limits(cilp->offload, &cilp->data_segment_limit); + error = icl_limits(cilp->offload, false, + &cilp->data_segment_limit); if (error != 0) { ci->status = CTL_ISCSI_ERROR; snprintf(ci->error_str, sizeof(ci->error_str), Modified: head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c ============================================================================== --- head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Tue May 24 07:52:53 2016 (r300591) +++ head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Tue May 24 08:44:45 2016 (r300592) @@ -850,7 +850,7 @@ icl_cxgbei_load(void) refcount_init(&icl_cxgbei_ncons, 0); - error = icl_register("cxgbei", 100, icl_cxgbei_limits, + error = icl_register("cxgbei", false, 100, icl_cxgbei_limits, icl_cxgbei_new_conn); KASSERT(error == 0, ("failed to register")); @@ -864,7 +864,7 @@ icl_cxgbei_unload(void) if (icl_cxgbei_ncons != 0) return (EBUSY); - icl_unregister("cxgbei"); + icl_unregister("cxgbei", false); uma_zdestroy(icl_transfer_zone); Modified: head/sys/dev/iscsi/icl.c ============================================================================== --- head/sys/dev/iscsi/icl.c Tue May 24 07:52:53 2016 (r300591) +++ head/sys/dev/iscsi/icl.c Tue May 24 08:44:45 2016 (r300592) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); struct icl_module { TAILQ_ENTRY(icl_module) im_next; char *im_name; + bool im_iser; int im_priority; int (*im_limits)(size_t *limitp); struct icl_conn *(*im_new_conn)(const char *name, @@ -106,7 +107,7 @@ sysctl_kern_icl_drivers(SYSCTL_HANDLER_A } static struct icl_module * -icl_find(const char *name) +icl_find(const char *name, bool iser, bool quiet) { struct icl_module *im, *im_max; @@ -117,34 +118,52 @@ icl_find(const char *name) * priority. */ if (name == NULL || name[0] == '\0') { - im_max = TAILQ_FIRST(&sc->sc_modules); + im_max = NULL; TAILQ_FOREACH(im, &sc->sc_modules, im_next) { - if (im->im_priority > im_max->im_priority) + if (im->im_iser != iser) + continue; + if (im_max == NULL || + im->im_priority > im_max->im_priority) im_max = im; } + if (iser && im_max == NULL && !quiet) + ICL_WARN("no iSER-capable offload found"); + return (im_max); } TAILQ_FOREACH(im, &sc->sc_modules, im_next) { - if (strcasecmp(im->im_name, name) == 0) - return (im); + if (strcasecmp(im->im_name, name) != 0) + continue; + + if (!im->im_iser && iser && !quiet) { + ICL_WARN("offload \"%s\" is not iSER-capable", name); + return (NULL); + } + if (im->im_iser && !iser && !quiet) { + ICL_WARN("offload \"%s\" is iSER-only", name); + return (NULL); + } + + return (im); } + if (!quiet) + ICL_WARN("offload \"%s\" not found", name); + return (NULL); } struct icl_conn * -icl_new_conn(const char *offload, const char *name, struct mtx *lock) +icl_new_conn(const char *offload, bool iser, const char *name, struct mtx *lock) { struct icl_module *im; struct icl_conn *ic; sx_slock(&sc->sc_lock); - im = icl_find(offload); - + im = icl_find(offload, iser, false); if (im == NULL) { - ICL_WARN("offload \"%s\" not found", offload); sx_sunlock(&sc->sc_lock); return (NULL); } @@ -156,16 +175,14 @@ icl_new_conn(const char *offload, const } int -icl_limits(const char *offload, size_t *limitp) +icl_limits(const char *offload, bool iser, size_t *limitp) { struct icl_module *im; int error; sx_slock(&sc->sc_lock); - im = icl_find(offload); - + im = icl_find(offload, iser, false); if (im == NULL) { - ICL_WARN("offload \"%s\" not found", offload); sx_sunlock(&sc->sc_lock); return (ENXIO); } @@ -176,16 +193,14 @@ icl_limits(const char *offload, size_t * return (error); } - int -icl_register(const char *offload, int priority, int (*limits)(size_t *), +icl_register(const char *offload, bool iser, int priority, int (*limits)(size_t *), struct icl_conn *(*new_conn)(const char *, struct mtx *)) { struct icl_module *im; sx_xlock(&sc->sc_lock); - im = icl_find(offload); - + im = icl_find(offload, iser, true); if (im != NULL) { ICL_WARN("offload \"%s\" already registered", offload); sx_xunlock(&sc->sc_lock); @@ -194,6 +209,7 @@ icl_register(const char *offload, int pr im = malloc(sizeof(*im), M_ICL, M_ZERO | M_WAITOK); im->im_name = strdup(offload, M_ICL); + im->im_iser = iser; im->im_priority = priority; im->im_limits = limits; im->im_new_conn = new_conn; @@ -206,13 +222,12 @@ icl_register(const char *offload, int pr } int -icl_unregister(const char *offload) +icl_unregister(const char *offload, bool rdma) { struct icl_module *im; sx_xlock(&sc->sc_lock); - im = icl_find(offload); - + im = icl_find(offload, rdma, true); if (im == NULL) { ICL_WARN("offload \"%s\" not registered", offload); sx_xunlock(&sc->sc_lock); Modified: head/sys/dev/iscsi/icl.h ============================================================================== --- head/sys/dev/iscsi/icl.h Tue May 24 07:52:53 2016 (r300591) +++ head/sys/dev/iscsi/icl.h Tue May 24 08:44:45 2016 (r300592) @@ -126,14 +126,14 @@ struct icl_conn { void *ic_prv0; }; -struct icl_conn *icl_new_conn(const char *offload, const char *name, +struct icl_conn *icl_new_conn(const char *offload, bool iser, const char *name, struct mtx *lock); -int icl_limits(const char *offload, size_t *limitp); +int icl_limits(const char *offload, bool iser, size_t *limitp); -int icl_register(const char *offload, int priority, +int icl_register(const char *offload, bool iser, int priority, int (*limits)(size_t *), struct icl_conn *(*new_conn)(const char *, struct mtx *)); -int icl_unregister(const char *offload); +int icl_unregister(const char *offload, bool rdma); #ifdef ICL_KERNEL_PROXY Modified: head/sys/dev/iscsi/icl_soft.c ============================================================================== --- head/sys/dev/iscsi/icl_soft.c Tue May 24 07:52:53 2016 (r300591) +++ head/sys/dev/iscsi/icl_soft.c Tue May 24 08:44:45 2016 (r300592) @@ -1531,9 +1531,19 @@ icl_soft_load(void) * it's known as "offload driver"; "offload driver: soft" * doesn't make much sense. */ - error = icl_register("none", 0, icl_soft_limits, icl_soft_new_conn); + error = icl_register("none", false, 0, + icl_soft_limits, icl_soft_new_conn); KASSERT(error == 0, ("failed to register")); +#if defined(ICL_KERNEL_PROXY) && 0 + /* + * Debugging aid for kernel proxy functionality. + */ + error = icl_register("proxytest", true, 0, + icl_soft_limits, icl_soft_new_conn); + KASSERT(error == 0, ("failed to register")); +#endif + return (error); } @@ -1544,7 +1554,10 @@ icl_soft_unload(void) if (icl_ncons != 0) return (EBUSY); - icl_unregister("none"); + icl_unregister("none", false); +#if defined(ICL_KERNEL_PROXY) && 0 + icl_unregister("proxytest", true); +#endif uma_zdestroy(icl_pdu_zone); Modified: head/sys/dev/iscsi/iscsi.c ============================================================================== --- head/sys/dev/iscsi/iscsi.c Tue May 24 07:52:53 2016 (r300591) +++ head/sys/dev/iscsi/iscsi.c Tue May 24 08:44:45 2016 (r300592) @@ -1324,6 +1324,7 @@ iscsi_ioctl_daemon_wait(struct iscsi_sof sizeof(request->idr_conf)); error = icl_limits(is->is_conf.isc_offload, + is->is_conf.isc_iser, &request->idr_limits.isl_max_data_segment_length); if (error != 0) { ISCSI_SESSION_WARN(is, "icl_limits for offload \"%s\" " @@ -1773,7 +1774,7 @@ iscsi_ioctl_session_add(struct iscsi_sof } is->is_conn = icl_new_conn(is->is_conf.isc_offload, - "iscsi", &is->is_lock); + is->is_conf.isc_iser, "iscsi", &is->is_lock); if (is->is_conn == NULL) { sx_xunlock(&sc->sc_lock); free(is, M_ISCSI); From owner-svn-src-head@freebsd.org Tue May 24 08:54:42 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76353B48D63; Tue, 24 May 2016 08:54:42 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 471E21E6E; Tue, 24 May 2016 08:54:42 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O8sfGP008054; Tue, 24 May 2016 08:54:41 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O8sfRp008053; Tue, 24 May 2016 08:54:41 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201605240854.u4O8sfRp008053@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala <trasz@FreeBSD.org> Date: Tue, 24 May 2016 08:54:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300593 - head/sys/dev/iscsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 08:54:42 -0000 Author: trasz Date: Tue May 24 08:54:41 2016 New Revision: 300593 URL: https://svnweb.freebsd.org/changeset/base/300593 Log: Rename kern.icl.drivers to kern.icl.offloads, for consistency. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iscsi/icl.c Modified: head/sys/dev/iscsi/icl.c ============================================================================== --- head/sys/dev/iscsi/icl.c Tue May 24 08:44:45 2016 (r300592) +++ head/sys/dev/iscsi/icl.c Tue May 24 08:54:41 2016 (r300593) @@ -69,7 +69,7 @@ struct icl_softc { TAILQ_HEAD(, icl_module) sc_modules; }; -static int sysctl_kern_icl_drivers(SYSCTL_HANDLER_ARGS); +static int sysctl_kern_icl_offloads(SYSCTL_HANDLER_ARGS); static MALLOC_DEFINE(M_ICL, "icl", "iSCSI Common Layer"); static struct icl_softc *sc; @@ -77,13 +77,13 @@ SYSCTL_NODE(_kern, OID_AUTO, icl, CTLFLA int icl_debug = 1; SYSCTL_INT(_kern_icl, OID_AUTO, debug, CTLFLAG_RWTUN, &icl_debug, 0, "Enable debug messages"); -SYSCTL_PROC(_kern_icl, OID_AUTO, drivers, +SYSCTL_PROC(_kern_icl, OID_AUTO, offloads, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, - NULL, 0, sysctl_kern_icl_drivers, "A", - "List of ICL drivers"); + NULL, 0, sysctl_kern_icl_offloads, "A", + "List of ICL modules"); static int -sysctl_kern_icl_drivers(SYSCTL_HANDLER_ARGS) +sysctl_kern_icl_offloads(SYSCTL_HANDLER_ARGS) { const struct icl_module *im; struct sbuf sb; From owner-svn-src-head@freebsd.org Tue May 24 09:23:05 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B329FB485F9; Tue, 24 May 2016 09:23:05 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83E4C1B11; Tue, 24 May 2016 09:23:05 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O9N4mT017098; Tue, 24 May 2016 09:23:04 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O9N4lU017097; Tue, 24 May 2016 09:23:04 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201605240923.u4O9N4lU017097@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo <kevlo@FreeBSD.org> Date: Tue, 24 May 2016 09:23:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300594 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 09:23:05 -0000 Author: kevlo Date: Tue May 24 09:23:04 2016 New Revision: 300594 URL: https://svnweb.freebsd.org/changeset/base/300594 Log: Add __iowrite32_copy() to the Linux kernel compatibility layer. Reviewed by: hselasky Modified: head/sys/compat/linuxkpi/common/include/linux/io.h Modified: head/sys/compat/linuxkpi/common/include/linux/io.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/io.h Tue May 24 08:54:41 2016 (r300593) +++ head/sys/compat/linuxkpi/common/include/linux/io.h Tue May 24 09:23:04 2016 (r300594) @@ -202,6 +202,17 @@ void iounmap(void *addr); #define memcpy_toio(a, b, c) memcpy((a), (b), (c)) static inline void +__iowrite32_copy(void *to, void *from, size_t count) +{ + uint32_t *src; + uint32_t *dst; + int i; + + for (i = 0, src = from, dst = to; i < count; i++, src++, dst++) + __raw_writel(*src, dst); +} + +static inline void __iowrite64_copy(void *to, void *from, size_t count) { #ifdef __LP64__ @@ -212,13 +223,7 @@ __iowrite64_copy(void *to, void *from, s for (i = 0, src = from, dst = to; i < count; i++, src++, dst++) __raw_writeq(*src, dst); #else - uint32_t *src; - uint32_t *dst; - int i; - - count *= 2; - for (i = 0, src = from, dst = to; i < count; i++, src++, dst++) - __raw_writel(*src, dst); + __iowrite32_copy(to, from, count * 2); #endif } From owner-svn-src-head@freebsd.org Tue May 24 10:16:04 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F1B1B46331; Tue, 24 May 2016 10:16:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31B5E12CC; Tue, 24 May 2016 10:16:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OAG3Bg032330; Tue, 24 May 2016 10:16:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OAG3HR032329; Tue, 24 May 2016 10:16:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605241016.u4OAG3HR032329@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov <kib@FreeBSD.org> Date: Tue, 24 May 2016 10:16:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300595 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 10:16:04 -0000 Author: kib Date: Tue May 24 10:16:03 2016 New Revision: 300595 URL: https://svnweb.freebsd.org/changeset/base/300595 Log: Remove Giant around allocation of the swap pager with non-NULL handle. Existing issue of not protecting pager_object_list iteration in vm_pager_object_lookup() by sw_alloc_mtx is not affected by Giant removal. Reviewed by: alc Sponsored by: The FreeBSD Foundation Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Tue May 24 09:23:04 2016 (r300594) +++ head/sys/vm/swap_pager.c Tue May 24 10:16:03 2016 (r300595) @@ -604,7 +604,6 @@ swap_pager_alloc(void *handle, vm_ooffse pindex = OFF_TO_IDX(offset + PAGE_MASK + size); if (handle) { - mtx_lock(&Giant); /* * Reference existing named region or allocate new one. There * should not be a race here against swp_pager_meta_build() @@ -617,7 +616,6 @@ swap_pager_alloc(void *handle, vm_ooffse if (cred != NULL) { if (!swap_reserve_by_cred(size, cred)) { sx_xunlock(&sw_alloc_sx); - mtx_unlock(&Giant); return (NULL); } crhold(cred); @@ -633,7 +631,6 @@ swap_pager_alloc(void *handle, vm_ooffse VM_OBJECT_WUNLOCK(object); } sx_xunlock(&sw_alloc_sx); - mtx_unlock(&Giant); } else { if (cred != NULL) { if (!swap_reserve_by_cred(size, cred)) From owner-svn-src-head@freebsd.org Tue May 24 10:21:40 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C591B46503; Tue, 24 May 2016 10:21:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 443E716DE; Tue, 24 May 2016 10:21:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OALd4m035136; Tue, 24 May 2016 10:21:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OALd9a035135; Tue, 24 May 2016 10:21:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605241021.u4OALd9a035135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov <kib@FreeBSD.org> Date: Tue, 24 May 2016 10:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300596 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 10:21:40 -0000 Author: kib Date: Tue May 24 10:21:39 2016 New Revision: 300596 URL: https://svnweb.freebsd.org/changeset/base/300596 Log: In vm_page_alloc_contig(), on vm_page_insert() failure, mark each freed page as VPO_UNMANAGED. Otherwise vm_pge_free_toq() insists on owning the page lock. Previously, VPO_UNMANAGED was only set up to the last processed page. Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue May 24 10:16:03 2016 (r300595) +++ head/sys/vm/vm_page.c Tue May 24 10:21:39 2016 (r300596) @@ -1944,8 +1944,10 @@ retry: m < &m_ret[npages]; m++) { if ((req & VM_ALLOC_WIRED) != 0) m->wire_count = 0; - if (m >= m_tmp) + if (m >= m_tmp) { m->object = NULL; + m->oflags |= VPO_UNMANAGED; + } vm_page_free(m); } return (NULL); From owner-svn-src-head@freebsd.org Tue May 24 11:44:44 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C311B43027; Tue, 24 May 2016 11:44:44 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C7CC1A53; Tue, 24 May 2016 11:44:44 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OBihGu060387; Tue, 24 May 2016 11:44:43 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OBih30060386; Tue, 24 May 2016 11:44:43 GMT (envelope-from des@FreeBSD.org) Message-Id: <201605241144.u4OBih30060386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= <des@FreeBSD.org> Date: Tue, 24 May 2016 11:44:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300602 - head/lib/libradius X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 11:44:44 -0000 Author: des Date: Tue May 24 11:44:43 2016 New Revision: 300602 URL: https://svnweb.freebsd.org/changeset/base/300602 Log: The NAS-Identifier attribute is a string, not an integer. MFC after: 1 week Modified: head/lib/libradius/radlib.h Modified: head/lib/libradius/radlib.h ============================================================================== --- head/lib/libradius/radlib.h Tue May 24 10:46:23 2016 (r300601) +++ head/lib/libradius/radlib.h Tue May 24 11:44:43 2016 (r300602) @@ -98,7 +98,7 @@ #define RAD_TERMINATION_ACTION 29 /* Integer */ #define RAD_CALLED_STATION_ID 30 /* String */ #define RAD_CALLING_STATION_ID 31 /* String */ -#define RAD_NAS_IDENTIFIER 32 /* Integer */ +#define RAD_NAS_IDENTIFIER 32 /* String */ #define RAD_PROXY_STATE 33 /* Integer */ #define RAD_LOGIN_LAT_SERVICE 34 /* Integer */ #define RAD_LOGIN_LAT_NODE 35 /* Integer */ From owner-svn-src-head@freebsd.org Tue May 24 11:47:15 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65A6EB431E4; Tue, 24 May 2016 11:47:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 35F8C1CC9; Tue, 24 May 2016 11:47:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OBlETB060514; Tue, 24 May 2016 11:47:14 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OBlEVc060513; Tue, 24 May 2016 11:47:14 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201605241147.u4OBlEVc060513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen <tuexen@FreeBSD.org> Date: Tue, 24 May 2016 11:47:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300603 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 11:47:15 -0000 Author: tuexen Date: Tue May 24 11:47:14 2016 New Revision: 300603 URL: https://svnweb.freebsd.org/changeset/base/300603 Log: Allow an MTU of 65535 bytes to be set via TUN[SG]IFINFO. This requires changing the type on the mtu field in struct tuninfo from short to unsigned short. This is used, for example, by packetdrill to test with MTUs up to the maximum value. Differential Revision: 6452 Modified: head/sys/net/if_tun.h Modified: head/sys/net/if_tun.h ============================================================================== --- head/sys/net/if_tun.h Tue May 24 11:44:43 2016 (r300602) +++ head/sys/net/if_tun.h Tue May 24 11:47:14 2016 (r300603) @@ -25,11 +25,11 @@ #define TUNMTU 1500 /* Maximum receive packet size (hard limit) */ -#define TUNMRU 16384 +#define TUNMRU 65535 struct tuninfo { int baudrate; /* linespeed */ - short mtu; /* maximum transmission unit */ + unsigned short mtu; /* maximum transmission unit */ u_char type; /* ethernet, tokenring, etc. */ u_char dummy; /* place holder */ }; From owner-svn-src-head@freebsd.org Tue May 24 12:06:58 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 208DDB43E05; Tue, 24 May 2016 12:06:58 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E55991987; Tue, 24 May 2016 12:06:57 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OC6vQk066393; Tue, 24 May 2016 12:06:57 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OC6vxt066392; Tue, 24 May 2016 12:06:57 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201605241206.u4OC6vxt066392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner <andrew@FreeBSD.org> Date: Tue, 24 May 2016 12:06:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300604 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 12:06:58 -0000 Author: andrew Date: Tue May 24 12:06:56 2016 New Revision: 300604 URL: https://svnweb.freebsd.org/changeset/base/300604 Log: Limit calling pmc_hook to when the interrupt comes while running userspace. We may enable interrupts from within the callback, e.g. in a data abort during copyin. If we receive an interrupt at that time pmc_hook will be called again and, as it is handling userspace stack tracing, will hit a KASSERT as it checks if the trapframe is from userland. With this I can run hwpmc with intrng on a ThunderX and have it trace all CPUs. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/subr_intr.c Modified: head/sys/kern/subr_intr.c ============================================================================== --- head/sys/kern/subr_intr.c Tue May 24 11:47:14 2016 (r300603) +++ head/sys/kern/subr_intr.c Tue May 24 12:06:56 2016 (r300604) @@ -317,7 +317,8 @@ intr_irq_handler(struct trapframe *tf) td->td_intr_frame = oldframe; critical_exit(); #ifdef HWPMC_HOOKS - if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN)) + if (pmc_hook && TRAPF_USERMODE(tf) && + (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN)) pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, tf); #endif } From owner-svn-src-head@freebsd.org Tue May 24 12:14:20 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D994EB43F93; Tue, 24 May 2016 12:14:20 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 828F61D72; Tue, 24 May 2016 12:14:20 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OCEJhP069473; Tue, 24 May 2016 12:14:19 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OCEJ9E069471; Tue, 24 May 2016 12:14:19 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201605241214.u4OCEJ9E069471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko <arybchik@FreeBSD.org> Date: Tue, 24 May 2016 12:14:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300605 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 12:14:21 -0000 Author: arybchik Date: Tue May 24 12:14:19 2016 New Revision: 300605 URL: https://svnweb.freebsd.org/changeset/base/300605 Log: sfxge(4): be ready to receive events immediately after event queues are created Submitted by: Mark Spender <mspender at solarflare.com> Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6507 Modified: head/sys/dev/sfxge/common/ef10_ev.c head/sys/dev/sfxge/common/efx_ev.c Modified: head/sys/dev/sfxge/common/ef10_ev.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_ev.c Tue May 24 12:06:56 2016 (r300604) +++ head/sys/dev/sfxge/common/ef10_ev.c Tue May 24 12:14:19 2016 (r300605) @@ -275,6 +275,11 @@ ef10_ev_qcreate( /* Set up the event queue */ irq = index; /* INIT_EVQ expects function-relative vector number */ + + /* + * Interrupts may be raised for events immediately after the queue is + * created. See bug58606. + */ if ((rc = efx_mcdi_init_evq(enp, index, esmp, n, irq)) != 0) goto fail3; Modified: head/sys/dev/sfxge/common/efx_ev.c ============================================================================== --- head/sys/dev/sfxge/common/efx_ev.c Tue May 24 12:06:56 2016 (r300604) +++ head/sys/dev/sfxge/common/efx_ev.c Tue May 24 12:14:19 2016 (r300605) @@ -251,16 +251,27 @@ efx_ev_qcreate( eep->ee_mask = n - 1; eep->ee_esmp = esmp; - if ((rc = eevop->eevo_qcreate(enp, index, esmp, n, id, eep)) != 0) - goto fail2; - + /* + * Set outputs before the queue is created because interrupts may be + * raised for events immediately after the queue is created, before the + * function call below returns. See bug58606. + * + * The eepp pointer passed in by the client must therefore point to data + * shared with the client's event processing context. + */ enp->en_ev_qcount++; *eepp = eep; + if ((rc = eevop->eevo_qcreate(enp, index, esmp, n, id, eep)) != 0) + goto fail2; + return (0); fail2: EFSYS_PROBE(fail2); + + *eepp = NULL; + enp->en_ev_qcount--; EFSYS_KMEM_FREE(enp->en_esip, sizeof (efx_evq_t), eep); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); From owner-svn-src-head@freebsd.org Tue May 24 12:15:31 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F0F7B47012; Tue, 24 May 2016 12:15:31 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5763A1EFE; Tue, 24 May 2016 12:15:31 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OCFUcF069558; Tue, 24 May 2016 12:15:30 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OCFUsZ069555; Tue, 24 May 2016 12:15:30 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201605241215.u4OCFUsZ069555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko <arybchik@FreeBSD.org> Date: Tue, 24 May 2016 12:15:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300606 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 12:15:31 -0000 Author: arybchik Date: Tue May 24 12:15:30 2016 New Revision: 300606 URL: https://svnweb.freebsd.org/changeset/base/300606 Log: sfxge(4): provide option to disable not a local MAC address check Option EFSYS_OPT_ALLOW_UNCONFIGURED_NIC disables check that the adapter MAC address is not a local address (beginning 02). Submitted by: Laurence Evans <levans at solarflare.com> Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6508 Modified: head/sys/dev/sfxge/common/efsys.h head/sys/dev/sfxge/common/efx_check.h head/sys/dev/sfxge/common/medford_nic.c Modified: head/sys/dev/sfxge/common/efsys.h ============================================================================== --- head/sys/dev/sfxge/common/efsys.h Tue May 24 12:14:19 2016 (r300605) +++ head/sys/dev/sfxge/common/efsys.h Tue May 24 12:15:30 2016 (r300606) @@ -278,6 +278,8 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, b #define EFSYS_OPT_LICENSING 0 +#define EFSYS_OPT_ALLOW_UNCONFIGURED_NIC 0 + /* ID */ typedef struct __efsys_identifier_s efsys_identifier_t; Modified: head/sys/dev/sfxge/common/efx_check.h ============================================================================== --- head/sys/dev/sfxge/common/efx_check.h Tue May 24 12:14:19 2016 (r300605) +++ head/sys/dev/sfxge/common/efx_check.h Tue May 24 12:15:30 2016 (r300606) @@ -334,5 +334,12 @@ # endif #endif /* EFSYS_OPT_LICENSING */ +/* Support adapters with missing static config (for factory use only) */ +#if EFSYS_OPT_ALLOW_UNCONFIGURED_NIC +# if !EFSYS_OPT_MEDFORD +# error "ALLOW_UNCONFIGURED_NIC requires MEDFORD" +# endif +#endif /* EFSYS_OPT_ALLOW_UNCONFIGURED_NIC */ + #endif /* _SYS_EFX_CHECK_H */ Modified: head/sys/dev/sfxge/common/medford_nic.c ============================================================================== --- head/sys/dev/sfxge/common/medford_nic.c Tue May 24 12:14:19 2016 (r300605) +++ head/sys/dev/sfxge/common/medford_nic.c Tue May 24 12:15:30 2016 (r300606) @@ -180,6 +180,12 @@ medford_board_cfg( /* MAC address for this function */ if (EFX_PCI_FUNCTION_IS_PF(encp)) { rc = efx_mcdi_get_mac_address_pf(enp, mac_addr); +#if EFSYS_OPT_ALLOW_UNCONFIGURED_NIC + /* Disable static config checking for Medford NICs, ONLY + * for manufacturing test and setup at the factory, to + * allow the static config to be installed. + */ +#else /* EFSYS_OPT_ALLOW_UNCONFIGURED_NIC */ if ((rc == 0) && (mac_addr[0] & 0x02)) { /* * If the static config does not include a global MAC @@ -189,6 +195,7 @@ medford_board_cfg( */ rc = EINVAL; } +#endif /* EFSYS_OPT_ALLOW_UNCONFIGURED_NIC */ } else { rc = efx_mcdi_get_mac_address_vf(enp, mac_addr); } From owner-svn-src-head@freebsd.org Tue May 24 12:17:06 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 657DCB47093; Tue, 24 May 2016 12:17:06 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 027AB10B0; Tue, 24 May 2016 12:17:05 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OCH5uf069725; Tue, 24 May 2016 12:17:05 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OCGwMS069646; Tue, 24 May 2016 12:16:58 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201605241216.u4OCGwMS069646@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko <arybchik@FreeBSD.org> Date: Tue, 24 May 2016 12:16:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300607 - in head: share/man/man4 sys/dev/sfxge sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 12:17:06 -0000 Author: arybchik Date: Tue May 24 12:16:57 2016 New Revision: 300607 URL: https://svnweb.freebsd.org/changeset/base/300607 Log: sfxge(4): cleanup: update copyright to 2016 Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6509 Modified: head/share/man/man4/sfxge.4 head/sys/dev/sfxge/common/ef10_ev.c head/sys/dev/sfxge/common/ef10_filter.c head/sys/dev/sfxge/common/ef10_impl.h head/sys/dev/sfxge/common/ef10_intr.c head/sys/dev/sfxge/common/ef10_mac.c head/sys/dev/sfxge/common/ef10_mcdi.c head/sys/dev/sfxge/common/ef10_nic.c head/sys/dev/sfxge/common/ef10_nvram.c head/sys/dev/sfxge/common/ef10_phy.c head/sys/dev/sfxge/common/ef10_rx.c head/sys/dev/sfxge/common/ef10_tx.c head/sys/dev/sfxge/common/ef10_vpd.c head/sys/dev/sfxge/common/efsys.h head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_bootcfg.c head/sys/dev/sfxge/common/efx_check.h head/sys/dev/sfxge/common/efx_crc32.c head/sys/dev/sfxge/common/efx_ev.c head/sys/dev/sfxge/common/efx_filter.c head/sys/dev/sfxge/common/efx_hash.c head/sys/dev/sfxge/common/efx_impl.h head/sys/dev/sfxge/common/efx_intr.c head/sys/dev/sfxge/common/efx_lic.c head/sys/dev/sfxge/common/efx_mac.c head/sys/dev/sfxge/common/efx_mcdi.c head/sys/dev/sfxge/common/efx_mcdi.h head/sys/dev/sfxge/common/efx_mon.c head/sys/dev/sfxge/common/efx_nic.c head/sys/dev/sfxge/common/efx_nvram.c head/sys/dev/sfxge/common/efx_phy.c head/sys/dev/sfxge/common/efx_phy_ids.h head/sys/dev/sfxge/common/efx_port.c head/sys/dev/sfxge/common/efx_regs.h head/sys/dev/sfxge/common/efx_regs_ef10.h head/sys/dev/sfxge/common/efx_regs_pci.h head/sys/dev/sfxge/common/efx_rx.c head/sys/dev/sfxge/common/efx_sram.c head/sys/dev/sfxge/common/efx_tx.c head/sys/dev/sfxge/common/efx_types.h head/sys/dev/sfxge/common/efx_vpd.c head/sys/dev/sfxge/common/efx_wol.c head/sys/dev/sfxge/common/hunt_impl.h head/sys/dev/sfxge/common/hunt_nic.c head/sys/dev/sfxge/common/hunt_phy.c head/sys/dev/sfxge/common/mcdi_mon.c head/sys/dev/sfxge/common/mcdi_mon.h head/sys/dev/sfxge/common/medford_impl.h head/sys/dev/sfxge/common/medford_nic.c head/sys/dev/sfxge/common/siena_flash.h head/sys/dev/sfxge/common/siena_impl.h head/sys/dev/sfxge/common/siena_mac.c head/sys/dev/sfxge/common/siena_mcdi.c head/sys/dev/sfxge/common/siena_nic.c head/sys/dev/sfxge/common/siena_nvram.c head/sys/dev/sfxge/common/siena_phy.c head/sys/dev/sfxge/common/siena_sram.c head/sys/dev/sfxge/common/siena_vpd.c head/sys/dev/sfxge/sfxge.c head/sys/dev/sfxge/sfxge.h head/sys/dev/sfxge/sfxge_dma.c head/sys/dev/sfxge/sfxge_ev.c head/sys/dev/sfxge/sfxge_intr.c head/sys/dev/sfxge/sfxge_ioc.h head/sys/dev/sfxge/sfxge_mcdi.c head/sys/dev/sfxge/sfxge_nvram.c head/sys/dev/sfxge/sfxge_port.c head/sys/dev/sfxge/sfxge_rx.c head/sys/dev/sfxge/sfxge_rx.h head/sys/dev/sfxge/sfxge_tx.c head/sys/dev/sfxge/sfxge_tx.h head/sys/dev/sfxge/sfxge_version.h Modified: head/share/man/man4/sfxge.4 ============================================================================== --- head/share/man/man4/sfxge.4 Tue May 24 12:15:30 2016 (r300606) +++ head/share/man/man4/sfxge.4 Tue May 24 12:16:57 2016 (r300607) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2011-2015 Solarflare Communications Inc. +.\" Copyright (c) 2011-2016 Solarflare Communications Inc. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/ef10_ev.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_ev.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/ef10_ev.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2015 Solarflare Communications Inc. + * Copyright (c) 2012-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/ef10_filter.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_filter.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/ef10_filter.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/ef10_impl.h ============================================================================== --- head/sys/dev/sfxge/common/ef10_impl.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/ef10_impl.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Solarflare Communications Inc. + * Copyright (c) 2015-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/ef10_intr.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_intr.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/ef10_intr.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2015 Solarflare Communications Inc. + * Copyright (c) 2012-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/ef10_mac.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_mac.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/ef10_mac.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2015 Solarflare Communications Inc. + * Copyright (c) 2012-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/ef10_mcdi.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_mcdi.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/ef10_mcdi.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2015 Solarflare Communications Inc. + * Copyright (c) 2012-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/ef10_nic.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_nic.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/ef10_nic.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2015 Solarflare Communications Inc. + * Copyright (c) 2012-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/ef10_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_nvram.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/ef10_nvram.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2015 Solarflare Communications Inc. + * Copyright (c) 2012-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/ef10_phy.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_phy.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/ef10_phy.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2015 Solarflare Communications Inc. + * Copyright (c) 2012-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/ef10_rx.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_rx.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/ef10_rx.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2015 Solarflare Communications Inc. + * Copyright (c) 2012-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/ef10_tx.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_tx.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/ef10_tx.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2015 Solarflare Communications Inc. + * Copyright (c) 2012-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/ef10_vpd.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_vpd.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/ef10_vpd.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efsys.h ============================================================================== --- head/sys/dev/sfxge/common/efsys.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efsys.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2015 Solarflare Communications Inc. + * Copyright (c) 2010-2016 Solarflare Communications Inc. * All rights reserved. * * This software was developed in part by Philip Paeps under contract for Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006-2015 Solarflare Communications Inc. + * Copyright (c) 2006-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_bootcfg.c ============================================================================== --- head/sys/dev/sfxge/common/efx_bootcfg.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_bootcfg.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_check.h ============================================================================== --- head/sys/dev/sfxge/common/efx_check.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_check.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2015 Solarflare Communications Inc. + * Copyright (c) 2012-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_crc32.c ============================================================================== --- head/sys/dev/sfxge/common/efx_crc32.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_crc32.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015 Solarflare Communications Inc. + * Copyright (c) 2013-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_ev.c ============================================================================== --- head/sys/dev/sfxge/common/efx_ev.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_ev.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_filter.c ============================================================================== --- head/sys/dev/sfxge/common/efx_filter.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_filter.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_hash.c ============================================================================== --- head/sys/dev/sfxge/common/efx_hash.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_hash.c Tue May 24 12:16:57 2016 (r300607) @@ -10,7 +10,7 @@ * ...You can use this free for any purpose. It's in the public domain. * It has no warranty." * - * Copyright (c) 2014-2015 Solarflare Communications Inc. + * Copyright (c) 2014-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_impl.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_intr.c ============================================================================== --- head/sys/dev/sfxge/common/efx_intr.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_intr.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_lic.c ============================================================================== --- head/sys/dev/sfxge/common/efx_lic.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_lic.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_mac.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mac.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_mac.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_mcdi.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mcdi.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_mcdi.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2015 Solarflare Communications Inc. + * Copyright (c) 2008-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_mcdi.h ============================================================================== --- head/sys/dev/sfxge/common/efx_mcdi.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_mcdi.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_mon.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mon.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_mon.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_nic.c ============================================================================== --- head/sys/dev/sfxge/common/efx_nic.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_nic.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/efx_nvram.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_nvram.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_phy.c ============================================================================== --- head/sys/dev/sfxge/common/efx_phy.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_phy.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_phy_ids.h ============================================================================== --- head/sys/dev/sfxge/common/efx_phy_ids.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_phy_ids.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015 Solarflare Communications Inc. + * Copyright (c) 2013-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_port.c ============================================================================== --- head/sys/dev/sfxge/common/efx_port.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_port.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_regs.h ============================================================================== --- head/sys/dev/sfxge/common/efx_regs.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_regs.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_regs_ef10.h ============================================================================== --- head/sys/dev/sfxge/common/efx_regs_ef10.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_regs_ef10.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_regs_pci.h ============================================================================== --- head/sys/dev/sfxge/common/efx_regs_pci.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_regs_pci.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_rx.c ============================================================================== --- head/sys/dev/sfxge/common/efx_rx.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_rx.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_sram.c ============================================================================== --- head/sys/dev/sfxge/common/efx_sram.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_sram.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_tx.c ============================================================================== --- head/sys/dev/sfxge/common/efx_tx.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_tx.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_types.h ============================================================================== --- head/sys/dev/sfxge/common/efx_types.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_types.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_vpd.c ============================================================================== --- head/sys/dev/sfxge/common/efx_vpd.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_vpd.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/efx_wol.c ============================================================================== --- head/sys/dev/sfxge/common/efx_wol.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/efx_wol.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/hunt_impl.h ============================================================================== --- head/sys/dev/sfxge/common/hunt_impl.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/hunt_impl.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2015 Solarflare Communications Inc. + * Copyright (c) 2012-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/hunt_nic.c ============================================================================== --- head/sys/dev/sfxge/common/hunt_nic.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/hunt_nic.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2015 Solarflare Communications Inc. + * Copyright (c) 2012-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/hunt_phy.c ============================================================================== --- head/sys/dev/sfxge/common/hunt_phy.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/hunt_phy.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2015 Solarflare Communications Inc. + * Copyright (c) 2012-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/mcdi_mon.c ============================================================================== --- head/sys/dev/sfxge/common/mcdi_mon.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/mcdi_mon.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/mcdi_mon.h ============================================================================== --- head/sys/dev/sfxge/common/mcdi_mon.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/mcdi_mon.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/medford_impl.h ============================================================================== --- head/sys/dev/sfxge/common/medford_impl.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/medford_impl.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Solarflare Communications Inc. + * Copyright (c) 2015-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/medford_nic.c ============================================================================== --- head/sys/dev/sfxge/common/medford_nic.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/medford_nic.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Solarflare Communications Inc. + * Copyright (c) 2015-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/siena_flash.h ============================================================================== --- head/sys/dev/sfxge/common/siena_flash.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/siena_flash.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/siena_impl.h ============================================================================== --- head/sys/dev/sfxge/common/siena_impl.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/siena_impl.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/siena_mac.c ============================================================================== --- head/sys/dev/sfxge/common/siena_mac.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/siena_mac.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/siena_mcdi.c ============================================================================== --- head/sys/dev/sfxge/common/siena_mcdi.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/siena_mcdi.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2015 Solarflare Communications Inc. + * Copyright (c) 2012-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/siena_nic.c ============================================================================== --- head/sys/dev/sfxge/common/siena_nic.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/siena_nic.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/siena_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/siena_nvram.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/siena_nvram.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/siena_phy.c ============================================================================== --- head/sys/dev/sfxge/common/siena_phy.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/siena_phy.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/siena_sram.c ============================================================================== --- head/sys/dev/sfxge/common/siena_sram.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/siena_sram.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/common/siena_vpd.c ============================================================================== --- head/sys/dev/sfxge/common/siena_vpd.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/common/siena_vpd.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2015 Solarflare Communications Inc. + * Copyright (c) 2009-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/sfxge.c ============================================================================== --- head/sys/dev/sfxge/sfxge.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/sfxge.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2015 Solarflare Communications Inc. + * Copyright (c) 2010-2016 Solarflare Communications Inc. * All rights reserved. * * This software was developed in part by Philip Paeps under contract for Modified: head/sys/dev/sfxge/sfxge.h ============================================================================== --- head/sys/dev/sfxge/sfxge.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/sfxge.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2015 Solarflare Communications Inc. + * Copyright (c) 2010-2016 Solarflare Communications Inc. * All rights reserved. * * This software was developed in part by Philip Paeps under contract for Modified: head/sys/dev/sfxge/sfxge_dma.c ============================================================================== --- head/sys/dev/sfxge/sfxge_dma.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/sfxge_dma.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2015 Solarflare Communications Inc. + * Copyright (c) 2010-2016 Solarflare Communications Inc. * All rights reserved. * * This software was developed in part by Philip Paeps under contract for Modified: head/sys/dev/sfxge/sfxge_ev.c ============================================================================== --- head/sys/dev/sfxge/sfxge_ev.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/sfxge_ev.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2015 Solarflare Communications Inc. + * Copyright (c) 2010-2016 Solarflare Communications Inc. * All rights reserved. * * This software was developed in part by Philip Paeps under contract for Modified: head/sys/dev/sfxge/sfxge_intr.c ============================================================================== --- head/sys/dev/sfxge/sfxge_intr.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/sfxge_intr.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2015 Solarflare Communications Inc. + * Copyright (c) 2010-2016 Solarflare Communications Inc. * All rights reserved. * * This software was developed in part by Philip Paeps under contract for Modified: head/sys/dev/sfxge/sfxge_ioc.h ============================================================================== --- head/sys/dev/sfxge/sfxge_ioc.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/sfxge_ioc.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 Solarflare Communications Inc. + * Copyright (c) 2014-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/sfxge/sfxge_mcdi.c ============================================================================== --- head/sys/dev/sfxge/sfxge_mcdi.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/sfxge_mcdi.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2015 Solarflare Communications Inc. + * Copyright (c) 2010-2016 Solarflare Communications Inc. * All rights reserved. * * This software was developed in part by Philip Paeps under contract for Modified: head/sys/dev/sfxge/sfxge_nvram.c ============================================================================== --- head/sys/dev/sfxge/sfxge_nvram.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/sfxge_nvram.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2015 Solarflare Communications, Inc. + * Copyright (c) 2010-2016 Solarflare Communications, Inc. * All rights reserved. * * This software was developed in part by OKTET Labs Ltd. under contract for Modified: head/sys/dev/sfxge/sfxge_port.c ============================================================================== --- head/sys/dev/sfxge/sfxge_port.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/sfxge_port.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2015 Solarflare Communications Inc. + * Copyright (c) 2010-2016 Solarflare Communications Inc. * All rights reserved. * * This software was developed in part by Philip Paeps under contract for Modified: head/sys/dev/sfxge/sfxge_rx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_rx.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/sfxge_rx.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2015 Solarflare Communications Inc. + * Copyright (c) 2010-2016 Solarflare Communications Inc. * All rights reserved. * * This software was developed in part by Philip Paeps under contract for Modified: head/sys/dev/sfxge/sfxge_rx.h ============================================================================== --- head/sys/dev/sfxge/sfxge_rx.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/sfxge_rx.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2015 Solarflare Communications Inc. + * Copyright (c) 2010-2016 Solarflare Communications Inc. * All rights reserved. * * This software was developed in part by Philip Paeps under contract for Modified: head/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_tx.c Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/sfxge_tx.c Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2015 Solarflare Communications Inc. + * Copyright (c) 2010-2016 Solarflare Communications Inc. * All rights reserved. * * This software was developed in part by Philip Paeps under contract for Modified: head/sys/dev/sfxge/sfxge_tx.h ============================================================================== --- head/sys/dev/sfxge/sfxge_tx.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/sfxge_tx.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2015 Solarflare Communications Inc. + * Copyright (c) 2010-2016 Solarflare Communications Inc. * All rights reserved. * * This software was developed in part by Philip Paeps under contract for Modified: head/sys/dev/sfxge/sfxge_version.h ============================================================================== --- head/sys/dev/sfxge/sfxge_version.h Tue May 24 12:15:30 2016 (r300606) +++ head/sys/dev/sfxge/sfxge_version.h Tue May 24 12:16:57 2016 (r300607) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Solarflare Communications Inc. + * Copyright (c) 2015-2016 Solarflare Communications Inc. * All rights reserved. * * This software was developed in part by OKTET Labs under contract for From owner-svn-src-head@freebsd.org Tue May 24 12:19:16 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45CB8B47173; Tue, 24 May 2016 12:19:16 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 133981286; Tue, 24 May 2016 12:19:15 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OCJFW6069842; Tue, 24 May 2016 12:19:15 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OCJFOZ069841; Tue, 24 May 2016 12:19:15 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201605241219.u4OCJFOZ069841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko <arybchik@FreeBSD.org> Date: Tue, 24 May 2016 12:19:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300608 - head/sys/dev/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 12:19:16 -0000 Author: arybchik Date: Tue May 24 12:19:14 2016 New Revision: 300608 URL: https://svnweb.freebsd.org/changeset/base/300608 Log: sfxge(4): bump driver version to the closest out-of-tree version Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Modified: head/sys/dev/sfxge/sfxge_version.h Modified: head/sys/dev/sfxge/sfxge_version.h ============================================================================== --- head/sys/dev/sfxge/sfxge_version.h Tue May 24 12:16:57 2016 (r300607) +++ head/sys/dev/sfxge/sfxge_version.h Tue May 24 12:19:14 2016 (r300608) @@ -36,6 +36,6 @@ #ifndef _SFXGE_VERSION_H #define _SFXGE_VERSION_H -#define SFXGE_VERSION_STRING "v4.8.0.1019" +#define SFXGE_VERSION_STRING "v4.8.0.1071" #endif /* _SFXGE_DRIVER_VERSION_H */ From owner-svn-src-head@freebsd.org Tue May 24 12:20:25 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EB1EB471F4; Tue, 24 May 2016 12:20:25 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BE5F1478; Tue, 24 May 2016 12:20:24 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OCKOJb069936; Tue, 24 May 2016 12:20:24 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OCKO1C069934; Tue, 24 May 2016 12:20:24 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201605241220.u4OCKO1C069934@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko <arybchik@FreeBSD.org> Date: Tue, 24 May 2016 12:20:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300609 - in head/sys/dev/sfxge: . common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 12:20:25 -0000 Author: arybchik Date: Tue May 24 12:20:23 2016 New Revision: 300609 URL: https://svnweb.freebsd.org/changeset/base/300609 Log: sfxge(4): enable Medford support Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6510 Modified: head/sys/dev/sfxge/common/efsys.h head/sys/dev/sfxge/sfxge.c Modified: head/sys/dev/sfxge/common/efsys.h ============================================================================== --- head/sys/dev/sfxge/common/efsys.h Tue May 24 12:19:14 2016 (r300608) +++ head/sys/dev/sfxge/common/efsys.h Tue May 24 12:20:23 2016 (r300609) @@ -238,7 +238,7 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, b #define EFSYS_OPT_SIENA 1 #define EFSYS_OPT_HUNTINGTON 1 -#define EFSYS_OPT_MEDFORD 0 +#define EFSYS_OPT_MEDFORD 1 #ifdef DEBUG #define EFSYS_OPT_CHECK_REG 1 #else Modified: head/sys/dev/sfxge/sfxge.c ============================================================================== --- head/sys/dev/sfxge/sfxge.c Tue May 24 12:19:14 2016 (r300608) +++ head/sys/dev/sfxge/sfxge.c Tue May 24 12:20:23 2016 (r300609) @@ -1150,6 +1150,11 @@ sfxge_probe(device_t dev) return (0); } + if (family == EFX_FAMILY_MEDFORD) { + device_set_desc(dev, "Solarflare SFC9200 family"); + return (0); + } + DBGPRINT(dev, "impossible controller family %d", family); return (ENXIO); } From owner-svn-src-head@freebsd.org Tue May 24 12:20:50 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D717B47326; Tue, 24 May 2016 12:20:50 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id CB8DB1748; Tue, 24 May 2016 12:20:49 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id BC6964295DC; Tue, 24 May 2016 22:20:41 +1000 (AEST) Date: Tue, 24 May 2016 22:20:40 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> X-X-Sender: bde@besplex.bde.org To: Kevin Lo <kevlo@freebsd.org> cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300423 - in head/sys: fs/ext2fs ufs/ffs In-Reply-To: <201605221431.u4MEVKXC007524@repo.freebsd.org> Message-ID: <20160524195127.C931@besplex.bde.org> References: <201605221431.u4MEVKXC007524@repo.freebsd.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=c+ZWOkJl c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=nlC_4_pT8q9DhB4Ho9EA:9 a=QENDHu2xUf8jxPyttf4A:9 a=TjCIVPREPFfoBbfk:21 a=UyK6-i59gRvh9EqX:21 a=45ClL6m2LaAA:10 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 12:20:50 -0000 On Sun, 22 May 2016, Kevin Lo wrote: > Log: > arc4random() returns 0 to (2**32)=E2=88=921, use an alternative to initi= alize > i_gen if it's zero rather than a divide by 2. > > With inputs from delphij, mckusick, rmacklem > > Reviewed by:=09mckusick > ... > Modified: head/sys/fs/ext2fs/ext2_alloc.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/fs/ext2fs/ext2_alloc.c=09Sun May 22 14:13:20 2016=09(r300422= ) > +++ head/sys/fs/ext2fs/ext2_alloc.c=09Sun May 22 14:31:20 2016=09(r300423= ) > @@ -408,7 +408,8 @@ ext2_valloc(struct vnode *pvp, int mode, > =09/* > =09 * Set up a new generation number for this inode. > =09 */ > -=09ip->i_gen =3D arc4random(); > +=09while (ip->i_gen =3D=3D 0 || ++ip->i_gen =3D=3D 0) > +=09=09ip->i_gen =3D arc4random(); This is a correct implementation of ffs's intended method, but ffs's intended method is wrong (see below for its wrongness). Correctness depends on i_gen having type uint32_t in ext2fs. This makes the code +ip_i_gen undead, so i_gen is re-randomized occasionally (averaged over all inodes, once for every ~2 billionth reuse of an inode, which is practically never. Bugs in ffs prevent it being done even that often there. So the re-randomization is almost useless. I think it is slighty worse than useless, since it may give the same i_gen immediately, while always incrementing (but skipping 0) always gives a new i_gen. ext2fs might not need this at all. For ffs, then special case of i_gen =3D=3D 0 must be handled because we still pretend to support file systems created by newfs versions almost 25 years old. newfs didn't initialize di_gen back then, so all inodes started with di_gen =3D=3D 0. ext2fs is less that 25 years old, so it has less history to support. > > =09vfs_timestamp(&ts); > =09ip->i_birthtime =3D ts.tv_sec; > > Modified: head/sys/fs/ext2fs/ext2_vfsops.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/fs/ext2fs/ext2_vfsops.c=09Sun May 22 14:13:20 2016=09(r30042= 2) > +++ head/sys/fs/ext2fs/ext2_vfsops.c=09Sun May 22 14:31:20 2016=09(r30042= 3) > @@ -998,7 +998,8 @@ ext2_vget(struct mount *mp, ino_t ino, i > =09 * already have one. This should only happen on old filesystems. > =09 */ > =09if (ip->i_gen =3D=3D 0) { > -=09=09ip->i_gen =3D random() + 1; > +=09=09while (ip->i_gen =3D=3D 0) > +=09=09=09ip->i_gen =3D arc4random(); This is correct, but might be unnecessary (see above). "on old filesystems= " was copied from ffs where it meant "on file systems created by versions of newfs that didn't initialize di_gen". Such file systems are restricted to ffs1. But i_gen stil occurs due to bugs in newfs -- it is missing this loop, so it sometimes sets i_gen to the random value of 1, and we can't/don= 't tell the difference between this and unitialized. I think ext2fs is more like ffs2 in a relevant way here. Both have the feature of speeding up newfs by only writing a few inodes. Thus most inode allocations occur in the kernel, and it hardly matters if newfs initialized i_gen for the few inodes that it initialized. extfs and ext2fs also have an inode non-clearing feature on unlink that might be relevant. I forget if ffs2 has this. So the code should be simplified by never expecting newfs to initialize i_gen to nonzero. It already almost does this, except in the comment. For this, it is necessary to skip i_gen =3D=3D 0 (mod 2**32). > =09=09if ((vp->v_mount->mnt_flag & MNT_RDONLY) =3D=3D 0) > =09=09=09ip->i_flag |=3D IN_MODIFIED; > =09} > > Modified: head/sys/ufs/ffs/ffs_alloc.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/ufs/ffs/ffs_alloc.c=09Sun May 22 14:13:20 2016=09(r300422) > +++ head/sys/ufs/ffs/ffs_alloc.c=09Sun May 22 14:31:20 2016=09(r300423) > @@ -1102,8 +1102,8 @@ dup_alloc: > =09/* > =09 * Set up a new generation number for this inode. > =09 */ > -=09if (ip->i_gen =3D=3D 0 || ++ip->i_gen =3D=3D 0) > -=09=09ip->i_gen =3D arc4random() / 2 + 1; > +=09while (ip->i_gen =3D=3D 0 || ++ip->i_gen =3D=3D 0) > +=09=09ip->i_gen =3D arc4random(); This is broken due to an old type error. In ffs, i_gen has type uint64_t, so it is physically impossible for ++ip->i_gen to wrap to 0. (i_gen is initialized from di_gen, and that has type uint32_t, so i_gen is initially <=3D UINT32_MAX and it would take 584 years to wrap with the modest inode recycling period of 1 nanosecond.) So the above is an obfuscated way of writing: =09if (ip->i_gen =3D=3D 0) { =09=09/* =09=09 * This value means uninitialized (or a bug). Init now. =09=09 * The loop is to not have the usual bug here. =09=09 */ =09=09do =09=09=09ip->i_gen =3D arc4random(); =09=09while (ip->i_gen =3D=3D 0); =09} else =09=09ip->i_gen++; Now it is clear that i_gen can grow far above UINT32_MAX. But usually it doesn't. Growth above UINT32_MAX gets truncated when the vnode is recycled. Overflow occurs with i_gen is stored to di_gen, and growth resumes at a small truncated value. The type error gives truncation on most uses of i_gen: di_gen, ufid_gen and ueh_i_gen are all 32 bits. va_gen is 32-bits on 32-bit arches but is 64 bits on 64-bit arches. Various bugs result. The bugs are mostly features. It is not very useful to re-randomize on reaching the 32-bit boundary. The bugfeature normally avoids this. If i_gen were not truncated to 32 bits when the vnode is recycled (or on unmount), and if it were consistently truncated (that means, truncate it to 32 bits in va_gen on 64-bit arches), then the bugfeature would work perfectly. The top 32 bits in i_gen would then be unused except to record history for a few trillion years for most inodes. > =09DIP_SET(ip, i_gen, ip->i_gen); > =09if (fs->fs_magic =3D=3D FS_UFS2_MAGIC) { > =09=09vfs_timestamp(&ts); > @@ -2080,7 +2080,8 @@ gotit: > =09=09bzero(ibp->b_data, (int)fs->fs_bsize); > =09=09dp2 =3D (struct ufs2_dinode *)(ibp->b_data); > =09=09for (i =3D 0; i < INOPB(fs); i++) { > -=09=09=09dp2->di_gen =3D arc4random() / 2 + 1; > +=09=09=09while (dp2->di_gen =3D=3D 0) > +=09=09=09=09dp2->di_gen =3D arc4random(); This seems to be correct. It is only for the ffs2 case, and di_gen was initialized to 0 by the bzero(), but the while loop is easier to read that the more optimal do-while loop that I wrote above. > =09=09=09dp2++; > =09=09} > =09=09/* > > Modified: head/sys/ufs/ffs/ffs_vfsops.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/ufs/ffs/ffs_vfsops.c=09Sun May 22 14:13:20 2016=09(r300422) > +++ head/sys/ufs/ffs/ffs_vfsops.c=09Sun May 22 14:31:20 2016=09(r300423) > @@ -1768,7 +1768,8 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags > =09 * already have one. This should only happen on old filesystems. > =09 */ > =09if (ip->i_gen =3D=3D 0) { > -=09=09ip->i_gen =3D arc4random() / 2 + 1; > +=09=09while (ip->i_gen =3D=3D 0) > +=09=09=09ip->i_gen =3D arc4random(); This also seems to be correct. Now the compiler can easily optimize the while loop to a do-while loop, since a previous check for i_gen =3D=3D 0 is visible. "should" in the comment is correct, except this should never happen now since file systems that were old when it was written now shouldn't exist. However, this does happen now, mostly for new file systems, due to a bug in newfs: newfs is missing this while loop, so it sometimes initializes di_gen to 0. Then we can't/don't tell if di_gen was initialized to a random value, so we-re-randomize it. > =09=09if ((vp->v_mount->mnt_flag & MNT_RDONLY) =3D=3D 0) { > =09=09=09ip->i_flag |=3D IN_MODIFIED; > =09=09=09DIP_SET(ip, i_gen, ip->i_gen); All versions of newfs seem to have had buggy initialization: - they didn't initialize di_gen (except to 0) until 1997 - the first 1997 version used /dev/urandom to initialize "long ret;". Assignment of this to "int32_t di_gen;" overflowed on 64-bit arches (alpha?). This gave a negative value which gave further overflows or suprising sign extensions mainly when assigned to "u_long va_gen'"; most other types were consistently signed. - the next 1997 version used random(). This fixed the generation of negative values. 0 was still generated - the 2003 version used arc4random(). This gave negative values again. 0 was still generated. This is essentially the current version. The current version uses a wrapper function like the first 1997 version. - newfs doesn't seem to have ever had the version that did *random() / 2 + = 1 like the kernel did. It thus escaped having the overflow/sign extension bugs that the kernel had. Dividing by 2 was apparently supposed to avoi= d these bugs. It worked with random() since random() returns at most INT32_MAX. But arc4random() returns at mist UINT32_MAX. Dividing this by 2 gives (u_int)INT32_MAX and adding 1 gives a value that overflows when assigned to int32_t. This was later fixed by changing lots of int32_t to uint32_t. I'm not sure about the security aspects of randomizing i_gen. The re- randomization is so accidental and infrequent that security must be unimportant. But I think a unique generation (over all inodes on all file systems) would be better than any randomness. FreeBSD-1 was closer to having that -- i_gen was initialized to the global nextgennumber++ if it was zero; it was not incremented for inode use. The globabl would have to be 64 bits now. Ensuring uniqueness is not easy since it means that you have to check inode numbers on not-very-trusted newly mounted file systems against all inode numbers already in use. Perhaps it works to always use a new set for every new mount (ignore the ones on disk). Bruce From owner-svn-src-head@freebsd.org Tue May 24 12:40:04 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D694DB47672; Tue, 24 May 2016 12:40:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B15810F9; Tue, 24 May 2016 12:40:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OCe3Bc076066; Tue, 24 May 2016 12:40:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OCe3Gc076065; Tue, 24 May 2016 12:40:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605241240.u4OCe3Gc076065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin <mav@FreeBSD.org> Date: Tue, 24 May 2016 12:40:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300610 - head/sys/dev/ntb/if_ntb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 12:40:05 -0000 Author: mav Date: Tue May 24 12:40:03 2016 New Revision: 300610 URL: https://svnweb.freebsd.org/changeset/base/300610 Log: Re-enable write combining, disabled by default at r295486. if_ntb(4) strongly benefits from WC, improving throughput from 350Mbit/s to 8-10Gbit/s on my tests. MFC after: 1 week Modified: head/sys/dev/ntb/if_ntb/if_ntb.c Modified: head/sys/dev/ntb/if_ntb/if_ntb.c ============================================================================== --- head/sys/dev/ntb/if_ntb/if_ntb.c Tue May 24 12:20:23 2016 (r300609) +++ head/sys/dev/ntb/if_ntb/if_ntb.c Tue May 24 12:40:03 2016 (r300610) @@ -616,6 +616,10 @@ ntb_transport_probe(struct ntb_softc *nt mw->xlat_size = 0; mw->virt_addr = NULL; mw->dma_addr = 0; + + rc = ntb_mw_set_wc(nt->ntb, i, VM_MEMATTR_WRITE_COMBINING); + if (rc) + ntb_printf(0, "Unable to set mw%d caching\n", i); } qp_bitmap = ntb_db_valid_mask(ntb); From owner-svn-src-head@freebsd.org Tue May 24 13:57:25 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38F9DB4718C; Tue, 24 May 2016 13:57:25 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06562129B; Tue, 24 May 2016 13:57:24 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4ODvOlp000802; Tue, 24 May 2016 13:57:24 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4ODvOhp000801; Tue, 24 May 2016 13:57:24 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201605241357.u4ODvOhp000801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno <sbruno@FreeBSD.org> Date: Tue, 24 May 2016 13:57:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300612 - head/sys/dev/an X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 13:57:25 -0000 Author: sbruno Date: Tue May 24 13:57:23 2016 New Revision: 300612 URL: https://svnweb.freebsd.org/changeset/base/300612 Log: Reject ioctl commands for FLSHGCHR and FLSHPCHR if the size is greater than sc->areq. This is a bounds check to ensure we're not just cramming arbitrarily sized nonsense into the driver and overflowing the heap. PR: 209545 Submitted by: cturt@hardenedbsd.org MFC after: 2 weeks Modified: head/sys/dev/an/if_an.c Modified: head/sys/dev/an/if_an.c ============================================================================== --- head/sys/dev/an/if_an.c Tue May 24 13:57:23 2016 (r300611) +++ head/sys/dev/an/if_an.c Tue May 24 13:57:23 2016 (r300612) @@ -3749,6 +3749,9 @@ flashcard(struct ifnet *ifp, struct airo return ENOBUFS; break; case AIROFLSHGCHR: /* Get char from aux */ + if (l_ioctl->len > sizeof(sc->areq)) { + return -EINVAL; + } AN_UNLOCK(sc); status = copyin(l_ioctl->data, &sc->areq, l_ioctl->len); AN_LOCK(sc); @@ -3760,6 +3763,9 @@ flashcard(struct ifnet *ifp, struct airo else return -1; case AIROFLSHPCHR: /* Send char to card. */ + if (l_ioctl->len > sizeof(sc->areq)) { + return -EINVAL; + } AN_UNLOCK(sc); status = copyin(l_ioctl->data, &sc->areq, l_ioctl->len); AN_LOCK(sc); From owner-svn-src-head@freebsd.org Tue May 24 13:57:24 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A9F8B47189; Tue, 24 May 2016 13:57:24 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C841129A; Tue, 24 May 2016 13:57:24 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4ODvNbZ000758; Tue, 24 May 2016 13:57:23 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4ODvN7Q000757; Tue, 24 May 2016 13:57:23 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201605241357.u4ODvN7Q000757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner <andrew@FreeBSD.org> Date: Tue, 24 May 2016 13:57:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300611 - head/sys/cddl/dev/dtrace/aarch64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 13:57:24 -0000 Author: andrew Date: Tue May 24 13:57:23 2016 New Revision: 300611 URL: https://svnweb.freebsd.org/changeset/base/300611 Log: Mark all memory before the kernel as toxic to DTrace. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Tue May 24 12:40:03 2016 (r300610) +++ head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Tue May 24 13:57:23 2016 (r300611) @@ -120,7 +120,7 @@ void dtrace_toxic_ranges(void (*func)(uintptr_t base, uintptr_t limit)) { - printf("IMPLEMENT ME: dtrace_toxic_ranges\n"); + (*func)(0, (uintptr_t)VM_MIN_KERNEL_ADDRESS); } void From owner-svn-src-head@freebsd.org Tue May 24 13:58:08 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBC17B47253; Tue, 24 May 2016 13:58:08 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 88E041746; Tue, 24 May 2016 13:58:08 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4ODw7GC000887; Tue, 24 May 2016 13:58:07 GMT (envelope-from skreuzer@FreeBSD.org) Received: (from skreuzer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4ODw7HL000886; Tue, 24 May 2016 13:58:07 GMT (envelope-from skreuzer@FreeBSD.org) Message-Id: <201605241358.u4ODw7HL000886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skreuzer set sender to skreuzer@FreeBSD.org using -f From: Steven Kreuzer <skreuzer@FreeBSD.org> Date: Tue, 24 May 2016 13:58:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300613 - head/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 13:58:08 -0000 Author: skreuzer (doc,ports committer) Date: Tue May 24 13:58:07 2016 New Revision: 300613 URL: https://svnweb.freebsd.org/changeset/base/300613 Log: Bump copyright year Approved by: gjb@ (implicit) Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue May 24 13:57:23 2016 (r300612) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue May 24 13:58:07 2016 (r300613) @@ -26,6 +26,7 @@ <copyright> <year>2015</year> + <year>2016</year> <holder role="mailto:doc@FreeBSD.org">The &os; Documentation Project</holder> </copyright> From owner-svn-src-head@freebsd.org Tue May 24 13:59:15 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B466B4737A; Tue, 24 May 2016 13:59:15 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E15361A6D; Tue, 24 May 2016 13:59:14 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4ODxEEb000968; Tue, 24 May 2016 13:59:14 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4ODxE5a000967; Tue, 24 May 2016 13:59:14 GMT (envelope-from br@FreeBSD.org) Message-Id: <201605241359.u4ODxE5a000967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin <br@FreeBSD.org> Date: Tue, 24 May 2016 13:59:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300614 - head/sys/riscv/riscv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 13:59:15 -0000 Author: br Date: Tue May 24 13:59:13 2016 New Revision: 300614 URL: https://svnweb.freebsd.org/changeset/base/300614 Log: Store the original value of stack pointer to the exception frame (the value we had before supervisor exception occurred). This helps consumers (e.g. DTrace) to not proceed additional calculations. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Modified: head/sys/riscv/riscv/exception.S Modified: head/sys/riscv/riscv/exception.S ============================================================================== --- head/sys/riscv/riscv/exception.S Tue May 24 13:58:07 2016 (r300613) +++ head/sys/riscv/riscv/exception.S Tue May 24 13:59:13 2016 (r300614) @@ -93,7 +93,9 @@ __FBSDID("$FreeBSD$"); .if \el == 1 /* Store kernel sp */ - sd sp, (TF_SP)(sp) + li t1, TF_SIZE + add t0, sp, t1 + sd t0, (TF_SP)(sp) .else /* Store user sp */ csrr t0, sscratch From owner-svn-src-head@freebsd.org Tue May 24 14:34:37 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5B8BB47DD1; Tue, 24 May 2016 14:34:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2973104E; Tue, 24 May 2016 14:34:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OEYaUD013699; Tue, 24 May 2016 14:34:36 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OEYaZv013698; Tue, 24 May 2016 14:34:36 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201605241434.u4OEYaZv013698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala <trasz@FreeBSD.org> Date: Tue, 24 May 2016 14:34:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300615 - head/sys/dev/iscsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 14:34:38 -0000 Author: trasz Date: Tue May 24 14:34:36 2016 New Revision: 300615 URL: https://svnweb.freebsd.org/changeset/base/300615 Log: Add kern.icl.iser_offloads sysctl. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iscsi/icl.c Modified: head/sys/dev/iscsi/icl.c ============================================================================== --- head/sys/dev/iscsi/icl.c Tue May 24 13:59:13 2016 (r300614) +++ head/sys/dev/iscsi/icl.c Tue May 24 14:34:36 2016 (r300615) @@ -79,20 +79,27 @@ SYSCTL_INT(_kern_icl, OID_AUTO, debug, C &icl_debug, 0, "Enable debug messages"); SYSCTL_PROC(_kern_icl, OID_AUTO, offloads, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, - NULL, 0, sysctl_kern_icl_offloads, "A", + NULL, false, sysctl_kern_icl_offloads, "A", "List of ICL modules"); +SYSCTL_PROC(_kern_icl, OID_AUTO, iser_offloads, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + NULL, true, sysctl_kern_icl_offloads, "A", + "List of iSER ICL modules"); static int sysctl_kern_icl_offloads(SYSCTL_HANDLER_ARGS) { const struct icl_module *im; struct sbuf sb; + bool iser = arg2; int error; sbuf_new(&sb, NULL, 256, SBUF_AUTOEXTEND | SBUF_INCLUDENUL); sx_slock(&sc->sc_lock); TAILQ_FOREACH(im, &sc->sc_modules, im_next) { + if (im->im_iser != iser) + continue; if (im != TAILQ_FIRST(&sc->sc_modules)) sbuf_putc(&sb, ' '); sbuf_printf(&sb, "%s", im->im_name); From owner-svn-src-head@freebsd.org Tue May 24 14:47:28 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49739B481E0 for <svn-src-head@mailman.ysv.freebsd.org>; Tue, 24 May 2016 14:47:28 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm48-vm7.bullet.mail.bf1.yahoo.com (nm48-vm7.bullet.mail.bf1.yahoo.com [216.109.115.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11A871A57 for <svn-src-head@freebsd.org>; Tue, 24 May 2016 14:47:27 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1464101240; bh=VySKh377OV8Nj1W8csiYM3fQNmLLxHpN9apdvgJmTk8=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=XOOf9wdM6qpQYAAQ35cnOPbPYEL3T1LFAL4FV7VP1GvG07XERekzm0fIgiPa1P7pG2PdLO41pVnMR+dbpka5kkBDLETmfC80uuoFzDbfdu47GzYu0aybimc0t5G7uFQMcfAmt5FBQG7rolJhtOvWnXvlCQilHRquOcLWZE0Mac7GXxkcii/TdtinY5uNhDBgZUlNOCTggQmOd0FcVmcCdtapxLdnu3LLgnOArI80itTo63p0vSQ+pMRRTwRF2iZt9MDPVFOsEwPvDGyYefTPrN0IBu3JW/Mg+eYoOeAhIZbyUK+KSLbvonHuAf9bxlGHpwyzYVnz3cv4FEAvuyzHKg== Received: from [66.196.81.171] by nm48.bullet.mail.bf1.yahoo.com with NNFMP; 24 May 2016 14:47:20 -0000 Received: from [68.142.230.72] by tm17.bullet.mail.bf1.yahoo.com with NNFMP; 24 May 2016 14:47:20 -0000 Received: from [127.0.0.1] by smtp229.mail.bf1.yahoo.com with NNFMP; 24 May 2016 14:47:20 -0000 X-Yahoo-Newman-Id: 543301.25536.bm@smtp229.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: FEjh0UQVM1kt_5UIkCeZS8ri1MvAaGtvhjCIhypCGqU6FV3 MGmDKiHm9qwYaw3zpNzOe654P7JQJKVU4_Dwxxt0_ny00MroEhFP7v8ssiYH QHtlZtYlhQ3T5OGyy9byPQoayvsELuLccbbrRKZ4_LAgr.znXOq9jdfen.Pt 01i5MlxjDUMsG1.OdpC50KLk890HKjwu8zQznwWSZyo3gCvaxSBRcHl0xMQv 2GGqvZl3QPbcyVeqJVoCWLh89moT1CYgF7H9L4ICXBM0XACUUR24Dnm8DA3r xv418uLhmFIv4eqLhV7DcGAkIHFuerFTR6oLvV4p4zaxIaQQLlDkeCtojymG _WxtqrVAWRXGJhpfeXV4LEmCY4gazUGGJTWovSmZvOEzp5z4ncuuat9EK3H4 u2IPOorq85N5HMN06KBdCGVXEqDBNKznDf827MgDhncjstZksKT6a1TnGGXm 25r5Y2mEVr1gjdW1IQDDbSh11w3Y_JkkTiojKhEnvjn_uGU06qjiF8zrgBx1 cREJZac8YOPMt5wL4iGXnQBpLRS5REOb1 X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r300423 - in head/sys: fs/ext2fs ufs/ffs To: Bruce Evans <brde@optusnet.com.au>, Kevin Lo <kevlo@freebsd.org> References: <201605221431.u4MEVKXC007524@repo.freebsd.org> <20160524195127.C931@besplex.bde.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni <pfg@FreeBSD.org> Message-ID: <b2633318-9e64-ab1f-4a21-931193eb4b36@FreeBSD.org> Date: Tue, 24 May 2016 09:47:38 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <20160524195127.C931@besplex.bde.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 14:47:28 -0000 On 05/24/16 07:20, Bruce Evans wrote: > On Sun, 22 May 2016, Kevin Lo wrote: > >> Log: >> arc4random() returns 0 to (2**32)−1, use an alternative to initialize >> i_gen if it's zero rather than a divide by 2. >> >> With inputs from delphij, mckusick, rmacklem >> >> Reviewed by: mckusick >> ... >> Modified: head/sys/fs/ext2fs/ext2_alloc.c >> ============================================================================== >> >> --- head/sys/fs/ext2fs/ext2_alloc.c Sun May 22 14:13:20 2016 >> (r300422) >> +++ head/sys/fs/ext2fs/ext2_alloc.c Sun May 22 14:31:20 2016 >> (r300423) >> @@ -408,7 +408,8 @@ ext2_valloc(struct vnode *pvp, int mode, >> /* >> * Set up a new generation number for this inode. >> */ >> - ip->i_gen = arc4random(); >> + while (ip->i_gen == 0 || ++ip->i_gen == 0) >> + ip->i_gen = arc4random(); > > This is a correct implementation of ffs's intended method, but ffs's > intended method is wrong (see below for its wrongness). > > Correctness depends on i_gen having type uint32_t in ext2fs. This > makes the code +ip_i_gen undead, so i_gen is re-randomized occasionally > (averaged over all inodes, once for every ~2 billionth reuse of an > inode, which is practically never. Bugs in ffs prevent it being done > even that often there. So the re-randomization is almost useless. I > think it is slighty worse than useless, since it may give the same > i_gen immediately, while always incrementing (but skipping 0) always > gives a new i_gen. > > ext2fs might not need this at all. For ffs, then special case of > i_gen == 0 must be handled because we still pretend to support file > systems created by newfs versions almost 25 years old. newfs didn't > initialize di_gen back then, so all inodes started with di_gen == 0. > ext2fs is less that 25 years old, so it has less history to support. > I agree ext2fs, and likely UFS2, can handle the case of di_gen == 0. The additional question is where do we actually need to do randomization in ext2fs? UFS does the randomization when formatting so ffs_vget doesn't do randomization at all. arc4random is AFAICT, only required for very old UFS1. I lost interest in ext2fs and can't be bothered to look in linux ;). >> >> vfs_timestamp(&ts); >> ip->i_birthtime = ts.tv_sec; >> >> Modified: head/sys/fs/ext2fs/ext2_vfsops.c >> ============================================================================== >> >> --- head/sys/fs/ext2fs/ext2_vfsops.c Sun May 22 14:13:20 2016 >> (r300422) >> +++ head/sys/fs/ext2fs/ext2_vfsops.c Sun May 22 14:31:20 2016 >> (r300423) >> @@ -998,7 +998,8 @@ ext2_vget(struct mount *mp, ino_t ino, i >> * already have one. This should only happen on old filesystems. >> */ >> if (ip->i_gen == 0) { >> - ip->i_gen = random() + 1; >> + while (ip->i_gen == 0) >> + ip->i_gen = arc4random(); > > This is correct, but might be unnecessary (see above). "on old > filesystems" > was copied from ffs where it meant "on file systems created by versions > of newfs that didn't initialize di_gen". Such file systems are restricted > to ffs1. But i_gen stil occurs due to bugs in newfs -- it is missing this > loop, so it sometimes sets i_gen to the random value of 1, and we > can't/don't > tell the difference between this and unitialized. > > I think ext2fs is more like ffs2 in a relevant way here. Both have the > feature of speeding up newfs by only writing a few inodes. Thus most > inode allocations occur in the kernel, and it hardly matters if newfs > initialized i_gen for the few inodes that it initialized. extfs and > ext2fs also have an inode non-clearing feature on unlink that might > be relevant. I forget if ffs2 has this. So the code should be simplified > by never expecting newfs to initialize i_gen to nonzero. It already > almost does this, except in the comment. For this, it is necessary to > skip i_gen == 0 (mod 2**32). > >> if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) >> ip->i_flag |= IN_MODIFIED; >> } >> >> Modified: head/sys/ufs/ffs/ffs_alloc.c >> ============================================================================== >> >> --- head/sys/ufs/ffs/ffs_alloc.c Sun May 22 14:13:20 2016 (r300422) >> +++ head/sys/ufs/ffs/ffs_alloc.c Sun May 22 14:31:20 2016 (r300423) >> @@ -1102,8 +1102,8 @@ dup_alloc: >> /* >> * Set up a new generation number for this inode. >> */ >> - if (ip->i_gen == 0 || ++ip->i_gen == 0) >> - ip->i_gen = arc4random() / 2 + 1; >> + while (ip->i_gen == 0 || ++ip->i_gen == 0) >> + ip->i_gen = arc4random(); > > This is broken due to an old type error. In ffs, i_gen has type uint64_t, > so it is physically impossible for ++ip->i_gen to wrap to 0. > (i_gen is initialized from di_gen, and that has type uint32_t, so > i_gen is initially <= UINT32_MAX and it would take 584 years to wrap > with the modest inode recycling period of 1 nanosecond.) > So the above is an obfuscated way of writing: > > if (ip->i_gen == 0) { > /* > * This value means uninitialized (or a bug). Init now. > * The loop is to not have the usual bug here. > */ > do > ip->i_gen = arc4random(); > while (ip->i_gen == 0); > } else > ip->i_gen++; > > Now it is clear that i_gen can grow far above UINT32_MAX. But usually > it doesn't. Growth above UINT32_MAX gets truncated when the vnode is > recycled. Overflow occurs with i_gen is stored to di_gen, and growth > resumes at a small truncated value. > > The type error gives truncation on most uses of i_gen: di_gen, ufid_gen > and ueh_i_gen are all 32 bits. va_gen is 32-bits on 32-bit arches but > is 64 bits on 64-bit arches. Various bugs result. The bugs are mostly > features. It is not very useful to re-randomize on reaching the 32-bit > boundary. The bugfeature normally avoids this. If i_gen were not > truncated to 32 bits when the vnode is recycled (or on unmount), and > if it were consistently truncated (that means, truncate it to 32 bits > in va_gen on 64-bit arches), then the bugfeature would work perfectly. > The top 32 bits in i_gen would then be unused except to record history > for a few trillion years for most inodes. > >> DIP_SET(ip, i_gen, ip->i_gen); >> if (fs->fs_magic == FS_UFS2_MAGIC) { >> vfs_timestamp(&ts); >> @@ -2080,7 +2080,8 @@ gotit: >> bzero(ibp->b_data, (int)fs->fs_bsize); >> dp2 = (struct ufs2_dinode *)(ibp->b_data); >> for (i = 0; i < INOPB(fs); i++) { >> - dp2->di_gen = arc4random() / 2 + 1; >> + while (dp2->di_gen == 0) >> + dp2->di_gen = arc4random(); > > This seems to be correct. It is only for the ffs2 case, and di_gen was > initialized to 0 by the bzero(), but the while loop is easier to read > that the more optimal do-while loop that I wrote above. > >> dp2++; >> } >> /* >> >> Modified: head/sys/ufs/ffs/ffs_vfsops.c >> ============================================================================== >> >> --- head/sys/ufs/ffs/ffs_vfsops.c Sun May 22 14:13:20 2016 >> (r300422) >> +++ head/sys/ufs/ffs/ffs_vfsops.c Sun May 22 14:31:20 2016 >> (r300423) >> @@ -1768,7 +1768,8 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags >> * already have one. This should only happen on old filesystems. >> */ >> if (ip->i_gen == 0) { >> - ip->i_gen = arc4random() / 2 + 1; >> + while (ip->i_gen == 0) >> + ip->i_gen = arc4random(); > > This also seems to be correct. Now the compiler can easily optimize the > while loop to a do-while loop, since a previous check for i_gen == 0 is > visible. > > "should" in the comment is correct, except this should never happen > now since file systems that were old when it was written now shouldn't > exist. However, this does happen now, mostly for new file systems, > due to a bug in newfs: newfs is missing this while loop, so it sometimes > initializes di_gen to 0. Then we can't/don't tell if di_gen was > initialized to a random value, so we-re-randomize it. > >> if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) { >> ip->i_flag |= IN_MODIFIED; >> DIP_SET(ip, i_gen, ip->i_gen); > > All versions of newfs seem to have had buggy initialization: > - they didn't initialize di_gen (except to 0) until 1997 > - the first 1997 version used /dev/urandom to initialize "long ret;". > Assignment of this to "int32_t di_gen;" overflowed on 64-bit arches > (alpha?). This gave a negative value which gave further overflows > or suprising sign extensions mainly when assigned to "u_long va_gen'"; > most other types were consistently signed. > - the next 1997 version used random(). This fixed the generation of > negative values. 0 was still generated > - the 2003 version used arc4random(). This gave negative values again. > 0 was still generated. This is essentially the current version. The > current version uses a wrapper function like the first 1997 version. > - newfs doesn't seem to have ever had the version that did *random() / 2 > + 1 > like the kernel did. It thus escaped having the overflow/sign extension > bugs that the kernel had. Dividing by 2 was apparently supposed to avoid > these bugs. It worked with random() since random() returns at most > INT32_MAX. But arc4random() returns at mist UINT32_MAX. Dividing this > by 2 gives (u_int)INT32_MAX and adding 1 gives a value that overflows > when assigned to int32_t. This was later fixed by changing lots of > int32_t to uint32_t. > > I'm not sure about the security aspects of randomizing i_gen. The re- > randomization is so accidental and infrequent that security must be > unimportant. But I think a unique generation (over all inodes on all > file systems) would be better than any randomness. FreeBSD-1 was closer > to having that -- i_gen was initialized to the global nextgennumber++ if > it was zero; it was not incremented for inode use. The globabl would > have to be 64 bits now. Ensuring uniqueness is not easy since it means > that you have to check inode numbers on not-very-trusted newly mounted > file systems against all inode numbers already in use. Perhaps it works > to always use a new set for every new mount (ignore the ones on disk). > > Bruce Yes, I have always wondered: who is detecting if we have a repeated generation number, the end user? And then if we get a repeated generation number and try to fix it, how do we know that a new random value we generate to replace the duplicate is unused? I am rather afraid to hear the answers :-/. Pedro. From owner-svn-src-head@freebsd.org Tue May 24 15:39:58 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4784B48EA4; Tue, 24 May 2016 15:39:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD746147B; Tue, 24 May 2016 15:39:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OFdvI2032258; Tue, 24 May 2016 15:39:57 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OFdvFd032257; Tue, 24 May 2016 15:39:57 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605241539.u4OFdvFd032257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Tue, 24 May 2016 15:39:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300616 - head/sys/dev/bhnd/soc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 15:39:59 -0000 Author: adrian Date: Tue May 24 15:39:57 2016 New Revision: 300616 URL: https://svnweb.freebsd.org/changeset/base/300616 Log: [bhnd] fix compilation due to incompatible types Submitted by: Michael Zhilin <mizhka@gmail.com> Differential Revision: https://reviews.freebsd.org/D6532 Modified: head/sys/dev/bhnd/soc/bhnd_soc.c Modified: head/sys/dev/bhnd/soc/bhnd_soc.c ============================================================================== --- head/sys/dev/bhnd/soc/bhnd_soc.c Tue May 24 14:34:36 2016 (r300615) +++ head/sys/dev/bhnd/soc/bhnd_soc.c Tue May 24 15:39:57 2016 (r300616) @@ -216,7 +216,7 @@ bhnd_soc_is_hw_disabled(device_t dev, de return false; } -static int +static bhnd_attach_type bhnd_soc_get_attach_type(device_t dev, device_t child) { return (BHND_ATTACH_NATIVE); From owner-svn-src-head@freebsd.org Tue May 24 15:53:28 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDCF2B482AF; Tue, 24 May 2016 15:53:28 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CD8C31D6E; Tue, 24 May 2016 15:53:28 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id DDCE0B978; Tue, 24 May 2016 11:53:26 -0400 (EDT) From: John Baldwin <jhb@freebsd.org> To: Alan Somers <asomers@freebsd.org> Cc: Peter Wemm <peter@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Subject: Re: svn commit: r300557 - head/usr.sbin/apmd Date: Tue, 24 May 2016 08:52:32 -0700 Message-ID: <2084098.Ir36lcS1Gf@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <CAOtMX2jU=GNKbGUeMrSHZsxd8GLe9gd-ycYZS8ST_85+ai+JBA@mail.gmail.com> References: <201605240315.u4O3FkMt001717@repo.freebsd.org> <CAOtMX2jU=GNKbGUeMrSHZsxd8GLe9gd-ycYZS8ST_85+ai+JBA@mail.gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 24 May 2016 11:53:27 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 15:53:29 -0000 On Monday, May 23, 2016 09:24:41 PM Alan Somers wrote: > On Mon, May 23, 2016 at 9:15 PM, Peter Wemm <peter@freebsd.org> wrote: > > > Author: peter > > Date: Tue May 24 03:15:46 2016 > > New Revision: 300557 > > URL: https://svnweb.freebsd.org/changeset/base/300557 > > > > Log: > > It seems <sys/types.h> is a new prerequisite for <bitstring.h> after > > r300539. Attempt to fix the build for i386. > > > > Modified: > > head/usr.sbin/apmd/apmd.c > > head/usr.sbin/apmd/apmdlex.l > > head/usr.sbin/apmd/apmdparse.y > > > > > Are you sure this is necessary, even after 300544? Actually, we try to avoid nested includes when possible for userland, so I'd be inclined to drop the <sys/types.h> nested include and just add <sys/types.h> to the places that need it. Userland code in the base system is supposed to have <sys/types.h> or <sys/param.h> as the first #include anyway (which apmd was not following), so any fixes to userland are probably style fixes anyway. -- John Baldwin From owner-svn-src-head@freebsd.org Tue May 24 16:30:06 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93E41B48ED8; Tue, 24 May 2016 16:30:06 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5FF8B13A1; Tue, 24 May 2016 16:30:06 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OGU5TW047840; Tue, 24 May 2016 16:30:05 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OGU53d047839; Tue, 24 May 2016 16:30:05 GMT (envelope-from br@FreeBSD.org) Message-Id: <201605241630.u4OGU53d047839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin <br@FreeBSD.org> Date: Tue, 24 May 2016 16:30:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300617 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 16:30:06 -0000 Author: br Date: Tue May 24 16:30:05 2016 New Revision: 300617 URL: https://svnweb.freebsd.org/changeset/base/300617 Log: Set dependencies for genassym.c. This fixes non-parallel build. Modified: head/sys/conf/Makefile.riscv Modified: head/sys/conf/Makefile.riscv ============================================================================== --- head/sys/conf/Makefile.riscv Tue May 24 15:39:57 2016 (r300616) +++ head/sys/conf/Makefile.riscv Tue May 24 16:30:05 2016 (r300617) @@ -32,6 +32,9 @@ INCLUDES+= -I$S/contrib/libfdt CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls .endif +# hack because genassym.c includes sys/bus.h which includes these. +genassym.o: bus_if.h device_if.h + %BEFORE_DEPEND %OBJS From owner-svn-src-head@freebsd.org Tue May 24 16:41:39 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABAD2B480F8; Tue, 24 May 2016 16:41:39 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67E091B7E; Tue, 24 May 2016 16:41:39 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OGfcCj053473; Tue, 24 May 2016 16:41:38 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OGfbRq051549; Tue, 24 May 2016 16:41:37 GMT (envelope-from br@FreeBSD.org) Message-Id: <201605241641.u4OGfbRq051549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin <br@FreeBSD.org> Date: Tue, 24 May 2016 16:41:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300618 - in head: cddl/contrib/opensolaris/lib/libdtrace/common cddl/contrib/opensolaris/lib/libdtrace/riscv cddl/lib cddl/lib/libdtrace cddl/usr.sbin sys/cddl/contrib/opensolaris/uts/... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 16:41:39 -0000 Author: br Date: Tue May 24 16:41:37 2016 New Revision: 300618 URL: https://svnweb.freebsd.org/changeset/base/300618 Log: Add initial DTrace support for RISC-V. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Added: head/cddl/contrib/opensolaris/lib/libdtrace/riscv/ head/cddl/contrib/opensolaris/lib/libdtrace/riscv/dt_isadep.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/riscv/ head/sys/cddl/contrib/opensolaris/uts/riscv/dtrace/ head/sys/cddl/contrib/opensolaris/uts/riscv/dtrace/fasttrap_isa.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/riscv/sys/ head/sys/cddl/contrib/opensolaris/uts/riscv/sys/fasttrap_isa.h (contents, props changed) head/sys/cddl/dev/dtrace/riscv/ head/sys/cddl/dev/dtrace/riscv/dtrace_asm.S (contents, props changed) head/sys/cddl/dev/dtrace/riscv/dtrace_isa.c (contents, props changed) head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c (contents, props changed) head/sys/cddl/dev/dtrace/riscv/regset.h (contents, props changed) head/sys/cddl/dev/fbt/riscv/ head/sys/cddl/dev/fbt/riscv/fbt_isa.c (contents, props changed) head/sys/cddl/dev/fbt/riscv/fbt_isa.h (contents, props changed) Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c head/cddl/lib/Makefile head/cddl/lib/libdtrace/Makefile head/cddl/usr.sbin/Makefile head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h head/sys/cddl/dev/profile/profile.c head/sys/conf/files.riscv head/sys/riscv/include/frame.h head/sys/riscv/include/riscvreg.h head/sys/riscv/riscv/trap.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Tue May 24 16:30:05 2016 (r300617) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Tue May 24 16:41:37 2016 (r300618) @@ -250,6 +250,9 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION_ dofr[j].dofr_offset + 4; rel->r_info = ELF32_R_INFO(count + dep->de_global, R_PPC_REL32); +#elif defined(__riscv__) +/* XXX */ +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); #elif defined(__sparc) /* * Add 4 bytes to hit the low half of this 64-bit @@ -440,6 +443,8 @@ prepare_elf64(dtrace_hdl_t *dtp, const d dofr[j].dofr_offset; rel->r_info = ELF64_R_INFO(count + dep->de_global, R_PPC64_REL64); +#elif defined(__riscv__) +/* XXX */ #elif defined(__i386) || defined(__amd64) rel->r_offset = s->dofs_offset + dofr[j].dofr_offset; @@ -935,7 +940,15 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, i return (0); } - +#elif defined(__riscv__) +/* XXX */ +static int +dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, + uint32_t *off) +{ +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + return (0); +} #elif defined(__sparc) #define DT_OP_RET 0x81c7e008 Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c Tue May 24 16:30:05 2016 (r300617) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c Tue May 24 16:41:37 2016 (r300618) @@ -310,7 +310,8 @@ pfprint_fp(dtrace_hdl_t *dtp, FILE *fp, case sizeof (double): return (dt_printf(dtp, fp, format, *((double *)addr) / n)); -#if !defined(__arm__) && !defined(__powerpc__) && !defined(__mips__) +#if !defined(__arm__) && !defined(__powerpc__) && \ + !defined(__mips__) && !defined(__riscv__) case sizeof (long double): return (dt_printf(dtp, fp, format, *((long double *)addr) / ldn)); Added: head/cddl/contrib/opensolaris/lib/libdtrace/riscv/dt_isadep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/lib/libdtrace/riscv/dt_isadep.c Tue May 24 16:41:37 2016 (r300618) @@ -0,0 +1,139 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + * Copyright 2014 Howard Su + * Copyright 2015 George V. Neville-Neil + * Copyright 2015 Ruslan Bukin <br@bsdpad.com> + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <stdlib.h> +#include <assert.h> +#include <errno.h> +#include <string.h> +#include <libgen.h> + +#include <dt_impl.h> +#include <dt_pid.h> + +#if !defined(sun) +#include <libproc_compat.h> +#endif + +/*ARGSUSED*/ +int +dt_pid_create_entry_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp, + fasttrap_probe_spec_t *ftp, const GElf_Sym *symp) +{ + + ftp->ftps_type = DTFTP_ENTRY; + ftp->ftps_pc = (uintptr_t)symp->st_value; + ftp->ftps_size = (size_t)symp->st_size; + ftp->ftps_noffs = 1; + ftp->ftps_offs[0] = 0; + + if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) { + dt_dprintf("fasttrap probe creation ioctl failed: %s\n", + strerror(errno)); + return (dt_set_errno(dtp, errno)); + } + + return (1); +} + +int +dt_pid_create_return_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp, + fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, uint64_t *stret) +{ + + dt_dprintf("%s: unimplemented\n", __func__); + + return (DT_PROC_ERR); +} + +/*ARGSUSED*/ +int +dt_pid_create_offset_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp, + fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, ulong_t off) +{ + + if (!ALIGNED_POINTER(off, 4)) + return (DT_PROC_ALIGN); + + ftp->ftps_type = DTFTP_OFFSETS; + ftp->ftps_pc = (uintptr_t)symp->st_value; + ftp->ftps_size = (size_t)symp->st_size; + ftp->ftps_noffs = 1; + ftp->ftps_offs[0] = off; + + if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) { + dt_dprintf("fasttrap probe creation ioctl failed: %s\n", + strerror(errno)); + return (dt_set_errno(dtp, errno)); + } + + return (1); +} + +/*ARGSUSED*/ +int +dt_pid_create_glob_offset_probes(struct ps_prochandle *P, dtrace_hdl_t *dtp, + fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, const char *pattern) +{ + ulong_t i; + + ftp->ftps_type = DTFTP_OFFSETS; + ftp->ftps_pc = (uintptr_t)symp->st_value; + ftp->ftps_size = (size_t)symp->st_size; + ftp->ftps_noffs = 0; + + /* + * If we're matching against everything, just iterate through each + * instruction in the function, otherwise look for matching offset + * names by constructing the string and comparing it against the + * pattern. + */ + if (strcmp("*", pattern) == 0) { + for (i = 0; i < symp->st_size; i += 4) { + ftp->ftps_offs[ftp->ftps_noffs++] = i; + } + } else { + char name[sizeof (i) * 2 + 1]; + + for (i = 0; i < symp->st_size; i += 4) { + (void) sprintf(name, "%lx", i); + if (gmatch(name, pattern)) + ftp->ftps_offs[ftp->ftps_noffs++] = i; + } + } + + if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) { + dt_dprintf("fasttrap probe creation ioctl failed: %s\n", + strerror(errno)); + return (dt_set_errno(dtp, errno)); + } + + return (ftp->ftps_noffs); +} Modified: head/cddl/lib/Makefile ============================================================================== --- head/cddl/lib/Makefile Tue May 24 16:30:05 2016 (r300617) +++ head/cddl/lib/Makefile Tue May 24 16:41:37 2016 (r300618) @@ -26,7 +26,7 @@ _libzpool= libzpool .endif .endif -.if ${MACHINE_CPUARCH} != "sparc64" && ${MACHINE_CPUARCH} != "riscv" +.if ${MACHINE_CPUARCH} != "sparc64" _drti= drti _libdtrace= libdtrace .endif Modified: head/cddl/lib/libdtrace/Makefile ============================================================================== --- head/cddl/lib/libdtrace/Makefile Tue May 24 16:30:05 2016 (r300617) +++ head/cddl/lib/libdtrace/Makefile Tue May 24 16:41:37 2016 (r300618) @@ -95,6 +95,10 @@ CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/ut CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/powerpc .PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/powerpc .PATH: ${.CURDIR}/../../../sys/cddl/dev/dtrace/powerpc +.elif ${MACHINE_CPUARCH} == "riscv" +CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/riscv +.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/riscv +.PATH: ${.CURDIR}/../../../sys/cddl/dev/dtrace/riscv .elif ${MACHINE_CPUARCH} == "sparc64" CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/sparc .PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/sparc Modified: head/cddl/usr.sbin/Makefile ============================================================================== --- head/cddl/usr.sbin/Makefile Tue May 24 16:30:05 2016 (r300617) +++ head/cddl/usr.sbin/Makefile Tue May 24 16:41:37 2016 (r300618) @@ -26,7 +26,8 @@ _lockstat= lockstat _plockstat= plockstat .endif -.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" || \ + ${MACHINE_CPUARCH} == "riscv" _dtrace= dtrace _lockstat= lockstat .endif Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue May 24 16:30:05 2016 (r300617) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue May 24 16:41:37 2016 (r300618) @@ -12026,7 +12026,7 @@ err: *factor = 1; #if defined(__aarch64__) || defined(__amd64__) || defined(__arm__) || \ - defined(__mips__) || defined(__powerpc__) + defined(__mips__) || defined(__powerpc__) || defined(__riscv__) /* * FreeBSD isn't good at limiting the amount of memory we * ask to malloc, so let's place a limit here before trying Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Tue May 24 16:30:05 2016 (r300617) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Tue May 24 16:41:37 2016 (r300618) @@ -2495,6 +2495,16 @@ extern void dtrace_helpers_destroy(proc_ #define DTRACE_INVOP_SD 1 #define DTRACE_INVOP_LD 2 + +#elif defined(__riscv__) + +#define SD_RA_SP_MASK 0x1fff07f +#define SD_RA_SP 0x0113023 + +#define DTRACE_INVOP_SD 1 +#define DTRACE_INVOP_RET 2 +#define DTRACE_INVOP_NOP 3 + #endif #ifdef __cplusplus Added: head/sys/cddl/contrib/opensolaris/uts/riscv/dtrace/fasttrap_isa.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/riscv/dtrace/fasttrap_isa.c Tue May 24 16:41:37 2016 (r300618) @@ -0,0 +1,29 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * XXX: Placeholder for RISC-V fasttrap code + */ Added: head/sys/cddl/contrib/opensolaris/uts/riscv/sys/fasttrap_isa.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/riscv/sys/fasttrap_isa.h Tue May 24 16:41:37 2016 (r300618) @@ -0,0 +1,46 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _FASTTRAP_ISA_H +#define _FASTTRAP_ISA_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef uint32_t fasttrap_instr_t; + +/* XXX: Place for RISC-V fasttrap headers */ + +#ifdef __cplusplus +} +#endif + +#endif /* _FASTTRAP_ISA_H */ Added: head/sys/cddl/dev/dtrace/riscv/dtrace_asm.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/dev/dtrace/riscv/dtrace_asm.S Tue May 24 16:41:37 2016 (r300618) @@ -0,0 +1,176 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * + * Portions Copyright 2016 Ruslan Bukin <br@bsdpad.com> + * + * $FreeBSD$ + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#define _ASM +#define _LOCORE + +#include <sys/cpuvar_defs.h> +#include <sys/dtrace.h> + +#include <machine/riscvreg.h> +#include <machine/asm.h> + +#include "assym.s" + +/* +void dtrace_membar_producer(void) +*/ +ENTRY(dtrace_membar_producer) + RET +END(dtrace_membar_producer) + +/* +void dtrace_membar_consumer(void) +*/ +ENTRY(dtrace_membar_consumer) + RET +END(dtrace_membar_consumer) + +/* +dtrace_icookie_t dtrace_interrupt_disable(void) +*/ +ENTRY(dtrace_interrupt_disable) + csrci sstatus, 1 + RET +END(dtrace_interrupt_disable) + +/* +void dtrace_interrupt_enable(dtrace_icookie_t cookie) +*/ +ENTRY(dtrace_interrupt_enable) + csrsi sstatus, 1 + RET +END(dtrace_interrupt_enable) +/* +uint8_t +dtrace_fuword8_nocheck(void *addr) +*/ +ENTRY(dtrace_fuword8_nocheck) + lb a0, 0(a0) + RET +END(dtrace_fuword8_nocheck) + +/* +uint16_t +dtrace_fuword16_nocheck(void *addr) +*/ +ENTRY(dtrace_fuword16_nocheck) + lh a0, 0(a0) + RET +END(dtrace_fuword16_nocheck) + +/* +uint32_t +dtrace_fuword32_nocheck(void *addr) +*/ +ENTRY(dtrace_fuword32_nocheck) + lw a0, 0(a0) + RET +END(dtrace_fuword32_nocheck) + +/* +uint64_t +dtrace_fuword64_nocheck(void *addr) +*/ +ENTRY(dtrace_fuword64_nocheck) + ld a0, 0(a0) + RET +END(dtrace_fuword64_nocheck) + +/* +void +dtrace_copy(uintptr_t uaddr, uintptr_t kaddr, size_t size) +*/ +ENTRY(dtrace_copy) + beqz a2, 2f /* If len == 0 then skip loop */ +1: + lb a4, 0(a0) /* Load from uaddr */ + addi a0, a0, 1 + sb a4, 0(a1) /* Store in kaddr */ + addi a1, a1, 1 + addi a2, a2, -1 /* len-- */ + bnez a2, 1b +2: + RET +END(dtrace_copy) + +/* +void +dtrace_copystr(uintptr_t uaddr, uintptr_t kaddr, size_t size, + volatile uint16_t *flags) +XXX: Check for flags? +*/ +ENTRY(dtrace_copystr) + beqz a2, 2f /* If len == 0 then skip loop */ + lb a4, 0(a0) /* Load from uaddr */ + addi a0, a0, 1 + sb a4, 0(a1) /* Store in kaddr */ + addi a1, a1, 1 + beqz a4, 2f /* If == 0 then break */ + addi a2, a2, -1 /* len-- */ + bnez a2, 1b +2: + RET +END(dtrace_copystr) + +/* +uintptr_t +dtrace_caller(int aframes) +*/ +ENTRY(dtrace_caller) + li a0, -1 + RET +END(dtrace_caller) + +/* +uint32_t +dtrace_cas32(uint32_t *target, uint32_t cmp, uint32_t new) +*/ +ENTRY(dtrace_cas32) +1: lr.w a3, 0(a0) /* Load target */ + bne a3, a1, 2f /* *target != cmp ? return */ + sc.w a4, a2, 0(a0) /* Store new to target */ + bnez a4, 1b /* Try again if store not succeed */ +2: mv a0, a3 /* Return the value loaded from target */ + RET +END(dtrace_cas32) + +/* +void * +dtrace_casptr(volatile void *target, volatile void *cmp, volatile void *new) +*/ +ENTRY(dtrace_casptr) +1: lr.d a3, 0(a0) /* Load target */ + bne a3, a1, 2f /* *target != cmp ? return */ + sc.d a4, a2, 0(a0) /* Store new to target */ + bnez a4, 1b /* Try again if store not succeed */ +2: mv a0, a3 /* Return the value loaded from target */ + RET +END(dtrace_casptr) Added: head/sys/cddl/dev/dtrace/riscv/dtrace_isa.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/dev/dtrace/riscv/dtrace_isa.c Tue May 24 16:41:37 2016 (r300618) @@ -0,0 +1,394 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * + * Portions Copyright 2016 Ruslan Bukin <br@bsdpad.com> + * + * $FreeBSD$ + */ +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ +#include <sys/cdefs.h> + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/stack.h> +#include <sys/pcpu.h> + +#include <machine/frame.h> +#include <machine/md_var.h> +#include <machine/reg.h> + +#include <vm/vm.h> +#include <vm/vm_param.h> +#include <vm/pmap.h> + +#include <machine/atomic.h> +#include <machine/db_machdep.h> +#include <machine/md_var.h> +#include <machine/stack.h> +#include <ddb/db_sym.h> +#include <ddb/ddb.h> +#include <sys/kdb.h> + +#include "regset.h" + +/* + * Wee need some reasonable default to prevent backtrace code + * from wandering too far + */ +#define MAX_FUNCTION_SIZE 0x10000 +#define MAX_PROLOGUE_SIZE 0x100 +#define MAX_USTACK_DEPTH 2048 + +uint8_t dtrace_fuword8_nocheck(void *); +uint16_t dtrace_fuword16_nocheck(void *); +uint32_t dtrace_fuword32_nocheck(void *); +uint64_t dtrace_fuword64_nocheck(void *); + +void +dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes, + uint32_t *intrpc) +{ + struct unwind_state state; + int scp_offset; + register_t sp; + int depth; + + depth = 0; + + if (intrpc != 0) { + pcstack[depth++] = (pc_t) intrpc; + } + + aframes++; + + __asm __volatile("mv %0, sp" : "=&r" (sp)); + + state.fp = (uint64_t)__builtin_frame_address(0); + state.sp = sp; + state.pc = (uint64_t)dtrace_getpcstack; + + while (depth < pcstack_limit) { + if (unwind_frame(&state)) + break; + + if (!INKERNEL(state.pc) || !INKERNEL(state.fp)) + break; + + /* + * NB: Unlike some other architectures, we don't need to + * explicitly insert cpu_dtrace_caller as it appears in the + * normal kernel stack trace rather than a special trap frame. + */ + if (aframes > 0) { + aframes--; + } else { + pcstack[depth++] = state.pc; + } + + } + + for (; depth < pcstack_limit; depth++) { + pcstack[depth] = 0; + } +} + +static int +dtrace_getustack_common(uint64_t *pcstack, int pcstack_limit, uintptr_t pc, + uintptr_t fp) +{ + volatile uint16_t *flags; + uintptr_t oldfp; + int ret; + + ret = 0; + flags = (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; + + ASSERT(pcstack == NULL || pcstack_limit > 0); + + while (pc != 0) { + /* + * We limit the number of times we can go around this + * loop to account for a circular stack. + */ + if (ret++ >= MAX_USTACK_DEPTH) { + *flags |= CPU_DTRACE_BADSTACK; + cpu_core[curcpu].cpuc_dtrace_illval = fp; + break; + } + + if (pcstack != NULL) { + *pcstack++ = (uint64_t)pc; + pcstack_limit--; + if (pcstack_limit <= 0) + break; + } + + if (fp == 0) + break; + + pc = dtrace_fuword64((void *)(fp + + offsetof(struct riscv_frame, f_retaddr))); + fp = dtrace_fuword64((void *)fp); + + if (fp == oldfp) { + *flags |= CPU_DTRACE_BADSTACK; + cpu_core[curcpu].cpuc_dtrace_illval = fp; + break; + } + } + + return (ret); +} + +void +dtrace_getupcstack(uint64_t *pcstack, int pcstack_limit) +{ + volatile uint16_t *flags; + struct trapframe *tf; + uintptr_t pc, sp, fp; + proc_t *p; + int n; + + p = curproc; + flags = (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; + + if (*flags & CPU_DTRACE_FAULT) + return; + + if (pcstack_limit <= 0) + return; + + /* + * If there's no user context we still need to zero the stack. + */ + if (p == NULL || (tf = curthread->td_frame) == NULL) + goto zero; + + *pcstack++ = (uint64_t)p->p_pid; + pcstack_limit--; + + if (pcstack_limit <= 0) + return; + + pc = tf->tf_sepc; + sp = tf->tf_sp; + fp = tf->tf_s[0]; + + if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_ENTRY)) { + /* + * In an entry probe. The frame pointer has not yet been + * pushed (that happens in the function prologue). The + * best approach is to add the current pc as a missing top + * of stack and back the pc up to the caller, which is stored + * at the current stack pointer address since the call + * instruction puts it there right before the branch. + */ + + *pcstack++ = (uint64_t)pc; + pcstack_limit--; + if (pcstack_limit <= 0) + return; + + pc = tf->tf_ra; + } + + n = dtrace_getustack_common(pcstack, pcstack_limit, pc, fp); + ASSERT(n >= 0); + ASSERT(n <= pcstack_limit); + + pcstack += n; + pcstack_limit -= n; + +zero: + while (pcstack_limit-- > 0) + *pcstack++ = 0; +} + +int +dtrace_getustackdepth(void) +{ + + printf("IMPLEMENT ME: %s\n", __func__); + + return (0); +} + +void +dtrace_getufpstack(uint64_t *pcstack, uint64_t *fpstack, int pcstack_limit) +{ + + printf("IMPLEMENT ME: %s\n", __func__); +} + +/*ARGSUSED*/ +uint64_t +dtrace_getarg(int arg, int aframes) +{ + + printf("IMPLEMENT ME: %s\n", __func__); + + return (0); +} + +int +dtrace_getstackdepth(int aframes) +{ + struct unwind_state state; + int scp_offset; + register_t sp; + int depth; + int done; + + depth = 1; + done = 0; + + __asm __volatile("mv %0, sp" : "=&r" (sp)); + + state.fp = (uint64_t)__builtin_frame_address(0); + state.sp = sp; + state.pc = (uint64_t)dtrace_getstackdepth; + + do { + done = unwind_frame(&state); + if (!INKERNEL(state.pc) || !INKERNEL(state.fp)) + break; + depth++; + } while (!done); + + if (depth < aframes) + return (0); + else + return (depth - aframes); +} + +ulong_t +dtrace_getreg(struct trapframe *rp, uint_t reg) +{ + + printf("IMPLEMENT ME: %s\n", __func__); + + return (0); +} + +static int +dtrace_copycheck(uintptr_t uaddr, uintptr_t kaddr, size_t size) +{ + + if (uaddr + size > VM_MAXUSER_ADDRESS || uaddr + size < uaddr) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = uaddr; + return (0); + } + + return (1); +} + +void +dtrace_copyin(uintptr_t uaddr, uintptr_t kaddr, size_t size, + volatile uint16_t *flags) +{ + + if (dtrace_copycheck(uaddr, kaddr, size)) + dtrace_copy(uaddr, kaddr, size); +} + +void +dtrace_copyout(uintptr_t kaddr, uintptr_t uaddr, size_t size, + volatile uint16_t *flags) +{ + + if (dtrace_copycheck(uaddr, kaddr, size)) + dtrace_copy(kaddr, uaddr, size); +} + +void +dtrace_copyinstr(uintptr_t uaddr, uintptr_t kaddr, size_t size, + volatile uint16_t *flags) +{ + + if (dtrace_copycheck(uaddr, kaddr, size)) + dtrace_copystr(uaddr, kaddr, size, flags); +} + +void +dtrace_copyoutstr(uintptr_t kaddr, uintptr_t uaddr, size_t size, + volatile uint16_t *flags) +{ + + if (dtrace_copycheck(uaddr, kaddr, size)) + dtrace_copystr(kaddr, uaddr, size, flags); +} + +uint8_t +dtrace_fuword8(void *uaddr) +{ + + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; + return (0); + } + + return (dtrace_fuword8_nocheck(uaddr)); +} + +uint16_t +dtrace_fuword16(void *uaddr) +{ + + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; + return (0); + } + + return (dtrace_fuword16_nocheck(uaddr)); +} + +uint32_t +dtrace_fuword32(void *uaddr) +{ + + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; + return (0); + } + + return (dtrace_fuword32_nocheck(uaddr)); +} + +uint64_t +dtrace_fuword64(void *uaddr) +{ + + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; + return (0); + } + + return (dtrace_fuword64_nocheck(uaddr)); +} Added: head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c Tue May 24 16:41:37 2016 (r300618) @@ -0,0 +1,282 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * + * Portions Copyright 2016 Ruslan Bukin <br@bsdpad.com> + * + * $FreeBSD$ + * + */ +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/types.h> +#include <sys/kernel.h> +#include <sys/malloc.h> +#include <sys/kmem.h> +#include <sys/smp.h> +#include <sys/dtrace_impl.h> +#include <sys/dtrace_bsd.h> +#include <machine/vmparam.h> +#include <machine/riscvreg.h> +#include <machine/riscv_opcode.h> +#include <machine/clock.h> +#include <machine/frame.h> +#include <machine/trap.h> +#include <vm/pmap.h> + +extern dtrace_id_t dtrace_probeid_error; +extern int (*dtrace_invop_jump_addr)(struct trapframe *); +extern void dtrace_getnanotime(struct timespec *tsp); + +int dtrace_invop(uintptr_t, struct trapframe *, uintptr_t); +void dtrace_invop_init(void); +void dtrace_invop_uninit(void); + +typedef struct dtrace_invop_hdlr { + int (*dtih_func)(uintptr_t, struct trapframe *, uintptr_t); + struct dtrace_invop_hdlr *dtih_next; +} dtrace_invop_hdlr_t; + +dtrace_invop_hdlr_t *dtrace_invop_hdlr; + +int +dtrace_invop(uintptr_t addr, struct trapframe *frame, uintptr_t eax) +{ + dtrace_invop_hdlr_t *hdlr; + int rval; + + for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next) + if ((rval = hdlr->dtih_func(addr, frame, eax)) != 0) + return (rval); + + return (0); +} + + +void +dtrace_invop_add(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue May 24 17:22:14 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0DD5B47147; Tue, 24 May 2016 17:22:14 +0000 (UTC) (envelope-from cschuber@gmail.com) Received: from mail-pf0-x22e.google.com (mail-pf0-x22e.google.com [IPv6:2607:f8b0:400e:c00::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 82EC317ED; Tue, 24 May 2016 17:22:14 +0000 (UTC) (envelope-from cschuber@gmail.com) Received: by mail-pf0-x22e.google.com with SMTP id y69so8908647pfb.1; Tue, 24 May 2016 10:22:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:mime-version:from:subject:date:to:cc; bh=9t9JVIb3H92KtZbvTA4vMIMgAVMNd61J7TBpwahKkBg=; b=bN0d6bwyaK7YgdMT5yShoCJoReQWaeKx62airT+fSBzFEKe7xo6JQbDQCnTstk/T36 zsLmuuZiEfnCbBFdoPjcD8AMlFA1VTuIPiR1/oDLNptRi+LvAzNmy0Q4RoSaDAwvxAyd uss3g1d9SUKa89hjIK5ZPB77UaaO1dJmO1nR8tPazgHK9QAQEf99vB7mR2vpRzX1If/f WXKGqCzIGzHfXR13pd+LWM/D09OgBYWMACfFJ4+yKNETvNlHv6oHMB6kEEG0L9yMWOU/ Bq1XN/yQx6UNXIrYICYHgXYngcFRkMb3lBiw+wggWWcN7n2mToT7DJb/A5dyaPiZk+Gj y/eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:mime-version:from:subject:date:to:cc; bh=9t9JVIb3H92KtZbvTA4vMIMgAVMNd61J7TBpwahKkBg=; b=S4Aqi8FI0FDm3u1CsVtwt6qchdJOnT2b38D4v9p73/2f0Z7JjHg3AJlF/UUDAN60Yj wi3cQn/bS+LK/47sjxnRoBCYVTUddr/tb9qp8BylcnGhcg0ELDB2kGfxQxAPyDeF6EDR b7XVgw/hZqS7cAh+xPyu2x0ztZD6HK+O4vjPo1JejZGfBQLrD1W6nPJHMPChdDgjrUbw J328LAN1UueplGh5d4K8Rwi+rHWaFRrp837hXXjt3wEbHgsQ+l7tfFVz1n7wjn8iEx0R GUH2vuRBZapH141V9HxfSNP0UvLS4M5u4vwDkrg+3uX+GGLpEL8vtI8JcaTs3qhx9qUy aKAQ== X-Gm-Message-State: ALyK8tJ7ljK7Hf7PRhFoWBFegxEZa7T8odbX6/sVdoGiffQPqJQwzFTLgqScGnICTNTj2Q== X-Received: by 10.98.69.202 with SMTP id n71mr2775649pfi.82.1464110534004; Tue, 24 May 2016 10:22:14 -0700 (PDT) Received: from [25.88.35.112] (S0106d4ca6d8943b0.gv.shawcable.net. [24.68.134.59]) by smtp.gmail.com with ESMTPSA id w27sm55749017pfi.24.2016.05.24.10.22.12 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 May 2016 10:22:12 -0700 (PDT) Message-ID: <57448dc4.1b0e620a.71bca.fffff8e1@mx.google.com> MIME-Version: 1.0 From: Cy Schubert <cschuber@gmail.com> Subject: RE: svn commit: r300617 - head/sys/conf Date: Tue, 24 May 2016 10:22:16 -0700 To: Ruslan Bukin <br@FreeBSD.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> CC: Cy Schubert <Cy.Schubert@cschubert.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 17:22:14 -0000 >From the commit log it would appear that parallel builds worked whereas seq= uential (non-parallel) builds did not. That's kind of strange. Sent from my cellphone, ~Cy -----Original Message----- From: Ruslan Bukin Sent: 24/05/2016 09:30 To: src-committers@freebsd.org; svn-src-all@freebsd.org; svn-src-head@freeb= sd.org Subject: svn commit: r300617 - head/sys/conf Author: br Date: Tue May 24 16:30:05 2016 New Revision: 300617 URL: https://svnweb.freebsd.org/changeset/base/300617 Log: Set dependencies for genassym.c. This fixes non-parallel build. Modified: head/sys/conf/Makefile.riscv Modified: head/sys/conf/Makefile.riscv =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- head/sys/conf/Makefile.riscv Tue May 24 15:39:57 2016 (r300616) +++ head/sys/conf/Makefile.riscv Tue May 24 16:30:05 2016 (r300617) @@ -32,6 +32,9 @@ INCLUDES+=3D -I$S/contrib/libfdt CFLAGS +=3D -fno-omit-frame-pointer -fno-optimize-sibling-calls .endif =20 +# hack because genassym.c includes sys/bus.h which includes these. +genassym.o: bus_if.h device_if.h + %BEFORE_DEPEND =20 %OBJS From owner-svn-src-head@freebsd.org Tue May 24 17:38:29 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17287B476B1; Tue, 24 May 2016 17:38:29 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC9BA10C6; Tue, 24 May 2016 17:38:28 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OHcSr8069441; Tue, 24 May 2016 17:38:28 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OHcScx069440; Tue, 24 May 2016 17:38:28 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201605241738.u4OHcScx069440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" <bz@FreeBSD.org> Date: Tue, 24 May 2016 17:38:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300619 - head/sys/cddl/dev/dtrace/aarch64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 17:38:29 -0000 Author: bz Date: Tue May 24 17:38:27 2016 New Revision: 300619 URL: https://svnweb.freebsd.org/changeset/base/300619 Log: Try to unbreak the build after r300611 by including the header defining VM_MIN_KERNEL_ADDRESS. Sponsored by: DARPA/AFRL Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Tue May 24 16:41:37 2016 (r300618) +++ head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Tue May 24 17:38:27 2016 (r300619) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include <machine/clock.h> #include <machine/frame.h> #include <machine/trap.h> +#include <machine/vmparam.h> #include <vm/pmap.h> extern dtrace_id_t dtrace_probeid_error; From owner-svn-src-head@freebsd.org Tue May 24 18:44:51 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73A45B4969D; Tue, 24 May 2016 18:44:51 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44FC513C4; Tue, 24 May 2016 18:44:51 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OIio8d090458; Tue, 24 May 2016 18:44:50 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OIioBp090457; Tue, 24 May 2016 18:44:50 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605241844.u4OIioBp090457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper <ngie@FreeBSD.org> Date: Tue, 24 May 2016 18:44:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300620 - head/lib/libc/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 18:44:51 -0000 Author: ngie Date: Tue May 24 18:44:50 2016 New Revision: 300620 URL: https://svnweb.freebsd.org/changeset/base/300620 Log: Use reallocf instead of malloc to fix leak with outbuf_pmap The previous code overwrote outbuf_pmap's memory with malloc once per loop iteration, which leaked its memory; use reallocf instead to ensure that memory is properly free'd each loop iteration. Add a outbuf_pmap = NULL in the failure case to avoid a double-free at the bottom of the function. Differential Revision: https://reviews.freebsd.org/D6495 MFC after: 1 week Reported by: Coverity CID: 1038776 Reviewed by: markj, pfgj Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libc/rpc/clnt_bcast.c Modified: head/lib/libc/rpc/clnt_bcast.c ============================================================================== --- head/lib/libc/rpc/clnt_bcast.c Tue May 24 17:38:27 2016 (r300619) +++ head/lib/libc/rpc/clnt_bcast.c Tue May 24 18:44:50 2016 (r300620) @@ -346,7 +346,9 @@ rpc_broadcast_exp(rpcprog_t prog, rpcver #ifdef PORTMAP if (si.si_af == AF_INET && si.si_proto == IPPROTO_UDP) { udpbufsz = fdlist[fdlistno].dsize; - if ((outbuf_pmap = malloc(udpbufsz)) == NULL) { + outbuf_pmap = reallocf(outbuf_pmap, udpbufsz); + if (outbuf_pmap == NULL) { + outbuf_pmap = NULL; _close(fd); stat = RPC_SYSTEMERROR; goto done_broad; From owner-svn-src-head@freebsd.org Tue May 24 18:49:45 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E3ADB497AD; Tue, 24 May 2016 18:49:45 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ig0-f179.google.com (mail-ig0-f179.google.com [209.85.213.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3436717CE; Tue, 24 May 2016 18:49:44 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ig0-f179.google.com with SMTP id bi2so57965970igb.0; Tue, 24 May 2016 11:49:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :date:message-id:subject:from:to:cc; bh=XyybUbjp4dexNyh6is6Ftv5tPWL03EjGdDel4+jumV0=; b=fsfqYL0IYycHxV/iA8BYhy3ZwkeR1Iy4nHmkGAo0R++AhALMlXeKzC5FpRC5F1HhV4 WETOA7+PduIidFvElbzOZHC/H+u6f+OEws3TPX2lcRm4UMe/3l+Rdbm8ZI98Ubt47Rvb /wT02AAmQAlwKwHx/o3vy65N6vIT3GV1sNPDUOWERUc4zSSRoNlGbvSTXR54VBJPoWfL 1AnXRBHML552h/5OripwhdJt3EvQ6ye1ELPHNNXdXNOp5IddUeXRjdBCE5sdnEeQVgp4 gI5vUMkxjCBt71kd/AgymauzafzjZp60SU2aO3nYeGnghjgAv62yrRI+unaE+S5ISxTD 2ejA== X-Gm-Message-State: ALyK8tLemVHCPBAUAMpdv6hoEJE+NgQPJ04eoarSEBWpbNP53PybRoN2hU5D2+vp0Cr6mA== X-Received: by 10.50.108.109 with SMTP id hj13mr270106igb.96.1464115778627; Tue, 24 May 2016 11:49:38 -0700 (PDT) Received: from mail-ig0-f178.google.com (mail-ig0-f178.google.com. [209.85.213.178]) by smtp.gmail.com with ESMTPSA id u67sm1538142itd.1.2016.05.24.11.49.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 May 2016 11:49:38 -0700 (PDT) Received: by mail-ig0-f178.google.com with SMTP id l10so16056764igk.0; Tue, 24 May 2016 11:49:37 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.50.29.72 with SMTP id i8mr3489704igh.48.1464115777783; Tue, 24 May 2016 11:49:37 -0700 (PDT) Reply-To: cem@FreeBSD.org Received: by 10.36.205.70 with HTTP; Tue, 24 May 2016 11:49:37 -0700 (PDT) In-Reply-To: <201605241844.u4OIioBp090457@repo.freebsd.org> References: <201605241844.u4OIioBp090457@repo.freebsd.org> Date: Tue, 24 May 2016 11:49:37 -0700 X-Gmail-Original-Message-ID: <CAG6CVpUYMpc_Bj4cnNVqi9Yoaq0PTowjmM6brpeV8ZjrsHbe2w@mail.gmail.com> Message-ID: <CAG6CVpUYMpc_Bj4cnNVqi9Yoaq0PTowjmM6brpeV8ZjrsHbe2w@mail.gmail.com> Subject: Re: svn commit: r300620 - head/lib/libc/rpc From: Conrad Meyer <cem@FreeBSD.org> To: Garrett Cooper <ngie@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 18:49:45 -0000 On Tue, May 24, 2016 at 11:44 AM, Garrett Cooper <ngie@freebsd.org> wrote: > Author: ngie > Date: Tue May 24 18:44:50 2016 > New Revision: 300620 > URL: https://svnweb.freebsd.org/changeset/base/300620 > > Log: > Use reallocf instead of malloc to fix leak with outbuf_pmap > > ... > > Add a outbuf_pmap = NULL in the failure case to avoid a double-free > at the bottom of the function. > > ... > Modified: head/lib/libc/rpc/clnt_bcast.c > ============================================================================== > --- head/lib/libc/rpc/clnt_bcast.c Tue May 24 17:38:27 2016 (r300619) > +++ head/lib/libc/rpc/clnt_bcast.c Tue May 24 18:44:50 2016 (r300620) > @@ -346,7 +346,9 @@ rpc_broadcast_exp(rpcprog_t prog, rpcver > #ifdef PORTMAP > if (si.si_af == AF_INET && si.si_proto == IPPROTO_UDP) { > udpbufsz = fdlist[fdlistno].dsize; > - if ((outbuf_pmap = malloc(udpbufsz)) == NULL) { > + outbuf_pmap = reallocf(outbuf_pmap, udpbufsz); > + if (outbuf_pmap == NULL) { > + outbuf_pmap = NULL; Huh? This seems a little redundant. > _close(fd); > stat = RPC_SYSTEMERROR; > goto done_broad; > Best, Conrad From owner-svn-src-head@freebsd.org Tue May 24 18:53:07 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2F61B49909; Tue, 24 May 2016 18:53:07 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8550A1C10; Tue, 24 May 2016 18:53:07 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OIr67G093393; Tue, 24 May 2016 18:53:06 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OIr6B0093392; Tue, 24 May 2016 18:53:06 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605241853.u4OIr6B0093392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper <ngie@FreeBSD.org> Date: Tue, 24 May 2016 18:53:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300621 - head/lib/libc/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 18:53:07 -0000 Author: ngie Date: Tue May 24 18:53:06 2016 New Revision: 300621 URL: https://svnweb.freebsd.org/changeset/base/300621 Log: Remove redundant NULLing of outbuf_pmap If reallocf ever failed, outbuf_pmap would already be NULL MFC after: 1 week X-MFC with: r300620 Reported by: cem Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libc/rpc/clnt_bcast.c Modified: head/lib/libc/rpc/clnt_bcast.c ============================================================================== --- head/lib/libc/rpc/clnt_bcast.c Tue May 24 18:44:50 2016 (r300620) +++ head/lib/libc/rpc/clnt_bcast.c Tue May 24 18:53:06 2016 (r300621) @@ -348,7 +348,6 @@ rpc_broadcast_exp(rpcprog_t prog, rpcver udpbufsz = fdlist[fdlistno].dsize; outbuf_pmap = reallocf(outbuf_pmap, udpbufsz); if (outbuf_pmap == NULL) { - outbuf_pmap = NULL; _close(fd); stat = RPC_SYSTEMERROR; goto done_broad; From owner-svn-src-head@freebsd.org Tue May 24 18:54:02 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66FA7B4995F; Tue, 24 May 2016 18:54:02 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-io0-x229.google.com (mail-io0-x229.google.com [IPv6:2607:f8b0:4001:c06::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D4371D81; Tue, 24 May 2016 18:54:02 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-io0-x229.google.com with SMTP id 190so18075735iow.1; Tue, 24 May 2016 11:54:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=wFAVoJvEhBvLDk2m+SJaijq+0g06pBwDw1Czq9NzaiY=; b=OnkNcPa37vJeeQj7ScrffH0GysUmFxk9FJv9IWno3a9vqfWDhqMgSpwuds0siL3Xe7 vE5YA9tVwT1kt/YslbzRxCVJ1viSI6qKQNM0tpUWdmXef84Gr1xYFhhLn7ZMXDzFPMh3 gSoD7Wn3h0sWLN6cOcCYQMdV2FPlwZKwqA0uwajYNKH+SMmqlDRxf619hw3QLcAP5D0t k9KrAHejDXDCQx44eM8Tac8+1juUx4B7cC/BBbDMCnQBpQ/K/MEGOkrlZxUgHeff71Wh VfskYl4iSFYD8V9ctSwW0HQntxNY+X5qpL37Gvw2/yZ8zQx5KgOQmhGvBQDpxC8dubWj NBIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=wFAVoJvEhBvLDk2m+SJaijq+0g06pBwDw1Czq9NzaiY=; b=BfdBB2ttE5tFgDL9PdxwzqNAeJV2aesqEYIDPyqe16VsyTUze0mo1v26xn93/Kd43w lOcL5i3l/xn+9in+GRbbo4235BSJBxBEqkdeR0y5pcz1r/IMfgkdAqRvJ0eIhSAchobi PCqz+EBuuykuCRFNR5Rf+dIjR1I6W5kZbnNKYAZQu8gweR0W4IESVHuTCVTajwCNRpCJ 8QAcmCpQQxNx+0KF6zICYZmytK/X2moBEKVIfgVudBDFcJG/BHXR3kSQc+pbRBOJJJOv s1jd8mVm1uwr+vKvhnyATzclLT8hMpI/4jDDiIVqEqNfloIbdLylTGul6sw/745kQBun QSjg== X-Gm-Message-State: ALyK8tIpEg6So4iP3VCzwWgHFJVlgiQnkosx9bTDlohtM8OWj4MYJVx2psvYo2hJ4nTobA== X-Received: by 10.107.9.86 with SMTP id j83mr338775ioi.50.1464116041564; Tue, 24 May 2016 11:54:01 -0700 (PDT) Received: from [192.168.20.7] (c-73-97-222-46.hsd1.wa.comcast.net. [73.97.222.46]) by smtp.gmail.com with ESMTPSA id 65sm1503440iog.42.2016.05.24.11.54.00 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 May 2016 11:54:00 -0700 (PDT) Subject: Re: svn commit: r300620 - head/lib/libc/rpc Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_2747BE4B-C121-4E2A-99F6-5B45FA9A28DA"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.6b2 From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com> In-Reply-To: <CAG6CVpUYMpc_Bj4cnNVqi9Yoaq0PTowjmM6brpeV8ZjrsHbe2w@mail.gmail.com> Date: Tue, 24 May 2016 11:53:58 -0700 Cc: Garrett Cooper <ngie@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <04B24CA6-4C03-4DA9-A18F-8E82BADD0BB3@gmail.com> References: <201605241844.u4OIioBp090457@repo.freebsd.org> <CAG6CVpUYMpc_Bj4cnNVqi9Yoaq0PTowjmM6brpeV8ZjrsHbe2w@mail.gmail.com> To: "Conrad E. Meyer" <cem@FreeBSD.org> X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 18:54:02 -0000 --Apple-Mail=_2747BE4B-C121-4E2A-99F6-5B45FA9A28DA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On May 24, 2016, at 11:49, Conrad Meyer <cem@FreeBSD.org> wrote: >=20 > On Tue, May 24, 2016 at 11:44 AM, Garrett Cooper <ngie@freebsd.org> = wrote: >> Author: ngie >> Date: Tue May 24 18:44:50 2016 >> New Revision: 300620 >> URL: https://svnweb.freebsd.org/changeset/base/300620 >>=20 >> Log: >> Use reallocf instead of malloc to fix leak with outbuf_pmap >>=20 >> ... >>=20 >> Add a outbuf_pmap =3D NULL in the failure case to avoid a = double-free >> at the bottom of the function. >>=20 >> ... >> Modified: head/lib/libc/rpc/clnt_bcast.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/lib/libc/rpc/clnt_bcast.c Tue May 24 17:38:27 2016 = (r300619) >> +++ head/lib/libc/rpc/clnt_bcast.c Tue May 24 18:44:50 2016 = (r300620) >> @@ -346,7 +346,9 @@ rpc_broadcast_exp(rpcprog_t prog, rpcver >> #ifdef PORTMAP >> if (si.si_af =3D=3D AF_INET && si.si_proto =3D=3D = IPPROTO_UDP) { >> udpbufsz =3D fdlist[fdlistno].dsize; >> - if ((outbuf_pmap =3D malloc(udpbufsz)) =3D=3D = NULL) { >> + outbuf_pmap =3D reallocf(outbuf_pmap, = udpbufsz); >> + if (outbuf_pmap =3D=3D NULL) { >> + outbuf_pmap =3D NULL; >=20 > Huh? This seems a little redundant. Yes, it was *sigh* (r300621).. --Apple-Mail=_2747BE4B-C121-4E2A-99F6-5B45FA9A28DA Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJXRKNGAAoJEPWDqSZpMIYVYvsP/1jQcrWAkjCIYrh89WwlYTAf 2Ag5Gmj2qAzZFtJ4wwxqBSXA9VgcPgjECZ//lK/LVzIpRU+euwaHwhlNWaf0B8IF GF7+dhobXoiIejx5MXvs2/ogVRa4Tauiz+DF4ISiT141kR7Fkm+AxPogpTQta4Lu BIOAYpM0/Rh9asyayL2EVX/Y5x+8M1TMjMS6/yawCBDKRXWm6QqjD1bGGw3ePFgd r7syi3o2Z6pmIZNxtVHz6hqi13x0NJG/u2JwFbmrWn/qmJpuwe6Uqsa1GuZvtU7e wKUO5kJLdIBVnVJv3A4y0LzQBoCGKoMc4b/vjcR8ALi2u1u7kWcpKbYU9H30FpDN McavFeTYtAP1WLseGvA3NzLpqbKq2H8gYC2hEdcWZlovKNt5eTNYfyUOYivqssYU hGL7dveG+Xh6Fhc9V2vrE9h4DaDtcIeplXNDoPb8/ybsH03M70GcDbXOCwb8t8bn zCokitju9VwfoH2dbu1IqtBeJuh2ZuRopSF4wS6LHTFXqsYYcfYhg5x/xCIjM9Vm oVubxazu9m1noDdBNOmrvNS731lS8izt9SY/Q2k2mWWVlZGS6IO9mCGv0aNXOlPL sSpLI00Gn+REgDVIjzoIROmc7QfAu/Zy8Eao0+F1c1YU2fScv7YqfQVXjhnl3oua 28oQklJ1s0uSLqIj5SqS =GwEY -----END PGP SIGNATURE----- --Apple-Mail=_2747BE4B-C121-4E2A-99F6-5B45FA9A28DA-- From owner-svn-src-head@freebsd.org Tue May 24 19:20:31 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 860E1B49EF2; Tue, 24 May 2016 19:20:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57C7F1A38; Tue, 24 May 2016 19:20:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OJKUsi099673; Tue, 24 May 2016 19:20:30 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OJKUfV099672; Tue, 24 May 2016 19:20:30 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605241920.u4OJKUfV099672@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov <kib@FreeBSD.org> Date: Tue, 24 May 2016 19:20:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300622 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 19:20:31 -0000 Author: kib Date: Tue May 24 19:20:30 2016 New Revision: 300622 URL: https://svnweb.freebsd.org/changeset/base/300622 Log: In vm_page_cache(), only drop the vnode after radix insert failure for empty page cache when the object type if OBJT_VNODE. Reported and tested by: pho Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue May 24 18:53:06 2016 (r300621) +++ head/sys/vm/vm_page.c Tue May 24 19:20:30 2016 (r300622) @@ -3290,7 +3290,8 @@ vm_page_cache(vm_page_t m) cache_was_empty = vm_radix_is_empty(&object->cache); if (vm_radix_insert(&object->cache, m)) { mtx_unlock(&vm_page_queue_free_mtx); - if (object->resident_page_count == 0) + if (object->type == OBJT_VNODE && + object->resident_page_count == 0) vdrop(object->handle); m->object = NULL; vm_page_free(m); From owner-svn-src-head@freebsd.org Tue May 24 19:52:06 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56E73B48A7D; Tue, 24 May 2016 19:52:06 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2481A10A2; Tue, 24 May 2016 19:52:06 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OJq5Tl012005; Tue, 24 May 2016 19:52:05 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OJq5Us012004; Tue, 24 May 2016 19:52:05 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605241952.u4OJq5Us012004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper <ngie@FreeBSD.org> Date: Tue, 24 May 2016 19:52:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300624 - head/lib/libc/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 19:52:06 -0000 Author: ngie Date: Tue May 24 19:52:05 2016 New Revision: 300624 URL: https://svnweb.freebsd.org/changeset/base/300624 Log: Fix up r300385 I accidentally glossed over the fact that tmp is manipulated via strchr, so if we tried to free `tmp` after r300385, it would have crashed. Create a separate pointer (tmp2) to track the original allocation of `tmp`, and free `tmp2` if `p->nc_lookups` can't be malloced MFC after: 4 days X-MFC with: r300385 Reported by: Coverity CID: 1356026 Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libc/rpc/getnetconfig.c Modified: head/lib/libc/rpc/getnetconfig.c ============================================================================== --- head/lib/libc/rpc/getnetconfig.c Tue May 24 19:26:58 2016 (r300623) +++ head/lib/libc/rpc/getnetconfig.c Tue May 24 19:52:05 2016 (r300624) @@ -692,7 +692,7 @@ static struct netconfig * dup_ncp(struct netconfig *ncp) { struct netconfig *p; - char *tmp; + char *tmp, *tmp2; u_int i; if ((tmp=malloc(MAXNETCONFIGLINE)) == NULL) @@ -701,6 +701,7 @@ dup_ncp(struct netconfig *ncp) free(tmp); return(NULL); } + tmp2 = tmp; /* * First we dup all the data from matched netconfig buffer. Then we * adjust some of the member pointer to a pre-allocated buffer where @@ -722,7 +723,7 @@ dup_ncp(struct netconfig *ncp) if (p->nc_lookups == NULL) { free(p->nc_netid); free(p); - free(tmp); + free(tmp2); return(NULL); } for (i=0; i < p->nc_nlookups; i++) { From owner-svn-src-head@freebsd.org Tue May 24 20:06:42 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C18D6B49018; Tue, 24 May 2016 20:06:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92FF91AD8; Tue, 24 May 2016 20:06:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OK6fjm015140; Tue, 24 May 2016 20:06:41 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OK6fjl015139; Tue, 24 May 2016 20:06:41 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605242006.u4OK6fjl015139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper <ngie@FreeBSD.org> Date: Tue, 24 May 2016 20:06:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300625 - head/sys/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 20:06:42 -0000 Author: ngie Date: Tue May 24 20:06:41 2016 New Revision: 300625 URL: https://svnweb.freebsd.org/changeset/base/300625 Log: Remove unnecessary memset(.., 0, ..)'s The mem_alloc macro calls calloc (userspace) / malloc(.., M_WAITOK|M_ZERO) under the covers, so zeroing out memory is already handled by the underlying calls MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/sys/rpc/svc.c Modified: head/sys/rpc/svc.c ============================================================================== --- head/sys/rpc/svc.c Tue May 24 19:52:05 2016 (r300624) +++ head/sys/rpc/svc.c Tue May 24 20:06:41 2016 (r300625) @@ -847,9 +847,7 @@ svc_xprt_alloc() SVCXPRT_EXT *ext; xprt = mem_alloc(sizeof(SVCXPRT)); - memset(xprt, 0, sizeof(SVCXPRT)); ext = mem_alloc(sizeof(SVCXPRT_EXT)); - memset(ext, 0, sizeof(SVCXPRT_EXT)); xprt->xp_p3 = ext; refcount_init(&xprt->xp_refs, 1); From owner-svn-src-head@freebsd.org Tue May 24 21:09:06 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 863EEB49E99; Tue, 24 May 2016 21:09:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6192710A8; Tue, 24 May 2016 21:09:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OL95T6033353; Tue, 24 May 2016 21:09:05 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OL95Fr033351; Tue, 24 May 2016 21:09:05 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201605242109.u4OL95Fr033351@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin <jhb@FreeBSD.org> Date: Tue, 24 May 2016 21:09:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300626 - in head: sys/kern tests/sys/aio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 21:09:06 -0000 Author: jhb Date: Tue May 24 21:09:05 2016 New Revision: 300626 URL: https://svnweb.freebsd.org/changeset/base/300626 Log: Return the correct status when a partially completed request is cancelled. After the previous changes to fix requests on blocking sockets to complete across multiple operations, an edge case exists where a request can be cancelled after it has partially completed. POSIX doesn't appear to dictate exactly how to handle this case, but in general I feel that aio_cancel() should arrange to cancel any request it can, but that any partially completed requests should return a partial completion rather than ECANCELED. To that end, fix the socket AIO cancellation routine to return a short read/write if a partially completed request is cancelled rather than ECANCELED. Sponsored by: Chelsio Communications Modified: head/sys/kern/sys_socket.c head/tests/sys/aio/aio_test.c Modified: head/sys/kern/sys_socket.c ============================================================================== --- head/sys/kern/sys_socket.c Tue May 24 20:06:41 2016 (r300625) +++ head/sys/kern/sys_socket.c Tue May 24 21:09:05 2016 (r300626) @@ -721,6 +721,7 @@ soo_aio_cancel(struct kaiocb *job) { struct socket *so; struct sockbuf *sb; + long done; int opcode; so = job->fd_file->f_data; @@ -739,7 +740,11 @@ soo_aio_cancel(struct kaiocb *job) sb->sb_flags &= ~SB_AIO; SOCKBUF_UNLOCK(sb); - aio_cancel(job); + done = job->uaiocb._aiocb_private.status; + if (done != 0) + aio_complete(job, done, 0); + else + aio_cancel(job); } static int Modified: head/tests/sys/aio/aio_test.c ============================================================================== --- head/tests/sys/aio/aio_test.c Tue May 24 20:06:41 2016 (r300625) +++ head/tests/sys/aio/aio_test.c Tue May 24 21:09:05 2016 (r300626) @@ -845,6 +845,74 @@ ATF_TC_BODY(aio_socket_blocking_short_wr close(s[0]); } +/* + * This test verifies that cancelling a partially completed socket write + * returns a short write rather than ECANCELED. + */ +ATF_TC_WITHOUT_HEAD(aio_socket_short_write_cancel); +ATF_TC_BODY(aio_socket_short_write_cancel, tc) +{ + struct aiocb iocb, *iocbp; + char *buffer[2]; + ssize_t done; + int buffer_size, sb_size; + socklen_t len; + int s[2]; + + ATF_REQUIRE_KERNEL_MODULE("aio"); + + ATF_REQUIRE(socketpair(PF_UNIX, SOCK_STREAM, 0, s) != -1); + + len = sizeof(sb_size); + ATF_REQUIRE(getsockopt(s[0], SOL_SOCKET, SO_RCVBUF, &sb_size, &len) != + -1); + ATF_REQUIRE(len == sizeof(sb_size)); + buffer_size = sb_size; + + ATF_REQUIRE(getsockopt(s[1], SOL_SOCKET, SO_SNDBUF, &sb_size, &len) != + -1); + ATF_REQUIRE(len == sizeof(sb_size)); + if (sb_size > buffer_size) + buffer_size = sb_size; + + /* + * Use three times the size of the MAX(receive buffer, send + * buffer) for the write to ensure that the write is split up + * into multiple writes internally. The recv() ensures that + * the write has partially completed, but a remaining size of + * two buffers should ensure that the write has not completed + * fully when it is cancelled. + */ + buffer[0] = malloc(buffer_size); + ATF_REQUIRE(buffer[0] != NULL); + buffer[1] = malloc(buffer_size * 3); + ATF_REQUIRE(buffer[1] != NULL); + + srandomdev(); + aio_fill_buffer(buffer[1], buffer_size * 3, random()); + + memset(&iocb, 0, sizeof(iocb)); + iocb.aio_fildes = s[1]; + iocb.aio_buf = buffer[1]; + iocb.aio_nbytes = buffer_size * 3; + ATF_REQUIRE(aio_write(&iocb) == 0); + + done = recv(s[0], buffer[0], buffer_size, MSG_WAITALL); + ATF_REQUIRE(done == buffer_size); + + ATF_REQUIRE(aio_error(&iocb) == EINPROGRESS); + ATF_REQUIRE(aio_cancel(s[1], &iocb) == AIO_NOTCANCELED); + + done = aio_waitcomplete(&iocbp, NULL); + ATF_REQUIRE(iocbp == &iocb); + ATF_REQUIRE(done >= buffer_size && done <= buffer_size * 2); + + ATF_REQUIRE(memcmp(buffer[0], buffer[1], buffer_size) == 0); + + close(s[1]); + close(s[0]); +} + ATF_TP_ADD_TCS(tp) { @@ -857,6 +925,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, aio_large_read_test); ATF_TP_ADD_TC(tp, aio_socket_two_reads); ATF_TP_ADD_TC(tp, aio_socket_blocking_short_write); + ATF_TP_ADD_TC(tp, aio_socket_short_write_cancel); return (atf_no_error()); } From owner-svn-src-head@freebsd.org Tue May 24 21:13:34 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB745B49FFD; Tue, 24 May 2016 21:13:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C065164C; Tue, 24 May 2016 21:13:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OLDX3S036156; Tue, 24 May 2016 21:13:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OLDXao036155; Tue, 24 May 2016 21:13:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605242113.u4OLDXao036155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov <kib@FreeBSD.org> Date: Tue, 24 May 2016 21:13:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300627 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 21:13:34 -0000 Author: kib Date: Tue May 24 21:13:33 2016 New Revision: 300627 URL: https://svnweb.freebsd.org/changeset/base/300627 Log: Silence false LOR report due to the taskqueue mutex and kqueue lock named the same. Reported by: Doug Luce <doug@freebsd.con.com> Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_event.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Tue May 24 21:09:05 2016 (r300626) +++ head/sys/kern/kern_event.c Tue May 24 21:13:33 2016 (r300627) @@ -91,7 +91,7 @@ MTX_SYSINIT(kq_global, &kq_global, "kque haslck = 0; \ } while (0) -TASKQUEUE_DEFINE_THREAD(kqueue); +TASKQUEUE_DEFINE_THREAD(kqueue_ctx); static int kevent_copyout(void *arg, struct kevent *kevp, int count); static int kevent_copyin(void *arg, struct kevent *kevp, int count); @@ -1426,7 +1426,7 @@ kqueue_schedtask(struct kqueue *kq) ("scheduling kqueue task while draining")); if ((kq->kq_state & KQ_TASKSCHED) != KQ_TASKSCHED) { - taskqueue_enqueue(taskqueue_kqueue, &kq->kq_task); + taskqueue_enqueue(taskqueue_kqueue_ctx, &kq->kq_task); kq->kq_state |= KQ_TASKSCHED; } } From owner-svn-src-head@freebsd.org Tue May 24 21:20:19 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04C8EB490A9; Tue, 24 May 2016 21:20:19 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89E3F18A9; Tue, 24 May 2016 21:20:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OLKHu0036441; Tue, 24 May 2016 21:20:17 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OLKHuL036436; Tue, 24 May 2016 21:20:17 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605242120.u4OLKHuL036436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Tue, 24 May 2016 21:20:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300628 - in head/sys/dev/bhnd: . bhndb cores/chipc cores/pci cores/pcie2 siba X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 21:20:19 -0000 Author: adrian Date: Tue May 24 21:20:17 2016 New Revision: 300628 URL: https://svnweb.freebsd.org/changeset/base/300628 Log: [bhnd] Normalize bhnd(4) device matching API This unifies handling of core, chip, and board-level device matching, and adds support for matching device drivers against the bus attach type (e.g. SoC vs WiFi adapter). Core-level quirks on Broadcom's chipsets generally are specific to some combination of chip model, core revision, chip package (e.g. 12x9 SMT package), SROM revision, etc. Unifying the match APIs for all three attribute types (core, chip, board/srom) allows defining a single device quirk table that matches across all of those attributes. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6515 Added: head/sys/dev/bhnd/bhnd_match.h (contents, props changed) Modified: head/sys/dev/bhnd/bhnd.h head/sys/dev/bhnd/bhnd_subr.c head/sys/dev/bhnd/bhndb/bhndb.c head/sys/dev/bhnd/bhndb/bhndb_hwdata.c head/sys/dev/bhnd/bhndb/bhndb_pci_hwdata.c head/sys/dev/bhnd/bhndb/bhndb_subr.c head/sys/dev/bhnd/cores/chipc/chipc.c head/sys/dev/bhnd/cores/pci/bhnd_pci.c head/sys/dev/bhnd/cores/pci/bhnd_pci_hostb.c head/sys/dev/bhnd/cores/pcie2/bhnd_pcie2.c head/sys/dev/bhnd/cores/pcie2/bhnd_pcie2_hostb.c head/sys/dev/bhnd/siba/siba_bhndb.c Modified: head/sys/dev/bhnd/bhnd.h ============================================================================== --- head/sys/dev/bhnd/bhnd.h Tue May 24 21:13:33 2016 (r300627) +++ head/sys/dev/bhnd/bhnd.h Tue May 24 21:20:17 2016 (r300628) @@ -41,6 +41,7 @@ #include "bhnd_types.h" #include "bhnd_debug.h" #include "bhnd_bus_if.h" +#include "bhnd_match.h" extern devclass_t bhnd_devclass; extern devclass_t bhnd_hostb_devclass; @@ -169,17 +170,6 @@ struct bhnd_core_info { int unit; /**< bus-assigned core unit */ }; - -/** - * A hardware revision match descriptor. - */ -struct bhnd_hwrev_match { - uint16_t start; /**< first revision, or BHND_HWREV_INVALID - to match on any revision. */ - uint16_t end; /**< last revision, or BHND_HWREV_INVALID - to match on any revision. */ -}; - /** * A bhnd(4) bus resource. * @@ -193,223 +183,70 @@ struct bhnd_resource { * is MMIO accessible. */ }; -/** - * Wildcard hardware revision match descriptor. - */ -#define BHND_HWREV_ANY { BHND_HWREV_INVALID, BHND_HWREV_INVALID } -#define BHND_HWREV_IS_ANY(_m) \ - ((_m)->start == BHND_HWREV_INVALID && (_m)->end == BHND_HWREV_INVALID) - -/** - * Hardware revision match descriptor for an inclusive range. - * - * @param _start The first applicable hardware revision. - * @param _end The last applicable hardware revision, or BHND_HWREV_INVALID - * to match on any revision. - */ -#define BHND_HWREV_RANGE(_start, _end) { _start, _end } - -/** - * Hardware revision match descriptor for a single revision. - * - * @param _hwrev The hardware revision to match on. - */ -#define BHND_HWREV_EQ(_hwrev) BHND_HWREV_RANGE(_hwrev, _hwrev) - -/** - * Hardware revision match descriptor for any revision equal to or greater - * than @p _start. - * - * @param _start The first hardware revision to match on. - */ -#define BHND_HWREV_GTE(_start) BHND_HWREV_RANGE(_start, BHND_HWREV_INVALID) - -/** - * Hardware revision match descriptor for any revision equal to or less - * than @p _end. - * - * @param _end The last hardware revision to match on. - */ -#define BHND_HWREV_LTE(_end) BHND_HWREV_RANGE(0, _end) - - -/** A core match descriptor. */ -struct bhnd_core_match { - uint16_t vendor; /**< required JEP106 device vendor or BHND_MFGID_INVALID. */ - uint16_t device; /**< required core ID or BHND_COREID_INVALID */ - struct bhnd_hwrev_match hwrev; /**< matching revisions. */ - bhnd_devclass_t class; /**< required class or BHND_DEVCLASS_INVALID */ - int unit; /**< required core unit, or -1 */ -}; - -/** - * Core match descriptor matching against the given @p _vendor, @p _device, - * and @p _hwrev match descriptors. - */ -#define BHND_CORE_MATCH(_vendor, _device, _hwrev) \ - { _vendor, _device, _hwrev, BHND_DEVCLASS_INVALID, -1 } - -/** - * Wildcard core match descriptor. - */ -#define BHND_CORE_MATCH_ANY \ - { \ - .vendor = BHND_MFGID_INVALID, \ - .device = BHND_COREID_INVALID, \ - .hwrev = BHND_HWREV_ANY, \ - .class = BHND_DEVCLASS_INVALID, \ - .unit = -1 \ - } - /** - * A chipset match descriptor. - * - * @warning Matching on board/nvram attributes relies on NVRAM access, and will - * fail if a valid NVRAM device cannot be found, or is not yet attached. + * Device quirk table descriptor. */ -struct bhnd_chip_match { - /** Select fields to be matched */ - uint16_t - match_id:1, - match_rev:1, - match_pkg:1, - match_bvendor:1, - match_btype:1, - match_brev:1, - match_srom_rev:1, - match_any:1, - match_flags_unused:8; - - uint16_t chip_id; /**< required chip id */ - struct bhnd_hwrev_match chip_rev; /**< matching chip revisions */ - uint8_t chip_pkg; /**< required package */ - - uint16_t board_vendor; /**< required board vendor */ - uint16_t board_type; /**< required board type */ - struct bhnd_hwrev_match board_rev; /**< matching board revisions */ - - struct bhnd_hwrev_match board_srom_rev; /**< matching board srom revisions */ +struct bhnd_device_quirk { + struct bhnd_device_match desc; /**< device match descriptor */ + uint32_t quirks; /**< quirk flags */ }; -#define BHND_CHIP_MATCH_ANY \ - { .match_any = 1 } - -#define BHND_CHIP_MATCH_IS_ANY(_m) \ - ((_m)->match_any == 1) - -#define BHND_CHIP_MATCH_REQ_BOARD_INFO(_m) \ - ((_m)->match_srom_rev || (_m)->match_bvendor || \ - (_m)->match_btype || (_m)->match_brev) - -/** Set the required chip ID within a bhnd_chip_match instance */ -#define BHND_CHIP_ID(_cid) \ - .match_id = 1, .chip_id = BHND_CHIPID_BCM ## _cid - -/** Set the required chip revision range within a bhnd_chip_match instance */ -#define BHND_CHIP_REV(_rev) \ - .match_rev = 1, .chip_rev = BHND_ ## _rev +#define BHND_CORE_QUIRK(_rev, _flags) \ + {{ BHND_MATCH_CORE_REV(_rev) }, (_flags) } -/** Set the required package ID within a bhnd_chip_match instance */ -#define BHND_CHIP_PKG(_pkg) \ - .match_pkg = 1, .chip_pkg = BHND_PKGID_BCM ## _pkg +#define BHND_CHIP_QUIRK(_chip, _rev, _flags) \ + {{ BHND_CHIP_IR(BCM ## _chip, _rev) }, (_flags) } -/** Set the required board vendor within a bhnd_chip_match instance */ -#define BHND_CHIP_BVENDOR(_vend) \ - .match_bvendor = 1, .board_vendor = _vend +#define BHND_PKG_QUIRK(_chip, _pkg, _flags) \ + {{ BHND_CHIP_IP(BCM ## _chip, BCM ## _chip ## _pkg) }, (_flags) } -/** Set the required board type within a bhnd_chip_match instance */ -#define BHND_CHIP_BTYPE(_btype) \ - .match_btype = 1, .board_type = BHND_BOARD_ ## _btype +#define BHND_BOARD_QUIRK(_board, _flags) \ + {{ BHND_MATCH_BOARD_TYPE(_board) }, \ + (_flags) } -/** Set the required SROM revision range within a bhnd_chip_match instance */ -#define BHND_CHIP_SROMREV(_rev) \ - .match_srom_rev = 1, .board_srom_rev = BHND_ ## _rev - -/** Set the required board revision range within a bhnd_chip_match instance */ -#define BHND_CHIP_BREV(_rev) \ - .match_brev = 1, .board_rev = BHND_ ## _rev - -/** Set the required board vendor and type within a bhnd_chip_match instance */ -#define BHND_CHIP_BVT(_vend, _type) \ - BHND_CHIP_BVENDOR(_vend), BHND_CHIP_BTYPE(_type) - -/** Set the required board vendor, type, and revision within a bhnd_chip_match - * instance */ -#define BHND_CHIP_BVTR(_vend, _type, _rev) \ - BHND_CHIP_BVT(_vend, _type), BHND_CHIP_BREV(_rev) - -/** Set the required chip and package ID within a bhnd_chip_match instance */ -#define BHND_CHIP_IP(_cid, _pkg) \ - BHND_CHIP_ID(_cid), BHND_CHIP_PKG(_pkg) - -/** Set the required chip ID, package ID, and revision within a bhnd_chip_match - * instance */ -#define BHND_CHIP_IPR(_cid, _pkg, _rev) \ - BHND_CHIP_ID(_cid), BHND_CHIP_PKG(_pkg), BHND_CHIP_REV(_rev) - -/** Set the required chip ID and revision within a bhnd_chip_match - * instance */ -#define BHND_CHIP_IR(_cid, _rev) \ - BHND_CHIP_ID(_cid), BHND_CHIP_REV(_rev) - -/** - * Chipset quirk table descriptor. - */ -struct bhnd_chip_quirk { - const struct bhnd_chip_match chip; /**< chip match descriptor */ - uint32_t quirks; /**< quirk flags */ -}; - -#define BHND_CHIP_QUIRK_END { BHND_CHIP_MATCH_ANY, 0 } - -#define BHND_CHIP_QUIRK_IS_END(_q) \ - (BHND_CHIP_MATCH_IS_ANY(&(_q)->chip) && (_q)->quirks == 0) - -/** - * Device quirk table descriptor. - */ -struct bhnd_device_quirk { - struct bhnd_hwrev_match hwrev; /**< applicable hardware revisions */ - uint32_t quirks; /**< quirk flags */ -}; -#define BHND_DEVICE_QUIRK_END { BHND_HWREV_ANY, 0 } +#define BHND_DEVICE_QUIRK_END { { BHND_MATCH_ANY }, 0 } #define BHND_DEVICE_QUIRK_IS_END(_q) \ - (BHND_HWREV_IS_ANY(&(_q)->hwrev) && (_q)->quirks == 0) + (((_q)->desc.m.match_flags == 0) && (_q)->quirks == 0) enum { BHND_DF_ANY = 0, - BHND_DF_HOSTB = (1<<0) /**< core is serving as the bus' - * host bridge */ + BHND_DF_HOSTB = (1<<0), /**< core is serving as the bus' host + * bridge. implies BHND_DF_ADAPTER */ + BHND_DF_SOC = (1<<1), /**< core is attached to a native + bus (BHND_ATTACH_NATIVE) */ + BHND_DF_ADAPTER = (1<<2), /**< core is attached to a bridged + * adapter (BHND_ATTACH_ADAPTER) */ }; /** Device probe table descriptor */ struct bhnd_device { - const struct bhnd_core_match core; /**< core match descriptor */ - const char *desc; /**< device description, or NULL. */ - const struct bhnd_device_quirk *quirks_table; /**< quirks table for this device, or NULL */ - const struct bhnd_chip_quirk *chip_quirks_table; /**< chipset-specific quirks for this device, or NULL */ - uint32_t device_flags; /**< required BHND_DF_* flags */ + const struct bhnd_device_match core; /**< core match descriptor */ + const char *desc; /**< device description, or NULL. */ + const struct bhnd_device_quirk *quirks_table; /**< quirks table for this device, or NULL */ + uint32_t device_flags; /**< required BHND_DF_* flags */ }; -#define _BHND_DEVICE(_vendor, _device, _desc, _quirks, _chip_quirks, \ - _flags, ...) \ - { BHND_CORE_MATCH(BHND_MFGID_ ## _vendor, \ - BHND_COREID_ ## _device, BHND_HWREV_ANY), _desc, _quirks, \ - _chip_quirks, _flags } +#define _BHND_DEVICE(_vendor, _device, _desc, _quirks, \ + _flags, ...) \ + { { BHND_MATCH_CORE(BHND_MFGID_ ## _vendor, \ + BHND_COREID_ ## _device) }, _desc, _quirks, \ + _flags } -#define BHND_MIPS_DEVICE(_device, _desc, _quirks, _chip_quirks, ...) \ - _BHND_DEVICE(MIPS, _device, _desc, _quirks, _chip_quirks, \ +#define BHND_MIPS_DEVICE(_device, _desc, _quirks, ...) \ + _BHND_DEVICE(MIPS, _device, _desc, _quirks, \ ## __VA_ARGS__, 0) -#define BHND_ARM_DEVICE(_device, _desc, _quirks, _chip_quirks, ...) \ - _BHND_DEVICE(ARM, _device, _desc, _quirks, _chip_quirks, \ +#define BHND_ARM_DEVICE(_device, _desc, _quirks, ...) \ + _BHND_DEVICE(ARM, _device, _desc, _quirks, \ ## __VA_ARGS__, 0) -#define BHND_DEVICE(_device, _desc, _quirks, _chip_quirks, ...) \ - _BHND_DEVICE(BCM, _device, _desc, _quirks, _chip_quirks, \ +#define BHND_DEVICE(_device, _desc, _quirks, ...) \ + _BHND_DEVICE(BCM, _device, _desc, _quirks, \ ## __VA_ARGS__, 0) -#define BHND_DEVICE_END { BHND_CORE_MATCH_ANY, NULL, NULL, NULL, 0 } +#define BHND_DEVICE_END { { BHND_MATCH_ANY }, NULL, NULL, 0 } +#define BHND_DEVICE_IS_END(_d) \ + (BHND_MATCH_IS_ANY(&(_d)->core) && (_d)->desc == NULL) const char *bhnd_vendor_name(uint16_t vendor); const char *bhnd_port_type_name(bhnd_port_type port_type); @@ -447,17 +284,17 @@ bool bhnd_core_matches( bool bhnd_chip_matches( const struct bhnd_chipid *chipid, - const struct bhnd_board_info *binfo, const struct bhnd_chip_match *desc); +bool bhnd_board_matches( + const struct bhnd_board_info *info, + const struct bhnd_board_match *desc); + bool bhnd_hwrev_matches(uint16_t hwrev, const struct bhnd_hwrev_match *desc); -uint32_t bhnd_chip_quirks(device_t dev, - const struct bhnd_chip_quirk *table); - bool bhnd_device_matches(device_t dev, - const struct bhnd_core_match *desc); + const struct bhnd_device_match *desc); const struct bhnd_device *bhnd_device_lookup(device_t dev, const struct bhnd_device *table, @@ -469,7 +306,6 @@ uint32_t bhnd_device_quirks(device_t struct bhnd_core_info bhnd_get_core_info(device_t dev); - int bhnd_alloc_resources(device_t dev, struct resource_spec *rs, struct bhnd_resource **res); Added: head/sys/dev/bhnd/bhnd_match.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/bhnd/bhnd_match.h Tue May 24 21:20:17 2016 (r300628) @@ -0,0 +1,291 @@ +/*- + * Copyright (c) 2015-2016 Landon Fuller <landon@landonf.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGES. + * + * $FreeBSD$ + */ + +#ifndef _BHND_BHND_MATCH_H_ +#define _BHND_BHND_MATCH_H_ + +#include "bhnd_types.h" + +/** + * A hardware revision match descriptor. + */ +struct bhnd_hwrev_match { + uint16_t start; /**< first revision, or BHND_HWREV_INVALID + to match on any revision. */ + uint16_t end; /**< last revision, or BHND_HWREV_INVALID + to match on any revision. */ +}; + +/* Copy match field @p _name from @p _src */ +#define _BHND_COPY_MATCH_FIELD(_src, _name) \ + .m.match._name = (_src)->m.match._name, \ + ._name = (_src)->_name + +/* Set match field @p _name with @p _value */ +#define _BHND_SET_MATCH_FIELD(_name, _value) \ + .m.match._name = 1, ._name = _value + +/** + * Wildcard hardware revision match descriptor. + */ +#define BHND_HWREV_ANY { BHND_HWREV_INVALID, BHND_HWREV_INVALID } +#define BHND_HWREV_IS_ANY(_m) \ + ((_m)->start == BHND_HWREV_INVALID && (_m)->end == BHND_HWREV_INVALID) + +/** + * Hardware revision match descriptor for an inclusive range. + * + * @param _start The first applicable hardware revision. + * @param _end The last applicable hardware revision, or BHND_HWREV_INVALID + * to match on any revision. + */ +#define BHND_HWREV_RANGE(_start, _end) { _start, _end } + +/** + * Hardware revision match descriptor for a single revision. + * + * @param _hwrev The hardware revision to match on. + */ +#define BHND_HWREV_EQ(_hwrev) BHND_HWREV_RANGE(_hwrev, _hwrev) + +/** + * Hardware revision match descriptor for any revision equal to or greater + * than @p _start. + * + * @param _start The first hardware revision to match on. + */ +#define BHND_HWREV_GTE(_start) BHND_HWREV_RANGE(_start, BHND_HWREV_INVALID) + +/** + * Hardware revision match descriptor for any revision equal to or less + * than @p _end. + * + * @param _end The last hardware revision to match on. + */ +#define BHND_HWREV_LTE(_end) BHND_HWREV_RANGE(0, _end) + +/** + * A bhnd(4) core match descriptor. + */ +struct bhnd_core_match { + /** Select fields to be matched */ + union { + uint8_t match_flags; + struct { + uint8_t + core_vendor:1, + core_id:1, + core_rev:1, + core_class:1, + core_unit:1, + flags_unused:3; + } match; + } m; + + uint16_t core_vendor; /**< required JEP106 device vendor */ + uint16_t core_id; /**< required core ID */ + struct bhnd_hwrev_match core_rev; /**< matching core revisions. */ + bhnd_devclass_t core_class; /**< required bhnd class */ + int core_unit; /**< required core unit */ +}; + +#define _BHND_CORE_MATCH_COPY(_src) \ + _BHND_COPY_MATCH_FIELD(_src, core_vendor), \ + _BHND_COPY_MATCH_FIELD(_src, core_id), \ + _BHND_COPY_MATCH_FIELD(_src, core_rev), \ + _BHND_COPY_MATCH_FIELD(_src, core_class), \ + _BHND_COPY_MATCH_FIELD(_src, core_unit) \ + +#define BHND_MATCH_CORE_VENDOR(_v) _BHND_SET_MATCH_FIELD(core_vendor, _v) +#define BHND_MATCH_CORE_ID(_id) _BHND_SET_MATCH_FIELD(core_id, _id) +#define BHND_MATCH_CORE_REV(_rev) _BHND_SET_MATCH_FIELD(core_rev, \ + BHND_ ## _rev) +#define BHND_MATCH_CORE_CLASS(_cls) _BHND_SET_MATCH_FIELD(core_class, _cls) +#define BHND_MATCH_CORE_UNIT(_unit) _BHND_SET_MATCH_FIELD(core_unit, _unit) + +/** + * Match against the given @p _vendor and @p _id, + */ +#define BHND_MATCH_CORE(_vendor, _id) \ + BHND_MATCH_CORE_VENDOR(_vendor), \ + BHND_MATCH_CORE_ID(_id) + +/** + * A bhnd(4) chip match descriptor. + */ +struct bhnd_chip_match { + /** Select fields to be matched */ + union { + uint8_t match_flags; + struct { + uint8_t + chip_id:1, + chip_rev:1, + chip_pkg:1, + flags_unused:5; + } match; + + } m; + + uint16_t chip_id; /**< required chip id */ + struct bhnd_hwrev_match chip_rev; /**< matching chip revisions */ + uint8_t chip_pkg; /**< required package */ +}; + +#define _BHND_CHIP_MATCH_COPY(_src) \ + _BHND_COPY_MATCH_FIELD(_src, chip_id), \ + _BHND_COPY_MATCH_FIELD(_src, chip_rev), \ + _BHND_COPY_MATCH_FIELD(_src, chip_pkg) \ + +/** Set the required chip ID within a bhnd match descriptor */ +#define BHND_CHIP_ID(_cid) _BHND_SET_MATCH_FIELD(chip_id, \ + BHND_CHIPID_ ## _cid) + +/** Set the required chip revision range within a bhnd match descriptor */ +#define BHND_CHIP_REV(_rev) _BHND_SET_MATCH_FIELD(chip_rev, \ + BHND_ ## _rev) + +/** Set the required package ID within a bhnd match descriptor */ +#define BHND_CHIP_PKG(_pkg) _BHND_SET_MATCH_FIELD(chip_pkg, \ + BHND_PKGID_ ## _pkg) + +/** Set the required chip and package ID within a bhnd match descriptor */ +#define BHND_CHIP_IP(_cid, _pkg) \ + BHND_CHIP_ID(_cid), BHND_CHIP_PKG(_pkg) + +/** Set the required chip ID, package ID, and revision within a bhnd_device_match + * instance */ +#define BHND_CHIP_IPR(_cid, _pkg, _rev) \ + BHND_CHIP_ID(_cid), BHND_CHIP_PKG(_pkg), BHND_CHIP_REV(_rev) + +/** Set the required chip ID and revision within a bhnd_device_match + * instance */ +#define BHND_CHIP_IR(_cid, _rev) \ + BHND_CHIP_ID(_cid), BHND_CHIP_REV(_rev) + +/** + * A bhnd(4) board match descriptor. + */ +struct bhnd_board_match { + /** Select fields to be matched */ + union { + uint8_t match_flags; + struct { + uint8_t + board_vendor:1, + board_type:1, + board_rev:1, + board_srom_rev:1, + flags_unused:4; + } match; + } m; + + uint16_t board_vendor; /**< required board vendor */ + uint16_t board_type; /**< required board type */ + struct bhnd_hwrev_match board_rev; /**< matching board revisions */ + struct bhnd_hwrev_match board_srom_rev; /**< matching board srom revisions */ +}; + +#define _BHND_BOARD_MATCH_COPY(_src) \ + _BHND_COPY_MATCH_FIELD(_src, board_vendor), \ + _BHND_COPY_MATCH_FIELD(_src, board_type), \ + _BHND_COPY_MATCH_FIELD(_src, board_rev), \ + _BHND_COPY_MATCH_FIELD(_src, board_srom_rev) + +/** Set the required board vendor within a bhnd match descriptor */ +#define BHND_MATCH_BOARD_VENDOR(_v) _BHND_SET_MATCH_FIELD(board_vendor, _v) + +/** Set the required board type within a bhnd match descriptor */ +#define BHND_MATCH_BOARD_TYPE(_type) _BHND_SET_MATCH_FIELD(board_type, \ + BHND_BOARD_ ## _type) +/** Set the required SROM revision range within a bhnd match descriptor */ +#define BHND_MATCH_SROMREV(_rev) _BHND_SET_MATCH_FIELD(board_srom_rev, \ + BHND_HWREV_ ## _rev) + +/** Set the required board revision range within a bhnd match descriptor */ +#define BHND_MATCH_BOARD_REV(_rev) _BHND_SET_MATCH_FIELD(board_rev, \ + BHND_ ## _rev) + +/** Set the required board vendor and type within a bhnd match descriptor */ +#define BHND_MATCH_BOARD(_vend, _type) \ + BHND_MATCH_BOARD_VENDOR(_vend), BHND_MATCH_BOARD_TYPE(_type) + + +/** + * A bhnd(4) device match descriptor. + * + * @warning Matching on board attributes relies on NVRAM access, and will + * fail if a valid NVRAM device cannot be found, or is not yet attached. + */ +struct bhnd_device_match { + /** Select fields to be matched */ + union { + uint16_t match_flags; + struct { + uint16_t + core_vendor:1, + core_id:1, + core_rev:1, + core_class:1, + core_unit:1, + chip_id:1, + chip_rev:1, + chip_pkg:1, + board_vendor:1, + board_type:1, + board_rev:1, + board_srom_rev:1, + flags_unused:2; + } match; + } m; + + uint16_t core_vendor; /**< required JEP106 device vendor */ + uint16_t core_id; /**< required core ID */ + struct bhnd_hwrev_match core_rev; /**< matching core revisions. */ + bhnd_devclass_t core_class; /**< required bhnd class */ + int core_unit; /**< required core unit */ + + uint16_t chip_id; /**< required chip id */ + struct bhnd_hwrev_match chip_rev; /**< matching chip revisions */ + uint8_t chip_pkg; /**< required package */ + + uint16_t board_vendor; /**< required board vendor */ + uint16_t board_type; /**< required board type */ + struct bhnd_hwrev_match board_rev; /**< matching board revisions */ + struct bhnd_hwrev_match board_srom_rev; /**< matching board srom revisions */ +}; + +/** Define a wildcard match requirement (matches on any device). */ +#define BHND_MATCH_ANY .m.match_flags = 0 +#define BHND_MATCH_IS_ANY(_m) \ + ((_m)->m.match_flags == 0) + +#endif /* _BHND_BHND_MATCH_H_ */ Modified: head/sys/dev/bhnd/bhnd_subr.c ============================================================================== --- head/sys/dev/bhnd/bhnd_subr.c Tue May 24 21:13:33 2016 (r300627) +++ head/sys/dev/bhnd/bhnd_subr.c Tue May 24 21:20:17 2016 (r300628) @@ -303,14 +303,13 @@ device_t bhnd_find_child(device_t dev, bhnd_devclass_t class, int unit) { struct bhnd_core_match md = { - .vendor = BHND_MFGID_INVALID, - .device = BHND_COREID_INVALID, - .hwrev.start = BHND_HWREV_INVALID, - .hwrev.end = BHND_HWREV_INVALID, - .class = class, - .unit = unit + BHND_MATCH_CORE_CLASS(class), + BHND_MATCH_CORE_UNIT(unit) }; + if (unit == -1) + md.m.match.core_unit = 0; + return bhnd_match_child(dev, &md); } @@ -337,9 +336,10 @@ bhnd_match_child(device_t dev, const str match = NULL; for (int i = 0; i < devcnt; i++) { - device_t dev = devlistp[i]; - if (bhnd_device_matches(dev, desc)) { - match = dev; + struct bhnd_core_info ci = bhnd_get_core_info(devlistp[i]); + + if (bhnd_core_matches(&ci, desc)) { + match = devlistp[i]; goto done; } } @@ -437,12 +437,7 @@ bhnd_find_core(const struct bhnd_core_in bhnd_devclass_t class) { struct bhnd_core_match md = { - .vendor = BHND_MFGID_INVALID, - .device = BHND_COREID_INVALID, - .hwrev.start = BHND_HWREV_INVALID, - .hwrev.end = BHND_HWREV_INVALID, - .class = class, - .unit = -1 + BHND_MATCH_CORE_CLASS(class) }; return bhnd_match_core(cores, num_cores, &md); @@ -461,22 +456,21 @@ bool bhnd_core_matches(const struct bhnd_core_info *core, const struct bhnd_core_match *desc) { - if (desc->vendor != BHND_MFGID_INVALID && - desc->vendor != core->vendor) + if (desc->m.match.core_vendor && desc->core_vendor != core->vendor) return (false); - if (desc->device != BHND_COREID_INVALID && - desc->device != core->device) + if (desc->m.match.core_id && desc->core_id != core->device) return (false); - if (desc->unit != -1 && desc->unit != core->unit) + if (desc->m.match.core_unit && desc->core_unit != core->unit) return (false); - if (!bhnd_hwrev_matches(core->hwrev, &desc->hwrev)) + if (desc->m.match.core_rev && + !bhnd_hwrev_matches(core->hwrev, &desc->core_rev)) return (false); - if (desc->class != BHND_DEVCLASS_INVALID && - desc->class != bhnd_core_class(core)) + if (desc->m.match.core_class && + desc->core_class != bhnd_core_class(core)) return (false); return true; @@ -486,7 +480,6 @@ bhnd_core_matches(const struct bhnd_core * Return true if the @p chip matches @p desc. * * @param chip A bhnd chip identifier. - * @param board The bhnd board info, or NULL if unavailable. * @param desc A match descriptor to compare against @p chip. * * @retval true if @p chip matches @p match @@ -494,46 +487,49 @@ bhnd_core_matches(const struct bhnd_core */ bool bhnd_chip_matches(const struct bhnd_chipid *chip, - const struct bhnd_board_info *board, const struct bhnd_chip_match *desc) { - /* Explicit wildcard match */ - if (desc->match_any) - return (true); - - /* If board_info is missing, but required, we cannot match. */ - if (BHND_CHIP_MATCH_REQ_BOARD_INFO(desc) && board == NULL) - return (false); - - - /* Chip matching */ - if (desc->match_id && chip->chip_id != desc->chip_id) + if (desc->m.match.chip_id && chip->chip_id != desc->chip_id) return (false); - if (desc->match_pkg && chip->chip_pkg != desc->chip_pkg) + if (desc->m.match.chip_pkg && chip->chip_pkg != desc->chip_pkg) return (false); - if (desc->match_rev && + if (desc->m.match.chip_rev && !bhnd_hwrev_matches(chip->chip_rev, &desc->chip_rev)) return (false); + return (true); +} - /* Board info matching */ - if (desc->match_srom_rev && +/** + * Return true if the @p board matches @p desc. + * + * @param board The bhnd board info. + * @param desc A match descriptor to compare against @p board. + * + * @retval true if @p chip matches @p match + * @retval false if @p chip does not match @p match. + */ +bool +bhnd_board_matches(const struct bhnd_board_info *board, + const struct bhnd_board_match *desc) +{ + if (desc->m.match.board_srom_rev && !bhnd_hwrev_matches(board->board_srom_rev, &desc->board_srom_rev)) return (false); - if (desc->match_bvendor && board->board_vendor != desc->board_vendor) + if (desc->m.match.board_vendor && + board->board_vendor != desc->board_vendor) return (false); - if (desc->match_btype && board->board_type != desc->board_type) + if (desc->m.match.board_type && board->board_type != desc->board_type) return (false); - if (desc->match_brev && + if (desc->m.match.board_rev && !bhnd_hwrev_matches(board->board_rev, &desc->board_rev)) return (false); - return (true); } @@ -570,16 +566,59 @@ bhnd_hwrev_matches(uint16_t hwrev, const * @retval false if @p dev does not match @p match. */ bool -bhnd_device_matches(device_t dev, const struct bhnd_core_match *desc) +bhnd_device_matches(device_t dev, const struct bhnd_device_match *desc) { - struct bhnd_core_info ci = { - .vendor = bhnd_get_vendor(dev), - .device = bhnd_get_device(dev), - .unit = bhnd_get_core_unit(dev), - .hwrev = bhnd_get_hwrev(dev) - }; + struct bhnd_core_info core; + const struct bhnd_chipid *chip; + struct bhnd_board_info board; + device_t parent; + int error; - return bhnd_core_matches(&ci, desc); + /* Construct individual match descriptors */ + struct bhnd_core_match m_core = { _BHND_CORE_MATCH_COPY(desc) }; + struct bhnd_chip_match m_chip = { _BHND_CHIP_MATCH_COPY(desc) }; + struct bhnd_board_match m_board = { _BHND_BOARD_MATCH_COPY(desc) }; + + /* Fetch and match core info */ + if (m_core.m.match_flags) { + /* Only applicable to bhnd-attached cores */ + parent = device_get_parent(dev); + if (device_get_devclass(parent) != bhnd_devclass) { + device_printf(dev, "attempting to match core " + "attributes against non-core device\n"); + return (false); + } + + core = bhnd_get_core_info(dev); + if (!bhnd_core_matches(&core, &m_core)) + return (false); + } + + /* Fetch and match chip info */ + if (m_chip.m.match_flags) { + chip = bhnd_get_chipid(dev); + + if (!bhnd_chip_matches(chip, &m_chip)) + return (false); + } + + /* Fetch and match board info. + * + * This is not available until after NVRAM is up; earlier device + * matches should not include board requirements */ + if (m_board.m.match_flags) { + if ((error = bhnd_read_board_info(dev, &board))) { + device_printf(dev, "failed to read required board info " + "during device matching: %d\n", error); + return (false); + } + + if (!bhnd_board_matches(&board, &m_board)) + return (false); + } + + /* All matched */ + return (true); } /** @@ -598,11 +637,14 @@ bhnd_device_lookup(device_t dev, const s { const struct bhnd_device *entry; device_t hostb, parent; + bhnd_attach_type attach_type; + uint32_t dflags; parent = device_get_parent(dev); hostb = bhnd_find_hostb_device(parent); + attach_type = bhnd_get_attach_type(dev); - for (entry = table; entry->desc != NULL; entry = + for (entry = table; !BHND_DEVICE_IS_END(entry); entry = (const struct bhnd_device *) ((const char *) entry + entry_size)) { /* match core info */ @@ -610,10 +652,23 @@ bhnd_device_lookup(device_t dev, const s continue; /* match device flags */ - if (entry->device_flags & BHND_DF_HOSTB) { + dflags = entry->device_flags; + + /* hostb implies BHND_ATTACH_ADAPTER requirement */ + if (dflags & BHND_DF_HOSTB) + dflags |= BHND_DF_ADAPTER; + + if (dflags & BHND_DF_ADAPTER) + if (attach_type != BHND_ATTACH_ADAPTER) + continue; + + if (dflags & BHND_DF_HOSTB) if (dev != hostb) continue; - } + + if (dflags & BHND_DF_SOC) + if (attach_type != BHND_ATTACH_NATIVE) + continue; /* device found */ return (entry); @@ -624,66 +679,10 @@ bhnd_device_lookup(device_t dev, const s } /** - * Scan @p table for all quirk flags applicable to @p dev's chip identifier - * (as returned by bhnd_get_chipid). - * - * @param dev A bhnd device. - * @param table The chip quirk table to search. - * - * @return returns all matching quirk flags. - */ -uint32_t -bhnd_chip_quirks(device_t dev, const struct bhnd_chip_quirk *table) -{ - struct bhnd_board_info bi, *board; - const struct bhnd_chipid *cid; - const struct bhnd_chip_quirk *qent; - uint32_t quirks; - int error; - bool need_boardinfo; - - cid = bhnd_get_chipid(dev); - quirks = 0; - need_boardinfo = 0; - board = NULL; - - /* Determine whether quirk matching requires board_info; we want to - * avoid fetching board_info for early devices (e.g. ChipCommon) - * that are brought up prior to NVRAM being readable. */ - for (qent = table; !BHND_CHIP_QUIRK_IS_END(qent); qent++) { - if (!BHND_CHIP_MATCH_REQ_BOARD_INFO(&qent->chip)) - continue; - - need_boardinfo = true; - break; - } - - /* If required, fetch board info */ - if (need_boardinfo) { - error = bhnd_read_board_info(dev, &bi); - if (!error) { - board = &bi; - } else { - device_printf(dev, "failed to read required board info " - "during quirk matching: %d\n", error); - } - } - - /* Apply all matching quirk flags */ - for (qent = table; !BHND_CHIP_QUIRK_IS_END(qent); qent++) { - if (bhnd_chip_matches(cid, board, &qent->chip)) - quirks |= qent->quirks; - } - - return (quirks); -} - -/** - * Scan @p table for all quirk flags applicable to @p dev. + * Scan the device @p table for all quirk flags applicable to @p dev. * * @param dev A bhnd device to match against @p table. * @param table The device table to search. - * @param entry_size The @p table entry size, in bytes. * * @return returns all matching quirk flags. */ @@ -692,32 +691,25 @@ bhnd_device_quirks(device_t dev, const s size_t entry_size) { const struct bhnd_device *dent; - const struct bhnd_device_quirk *qtable, *qent; + const struct bhnd_device_quirk *qent, *qtable; uint32_t quirks; - uint16_t hwrev; - hwrev = bhnd_get_hwrev(dev); - quirks = 0; + /* Locate the device entry */ + if ((dent = bhnd_device_lookup(dev, table, entry_size)) == NULL) + return (0); - /* Find the quirk table */ - if ((dent = bhnd_device_lookup(dev, table, entry_size)) == NULL) { - /* This is almost certainly a (caller) implementation bug */ - device_printf(dev, "quirk lookup did not match any device\n"); + /* Quirks table is optional */ + qtable = dent->quirks_table; + if (qtable == NULL) return (0); - } /* Collect matching device quirk entries */ - if ((qtable = dent->quirks_table) != NULL) { - for (qent = qtable; !BHND_DEVICE_QUIRK_IS_END(qent); qent++) { - if (bhnd_hwrev_matches(hwrev, &qent->hwrev)) - quirks |= qent->quirks; - } + quirks = 0; + for (qent = qtable; !BHND_DEVICE_QUIRK_IS_END(qent); qent++) { + if (bhnd_device_matches(dev, &qent->desc)) + quirks |= qent->quirks; } - /* Collect matching chip quirk entries */ - if (dent->chip_quirks_table != NULL) - quirks |= bhnd_chip_quirks(dev, dent->chip_quirks_table); - return (quirks); } Modified: head/sys/dev/bhnd/bhndb/bhndb.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb.c Tue May 24 21:13:33 2016 (r300627) +++ head/sys/dev/bhnd/bhndb/bhndb.c Tue May 24 21:20:17 2016 (r300628) @@ -194,13 +194,15 @@ bhndb_hw_matches(device_t *devlist, int { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue May 24 23:15:53 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 728F5B493E7; Tue, 24 May 2016 23:15:53 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43B581327; Tue, 24 May 2016 23:15:53 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4ONFqJr075209; Tue, 24 May 2016 23:15:52 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4ONFqNK075208; Tue, 24 May 2016 23:15:52 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201605242315.u4ONFqNK075208@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery <bdrewery@FreeBSD.org> Date: Tue, 24 May 2016 23:15:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300630 - head/tools/build/options X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 23:15:53 -0000 Author: bdrewery Date: Tue May 24 23:15:52 2016 New Revision: 300630 URL: https://svnweb.freebsd.org/changeset/base/300630 Log: WITH_META_MODE: Correct description of missing .meta file. Sponsored by: EMC / Isilon Storage Division Modified: head/tools/build/options/WITH_META_MODE Modified: head/tools/build/options/WITH_META_MODE ============================================================================== --- head/tools/build/options/WITH_META_MODE Tue May 24 23:04:16 2016 (r300629) +++ head/tools/build/options/WITH_META_MODE Tue May 24 23:15:52 2016 (r300630) @@ -19,7 +19,9 @@ The command to execute changes. .It The current working directory changes. .It -The target's meta file is missing. +The target's meta file is missing, if it had +.Sy .META +as a dependency. .It [requires .Xr filemon 4 ] From owner-svn-src-head@freebsd.org Tue May 24 23:19:05 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27D1DB49643; Tue, 24 May 2016 23:19:05 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE3D61793; Tue, 24 May 2016 23:19:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4ONJ469075359; Tue, 24 May 2016 23:19:04 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4ONJ4eG075358; Tue, 24 May 2016 23:19:04 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201605242319.u4ONJ4eG075358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery <bdrewery@FreeBSD.org> Date: Tue, 24 May 2016 23:19:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300631 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 23:19:05 -0000 Author: bdrewery Date: Tue May 24 23:19:03 2016 New Revision: 300631 URL: https://svnweb.freebsd.org/changeset/base/300631 Log: Regenerate Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Tue May 24 23:15:52 2016 (r300630) +++ head/share/man/man5/src.conf.5 Tue May 24 23:19:03 2016 (r300631) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 292283 2015-12-15 18:42:30Z bdrewery .\" $FreeBSD$ -.Dd May 20, 2016 +.Dd May 24, 2016 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1062,7 +1062,7 @@ Set to not build utilities for manual pa .Xr manctl 8 , and related support files. .It Va WITH_META_MODE -.\" from FreeBSD: head/tools/build/options/WITH_META_MODE 298007 2016-04-14 22:00:49Z bdrewery +.\" from FreeBSD: head/tools/build/options/WITH_META_MODE 300630 2016-05-24 23:15:52Z bdrewery Creates .Xr make 1 meta files when building, which can provide a reliable incremental build when @@ -1083,7 +1083,9 @@ The command to execute changes. .It The current working directory changes. .It -The target's meta file is missing. +The target's meta file is missing, if it had +.Sy .META +as a dependency. .It [requires .Xr filemon 4 ] From owner-svn-src-head@freebsd.org Tue May 24 23:36:45 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25E76B49990; Tue, 24 May 2016 23:36:45 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E781D1EA7; Tue, 24 May 2016 23:36:44 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4ONaijP081179; Tue, 24 May 2016 23:36:44 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4ONait8081178; Tue, 24 May 2016 23:36:44 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605242336.u4ONait8081178@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Tue, 24 May 2016 23:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300632 - head/usr.sbin/acpi/acpidump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 23:36:45 -0000 Author: truckman Date: Tue May 24 23:36:43 2016 New Revision: 300632 URL: https://svnweb.freebsd.org/changeset/base/300632 Log: Fix acpidump CID 1011278 (Buffer not null terminated) and other issues Coverity reports that a buffer used for temporary file generation might not be NUL terminated by strncpy(). This is probably not true because the input gets passed through realpath(), but if the path name is sufficiently long the name could be truncated and cause other problems. The code for generating the temp file names is also overly complex. Instead of a bunch of calls to strncpy() and and strncat(), simplify the code by using snprintf() and add checks for unexpected truncation. The output file created by iasl -d is predictable. Fix this by using mkdtemp() to create a directory to hold the iasl input and output files. Check the return values of more syscalls. Reported by: Coverity CID: 1011278 Reviewed by: jkim MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6360 Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Tue May 24 23:19:03 2016 (r300631) +++ head/usr.sbin/acpi/acpidump/acpi.c Tue May 24 23:36:43 2016 (r300632) @@ -1466,27 +1466,34 @@ dsdt_save_file(char *outfile, ACPI_TABLE void aml_disassemble(ACPI_TABLE_HEADER *rsdt, ACPI_TABLE_HEADER *dsdp) { - char buf[PATH_MAX], tmpstr[PATH_MAX]; + char buf[PATH_MAX], tmpstr[PATH_MAX], wrkdir[PATH_MAX]; + const char *iname = "/acpdump.din"; + const char *oname = "/acpdump.dsl"; const char *tmpdir; - char *tmpext; FILE *fp; size_t len; - int fd; + int fd, status; + pid_t pid; tmpdir = getenv("TMPDIR"); if (tmpdir == NULL) tmpdir = _PATH_TMP; - strncpy(tmpstr, tmpdir, sizeof(tmpstr)); - if (realpath(tmpstr, buf) == NULL) { + if (realpath(tmpdir, buf) == NULL) { perror("realpath tmp dir"); return; } - strncpy(tmpstr, buf, sizeof(tmpstr)); - strncat(tmpstr, "/acpidump.", sizeof(tmpstr) - strlen(buf)); - len = strlen(tmpstr); - tmpext = tmpstr + len; - strncpy(tmpext, "XXXXXX", sizeof(tmpstr) - len); - fd = mkstemp(tmpstr); + len = sizeof(wrkdir) - strlen(iname); + if ((size_t)snprintf(wrkdir, len, "%s/acpidump.XXXXXX", buf) > len-1 ) { + fprintf(stderr, "$TMPDIR too long\n"); + return; + } + if (mkdtemp(wrkdir) == NULL) { + perror("mkdtemp tmp working dir"); + return; + } + assert((size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, iname) + <= sizeof(tmpstr) - 1); + fd = open(tmpstr, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR); if (fd < 0) { perror("iasl tmp file"); return; @@ -1495,28 +1502,46 @@ aml_disassemble(ACPI_TABLE_HEADER *rsdt, close(fd); /* Run iasl -d on the temp file */ - if (fork() == 0) { + if ((pid = fork()) == 0) { close(STDOUT_FILENO); if (vflag == 0) close(STDERR_FILENO); execl("/usr/sbin/iasl", "iasl", "-d", tmpstr, NULL); err(1, "exec"); } - - wait(NULL); - unlink(tmpstr); + if (pid > 0) + wait(&status); + if (unlink(tmpstr) < 0) { + perror("unlink"); + goto out; + } + if (pid < 0) { + perror("fork"); + goto out; + } + if (status != 0) { + fprintf(stderr, "iast exit status = %d\n", status); + } /* Dump iasl's output to stdout */ - strncpy(tmpext, "dsl", sizeof(tmpstr) - len); + assert((size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, oname) + <= sizeof(tmpstr) -1); fp = fopen(tmpstr, "r"); - unlink(tmpstr); + if (unlink(tmpstr) < 0) { + perror("unlink"); + goto out; + } if (fp == NULL) { perror("iasl tmp file (read)"); - return; + goto out; } while ((len = fread(buf, 1, sizeof(buf), fp)) > 0) fwrite(buf, 1, len, stdout); fclose(fp); + + out: + if (rmdir(wrkdir) < 0) + perror("rmdir"); } void From owner-svn-src-head@freebsd.org Tue May 24 23:41:38 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02278B49B1E; Tue, 24 May 2016 23:41:38 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C937D117B; Tue, 24 May 2016 23:41:37 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4ONfaUp083998; Tue, 24 May 2016 23:41:36 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4ONfabj083997; Tue, 24 May 2016 23:41:36 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605242341.u4ONfabj083997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Tue, 24 May 2016 23:41:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300633 - head/usr.sbin/acpi/acpidb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 24 May 2016 23:41:38 -0000 Author: truckman Date: Tue May 24 23:41:36 2016 New Revision: 300633 URL: https://svnweb.freebsd.org/changeset/base/300633 Log: Fix acpidb CIDs 1011279 (Buffer not null terminated) and 978405 and 1199380 (Resource leak). load_dsdt() calls strncpy() to copy a filename and Coverity warns that the destination buffer may not be NUL terminated. Fix this by using strlcpy() instead. If silent truncation occurs, then the filename was not valid anyway. load_dsdt() leaks an fd (CID 978405) and a memory region allocated using mmap() (CID 1199380) when it returns. Fix these by calling close() and munmap() as appropriate. Don't bother fixing the minor memory leak "list", allocated by AcGetAllTablesFromFile() (CID 1355191). Check for truncation when creating the temp file name. Set a flag to indicate that the temp file should be unlinked. Relying on a strcmp() test could delete the input file in contrived cases. Reported by: Coverity CID: 1011279, 978405, 1199380 Reviewed by: jkim MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6368 Modified: head/usr.sbin/acpi/acpidb/acpidb.c Modified: head/usr.sbin/acpi/acpidb/acpidb.c ============================================================================== --- head/usr.sbin/acpi/acpidb/acpidb.c Tue May 24 23:36:43 2016 (r300632) +++ head/usr.sbin/acpi/acpidb/acpidb.c Tue May 24 23:41:36 2016 (r300633) @@ -385,8 +385,7 @@ load_dsdt(const char *dsdtfile) ACPI_NEW_TABLE_DESC *list; u_int8_t *code; struct stat sb; - int fd, fd2; - int error; + int dounlink, error, fd; fd = open(dsdtfile, O_RDONLY, 0); if (fd == -1) { @@ -399,11 +398,13 @@ load_dsdt(const char *dsdtfile) return (-1); } code = mmap(NULL, (size_t)sb.st_size, PROT_READ, MAP_PRIVATE, fd, (off_t)0); + close(fd); if (code == NULL) { perror("mmap"); return (-1); } if ((error = AcpiInitializeSubsystem()) != AE_OK) { + munmap(code, (size_t)sb.st_size); return (-1); } @@ -411,21 +412,30 @@ load_dsdt(const char *dsdtfile) * make sure DSDT data contains table header or not. */ if (strncmp((char *)code, "DSDT", 4) == 0) { - strncpy(filetmp, dsdtfile, sizeof(filetmp)); + dounlink = 0; + strlcpy(filetmp, dsdtfile, sizeof(filetmp)); } else { + dounlink = 1; mode_t mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); dummy_dsdt_table.Length = sizeof(ACPI_TABLE_HEADER) + sb.st_size; - snprintf(filetmp, sizeof(filetmp), "%s.tmp", dsdtfile); - fd2 = open(filetmp, O_WRONLY | O_CREAT | O_TRUNC, mode); - if (fd2 == -1) { + if ((size_t)snprintf(filetmp, sizeof(filetmp), "%s.tmp", + dsdtfile) > sizeof(filetmp) - 1) { + fprintf(stderr, "file name too long\n"); + munmap(code, (size_t)sb.st_size); + return (-1); + } + fd = open(filetmp, O_WRONLY | O_CREAT | O_TRUNC, mode); + if (fd == -1) { perror("open"); + munmap(code, (size_t)sb.st_size); return (-1); } - write(fd2, &dummy_dsdt_table, sizeof(ACPI_TABLE_HEADER)); + write(fd, &dummy_dsdt_table, sizeof(ACPI_TABLE_HEADER)); - write(fd2, code, sb.st_size); - close(fd2); + write(fd, code, sb.st_size); + close(fd); } + munmap(code, (size_t)sb.st_size); /* * Install the virtual machine version of address space handlers. @@ -487,7 +497,7 @@ load_dsdt(const char *dsdtfile) AcpiGbl_DebuggerConfiguration = 0; AcpiDbUserCommands(':', NULL); - if (strcmp(dsdtfile, filetmp) != 0) { + if (dounlink) { unlink(filetmp); } From owner-svn-src-head@freebsd.org Wed May 25 00:13:02 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DF4AB48142; Wed, 25 May 2016 00:13:02 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 656C21FBD; Wed, 25 May 2016 00:13:02 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P0D1x8093062; Wed, 25 May 2016 00:13:01 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P0D1rj093061; Wed, 25 May 2016 00:13:01 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201605250013.u4P0D1rj093061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" <cem@FreeBSD.org> Date: Wed, 25 May 2016 00:13:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300634 - head/sys/boot/efi/loader X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 00:13:02 -0000 Author: cem Date: Wed May 25 00:13:01 2016 New Revision: 300634 URL: https://svnweb.freebsd.org/changeset/base/300634 Log: efi loader: Match format string to EFI_ERROR_CODE() Silence a format specifier warning. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/boot/efi/loader/main.c Modified: head/sys/boot/efi/loader/main.c ============================================================================== --- head/sys/boot/efi/loader/main.c Tue May 24 23:41:36 2016 (r300633) +++ head/sys/boot/efi/loader/main.c Wed May 25 00:13:01 2016 (r300634) @@ -923,7 +923,7 @@ command_efi_set(int argc, char *argv[]) EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS, strlen(val) + 1, val); if (EFI_ERROR(err)) { - printf("Failed to set variable: error %d\n", EFI_ERROR_CODE(err)); + printf("Failed to set variable: error %lu\n", EFI_ERROR_CODE(err)); return (CMD_ERROR); } return (CMD_OK); @@ -954,7 +954,7 @@ command_efi_unset(int argc, char *argv[] cpy8to16(var, wvar, sizeof(wvar)); err = RS->SetVariable(wvar, &guid, 0, 0, NULL); if (EFI_ERROR(err)) { - printf("Failed to unset variable: error %d\n", EFI_ERROR_CODE(err)); + printf("Failed to unset variable: error %lu\n", EFI_ERROR_CODE(err)); return (CMD_ERROR); } return (CMD_OK); From owner-svn-src-head@freebsd.org Wed May 25 00:16:53 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F091B48329; Wed, 25 May 2016 00:16:53 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C38F1288; Wed, 25 May 2016 00:16:53 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P0GqX7093250; Wed, 25 May 2016 00:16:52 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P0GqnV093249; Wed, 25 May 2016 00:16:52 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605250016.u4P0GqnV093249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Wed, 25 May 2016 00:16:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300635 - head/usr.sbin/ypserv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 00:16:53 -0000 Author: truckman Date: Wed May 25 00:16:52 2016 New Revision: 300635 URL: https://svnweb.freebsd.org/changeset/base/300635 Log: Call free(cur) if strdup(dirp->d_name) fails to avoid a memory leak. Reported by: Coverity CID: 1007414 MFC after: 1 week Modified: head/usr.sbin/ypserv/yp_server.c Modified: head/usr.sbin/ypserv/yp_server.c ============================================================================== --- head/usr.sbin/ypserv/yp_server.c Wed May 25 00:13:01 2016 (r300634) +++ head/usr.sbin/ypserv/yp_server.c Wed May 25 00:16:52 2016 (r300635) @@ -711,6 +711,7 @@ yp_maplist_create(const char *domain) yp_error("strdup() failed: %s",strerror(errno)); closedir(dird); yp_maplist_free(yp_maplist); + free(cur); return(NULL); } cur->next = yp_maplist; From owner-svn-src-head@freebsd.org Wed May 25 00:25:40 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E3BAB48649; Wed, 25 May 2016 00:25:40 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D39431A4A; Wed, 25 May 2016 00:25:39 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P0Pdf3096238; Wed, 25 May 2016 00:25:39 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P0PdXH096237; Wed, 25 May 2016 00:25:39 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605250025.u4P0PdXH096237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Wed, 25 May 2016 00:25:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300636 - head/usr.sbin/ypserv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 00:25:40 -0000 Author: truckman Date: Wed May 25 00:25:38 2016 New Revision: 300636 URL: https://svnweb.freebsd.org/changeset/base/300636 Log: Delay calling yp_malloc_dnsent() until after some additional sanity checks to avoid leaking memory on error returns. Reported by: Coverity CID: 1007416 MFC after: 1 week Modified: head/usr.sbin/ypserv/yp_dnslookup.c Modified: head/usr.sbin/ypserv/yp_dnslookup.c ============================================================================== --- head/usr.sbin/ypserv/yp_dnslookup.c Wed May 25 00:16:52 2016 (r300635) +++ head/usr.sbin/ypserv/yp_dnslookup.c Wed May 25 00:25:38 2016 (r300636) @@ -489,9 +489,6 @@ yp_async_lookup_addr(struct svc_req *rqs yp_find_dnsqent(svcudp_get_xid(rqstp->rq_xprt),BY_RPC_XID) != NULL) return(YP_TRUE); - if ((q = yp_malloc_dnsent()) == NULL) - return(YP_YPERR); - switch (af) { case AF_INET: if (inet_aton(addr, (struct in_addr *)uaddr) != 1) @@ -516,6 +513,9 @@ yp_async_lookup_addr(struct svc_req *rqs return(YP_YPERR); } + if ((q = yp_malloc_dnsent()) == NULL) + return(YP_YPERR); + if (debug) yp_error("DNS address is: %s", buf); From owner-svn-src-head@freebsd.org Wed May 25 01:23:20 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D01BFB49234; Wed, 25 May 2016 01:23:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 88BD912B7; Wed, 25 May 2016 01:23:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P1NJk1014264; Wed, 25 May 2016 01:23:19 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P1NJlY014263; Wed, 25 May 2016 01:23:19 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201605250123.u4P1NJlY014263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits <jhibbits@FreeBSD.org> Date: Wed, 25 May 2016 01:23:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300637 - head/sys/dev/dpaa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 01:23:20 -0000 Author: jhibbits Date: Wed May 25 01:23:19 2016 New Revision: 300637 URL: https://svnweb.freebsd.org/changeset/base/300637 Log: Set the TLB caching properties for portals at attach time. This was found while reworking the device tree nodes for dtsec to match the Linux device tree. Instead of waiting and expecting later code to call dpaa_portal_map_registers(), do the equivalent immediately upon mapping. Otherwise, it's possible to access the pages before that function is called, and hang the CPU. Modified: head/sys/dev/dpaa/portals_common.c Modified: head/sys/dev/dpaa/portals_common.c ============================================================================== --- head/sys/dev/dpaa/portals_common.c Wed May 25 00:25:38 2016 (r300636) +++ head/sys/dev/dpaa/portals_common.c Wed May 25 01:23:19 2016 (r300637) @@ -76,9 +76,12 @@ dpaa_portal_alloc_res(device_t dev, stru SYS_RES_MEMORY, &sc->sc_rrid[0], rle->start + sc->sc_dp_pa, rle->end + sc->sc_dp_pa, rle->count, RF_ACTIVE); if (sc->sc_rres[0] == NULL) { - device_printf(dev, "Could not allocate memory.\n"); + device_printf(dev, + "Could not allocate cache enabled memory.\n"); return (ENXIO); } + tlb1_set_entry(rman_get_bushandle(sc->sc_rres[0]), + rle->start + sc->sc_dp_pa, rle->count, _TLB_ENTRY_MEM); /* Cache inhibited area */ rle = resource_list_find(res, SYS_RES_MEMORY, 1); sc->sc_rrid[1] = 1; @@ -86,11 +89,15 @@ dpaa_portal_alloc_res(device_t dev, stru SYS_RES_MEMORY, &sc->sc_rrid[1], rle->start + sc->sc_dp_pa, rle->end + sc->sc_dp_pa, rle->count, RF_ACTIVE); if (sc->sc_rres[1] == NULL) { - device_printf(dev, "Could not allocate memory.\n"); + device_printf(dev, + "Could not allocate cache inhibited memory.\n"); bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_rrid[0], sc->sc_rres[0]); return (ENXIO); } + tlb1_set_entry(rman_get_bushandle(sc->sc_rres[1]), + rle->start + sc->sc_dp_pa, rle->count, _TLB_ENTRY_IO); + sc->sc_dp[cpu].dp_regs_mapped = 1; } /* Acquire portal's CE_PA and CI_PA */ rle = resource_list_find(res, SYS_RES_MEMORY, 0); From owner-svn-src-head@freebsd.org Wed May 25 01:35:03 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C59DEB4949E; Wed, 25 May 2016 01:35:03 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85F911A3A; Wed, 25 May 2016 01:35:03 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P1Z2wS017293; Wed, 25 May 2016 01:35:02 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P1Z2eE017292; Wed, 25 May 2016 01:35:02 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201605250135.u4P1Z2eE017292@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert <cy@FreeBSD.org> Date: Wed, 25 May 2016 01:35:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300638 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 01:35:03 -0000 Author: cy Date: Wed May 25 01:35:02 2016 New Revision: 300638 URL: https://svnweb.freebsd.org/changeset/base/300638 Log: Use the expiry date to determine whether to replace the DB copy of leapfile instead of using the leapfile serial number (create timestamp). PR: 209577 MFC after: 3 days Modified: head/etc/rc.d/ntpd Modified: head/etc/rc.d/ntpd ============================================================================== --- head/etc/rc.d/ntpd Wed May 25 01:23:19 2016 (r300637) +++ head/etc/rc.d/ntpd Wed May 25 01:35:02 2016 (r300638) @@ -108,8 +108,8 @@ ntpd_fetch_leapfile() { $verbose fetching $url fetch $ntp_leapfile_fetch_opts -o $ntp_tmp_leapfile $url && break done - ntp_ver_no_tmp=$(get_ntp_leapfile_ver $ntp_tmp_leapfile) - if [ "$ntp_ver_no_tmp" -gt "$ntp_ver_no_db" ]; then + ntp_expiry_tmp=$(get_ntp_leapfile_expiry $ntp_tmp_leapfile) + if [ "$ntp_expiry_tmp" -gt "$ntp_leap_expiry" ]; then $verbose using $url as $ntp_db_leapfile mv $ntp_tmp_leapfile $ntp_db_leapfile else From owner-svn-src-head@freebsd.org Wed May 25 01:37:27 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C0D9B49586; Wed, 25 May 2016 01:37:27 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F33F11C34; Wed, 25 May 2016 01:37:26 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P1bQ5I017459; Wed, 25 May 2016 01:37:26 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P1bQ86017456; Wed, 25 May 2016 01:37:26 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605250137.u4P1bQ86017456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Wed, 25 May 2016 01:37:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300639 - head/usr.sbin/ypldap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 01:37:27 -0000 Author: truckman Date: Wed May 25 01:37:25 2016 New Revision: 300639 URL: https://svnweb.freebsd.org/changeset/base/300639 Log: Fix Coverity CIDs 1340544 Resource leak and 1340543 Use after free At line 479 of ldapclient.c in client_build_req(), the error return leaks ldap_attrs (CID 1340544). It looks like this can happen if the first utoa() call in aldap_get_stringset() fails. It looks like other leaks can happen if other utoa() calls fail since scanning this array when it is freed stops when the first NULL is encountered. Fix these problems by not storing NULL in the array when utoa() fails, and by freeing ret and returning NULL if nothing is stored in the array. That way the caller will never see the ldap_attrs[0] == NULL case, so delete that check. The ber_printf_element() calls ber_free_elements() on its ber argument and returns NULL on failure. When each of its callers detects failure, they do a goto fail, which then calls ber_free_elements() with the same pointer (CID 1340543). Fix is to delete the ber_free_elements() from ber_printf_element() Reported by: Coverity CID: 1340543, 1340544 Reviewed by: araujo Differential Revision: https://reviews.freebsd.org/D6550 Modified: head/usr.sbin/ypldap/aldap.c head/usr.sbin/ypldap/ber.c head/usr.sbin/ypldap/ldapclient.c Modified: head/usr.sbin/ypldap/aldap.c ============================================================================== --- head/usr.sbin/ypldap/aldap.c Wed May 25 01:35:02 2016 (r300638) +++ head/usr.sbin/ypldap/aldap.c Wed May 25 01:37:25 2016 (r300639) @@ -716,12 +716,19 @@ aldap_get_stringset(struct ber_element * return NULL; for (a = elm, i = 0; a != NULL && a->be_type == BER_TYPE_OCTETSTRING; - a = a->be_next, i++) { + a = a->be_next) { ber_get_string(a, &s); ret[i] = utoa(s); + if (ret[i] != NULL) + i++; + } - ret[i + 1] = NULL; + if (i == 0) { + free(ret); + return NULL; + } + ret[i] = NULL; return ret; } Modified: head/usr.sbin/ypldap/ber.c ============================================================================== --- head/usr.sbin/ypldap/ber.c Wed May 25 01:35:02 2016 (r300638) +++ head/usr.sbin/ypldap/ber.c Wed May 25 01:37:25 2016 (r300639) @@ -621,7 +621,6 @@ ber_printf_elements(struct ber_element * return (ber); fail: - ber_free_elements(ber); return (NULL); } Modified: head/usr.sbin/ypldap/ldapclient.c ============================================================================== --- head/usr.sbin/ypldap/ldapclient.c Wed May 25 01:35:02 2016 (r300638) +++ head/usr.sbin/ypldap/ldapclient.c Wed May 25 01:37:25 2016 (r300639) @@ -475,8 +475,6 @@ client_build_req(struct idm *idm, struct } else { if (aldap_match_attr(m, idm->idm_attrs[i], &ldap_attrs) == -1) return (-1); - if (ldap_attrs[0] == NULL) - return (-1); if (strlcat(ir->ir_line, ldap_attrs[0], sizeof(ir->ir_line)) >= sizeof(ir->ir_line)) { aldap_free_attr(ldap_attrs); From owner-svn-src-head@freebsd.org Wed May 25 01:37:40 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73DD2B495B8; Wed, 25 May 2016 01:37:40 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 383241D83; Wed, 25 May 2016 01:37:40 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P1bd4t017509; Wed, 25 May 2016 01:37:39 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P1bd0D017508; Wed, 25 May 2016 01:37:39 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201605250137.u4P1bd0D017508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" <ken@FreeBSD.org> Date: Wed, 25 May 2016 01:37:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300640 - head/sys/cam/ata X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 01:37:40 -0000 Author: ken Date: Wed May 25 01:37:39 2016 New Revision: 300640 URL: https://svnweb.freebsd.org/changeset/base/300640 Log: Fix a few ada(4) driver issues: o Some Samsung drives do not support the ATA READ LOG EXT or READ LOG DMA EXT commands, despite indicating that they do in their IDENTIFY data. So, fix this in two ways: 1. Only start the log directory probe (ADA_STATE_LOGDIR) if the drive claims to be an SMR drive in the first place. We don't need to do the extra probing for other devices. This will also serve to prevent problems with other drives that have the same issue. 2. Add quirks for the two Samsung drives that have been reported so far (thanks to Oleg Nauman and Alex Petrov). If there is a reason to do a Read Log later on, we will know that it doesn't work on these drives. o Add a quirk entry to mark Seagate Lamarr Drive Managed drives as drive managed. They don't report this in their Identify data. sys/cam/ata/ata_da.c: Add two new quirks: 1. ADA_Q_LOG_BROKEN, for drives that claim to support Read Log but don't really. 2. ADA_Q_SMR_DM, for drives that are Drive Managed SMR, but don't report it. This can matter for software that wants to know when it should make an extra effort to write sequentially. Record two Samsung drives that don't support Read Log, and one Seagate drive that doesn't report that it is a SMR drive. The Seagate drive is already recorded in the da(4) driver. We may have to come up with a similar solution in the da(4) driver for SATA drives that don't properly support Read Log. In adasetflags(), Dont' set the ADA_FLAG_CAN_LOG bit if the device has the LOG_BROKEN quirk set. Also, look at the SMR_DM quirk and set the device type accordingly if it is actually a drive managed drive. When deciding whether to go into the LOGDIR probe state, look to see whether the device claims to be an SMR device. If not, don't bother with the LOGDIR probe state. Sponsored by: Spectra Logic Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Wed May 25 01:37:25 2016 (r300639) +++ head/sys/cam/ata/ata_da.c Wed May 25 01:37:39 2016 (r300640) @@ -115,12 +115,16 @@ typedef enum { ADA_Q_NONE = 0x00, ADA_Q_4K = 0x01, ADA_Q_NCQ_TRIM_BROKEN = 0x02, + ADA_Q_LOG_BROKEN = 0x04, + ADA_Q_SMR_DM = 0x08 } ada_quirks; #define ADA_Q_BIT_STRING \ "\020" \ "\0014K" \ - "\002NCQ_TRIM_BROKEN" + "\002NCQ_TRIM_BROKEN" \ + "\003LOG_BROKEN" \ + "\004SMR_DM" typedef enum { ADA_CCB_RAHEAD = 0x01, @@ -680,6 +684,35 @@ static struct ada_quirk_entry ada_quirk_ /*quirks*/ADA_Q_4K }, { + /* + * Samsung drive that doesn't support READ LOG EXT or + * READ LOG DMA EXT, despite reporting that it does in + * ATA identify data: + * SAMSUNG HD200HJ KF100-06 + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG HD200*", "*" }, + /*quirks*/ADA_Q_LOG_BROKEN + }, + { + /* + * Samsung drive that doesn't support READ LOG EXT or + * READ LOG DMA EXT, despite reporting that it does in + * ATA identify data: + * SAMSUNG HD501LJ CR100-10 + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG HD501*", "*" }, + /*quirks*/ADA_Q_LOG_BROKEN + }, + { + /* + * Seagate Lamarr 8TB Shingled Magnetic Recording (SMR) + * Drive Managed SATA hard drive. This drive doesn't report + * in firmware that it is a drive managed SMR drive. + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST8000AS0002*", "*" }, + /*quirks*/ADA_Q_SMR_DM + }, + { /* Default */ { T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED, @@ -1258,7 +1291,8 @@ adaasync(void *callback_arg, u_int32_t c softc->state = ADA_STATE_RAHEAD; else if (ADA_WC >= 0 && softc->flags & ADA_FLAG_CAN_RAHEAD) softc->state = ADA_STATE_WCACHE; - else if (softc->flags & ADA_FLAG_CAN_LOG) + else if ((softc->flags & ADA_FLAG_CAN_LOG) + && (softc->zone_mode != ADA_ZONE_NONE)) softc->state = ADA_STATE_LOGDIR; else break; @@ -1581,7 +1615,8 @@ adasetflags(struct ada_softc *softc, str */ adasetdeletemethod(softc); - if (cgd->ident_data.support.extension & ATA_SUPPORT_GENLOG) + if ((cgd->ident_data.support.extension & ATA_SUPPORT_GENLOG) + && ((softc->quirks & ADA_Q_LOG_BROKEN) == 0)) softc->flags |= ADA_FLAG_CAN_LOG; else softc->flags &= ~ADA_FLAG_CAN_LOG; @@ -1589,8 +1624,9 @@ adasetflags(struct ada_softc *softc, str if ((cgd->ident_data.support3 & ATA_SUPPORT_ZONE_MASK) == ATA_SUPPORT_ZONE_HOST_AWARE) softc->zone_mode = ADA_ZONE_HOST_AWARE; - else if ((cgd->ident_data.support3 & ATA_SUPPORT_ZONE_MASK) == - ATA_SUPPORT_ZONE_DEV_MANAGED) + else if (((cgd->ident_data.support3 & ATA_SUPPORT_ZONE_MASK) == + ATA_SUPPORT_ZONE_DEV_MANAGED) + || (softc->quirks & ADA_Q_SMR_DM)) softc->zone_mode = ADA_ZONE_DRIVE_MANAGED; else softc->zone_mode = ADA_ZONE_NONE; @@ -1818,7 +1854,8 @@ adaregister(struct cam_periph *periph, v softc->state = ADA_STATE_RAHEAD; } else if (ADA_WC >= 0 && softc->flags & ADA_FLAG_CAN_WCACHE) { softc->state = ADA_STATE_WCACHE; - } else if (softc->flags & ADA_FLAG_CAN_LOG) { + } else if ((softc->flags & ADA_FLAG_CAN_LOG) + && (softc->zone_mode != ADA_ZONE_NONE)) { softc->state = ADA_STATE_LOGDIR; } else { /* @@ -2863,7 +2900,8 @@ adadone(struct cam_periph *periph, union /* Drop freeze taken due to CAM_DEV_QFREEZE */ cam_release_devq(path, 0, 0, 0, FALSE); - if (softc->flags & ADA_FLAG_CAN_LOG) { + if ((softc->flags & ADA_FLAG_CAN_LOG) + && (softc->zone_mode != ADA_ZONE_NONE)) { xpt_release_ccb(done_ccb); softc->state = ADA_STATE_LOGDIR; xpt_schedule(periph, priority); From owner-svn-src-head@freebsd.org Wed May 25 02:10:32 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06267B49B1A; Wed, 25 May 2016 02:10:32 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A71081D45; Wed, 25 May 2016 02:10:31 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P2AUa2026888; Wed, 25 May 2016 02:10:30 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P2AUh1026887; Wed, 25 May 2016 02:10:30 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605250210.u4P2AUh1026887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Wed, 25 May 2016 02:10:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300642 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 02:10:32 -0000 Author: truckman Date: Wed May 25 02:10:30 2016 New Revision: 300642 URL: https://svnweb.freebsd.org/changeset/base/300642 Log: Match the descriptions of the \H and \h prompt string sequences to reality. They were swapped. X-Confirmed by: jilles MFC after: 1 week Modified: head/bin/sh/sh.1 Modified: head/bin/sh/sh.1 ============================================================================== --- head/bin/sh/sh.1 Wed May 25 01:48:44 2016 (r300641) +++ head/bin/sh/sh.1 Wed May 25 02:10:30 2016 (r300642) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd January 30, 2016 +.Dd May 24, 2016 .Dt SH 1 .Os .Sh NAME @@ -1403,9 +1403,9 @@ may include any of the following formatt which are replaced by the given information: .Bl -tag -width indent .It Li \eH -The local hostname. -.It Li \eh The fully-qualified hostname. +.It Li \eh +The local hostname. .It Li \eW The final component of the current working directory. .It Li \ew From owner-svn-src-head@freebsd.org Wed May 25 02:51:16 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 608C2B47250; Wed, 25 May 2016 02:51:16 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E48010FE; Wed, 25 May 2016 02:51:16 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P2pFGa039029; Wed, 25 May 2016 02:51:15 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P2pFFM039028; Wed, 25 May 2016 02:51:15 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605250251.u4P2pFFM039028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Wed, 25 May 2016 02:51:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300643 - head/bin/mv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 02:51:16 -0000 Author: truckman Date: Wed May 25 02:51:15 2016 New Revision: 300643 URL: https://svnweb.freebsd.org/changeset/base/300643 Log: Close from_fd if malloc() fails to avoid a file descriptor leak. Reported by: Coverity CID: 1007203 MFC after: 1 week Modified: head/bin/mv/mv.c Modified: head/bin/mv/mv.c ============================================================================== --- head/bin/mv/mv.c Wed May 25 02:10:30 2016 (r300642) +++ head/bin/mv/mv.c Wed May 25 02:51:15 2016 (r300643) @@ -286,6 +286,7 @@ fastcopy(const char *from, const char *t } if (bp == NULL && (bp = malloc((size_t)blen)) == NULL) { warnx("malloc(%u) failed", blen); + (void)close(from_fd); return (1); } while ((to_fd = From owner-svn-src-head@freebsd.org Wed May 25 03:30:57 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D9DDB478DE; Wed, 25 May 2016 03:30:57 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04BA91EDB; Wed, 25 May 2016 03:30:56 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P3UuJO052570; Wed, 25 May 2016 03:30:56 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P3Uuw0052569; Wed, 25 May 2016 03:30:56 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605250330.u4P3Uuw0052569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Wed, 25 May 2016 03:30:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300644 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 03:30:57 -0000 Author: sephe Date: Wed May 25 03:30:56 2016 New Revision: 300644 URL: https://svnweb.freebsd.org/changeset/base/300644 Log: hyperv/vmbus: Check hyperv_dmamem_alloc return value Though it is highly unlikely this function would fail w/ BUS_DMA_WAITOK, we had better to check its return value; better safe then sorry here. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6518 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 02:51:15 2016 (r300643) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 03:30:56 2016 (r300644) @@ -321,24 +321,34 @@ vmbus_synic_teardown(void *arg) wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); } -static void +static int vmbus_dma_alloc(struct vmbus_softc *sc) { int cpu; CPU_FOREACH(cpu) { + void *ptr; + /* * Per-cpu messages and event flags. */ - VMBUS_PCPU_GET(sc, message, cpu) = hyperv_dmamem_alloc( - bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE, + ptr = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + PAGE_SIZE, 0, PAGE_SIZE, VMBUS_PCPU_PTR(sc, message_dma, cpu), BUS_DMA_WAITOK | BUS_DMA_ZERO); - VMBUS_PCPU_GET(sc, event_flag, cpu) = hyperv_dmamem_alloc( - bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE, + if (ptr == NULL) + return ENOMEM; + VMBUS_PCPU_GET(sc, message, cpu) = ptr; + + ptr = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + PAGE_SIZE, 0, PAGE_SIZE, VMBUS_PCPU_PTR(sc, event_flag_dma, cpu), BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (ptr == NULL) + return ENOMEM; + VMBUS_PCPU_GET(sc, event_flag, cpu) = ptr; } + return 0; } static void @@ -622,7 +632,9 @@ vmbus_bus_init(void) /* * Allocate DMA stuffs. */ - vmbus_dma_alloc(sc); + ret = vmbus_dma_alloc(sc); + if (ret != 0) + goto cleanup; if (bootverbose) printf("VMBUS: Calling smp_rendezvous, smp_started = %d\n", From owner-svn-src-head@freebsd.org Wed May 25 03:39:43 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9E04B47B8B; Wed, 25 May 2016 03:39:43 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9FB4613A1; Wed, 25 May 2016 03:39:43 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P3dgaX054879; Wed, 25 May 2016 03:39:42 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P3dgKv054878; Wed, 25 May 2016 03:39:42 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605250339.u4P3dgKv054878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Wed, 25 May 2016 03:39:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300645 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 03:39:43 -0000 Author: sephe Date: Wed May 25 03:39:42 2016 New Revision: 300645 URL: https://svnweb.freebsd.org/changeset/base/300645 Log: hyperv/vmbus: Allocate/setup IDT vector after all ISR resources are ready And release IDT vector before releasing ISR resources on interrupt teardown path. We still have some work to do on the interrupt tearing down path. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6519 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 03:30:56 2016 (r300644) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 03:39:42 2016 (r300645) @@ -377,34 +377,17 @@ vmbus_intr_setup(struct vmbus_softc *sc) { int cpu; - /* - * Find a free IDT vector for vmbus messages/events. - */ - sc->vmbus_idtvec = lapic_ipi_alloc(IDTVEC(hv_vmbus_callback)); - if (sc->vmbus_idtvec < 0) { - device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); - return ENXIO; - } - if(bootverbose) { - device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n", - sc->vmbus_idtvec); - } - CPU_FOREACH(cpu) { char buf[MAXCOMLEN + 1]; + cpuset_t cpu_mask; + /* Allocate an interrupt counter for Hyper-V interrupt */ snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu); intrcnt_add(buf, VMBUS_PCPU_PTR(sc, intr_cnt, cpu)); - } - - /* - * Per cpu setup. - */ - CPU_FOREACH(cpu) { - cpuset_t cpu_mask; /* - * Setup taskqueue to handle events + * Setup taskqueue to handle events. Task will be per- + * channel. */ hv_vmbus_g_context.hv_event_queue[cpu] = taskqueue_create_fast("hyperv event", M_WAITOK, @@ -416,7 +399,7 @@ vmbus_intr_setup(struct vmbus_softc *sc) &cpu_mask, "hvevent%d", cpu); /* - * Setup per-cpu tasks and taskqueues to handle msg. + * Setup tasks and taskqueues to handle messages. */ hv_vmbus_g_context.hv_msg_tq[cpu] = taskqueue_create_fast( "hyperv msg", M_WAITOK, taskqueue_thread_enqueue, @@ -428,6 +411,20 @@ vmbus_intr_setup(struct vmbus_softc *sc) TASK_INIT(&hv_vmbus_g_context.hv_msg_task[cpu], 0, vmbus_msg_task, sc); } + + /* + * All Hyper-V ISR required resources are setup, now let's find a + * free IDT vector for Hyper-V ISR and set it up. + */ + sc->vmbus_idtvec = lapic_ipi_alloc(IDTVEC(hv_vmbus_callback)); + if (sc->vmbus_idtvec < 0) { + device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); + return ENXIO; + } + if(bootverbose) { + device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n", + sc->vmbus_idtvec); + } return 0; } @@ -436,6 +433,11 @@ vmbus_intr_teardown(struct vmbus_softc * { int cpu; + if (sc->vmbus_idtvec >= 0) { + lapic_ipi_free(sc->vmbus_idtvec); + sc->vmbus_idtvec = -1; + } + CPU_FOREACH(cpu) { if (hv_vmbus_g_context.hv_event_queue[cpu] != NULL) { taskqueue_free(hv_vmbus_g_context.hv_event_queue[cpu]); @@ -448,10 +450,6 @@ vmbus_intr_teardown(struct vmbus_softc * hv_vmbus_g_context.hv_msg_tq[cpu] = NULL; } } - if (sc->vmbus_idtvec >= 0) { - lapic_ipi_free(sc->vmbus_idtvec); - sc->vmbus_idtvec = -1; - } } static int @@ -623,16 +621,16 @@ vmbus_bus_init(void) sc = vmbus_get_softc(); /* - * Setup interrupt. + * Allocate DMA stuffs. */ - ret = vmbus_intr_setup(sc); + ret = vmbus_dma_alloc(sc); if (ret != 0) goto cleanup; /* - * Allocate DMA stuffs. + * Setup interrupt. */ - ret = vmbus_dma_alloc(sc); + ret = vmbus_intr_setup(sc); if (ret != 0) goto cleanup; @@ -664,8 +662,8 @@ vmbus_bus_init(void) return (ret); cleanup: - vmbus_dma_free(sc); vmbus_intr_teardown(sc); + vmbus_dma_free(sc); return (ret); } @@ -732,8 +730,8 @@ vmbus_detach(device_t dev) smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL); - vmbus_dma_free(sc); vmbus_intr_teardown(sc); + vmbus_dma_free(sc); return (0); } From owner-svn-src-head@freebsd.org Wed May 25 04:59:21 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E5B0B48958; Wed, 25 May 2016 04:59:21 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E7031FCD; Wed, 25 May 2016 04:59:21 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P4xKsI078861; Wed, 25 May 2016 04:59:20 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P4xK1L078857; Wed, 25 May 2016 04:59:20 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605250459.u4P4xK1L078857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Wed, 25 May 2016 04:59:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300646 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 04:59:21 -0000 Author: sephe Date: Wed May 25 04:59:20 2016 New Revision: 300646 URL: https://svnweb.freebsd.org/changeset/base/300646 Log: hyperv/vmbus: Move event/message taskqueue/task to vmbus softc MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6520 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Wed May 25 03:39:42 2016 (r300645) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Wed May 25 04:59:20 2016 (r300646) @@ -202,7 +202,8 @@ hv_vmbus_channel_open( vmbus_on_channel_open(new_channel); - new_channel->rxq = hv_vmbus_g_context.hv_event_queue[new_channel->target_cpu]; + new_channel->rxq = VMBUS_PCPU_GET(vmbus_get_softc(), event_tq, + new_channel->target_cpu); TASK_INIT(&new_channel->channel_task, 0, VmbusProcessChannelEvent, new_channel); /* Allocate the ring buffer */ Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 03:39:42 2016 (r300645) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 04:59:20 2016 (r300646) @@ -177,8 +177,8 @@ hv_vmbus_isr(struct vmbus_softc *sc, str msg = msg_base + HV_VMBUS_MESSAGE_SINT; if (msg->header.message_type != HV_MESSAGE_TYPE_NONE) { - taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[cpu], - &hv_vmbus_g_context.hv_msg_task[cpu]); + taskqueue_enqueue(VMBUS_PCPU_GET(sc, message_tq, cpu), + VMBUS_PCPU_PTR(sc, message_task, cpu)); } return (FILTER_HANDLED); @@ -389,26 +389,25 @@ vmbus_intr_setup(struct vmbus_softc *sc) * Setup taskqueue to handle events. Task will be per- * channel. */ - hv_vmbus_g_context.hv_event_queue[cpu] = - taskqueue_create_fast("hyperv event", M_WAITOK, - taskqueue_thread_enqueue, - &hv_vmbus_g_context.hv_event_queue[cpu]); + VMBUS_PCPU_GET(sc, event_tq, cpu) = taskqueue_create_fast( + "hyperv event", M_WAITOK, taskqueue_thread_enqueue, + VMBUS_PCPU_PTR(sc, event_tq, cpu)); CPU_SETOF(cpu, &cpu_mask); taskqueue_start_threads_cpuset( - &hv_vmbus_g_context.hv_event_queue[cpu], 1, PI_NET, - &cpu_mask, "hvevent%d", cpu); + VMBUS_PCPU_PTR(sc, event_tq, cpu), 1, PI_NET, &cpu_mask, + "hvevent%d", cpu); /* * Setup tasks and taskqueues to handle messages. */ - hv_vmbus_g_context.hv_msg_tq[cpu] = taskqueue_create_fast( + VMBUS_PCPU_GET(sc, message_tq, cpu) = taskqueue_create_fast( "hyperv msg", M_WAITOK, taskqueue_thread_enqueue, - &hv_vmbus_g_context.hv_msg_tq[cpu]); + VMBUS_PCPU_PTR(sc, message_tq, cpu)); CPU_SETOF(cpu, &cpu_mask); taskqueue_start_threads_cpuset( - &hv_vmbus_g_context.hv_msg_tq[cpu], 1, PI_NET, - &cpu_mask, "hvmsg%d", cpu); - TASK_INIT(&hv_vmbus_g_context.hv_msg_task[cpu], 0, + VMBUS_PCPU_PTR(sc, message_tq, cpu), 1, PI_NET, &cpu_mask, + "hvmsg%d", cpu); + TASK_INIT(VMBUS_PCPU_PTR(sc, message_task, cpu), 0, vmbus_msg_task, sc); } @@ -439,15 +438,15 @@ vmbus_intr_teardown(struct vmbus_softc * } CPU_FOREACH(cpu) { - if (hv_vmbus_g_context.hv_event_queue[cpu] != NULL) { - taskqueue_free(hv_vmbus_g_context.hv_event_queue[cpu]); - hv_vmbus_g_context.hv_event_queue[cpu] = NULL; + if (VMBUS_PCPU_GET(sc, event_tq, cpu) != NULL) { + taskqueue_free(VMBUS_PCPU_GET(sc, event_tq, cpu)); + VMBUS_PCPU_GET(sc, event_tq, cpu) = NULL; } - if (hv_vmbus_g_context.hv_msg_tq[cpu] != NULL) { - taskqueue_drain(hv_vmbus_g_context.hv_msg_tq[cpu], - &hv_vmbus_g_context.hv_msg_task[cpu]); - taskqueue_free(hv_vmbus_g_context.hv_msg_tq[cpu]); - hv_vmbus_g_context.hv_msg_tq[cpu] = NULL; + if (VMBUS_PCPU_GET(sc, message_tq, cpu) != NULL) { + taskqueue_drain(VMBUS_PCPU_GET(sc, message_tq, cpu), + VMBUS_PCPU_PTR(sc, message_task, cpu)); + taskqueue_free(VMBUS_PCPU_GET(sc, message_tq, cpu)); + VMBUS_PCPU_GET(sc, message_tq, cpu) = NULL; } } } Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed May 25 03:39:42 2016 (r300645) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed May 25 04:59:20 2016 (r300646) @@ -207,13 +207,6 @@ typedef struct { * For FreeBSD cpuid to Hyper-V vcpuid mapping. */ uint32_t hv_vcpu_index[MAXCPU]; - /* - * Each cpu has its own software interrupt handler for channel - * event and msg handling. - */ - struct taskqueue *hv_event_queue[MAXCPU]; - struct taskqueue *hv_msg_tq[MAXCPU]; - struct task hv_msg_task[MAXCPU]; } hv_vmbus_context; /* Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Wed May 25 03:39:42 2016 (r300645) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Wed May 25 04:59:20 2016 (r300646) @@ -42,11 +42,16 @@ struct vmbus_pcpu_data { /* Rarely used fields */ struct hyperv_dma message_dma; /* busdma glue */ struct hyperv_dma event_flag_dma; /* busdma glue */ + struct taskqueue *event_tq; /* event taskq */ + struct taskqueue *message_tq; /* message taskq */ + struct task message_task; /* message task */ } __aligned(CACHE_LINE_SIZE); struct vmbus_softc { void (*vmbus_event_proc)(struct vmbus_softc *, int); struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; + + /* Rarely used fields */ device_t vmbus_dev; int vmbus_idtvec; }; From owner-svn-src-head@freebsd.org Wed May 25 05:06:17 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2987BB48B12; Wed, 25 May 2016 05:06:17 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E691213E6; Wed, 25 May 2016 05:06:16 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P56GVK081739; Wed, 25 May 2016 05:06:16 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P56FNL081735; Wed, 25 May 2016 05:06:15 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605250506.u4P56FNL081735@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Wed, 25 May 2016 05:06:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300647 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 05:06:17 -0000 Author: sephe Date: Wed May 25 05:06:15 2016 New Revision: 300647 URL: https://svnweb.freebsd.org/changeset/base/300647 Log: hyperv/vmbus: Move vcpuid into vmbus softc per-cpu data MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6521 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed May 25 04:59:20 2016 (r300646) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed May 25 05:06:15 2016 (r300647) @@ -32,7 +32,8 @@ #include <sys/mbuf.h> #include <sys/mutex.h> -#include "hv_vmbus_priv.h" +#include <dev/hyperv/vmbus/hv_vmbus_priv.h> +#include <dev/hyperv/vmbus/vmbus_var.h> /* * Internal functions @@ -301,7 +302,7 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu)); chan->target_cpu = cpu; - chan->target_vcpu = hv_vmbus_g_context.hv_vcpu_index[cpu]; + chan->target_vcpu = VMBUS_PCPU_GET(vmbus_get_softc(), vcpuid, cpu); if (bootverbose) { printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n", @@ -744,7 +745,7 @@ vmbus_select_outgoing_channel(struct hv_ return outgoing_channel; } - cur_vcpu = hv_vmbus_g_context.hv_vcpu_index[smp_pro_id]; + cur_vcpu = VMBUS_PCPU_GET(vmbus_get_softc(), vcpuid, smp_pro_id); TAILQ_FOREACH(new_channel, &primary->sc_list_anchor, sc_list_entry) { if (new_channel->state != HV_CHANNEL_OPENED_STATE){ Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 04:59:20 2016 (r300646) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 05:06:15 2016 (r300647) @@ -213,7 +213,6 @@ vmbus_synic_setup(void *arg __unused) { struct vmbus_softc *sc = vmbus_get_softc(); int cpu; - uint64_t hv_vcpu_index; hv_vmbus_synic_simp simp; hv_vmbus_synic_siefp siefp; hv_vmbus_synic_scontrol sctrl; @@ -271,8 +270,7 @@ vmbus_synic_setup(void *arg __unused) * Set up the cpuid mapping from Hyper-V to FreeBSD. * The array is indexed using FreeBSD cpuid. */ - hv_vcpu_index = rdmsr(HV_X64_MSR_VP_INDEX); - hv_vmbus_g_context.hv_vcpu_index[cpu] = (uint32_t)hv_vcpu_index; + VMBUS_PCPU_GET(sc, vcpuid, cpu) = rdmsr(HV_X64_MSR_VP_INDEX); } static void Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed May 25 04:59:20 2016 (r300646) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed May 25 05:06:15 2016 (r300647) @@ -202,11 +202,6 @@ union vmbus_event_flags; typedef struct { hv_bool_uint8_t syn_ic_initialized; - - /* - * For FreeBSD cpuid to Hyper-V vcpuid mapping. - */ - uint32_t hv_vcpu_index[MAXCPU]; } hv_vmbus_context; /* Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Wed May 25 04:59:20 2016 (r300646) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Wed May 25 05:06:15 2016 (r300647) @@ -36,6 +36,7 @@ struct vmbus_pcpu_data { u_long *intr_cnt; /* Hyper-V interrupt counter */ struct vmbus_message *message; /* shared messages */ + uint32_t vcpuid; /* virtual cpuid */ int event_flag_cnt; /* # of event flags */ union vmbus_event_flags *event_flag; /* shared event flags */ From owner-svn-src-head@freebsd.org Wed May 25 05:12:58 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C6FFB48C99; Wed, 25 May 2016 05:12:58 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0AFD1977; Wed, 25 May 2016 05:12:57 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P5CubY084604; Wed, 25 May 2016 05:12:56 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P5CuvH084602; Wed, 25 May 2016 05:12:56 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605250512.u4P5CuvH084602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Wed, 25 May 2016 05:12:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300648 - head/bin/ps X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 05:12:58 -0000 Author: truckman Date: Wed May 25 05:12:56 2016 New Revision: 300648 URL: https://svnweb.freebsd.org/changeset/base/300648 Log: Fix CID 1011370 (Resource leak) in ps. There is no need to to call strdup() on the value returned by fmt(). The latter calls fmt_argv() which always returns a dynamically allocated string, and calling strdup() on that leaks the memory allocated by fmt_argv(). Wave some const magic on ki_args and ki_env to make the direct assignment happy. This requires a tweak to the asprintf() case to avoid a const vs. non-const mismatch. Reported by: Coverity CID: 1011370 MFC after: 1 week Modified: head/bin/ps/ps.c head/bin/ps/ps.h Modified: head/bin/ps/ps.c ============================================================================== --- head/bin/ps/ps.c Wed May 25 05:06:15 2016 (r300647) +++ head/bin/ps/ps.c Wed May 25 05:12:56 2016 (r300648) @@ -1235,6 +1235,7 @@ fmt(char **(*fn)(kvm_t *, const struct k static void saveuser(KINFO *ki) { + char *argsp; if (ki->ki_p->ki_flag & P_INMEM) { /* @@ -1253,10 +1254,12 @@ saveuser(KINFO *ki) if (ki->ki_p->ki_stat == SZOMB) ki->ki_args = strdup("<defunct>"); else if (UREADOK(ki) || (ki->ki_p->ki_args != NULL)) - ki->ki_args = strdup(fmt(kvm_getargv, ki, - ki->ki_p->ki_comm, ki->ki_p->ki_tdname, MAXCOMLEN)); - else - asprintf(&ki->ki_args, "(%s)", ki->ki_p->ki_comm); + ki->ki_args = fmt(kvm_getargv, ki, + ki->ki_p->ki_comm, ki->ki_p->ki_tdname, MAXCOMLEN); + else { + asprintf(&argsp, "(%s)", ki->ki_p->ki_comm); + ki->ki_args = argsp; + } if (ki->ki_args == NULL) xo_errx(1, "malloc failed"); } else { @@ -1264,8 +1267,8 @@ saveuser(KINFO *ki) } if (needenv) { if (UREADOK(ki)) - ki->ki_env = strdup(fmt(kvm_getenvv, ki, - (char *)NULL, (char *)NULL, 0)); + ki->ki_env = fmt(kvm_getenvv, ki, + (char *)NULL, (char *)NULL, 0); else ki->ki_env = strdup("()"); if (ki->ki_env == NULL) Modified: head/bin/ps/ps.h ============================================================================== --- head/bin/ps/ps.h Wed May 25 05:06:15 2016 (r300647) +++ head/bin/ps/ps.h Wed May 25 05:12:56 2016 (r300648) @@ -42,8 +42,8 @@ typedef struct kinfo_str { typedef struct kinfo { struct kinfo_proc *ki_p; /* kinfo_proc structure */ - char *ki_args; /* exec args */ - char *ki_env; /* environment */ + const char *ki_args; /* exec args */ + const char *ki_env; /* environment */ int ki_valid; /* 1 => uarea stuff valid */ double ki_pcpu; /* calculated in main() */ segsz_t ki_memsize; /* calculated in main() */ From owner-svn-src-head@freebsd.org Wed May 25 05:20:35 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1357B48D38; Wed, 25 May 2016 05:20:35 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BAE21C82; Wed, 25 May 2016 05:20:35 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P5KYi4087036; Wed, 25 May 2016 05:20:34 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P5KY9e087035; Wed, 25 May 2016 05:20:34 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605250520.u4P5KY9e087035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Wed, 25 May 2016 05:20:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300649 - head/bin/setfacl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 05:20:35 -0000 Author: truckman Date: Wed May 25 05:20:34 2016 New Revision: 300649 URL: https://svnweb.freebsd.org/changeset/base/300649 Log: Fix Coverity CID 1019054 (String not null terminated) in setfacl. Increase the size of buf[] by one to allow room for a NUL character at the end. Reported by: Coverity CID: 1019054 MFC after: 1 week Modified: head/bin/setfacl/file.c Modified: head/bin/setfacl/file.c ============================================================================== --- head/bin/setfacl/file.c Wed May 25 05:12:56 2016 (r300648) +++ head/bin/setfacl/file.c Wed May 25 05:20:34 2016 (r300649) @@ -43,7 +43,7 @@ acl_t get_acl_from_file(const char *filename) { FILE *file; - char buf[BUFSIZ]; + char buf[BUFSIZ+1]; if (filename == NULL) err(1, "(null) filename in get_acl_from_file()"); @@ -61,7 +61,7 @@ get_acl_from_file(const char *filename) err(1, "fopen() %s failed", filename); } - fread(buf, sizeof(buf), (size_t)1, file); + fread(buf, sizeof(buf) - 1, (size_t)1, file); if (ferror(file) != 0) { fclose(file); err(1, "error reading from %s", filename); From owner-svn-src-head@freebsd.org Wed May 25 05:22:37 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BF1CB48F45; Wed, 25 May 2016 05:22:37 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AF951045; Wed, 25 May 2016 05:22:37 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P5MaH2087789; Wed, 25 May 2016 05:22:36 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P5Maiw087785; Wed, 25 May 2016 05:22:36 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605250522.u4P5Maiw087785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Wed, 25 May 2016 05:22:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300650 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 05:22:37 -0000 Author: sephe Date: Wed May 25 05:22:35 2016 New Revision: 300650 URL: https://svnweb.freebsd.org/changeset/base/300650 Log: hyperv/vmbus: Move two global flags into vmbus softc And pack them into one flag field. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6522 Modified: head/sys/dev/hyperv/vmbus/hv_hv.c head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_hv.c Wed May 25 05:20:34 2016 (r300649) +++ head/sys/dev/hyperv/vmbus/hv_hv.c Wed May 25 05:22:35 2016 (r300650) @@ -96,13 +96,6 @@ u_int hyperv_recommends; static u_int hyperv_pm_features; static u_int hyperv_features3; -/** - * Globals - */ -hv_vmbus_context hv_vmbus_g_context = { - .syn_ic_initialized = FALSE, -}; - static struct timecounter hv_timecounter = { hv_get_timecount, 0, ~0u, HV_NANOSECONDS_PER_SEC/100, "Hyper-V", HV_NANOSECONDS_PER_SEC/100 }; Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 05:20:34 2016 (r300649) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 05:22:35 2016 (r300650) @@ -68,8 +68,6 @@ __FBSDID("$FreeBSD$"); struct vmbus_softc *vmbus_sc; -static int vmbus_inited; - static char *vmbus_ids[] = { "VMBUS", NULL }; extern inthand_t IDTVEC(hv_vmbus_callback); @@ -264,8 +262,6 @@ vmbus_synic_setup(void *arg __unused) wrmsr(HV_X64_MSR_SCONTROL, sctrl.as_uint64_t); - hv_vmbus_g_context.syn_ic_initialized = TRUE; - /* * Set up the cpuid mapping from Hyper-V to FreeBSD. * The array is indexed using FreeBSD cpuid. @@ -280,9 +276,6 @@ vmbus_synic_teardown(void *arg) hv_vmbus_synic_simp simp; hv_vmbus_synic_siefp siefp; - if (!hv_vmbus_g_context.syn_ic_initialized) - return; - shared_sint.as_uint64_t = rdmsr( HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT); @@ -608,14 +601,12 @@ vmbus_probe(device_t dev) static int vmbus_bus_init(void) { - struct vmbus_softc *sc; + struct vmbus_softc *sc = vmbus_get_softc(); int ret; - if (vmbus_inited) + if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED) return (0); - - vmbus_inited = 1; - sc = vmbus_get_softc(); + sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; /* * Allocate DMA stuffs. @@ -631,10 +622,13 @@ vmbus_bus_init(void) if (ret != 0) goto cleanup; + /* + * Setup SynIC. + */ if (bootverbose) - printf("VMBUS: Calling smp_rendezvous, smp_started = %d\n", - smp_started); + device_printf(sc->vmbus_dev, "smp_started = %d\n", smp_started); smp_rendezvous(NULL, vmbus_synic_setup, NULL, NULL); + sc->vmbus_flags |= VMBUS_FLAG_SYNIC; /* * Connect to VMBus in the root partition @@ -725,7 +719,10 @@ vmbus_detach(device_t dev) hv_vmbus_release_unattached_channels(); hv_vmbus_disconnect(); - smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL); + if (sc->vmbus_flags & VMBUS_FLAG_SYNIC) { + sc->vmbus_flags &= ~VMBUS_FLAG_SYNIC; + smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL); + } vmbus_intr_teardown(sc); vmbus_dma_free(sc); Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed May 25 05:20:34 2016 (r300649) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed May 25 05:22:35 2016 (r300650) @@ -200,10 +200,6 @@ enum { struct vmbus_message; union vmbus_event_flags; -typedef struct { - hv_bool_uint8_t syn_ic_initialized; -} hv_vmbus_context; - /* * Define hypervisor message types */ @@ -635,7 +631,6 @@ typedef enum { * Global variables */ -extern hv_vmbus_context hv_vmbus_g_context; extern hv_vmbus_connection hv_vmbus_g_connection; extern u_int hyperv_features; Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Wed May 25 05:20:34 2016 (r300649) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Wed May 25 05:22:35 2016 (r300650) @@ -55,8 +55,12 @@ struct vmbus_softc { /* Rarely used fields */ device_t vmbus_dev; int vmbus_idtvec; + uint32_t vmbus_flags; /* see VMBUS_FLAG_ */ }; +#define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */ +#define VMBUS_FLAG_SYNIC 0x0002 /* SynIC was setup */ + extern struct vmbus_softc *vmbus_sc; static __inline struct vmbus_softc * From owner-svn-src-head@freebsd.org Wed May 25 05:30:50 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17B3BB490E4; Wed, 25 May 2016 05:30:50 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3762127E; Wed, 25 May 2016 05:30:49 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P5UmNV088085; Wed, 25 May 2016 05:30:48 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P5UmUZ088084; Wed, 25 May 2016 05:30:48 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605250530.u4P5UmUZ088084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Wed, 25 May 2016 05:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300651 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 05:30:50 -0000 Author: sephe Date: Wed May 25 05:30:48 2016 New Revision: 300651 URL: https://svnweb.freebsd.org/changeset/base/300651 Log: hyperv/vmbus: Minor style and white space cleanup MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6523 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 05:22:35 2016 (r300650) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 05:30:48 2016 (r300651) @@ -443,16 +443,11 @@ vmbus_intr_teardown(struct vmbus_softc * } static int -vmbus_read_ivar( - device_t dev, - device_t child, - int index, - uintptr_t* result) +vmbus_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) { struct hv_device *child_dev_ctx = device_get_ivars(child); switch (index) { - case HV_VMBUS_IVAR_TYPE: *result = (uintptr_t) &child_dev_ctx->class_id; return (0); @@ -470,14 +465,9 @@ vmbus_read_ivar( } static int -vmbus_write_ivar( - device_t dev, - device_t child, - int index, - uintptr_t value) +vmbus_write_ivar(device_t dev, device_t child, int index, uintptr_t value) { switch (index) { - case HV_VMBUS_IVAR_TYPE: case HV_VMBUS_IVAR_INSTANCE: case HV_VMBUS_IVAR_DEVCTX: @@ -508,19 +498,16 @@ vmbus_child_pnpinfo_str(device_t dev, de return (0); } -struct hv_device* -hv_vmbus_child_device_create( - hv_guid type, - hv_guid instance, - hv_vmbus_channel* channel) +struct hv_device * +hv_vmbus_child_device_create(hv_guid type, hv_guid instance, + hv_vmbus_channel *channel) { - hv_device* child_dev; + hv_device *child_dev; /* * Allocate the new child device */ - child_dev = malloc(sizeof(hv_device), M_DEVBUF, - M_WAITOK | M_ZERO); + child_dev = malloc(sizeof(hv_device), M_DEVBUF, M_WAITOK | M_ZERO); child_dev->channel = channel; memcpy(&child_dev->class_id, &type, sizeof(hv_guid)); From owner-svn-src-head@freebsd.org Wed May 25 05:37:43 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DFC8B491E0; Wed, 25 May 2016 05:37:43 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 512881883; Wed, 25 May 2016 05:37:43 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P5bgDK090946; Wed, 25 May 2016 05:37:42 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P5bgEK090945; Wed, 25 May 2016 05:37:42 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605250537.u4P5bgEK090945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Wed, 25 May 2016 05:37:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300652 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 05:37:43 -0000 Author: sephe Date: Wed May 25 05:37:42 2016 New Revision: 300652 URL: https://svnweb.freebsd.org/changeset/base/300652 Log: hyperv/vmbus: Pass vmbus softc to vmbus_synic_setup MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6527 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 05:30:48 2016 (r300651) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 05:37:42 2016 (r300652) @@ -207,9 +207,9 @@ hv_vector_handler(struct trapframe *trap } static void -vmbus_synic_setup(void *arg __unused) +vmbus_synic_setup(void *xsc) { - struct vmbus_softc *sc = vmbus_get_softc(); + struct vmbus_softc *sc = xsc; int cpu; hv_vmbus_synic_simp simp; hv_vmbus_synic_siefp siefp; @@ -614,7 +614,7 @@ vmbus_bus_init(void) */ if (bootverbose) device_printf(sc->vmbus_dev, "smp_started = %d\n", smp_started); - smp_rendezvous(NULL, vmbus_synic_setup, NULL, NULL); + smp_rendezvous(NULL, vmbus_synic_setup, NULL, sc); sc->vmbus_flags |= VMBUS_FLAG_SYNIC; /* From owner-svn-src-head@freebsd.org Wed May 25 05:45:44 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 698B3B4932D; Wed, 25 May 2016 05:45:44 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25F651D21; Wed, 25 May 2016 05:45:44 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P5jhAW093851; Wed, 25 May 2016 05:45:43 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P5jhHX093850; Wed, 25 May 2016 05:45:43 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605250545.u4P5jhHX093850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Wed, 25 May 2016 05:45:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300653 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 05:45:44 -0000 Author: sephe Date: Wed May 25 05:45:43 2016 New Revision: 300653 URL: https://svnweb.freebsd.org/changeset/base/300653 Log: hyperv/vmbus: Nuke unnecessary MSR read MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6528 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 05:37:42 2016 (r300652) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 05:45:43 2016 (r300653) @@ -215,16 +215,10 @@ vmbus_synic_setup(void *xsc) hv_vmbus_synic_siefp siefp; hv_vmbus_synic_scontrol sctrl; hv_vmbus_synic_sint shared_sint; - uint64_t version; cpu = PCPU_GET(cpuid); /* - * TODO: Check the version - */ - version = rdmsr(HV_X64_MSR_SVERSION); - - /* * Setup the Synic's message page */ simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); From owner-svn-src-head@freebsd.org Wed May 25 05:53:14 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C3B4B494A0; Wed, 25 May 2016 05:53:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 13AC911A9; Wed, 25 May 2016 05:53:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P5rD20096903; Wed, 25 May 2016 05:53:13 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P5rDo1096901; Wed, 25 May 2016 05:53:13 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605250553.u4P5rDo1096901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Wed, 25 May 2016 05:53:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300654 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 05:53:14 -0000 Author: sephe Date: Wed May 25 05:53:12 2016 New Revision: 300654 URL: https://svnweb.freebsd.org/changeset/base/300654 Log: hyperv/vmbus: Rework SynIC setup and teardown - Avoid bit fields. - Fix SINT setup (preserve required bits). MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6529 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/hyperv_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 05:45:43 2016 (r300653) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 05:53:12 2016 (r300654) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include <dev/hyperv/include/hyperv.h> #include <dev/hyperv/vmbus/hv_vmbus_priv.h> +#include <dev/hyperv/vmbus/hyperv_reg.h> #include <dev/hyperv/vmbus/vmbus_var.h> #include <contrib/dev/acpica/include/acpi.h> @@ -210,100 +211,97 @@ static void vmbus_synic_setup(void *xsc) { struct vmbus_softc *sc = xsc; - int cpu; - hv_vmbus_synic_simp simp; - hv_vmbus_synic_siefp siefp; - hv_vmbus_synic_scontrol sctrl; - hv_vmbus_synic_sint shared_sint; - - cpu = PCPU_GET(cpuid); + int cpu = curcpu; + uint64_t val, orig; + uint32_t sint; /* - * Setup the Synic's message page + * Save virtual processor id. */ - simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); - simp.u.simp_enabled = 1; - simp.u.base_simp_gpa = - VMBUS_PCPU_GET(sc, message_dma.hv_paddr, cpu) >> PAGE_SHIFT; - - wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); + VMBUS_PCPU_GET(sc, vcpuid, cpu) = rdmsr(MSR_HV_VP_INDEX); /* - * Setup the Synic's event page + * Setup the SynIC message. */ - siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); - siefp.u.siefp_enabled = 1; - siefp.u.base_siefp_gpa = - VMBUS_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT; + orig = rdmsr(MSR_HV_SIMP); + val = MSR_HV_SIMP_ENABLE | (orig & MSR_HV_SIMP_RSVD_MASK) | + ((VMBUS_PCPU_GET(sc, message_dma.hv_paddr, cpu) >> PAGE_SHIFT) << + MSR_HV_SIMP_PGSHIFT); + wrmsr(MSR_HV_SIMP, val); - wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); - - /*HV_SHARED_SINT_IDT_VECTOR + 0x20; */ - shared_sint.as_uint64_t = 0; - shared_sint.u.vector = sc->vmbus_idtvec; - shared_sint.u.masked = FALSE; - shared_sint.u.auto_eoi = TRUE; - - wrmsr(HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT, - shared_sint.as_uint64_t); + /* + * Setup the SynIC event flags. + */ + orig = rdmsr(MSR_HV_SIEFP); + val = MSR_HV_SIEFP_ENABLE | (orig & MSR_HV_SIEFP_RSVD_MASK) | + ((VMBUS_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT) << + MSR_HV_SIEFP_PGSHIFT); + wrmsr(MSR_HV_SIEFP, val); - wrmsr(HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT, - shared_sint.as_uint64_t); - /* Enable the global synic bit */ - sctrl.as_uint64_t = rdmsr(HV_X64_MSR_SCONTROL); - sctrl.u.enable = 1; + /* + * Configure and unmask SINT for message and event flags. + */ + sint = MSR_HV_SINT0 + HV_VMBUS_MESSAGE_SINT; + orig = rdmsr(sint); + val = sc->vmbus_idtvec | MSR_HV_SINT_AUTOEOI | + (orig & MSR_HV_SINT_RSVD_MASK); + wrmsr(sint, val); - wrmsr(HV_X64_MSR_SCONTROL, sctrl.as_uint64_t); + /* + * Configure and unmask SINT for timer. + */ + sint = MSR_HV_SINT0 + HV_VMBUS_TIMER_SINT; + orig = rdmsr(sint); + val = sc->vmbus_idtvec | MSR_HV_SINT_AUTOEOI | + (orig & MSR_HV_SINT_RSVD_MASK); + wrmsr(sint, val); /* - * Set up the cpuid mapping from Hyper-V to FreeBSD. - * The array is indexed using FreeBSD cpuid. + * All done; enable SynIC. */ - VMBUS_PCPU_GET(sc, vcpuid, cpu) = rdmsr(HV_X64_MSR_VP_INDEX); + orig = rdmsr(MSR_HV_SCONTROL); + val = MSR_HV_SCTRL_ENABLE | (orig & MSR_HV_SCTRL_RSVD_MASK); + wrmsr(MSR_HV_SCONTROL, val); } static void vmbus_synic_teardown(void *arg) { - hv_vmbus_synic_sint shared_sint; - hv_vmbus_synic_simp simp; - hv_vmbus_synic_siefp siefp; - - shared_sint.as_uint64_t = rdmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT); - - shared_sint.u.masked = 1; + uint64_t orig; + uint32_t sint; /* - * Disable the interrupt 0 + * Disable SynIC. */ - wrmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT, - shared_sint.as_uint64_t); - - shared_sint.as_uint64_t = rdmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT); - - shared_sint.u.masked = 1; + orig = rdmsr(MSR_HV_SCONTROL); + wrmsr(MSR_HV_SCONTROL, (orig & MSR_HV_SCTRL_RSVD_MASK)); /* - * Disable the interrupt 1 + * Mask message and event flags SINT. */ - wrmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT, - shared_sint.as_uint64_t); - simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); - simp.u.simp_enabled = 0; - simp.u.base_simp_gpa = 0; + sint = MSR_HV_SINT0 + HV_VMBUS_MESSAGE_SINT; + orig = rdmsr(sint); + wrmsr(sint, orig | MSR_HV_SINT_MASKED); - wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); + /* + * Mask timer SINT. + */ + sint = MSR_HV_SINT0 + HV_VMBUS_TIMER_SINT; + orig = rdmsr(sint); + wrmsr(sint, orig | MSR_HV_SINT_MASKED); - siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); - siefp.u.siefp_enabled = 0; - siefp.u.base_siefp_gpa = 0; + /* + * Teardown SynIC message. + */ + orig = rdmsr(MSR_HV_SIMP); + wrmsr(MSR_HV_SIMP, (orig & MSR_HV_SIMP_RSVD_MASK)); - wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); + /* + * Teardown SynIC event flags. + */ + orig = rdmsr(MSR_HV_SIEFP); + wrmsr(MSR_HV_SIEFP, (orig & MSR_HV_SIEFP_RSVD_MASK)); } static int Modified: head/sys/dev/hyperv/vmbus/hyperv_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv_reg.h Wed May 25 05:45:43 2016 (r300653) +++ head/sys/dev/hyperv/vmbus/hyperv_reg.h Wed May 25 05:53:12 2016 (r300654) @@ -34,4 +34,29 @@ #define MSR_HV_HYPERCALL_RSVD_MASK 0x0ffeULL #define MSR_HV_HYPERCALL_PGSHIFT 12 +#define MSR_HV_VP_INDEX 0x40000002 + +#define MSR_HV_SCONTROL 0x40000080 +#define MSR_HV_SCTRL_ENABLE 0x0001ULL +#define MSR_HV_SCTRL_RSVD_MASK 0xfffffffffffffffeULL + +#define MSR_HV_SIEFP 0x40000082 +#define MSR_HV_SIEFP_ENABLE 0x0001ULL +#define MSR_HV_SIEFP_RSVD_MASK 0x0ffeULL +#define MSR_HV_SIEFP_PGSHIFT 12 + +#define MSR_HV_SIMP 0x40000083 +#define MSR_HV_SIMP_ENABLE 0x0001ULL +#define MSR_HV_SIMP_RSVD_MASK 0x0ffeULL +#define MSR_HV_SIMP_PGSHIFT 12 + +#define MSR_HV_SINT0 0x40000090 +#define MSR_HV_SINT_VECTOR_MASK 0x00ffULL +#define MSR_HV_SINT_RSVD1_MASK 0xff00ULL +#define MSR_HV_SINT_MASKED 0x00010000ULL +#define MSR_HV_SINT_AUTOEOI 0x00020000ULL +#define MSR_HV_SINT_RSVD2_MASK 0xfffffffffffc0000ULL +#define MSR_HV_SINT_RSVD_MASK (MSR_HV_SINT_RSVD1_MASK | \ + MSR_HV_SINT_RSVD2_MASK) + #endif /* !_HYPERV_REG_H_ */ From owner-svn-src-head@freebsd.org Wed May 25 06:01:49 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 075A2B495DA; Wed, 25 May 2016 06:01:49 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C1C3E14C7; Wed, 25 May 2016 06:01:48 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P61lvG097996; Wed, 25 May 2016 06:01:47 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P61lkI097995; Wed, 25 May 2016 06:01:47 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605250601.u4P61lkI097995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Wed, 25 May 2016 06:01:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300655 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 06:01:49 -0000 Author: sephe Date: Wed May 25 06:01:47 2016 New Revision: 300655 URL: https://svnweb.freebsd.org/changeset/base/300655 Log: hyperv: Preserve required bits when disable Hypercall MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6530 Modified: head/sys/dev/hyperv/vmbus/hv_hv.c Modified: head/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_hv.c Wed May 25 05:53:12 2016 (r300654) +++ head/sys/dev/hyperv/vmbus/hv_hv.c Wed May 25 06:01:47 2016 (r300655) @@ -390,11 +390,14 @@ SYSINIT(hypercall_ctor, SI_SUB_DRIVERS, static void hypercall_destroy(void *arg __unused) { + uint64_t hc; + if (hypercall_context.hc_addr == NULL) return; /* Disable Hypercall */ - wrmsr(MSR_HV_HYPERCALL, 0); + hc = rdmsr(MSR_HV_HYPERCALL); + wrmsr(MSR_HV_HYPERCALL, (hc & MSR_HV_HYPERCALL_RSVD_MASK)); hypercall_memfree(); if (bootverbose) From owner-svn-src-head@freebsd.org Wed May 25 06:29:25 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38091B4997C; Wed, 25 May 2016 06:29:25 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E45F41246; Wed, 25 May 2016 06:29:24 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P6TOCK006436; Wed, 25 May 2016 06:29:24 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P6TOQ6006434; Wed, 25 May 2016 06:29:24 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201605250629.u4P6TOQ6006434@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov <sgalabov@FreeBSD.org> Date: Wed, 25 May 2016 06:29:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300657 - head/sys/dev/ral X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 06:29:25 -0000 Author: sgalabov Date: Wed May 25 06:29:23 2016 New Revision: 300657 URL: https://svnweb.freebsd.org/changeset/base/300657 Log: Align radiotap structures in ral(4) Currently all radiotap structures in ral(4) are packed, but are not aligned, which causes ral based devices to crash when one does 'ifconfig wlan0 up' for a wlan interface with a ral wlandev on arches that care about structure alignment (e.g., MIPS). Adding an aligned attribute helps fix this problem and ral devices can be properly brought up. Reviewed by: adrian Sponsored by: Smartcom - Bulgaria AD Modified: head/sys/dev/ral/rt2661var.h head/sys/dev/ral/rt2860var.h Modified: head/sys/dev/ral/rt2661var.h ============================================================================== --- head/sys/dev/ral/rt2661var.h Wed May 25 06:15:26 2016 (r300656) +++ head/sys/dev/ral/rt2661var.h Wed May 25 06:29:23 2016 (r300657) @@ -26,7 +26,7 @@ struct rt2661_rx_radiotap_header { uint16_t wr_chan_flags; int8_t wr_antsignal; int8_t wr_antnoise; -} __packed; +} __packed __aligned(8); #define RT2661_RX_RADIOTAP_PRESENT \ ((1 << IEEE80211_RADIOTAP_TSFT) | \ @@ -42,7 +42,7 @@ struct rt2661_tx_radiotap_header { uint8_t wt_rate; uint16_t wt_chan_freq; uint16_t wt_chan_flags; -} __packed; +} __packed __aligned(8); #define RT2661_TX_RADIOTAP_PRESENT \ ((1 << IEEE80211_RADIOTAP_FLAGS) | \ Modified: head/sys/dev/ral/rt2860var.h ============================================================================== --- head/sys/dev/ral/rt2860var.h Wed May 25 06:15:26 2016 (r300656) +++ head/sys/dev/ral/rt2860var.h Wed May 25 06:29:23 2016 (r300657) @@ -38,7 +38,7 @@ struct rt2860_rx_radiotap_header { uint8_t wr_antenna; int8_t wr_antsignal; int8_t wr_antnoise; -} __packed; +} __packed __aligned(8); #define RT2860_RX_RADIOTAP_PRESENT \ ((1 << IEEE80211_RADIOTAP_TSFT) | \ @@ -55,7 +55,7 @@ struct rt2860_tx_radiotap_header { uint8_t wt_rate; uint16_t wt_chan_freq; uint16_t wt_chan_flags; -} __packed; +} __packed __aligned(8); #define RT2860_TX_RADIOTAP_PRESENT \ ((1 << IEEE80211_RADIOTAP_FLAGS) | \ From owner-svn-src-head@freebsd.org Wed May 25 06:39:58 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FEEAB49C0C; Wed, 25 May 2016 06:39:58 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F18EF185B; Wed, 25 May 2016 06:39:57 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P6dvw5009606; Wed, 25 May 2016 06:39:57 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P6dmBB009514; Wed, 25 May 2016 06:39:48 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201605250639.u4P6dmBB009514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov <sgalabov@FreeBSD.org> Date: Wed, 25 May 2016 06:39:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300658 - head/sys/gnu/dts/mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 06:39:58 -0000 Author: sgalabov Date: Wed May 25 06:39:48 2016 New Revision: 300658 URL: https://svnweb.freebsd.org/changeset/base/300658 Log: Bring ralink/mediatek DTS files in sync with LEDE This is the last sync with LEDE Project dts files before 11.0. Obtained from: LEDE Project Sponsored by: Smartcom - Bulgaria AD Modified: head/sys/gnu/dts/mips/3G150B.dts head/sys/gnu/dts/mips/3G300M.dts head/sys/gnu/dts/mips/A5-V11.dts head/sys/gnu/dts/mips/AIR3GII.dts head/sys/gnu/dts/mips/ALL0256N-4M.dts head/sys/gnu/dts/mips/ALL0256N-8M.dts head/sys/gnu/dts/mips/ALL5002.dts head/sys/gnu/dts/mips/ALL5003.dts head/sys/gnu/dts/mips/ASL26555-16M.dts head/sys/gnu/dts/mips/ASL26555-8M.dts head/sys/gnu/dts/mips/AWAPN2403.dts head/sys/gnu/dts/mips/AWM002.dtsi head/sys/gnu/dts/mips/ArcherC20i.dts head/sys/gnu/dts/mips/CF-WR800N.dts head/sys/gnu/dts/mips/CS-QR10.dts head/sys/gnu/dts/mips/DB-WRT01.dts head/sys/gnu/dts/mips/DCS-930L-B1.dts head/sys/gnu/dts/mips/DIR-300-B7.dts head/sys/gnu/dts/mips/DIR-320-B1.dts head/sys/gnu/dts/mips/DIR-610-A1.dts head/sys/gnu/dts/mips/DIR-615-H1.dts head/sys/gnu/dts/mips/DIR-620-D1.dts head/sys/gnu/dts/mips/DIR-645.dts head/sys/gnu/dts/mips/DIR-810L.dts head/sys/gnu/dts/mips/DIR-860L-B1.dts head/sys/gnu/dts/mips/E1700.dts head/sys/gnu/dts/mips/EX2700.dts head/sys/gnu/dts/mips/F7C027.dts head/sys/gnu/dts/mips/FIREWRT.dts head/sys/gnu/dts/mips/GL-MT300A.dts head/sys/gnu/dts/mips/GL-MT300N.dts head/sys/gnu/dts/mips/GL-MT750.dts head/sys/gnu/dts/mips/HC5XXX.dtsi head/sys/gnu/dts/mips/HLKRM04.dts head/sys/gnu/dts/mips/HT-TM02.dts head/sys/gnu/dts/mips/JHR-N805R.dts head/sys/gnu/dts/mips/LINKIT7688.dts head/sys/gnu/dts/mips/M2M.dts head/sys/gnu/dts/mips/M3.dts head/sys/gnu/dts/mips/M4-4M.dts head/sys/gnu/dts/mips/M4-8M.dts head/sys/gnu/dts/mips/MINIEMBPLUG.dts head/sys/gnu/dts/mips/MIWIFI-MINI.dts head/sys/gnu/dts/mips/MIWIFI-NANO.dts head/sys/gnu/dts/mips/MLW221.dts head/sys/gnu/dts/mips/MLWG2.dts head/sys/gnu/dts/mips/MPRA1.dts head/sys/gnu/dts/mips/MPRA2.dts head/sys/gnu/dts/mips/MT7620a.dts head/sys/gnu/dts/mips/MT7620a_MT7530.dts head/sys/gnu/dts/mips/MT7620a_MT7610e.dts head/sys/gnu/dts/mips/MT7628.dts head/sys/gnu/dts/mips/MZK-750DHP.dts head/sys/gnu/dts/mips/MZK-DP150N.dts head/sys/gnu/dts/mips/MZK-EX300NP.dts head/sys/gnu/dts/mips/MZK-EX750NP.dts head/sys/gnu/dts/mips/MicroWRT.dts head/sys/gnu/dts/mips/NCS601W.dts head/sys/gnu/dts/mips/NW718.dts head/sys/gnu/dts/mips/OY-0001.dts head/sys/gnu/dts/mips/PBR-M1.dts head/sys/gnu/dts/mips/PSG1208.dts head/sys/gnu/dts/mips/PX-4885-4M.dts head/sys/gnu/dts/mips/PX-4885-8M.dts head/sys/gnu/dts/mips/PX-4885.dtsi head/sys/gnu/dts/mips/RE6500.dts head/sys/gnu/dts/mips/RP-N53.dts head/sys/gnu/dts/mips/RT-G32-B1.dts head/sys/gnu/dts/mips/RT-N14U.dts head/sys/gnu/dts/mips/RT5350F-OLINUXINO-EVB.dts head/sys/gnu/dts/mips/RT5350F-OLINUXINO.dts head/sys/gnu/dts/mips/RUT5XX.dts head/sys/gnu/dts/mips/SAP-G3200U3.dts head/sys/gnu/dts/mips/SK-WB8.dts head/sys/gnu/dts/mips/TINY-AC.dts head/sys/gnu/dts/mips/VOCORE-16M.dts head/sys/gnu/dts/mips/VOCORE-8M.dts head/sys/gnu/dts/mips/VOCORE.dtsi head/sys/gnu/dts/mips/WHR-1166D.dts head/sys/gnu/dts/mips/WHR-300HP2.dts head/sys/gnu/dts/mips/WHR-600D.dts head/sys/gnu/dts/mips/WITI.dts head/sys/gnu/dts/mips/WIZARD8800.dts head/sys/gnu/dts/mips/WIZFI630A.dts head/sys/gnu/dts/mips/WL-330N.dts head/sys/gnu/dts/mips/WL-330N3G.dts head/sys/gnu/dts/mips/WMR-300.dts head/sys/gnu/dts/mips/WNCE2001.dts head/sys/gnu/dts/mips/WNDR3700V5.dts head/sys/gnu/dts/mips/WRH-300CR.dts head/sys/gnu/dts/mips/WRTNODE.dts head/sys/gnu/dts/mips/WRTNODE2.dtsi head/sys/gnu/dts/mips/WSR-1166.dts head/sys/gnu/dts/mips/WSR-600.dts head/sys/gnu/dts/mips/WT1520-4M.dts head/sys/gnu/dts/mips/WT1520-8M.dts head/sys/gnu/dts/mips/WT1520.dtsi head/sys/gnu/dts/mips/WT3020-4M.dts head/sys/gnu/dts/mips/WT3020-8M.dts head/sys/gnu/dts/mips/X5.dts head/sys/gnu/dts/mips/X8.dts head/sys/gnu/dts/mips/Y1.dtsi head/sys/gnu/dts/mips/YOUKU-YK1.dts head/sys/gnu/dts/mips/ZBT-WA05.dts head/sys/gnu/dts/mips/ZBT-WE826.dts head/sys/gnu/dts/mips/ZBT-WG2626.dts head/sys/gnu/dts/mips/ZBT-WG3526.dts head/sys/gnu/dts/mips/ZBT-WR8305RT.dts head/sys/gnu/dts/mips/ZTE-Q7.dts head/sys/gnu/dts/mips/mt7620a.dtsi head/sys/gnu/dts/mips/mt7620n.dtsi head/sys/gnu/dts/mips/mt7621.dtsi head/sys/gnu/dts/mips/rt3352.dtsi head/sys/gnu/dts/mips/rt5350.dtsi Modified: head/sys/gnu/dts/mips/3G150B.dts ============================================================================== --- head/sys/gnu/dts/mips/3G150B.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/3G150B.dts Wed May 25 06:39:48 2016 (r300658) @@ -52,7 +52,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25fl064k"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/3G300M.dts ============================================================================== --- head/sys/gnu/dts/mips/3G300M.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/3G300M.dts Wed May 25 06:39:48 2016 (r300658) @@ -67,7 +67,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l3205d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/A5-V11.dts ============================================================================== --- head/sys/gnu/dts/mips/A5-V11.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/A5-V11.dts Wed May 25 06:39:48 2016 (r300658) @@ -58,7 +58,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "pm25lq032"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/AIR3GII.dts ============================================================================== --- head/sys/gnu/dts/mips/AIR3GII.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/AIR3GII.dts Wed May 25 06:39:48 2016 (r300658) @@ -45,7 +45,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "en25q32b"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/ALL0256N-4M.dts ============================================================================== --- head/sys/gnu/dts/mips/ALL0256N-4M.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/ALL0256N-4M.dts Wed May 25 06:39:48 2016 (r300658) @@ -50,7 +50,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l3205d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/ALL0256N-8M.dts ============================================================================== --- head/sys/gnu/dts/mips/ALL0256N-8M.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/ALL0256N-8M.dts Wed May 25 06:39:48 2016 (r300658) @@ -50,7 +50,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l3205d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/ALL5002.dts ============================================================================== --- head/sys/gnu/dts/mips/ALL5002.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/ALL5002.dts Wed May 25 06:39:48 2016 (r300658) @@ -50,7 +50,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l25635e"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/ALL5003.dts ============================================================================== --- head/sys/gnu/dts/mips/ALL5003.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/ALL5003.dts Wed May 25 06:39:48 2016 (r300658) @@ -50,7 +50,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l25635e"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/ASL26555-16M.dts ============================================================================== --- head/sys/gnu/dts/mips/ASL26555-16M.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/ASL26555-16M.dts Wed May 25 06:39:48 2016 (r300658) @@ -81,7 +81,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25sl12801"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/ASL26555-8M.dts ============================================================================== --- head/sys/gnu/dts/mips/ASL26555-8M.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/ASL26555-8M.dts Wed May 25 06:39:48 2016 (r300658) @@ -81,7 +81,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25sl064p"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/AWAPN2403.dts ============================================================================== --- head/sys/gnu/dts/mips/AWAPN2403.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/AWAPN2403.dts Wed May 25 06:39:48 2016 (r300658) @@ -36,7 +36,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l3205d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/AWM002.dtsi ============================================================================== --- head/sys/gnu/dts/mips/AWM002.dtsi Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/AWM002.dtsi Wed May 25 06:39:48 2016 (r300658) @@ -25,7 +25,7 @@ m25p80: m25p80@0 { #address-cells = <1>; #size-cells = <1>; - reg = <0 0>; + reg = <0>; compatible = "jedec,spi-nor"; spi-max-frequency = <10000000>; @@ -55,7 +55,7 @@ }; &pinctrl { - state_default { + state_default: pinctrl0 { gpio { ralink,group = "i2c", "jtag"; ralink,function = "gpio"; Modified: head/sys/gnu/dts/mips/ArcherC20i.dts ============================================================================== --- head/sys/gnu/dts/mips/ArcherC20i.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/ArcherC20i.dts Wed May 25 06:39:48 2016 (r300658) @@ -33,7 +33,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l6405d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/CF-WR800N.dts ============================================================================== --- head/sys/gnu/dts/mips/CF-WR800N.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/CF-WR800N.dts Wed May 25 06:39:48 2016 (r300658) @@ -66,7 +66,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "w25q64"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/CS-QR10.dts ============================================================================== --- head/sys/gnu/dts/mips/CS-QR10.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/CS-QR10.dts Wed May 25 06:39:48 2016 (r300658) @@ -79,7 +79,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l6405d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/DB-WRT01.dts ============================================================================== --- head/sys/gnu/dts/mips/DB-WRT01.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/DB-WRT01.dts Wed May 25 06:39:48 2016 (r300658) @@ -40,7 +40,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l6405d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/DCS-930L-B1.dts ============================================================================== --- head/sys/gnu/dts/mips/DCS-930L-B1.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/DCS-930L-B1.dts Wed May 25 06:39:48 2016 (r300658) @@ -47,7 +47,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25fl064k"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/DIR-300-B7.dts ============================================================================== --- head/sys/gnu/dts/mips/DIR-300-B7.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/DIR-300-B7.dts Wed May 25 06:39:48 2016 (r300658) @@ -47,7 +47,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25fl064k"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/DIR-320-B1.dts ============================================================================== --- head/sys/gnu/dts/mips/DIR-320-B1.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/DIR-320-B1.dts Wed May 25 06:39:48 2016 (r300658) @@ -69,7 +69,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25fl064k"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/DIR-610-A1.dts ============================================================================== --- head/sys/gnu/dts/mips/DIR-610-A1.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/DIR-610-A1.dts Wed May 25 06:39:48 2016 (r300658) @@ -47,7 +47,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/DIR-615-H1.dts ============================================================================== --- head/sys/gnu/dts/mips/DIR-615-H1.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/DIR-615-H1.dts Wed May 25 06:39:48 2016 (r300658) @@ -62,7 +62,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l3205d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/DIR-620-D1.dts ============================================================================== --- head/sys/gnu/dts/mips/DIR-620-D1.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/DIR-620-D1.dts Wed May 25 06:39:48 2016 (r300658) @@ -41,7 +41,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l6405d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/DIR-645.dts ============================================================================== --- head/sys/gnu/dts/mips/DIR-645.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/DIR-645.dts Wed May 25 06:39:48 2016 (r300658) @@ -69,7 +69,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80"; spi-max-frequency = <25000000>; Modified: head/sys/gnu/dts/mips/DIR-810L.dts ============================================================================== --- head/sys/gnu/dts/mips/DIR-810L.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/DIR-810L.dts Wed May 25 06:39:48 2016 (r300658) @@ -52,7 +52,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/DIR-860L-B1.dts ============================================================================== --- head/sys/gnu/dts/mips/DIR-860L-B1.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/DIR-860L-B1.dts Wed May 25 06:39:48 2016 (r300658) @@ -54,7 +54,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/E1700.dts ============================================================================== --- head/sys/gnu/dts/mips/E1700.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/E1700.dts Wed May 25 06:39:48 2016 (r300658) @@ -57,7 +57,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l6405d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/EX2700.dts ============================================================================== --- head/sys/gnu/dts/mips/EX2700.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/EX2700.dts Wed May 25 06:39:48 2016 (r300658) @@ -95,7 +95,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l3205d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/F7C027.dts ============================================================================== --- head/sys/gnu/dts/mips/F7C027.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/F7C027.dts Wed May 25 06:39:48 2016 (r300658) @@ -63,7 +63,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l12805d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/FIREWRT.dts ============================================================================== --- head/sys/gnu/dts/mips/FIREWRT.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/FIREWRT.dts Wed May 25 06:39:48 2016 (r300658) @@ -55,7 +55,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/GL-MT300A.dts ============================================================================== --- head/sys/gnu/dts/mips/GL-MT300A.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/GL-MT300A.dts Wed May 25 06:39:48 2016 (r300658) @@ -83,7 +83,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "w25q128"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "w25q128"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/GL-MT300N.dts ============================================================================== --- head/sys/gnu/dts/mips/GL-MT300N.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/GL-MT300N.dts Wed May 25 06:39:48 2016 (r300658) @@ -78,7 +78,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "w25q128"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "w25q128"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/GL-MT750.dts ============================================================================== --- head/sys/gnu/dts/mips/GL-MT750.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/GL-MT750.dts Wed May 25 06:39:48 2016 (r300658) @@ -78,7 +78,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "w25q128"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "w25q128"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/HC5XXX.dtsi ============================================================================== --- head/sys/gnu/dts/mips/HC5XXX.dtsi Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/HC5XXX.dtsi Wed May 25 06:39:48 2016 (r300658) @@ -55,7 +55,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "w25q128"; spi-max-frequency = <10000000>; @@ -125,7 +125,7 @@ }; &pinctrl { - state_default { + state_default: pinctrl0 { gpio { ralink,group = "uartf", "wled", "nd_sd"; ralink,function = "gpio"; Modified: head/sys/gnu/dts/mips/HLKRM04.dts ============================================================================== --- head/sys/gnu/dts/mips/HLKRM04.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/HLKRM04.dts Wed May 25 06:39:48 2016 (r300658) @@ -63,7 +63,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25fl064k"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/HT-TM02.dts ============================================================================== --- head/sys/gnu/dts/mips/HT-TM02.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/HT-TM02.dts Wed May 25 06:39:48 2016 (r300658) @@ -52,7 +52,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l6405d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/JHR-N805R.dts ============================================================================== --- head/sys/gnu/dts/mips/JHR-N805R.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/JHR-N805R.dts Wed May 25 06:39:48 2016 (r300658) @@ -45,7 +45,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l3205d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/LINKIT7688.dts ============================================================================== --- head/sys/gnu/dts/mips/LINKIT7688.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/LINKIT7688.dts Wed May 25 06:39:48 2016 (r300658) @@ -115,7 +115,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l25635e"; spi-max-frequency = <40000000>; m25p,chunked-io = <31>; @@ -146,8 +146,8 @@ spidev@1 { #address-cells = <1>; #size-cells = <1>; - compatible = "spidev"; - reg = <1 0>; + compatible = "linux,spidev"; + reg = <1>; spi-max-frequency = <40000000>; }; }; Modified: head/sys/gnu/dts/mips/M2M.dts ============================================================================== --- head/sys/gnu/dts/mips/M2M.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/M2M.dts Wed May 25 06:39:48 2016 (r300658) @@ -51,7 +51,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l6405d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/M3.dts ============================================================================== --- head/sys/gnu/dts/mips/M3.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/M3.dts Wed May 25 06:39:48 2016 (r300658) @@ -43,7 +43,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "w25q32"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/M4-4M.dts ============================================================================== --- head/sys/gnu/dts/mips/M4-4M.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/M4-4M.dts Wed May 25 06:39:48 2016 (r300658) @@ -36,7 +36,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "pm25lq032"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/M4-8M.dts ============================================================================== --- head/sys/gnu/dts/mips/M4-8M.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/M4-8M.dts Wed May 25 06:39:48 2016 (r300658) @@ -36,7 +36,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "gd25q64"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/MINIEMBPLUG.dts ============================================================================== --- head/sys/gnu/dts/mips/MINIEMBPLUG.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MINIEMBPLUG.dts Wed May 25 06:39:48 2016 (r300658) @@ -72,7 +72,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l6405d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/MIWIFI-MINI.dts ============================================================================== --- head/sys/gnu/dts/mips/MIWIFI-MINI.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MIWIFI-MINI.dts Wed May 25 06:39:48 2016 (r300658) @@ -62,7 +62,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "w25q128"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/MIWIFI-NANO.dts ============================================================================== --- head/sys/gnu/dts/mips/MIWIFI-NANO.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MIWIFI-NANO.dts Wed May 25 06:39:48 2016 (r300658) @@ -57,7 +57,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80"; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; Modified: head/sys/gnu/dts/mips/MLW221.dts ============================================================================== --- head/sys/gnu/dts/mips/MLW221.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MLW221.dts Wed May 25 06:39:48 2016 (r300658) @@ -59,7 +59,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25fl129p1"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/MLWG2.dts ============================================================================== --- head/sys/gnu/dts/mips/MLWG2.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MLWG2.dts Wed May 25 06:39:48 2016 (r300658) @@ -59,7 +59,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/MPRA1.dts ============================================================================== --- head/sys/gnu/dts/mips/MPRA1.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MPRA1.dts Wed May 25 06:39:48 2016 (r300658) @@ -58,7 +58,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25fl064k"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/MPRA2.dts ============================================================================== --- head/sys/gnu/dts/mips/MPRA2.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MPRA2.dts Wed May 25 06:39:48 2016 (r300658) @@ -58,7 +58,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25fl064k"; spi-max-frequency = <10000000>; @@ -101,7 +101,8 @@ }; &esw { - mediatek,portmap = <0x2f>; + mediatek,portmap = <0x1>; + mediatek,portdisable = <0x3e>; }; &wmac { Modified: head/sys/gnu/dts/mips/MT7620a.dts ============================================================================== --- head/sys/gnu/dts/mips/MT7620a.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MT7620a.dts Wed May 25 06:39:48 2016 (r300658) @@ -33,7 +33,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "en25q64"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/MT7620a_MT7530.dts ============================================================================== --- head/sys/gnu/dts/mips/MT7620a_MT7530.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MT7620a_MT7530.dts Wed May 25 06:39:48 2016 (r300658) @@ -14,7 +14,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25fl064k"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/MT7620a_MT7610e.dts ============================================================================== --- head/sys/gnu/dts/mips/MT7620a_MT7610e.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MT7620a_MT7610e.dts Wed May 25 06:39:48 2016 (r300658) @@ -37,7 +37,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "en25q64"; spi-max-frequency = <1000000>; Modified: head/sys/gnu/dts/mips/MT7628.dts ============================================================================== --- head/sys/gnu/dts/mips/MT7628.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MT7628.dts Wed May 25 06:39:48 2016 (r300658) @@ -32,7 +32,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "en25q64"; spi-max-frequency = <10000000>; m25p,chunked-io = <32>; Modified: head/sys/gnu/dts/mips/MZK-750DHP.dts ============================================================================== --- head/sys/gnu/dts/mips/MZK-750DHP.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MZK-750DHP.dts Wed May 25 06:39:48 2016 (r300658) @@ -60,7 +60,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l6405d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/MZK-DP150N.dts ============================================================================== --- head/sys/gnu/dts/mips/MZK-DP150N.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MZK-DP150N.dts Wed May 25 06:39:48 2016 (r300658) @@ -40,7 +40,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25fl064k"; spi-max-frequency = <10000000>; @@ -67,11 +67,13 @@ reg = <0x50000 0x3b0000>; }; }; +}; - spidev@1 { +&spi1 { + spidev@0 { compatible = "linux,spidev"; spi-max-frequency = <10000000>; - reg = <1 0>; + reg = <0>; }; }; Modified: head/sys/gnu/dts/mips/MZK-EX300NP.dts ============================================================================== --- head/sys/gnu/dts/mips/MZK-EX300NP.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MZK-EX300NP.dts Wed May 25 06:39:48 2016 (r300658) @@ -75,7 +75,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "w25q64"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/MZK-EX750NP.dts ============================================================================== --- head/sys/gnu/dts/mips/MZK-EX750NP.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MZK-EX750NP.dts Wed May 25 06:39:48 2016 (r300658) @@ -80,7 +80,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "w25q64"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/MicroWRT.dts ============================================================================== --- head/sys/gnu/dts/mips/MicroWRT.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/MicroWRT.dts Wed May 25 06:39:48 2016 (r300658) @@ -45,7 +45,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "w25q128"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/NCS601W.dts ============================================================================== --- head/sys/gnu/dts/mips/NCS601W.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/NCS601W.dts Wed May 25 06:39:48 2016 (r300658) @@ -14,7 +14,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25fl064k"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/NW718.dts ============================================================================== --- head/sys/gnu/dts/mips/NW718.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/NW718.dts Wed May 25 06:39:48 2016 (r300658) @@ -52,7 +52,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l3205d"; spi-max-frequency = <25000000>; Modified: head/sys/gnu/dts/mips/OY-0001.dts ============================================================================== --- head/sys/gnu/dts/mips/OY-0001.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/OY-0001.dts Wed May 25 06:39:48 2016 (r300658) @@ -53,7 +53,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "w25q128"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/PBR-M1.dts ============================================================================== --- head/sys/gnu/dts/mips/PBR-M1.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/PBR-M1.dts Wed May 25 06:39:48 2016 (r300658) @@ -121,7 +121,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/PSG1208.dts ============================================================================== --- head/sys/gnu/dts/mips/PSG1208.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/PSG1208.dts Wed May 25 06:39:48 2016 (r300658) @@ -49,7 +49,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "en25q64"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/PX-4885-4M.dts ============================================================================== --- head/sys/gnu/dts/mips/PX-4885-4M.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/PX-4885-4M.dts Wed May 25 06:39:48 2016 (r300658) @@ -9,7 +9,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l3205d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/PX-4885-8M.dts ============================================================================== --- head/sys/gnu/dts/mips/PX-4885-8M.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/PX-4885-8M.dts Wed May 25 06:39:48 2016 (r300658) @@ -9,7 +9,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l3205d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/PX-4885.dtsi ============================================================================== --- head/sys/gnu/dts/mips/PX-4885.dtsi Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/PX-4885.dtsi Wed May 25 06:39:48 2016 (r300658) @@ -33,7 +33,7 @@ }; &pinctrl { - state_default { + state_default: pinctrl0 { gpio { ralink,group = "i2c", "jtag", "uartf"; ralink,function = "gpio"; Modified: head/sys/gnu/dts/mips/RE6500.dts ============================================================================== --- head/sys/gnu/dts/mips/RE6500.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/RE6500.dts Wed May 25 06:39:48 2016 (r300658) @@ -56,7 +56,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "en25q64"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/RP-N53.dts ============================================================================== --- head/sys/gnu/dts/mips/RP-N53.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/RP-N53.dts Wed May 25 06:39:48 2016 (r300658) @@ -103,7 +103,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/RT-G32-B1.dts ============================================================================== --- head/sys/gnu/dts/mips/RT-G32-B1.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/RT-G32-B1.dts Wed May 25 06:39:48 2016 (r300658) @@ -33,7 +33,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l3205d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/RT-N14U.dts ============================================================================== --- head/sys/gnu/dts/mips/RT-N14U.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/RT-N14U.dts Wed May 25 06:39:48 2016 (r300658) @@ -70,7 +70,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "w25q128"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/RT5350F-OLINUXINO-EVB.dts ============================================================================== --- head/sys/gnu/dts/mips/RT5350F-OLINUXINO-EVB.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/RT5350F-OLINUXINO-EVB.dts Wed May 25 06:39:48 2016 (r300658) @@ -36,7 +36,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25fl064k"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/RT5350F-OLINUXINO.dts ============================================================================== --- head/sys/gnu/dts/mips/RT5350F-OLINUXINO.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/RT5350F-OLINUXINO.dts Wed May 25 06:39:48 2016 (r300658) @@ -14,7 +14,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25fl064k"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/RUT5XX.dts ============================================================================== --- head/sys/gnu/dts/mips/RUT5XX.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/RUT5XX.dts Wed May 25 06:39:48 2016 (r300658) @@ -36,7 +36,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "n25q128a13"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/SAP-G3200U3.dts ============================================================================== --- head/sys/gnu/dts/mips/SAP-G3200U3.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/SAP-G3200U3.dts Wed May 25 06:39:48 2016 (r300658) @@ -51,7 +51,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "en25q64"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/SK-WB8.dts ============================================================================== --- head/sys/gnu/dts/mips/SK-WB8.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/SK-WB8.dts Wed May 25 06:39:48 2016 (r300658) @@ -54,7 +54,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/TINY-AC.dts ============================================================================== --- head/sys/gnu/dts/mips/TINY-AC.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/TINY-AC.dts Wed May 25 06:39:48 2016 (r300658) @@ -70,7 +70,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l6405d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/VOCORE-16M.dts ============================================================================== --- head/sys/gnu/dts/mips/VOCORE-16M.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/VOCORE-16M.dts Wed May 25 06:39:48 2016 (r300658) @@ -9,7 +9,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "w25q128"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/VOCORE-8M.dts ============================================================================== --- head/sys/gnu/dts/mips/VOCORE-8M.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/VOCORE-8M.dts Wed May 25 06:39:48 2016 (r300658) @@ -9,7 +9,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25fl064k"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/VOCORE.dtsi ============================================================================== --- head/sys/gnu/dts/mips/VOCORE.dtsi Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/VOCORE.dtsi Wed May 25 06:39:48 2016 (r300658) @@ -156,7 +156,7 @@ }; &pinctrl { - state_default { + state_default: pinctrl0 { gpio { ralink,group = "jtag", "uartf", "led"; ralink,function = "gpio"; Modified: head/sys/gnu/dts/mips/WHR-1166D.dts ============================================================================== --- head/sys/gnu/dts/mips/WHR-1166D.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/WHR-1166D.dts Wed May 25 06:39:48 2016 (r300658) @@ -90,7 +90,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l6405d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/WHR-300HP2.dts ============================================================================== --- head/sys/gnu/dts/mips/WHR-300HP2.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/WHR-300HP2.dts Wed May 25 06:39:48 2016 (r300658) @@ -90,7 +90,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "s25fl064k"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/WHR-600D.dts ============================================================================== --- head/sys/gnu/dts/mips/WHR-600D.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/WHR-600D.dts Wed May 25 06:39:48 2016 (r300658) @@ -90,7 +90,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l6405d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/WITI.dts ============================================================================== --- head/sys/gnu/dts/mips/WITI.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/WITI.dts Wed May 25 06:39:48 2016 (r300658) @@ -63,7 +63,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/WIZARD8800.dts ============================================================================== --- head/sys/gnu/dts/mips/WIZARD8800.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/WIZARD8800.dts Wed May 25 06:39:48 2016 (r300658) @@ -22,7 +22,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "w25q32"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/WIZFI630A.dts ============================================================================== --- head/sys/gnu/dts/mips/WIZFI630A.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/WIZFI630A.dts Wed May 25 06:39:48 2016 (r300658) @@ -82,7 +82,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "w25q128"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/WL-330N.dts ============================================================================== --- head/sys/gnu/dts/mips/WL-330N.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/WL-330N.dts Wed May 25 06:39:48 2016 (r300658) @@ -47,7 +47,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l3205d"; spi-max-frequency = <10000000>; Modified: head/sys/gnu/dts/mips/WL-330N3G.dts ============================================================================== --- head/sys/gnu/dts/mips/WL-330N3G.dts Wed May 25 06:29:23 2016 (r300657) +++ head/sys/gnu/dts/mips/WL-330N3G.dts Wed May 25 06:39:48 2016 (r300658) @@ -52,7 +52,7 @@ #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; - reg = <0 0>; + reg = <0>; linux,modalias = "m25p80", "mx25l3205d"; spi-max-frequency = <10000000>; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed May 25 06:47:30 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 645BEB49D83; Wed, 25 May 2016 06:47:30 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1BCE51CCC; Wed, 25 May 2016 06:47:30 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P6lT3x012499; Wed, 25 May 2016 06:47:29 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P6lTQD012496; Wed, 25 May 2016 06:47:29 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201605250647.u4P6lTQD012496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov <sgalabov@FreeBSD.org> Date: Wed, 25 May 2016 06:47:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300659 - in head/sys/mips: conf mediatek X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 06:47:30 -0000 Author: sgalabov Date: Wed May 25 06:47:28 2016 New Revision: 300659 URL: https://svnweb.freebsd.org/changeset/base/300659 Log: Build etherswitch support for appropriate Ralink/Mediatek SoCs Etherswitch support is built by default on all SoCs except RT3662/RT3883 as they have no built-in switch and their configurations with external switches are not yet supported. Sponsored by: Smartcom - Bulgaria AD Modified: head/sys/mips/conf/RT3883_FDT head/sys/mips/mediatek/files.mediatek head/sys/mips/mediatek/std.mediatek Modified: head/sys/mips/conf/RT3883_FDT ============================================================================== --- head/sys/mips/conf/RT3883_FDT Wed May 25 06:39:48 2016 (r300658) +++ head/sys/mips/conf/RT3883_FDT Wed May 25 06:47:28 2016 (r300659) @@ -76,3 +76,7 @@ device if_bridge # Extres device ext_resources device clk + +# For now there's no etherswitch support for RT3662/RT3883 +nodevice etherswitch +nodevice mtkswitch Modified: head/sys/mips/mediatek/files.mediatek ============================================================================== --- head/sys/mips/mediatek/files.mediatek Wed May 25 06:39:48 2016 (r300658) +++ head/sys/mips/mediatek/files.mediatek Wed May 25 06:47:28 2016 (r300659) @@ -40,3 +40,8 @@ mips/mips/tick.c standard # Temporary Reset if mips/mediatek/fdt_reset.c standard mips/mediatek/fdt_reset_if.m standard + +# Switch +dev/etherswitch/mtkswitch/mtkswitch.c optional mtkswitch +dev/etherswitch/mtkswitch/mtkswitch_rt3050.c optional mtkswitch +dev/etherswitch/mtkswitch/mtkswitch_mt7620.c optional mtkswitch Modified: head/sys/mips/mediatek/std.mediatek ============================================================================== --- head/sys/mips/mediatek/std.mediatek Wed May 25 06:39:48 2016 (r300658) +++ head/sys/mips/mediatek/std.mediatek Wed May 25 06:47:28 2016 (r300659) @@ -82,3 +82,9 @@ device loop # ether device support device ether + +# ether switch support +device etherswitch +device miibus +device mtkswitch +device mdio From owner-svn-src-head@freebsd.org Wed May 25 06:55:54 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BACEBB49FD3; Wed, 25 May 2016 06:55:54 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BF4410F3; Wed, 25 May 2016 06:55:54 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P6trfr015447; Wed, 25 May 2016 06:55:53 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P6trZO015446; Wed, 25 May 2016 06:55:53 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605250655.u4P6trZO015446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Wed, 25 May 2016 06:55:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300660 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 06:55:54 -0000 Author: truckman Date: Wed May 25 06:55:53 2016 New Revision: 300660 URL: https://svnweb.freebsd.org/changeset/base/300660 Log: Fix 1016718 Resource leak. Don't leak a file descriptor if fchdir() fails. Reported by: Coverity CID: 1016718 MFC after: 1 week Modified: head/lib/libc/gen/fts-compat.c Modified: head/lib/libc/gen/fts-compat.c ============================================================================== --- head/lib/libc/gen/fts-compat.c Wed May 25 06:47:28 2016 (r300659) +++ head/lib/libc/gen/fts-compat.c Wed May 25 06:55:53 2016 (r300660) @@ -573,8 +573,10 @@ __fts_children_44bsd(FTS *sp, int instr) if ((fd = _open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) return (NULL); sp->fts_child = fts_build(sp, instr); - if (fchdir(fd)) + if (fchdir(fd)) { + (void)_close(fd); return (NULL); + } (void)_close(fd); return (sp->fts_child); } From owner-svn-src-head@freebsd.org Wed May 25 07:13:54 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7EB95B492D1; Wed, 25 May 2016 07:13:54 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C0761AC9; Wed, 25 May 2016 07:13:54 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P7DrwM021629; Wed, 25 May 2016 07:13:53 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P7Dr08021628; Wed, 25 May 2016 07:13:53 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605250713.u4P7Dr08021628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Wed, 25 May 2016 07:13:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300662 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 07:13:54 -0000 Author: truckman Date: Wed May 25 07:13:53 2016 New Revision: 300662 URL: https://svnweb.freebsd.org/changeset/base/300662 Log: Fix Coverity CID 1016714 Resource leak in process_file_actions_entry() Don't leak a file descriptor of _dup2() fails (shouldn't happen). Reported by: Coverity CID: 1016714 MFC after: 1 week Modified: head/lib/libc/gen/posix_spawn.c Modified: head/lib/libc/gen/posix_spawn.c ============================================================================== --- head/lib/libc/gen/posix_spawn.c Wed May 25 07:09:54 2016 (r300661) +++ head/lib/libc/gen/posix_spawn.c Wed May 25 07:13:53 2016 (r300662) @@ -140,7 +140,7 @@ process_spawnattr(const posix_spawnattr_ static int process_file_actions_entry(posix_spawn_file_actions_entry_t *fae) { - int fd; + int fd, saved_errno; switch (fae->fae_action) { case FAE_OPEN: @@ -149,8 +149,11 @@ process_file_actions_entry(posix_spawn_f if (fd < 0) return (errno); if (fd != fae->fae_fildes) { - if (_dup2(fd, fae->fae_fildes) == -1) - return (errno); + if (_dup2(fd, fae->fae_fildes) == -1) { + saved_errno = errno; + (void)_close(fd); + return (saved_errno); + } if (_close(fd) != 0) { if (errno == EBADF) return (EBADF); From owner-svn-src-head@freebsd.org Wed May 25 07:26:23 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B2F9B49586; Wed, 25 May 2016 07:26:23 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C191131B; Wed, 25 May 2016 07:26:23 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P7QMTg024713; Wed, 25 May 2016 07:26:22 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P7QM5C024712; Wed, 25 May 2016 07:26:22 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605250726.u4P7QM5C024712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Wed, 25 May 2016 07:26:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300664 - head/lib/libcompat/4.3 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 07:26:23 -0000 Author: truckman Date: Wed May 25 07:26:22 2016 New Revision: 300664 URL: https://svnweb.freebsd.org/changeset/base/300664 Log: Fix Coverity CID 978183 Resource leak in rexec(). Close the socket if connect() fails to avoid leaking it. Reported by: Coverity CID: 978183 MFC after: 1 week Modified: head/lib/libcompat/4.3/rexec.c Modified: head/lib/libcompat/4.3/rexec.c ============================================================================== --- head/lib/libcompat/4.3/rexec.c Wed May 25 07:14:52 2016 (r300663) +++ head/lib/libcompat/4.3/rexec.c Wed May 25 07:26:22 2016 (r300664) @@ -330,6 +330,7 @@ retry: goto retry; } perror(hp->h_name); + (void) close(s); return (-1); } port = 0; From owner-svn-src-head@freebsd.org Wed May 25 07:39:50 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12E9AB498F5; Wed, 25 May 2016 07:39:50 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D85431B78; Wed, 25 May 2016 07:39:49 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P7dn68027773; Wed, 25 May 2016 07:39:49 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P7dngg027772; Wed, 25 May 2016 07:39:49 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605250739.u4P7dngg027772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Wed, 25 May 2016 07:39:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300665 - head/lib/libfetch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 07:39:50 -0000 Author: truckman Date: Wed May 25 07:39:48 2016 New Revision: 300665 URL: https://svnweb.freebsd.org/changeset/base/300665 Log: Don't leak addrinfo in fetch_bind() Reported by: Coverity CID: 1225038 MFC after: 1 week Modified: head/lib/libfetch/common.c Modified: head/lib/libfetch/common.c ============================================================================== --- head/lib/libfetch/common.c Wed May 25 07:26:22 2016 (r300664) +++ head/lib/libfetch/common.c Wed May 25 07:39:48 2016 (r300665) @@ -256,8 +256,11 @@ fetch_bind(int sd, int af, const char *a if ((err = getaddrinfo(addr, NULL, &hints, &res0)) != 0) return (-1); for (res = res0; res; res = res->ai_next) - if (bind(sd, res->ai_addr, res->ai_addrlen) == 0) + if (bind(sd, res->ai_addr, res->ai_addrlen) == 0) { + freeaddrinfo(res0); return (0); + } + freeaddrinfo(res0); return (-1); } From owner-svn-src-head@freebsd.org Wed May 25 07:43:33 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91F68B49D4E; Wed, 25 May 2016 07:43:33 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6248A10CE; Wed, 25 May 2016 07:43:33 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P7hWTh030711; Wed, 25 May 2016 07:43:32 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P7hWTP030710; Wed, 25 May 2016 07:43:32 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605250743.u4P7hWTP030710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Wed, 25 May 2016 07:43:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300666 - head/lib/libfetch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 07:43:33 -0000 Author: truckman Date: Wed May 25 07:43:32 2016 New Revision: 300666 URL: https://svnweb.freebsd.org/changeset/base/300666 Log: Call closedir() before returning from fetchListFile() to avoid a leak. Reported by: Coverity CID: 1016697 MFC after: 1 week Modified: head/lib/libfetch/file.c Modified: head/lib/libfetch/file.c ============================================================================== --- head/lib/libfetch/file.c Wed May 25 07:39:48 2016 (r300665) +++ head/lib/libfetch/file.c Wed May 25 07:43:32 2016 (r300666) @@ -149,5 +149,6 @@ fetchListFile(struct url *u, const char fetch_add_entry(&ue, &size, &len, de->d_name, &us); } + closedir(dir); return (ue); } From owner-svn-src-head@freebsd.org Wed May 25 07:48:38 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36A27B49F63; Wed, 25 May 2016 07:48:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA20E13E0; Wed, 25 May 2016 07:48:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P7mb92030928; Wed, 25 May 2016 07:48:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P7ma5F030925; Wed, 25 May 2016 07:48:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605250748.u4P7ma5F030925@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Wed, 25 May 2016 07:48:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300667 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 07:48:38 -0000 Author: hselasky Date: Wed May 25 07:48:36 2016 New Revision: 300667 URL: https://svnweb.freebsd.org/changeset/base/300667 Log: Check for signals when locking the USB enumeration thread from userspace, so that USB applications can be killed if an enumeration thread should be stuck for various reasons. MFC after: 1 week Modified: head/sys/dev/usb/usb_dev.c head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.h Modified: head/sys/dev/usb/usb_dev.c ============================================================================== --- head/sys/dev/usb/usb_dev.c Wed May 25 07:43:32 2016 (r300666) +++ head/sys/dev/usb/usb_dev.c Wed May 25 07:48:36 2016 (r300667) @@ -228,7 +228,7 @@ usb_ref_device(struct usb_cdev_privdata * We need to grab the enumeration SX-lock before * grabbing the FIFO refs to avoid deadlock at detach! */ - crd->do_unlock = usbd_enum_lock(cpd->udev); + crd->do_unlock = usbd_enum_lock_sig(cpd->udev); mtx_lock(&usb_ref_lock); @@ -236,6 +236,12 @@ usb_ref_device(struct usb_cdev_privdata * Set "is_uref" after grabbing the default SX lock */ crd->is_uref = 1; + + /* check for signal */ + if (crd->do_unlock > 1) { + crd->do_unlock = 0; + goto error; + } } /* check if we are doing an open */ Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Wed May 25 07:43:32 2016 (r300666) +++ head/sys/dev/usb/usb_device.c Wed May 25 07:48:36 2016 (r300667) @@ -2740,7 +2740,7 @@ usbd_device_attached(struct usb_device * /* * The following function locks enumerating the given USB device. If * the lock is already grabbed this function returns zero. Else a - * non-zero value is returned. + * a value of one is returned. */ uint8_t usbd_enum_lock(struct usb_device *udev) @@ -2759,6 +2759,27 @@ usbd_enum_lock(struct usb_device *udev) return (1); } +#if USB_HAVE_UGEN +/* + * This function is the same like usbd_enum_lock() except a value of + * 255 is returned when a signal is pending: + */ +uint8_t +usbd_enum_lock_sig(struct usb_device *udev) +{ + if (sx_xlocked(&udev->enum_sx)) + return (0); + if (sx_xlock_sig(&udev->enum_sx)) + return (255); + if (sx_xlock_sig(&udev->sr_sx)) { + sx_xunlock(&udev->enum_sx); + return (255); + } + mtx_lock(&Giant); + return (1); +} +#endif + /* The following function unlocks enumerating the given USB device. */ void Modified: head/sys/dev/usb/usb_device.h ============================================================================== --- head/sys/dev/usb/usb_device.h Wed May 25 07:43:32 2016 (r300666) +++ head/sys/dev/usb/usb_device.h Wed May 25 07:48:36 2016 (r300667) @@ -314,6 +314,9 @@ void usb_set_device_state(struct usb_dev enum usb_dev_state usb_get_device_state(struct usb_device *); uint8_t usbd_enum_lock(struct usb_device *); +#if USB_HAVE_UGEN +uint8_t usbd_enum_lock_sig(struct usb_device *); +#endif void usbd_enum_unlock(struct usb_device *); void usbd_sr_lock(struct usb_device *); void usbd_sr_unlock(struct usb_device *); From owner-svn-src-head@freebsd.org Wed May 25 08:45:04 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4009B49BA0; Wed, 25 May 2016 08:45:04 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81AB211FE; Wed, 25 May 2016 08:45:04 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P8j38G049161; Wed, 25 May 2016 08:45:03 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P8j3Xg049160; Wed, 25 May 2016 08:45:03 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201605250845.u4P8j3Xg049160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten <ed@FreeBSD.org> Date: Wed, 25 May 2016 08:45:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300669 - head/usr.sbin/pmcstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 08:45:04 -0000 Author: ed Date: Wed May 25 08:45:03 2016 New Revision: 300669 URL: https://svnweb.freebsd.org/changeset/base/300669 Log: Make code compile when basename() is POSIX compliant. The POSIX basename() function is allowed to modify its input buffer, which means its argument is "char *". Pull a copy of the input string before computing the base. Reviewed by: jtl Differential Revision: https://reviews.freebsd.org/D6465 Modified: head/usr.sbin/pmcstat/pmcpl_gprof.c Modified: head/usr.sbin/pmcstat/pmcpl_gprof.c ============================================================================== --- head/usr.sbin/pmcstat/pmcpl_gprof.c Wed May 25 08:09:14 2016 (r300668) +++ head/usr.sbin/pmcstat/pmcpl_gprof.c Wed May 25 08:45:03 2016 (r300669) @@ -310,8 +310,9 @@ pmcstat_callgraph_do_gmon_arcs(void) void pmcpl_gmon_initimage(struct pmcstat_image *pi) { + const char *execpath; int count, nlen; - char *sn; + char *sn, *snbuf; char name[NAME_MAX]; /* @@ -321,9 +322,11 @@ pmcpl_gmon_initimage(struct pmcstat_imag * `basename(path)`+ "~" + NNN + ".gmon" till we get a free * entry. */ - if ((sn = basename(pmcstat_string_unintern(pi->pi_execpath))) == NULL) - err(EX_OSERR, "ERROR: Cannot process \"%s\"", - pmcstat_string_unintern(pi->pi_execpath)); + execpath = pmcstat_string_unintern(pi->pi_execpath); + if ((snbuf = strdup(execpath)) == NULL) + err(EX_OSERR, "ERROR: Cannot copy \"%s\"", execpath); + if ((sn = basename(snbuf)) == NULL) + err(EX_OSERR, "ERROR: Cannot process \"%s\"", execpath); nlen = strlen(sn); nlen = min(nlen, (int) (sizeof(name) - sizeof(".gmon"))); @@ -355,6 +358,7 @@ pmcpl_gmon_initimage(struct pmcstat_imag } } while (count > 0); } + free(snbuf); LIST_INIT(&pi->pi_gmlist); } From owner-svn-src-head@freebsd.org Wed May 25 09:00:06 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0B63B4896D; Wed, 25 May 2016 09:00:06 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE8691AB6; Wed, 25 May 2016 09:00:06 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P905qr052334; Wed, 25 May 2016 09:00:05 GMT (envelope-from n_hibma@FreeBSD.org) Received: (from n_hibma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P9057F052333; Wed, 25 May 2016 09:00:05 GMT (envelope-from n_hibma@FreeBSD.org) Message-Id: <201605250900.u4P9057F052333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: n_hibma set sender to n_hibma@FreeBSD.org using -f From: Nick Hibma <n_hibma@FreeBSD.org> Date: Wed, 25 May 2016 09:00:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300670 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 09:00:07 -0000 Author: n_hibma Date: Wed May 25 09:00:05 2016 New Revision: 300670 URL: https://svnweb.freebsd.org/changeset/base/300670 Log: Change net.link.log_promisc_mode_change to a read-only tunable PR: 166255 Submitted by: eugen.grosbein.net Obtained from: hselasky MFC after: 3 days Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Wed May 25 08:45:03 2016 (r300669) +++ head/sys/net/if.c Wed May 25 09:00:05 2016 (r300670) @@ -115,7 +115,7 @@ SYSCTL_INT(_net_link, OID_AUTO, log_link /* Log promiscuous mode change events */ static int log_promisc_mode_change = 1; -SYSCTL_INT(_net_link, OID_AUTO, log_promisc_mode_change, CTLFLAG_RW, +SYSCTL_INT(_net_link, OID_AUTO, log_promisc_mode_change, CTLFLAG_RDTUN, &log_promisc_mode_change, 1, "log promiscuous mode change events"); From owner-svn-src-head@freebsd.org Wed May 25 09:04:08 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30F7DB48C72; Wed, 25 May 2016 09:04:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7D1F102E; Wed, 25 May 2016 09:04:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P947gO055115; Wed, 25 May 2016 09:04:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P946CY055112; Wed, 25 May 2016 09:04:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605250904.u4P946CY055112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Wed, 25 May 2016 09:04:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300671 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 09:04:08 -0000 Author: hselasky Date: Wed May 25 09:04:06 2016 New Revision: 300671 URL: https://svnweb.freebsd.org/changeset/base/300671 Log: Add checks for SCHEDULER_STOPPED() so that code using the LinuxKPI can run after a panic(). This for example allows a LinuxKPI based graphics stack to receive prints during a panic. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h head/sys/compat/linuxkpi/common/include/linux/wait.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/sched.h Wed May 25 09:00:05 2016 (r300670) +++ head/sys/compat/linuxkpi/common/include/linux/sched.h Wed May 25 09:04:06 2016 (r300671) @@ -91,7 +91,7 @@ CTASSERT(sizeof(((struct thread *)0)->td do { \ void *c; \ \ - if (cold) \ + if (cold || SCHEDULER_STOPPED()) \ break; \ c = curthread; \ sleepq_lock(c); \ Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/wait.h Wed May 25 09:00:05 2016 (r300670) +++ head/sys/compat/linuxkpi/common/include/linux/wait.h Wed May 25 09:04:06 2016 (r300671) @@ -31,6 +31,7 @@ #ifndef _LINUX_WAIT_H_ #define _LINUX_WAIT_H_ +#include <linux/compiler.h> #include <linux/spinlock.h> #include <linux/sched.h> #include <linux/list.h> @@ -81,6 +82,8 @@ do { \ void *c = &(q).wchan; \ if (!(cond)) { \ for (;;) { \ + if (unlikely(SCHEDULER_STOPPED())) \ + break; \ sleepq_lock(c); \ if (cond) { \ sleepq_release(c); \ @@ -100,6 +103,8 @@ do { \ _error = 0; \ if (!(cond)) { \ for (; _error == 0;) { \ + if (unlikely(SCHEDULER_STOPPED())) \ + break; \ sleepq_lock(c); \ if (cond) { \ sleepq_release(c); \ @@ -123,6 +128,8 @@ do { \ \ if (!(cond)) { \ for (; __rc == 0;) { \ + if (unlikely(SCHEDULER_STOPPED())) \ + break; \ sleepq_lock(c); \ if (cond) { \ sleepq_release(c); \ Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Wed May 25 09:00:05 2016 (r300670) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Wed May 25 09:04:06 2016 (r300671) @@ -1093,6 +1093,8 @@ linux_complete_common(struct completion long linux_wait_for_common(struct completion *c, int flags) { + if (unlikely(SCHEDULER_STOPPED())) + return (0); if (flags != 0) flags = SLEEPQ_INTERRUPTIBLE | SLEEPQ_SLEEP; @@ -1123,6 +1125,9 @@ linux_wait_for_timeout_common(struct com { long end = jiffies + timeout; + if (unlikely(SCHEDULER_STOPPED())) + return (0); + if (flags != 0) flags = SLEEPQ_INTERRUPTIBLE | SLEEPQ_SLEEP; else From owner-svn-src-head@freebsd.org Wed May 25 10:09:24 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C48EBB49D66; Wed, 25 May 2016 10:09:24 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 879341004; Wed, 25 May 2016 10:09:24 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PA9Nik073321; Wed, 25 May 2016 10:09:23 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PA9NAP073320; Wed, 25 May 2016 10:09:23 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201605251009.u4PA9NAP073320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus <skra@FreeBSD.org> Date: Wed, 25 May 2016 10:09:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300674 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 10:09:24 -0000 Author: skra Date: Wed May 25 10:09:23 2016 New Revision: 300674 URL: https://svnweb.freebsd.org/changeset/base/300674 Log: Add more info about the issue fixed in r298460. Rephrase some sentences and fix grammar. No functional change. Suggested by: alc Reviewed by: alc Modified: head/sys/arm/arm/pmap-v6.c Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Wed May 25 10:04:53 2016 (r300673) +++ head/sys/arm/arm/pmap-v6.c Wed May 25 10:09:23 2016 (r300674) @@ -3302,10 +3302,16 @@ pmap_update_pte1_action(void *arg) * Change pte1 on current pmap. * Note that kernel pte1 must be changed on all pmaps. * - * By ARM ARM manual, the behaviour is UNPREDICABLE when two or more TLB - * entries map same VA. It's a problem when either promotion or demotion - * is being done. The pte1 update and appropriate TLB flush must be done - * atomically in general. + * According to the architecture reference manual published by ARM, + * the behaviour is UNPREDICTABLE when two or more TLB entries map the same VA. + * According to this manual, UNPREDICTABLE behaviours must never happen in + * a viable system. In contrast, on x86 processors, it is not specified which + * TLB entry mapping the virtual address will be used, but the MMU doesn't + * generate a bogus translation the way it does on Cortex-A8 rev 2 (Beaglebone + * Black). + * + * It's a problem when either promotion or demotion is being done. The pte1 + * update and appropriate TLB flush must be done atomically in general. */ static void pmap_change_pte1(pmap_t pmap, pt1_entry_t *pte1p, vm_offset_t va, @@ -3329,8 +3335,9 @@ pmap_change_pte1(pmap_t pmap, pt1_entry_ * Use break-before-make approach for changing userland * mappings. It can cause L1 translation aborts on other * cores in SMP case. So, special treatment is implemented - * in pmap_fault(). Interrups are disabled here to make it - * without any interruption as quick as possible. + * in pmap_fault(). To reduce the likelihood that another core + * will be affected by the broken mapping, disable interrupts + * until the mapping change is completed. */ cspr = disable_interrupts(PSR_I | PSR_F); pte1_clear(pte1p); @@ -6355,9 +6362,9 @@ pmap_fault(pmap_t pmap, vm_offset_t far, PMAP_LOCK(pmap); #ifdef SMP /* - * Special treatment due to break-before-make approach done when + * Special treatment is due to break-before-make approach done when * pte1 is updated for userland mapping during section promotion or - * demotion. If not catched here, pmap_enter() can find a section + * demotion. If not caught here, pmap_enter() can find a section * mapping on faulting address. That is not allowed. */ if (idx == FAULT_TRAN_L1 && usermode && cp15_ats1cur_check(far) == 0) { From owner-svn-src-head@freebsd.org Wed May 25 11:58:56 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 624B5B49A32; Wed, 25 May 2016 11:58:56 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33B451230; Wed, 25 May 2016 11:58:56 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PBwtcj006571; Wed, 25 May 2016 11:58:55 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PBwtpC006569; Wed, 25 May 2016 11:58:55 GMT (envelope-from br@FreeBSD.org) Message-Id: <201605251158.u4PBwtpC006569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin <br@FreeBSD.org> Date: Wed, 25 May 2016 11:58:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300675 - head/contrib/elftoolchain/libdwarf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 11:58:56 -0000 Author: br Date: Wed May 25 11:58:55 2016 New Revision: 300675 URL: https://svnweb.freebsd.org/changeset/base/300675 Log: Add relocation support for RISC-V. Reviewed by: emaste Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D6559 Modified: head/contrib/elftoolchain/libdwarf/libdwarf.h head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c Modified: head/contrib/elftoolchain/libdwarf/libdwarf.h ============================================================================== --- head/contrib/elftoolchain/libdwarf/libdwarf.h Wed May 25 10:09:23 2016 (r300674) +++ head/contrib/elftoolchain/libdwarf/libdwarf.h Wed May 25 11:58:55 2016 (r300675) @@ -440,6 +440,7 @@ enum Dwarf_ISA { DW_ISA_X86, DW_ISA_X86_64, DW_ISA_AARCH64, + DW_ISA_RISCV, DW_ISA_MAX }; Modified: head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c ============================================================================== --- head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c Wed May 25 10:09:23 2016 (r300674) +++ head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c Wed May 25 11:58:55 2016 (r300675) @@ -54,6 +54,8 @@ _dwarf_get_reloc_type(Dwarf_P_Debug dbg, return (R_ARM_ABS32); case DW_ISA_MIPS: return (is64 ? R_MIPS_64 : R_MIPS_32); + case DW_ISA_RISCV: + return (is64 ? R_RISCV_64 : R_RISCV_32); case DW_ISA_IA64: return (is64 ? R_IA_64_DIR64LSB : R_IA_64_DIR32LSB); default: @@ -106,6 +108,12 @@ _dwarf_get_reloc_size(Dwarf_Debug dbg, D else if (rel_type == R_MIPS_64) return (8); break; + case EM_RISCV: + if (rel_type == R_RISCV_32) + return (4); + else if (rel_type == R_RISCV_64) + return (8); + break; case EM_IA_64: if (rel_type == R_IA_64_SECREL32LSB) return (4); From owner-svn-src-head@freebsd.org Wed May 25 12:03:24 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE8BCB492EC; Wed, 25 May 2016 12:03:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A3ED1BA2; Wed, 25 May 2016 12:03:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PC3NLA009530; Wed, 25 May 2016 12:03:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PC3LC2009507; Wed, 25 May 2016 12:03:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605251203.u4PC3LC2009507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Wed, 25 May 2016 12:03:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300676 - in head/sys: dev/cxgbe/iw_cxgbe dev/mlx5/mlx5_core ofed/drivers/infiniband/core ofed/drivers/infiniband/debug ofed/drivers/infiniband/hw/mlx4 ofed/drivers/infiniband/hw/mthca ... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 12:03:24 -0000 Author: hselasky Date: Wed May 25 12:03:21 2016 New Revision: 300676 URL: https://svnweb.freebsd.org/changeset/base/300676 Log: Prepare for activation of LinuxKPI module parameters as read-only tunable SYSCTL's. Linux module parameters are associated with the module they belong to. FreeBSD does not share this concept of a parent module. Instead add macros which define the prefix to use for the module parameters in the LinuxKPI consumers. While at it convert all "bool" LinuxKPI module parameters to "byte" type, because we don't have a "bool" type of SYSCTL in FreeBSD. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/cxgbe/iw_cxgbe/provider.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/ofed/drivers/infiniband/core/cma.c head/sys/ofed/drivers/infiniband/core/mad.c head/sys/ofed/drivers/infiniband/core/multicast.c head/sys/ofed/drivers/infiniband/core/umem.c head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c head/sys/ofed/drivers/infiniband/debug/memtrack.c head/sys/ofed/drivers/infiniband/hw/mlx4/main.c head/sys/ofed/drivers/infiniband/hw/mthca/mthca_catas.c head/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.c head/sys/ofed/drivers/infiniband/hw/mthca/mthca_main.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h head/sys/ofed/drivers/infiniband/util/madeye.c head/sys/ofed/drivers/net/mlx4/catas.c head/sys/ofed/drivers/net/mlx4/en_main.c head/sys/ofed/drivers/net/mlx4/en_tx.c head/sys/ofed/drivers/net/mlx4/fw.c head/sys/ofed/drivers/net/mlx4/main.c head/sys/ofed/drivers/net/mlx4/port.c Modified: head/sys/dev/cxgbe/iw_cxgbe/provider.c ============================================================================== --- head/sys/dev/cxgbe/iw_cxgbe/provider.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/dev/cxgbe/iw_cxgbe/provider.c Wed May 25 12:03:21 2016 (r300676) @@ -32,6 +32,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#define LINUXKPI_PARAM_PREFIX iw_cxgbe_ + #include "opt_inet.h" #ifdef TCP_OFFLOAD Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed May 25 12:03:21 2016 (r300676) @@ -25,6 +25,8 @@ * $FreeBSD$ */ +#define LINUXKPI_PARAM_PREFIX mlx5_ + #include <linux/kmod.h> #include <linux/module.h> #include <linux/errno.h> Modified: head/sys/ofed/drivers/infiniband/core/cma.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/cma.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/infiniband/core/cma.c Wed May 25 12:03:21 2016 (r300676) @@ -34,6 +34,8 @@ * SOFTWARE. */ +#define LINUXKPI_PARAM_PREFIX ibcore_ + #include <linux/completion.h> #include <linux/in.h> #include <linux/in6.h> Modified: head/sys/ofed/drivers/infiniband/core/mad.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/mad.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/infiniband/core/mad.c Wed May 25 12:03:21 2016 (r300676) @@ -33,6 +33,9 @@ * SOFTWARE. * */ + +#define LINUXKPI_PARAM_PREFIX ibcore_ + #include <linux/dma-mapping.h> #include <linux/slab.h> #include <linux/module.h> Modified: head/sys/ofed/drivers/infiniband/core/multicast.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/multicast.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/infiniband/core/multicast.c Wed May 25 12:03:21 2016 (r300676) @@ -30,6 +30,8 @@ * SOFTWARE. */ +#define LINUXKPI_PARAM_PREFIX ibcore_ + #include <linux/completion.h> #include <linux/dma-mapping.h> #include <linux/err.h> Modified: head/sys/ofed/drivers/infiniband/core/umem.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/umem.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/infiniband/core/umem.c Wed May 25 12:03:21 2016 (r300676) @@ -32,6 +32,8 @@ * SOFTWARE. */ +#define LINUXKPI_PARAM_PREFIX ibcore_ + #include <linux/mm.h> #include <linux/dma-mapping.h> #include <linux/sched.h> Modified: head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c Wed May 25 12:03:21 2016 (r300676) @@ -33,6 +33,8 @@ * SOFTWARE. */ +#define LINUXKPI_PARAM_PREFIX ibcore_ + #include <linux/file.h> #include <linux/fs.h> #include <linux/slab.h> Modified: head/sys/ofed/drivers/infiniband/debug/memtrack.c ============================================================================== --- head/sys/ofed/drivers/infiniband/debug/memtrack.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/infiniband/debug/memtrack.c Wed May 25 12:03:21 2016 (r300676) @@ -19,6 +19,8 @@ Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved. */ +#define LINUXKPI_PARAM_PREFIX memtrack_ + #define C_MEMTRACK_C #ifdef kmalloc Modified: head/sys/ofed/drivers/infiniband/hw/mlx4/main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/hw/mlx4/main.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/infiniband/hw/mlx4/main.c Wed May 25 12:03:21 2016 (r300676) @@ -31,6 +31,8 @@ * SOFTWARE. */ +#define LINUXKPI_PARAM_PREFIX mlx4_ + #include <linux/module.h> #include <linux/slab.h> #include <linux/errno.h> Modified: head/sys/ofed/drivers/infiniband/hw/mthca/mthca_catas.c ============================================================================== --- head/sys/ofed/drivers/infiniband/hw/mthca/mthca_catas.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/infiniband/hw/mthca/mthca_catas.c Wed May 25 12:03:21 2016 (r300676) @@ -30,6 +30,8 @@ * SOFTWARE. */ +#define LINUXKPI_PARAM_PREFIX mthca_ + #include <linux/jiffies.h> #include <linux/timer.h> #include <linux/workqueue.h> Modified: head/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.c ============================================================================== --- head/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.c Wed May 25 12:03:21 2016 (r300676) @@ -32,6 +32,8 @@ * SOFTWARE. */ +#define LINUXKPI_PARAM_PREFIX mthca_ + #include <linux/completion.h> #include <linux/pci.h> #include <linux/errno.h> Modified: head/sys/ofed/drivers/infiniband/hw/mthca/mthca_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/hw/mthca/mthca_main.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/infiniband/hw/mthca/mthca_main.c Wed May 25 12:03:21 2016 (r300676) @@ -32,6 +32,8 @@ * SOFTWARE. */ +#define LINUXKPI_PARAM_PREFIX mthca_ + #include <linux/module.h> #include <linux/errno.h> #include <linux/pci.h> Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Wed May 25 12:03:21 2016 (r300676) @@ -35,6 +35,8 @@ #ifndef _IPOIB_H #define _IPOIB_H +#define LINUXKPI_PARAM_PREFIX ipoib_ + #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ofed.h" Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h Wed May 25 12:03:21 2016 (r300676) @@ -1,6 +1,8 @@ #ifndef _SDP_H_ #define _SDP_H_ +#define LINUXKPI_PARAM_PREFIX ib_sdp_ + #include "opt_ddb.h" #include "opt_inet.h" #include "opt_ofed.h" Modified: head/sys/ofed/drivers/infiniband/util/madeye.c ============================================================================== --- head/sys/ofed/drivers/infiniband/util/madeye.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/infiniband/util/madeye.c Wed May 25 12:03:21 2016 (r300676) @@ -32,6 +32,9 @@ * * $Id$ */ + +#define LINUXKPI_PARAM_PREFIX ib_madeye_ + #include <linux/module.h> #include <linux/device.h> #include <linux/err.h> Modified: head/sys/ofed/drivers/net/mlx4/catas.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/catas.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/net/mlx4/catas.c Wed May 25 12:03:21 2016 (r300676) @@ -31,6 +31,8 @@ * SOFTWARE. */ +#define LINUXKPI_PARAM_PREFIX mlx4_ + #include <linux/workqueue.h> #include <linux/module.h> Modified: head/sys/ofed/drivers/net/mlx4/en_main.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/en_main.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/net/mlx4/en_main.c Wed May 25 12:03:21 2016 (r300676) @@ -31,6 +31,8 @@ * */ +#define LINUXKPI_PARAM_PREFIX mlx4_ + #include <linux/module.h> #include <linux/delay.h> #include <linux/netdevice.h> Modified: head/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/en_tx.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/net/mlx4/en_tx.c Wed May 25 12:03:21 2016 (r300676) @@ -31,6 +31,8 @@ * */ +#define LINUXKPI_PARAM_PREFIX mlx4_ + #include <linux/page.h> #include <linux/mlx4/cq.h> #include <linux/slab.h> Modified: head/sys/ofed/drivers/net/mlx4/fw.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/fw.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/net/mlx4/fw.c Wed May 25 12:03:21 2016 (r300676) @@ -32,6 +32,8 @@ * SOFTWARE. */ +#define LINUXKPI_PARAM_PREFIX mlx4_ + #include <linux/etherdevice.h> #include <linux/mlx4/cmd.h> #include <linux/module.h> @@ -49,8 +51,8 @@ enum { extern void __buggy_use_of_MLX4_GET(void); extern void __buggy_use_of_MLX4_PUT(void); -static bool enable_qos; -module_param(enable_qos, bool, 0444); +static u8 enable_qos; +module_param(enable_qos, byte, 0444); MODULE_PARM_DESC(enable_qos, "Enable Quality of Service support in the HCA (default: off)"); #define MLX4_GET(dest, source, offset) \ Modified: head/sys/ofed/drivers/net/mlx4/main.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/main.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/net/mlx4/main.c Wed May 25 12:03:21 2016 (r300676) @@ -33,6 +33,8 @@ * SOFTWARE. */ +#define LINUXKPI_PARAM_PREFIX mlx4_ + #include <linux/kmod.h> #include <linux/module.h> #include <linux/errno.h> Modified: head/sys/ofed/drivers/net/mlx4/port.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/port.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/net/mlx4/port.c Wed May 25 12:03:21 2016 (r300676) @@ -30,6 +30,8 @@ * SOFTWARE. */ +#define LINUXKPI_PARAM_PREFIX mlx4_ + #include <linux/errno.h> #include <linux/if_ether.h> #include <linux/module.h> From owner-svn-src-head@freebsd.org Wed May 25 12:12:16 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05A71B495A0; Wed, 25 May 2016 12:12:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2D0D1143; Wed, 25 May 2016 12:12:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PCCFQo012594; Wed, 25 May 2016 12:12:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PCCEfJ012592; Wed, 25 May 2016 12:12:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605251212.u4PCCEfJ012592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Wed, 25 May 2016 12:12:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300677 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 12:12:16 -0000 Author: hselasky Date: Wed May 25 12:12:14 2016 New Revision: 300677 URL: https://svnweb.freebsd.org/changeset/base/300677 Log: Implement Linux module parameters as read-only tunable SYSCTLs. Bool module parameters are no longer supported, because there is no equivalent in FreeBSD. There are two macros available which control the behaviour of the LinuxKPI module parameters: - LINUXKPI_PARAM_PARENT allows the consumer to set the SYSCTL parent where the modules parameters will be created. - LINUXKPI_PARAM_PREFIX defines a parameter name prefix, which is added to all created module parameters. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/compat/linuxkpi/common/include/linux/moduleparam.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/moduleparam.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Wed May 25 12:03:21 2016 (r300676) +++ head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Wed May 25 12:12:14 2016 (r300677) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,204 +31,84 @@ #ifndef _LINUX_MODULEPARAM_H_ #define _LINUX_MODULEPARAM_H_ -#include <linux/types.h> - -/* - * These are presently not hooked up to anything. In linux the parameters - * can be set when modules are loaded. On FreeBSD these could be mapped - * to kenv in the future. - */ -struct kernel_param; - -typedef int (*param_set_fn)(const char *val, struct kernel_param *kp); -typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp); - -struct kernel_param { - const char *name; - u16 perm; - u16 flags; - param_set_fn set; - param_get_fn get; - union { - void *arg; - struct kparam_string *str; - struct kparam_array *arr; - } un; -}; - -#define KPARAM_ISBOOL 2 - -struct kparam_string { - unsigned int maxlen; - char *string; -}; - -struct kparam_array -{ - unsigned int max; - unsigned int *num; - param_set_fn set; - param_get_fn get; - unsigned int elemsize; - void *elem; -}; - -static inline void -param_sysinit(struct kernel_param *param) -{ -} - -#define module_param_call(name, set, get, arg, perm) \ - static struct kernel_param __param_##name = \ - { #name, perm, 0, set, get, { arg } }; \ - SYSINIT(name##_param_sysinit, SI_SUB_DRIVERS, SI_ORDER_FIRST, \ - param_sysinit, &__param_##name); - -#define module_param_string(name, string, len, perm) - -#define module_param_named(name, var, type, mode) \ - module_param_call(name, param_set_##type, param_get_##type, &var, mode) - -#define module_param(var, type, mode) \ - module_param_named(var, var, type, mode) - -#define module_param_array(var, type, addr_argc, mode) \ - module_param_named(var, var, type, mode) - -#define MODULE_PARM_DESC(name, desc) - -static inline int -param_set_byte(const char *val, struct kernel_param *kp) -{ - - return 0; -} - -static inline int -param_get_byte(char *buffer, struct kernel_param *kp) -{ - - return 0; -} - - -static inline int -param_set_short(const char *val, struct kernel_param *kp) -{ - - return 0; -} - -static inline int -param_get_short(char *buffer, struct kernel_param *kp) -{ - - return 0; -} - - -static inline int -param_set_ushort(const char *val, struct kernel_param *kp) -{ - - return 0; -} - -static inline int -param_get_ushort(char *buffer, struct kernel_param *kp) -{ - - return 0; -} - - -static inline int -param_set_int(const char *val, struct kernel_param *kp) -{ - - return 0; -} - -static inline int -param_get_int(char *buffer, struct kernel_param *kp) -{ - - return 0; -} - - -static inline int -param_set_uint(const char *val, struct kernel_param *kp) -{ - - return 0; -} - -static inline int -param_get_uint(char *buffer, struct kernel_param *kp) -{ - - return 0; -} - - -static inline int -param_set_long(const char *val, struct kernel_param *kp) -{ - - return 0; -} - -static inline int -param_get_long(char *buffer, struct kernel_param *kp) -{ - - return 0; -} - - -static inline int -param_set_ulong(const char *val, struct kernel_param *kp) -{ - - return 0; -} - -static inline int -param_get_ulong(char *buffer, struct kernel_param *kp) -{ - - return 0; -} - - -static inline int -param_set_charp(const char *val, struct kernel_param *kp) -{ - - return 0; -} - -static inline int -param_get_charp(char *buffer, struct kernel_param *kp) -{ - - return 0; -} +#include <sys/types.h> +#include <sys/sysctl.h> +#include <linux/types.h> -static inline int -param_set_bool(const char *val, struct kernel_param *kp) -{ +#ifndef LINUXKPI_PARAM_PARENT +#define LINUXKPI_PARAM_PARENT _compat_linuxkpi +#endif + +#ifndef LINUXKPI_PARAM_PREFIX +#define LINUXKPI_PARAM_PREFIX /* empty prefix is the default */ +#endif + +#define LINUXKPI_PARAM_CONCAT_SUB(a,b,c,d) a##b##c##d +#define LINUXKPI_PARAM_CONCAT(...) LINUXKPI_PARAM_CONCAT_SUB(__VA_ARGS__) +#define LINUXKPI_PARAM_PASS(...) __VA_ARGS__ +#define LINUXKPI_PARAM_DESC(name) LINUXKPI_PARAM_CONCAT(linuxkpi_,LINUXKPI_PARAM_PREFIX,name,_desc) +#define LINUXKPI_PARAM_NAME(name) LINUXKPI_PARAM_CONCAT(LINUXKPI_PARAM_PREFIX,name,,) + +#define LINUXKPI_PARAM_byte(name, var) \ + extern const char LINUXKPI_PARAM_DESC(name)[]; \ + LINUXKPI_PARAM_PASS(SYSCTL_U8(LINUXKPI_PARAM_PARENT, OID_AUTO, \ + LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_DESC(name))) + +#define LINUXKPI_PARAM_short(name, var) \ + extern const char LINUXKPI_PARAM_DESC(name)[]; \ + LINUXKPI_PARAM_PASS(SYSCTL_S16(LINUXKPI_PARAM_PARENT, OID_AUTO, \ + LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_DESC(name))) + +#define LINUXKPI_PARAM_ushort(name, var) \ + extern const char LINUXKPI_PARAM_DESC(name)[]; \ + LINUXKPI_PARAM_PASS(SYSCTL_U16(LINUXKPI_PARAM_PARENT, OID_AUTO, \ + LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_DESC(name))) + +#define LINUXKPI_PARAM_int(name, var) \ + extern const char LINUXKPI_PARAM_DESC(name)[]; \ + LINUXKPI_PARAM_PASS(SYSCTL_INT(LINUXKPI_PARAM_PARENT, OID_AUTO, \ + LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_DESC(name))) + +#define LINUXKPI_PARAM_uint(name, var) \ + extern const char LINUXKPI_PARAM_DESC(name)[]; \ + LINUXKPI_PARAM_PASS(SYSCTL_UINT(LINUXKPI_PARAM_PARENT, OID_AUTO, \ + LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_DESC(name))) + +#define LINUXKPI_PARAM_long(name, var) \ + extern const char LINUXKPI_PARAM_DESC(name)[]; \ + LINUXKPI_PARAM_PASS(SYSCTL_LONG(LINUXKPI_PARAM_PARENT, OID_AUTO, \ + LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_DESC(name))) + +#define LINUXKPI_PARAM_ulong(name, var) \ + extern const char LINUXKPI_PARAM_DESC(name)[]; \ + LINUXKPI_PARAM_PASS(SYSCTL_ULONG(LINUXKPI_PARAM_PARENT, OID_AUTO, \ + LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_DESC(name))) + +#define module_param_string(name, str, len, perm) \ + extern const char LINUXKPI_PARAM_DESC(name)[]; \ + LINUXKPI_PARAM_PASS(SYSCTL_STRING(LINUXKPI_PARAM_PARENT, OID_AUTO, \ + LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, (str), (len), \ + LINUXKPI_PARAM_DESC(name))) + +#define module_param_named(name, var, type, mode) \ + LINUXKPI_PARAM_##type(name, var) + +#define module_param(var, type, mode) \ + LINUXKPI_PARAM_##type(var, var) - return 0; -} +#define module_param_array(var, type, addr_argc, mode) -static inline int -param_get_bool(char *buffer, struct kernel_param *kp) -{ +#define MODULE_PARM_DESC(name, desc) \ + const char LINUXKPI_PARAM_DESC(name)[] = { desc } - return 0; -} +SYSCTL_DECL(_compat_linuxkpi); -#endif /* _LINUX_MODULEPARAM_H_ */ +#endif /* _LINUX_MODULEPARAM_H_ */ Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Wed May 25 12:03:21 2016 (r300676) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Wed May 25 12:12:14 2016 (r300677) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include <linux/device.h> #include <linux/slab.h> #include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/cdev.h> #include <linux/file.h> #include <linux/sysfs.h> @@ -77,6 +78,8 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_pager.h> +SYSCTL_NODE(_compat, OID_AUTO, linuxkpi, CTLFLAG_RW, 0, "LinuxKPI parameters"); + MALLOC_DEFINE(M_KMALLOC, "linux", "Linux kmalloc compat"); #include <linux/rbtree.h> From owner-svn-src-head@freebsd.org Wed May 25 13:09:08 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BF7AB49482; Wed, 25 May 2016 13:09:08 +0000 (UTC) (envelope-from fanf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DDC761E5D; Wed, 25 May 2016 13:09:07 +0000 (UTC) (envelope-from fanf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PD975M027955; Wed, 25 May 2016 13:09:07 GMT (envelope-from fanf@FreeBSD.org) Received: (from fanf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PD976L027954; Wed, 25 May 2016 13:09:07 GMT (envelope-from fanf@FreeBSD.org) Message-Id: <201605251309.u4PD976L027954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fanf set sender to fanf@FreeBSD.org using -f From: Tony Finch <fanf@FreeBSD.org> Date: Wed, 25 May 2016 13:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300678 - head/usr.bin/whois X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 13:09:08 -0000 Author: fanf Date: Wed May 25 13:09:06 2016 New Revision: 300678 URL: https://svnweb.freebsd.org/changeset/base/300678 Log: Send whois queries for gov.uk names to JANET. Modified: head/usr.bin/whois/whois.c Modified: head/usr.bin/whois/whois.c ============================================================================== --- head/usr.bin/whois/whois.c Wed May 25 12:12:14 2016 (r300677) +++ head/usr.bin/whois/whois.c Wed May 25 13:09:06 2016 (r300678) @@ -101,6 +101,7 @@ static struct { { "-RIPE", RNICHOST }, /* Nominet's whois server doesn't return referrals to JANET */ { ".ac.uk", "ac.uk" QNICHOST_TAIL }, + { ".gov.uk", "ac.uk" QNICHOST_TAIL }, { "", IANAHOST }, /* default */ { NULL, NULL } /* safety belt */ }; From owner-svn-src-head@freebsd.org Wed May 25 13:23:50 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB67DB498B9; Wed, 25 May 2016 13:23:50 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84AB318FC; Wed, 25 May 2016 13:23:49 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 2CEDE1FE024; Wed, 25 May 2016 15:23:47 +0200 (CEST) Subject: Re: svn commit: r299393 - in head: . share/mk To: John Baldwin <jhb@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201605102232.u4AMWNvp000287@repo.freebsd.org> From: Hans Petter Selasky <hps@selasky.org> Message-ID: <08cfa0ac-ad92-c8f9-2141-e72088b17d41@selasky.org> Date: Wed, 25 May 2016 15:27:07 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <201605102232.u4AMWNvp000287@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 13:23:50 -0000 On 05/11/16 00:32, John Baldwin wrote: > Author: jhb > Date: Tue May 10 22:32:23 2016 > New Revision: 299393 > URL: https://svnweb.freebsd.org/changeset/base/299393 > > Log: > Change the default installation directory for modules to /boot/modules. > > Kernel installs always override KMODDIR when installing modules, so > this default setting is only used for standalone module builds. Many > out-of-tree modules manually override KMODDIR already to avoid placing > modules in /boot/kernel. This now makes that behavior the default. > > Discussed on: arch@ > Reviewed by: imp > Relnotes: yes > > Modified: > head/UPDATING > head/share/mk/bsd.own.mk > > Modified: head/UPDATING > ============================================================================== > --- head/UPDATING Tue May 10 22:28:06 2016 (r299392) > +++ head/UPDATING Tue May 10 22:32:23 2016 (r299393) > @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 > disable the most expensive debugging functionality run > "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > > +20160510: > + Kernel modules compiled outside of a kernel build now default to > + installing to /boot/modules instead of /boot/kernel. Many kernel > + modules built this way (such as those in ports) already overrode > + KMODDIR explicitly to install into /boot/modules. However, > + manually building and installing a module from /sys/modules will > + now install to /boot/modules instead of /boot/kernel. > + > 20160414: > The CAM I/O scheduler has been committed to the kernel. There should be > no user visible impact. This does enable NCQ Trim on ada SSDs. While the > > Modified: head/share/mk/bsd.own.mk > ============================================================================== > --- head/share/mk/bsd.own.mk Tue May 10 22:28:06 2016 (r299392) > +++ head/share/mk/bsd.own.mk Tue May 10 22:32:23 2016 (r299393) > @@ -165,11 +165,7 @@ BINGRP?= wheel > BINMODE?= 555 > NOBINMODE?= 444 > > -.if defined(MODULES_WITH_WORLD) > KMODDIR?= /boot/modules > -.else > -KMODDIR?= /boot/kernel > -.endif > KMODOWN?= ${BINOWN} > KMODGRP?= ${BINGRP} > KMODMODE?= ${BINMODE} > Just a small nit: There is a comment in bsd.own.mk which needs updating too: > # > # KMODDIR Base path for loadable kernel modules > # (see kld(4)). [/boot/kernel] --HPS From owner-svn-src-head@freebsd.org Wed May 25 13:48:27 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A896AB4903F; Wed, 25 May 2016 13:48:27 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A1E81750; Wed, 25 May 2016 13:48:27 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PDmQTm040105; Wed, 25 May 2016 13:48:26 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PDmQdA040104; Wed, 25 May 2016 13:48:26 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201605251348.u4PDmQdA040104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen <tuexen@FreeBSD.org> Date: Wed, 25 May 2016 13:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300679 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 13:48:27 -0000 Author: tuexen Date: Wed May 25 13:48:26 2016 New Revision: 300679 URL: https://svnweb.freebsd.org/changeset/base/300679 Log: Count packets as not being delivered only if they are neither processed by a kernel handler nor by a raw socket. MFC after: 1 week Modified: head/sys/netinet/raw_ip.c Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Wed May 25 13:09:06 2016 (r300678) +++ head/sys/netinet/raw_ip.c Wed May 25 13:48:26 2016 (r300679) @@ -132,6 +132,8 @@ int (*ip_rsvp_vif)(struct socket *, stru void (*ip_rsvp_force_done)(struct socket *); #endif /* INET */ +extern struct protosw inetsw[]; + u_long rip_sendspace = 9216; SYSCTL_ULONG(_net_inet_raw, OID_AUTO, maxdgram, CTLFLAG_RW, &rip_sendspace, 0, "Maximum outgoing raw IP datagram size"); @@ -411,9 +413,11 @@ rip_input(struct mbuf **mp, int *offp, i IPSTAT_INC(ips_delivered); INP_RUNLOCK(last); } else { + if (inetsw[ip_protox[ip->ip_p]].pr_input == rip_input) { + IPSTAT_INC(ips_noproto); + IPSTAT_DEC(ips_delivered); + } m_freem(m); - IPSTAT_INC(ips_noproto); - IPSTAT_DEC(ips_delivered); } return (IPPROTO_DONE); } From owner-svn-src-head@freebsd.org Wed May 25 14:08:23 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48399B495B8; Wed, 25 May 2016 14:08:23 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A3B81239; Wed, 25 May 2016 14:08:22 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PE8Muf046174; Wed, 25 May 2016 14:08:22 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PE8LXq046170; Wed, 25 May 2016 14:08:21 GMT (envelope-from br@FreeBSD.org) Message-Id: <201605251408.u4PE8LXq046170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin <br@FreeBSD.org> Date: Wed, 25 May 2016 14:08:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300680 - in head: contrib/netbsd-tests/lib/libc/gen contrib/netbsd-tests/lib/libc/sys lib/libc/riscv lib/libc/riscv/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 14:08:23 -0000 Author: br Date: Wed May 25 14:08:21 2016 New Revision: 300680 URL: https://svnweb.freebsd.org/changeset/base/300680 Log: Remove legacy brk and sbrk from RISC-V. Discussed with: andrew Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Deleted: head/lib/libc/riscv/sys/brk.S head/lib/libc/riscv/sys/sbrk.S Modified: head/contrib/netbsd-tests/lib/libc/gen/t_dir.c head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c head/lib/libc/riscv/Symbol.map head/lib/libc/riscv/sys/Makefile.inc Modified: head/contrib/netbsd-tests/lib/libc/gen/t_dir.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_dir.c Wed May 25 13:48:26 2016 (r300679) +++ head/contrib/netbsd-tests/lib/libc/gen/t_dir.c Wed May 25 14:08:21 2016 (r300680) @@ -111,7 +111,8 @@ ATF_TC_BODY(seekdir_basic, tc) closedir(dp); } -#ifndef __aarch64__ /* There is no sbrk on AArch64 */ +/* There is no sbrk on AArch64 and RISC-V */ +#if !defined(__aarch64__) && !defined(__riscv__) ATF_TC(telldir_leak); ATF_TC_HEAD(telldir_leak, tc) { @@ -161,7 +162,7 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, seekdir_basic); -#ifndef __aarch64__ +#if !defined(__aarch64__) && !defined(__riscv__) ATF_TP_ADD_TC(tp, telldir_leak); #endif Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Wed May 25 13:48:26 2016 (r300679) +++ head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Wed May 25 14:08:21 2016 (r300680) @@ -176,7 +176,7 @@ ATF_TC_BODY(mlock_err, tc) unsigned long vmin = 0; size_t len = sizeof(vmin); #endif -#ifndef __aarch64__ +#if !defined(__aarch64__) && !defined(__riscv__) void *invalid_ptr; #endif int null_errno = ENOMEM; /* error expected for NULL */ @@ -214,7 +214,8 @@ ATF_TC_BODY(mlock_err, tc) errno = 0; ATF_REQUIRE_ERRNO(EINVAL, munlock((char *)-1, page) == -1); -#ifndef __aarch64__ /* There is no sbrk on AArch64 */ +/* There is no sbrk on AArch64 and RISC-V */ +#if !defined(__aarch64__) && !defined(__riscv__) /* * Try to create a pointer to an unmapped page - first after current * brk will likely do. Modified: head/lib/libc/riscv/Symbol.map ============================================================================== --- head/lib/libc/riscv/Symbol.map Wed May 25 13:48:26 2016 (r300679) +++ head/lib/libc/riscv/Symbol.map Wed May 25 14:08:21 2016 (r300680) @@ -28,8 +28,6 @@ FBSD_1.0 { ntohl; ntohs; vfork; - brk; - sbrk; makecontext; }; Modified: head/lib/libc/riscv/sys/Makefile.inc ============================================================================== --- head/lib/libc/riscv/sys/Makefile.inc Wed May 25 13:48:26 2016 (r300679) +++ head/lib/libc/riscv/sys/Makefile.inc Wed May 25 14:08:21 2016 (r300680) @@ -3,10 +3,8 @@ SRCS+= trivial-vdso_tc.c #MDASM= ptrace.S -MDASM= brk.S \ - cerror.S \ +MDASM= cerror.S \ pipe.S \ - sbrk.S \ shmat.S \ sigreturn.S \ syscall.S \ From owner-svn-src-head@freebsd.org Wed May 25 15:35:24 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7796CB4AAD9; Wed, 25 May 2016 15:35:24 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F87E12F5; Wed, 25 May 2016 15:35:24 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PFZNxI073948; Wed, 25 May 2016 15:35:23 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PFZNMv073946; Wed, 25 May 2016 15:35:23 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201605251535.u4PFZNMv073946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" <pfg@FreeBSD.org> Date: Wed, 25 May 2016 15:35:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300683 - head/lib/libc/regex X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 15:35:24 -0000 Author: pfg Date: Wed May 25 15:35:23 2016 New Revision: 300683 URL: https://svnweb.freebsd.org/changeset/base/300683 Log: libc: regexec(3) adjustment. Change the behavior of when REG_STARTEND is combined with REG_NOTBOL. From the original posting[1]: "Enable the assumption that pmatch[0].rm_so is a continuation offset to a string and allows us to do a proper assessment of the character in regards to it's word position ('^' or '\<'), without risking going into unallocated memory." This change makes us similar to how glibc handles REG_STARTEND | REG_NOTBOL, and is closely related to a soon-to-land fix to sed. Special thanks to Martijn van Duren and Ingo Schwarze for working out some consistent behaviour. Differential Revision: https://reviews.freebsd.org/D6257 Taken from: openbsd-tech 2016-05-24 [1] (Martijn van Duren) Relnotes: yes MFC after: 1 month Modified: head/lib/libc/regex/engine.c head/lib/libc/regex/regex.3 Modified: head/lib/libc/regex/engine.c ============================================================================== --- head/lib/libc/regex/engine.c Wed May 25 15:10:07 2016 (r300682) +++ head/lib/libc/regex/engine.c Wed May 25 15:35:23 2016 (r300683) @@ -786,7 +786,7 @@ fast( struct match *m, ASSIGN(fresh, st); SP("start", st, *p); coldp = NULL; - if (start == m->beginp) + if (start == m->offp || (start == m->beginp && !(m->eflags®_NOTBOL))) c = OUT; else { /* @@ -891,7 +891,7 @@ slow( struct match *m, SP("sstart", st, *p); st = step(m->g, startst, stopst, st, NOTHING, st); matchp = NULL; - if (start == m->beginp) + if (start == m->offp || (start == m->beginp && !(m->eflags®_NOTBOL))) c = OUT; else { /* Modified: head/lib/libc/regex/regex.3 ============================================================================== --- head/lib/libc/regex/regex.3 Wed May 25 15:10:07 2016 (r300682) +++ head/lib/libc/regex/regex.3 Wed May 25 15:35:23 2016 (r300683) @@ -32,7 +32,7 @@ .\" @(#)regex.3 8.4 (Berkeley) 3/20/94 .\" $FreeBSD$ .\" -.Dd August 17, 2005 +.Dd May 25, 2016 .Dt REGEX 3 .Os .Sh NAME @@ -235,11 +235,16 @@ The argument is the bitwise OR of zero or more of the following flags: .Bl -tag -width REG_STARTEND .It Dv REG_NOTBOL -The first character of -the string -is not the beginning of a line, so the -.Ql ^\& -anchor should not match before it. +The first character of the string is treated as the continuation +of a line. +This means that the anchors +.Ql ^\& , +.Ql [[:<:]] , +and +.Ql \e< +do not match before it; but see +.Dv REG_STARTEND +below. This does not affect the behavior of newlines under .Dv REG_NEWLINE . .It Dv REG_NOTEOL @@ -247,19 +252,16 @@ The NUL terminating the string does not end a line, so the .Ql $\& -anchor should not match before it. +anchor does not match before it. This does not affect the behavior of newlines under .Dv REG_NEWLINE . .It Dv REG_STARTEND The string is considered to start at -.Fa string -+ -.Fa pmatch Ns [0]. Ns Va rm_so -and to have a terminating NUL located at -.Fa string -+ -.Fa pmatch Ns [0]. Ns Va rm_eo -(there need not actually be a NUL at that location), +.Fa string No + +.Fa pmatch Ns [0]. Ns Fa rm_so +and to end before the byte located at +.Fa string No + +.Fa pmatch Ns [0]. Ns Fa rm_eo , regardless of the value of .Fa nmatch . See below for the definition of @@ -271,13 +273,37 @@ compatible with but not specified by .St -p1003.2 , and should be used with caution in software intended to be portable to other systems. -Note that a non-zero -.Va rm_so -does not imply -.Dv REG_NOTBOL ; -.Dv REG_STARTEND -affects only the location of the string, -not how it is matched. +.Pp +Without +.Dv REG_NOTBOL , +the position +.Fa rm_so +is considered the beginning of a line, such that +.Ql ^ +matches before it, and the beginning of a word if there is a word +character at this position, such that +.Ql [[:<:]] +and +.Ql \e< +match before it. +.Pp +With +.Dv REG_NOTBOL , +the character at position +.Fa rm_so +is treated as the continuation of a line, and if +.Fa rm_so +is greater than 0, the preceding character is taken into consideration. +If the preceding character is a newline and the regular expression was compiled +with +.Dv REG_NEWLINE , +.Ql ^ +matches before the string; if the preceding character is not a word character +but the string starts with a word character, +.Ql [[:<:]] +and +.Ql \e< +match before the string. .El .Pp See From owner-svn-src-head@freebsd.org Wed May 25 15:42:40 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C239CB4AE81; Wed, 25 May 2016 15:42:40 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94E8E1C02; Wed, 25 May 2016 15:42:40 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PFgdME076997; Wed, 25 May 2016 15:42:39 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PFgdRG076996; Wed, 25 May 2016 15:42:39 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201605251542.u4PFgdRG076996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" <pfg@FreeBSD.org> Date: Wed, 25 May 2016 15:42:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300684 - head/usr.bin/sed X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 15:42:40 -0000 Author: pfg Date: Wed May 25 15:42:39 2016 New Revision: 300684 URL: https://svnweb.freebsd.org/changeset/base/300684 Log: sed: convert sed to use REG_STARTEND more explicitly. Summarizing the findings in the OpenBSD list: This solves a reproduceable issue with very recent Mesa where REG_NOTBOL combined with a match at the begin of the string causes our regex library to treat the word as not begin of word. Thanks to Martijn van Duren and Ingo Schwarze for taking the time to solve this in the least invasive way. PR: 209352, 209387 Taken from: openbsd-tech (Martijn van Duren) MFC after: 1 month Modified: head/usr.bin/sed/process.c Modified: head/usr.bin/sed/process.c ============================================================================== --- head/usr.bin/sed/process.c Wed May 25 15:35:23 2016 (r300683) +++ head/usr.bin/sed/process.c Wed May 25 15:42:39 2016 (r300684) @@ -71,7 +71,8 @@ static inline int applies(struct s_comm static void do_tr(struct s_tr *); static void flush_appends(void); static void lputs(char *, size_t); -static int regexec_e(regex_t *, const char *, int, int, size_t); +static int regexec_e(regex_t *, const char *, int, int, size_t, + size_t); static void regsub(SPACE *, char *, char *); static int substitute(struct s_command *); @@ -281,7 +282,7 @@ new: if (!nflag && !pd) * (lastline, linenumber, ps). */ #define MATCH(a) \ - ((a)->type == AT_RE ? regexec_e((a)->u.r, ps, 0, 1, psl) : \ + ((a)->type == AT_RE ? regexec_e((a)->u.r, ps, 0, 1, 0, psl) : \ (a)->type == AT_LINE ? linenum == (a)->u.l : lastline()) /* @@ -381,6 +382,7 @@ substitute(struct s_command *cp) regex_t *re; regoff_t slen; int lastempty, n; + size_t le = 0; char *s; s = ps; @@ -392,7 +394,7 @@ substitute(struct s_command *cp) linenum, fname, cp->u.s->maxbref); } } - if (!regexec_e(re, s, 0, 0, psl)) + if (!regexec_e(re, s, 0, 0, 0, psl)) return (0); SS.len = 0; /* Clean substitute space. */ @@ -402,28 +404,30 @@ substitute(struct s_command *cp) do { /* Copy the leading retained string. */ - if (n <= 1 && match[0].rm_so) - cspace(&SS, s, match[0].rm_so, APPEND); + if (n <= 1 && match[0].rm_so - le) + cspace(&SS, s, match[0].rm_so - le, APPEND); /* Skip zero-length matches right after other matches. */ - if (lastempty || match[0].rm_so || + if (lastempty || (match[0].rm_so - le) || match[0].rm_so != match[0].rm_eo) { if (n <= 1) { /* Want this match: append replacement. */ - regsub(&SS, s, cp->u.s->new); + regsub(&SS, ps, cp->u.s->new); if (n == 1) n = -1; } else { /* Want a later match: append original. */ - if (match[0].rm_eo) - cspace(&SS, s, match[0].rm_eo, APPEND); + if (match[0].rm_eo - le) + cspace(&SS, s, match[0].rm_eo - le, + APPEND); n--; } } /* Move past this match. */ - s += match[0].rm_eo; - slen -= match[0].rm_eo; + s += (match[0].rm_eo - le); + slen -= (match[0].rm_eo - le); + le = match[0].rm_eo; /* * After a zero-length match, advance one byte, @@ -434,13 +438,15 @@ substitute(struct s_command *cp) slen = -1; else slen--; - if (*s != '\0') + if (*s != '\0') { cspace(&SS, s++, 1, APPEND); + le++; + } lastempty = 1; } else lastempty = 0; - } while (n >= 0 && slen >= 0 && regexec_e(re, s, REG_NOTBOL, 0, slen)); + } while (n >= 0 && slen >= 0 && regexec_e(re, ps, 0, 0, le, psl)); /* Did not find the requested number of matches. */ if (n > 1) @@ -652,7 +658,7 @@ lputs(char *s, size_t len) static int regexec_e(regex_t *preg, const char *string, int eflags, int nomatch, - size_t slen) + size_t start, size_t stop) { int eval; @@ -663,8 +669,8 @@ regexec_e(regex_t *preg, const char *str defpreg = preg; /* Set anchors */ - match[0].rm_so = 0; - match[0].rm_eo = slen; + match[0].rm_so = start; + match[0].rm_eo = stop; eval = regexec(defpreg, string, nomatch ? 0 : maxnsub + 1, match, eflags | REG_STARTEND); From owner-svn-src-head@freebsd.org Wed May 25 15:43:02 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80A73B4AECA; Wed, 25 May 2016 15:43:02 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34DB81D68; Wed, 25 May 2016 15:43:02 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PFh1q3077087; Wed, 25 May 2016 15:43:01 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PFh146077085; Wed, 25 May 2016 15:43:01 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605251543.u4PFh146077085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Wed, 25 May 2016 15:43:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300685 - head/sbin/camcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 15:43:02 -0000 Author: truckman Date: Wed May 25 15:43:01 2016 New Revision: 300685 URL: https://svnweb.freebsd.org/changeset/base/300685 Log: Fix a couple of new instances of a false positive Coverity buffer overflow defect. Use the new CCB_CLEAR_ALL_EXCEPT_HDR() macro instead of the calling bzero() on the pointer to the header used as an array and indexed by 1. Don't leak a buffer after executing "goto restart_report" by overwriting its pointer with the results of another calloc(). Be sure to clear the buffer before reusing it. (CID 1356042) Reported by: Coverity CID: 1356022, 1356034, 1356023, 1356035, 1356042 Reviewed by: ken Modified: head/sbin/camcontrol/epc.c head/sbin/camcontrol/zone.c Modified: head/sbin/camcontrol/epc.c ============================================================================== --- head/sbin/camcontrol/epc.c Wed May 25 15:42:39 2016 (r300684) +++ head/sbin/camcontrol/epc.c Wed May 25 15:43:01 2016 (r300685) @@ -633,8 +633,7 @@ epc(struct cam_device *device, int argc, goto bailout; } - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(ccb); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { Modified: head/sbin/camcontrol/zone.c ============================================================================== --- head/sbin/camcontrol/zone.c Wed May 25 15:42:39 2016 (r300684) +++ head/sbin/camcontrol/zone.c Wed May 25 15:43:01 2016 (r300685) @@ -347,8 +347,7 @@ zone(struct cam_device *device, int argc goto bailout; } - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(ccb); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { @@ -484,7 +483,8 @@ restart_report: sector_count = ZAC_ATA_SECTOR_COUNT(alloc_len); protocol = AP_PROTO_DMA; } else { - cdb_storage = calloc(cdb_storage_len, 1); + if (cdb_storage == NULL) + cdb_storage = calloc(cdb_storage_len, 1); if (cdb_storage == NULL) err(1, "couldn't allocate memory"); @@ -662,6 +662,8 @@ restart_report: if (zp_status == ZONE_PRINT_MORE_DATA) { bzero(ccb, sizeof(*ccb)); first_pass = 0; + if (cdb_storage != NULL) + bzero(cdb_storage, cdb_storage_len); goto restart_report; } else if (zp_status == ZONE_PRINT_ERROR) error = 1; From owner-svn-src-head@freebsd.org Wed May 25 15:49:30 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1FA5B49065; Wed, 25 May 2016 15:49:30 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F5261205; Wed, 25 May 2016 15:49:30 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PFnTNt079366; Wed, 25 May 2016 15:49:29 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PFnTkp079365; Wed, 25 May 2016 15:49:29 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605251549.u4PFnTkp079365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Wed, 25 May 2016 15:49:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300686 - head/sbin/camcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 15:49:30 -0000 Author: truckman Date: Wed May 25 15:49:29 2016 New Revision: 300686 URL: https://svnweb.freebsd.org/changeset/base/300686 Log: Fix a couple of Coverity Unintended sign extension sign extension defects. When shifting an unsigned byte into the upper 8 bits of an int and the resulting value is greater than 0x7FFFFFF, the result will be sign extended when converting to a 64 bit unsigned long. Fix by casting to (uint64_t) before the shift. Reported by: Coverity CID: 1356044, 1356045 Reviewed by: ken Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Wed May 25 15:43:01 2016 (r300685) +++ head/sbin/camcontrol/camcontrol.c Wed May 25 15:49:29 2016 (r300686) @@ -5188,7 +5188,7 @@ get_ata_status(struct cam_device *dev, u desc->count_7_0; *lba = ((uint64_t)desc->lba_47_40 << 40) | ((uint64_t)desc->lba_39_32 << 32) | - (desc->lba_31_24 << 24) | + ((uint64_t)desc->lba_31_24 << 24) | (desc->lba_23_16 << 16) | (desc->lba_15_8 << 8) | desc->lba_7_0; @@ -5249,7 +5249,7 @@ get_ata_status(struct cam_device *dev, u (res->lba_low); if (res->flags & CAM_ATAIO_48BIT) { *count |= (res->sector_count_exp << 8); - *lba |= (res->lba_low_exp << 24) | + *lba |= ((uint64_t)res->lba_low_exp << 24) | ((uint64_t)res->lba_mid_exp << 32) | ((uint64_t)res->lba_high_exp << 40); } else { From owner-svn-src-head@freebsd.org Wed May 25 15:51:49 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F35CB49365; Wed, 25 May 2016 15:51:49 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from gw.catspoiler.org (unknown [IPv6:2602:304:b010:ef20::f2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gw.catspoiler.org", Issuer "gw.catspoiler.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3206A17DC; Wed, 25 May 2016 15:51:49 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.15.2/8.15.2) with ESMTP id u4PFpewg006305; Wed, 25 May 2016 08:51:44 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <201605251551.u4PFpewg006305@gw.catspoiler.org> Date: Wed, 25 May 2016 08:51:40 -0700 (PDT) From: Don Lewis <truckman@FreeBSD.org> Subject: Re: svn commit: r300685 - head/sbin/camcontrol To: src-committers@freebsd.org cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201605251543.u4PFh146077085@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 15:51:49 -0000 On 25 May, To: src-committers@freebsd.org wrote: > Author: truckman > Date: Wed May 25 15:43:01 2016 > New Revision: 300685 > URL: https://svnweb.freebsd.org/changeset/base/300685 > > Log: > Fix a couple of new instances of a false positive Coverity buffer > overflow defect. Use the new CCB_CLEAR_ALL_EXCEPT_HDR() macro > instead of the calling bzero() on the pointer to the header used > as an array and indexed by 1. > > Don't leak a buffer after executing "goto restart_report" by > overwriting its pointer with the results of another calloc(). > Be sure to clear the buffer before reusing it. (CID 1356042) > > Reported by: Coverity > CID: 1356022, 1356034, 1356023, 1356035, 1356042 > Reviewed by: ken Differential Revision: https://reviews.freebsd.org/D6558 From owner-svn-src-head@freebsd.org Wed May 25 15:52:39 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDDA4B4943A; Wed, 25 May 2016 15:52:39 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from gw.catspoiler.org (unknown [IPv6:2602:304:b010:ef20::f2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gw.catspoiler.org", Issuer "gw.catspoiler.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B793C1A2B; Wed, 25 May 2016 15:52:39 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.15.2/8.15.2) with ESMTP id u4PFqV5X006311; Wed, 25 May 2016 08:52:35 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <201605251552.u4PFqV5X006311@gw.catspoiler.org> Date: Wed, 25 May 2016 08:52:31 -0700 (PDT) From: Don Lewis <truckman@FreeBSD.org> Subject: Re: svn commit: r300686 - head/sbin/camcontrol To: src-committers@freebsd.org cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201605251549.u4PFnTkp079365@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 15:52:40 -0000 On 25 May, To: src-committers@freebsd.org wrote: > Author: truckman > Date: Wed May 25 15:49:29 2016 > New Revision: 300686 > URL: https://svnweb.freebsd.org/changeset/base/300686 > > Log: > Fix a couple of Coverity Unintended sign extension sign extension > defects. When shifting an unsigned byte into the upper 8 bits of > an int and the resulting value is greater than 0x7FFFFFF, the result > will be sign extended when converting to a 64 bit unsigned long. > Fix by casting to (uint64_t) before the shift. > > Reported by: Coverity > CID: 1356044, 1356045 > Reviewed by: ken Differential Revision: https://reviews.freebsd.org/D6557 From owner-svn-src-head@freebsd.org Wed May 25 15:54:22 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D5DDB494C3; Wed, 25 May 2016 15:54:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FFD71BD9; Wed, 25 May 2016 15:54:21 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PFsLhQ082157; Wed, 25 May 2016 15:54:21 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PFsL4t082156; Wed, 25 May 2016 15:54:21 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201605251554.u4PFsL4t082156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen <tuexen@FreeBSD.org> Date: Wed, 25 May 2016 15:54:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300687 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 15:54:22 -0000 Author: tuexen Date: Wed May 25 15:54:21 2016 New Revision: 300687 URL: https://svnweb.freebsd.org/changeset/base/300687 Log: Send an ICMP packet indicating destination unreachable/protocol unreachable if we don't handle the packet in the kernel and not in userspace. MFC after: 1 week Modified: head/sys/netinet/raw_ip.c Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Wed May 25 15:49:29 2016 (r300686) +++ head/sys/netinet/raw_ip.c Wed May 25 15:54:21 2016 (r300687) @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include <netinet/ip.h> #include <netinet/ip_var.h> #include <netinet/ip_mroute.h> +#include <netinet/ip_icmp.h> #ifdef IPSEC #include <netipsec/ipsec.h> @@ -416,8 +417,10 @@ rip_input(struct mbuf **mp, int *offp, i if (inetsw[ip_protox[ip->ip_p]].pr_input == rip_input) { IPSTAT_INC(ips_noproto); IPSTAT_DEC(ips_delivered); + icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PROTOCOL, 0, 0); + } else { + m_freem(m); } - m_freem(m); } return (IPPROTO_DONE); } From owner-svn-src-head@freebsd.org Wed May 25 16:38:11 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4817CB4A2D9; Wed, 25 May 2016 16:38:11 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 18A311DF5; Wed, 25 May 2016 16:38:11 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PGcAwR095483; Wed, 25 May 2016 16:38:10 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PGcAgw095482; Wed, 25 May 2016 16:38:10 GMT (envelope-from br@FreeBSD.org) Message-Id: <201605251638.u4PGcAgw095482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin <br@FreeBSD.org> Date: Wed, 25 May 2016 16:38:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300689 - head/lib/libc/riscv/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 16:38:11 -0000 Author: br Date: Wed May 25 16:38:10 2016 New Revision: 300689 URL: https://svnweb.freebsd.org/changeset/base/300689 Log: Do not generate code for sbrk syscall -- sbrk support was removed. Pointed out by: andrew Modified: head/lib/libc/riscv/sys/Makefile.inc Modified: head/lib/libc/riscv/sys/Makefile.inc ============================================================================== --- head/lib/libc/riscv/sys/Makefile.inc Wed May 25 16:04:50 2016 (r300688) +++ head/lib/libc/riscv/sys/Makefile.inc Wed May 25 16:38:10 2016 (r300689) @@ -15,6 +15,7 @@ NOASM= break.o \ exit.o \ getlogin.o \ openbsd_poll.o \ + sbrk.o \ sstk.o \ vfork.o \ yield.o From owner-svn-src-head@freebsd.org Wed May 25 18:10:45 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A38FB495B3; Wed, 25 May 2016 18:10:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 477501F97; Wed, 25 May 2016 18:10:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PIAibn023681; Wed, 25 May 2016 18:10:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PIAiFp023680; Wed, 25 May 2016 18:10:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605251810.u4PIAiFp023680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov <kib@FreeBSD.org> Date: Wed, 25 May 2016 18:10:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300691 - head/libexec/rtld-elf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 18:10:45 -0000 Author: kib Date: Wed May 25 18:10:44 2016 New Revision: 300691 URL: https://svnweb.freebsd.org/changeset/base/300691 Log: Fix issues found by Coverity in the rtld-elf.c:gethints(). Check that the dirlist path string specification does not cause overflow and is fully contained in the hints file. Check that the dirlist string is nul-terminated. Make 'hdr' static variable, so that hdr.dirlistlen is available when hints cached value is used on next function calls. Reset hdr.dirlistlen to zero if error was detected, so that allocations use reasonable size. Use 'hints', and not 'p' in the body, since p is only initialized on the first call. Reported and reviewed by: truckman (previous version) Sponsored by: The FreeBSD Foundation CIDs: 1006503, 1006504, 1006676, 1008488, 1007263 MFC after: 2 weeks Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Wed May 25 17:10:10 2016 (r300690) +++ head/libexec/rtld-elf/rtld.c Wed May 25 18:10:44 2016 (r300691) @@ -1667,14 +1667,16 @@ static const char * gethints(bool nostdlib) { static char *hints, *filtered_path; - struct elfhints_hdr hdr; + static struct elfhints_hdr hdr; struct fill_search_info_args sargs, hargs; struct dl_serinfo smeta, hmeta, *SLPinfo, *hintinfo; struct dl_serpath *SLPpath, *hintpath; char *p; + struct stat hint_stat; unsigned int SLPndx, hintndx, fndx, fcount; int fd; size_t flen; + uint32_t dl; bool skip; /* First call, read the hints file */ @@ -1684,19 +1686,38 @@ gethints(bool nostdlib) if ((fd = open(ld_elf_hints_path, O_RDONLY | O_CLOEXEC)) == -1) return (NULL); + + /* + * Check of hdr.dirlistlen value against type limit + * intends to pacify static analyzers. Further + * paranoia leads to checks that dirlist is fully + * contained in the file range. + */ if (read(fd, &hdr, sizeof hdr) != sizeof hdr || hdr.magic != ELFHINTS_MAGIC || - hdr.version != 1) { + hdr.version != 1 || hdr.dirlistlen > UINT_MAX / 2 || + fstat(fd, &hint_stat) == -1) { +cleanup1: close(fd); + hdr.dirlistlen = 0; return (NULL); } + dl = hdr.strtab; + if (dl + hdr.dirlist < dl) + goto cleanup1; + dl += hdr.dirlist; + if (dl + hdr.dirlistlen < dl) + goto cleanup1; + dl += hdr.dirlistlen; + if (dl > hint_stat.st_size) + goto cleanup1; p = xmalloc(hdr.dirlistlen + 1); + if (lseek(fd, hdr.strtab + hdr.dirlist, SEEK_SET) == -1 || read(fd, p, hdr.dirlistlen + 1) != - (ssize_t)hdr.dirlistlen + 1) { + (ssize_t)hdr.dirlistlen + 1 || p[hdr.dirlistlen] != '\0') { free(p); - close(fd); - return (NULL); + goto cleanup1; } hints = p; close(fd); @@ -1729,7 +1750,7 @@ gethints(bool nostdlib) hargs.serinfo = &hmeta; path_enumerate(ld_standard_library_path, fill_search_info, &sargs); - path_enumerate(p, fill_search_info, &hargs); + path_enumerate(hints, fill_search_info, &hargs); SLPinfo = xmalloc(smeta.dls_size); hintinfo = xmalloc(hmeta.dls_size); @@ -1748,7 +1769,7 @@ gethints(bool nostdlib) hargs.strspace = (char *)&hintinfo->dls_serpath[hmeta.dls_cnt]; path_enumerate(ld_standard_library_path, fill_search_info, &sargs); - path_enumerate(p, fill_search_info, &hargs); + path_enumerate(hints, fill_search_info, &hargs); /* * Now calculate the difference between two sets, by excluding From owner-svn-src-head@freebsd.org Wed May 25 18:38:31 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87EEBB49F03; Wed, 25 May 2016 18:38:31 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3DCFC10FB; Wed, 25 May 2016 18:38:31 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PIcUKt032522; Wed, 25 May 2016 18:38:30 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PIcUhc032521; Wed, 25 May 2016 18:38:30 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605251838.u4PIcUhc032521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Wed, 25 May 2016 18:38:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300692 - head/bin/ed X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 18:38:31 -0000 Author: truckman Date: Wed May 25 18:38:30 2016 New Revision: 300692 URL: https://svnweb.freebsd.org/changeset/base/300692 Log: Close the input FILE * in read_file() and the output FILE * in write_file() if read_stream() or write_stream() fails to avoid leaking the FILE. Reported by: Coverity CID: 977702 Reviewed by: pfg MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6554 Modified: head/bin/ed/io.c Modified: head/bin/ed/io.c ============================================================================== --- head/bin/ed/io.c Wed May 25 18:10:44 2016 (r300691) +++ head/bin/ed/io.c Wed May 25 18:38:30 2016 (r300692) @@ -36,20 +36,24 @@ read_file(char *fn, long n) { FILE *fp; long size; - + int cs; fp = (*fn == '!') ? popen(fn + 1, "r") : fopen(strip_escapes(fn), "r"); if (fp == NULL) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); errmsg = "cannot open input file"; return ERR; - } else if ((size = read_stream(fp, n)) < 0) - return ERR; - else if (((*fn == '!') ? pclose(fp) : fclose(fp)) < 0) { + } + if ((size = read_stream(fp, n)) < 0) { + fprintf(stderr, "%s: %s\n", fn, strerror(errno)); + errmsg = "error reading input file"; + } + if ((cs = (*fn == '!') ? pclose(fp) : fclose(fp)) < 0) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); errmsg = "cannot close input file"; - return ERR; } + if (size < 0 || cs < 0) + return ERR; if (!scripted) fprintf(stdout, "%lu\n", size); return current_addr - n; @@ -143,19 +147,24 @@ write_file(char *fn, const char *mode, l { FILE *fp; long size; + int cs; fp = (*fn == '!') ? popen(fn+1, "w") : fopen(strip_escapes(fn), mode); if (fp == NULL) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); errmsg = "cannot open output file"; return ERR; - } else if ((size = write_stream(fp, n, m)) < 0) - return ERR; - else if (((*fn == '!') ? pclose(fp) : fclose(fp)) < 0) { + } + if ((size = write_stream(fp, n, m)) < 0) { + fprintf(stderr, "%s: %s\n", fn, strerror(errno)); + errmsg = "error writing output file"; + } + if ((cs = (*fn == '!') ? pclose(fp) : fclose(fp)) < 0) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); errmsg = "cannot close output file"; - return ERR; } + if (size < 0 || cs < 0) + return ERR; if (!scripted) fprintf(stdout, "%lu\n", size); return n ? m - n + 1 : 0; From owner-svn-src-head@freebsd.org Wed May 25 19:44:31 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92851B490E5; Wed, 25 May 2016 19:44:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C1A11DFE; Wed, 25 May 2016 19:44:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PJiUGC054416; Wed, 25 May 2016 19:44:30 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PJiQGq054373; Wed, 25 May 2016 19:44:26 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201605251944.u4PJiQGq054373@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore <ian@FreeBSD.org> Date: Wed, 25 May 2016 19:44:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300694 - in head/sys: arm/arm arm/include arm/mv kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 19:44:31 -0000 Author: ian Date: Wed May 25 19:44:26 2016 New Revision: 300694 URL: https://svnweb.freebsd.org/changeset/base/300694 Log: Include machine/acle-compat.h in cdefs.h on arm if the compiler doesn't have ACLE support built in. The ACLE (ARM C Language Extensions) defines a set of standardized symbols which indicate the architecture version and features available. ACLE support is built in to modern compilers (both clang and gcc), but absent from gcc prior to 4.4. ARM (the company) provides the acle-compat.h header file to define the right symbols for older versions of gcc. Basically, acle-compat.h does for arm about the same thing cdefs.h does for freebsd: defines standardized macros that work no matter which compiler you use. If ARM hadn't provided this file we would have ended up with a big #ifdef __arm__ section in cdefs.h with our own compatibility shims. Remove #include <machine/acle-compat.h> from the zillion other places (an ever-growing list) that it appears. Since style(9) requires sys/types.h or sys/param.h early in the include list, and both of those lead to including cdefs.h, only a couple special cases still need to include acle-compat.h directly. Loves it: imp Modified: head/sys/arm/arm/bcopyinout.S head/sys/arm/arm/bcopyinout_xscale.S head/sys/arm/arm/bus_space_base.c head/sys/arm/arm/copystr.S head/sys/arm/arm/cpu_asm-v6.S head/sys/arm/arm/cpufunc.c head/sys/arm/arm/disassem.c head/sys/arm/arm/elf_machdep.c head/sys/arm/arm/exception.S head/sys/arm/arm/fiq.c head/sys/arm/arm/fusu.S head/sys/arm/arm/genassym.c head/sys/arm/arm/locore-v6.S head/sys/arm/arm/machdep.c head/sys/arm/arm/mem.c head/sys/arm/arm/mp_machdep.c head/sys/arm/arm/stdatomic.c head/sys/arm/arm/swtch-v4.S head/sys/arm/arm/swtch-v6.S head/sys/arm/arm/sys_machdep.c head/sys/arm/arm/trap-v6.c head/sys/arm/arm/vm_machdep.c head/sys/arm/include/armreg.h head/sys/arm/include/asm.h head/sys/arm/include/atomic.h head/sys/arm/include/bus.h head/sys/arm/include/cpu-v4.h head/sys/arm/include/cpu-v6.h head/sys/arm/include/cpu.h head/sys/arm/include/db_machdep.h head/sys/arm/include/machdep.h head/sys/arm/include/param.h head/sys/arm/include/pcpu.h head/sys/arm/include/pmap.h head/sys/arm/include/sf_buf.h head/sys/arm/include/sysarch.h head/sys/arm/include/sysreg.h head/sys/arm/include/vm.h head/sys/arm/mv/mv_machdep.c head/sys/kern/imgact_elf.c head/sys/kern/subr_devmap.c head/sys/sys/cdefs.h Modified: head/sys/arm/arm/bcopyinout.S ============================================================================== --- head/sys/arm/arm/bcopyinout.S Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/bcopyinout.S Wed May 25 19:44:26 2016 (r300694) @@ -38,7 +38,6 @@ #include "assym.s" -#include <machine/acle-compat.h> #include <machine/asm.h> #include <sys/errno.h> Modified: head/sys/arm/arm/bcopyinout_xscale.S ============================================================================== --- head/sys/arm/arm/bcopyinout_xscale.S Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/bcopyinout_xscale.S Wed May 25 19:44:26 2016 (r300694) @@ -38,8 +38,6 @@ #include <machine/asm.h> __FBSDID("$FreeBSD$"); -#include <machine/acle-compat.h> - .syntax unified .text .align 2 Modified: head/sys/arm/arm/bus_space_base.c ============================================================================== --- head/sys/arm/arm/bus_space_base.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/bus_space_base.c Wed May 25 19:44:26 2016 (r300694) @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <machine/bus.h> -#include <machine/acle-compat.h> #include "opt_platform.h" Modified: head/sys/arm/arm/copystr.S ============================================================================== --- head/sys/arm/arm/copystr.S Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/copystr.S Wed May 25 19:44:26 2016 (r300694) @@ -39,7 +39,6 @@ */ #include "assym.s" -#include <machine/acle-compat.h> #include <machine/asm.h> #include <machine/armreg.h> __FBSDID("$FreeBSD$"); Modified: head/sys/arm/arm/cpu_asm-v6.S ============================================================================== --- head/sys/arm/arm/cpu_asm-v6.S Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/cpu_asm-v6.S Wed May 25 19:44:26 2016 (r300694) @@ -28,7 +28,6 @@ */ #include "assym.s" -#include <machine/acle-compat.h> #include <machine/asm.h> #include <machine/asmacros.h> #include <machine/armreg.h> Modified: head/sys/arm/arm/cpufunc.c ============================================================================== --- head/sys/arm/arm/cpufunc.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/cpufunc.c Wed May 25 19:44:26 2016 (r300694) @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include <vm/pmap.h> #include <vm/uma.h> -#include <machine/acle-compat.h> #include <machine/cpuconf.h> #include <machine/cpufunc.h> Modified: head/sys/arm/arm/disassem.c ============================================================================== --- head/sys/arm/arm/disassem.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/disassem.c Wed May 25 19:44:26 2016 (r300694) @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <machine/disassem.h> #include <machine/armreg.h> -#include <machine/acle-compat.h> #include <ddb/ddb.h> /* Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/elf_machdep.c Wed May 25 19:44:26 2016 (r300694) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include <vm/pmap.h> #include <vm/vm_param.h> -#include <machine/acle-compat.h> #include <machine/elf.h> #include <machine/md_var.h> Modified: head/sys/arm/arm/exception.S ============================================================================== --- head/sys/arm/arm/exception.S Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/exception.S Wed May 25 19:44:26 2016 (r300694) @@ -48,7 +48,6 @@ #include "assym.s" -#include <machine/acle-compat.h> #include <machine/asm.h> #include <machine/armreg.h> #include <machine/asmacros.h> Modified: head/sys/arm/arm/fiq.c ============================================================================== --- head/sys/arm/arm/fiq.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/fiq.c Wed May 25 19:44:26 2016 (r300694) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> -#include <machine/acle-compat.h> #include <machine/armreg.h> #include <machine/cpufunc.h> #include <machine/fiq.h> Modified: head/sys/arm/arm/fusu.S ============================================================================== --- head/sys/arm/arm/fusu.S Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/fusu.S Wed May 25 19:44:26 2016 (r300694) @@ -33,7 +33,6 @@ * */ -#include <machine/acle-compat.h> #include <machine/asm.h> #include <machine/armreg.h> #include "assym.s" Modified: head/sys/arm/arm/genassym.c ============================================================================== --- head/sys/arm/arm/genassym.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/genassym.c Wed May 25 19:44:26 2016 (r300694) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include <vm/pmap.h> #include <vm/vm_map.h> -#include <machine/acle-compat.h> #include <machine/armreg.h> #include <machine/frame.h> #include <machine/pcb.h> Modified: head/sys/arm/arm/locore-v6.S ============================================================================== --- head/sys/arm/arm/locore-v6.S Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/locore-v6.S Wed May 25 19:44:26 2016 (r300694) @@ -30,7 +30,6 @@ #include "assym.s" #include <sys/syscall.h> -#include <machine/acle-compat.h> #include <machine/asm.h> #include <machine/asmacros.h> #include <machine/armreg.h> Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/machdep.c Wed May 25 19:44:26 2016 (r300694) @@ -94,7 +94,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_page.h> #include <vm/vm_pager.h> -#include <machine/acle-compat.h> #include <machine/armreg.h> #include <machine/atags.h> #include <machine/cpu.h> Modified: head/sys/arm/arm/mem.c ============================================================================== --- head/sys/arm/arm/mem.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/mem.c Wed May 25 19:44:26 2016 (r300694) @@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$"); #include <vm/pmap.h> #include <vm/vm_extern.h> -#include <machine/acle-compat.h> #include <machine/memdev.h> #include <machine/vmparam.h> Modified: head/sys/arm/arm/mp_machdep.c ============================================================================== --- head/sys/arm/arm/mp_machdep.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/mp_machdep.c Wed May 25 19:44:26 2016 (r300694) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_kern.h> #include <vm/pmap.h> -#include <machine/acle-compat.h> #include <machine/armreg.h> #include <machine/cpu.h> #include <machine/cpufunc.h> Modified: head/sys/arm/arm/stdatomic.c ============================================================================== --- head/sys/arm/arm/stdatomic.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/stdatomic.c Wed May 25 19:44:26 2016 (r300694) @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); #include <sys/stdatomic.h> #include <sys/types.h> -#include <machine/acle-compat.h> #include <machine/atomic.h> #include <machine/cpufunc.h> #include <machine/sysarch.h> Modified: head/sys/arm/arm/swtch-v4.S ============================================================================== --- head/sys/arm/arm/swtch-v4.S Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/swtch-v4.S Wed May 25 19:44:26 2016 (r300694) @@ -81,7 +81,6 @@ #include "assym.s" #include "opt_sched.h" -#include <machine/acle-compat.h> #include <machine/asm.h> #include <machine/asmacros.h> #include <machine/armreg.h> Modified: head/sys/arm/arm/swtch-v6.S ============================================================================== --- head/sys/arm/arm/swtch-v6.S Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/swtch-v6.S Wed May 25 19:44:26 2016 (r300694) @@ -81,7 +81,6 @@ #include "assym.s" #include "opt_sched.h" -#include <machine/acle-compat.h> #include <machine/asm.h> #include <machine/asmacros.h> #include <machine/armreg.h> Modified: head/sys/arm/arm/sys_machdep.c ============================================================================== --- head/sys/arm/arm/sys_machdep.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/sys_machdep.c Wed May 25 19:44:26 2016 (r300694) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm.h> #include <vm/vm_extern.h> -#include <machine/acle-compat.h> #include <machine/cpu.h> #include <machine/sysarch.h> #include <machine/vmparam.h> Modified: head/sys/arm/arm/trap-v6.c ============================================================================== --- head/sys/arm/arm/trap-v6.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/trap-v6.c Wed May 25 19:44:26 2016 (r300694) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_extern.h> #include <vm/vm_param.h> -#include <machine/acle-compat.h> #include <machine/cpu.h> #include <machine/frame.h> #include <machine/machdep.h> Modified: head/sys/arm/arm/vm_machdep.c ============================================================================== --- head/sys/arm/arm/vm_machdep.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/vm_machdep.c Wed May 25 19:44:26 2016 (r300694) @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include <sys/sysent.h> #include <sys/unistd.h> -#include <machine/acle-compat.h> #include <machine/cpu.h> #include <machine/frame.h> #include <machine/pcb.h> @@ -76,7 +75,6 @@ __FBSDID("$FreeBSD$"); #include <vm/uma.h> #include <vm/uma_int.h> -#include <machine/acle-compat.h> #include <machine/md_var.h> #include <machine/vfp.h> Modified: head/sys/arm/include/armreg.h ============================================================================== --- head/sys/arm/include/armreg.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/armreg.h Wed May 25 19:44:26 2016 (r300694) @@ -41,8 +41,6 @@ #ifndef MACHINE_ARMREG_H #define MACHINE_ARMREG_H -#include <machine/acle-compat.h> - #define INSN_SIZE 4 #define INSN_COND_MASK 0xf0000000 /* Condition mask */ #define PSR_MODE 0x0000001f /* mode mask */ Modified: head/sys/arm/include/asm.h ============================================================================== --- head/sys/arm/include/asm.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/asm.h Wed May 25 19:44:26 2016 (r300694) @@ -39,7 +39,6 @@ #ifndef _MACHINE_ASM_H_ #define _MACHINE_ASM_H_ #include <sys/cdefs.h> -#include <machine/acle-compat.h> #include <machine/sysreg.h> #define _C_LABEL(x) x Modified: head/sys/arm/include/atomic.h ============================================================================== --- head/sys/arm/include/atomic.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/atomic.h Wed May 25 19:44:26 2016 (r300694) @@ -42,8 +42,6 @@ #include <sys/types.h> #include <machine/armreg.h> -#include <machine/acle-compat.h> - #ifndef _KERNEL #include <machine/sysarch.h> #else Modified: head/sys/arm/include/bus.h ============================================================================== --- head/sys/arm/include/bus.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/bus.h Wed May 25 19:44:26 2016 (r300694) @@ -67,7 +67,6 @@ #define _MACHINE_BUS_H_ #include <machine/_bus.h> -#include <machine/acle-compat.h> /* * int bus_space_map (bus_space_tag_t t, bus_addr_t addr, Modified: head/sys/arm/include/cpu-v4.h ============================================================================== --- head/sys/arm/include/cpu-v4.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/cpu-v4.h Wed May 25 19:44:26 2016 (r300694) @@ -34,7 +34,6 @@ #error Only include this file in the kernel #endif -#include <machine/acle-compat.h> #include <machine/atomic.h> #include <machine/cpufunc.h> #include <machine/cpuinfo.h> Modified: head/sys/arm/include/cpu-v6.h ============================================================================== --- head/sys/arm/include/cpu-v6.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/cpu-v6.h Wed May 25 19:44:26 2016 (r300694) @@ -34,7 +34,6 @@ #error Only include this file in the kernel #endif -#include <machine/acle-compat.h> #include <machine/atomic.h> #include <machine/cpufunc.h> #include <machine/cpuinfo.h> Modified: head/sys/arm/include/cpu.h ============================================================================== --- head/sys/arm/include/cpu.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/cpu.h Wed May 25 19:44:26 2016 (r300694) @@ -4,7 +4,6 @@ #ifndef MACHINE_CPU_H #define MACHINE_CPU_H -#include <machine/acle-compat.h> #include <machine/armreg.h> #include <machine/frame.h> Modified: head/sys/arm/include/db_machdep.h ============================================================================== --- head/sys/arm/include/db_machdep.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/db_machdep.h Wed May 25 19:44:26 2016 (r300694) @@ -33,7 +33,6 @@ #include <machine/frame.h> #include <machine/trap.h> #include <machine/armreg.h> -#include <machine/acle-compat.h> #define T_BREAKPOINT (1) #define T_WATCHPOINT (2) Modified: head/sys/arm/include/machdep.h ============================================================================== --- head/sys/arm/include/machdep.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/machdep.h Wed May 25 19:44:26 2016 (r300694) @@ -4,8 +4,6 @@ #ifndef _MACHDEP_BOOT_MACHDEP_H_ #define _MACHDEP_BOOT_MACHDEP_H_ -#include <machine/acle-compat.h> - /* Structs that need to be initialised by initarm */ #if __ARM_ARCH >= 6 extern vm_offset_t irqstack; Modified: head/sys/arm/include/param.h ============================================================================== --- head/sys/arm/include/param.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/param.h Wed May 25 19:44:26 2016 (r300694) @@ -46,7 +46,6 @@ */ #include <machine/_align.h> -#include <machine/acle-compat.h> #define STACKALIGNBYTES (8 - 1) #define STACKALIGN(p) ((u_int)(p) & ~STACKALIGNBYTES) Modified: head/sys/arm/include/pcpu.h ============================================================================== --- head/sys/arm/include/pcpu.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/pcpu.h Wed May 25 19:44:26 2016 (r300694) @@ -32,7 +32,6 @@ #ifdef _KERNEL -#include <machine/acle-compat.h> #include <machine/cpuconf.h> #define ALT_STACK_SIZE 128 Modified: head/sys/arm/include/pmap.h ============================================================================== --- head/sys/arm/include/pmap.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/pmap.h Wed May 25 19:44:26 2016 (r300694) @@ -30,8 +30,6 @@ #ifndef _MACHINE_PMAP_H_ #define _MACHINE_PMAP_H_ -#include <machine/acle-compat.h> - #if __ARM_ARCH >= 6 #include <machine/pmap-v6.h> #else Modified: head/sys/arm/include/sf_buf.h ============================================================================== --- head/sys/arm/include/sf_buf.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/sf_buf.h Wed May 25 19:44:26 2016 (r300694) @@ -29,8 +29,6 @@ #ifndef _MACHINE_SF_BUF_H_ #define _MACHINE_SF_BUF_H_ -#include <machine/acle-compat.h> - static inline void sf_buf_map(struct sf_buf *sf, int flags) { Modified: head/sys/arm/include/sysarch.h ============================================================================== --- head/sys/arm/include/sysarch.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/sysarch.h Wed May 25 19:44:26 2016 (r300694) @@ -37,7 +37,6 @@ #ifndef _ARM_SYSARCH_H_ #define _ARM_SYSARCH_H_ -#include <machine/acle-compat.h> #include <machine/armreg.h> /* Modified: head/sys/arm/include/sysreg.h ============================================================================== --- head/sys/arm/include/sysreg.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/sysreg.h Wed May 25 19:44:26 2016 (r300694) @@ -39,8 +39,6 @@ #ifndef MACHINE_SYSREG_H #define MACHINE_SYSREG_H -#include <machine/acle-compat.h> - /* * CP14 registers */ Modified: head/sys/arm/include/vm.h ============================================================================== --- head/sys/arm/include/vm.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/include/vm.h Wed May 25 19:44:26 2016 (r300694) @@ -29,8 +29,6 @@ #ifndef _MACHINE_VM_H_ #define _MACHINE_VM_H_ -#include <machine/acle-compat.h> - #if __ARM_ARCH >= 6 #define VM_MEMATTR_WB_WA ((vm_memattr_t)0) #define VM_MEMATTR_NOCACHE ((vm_memattr_t)1) Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/mv/mv_machdep.c Wed May 25 19:44:26 2016 (r300694) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm.h> #include <vm/pmap.h> -#include <machine/acle-compat.h> #include <machine/bus.h> #include <machine/fdt.h> #include <machine/machdep.h> Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/kern/imgact_elf.c Wed May 25 19:44:26 2016 (r300694) @@ -80,9 +80,6 @@ __FBSDID("$FreeBSD$"); #include <machine/elf.h> #include <machine/md_var.h> -#ifdef __arm__ -#include <machine/acle-compat.h> -#endif #define ELF_NOTE_ROUNDSIZE 4 #define OLD_EI_BRAND 8 Modified: head/sys/kern/subr_devmap.c ============================================================================== --- head/sys/kern/subr_devmap.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/kern/subr_devmap.c Wed May 25 19:44:26 2016 (r300694) @@ -37,9 +37,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm.h> #include <vm/vm_extern.h> #include <vm/pmap.h> -#ifdef __arm__ -#include <machine/acle-compat.h> -#endif #include <machine/vmparam.h> static const struct devmap_entry *devmap_table; Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Wed May 25 19:41:48 2016 (r300693) +++ head/sys/sys/cdefs.h Wed May 25 19:44:26 2016 (r300694) @@ -781,6 +781,14 @@ #endif /* + * Old versions of GCC use non-standard ARM arch symbols; acle-compat.h + * translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + */ +#if defined(__arm__) && !defined(__ARM_ARCH) +#include <machine/acle-compat.h> +#endif + +/* * Type Safety Checking * * Clang provides additional attributes to enable checking type safety From owner-svn-src-head@freebsd.org Wed May 25 20:56:31 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D234B4A838; Wed, 25 May 2016 20:56:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 202581B83; Wed, 25 May 2016 20:56:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PKuUl2085347; Wed, 25 May 2016 20:56:30 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PKuUX3085345; Wed, 25 May 2016 20:56:30 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201605252056.u4PKuUX3085345@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste <emaste@FreeBSD.org> Date: Wed, 25 May 2016 20:56:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300698 - in head: contrib/elftoolchain/elfcopy lib/libelftc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 20:56:31 -0000 Author: emaste Date: Wed May 25 20:56:30 2016 New Revision: 300698 URL: https://svnweb.freebsd.org/changeset/base/300698 Log: Update to ELF Tool Chain r3477 This fixes a EFI/PE header issue that prevented elfcopy-produced .efi files from working with Secure Boot: Make sure section raw size is always padded to multiple of FileAlignment from the optional header, as requested by the PE specification. This change should reduce the diff between PE image generated by Binutils objcopy and elftoolchain elfcopy. Submitted by: kaiw Reported by: ambrisko Modified: head/contrib/elftoolchain/elfcopy/pe.c head/lib/libelftc/elftc_version.c Directory Properties: head/contrib/elftoolchain/ (props changed) Modified: head/contrib/elftoolchain/elfcopy/pe.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/pe.c Wed May 25 20:50:05 2016 (r300697) +++ head/contrib/elftoolchain/elfcopy/pe.c Wed May 25 20:56:30 2016 (r300698) @@ -34,7 +34,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: pe.c 3312 2016-01-10 09:23:51Z kaiwang27 $"); +ELFTC_VCSID("$Id: pe.c 3477 2016-05-25 20:00:42Z kaiwang27 $"); /* Convert ELF object to Portable Executable (PE). */ void @@ -54,7 +54,7 @@ create_pe(struct elfcopy *ecp, int ifd, PE_Buffer *pb; const char *name; size_t indx; - int elferr, i; + int elferr; if (ecp->otf == ETF_EFI || ecp->oem == EM_X86_64) po = PE_O_PE32P; @@ -175,7 +175,7 @@ create_pe(struct elfcopy *ecp, int ifd, psh.sh_addr = sh.sh_addr; psh.sh_virtsize = sh.sh_size; if (sh.sh_type != SHT_NOBITS) - psh.sh_rawsize = sh.sh_size; + psh.sh_rawsize = roundup(sh.sh_size, poh.oh_filealign); else psh.sh_char |= IMAGE_SCN_CNT_UNINITIALIZED_DATA; @@ -190,12 +190,6 @@ create_pe(struct elfcopy *ecp, int ifd, IMAGE_SCN_CNT_CODE; if ((sh.sh_flags & SHF_ALLOC) && (psh.sh_char & 0xF0) == 0) psh.sh_char |= IMAGE_SCN_CNT_INITIALIZED_DATA; - for (i = 0xE; i > 0; i--) { - if (sh.sh_addralign & (1U << (i - 1))) { - psh.sh_char |= i << 20; - break; - } - } /* Mark relocation section "discardable". */ if (strcmp(name, ".reloc") == 0) @@ -213,8 +207,12 @@ create_pe(struct elfcopy *ecp, int ifd, } pb->pb_align = 1; pb->pb_off = 0; - pb->pb_size = sh.sh_size; - pb->pb_buf = d->d_buf; + pb->pb_size = roundup(sh.sh_size, poh.oh_filealign); + if ((pb->pb_buf = calloc(1, pb->pb_size)) == NULL) { + warn("calloc failed"); + continue; + } + memcpy(pb->pb_buf, d->d_buf, sh.sh_size); } elferr = elf_errno(); if (elferr != 0) Modified: head/lib/libelftc/elftc_version.c ============================================================================== --- head/lib/libelftc/elftc_version.c Wed May 25 20:50:05 2016 (r300697) +++ head/lib/libelftc/elftc_version.c Wed May 25 20:56:30 2016 (r300698) @@ -6,5 +6,5 @@ const char * elftc_version(void) { - return "elftoolchain r3475M"; + return "elftoolchain r3477M"; } From owner-svn-src-head@freebsd.org Wed May 25 22:16:12 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF1CAB4A832; Wed, 25 May 2016 22:16:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 636A71706; Wed, 25 May 2016 22:16:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PMGBnK014919; Wed, 25 May 2016 22:16:11 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PMGBrb014918; Wed, 25 May 2016 22:16:11 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201605252216.u4PMGBrb014918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen <tuexen@FreeBSD.org> Date: Wed, 25 May 2016 22:16:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300699 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 22:16:12 -0000 Author: tuexen Date: Wed May 25 22:16:11 2016 New Revision: 300699 URL: https://svnweb.freebsd.org/changeset/base/300699 Log: When sending in ICMP response to an SCTP packet, * include the SCTP common header, if possible * include the first 8 bytes of the INIT chunk, if possible This provides the necesary information for the receiver of the ICMP packet to process it. MFC after: 1 week Modified: head/sys/netinet/ip_icmp.c Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Wed May 25 20:56:30 2016 (r300698) +++ head/sys/netinet/ip_icmp.c Wed May 25 22:16:11 2016 (r300699) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include <netinet/ip_icmp.h> #include <netinet/ip_var.h> #include <netinet/ip_options.h> +#include <netinet/sctp.h> #include <netinet/tcp.h> #include <netinet/tcp_var.h> #include <netinet/tcpip.h> @@ -249,6 +250,34 @@ icmp_error(struct mbuf *n, int type, int goto freeit; icmpelen = max(tcphlen, min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); + } else if (oip->ip_p == IPPROTO_SCTP) { + struct sctphdr *sh; + struct sctp_chunkhdr *ch; + + if (ntohs(oip->ip_len) < oiphlen + sizeof(struct sctphdr)) + goto stdreply; + if (oiphlen + sizeof(struct sctphdr) > n->m_len && + n->m_next == NULL) + goto stdreply; + if (n->m_len < oiphlen + sizeof(struct sctphdr) && + (n = m_pullup(n, oiphlen + sizeof(struct sctphdr))) == NULL) + goto freeit; + icmpelen = max(sizeof(struct sctphdr), + min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); + sh = (struct sctphdr *)((caddr_t)oip + oiphlen); + if (ntohl(sh->v_tag) == 0 && + ntohs(oip->ip_len) >= oiphlen + sizeof(struct sctphdr) + 8 && + (n->m_len >= oiphlen + sizeof(struct sctphdr) + 8 || + n->m_next != NULL)) { + if (n->m_len < oiphlen + sizeof(struct sctphdr) + 8 && + (n = m_pullup(n, oiphlen + sizeof(struct sctphdr) + 8)) == NULL) + goto freeit; + ch = (struct sctp_chunkhdr *)(sh + 1); + if (ch->chunk_type == SCTP_INITIATION) { + icmpelen = max(sizeof(struct sctphdr) + 8, + min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); + } + } } else stdreply: icmpelen = max(8, min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); From owner-svn-src-head@freebsd.org Wed May 25 23:06:53 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA951B4A0C1; Wed, 25 May 2016 23:06:53 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 69A011C3A; Wed, 25 May 2016 23:06:53 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PN6qsY033021; Wed, 25 May 2016 23:06:52 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PN6qAE033020; Wed, 25 May 2016 23:06:52 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201605252306.u4PN6qAE033020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim <jkim@FreeBSD.org> Date: Wed, 25 May 2016 23:06:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300700 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 25 May 2016 23:06:53 -0000 Author: jkim Date: Wed May 25 23:06:52 2016 New Revision: 300700 URL: https://svnweb.freebsd.org/changeset/base/300700 Log: Both Clang and GCC cannot generate efficient reserve_pv_entries(). http://docs.freebsd.org/cgi/mid.cgi?552BFEB2.8040407 Re-implement it entirely in inline assembly not to let compilers do silly spilling to memory. For non-POPCNT case, use newly added bit_count(3). Reported by: alc Reviewed by: alc, kib Differential Revision: https://reviews.freebsd.org/D6541 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed May 25 22:16:11 2016 (r300699) +++ head/sys/amd64/amd64/pmap.c Wed May 25 23:06:52 2016 (r300700) @@ -104,6 +104,7 @@ __FBSDID("$FreeBSD$"); #include "opt_vm.h" #include <sys/param.h> +#include <sys/bitstring.h> #include <sys/bus.h> #include <sys/systm.h> #include <sys/kernel.h> @@ -585,7 +586,7 @@ static caddr_t crashdumpmap; static void free_pv_chunk(struct pv_chunk *pc); static void free_pv_entry(pmap_t pmap, pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t pmap, struct rwlock **lockp); -static int popcnt_pc_map_elem_pq(uint64_t elem); +static int popcnt_pc_map_pq(uint64_t *map); static vm_page_t reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **lockp); static void reserve_pv_entries(pmap_t pmap, int needed, struct rwlock **lockp); @@ -3126,7 +3127,7 @@ retry: } /* - * Returns the number of one bits within the given PV chunk map element. + * Returns the number of one bits within the given PV chunk map. * * The erratas for Intel processors state that "POPCNT Instruction May * Take Longer to Execute Than Expected". It is believed that the @@ -3142,12 +3143,15 @@ retry: * 6th Gen Core: SKL029 */ static int -popcnt_pc_map_elem_pq(uint64_t elem) +popcnt_pc_map_pq(uint64_t *map) { - u_long result; + u_long result, tmp; - __asm __volatile("xorl %k0,%k0;popcntq %1,%0" - : "=&r" (result) : "rm" (elem)); + __asm __volatile("xorl %k0,%k0;popcntq %2,%0;" + "xorl %k1,%k1;popcntq %3,%1;addl %k1,%k0;" + "xorl %k1,%k1;popcntq %4,%1;addl %k1,%k0" + : "=&r" (result), "=&r" (tmp) + : "m" (map[0]), "m" (map[1]), "m" (map[2])); return (result); } @@ -3179,17 +3183,12 @@ retry: avail = 0; TAILQ_FOREACH(pc, &pmap->pm_pvchunk, pc_list) { #ifndef __POPCNT__ - if ((cpu_feature2 & CPUID2_POPCNT) == 0) { - free = bitcount64(pc->pc_map[0]); - free += bitcount64(pc->pc_map[1]); - free += bitcount64(pc->pc_map[2]); - } else + if ((cpu_feature2 & CPUID2_POPCNT) == 0) + bit_count((bitstr_t *)pc->pc_map, 0, + sizeof(pc->pc_map) * NBBY, &free); + else #endif - { - free = popcnt_pc_map_elem_pq(pc->pc_map[0]); - free += popcnt_pc_map_elem_pq(pc->pc_map[1]); - free += popcnt_pc_map_elem_pq(pc->pc_map[2]); - } + free = popcnt_pc_map_pq(pc->pc_map); if (free == 0) break; avail += free; From owner-svn-src-head@freebsd.org Thu May 26 00:03:25 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CCBCB4AD98; Thu, 26 May 2016 00:03:25 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0882C1301; Thu, 26 May 2016 00:03:24 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q03OO5054908; Thu, 26 May 2016 00:03:24 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q03NjC054902; Thu, 26 May 2016 00:03:23 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201605260003.u4Q03NjC054902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore <ian@FreeBSD.org> Date: Thu, 26 May 2016 00:03:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300701 - in head/sys: arm/arm arm/include sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 00:03:25 -0000 Author: ian Date: Thu May 26 00:03:23 2016 New Revision: 300701 URL: https://svnweb.freebsd.org/changeset/base/300701 Log: Disable alignment faults on armv6, adjust various alignment-related macros to match the new state of affairs. The hardware we support has always been able to do unaligned accesses, we've just never enabled it until now. This brings FreeBSD into line with all the other major OSes, and should help with the growing volume of 3rd-party software that assumes unaligned access will just work on armv6 and armv7. Modified: head/sys/arm/arm/locore-v6.S head/sys/arm/include/_align.h head/sys/arm/include/_types.h head/sys/arm/include/param.h head/sys/sys/param.h Modified: head/sys/arm/arm/locore-v6.S ============================================================================== --- head/sys/arm/arm/locore-v6.S Wed May 25 23:06:52 2016 (r300700) +++ head/sys/arm/arm/locore-v6.S Thu May 26 00:03:23 2016 (r300701) @@ -129,12 +129,12 @@ ASENTRY_NP(_start) */ 1: bic r7, #CPU_CONTROL_DC_ENABLE + bic r7, #CPU_CONTROL_AFLT_ENABLE bic r7, #CPU_CONTROL_MMU_ENABLE bic r7, #CPU_CONTROL_IC_ENABLE bic r7, #CPU_CONTROL_BPRD_ENABLE bic r7, #CPU_CONTROL_SW_ENABLE orr r7, #CPU_CONTROL_UNAL_ENABLE - orr r7, #CPU_CONTROL_AFLT_ENABLE orr r7, #CPU_CONTROL_VECRELOC mcr CP15_SCTLR(r7) DSB @@ -453,12 +453,12 @@ ASENTRY_NP(mpentry) /* Setup core, disable all caches. */ mrc CP15_SCTLR(r0) bic r0, #CPU_CONTROL_MMU_ENABLE + bic r0, #CPU_CONTROL_AFLT_ENABLE bic r0, #CPU_CONTROL_DC_ENABLE bic r0, #CPU_CONTROL_IC_ENABLE bic r0, #CPU_CONTROL_BPRD_ENABLE bic r0, #CPU_CONTROL_SW_ENABLE orr r0, #CPU_CONTROL_UNAL_ENABLE - orr r0, #CPU_CONTROL_AFLT_ENABLE orr r0, #CPU_CONTROL_VECRELOC mcr CP15_SCTLR(r0) DSB Modified: head/sys/arm/include/_align.h ============================================================================== --- head/sys/arm/include/_align.h Wed May 25 23:06:52 2016 (r300700) +++ head/sys/arm/include/_align.h Thu May 26 00:03:23 2016 (r300701) @@ -46,7 +46,11 @@ * is sufficient for any data type, pointer or numeric. The resulting type * is equivelent to arm's uintptr_t (but is purposely spelled "unsigned" here). */ +#if __ARM_ARCH >= 6 +#define _ALIGNBYTES (sizeof(int) - 1) +#else #define _ALIGNBYTES (sizeof(long long) - 1) +#endif #define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) #endif /* !_ARM_INCLUDE__ALIGN_H_ */ Modified: head/sys/arm/include/_types.h ============================================================================== --- head/sys/arm/include/_types.h Wed May 25 23:06:52 2016 (r300700) +++ head/sys/arm/include/_types.h Thu May 26 00:03:23 2016 (r300701) @@ -43,6 +43,10 @@ #error this file needs sys/cdefs.h as a prerequisite #endif +#if __ARM_ARCH >= 6 +#define __NO_STRICT_ALIGNMENT +#endif + /* * Basic types upon which most other types are built. */ Modified: head/sys/arm/include/param.h ============================================================================== --- head/sys/arm/include/param.h Wed May 25 23:06:52 2016 (r300700) +++ head/sys/arm/include/param.h Thu May 26 00:03:23 2016 (r300701) @@ -90,8 +90,16 @@ * is valid to fetch data elements of type t from on this architecture. * This does not reflect the optimal alignment, just the possibility * (within reasonable limits). + * + * armv4 and v5 require alignment to the type's size. armv6 and later require + * that an 8-byte type be aligned to at least a 4-byte boundary; access to + * smaller types can be unaligned. */ +#if __ARM_ARCH >= 6 +#define ALIGNED_POINTER(p, t) (((sizeof(t) != 8) || ((unsigned)(p) & 3) == 0)) +#else #define ALIGNED_POINTER(p, t) ((((unsigned)(p)) & (sizeof(t)-1)) == 0) +#endif /* * CACHE_LINE_SIZE is the compile-time maximum cache line size for an Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Wed May 25 23:06:52 2016 (r300700) +++ head/sys/sys/param.h Thu May 26 00:03:23 2016 (r300701) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100112 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100113 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Thu May 26 00:43:09 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86251B48394; Thu, 26 May 2016 00:43:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6093E12C8; Thu, 26 May 2016 00:43:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q0h8GW069174; Thu, 26 May 2016 00:43:08 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q0h8S5069171; Thu, 26 May 2016 00:43:08 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605260043.u4Q0h8S5069171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Thu, 26 May 2016 00:43:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300702 - head/sys/dev/bhnd/cores/chipc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 00:43:09 -0000 Author: adrian Date: Thu May 26 00:43:08 2016 New Revision: 300702 URL: https://svnweb.freebsd.org/changeset/base/300702 Log: [bhnd] Integrate bhnd_chipc's BUS_ADD_CHILD() with a child resource mapping table. This adds support for automatically configuring bhnd_chipc bus children with associated resources, using an internal 'hints' table based directly on Michael Zhilin's chipc resource mapping work. The bhnd_sprom_chipc driver has been converted to use DEVICE_IDENTIFY() with the new resource table. This should be nearly drop-in compatible with the child device drivers in D6250. Submitted by: Landon Fuller <landonf@landonf.org> Reviewed by: Michael Zhilin <mizhka@gmail.com> Differential Revision: https://reviews.freebsd.org/D6525 Modified: head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c head/sys/dev/bhnd/cores/chipc/chipc.c head/sys/dev/bhnd/cores/chipc/chipcreg.h Modified: head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c ============================================================================== --- head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c Thu May 26 00:03:23 2016 (r300701) +++ head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c Thu May 26 00:43:08 2016 (r300702) @@ -46,9 +46,23 @@ __FBSDID("$FreeBSD$"); #include <dev/bhnd/nvram/bhnd_nvram.h> #include <dev/bhnd/nvram/bhnd_spromvar.h> -#include "bhnd_chipc_if.h" #include "bhnd_nvram_if.h" +#include "chipc.h" + +static void +chipc_sprom_identify(driver_t *driver, device_t parent) +{ + if (bhnd_chipc_nvram_src(parent) != BHND_NVRAM_SRC_SPROM) + return; + + if (device_find_child(parent, "bhnd_nvram", 0) != NULL) + return; + + if (BUS_ADD_CHILD(parent, 0, "bhnd_nvram", 0) == NULL) + device_printf(parent, "add bhnd_nvram failed\n"); +} + static int chipc_sprom_probe(device_t dev) { @@ -87,6 +101,7 @@ chipc_sprom_attach(device_t dev) static device_method_t chipc_sprom_methods[] = { /* Device interface */ + DEVMETHOD(device_identify, chipc_sprom_identify), DEVMETHOD(device_probe, chipc_sprom_probe), DEVMETHOD(device_attach, chipc_sprom_attach), DEVMETHOD_END Modified: head/sys/dev/bhnd/cores/chipc/chipc.c ============================================================================== --- head/sys/dev/bhnd/cores/chipc/chipc.c Thu May 26 00:03:23 2016 (r300701) +++ head/sys/dev/bhnd/cores/chipc/chipc.c Thu May 26 00:43:08 2016 (r300702) @@ -98,6 +98,32 @@ static struct bhnd_device_quirk chipc_qu BHND_DEVICE_QUIRK_END }; + +static const struct chipc_hint { + const char *name; + int unit; + int type; + int rid; + rman_res_t base; /* relative to parent resource */ + rman_res_t size; + u_int port; /* ignored if SYS_RES_IRQ */ + u_int region; +} chipc_hints[] = { + // FIXME: cfg/spi port1.1 mapping on siba(4) SoCs + /* device unit type rid base size port,region */ + { "bhnd_nvram", 0, SYS_RES_MEMORY, 0, CHIPC_SPROM_OTP, CHIPC_SPROM_OTP_SIZE, 0,0 }, + { "uart", 0, SYS_RES_MEMORY, 0, CHIPC_UART0_BASE, CHIPC_UART_SIZE, 0,0 }, + { "uart", 0, SYS_RES_IRQ, 0, 0, RM_MAX_END }, + { "uart", 1, SYS_RES_MEMORY, 0, CHIPC_UART1_BASE, CHIPC_UART_SIZE, 0,0 }, + { "uart", 1, SYS_RES_IRQ, 0, 0, RM_MAX_END }, + { "spi", 0, SYS_RES_MEMORY, 0, 0, RM_MAX_END, 1,1 }, + { "spi", 0, SYS_RES_MEMORY, 1, CHIPC_SFLASH_BASE, CHIPC_SFLASH_SIZE, 0,0 }, + { "cfi", 0, SYS_RES_MEMORY, 0, 0, RM_MAX_END, 1,1}, + { "cfi", 0, SYS_RES_MEMORY, 1, CHIPC_SFLASH_BASE, CHIPC_SFLASH_SIZE, 0,0 }, + { NULL } +}; + + static int chipc_try_activate_resource( struct chipc_softc *sc, device_t child, int type, int rid, struct resource *r, @@ -106,7 +132,6 @@ static int chipc_try_activate_resourc static int chipc_read_caps(struct chipc_softc *sc, struct chipc_caps *caps); -static int chipc_nvram_attach(struct chipc_softc *sc); static bhnd_nvram_src_t chipc_nvram_identify(struct chipc_softc *sc); static bool chipc_should_enable_sprom( struct chipc_softc *sc); @@ -210,12 +235,11 @@ chipc_attach(device_t dev) if (bootverbose) chipc_print_caps(sc->dev, &sc->caps); - /* Identify NVRAM source and add child device. */ + /* Identify NVRAM source */ sc->nvram_src = chipc_nvram_identify(sc); - if ((error = chipc_nvram_attach(sc))) - goto failed; - /* Standard bus probe */ + /* Probe and attach children */ + bus_generic_probe(dev); if ((error = bus_generic_attach(dev))) goto failed; @@ -335,51 +359,6 @@ chipc_read_caps(struct chipc_softc *sc, } /** - * If supported, add an appropriate NVRAM child device. - */ -static int -chipc_nvram_attach(struct chipc_softc *sc) -{ - device_t nvram_dev; - rman_res_t start; - int error; - - switch (sc->nvram_src) { - case BHND_NVRAM_SRC_OTP: - // TODO OTP support - device_printf(sc->dev, "OTP nvram source unsupported\n"); - return (0); - - case BHND_NVRAM_SRC_SPROM: - /* Add OTP/SPROM device */ - nvram_dev = BUS_ADD_CHILD(sc->dev, 0, "bhnd_nvram", -1); - if (nvram_dev == NULL) { - device_printf(sc->dev, "failed to add NVRAM device\n"); - return (ENXIO); - } - - start = rman_get_start(sc->core->res) + CHIPC_SPROM_OTP; - error = bus_set_resource(nvram_dev, SYS_RES_MEMORY, 0, start, - CHIPC_SPROM_OTP_SIZE); - return (error); - - case BHND_NVRAM_SRC_FLASH: - // TODO flash support - device_printf(sc->dev, "flash nvram source unsupported\n"); - return (0); - - case BHND_NVRAM_SRC_UNKNOWN: - /* Handled externally */ - return (0); - - default: - device_printf(sc->dev, "invalid nvram source: %u\n", - sc->nvram_src); - return (ENXIO); - } -} - -/** * Determine the NVRAM data source for this device. * * @param sc chipc driver state. @@ -500,7 +479,9 @@ static device_t chipc_add_child(device_t dev, u_int order, const char *name, int unit) { struct chipc_devinfo *dinfo; + const struct chipc_hint *hint; device_t child; + int error; child = device_add_child_ordered(dev, order, name, unit); if (child == NULL) @@ -513,10 +494,81 @@ chipc_add_child(device_t dev, u_int orde } resource_list_init(&dinfo->resources); - device_set_ivars(child, dinfo); + /* Hint matching requires a device name */ + if (name == NULL) + return (child); + + /* Use hint table to set child resources */ + for (hint = chipc_hints; hint->name != NULL; hint++) { + bhnd_addr_t region_addr; + bhnd_size_t region_size; + + if (strcmp(hint->name, name) != 0) + continue; + + switch (hint->type) { + case SYS_RES_IRQ: + /* Add child resource */ + error = bus_set_resource(child, hint->type, hint->rid, + hint->base, hint->size); + if (error) { + device_printf(dev, + "bus_set_resource() failed for %s: %d\n", + device_get_nameunit(child), error); + goto failed; + } + break; + + case SYS_RES_MEMORY: + /* Fetch region address and size */ + error = bhnd_get_region_addr(dev, BHND_PORT_DEVICE, + hint->port, hint->region, ®ion_addr, + ®ion_size); + if (error) { + device_printf(dev, + "lookup of %s%u.%u failed: %d\n", + bhnd_port_type_name(BHND_PORT_DEVICE), + hint->port, hint->region, error); + goto failed; + } + + /* Verify requested range is mappable */ + if (hint->base > region_size || + hint->size > region_size || + region_size - hint->base < hint->size ) + { + device_printf(dev, + "%s%u.%u region cannot map requested range " + "%#jx+%#jx\n", + bhnd_port_type_name(BHND_PORT_DEVICE), + hint->port, hint->region, hint->base, + hint->size); + } + + /* Add child resource */ + error = bus_set_resource(child, hint->type, + hint->rid, region_addr + hint->base, hint->size); + if (error) { + device_printf(dev, + "bus_set_resource() failed for %s: %d\n", + device_get_nameunit(child), error); + goto failed; + } + break; + default: + device_printf(child, "unknown hint resource type: %d\n", + hint->type); + break; + } + } + return (child); + +failed: + device_delete_child(dev, child); + return (NULL); } static void Modified: head/sys/dev/bhnd/cores/chipc/chipcreg.h ============================================================================== --- head/sys/dev/bhnd/cores/chipc/chipcreg.h Thu May 26 00:03:23 2016 (r300701) +++ head/sys/dev/bhnd/cores/chipc/chipcreg.h Thu May 26 00:43:08 2016 (r300702) @@ -61,6 +61,8 @@ #define CHIPC_JTAGDR 0x38 #define CHIPC_JTAGCTRL 0x3c +#define CHIPC_SFLASH_BASE 0x40 +#define CHIPC_SFLASH_SIZE 12 #define CHIPC_SFLASHCTRL 0x40 #define CHIPC_SFLASHADDR 0x44 #define CHIPC_SFLASHDATA 0x48 @@ -171,11 +173,15 @@ #define CHIPC_CLK_CTL_ST 0x1E0 #define CHIPC_SPROM_HWWAR 0x19 -#define CHIPC_UART0 0x300 -#define CHIPC_UART1 0x400 +#define CHIPC_UART_BASE 0x300 +#define CHIPC_UART_SIZE 0x100 +#define CHIPC_UART0_BASE CHIPC_UART_BASE +#define CHIPC_UART1_BASE (CHIPC_UART_BASE + CHIPC_UART_SIZE) /* PMU registers (rev >= 20) */ #define CHIPC_PMU_BASE 0x600 +#define CHIPC_PMU_SIZE 0x70 + #define CHIPC_PMU_CTRL 0x600 #define CHIPC_PMU_CAP 0x604 #define CHIPC_PMU_ST 0x608 From owner-svn-src-head@freebsd.org Thu May 26 00:44:17 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE99BB48405; Thu, 26 May 2016 00:44:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9FF0814C7; Thu, 26 May 2016 00:44:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q0iGOx069276; Thu, 26 May 2016 00:44:16 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q0iGcu069274; Thu, 26 May 2016 00:44:16 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605260044.u4Q0iGcu069274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Thu, 26 May 2016 00:44:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300703 - head/sys/dev/bhnd/cores/chipc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 00:44:17 -0000 Author: adrian Date: Thu May 26 00:44:16 2016 New Revision: 300703 URL: https://svnweb.freebsd.org/changeset/base/300703 Log: [bhnd] Fix release of uninitialized SPROM shadow in chipc detach. This was triggering a panic on detach; the SPROM shadow is now maintained by the bhnd_sprom_chipc driver, and should be removed from chipc. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6548 Modified: head/sys/dev/bhnd/cores/chipc/chipc.c head/sys/dev/bhnd/cores/chipc/chipcvar.h Modified: head/sys/dev/bhnd/cores/chipc/chipc.c ============================================================================== --- head/sys/dev/bhnd/cores/chipc/chipc.c Thu May 26 00:43:08 2016 (r300702) +++ head/sys/dev/bhnd/cores/chipc/chipc.c Thu May 26 00:44:16 2016 (r300703) @@ -269,7 +269,6 @@ chipc_detach(device_t dev) chipc_release_region(sc, sc->core_region, RF_ALLOCATED|RF_ACTIVE); chipc_free_rman(sc); - bhnd_sprom_fini(&sc->sprom); CHIPC_LOCK_DESTROY(sc); Modified: head/sys/dev/bhnd/cores/chipc/chipcvar.h ============================================================================== --- head/sys/dev/bhnd/cores/chipc/chipcvar.h Thu May 26 00:43:08 2016 (r300702) +++ head/sys/dev/bhnd/cores/chipc/chipcvar.h Thu May 26 00:44:16 2016 (r300703) @@ -186,12 +186,8 @@ struct chipc_softc { bhnd_nvram_src_t nvram_src; /**< identified NVRAM source */ struct mtx mtx; /**< state mutex. */ - - struct bhnd_sprom sprom; /**< OTP/SPROM shadow, if any */ - size_t sprom_refcnt; /**< SPROM hardware refcount */ - + size_t sprom_refcnt; /**< SPROM pin enable refcount */ struct rman mem_rman; /**< port memory manager */ - STAILQ_HEAD(, chipc_region) mem_regions;/**< memory allocation records */ }; From owner-svn-src-head@freebsd.org Thu May 26 01:19:14 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2A2FB48BCC; Thu, 26 May 2016 01:19:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83CA51117; Thu, 26 May 2016 01:19:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q1JDM6080364; Thu, 26 May 2016 01:19:13 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q1JDDp080363; Thu, 26 May 2016 01:19:13 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605260119.u4Q1JDDp080363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Thu, 26 May 2016 01:19:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300704 - head/sys/dev/flash X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 01:19:14 -0000 Author: adrian Date: Thu May 26 01:19:13 2016 New Revision: 300704 URL: https://svnweb.freebsd.org/changeset/base/300704 Log: [mx25l] add Winbond w25x64 support. PR: https://github.com/freebsd/freebsd/pull/16 Submitted by: https://github.com/epipenau Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Thu May 26 00:44:16 2016 (r300703) +++ head/sys/dev/flash/mx25l.c Thu May 26 01:19:13 2016 (r300704) @@ -124,6 +124,7 @@ struct mx25l_flash_ident flash_devices[] /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ { "w25x32", 0xef, 0x3016, 64 * 1024, 64, FL_ERASE_4K }, + { "w25x64", 0xef, 0x3017, 64 * 1024, 128, FL_ERASE_4K }, { "w25q32", 0xef, 0x4016, 64 * 1024, 64, FL_ERASE_4K }, { "w25q64", 0xef, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, { "w25q64bv", 0xef, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, From owner-svn-src-head@freebsd.org Thu May 26 01:33:25 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA68FB492E9; Thu, 26 May 2016 01:33:25 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70E1F1CBC; Thu, 26 May 2016 01:33:25 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q1XOXS087711; Thu, 26 May 2016 01:33:24 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q1XOl5087710; Thu, 26 May 2016 01:33:24 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605260133.u4Q1XOl5087710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Thu, 26 May 2016 01:33:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300705 - head/usr.bin/fortune/unstr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 01:33:25 -0000 Author: truckman Date: Thu May 26 01:33:24 2016 New Revision: 300705 URL: https://svnweb.freebsd.org/changeset/base/300705 Log: Avoid buffer overflow when copying the input file name and appending .dat. Check the return value from fread() to be sure that it was successful. Reported by: Coverity CID: 1006709, 1009452 MFC after: 1 week Modified: head/usr.bin/fortune/unstr/unstr.c Modified: head/usr.bin/fortune/unstr/unstr.c ============================================================================== --- head/usr.bin/fortune/unstr/unstr.c Thu May 26 01:19:13 2016 (r300704) +++ head/usr.bin/fortune/unstr/unstr.c Thu May 26 01:33:24 2016 (r300705) @@ -86,13 +86,19 @@ main(int argc, char *argv[]) exit(1); } Infile = argv[1]; - strcpy(Datafile, Infile); - strcat(Datafile, ".dat"); + if ((size_t)snprintf(Datafile, sizeof(Datafile), "%s.dat", Infile) >= + sizeof(Datafile)) + errx(1, "%s name too long", Infile); if ((Inf = fopen(Infile, "r")) == NULL) err(1, "%s", Infile); if ((Dataf = fopen(Datafile, "r")) == NULL) err(1, "%s", Datafile); - fread((char *)&tbl, sizeof(tbl), 1, Dataf); + if (fread((char *)&tbl, sizeof(tbl), 1, Dataf) != 1) { + if (feof(Dataf)) + errx(1, "%s read EOF", Datafile); + else + err(1, "%s read", Datafile); + } tbl.str_version = be32toh(tbl.str_version); tbl.str_numstr = be32toh(tbl.str_numstr); tbl.str_longlen = be32toh(tbl.str_longlen); From owner-svn-src-head@freebsd.org Thu May 26 01:45:05 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79B5FB49591; Thu, 26 May 2016 01:45:05 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B9B51157; Thu, 26 May 2016 01:45:05 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q1j4N2091336; Thu, 26 May 2016 01:45:04 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q1j4im091335; Thu, 26 May 2016 01:45:04 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605260145.u4Q1j4im091335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis <truckman@FreeBSD.org> Date: Thu, 26 May 2016 01:45:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300706 - head/usr.sbin/tzsetup X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 01:45:05 -0000 Author: truckman Date: Thu May 26 01:45:04 2016 New Revision: 300706 URL: https://svnweb.freebsd.org/changeset/base/300706 Log: Avoid buffer overflow or truncation when constructing path_zoneinfo_file. Reported by: Coverity CID: 1011160 MFC after: 1 week Modified: head/usr.sbin/tzsetup/tzsetup.c Modified: head/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- head/usr.sbin/tzsetup/tzsetup.c Thu May 26 01:33:24 2016 (r300705) +++ head/usr.sbin/tzsetup/tzsetup.c Thu May 26 01:45:04 2016 (r300706) @@ -838,7 +838,9 @@ install_zoneinfo(const char *zoneinfo) FILE *f; char path_zoneinfo_file[MAXPATHLEN]; - sprintf(path_zoneinfo_file, "%s/%s", path_zoneinfo, zoneinfo); + if ((size_t)snprintf(path_zoneinfo_file, sizeof(path_zoneinfo_file), + "%s/%s", path_zoneinfo, zoneinfo) >= sizeof(path_zoneinfo_file)) + errx(1, "%s/%s name too long", path_zoneinfo, zoneinfo); rv = install_zoneinfo_file(path_zoneinfo_file); /* Save knowledge for later */ From owner-svn-src-head@freebsd.org Thu May 26 02:55:42 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCE85B4ADFF; Thu, 26 May 2016 02:55:42 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 936601240; Thu, 26 May 2016 02:55:42 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q2tfLD016895; Thu, 26 May 2016 02:55:41 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q2tfc4016894; Thu, 26 May 2016 02:55:41 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201605260255.u4Q2tfc4016894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore <ian@FreeBSD.org> Date: Thu, 26 May 2016 02:55:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300707 - head/sys/dev/sdhci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 02:55:42 -0000 Author: ian Date: Thu May 26 02:55:41 2016 New Revision: 300707 URL: https://svnweb.freebsd.org/changeset/base/300707 Log: Add a convenience macro that masks all the bits related to clock divisors in all versions of the sdhci spec (the HI bits are just unused reserved bits in earlier versions). Modified: head/sys/dev/sdhci/sdhci.h Modified: head/sys/dev/sdhci/sdhci.h ============================================================================== --- head/sys/dev/sdhci/sdhci.h Thu May 26 01:45:04 2016 (r300706) +++ head/sys/dev/sdhci/sdhci.h Thu May 26 02:55:41 2016 (r300707) @@ -153,6 +153,9 @@ #define SDHCI_CLOCK_CARD_EN 0x0004 #define SDHCI_CLOCK_INT_STABLE 0x0002 #define SDHCI_CLOCK_INT_EN 0x0001 +#define SDHCI_DIVIDERS_MASK \ + ((SDHCI_DIVIDER_MASK << SDHCI_DIVIDER_SHIFT) | \ + (SDHCI_DIVIDER_HI_MASK << SDHCI_DIVIDER_HI_SHIFT)) #define SDHCI_TIMEOUT_CONTROL 0x2E From owner-svn-src-head@freebsd.org Thu May 26 03:50:53 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DCD0B4A951; Thu, 26 May 2016 03:50:53 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 459F41158; Thu, 26 May 2016 03:50:53 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q3oqwD037268; Thu, 26 May 2016 03:50:52 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q3oqAg037266; Thu, 26 May 2016 03:50:52 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605260350.u4Q3oqAg037266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau <sephe@FreeBSD.org> Date: Thu, 26 May 2016 03:50:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300708 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 03:50:53 -0000 Author: sephe Date: Thu May 26 03:50:52 2016 New Revision: 300708 URL: https://svnweb.freebsd.org/changeset/base/300708 Log: hyperv: Rework guest id settings according to Hyper-V spec MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6553 Modified: head/sys/dev/hyperv/vmbus/hv_hv.c head/sys/dev/hyperv/vmbus/hyperv_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_hv.c Thu May 26 02:55:41 2016 (r300707) +++ head/sys/dev/hyperv/vmbus/hv_hv.c Thu May 26 03:50:52 2016 (r300708) @@ -52,34 +52,24 @@ __FBSDID("$FreeBSD$"); #define HYPERV_INTERFACE 0x31237648 /* HV#1 */ -/* - * The guest OS needs to register the guest ID with the hypervisor. - * The guest ID is a 64 bit entity and the structure of this ID is - * specified in the Hyper-V specification: - * - * http://msdn.microsoft.com/en-us/library/windows/ - * hardware/ff542653%28v=vs.85%29.aspx - * - * While the current guideline does not specify how FreeBSD guest ID(s) - * need to be generated, our plan is to publish the guidelines for - * FreeBSD and other guest operating systems that currently are hosted - * on Hyper-V. The implementation here conforms to this yet - * unpublished guidelines. - * - * Bit(s) - * 63 - Indicates if the OS is Open Source or not; 1 is Open Source - * 62:56 - Os Type: FreeBSD is 0x02 - * 55:48 - Distro specific identification - * 47:16 - FreeBSD kernel version number - * 15:0 - Distro specific identification - */ -#define HYPERV_GUESTID_OSS (0x1ULL << 63) -#define HYPERV_GUESTID_FREEBSD (0x02ULL << 56) -#define HYPERV_GUESTID(id) \ - (HYPERV_GUESTID_OSS | HYPERV_GUESTID_FREEBSD | \ - (((uint64_t)(((id) & 0xff0000) >> 16)) << 48) |\ - (((uint64_t)__FreeBSD_version) << 16) | \ - ((uint64_t)((id) & 0x00ffff))) +#define HYPERV_FREEBSD_BUILD 0ULL +#define HYPERV_FREEBSD_VERSION ((uint64_t)__FreeBSD_version) +#define HYPERV_FREEBSD_OSID 0ULL + +#define MSR_HV_GUESTID_BUILD_FREEBSD \ + (HYPERV_FREEBSD_BUILD & MSR_HV_GUESTID_BUILD_MASK) +#define MSR_HV_GUESTID_VERSION_FREEBSD \ + ((HYPERV_FREEBSD_VERSION << MSR_HV_GUESTID_VERSION_SHIFT) & \ + MSR_HV_GUESTID_VERSION_MASK) +#define MSR_HV_GUESTID_OSID_FREEBSD \ + ((HYPERV_FREEBSD_OSID << MSR_HV_GUESTID_OSID_SHIFT) & \ + MSR_HV_GUESTID_OSID_MASK) + +#define MSR_HV_GUESTID_FREEBSD \ + (MSR_HV_GUESTID_BUILD_FREEBSD | \ + MSR_HV_GUESTID_VERSION_FREEBSD | \ + MSR_HV_GUESTID_OSID_FREEBSD | \ + MSR_HV_GUESTID_OSTYPE_FREEBSD) struct hypercall_ctx { void *hc_addr; @@ -321,8 +311,8 @@ hyperv_init(void *dummy __unused) return; } - /* Write guest id */ - wrmsr(HV_X64_MSR_GUEST_OS_ID, HYPERV_GUESTID(0)); + /* Set guest id */ + wrmsr(MSR_HV_GUEST_OS_ID, MSR_HV_GUESTID_FREEBSD); if (hyperv_features & HV_FEATURE_MSR_TIME_REFCNT) { /* Register virtual timecount */ Modified: head/sys/dev/hyperv/vmbus/hyperv_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv_reg.h Thu May 26 02:55:41 2016 (r300707) +++ head/sys/dev/hyperv/vmbus/hyperv_reg.h Thu May 26 03:50:52 2016 (r300708) @@ -29,6 +29,20 @@ #ifndef _HYPERV_REG_H_ #define _HYPERV_REG_H_ +#define MSR_HV_GUEST_OS_ID 0x40000000 +#define MSR_HV_GUESTID_BUILD_MASK 0xffffULL +#define MSR_HV_GUESTID_VERSION_MASK 0x0000ffffffff0000ULL +#define MSR_HV_GUESTID_VERSION_SHIFT 16 +#define MSR_HV_GUESTID_OSID_MASK 0x00ff000000000000ULL +#define MSR_HV_GUESTID_OSID_SHIFT 48 +#define MSR_HV_GUESTID_OSTYPE_MASK 0x7f00000000000000ULL +#define MSR_HV_GUESTID_OSTYPE_SHIFT 56 +#define MSR_HV_GUESTID_OPENSRC 0x8000000000000000ULL +#define MSR_HV_GUESTID_OSTYPE_LINUX \ + ((0x01ULL << MSR_HV_GUESTID_OSTYPE_SHIFT) | MSR_HV_GUESTID_OPENSRC) +#define MSR_HV_GUESTID_OSTYPE_FREEBSD \ + ((0x02ULL << MSR_HV_GUESTID_OSTYPE_SHIFT) | MSR_HV_GUESTID_OPENSRC) + #define MSR_HV_HYPERCALL 0x40000001 #define MSR_HV_HYPERCALL_ENABLE 0x0001ULL #define MSR_HV_HYPERCALL_RSVD_MASK 0x0ffeULL From owner-svn-src-head@freebsd.org Thu May 26 03:55:29 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F097B4AAD5; Thu, 26 May 2016 03:55:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BFCAF167D; Thu, 26 May 2016 03:55:28 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q3tSwe040072; Thu, 26 May 2016 03:55:28 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q3tStH040071; Thu, 26 May 2016 03:55:28 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201605260355.u4Q3tStH040071@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore <ian@FreeBSD.org> Date: Thu, 26 May 2016 03:55:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300709 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 03:55:29 -0000 Author: ian Date: Thu May 26 03:55:27 2016 New Revision: 300709 URL: https://svnweb.freebsd.org/changeset/base/300709 Log: Another round of changes to add compatibility with the older ESHDC variety of hardware. Mostly this focuses on the big changes needed for setting the bus clock, because ESDHC is SDHCI v2.0 and USDHC is 3.0, and the number, location, and interpretation of clock divisor bits is vastly different between the two. This doesn't get the device all the way to functioning on ESDHC hardware yet, but it's much closer, now getting through all the card detection and negotiation of capabilties and speed (but it eventually hangs on what appears to be a missing interrupt). Another missing chunk of code for handling ESDHC's 32 bit command-and-mode register using sdhci's pair of 16 bit writes is added. This also does some leading whitespace cleanups and sorts some softc struct members by size, and adds some comments (because when do I ever touch code without adding comments?). Modified: head/sys/arm/freescale/imx/imx_sdhci.c Modified: head/sys/arm/freescale/imx/imx_sdhci.c ============================================================================== --- head/sys/arm/freescale/imx/imx_sdhci.c Thu May 26 03:50:52 2016 (r300708) +++ head/sys/arm/freescale/imx/imx_sdhci.c Thu May 26 03:55:27 2016 (r300709) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include <sys/bus.h> #include <sys/callout.h> #include <sys/kernel.h> +#include <sys/libkern.h> #include <sys/lock.h> #include <sys/malloc.h> #include <sys/module.h> @@ -74,12 +75,12 @@ struct imx_sdhci_softc { struct callout r1bfix_callout; sbintime_t r1bfix_timeout_at; uint32_t baseclk_hz; - uint32_t sdclockreg_freq_bits; uint32_t cmd_and_mode; uint32_t r1bfix_intmask; + boolean_t force_card_present; + uint16_t sdclockreg_freq_bits; uint8_t r1bfix_type; uint8_t hwtype; - boolean_t force_card_present; }; #define R1BFIX_NONE 0 /* No fix needed at next interrupt. */ @@ -90,6 +91,12 @@ struct imx_sdhci_softc { #define HWTYPE_ESDHC 1 /* imx5x and earlier. */ #define HWTYPE_USDHC 2 /* imx6. */ +/* + * Freescale-specific registers, or in some cases the layout of bits within the + * sdhci-defined register is different on Freescale. These names all begin with + * SDHC_ (not SDHCI_). + */ + #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. */ @@ -138,11 +145,20 @@ struct imx_sdhci_softc { #define SDHC_PROT_CDTL (1 << 6) #define SDHC_PROT_CDSS (1 << 7) +#define SDHC_SYS_CTRL 0x2c #define SDHC_INT_STATUS 0x30 +/* + * The clock enable bits exist in different registers for ESDHC vs USDHC, but + * they are the same bits in both cases. The divisor values go into the + * standard sdhci clock register, but in different bit positions and meanings + than the sdhci spec values. + */ #define SDHC_CLK_IPGEN (1 << 0) #define SDHC_CLK_HCKEN (1 << 1) #define SDHC_CLK_PEREN (1 << 2) +#define SDHC_CLK_SDCLKEN (1 << 3) +#define SDHC_CLK_ENABLE_MASK 0x0000000f #define SDHC_CLK_DIVISOR_MASK 0x000000f0 #define SDHC_CLK_DIVISOR_SHIFT 4 #define SDHC_CLK_PRESCALE_MASK 0x0000ff00 @@ -156,7 +172,8 @@ static struct ofw_compat_data compat_dat {NULL, HWTYPE_NONE}, }; -static void imx_sdhc_set_clock(struct imx_sdhci_softc *sc, int enable); +static uint16_t imx_sdhc_get_clock(struct imx_sdhci_softc *sc); +static void imx_sdhc_set_clock(struct imx_sdhci_softc *sc, uint16_t val); static void imx_sdhci_r1bfix_func(void *arg); static inline uint32_t @@ -186,7 +203,7 @@ imx_sdhci_read_1(device_t dev, struct sd */ if (off == SDHCI_HOST_CONTROL) { wrk32 = RD4(sc, SDHC_PROT_CTRL); - val32 = wrk32 & (SDHCI_CTRL_LED | SDHCI_CTRL_CARD_DET | + val32 = wrk32 & (SDHCI_CTRL_LED | SDHCI_CTRL_CARD_DET | SDHCI_CTRL_FORCE_CARD); switch (wrk32 & SDHC_PROT_WIDTH_MASK) { case SDHC_PROT_WIDTH_1BIT: @@ -204,7 +221,7 @@ imx_sdhci_read_1(device_t dev, struct sd /* Value is already 0. */ break; case SDHC_PROT_ADMA1: - /* This value is deprecated, should never appear. */ + /* This value is deprecated, should never appear. */ break; case SDHC_PROT_ADMA2: val32 |= SDHCI_CTRL_ADMA2; @@ -221,7 +238,7 @@ imx_sdhci_read_1(device_t dev, struct sd * power is always on and always set to the same voltage. */ if (off == SDHCI_POWER_CONTROL) { - return (SDHCI_POWER_ON | SDHCI_POWER_300); + return (SDHCI_POWER_ON | SDHCI_POWER_300); } @@ -232,7 +249,7 @@ 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; + uint32_t val32; if (sc->hwtype == HWTYPE_USDHC) { /* @@ -258,9 +275,9 @@ imx_sdhci_read_2(device_t dev, struct sd * 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); + } else if (off == SDHCI_COMMAND_FLAGS) { + return (sc->cmd_and_mode >> 16); } } @@ -276,22 +293,11 @@ imx_sdhci_read_2(device_t dev, struct sd } /* - * 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. + * Clock bits are scattered into various registers which differ by + * hardware type, complex enough to have their own function. */ 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, SDHC_PRES_STATE); - if (wrk32 & SDHC_PRES_SDSTB) - val32 |= SDHCI_CLOCK_INT_STABLE; - val32 |= sc->sdclockreg_freq_bits; - return (val32); + return (imx_sdhc_get_clock(sc)); } return ((RD4(sc, off & ~3) >> (off & 3) * 8) & 0xffff); @@ -307,9 +313,11 @@ imx_sdhci_read_4(device_t dev, struct sd /* * 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. + * register, but we filled it in by setting slot->max_clk at attach time + * rather than here, because we can't represent frequencies above 63MHz + * in an sdhci 2.0 capabliities register. 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). @@ -318,7 +326,6 @@ imx_sdhci_read_4(device_t dev, struct sd 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); } @@ -326,7 +333,7 @@ imx_sdhci_read_4(device_t dev, struct sd * The hardware moves bits around in the present state register to make * room for all 8 data line state bits. To translate, mask out all the * bits which are not in the same position in both registers (this also - * masks out some freescale-specific bits in locations defined as + * masks out some Freescale-specific bits in locations defined as * reserved by sdhci), then shift the data line and retune request bits * down to their standard locations. */ @@ -404,31 +411,12 @@ imx_sdhci_write_2(device_t dev, struct s 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. + * The clock control stuff is complex enough to have its own function + * that can handle the ESDHC versus USDHC differences. */ 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); - } + imx_sdhc_set_clock(sc, val); return; } @@ -461,6 +449,35 @@ imx_sdhci_write_2(device_t dev, struct s } } + /* + * The USDHC hardware moved the transfer mode bits to mixed control; we + * just write them there and we're done. The ESDHC hardware has the + * typical combined cmd-and-mode register that allows only 32-bit + * access, so when writing the mode bits just save them, then later when + * writing the command bits, add in the saved mode bits. + */ + 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; + } + } else if (sc->hwtype == HWTYPE_ESDHC) { + if (off == SDHCI_TRANSFER_MODE) { + sc->cmd_and_mode = + (sc->cmd_and_mode & 0xffff0000) | val; + return; + } else if (off == SDHCI_COMMAND_FLAGS) { + sc->cmd_and_mode = + (sc->cmd_and_mode & 0xffff) | (val << 16); + WR4(sc, SDHCI_TRANSFER_MODE, sc->cmd_and_mode); + return; + } + } + val32 = RD4(sc, off & ~3); val32 &= ~(0xffff << (off & 3) * 8); val32 |= ((val & 0xffff) << (off & 3) * 8); @@ -489,40 +506,103 @@ imx_sdhci_write_multi_4(device_t dev, st bus_write_multi_4(sc->mem_res, off, data, count); } -static void -imx_sdhc_set_clock(struct imx_sdhci_softc *sc, int enable) +static uint16_t +imx_sdhc_get_clock(struct imx_sdhci_softc *sc) { - uint32_t divisor, enable_bits, enable_reg, freq, prescale, val32; + uint16_t val; + + /* + * Whenever the sdhci driver writes the clock register we save a + * snapshot of just the frequency bits, so that we can play them back + * here on a register read without recalculating the frequency from the + * prescalar and divisor bits in the real register. We'll start with + * those bits, and mix in the clock status and enable bits that come + * from different places depending on which hardware we've got. + */ + val = sc->sdclockreg_freq_bits; + + /* + * The internal clock is always enabled (actually, the hardware manages + * it). Whether the internal clock is stable yet after a frequency + * change comes from the present-state register on both hardware types. + */ + val |= SDHCI_CLOCK_INT_EN; + if (RD4(sc, SDHC_PRES_STATE) & SDHC_PRES_SDSTB) + val |= SDHCI_CLOCK_INT_STABLE; + /* + * On ESDHC hardware the card bus clock enable is in the usual sdhci + * register but it's a different bit, so transcribe it (note the + * difference between standard SDHCI_ and Freescale SDHC_ prefixes + * here). On USDHC hardware there is a force-on bit, but no force-off + * for the card bus clock (the hardware runs the clock when transfers + * are active no matter what), so we always say the clock is on. + * XXX Maybe we should say it's in whatever state the sdhci driver last + * set it to. + */ 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; + if (RD4(sc, SDHC_SYS_CTRL) & SDHC_CLK_SDCLKEN) + val |= SDHCI_CLOCK_CARD_EN; } 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; + val |= SDHCI_CLOCK_CARD_EN; } - 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); + return (val); +} - if (!enable) - return; +static void +imx_sdhc_set_clock(struct imx_sdhci_softc *sc, uint16_t val) +{ + uint32_t divisor, freq, prescale, val32; + + val32 = RD4(sc, SDHCI_CLOCK_CONTROL); + + /* + * Save the frequency-setting bits in SDHCI format so that we can play + * them back in get_clock without complex decoding of hardware regs, + * then deal with the freqency part of the value based on hardware type. + */ + sc->sdclockreg_freq_bits = val & SDHCI_DIVIDERS_MASK; + if (sc->hwtype == HWTYPE_ESDHC) { + /* + * The ESDHC hardware requires the driver to manually start and + * stop the sd bus clock. If the enable bit is not set, turn + * off the clock in hardware and we're done, otherwise decode + * the requested frequency. ESDHC hardware is sdhci 2.0; the + * sdhci driver will use the original 8-bit divisor field and + * the "base / 2^N" divisor scheme. + */ + if ((val & SDHCI_CLOCK_CARD_EN) == 0) { + WR4(sc, SDHCI_CLOCK_CONTROL, val32 & ~SDHC_CLK_SDCLKEN); + return; - if (divisor == 0) - freq = sc->baseclk_hz; - else - freq = sc->baseclk_hz / (2 * divisor); + } + divisor = (val >> SDHCI_DIVIDER_SHIFT) & SDHCI_DIVIDER_MASK; + freq = sc->baseclk_hz >> ffs(divisor); + } else { + /* + * The USDHC hardware provides only "force always on" control + * over the sd bus clock, but no way to turn it off. (If a cmd + * or data transfer is in progress the clock is on, otherwise it + * is off.) If the clock is being disabled, we can just return + * now, otherwise we decode the requested frequency. USDHC + * hardware is sdhci 3.0; the sdhci driver will use a 10-bit + * divisor using the "base / 2*N" divisor scheme. + */ + if ((val & SDHCI_CLOCK_CARD_EN) == 0) + return; + divisor = ((val >> SDHCI_DIVIDER_SHIFT) & SDHCI_DIVIDER_MASK) | + ((val >> SDHCI_DIVIDER_HI_SHIFT) & SDHCI_DIVIDER_HI_MASK) << + SDHCI_DIVIDER_MASK_LEN; + if (divisor == 0) + freq = sc->baseclk_hz; + else + freq = sc->baseclk_hz / (2 * divisor); + } + /* + * Get a prescaler and final divisor to achieve the desired frequency. + */ for (prescale = 2; freq < sc->baseclk_hz / (prescale * 16);) prescale <<= 1; @@ -536,19 +616,16 @@ imx_sdhc_set_clock(struct imx_sdhci_soft prescale, divisor); #endif + /* + * Adjust to zero-based values, and store them to the hardware. + */ prescale >>= 1; divisor -= 1; - val32 = RD4(sc, SDHCI_CLOCK_CONTROL); - val32 &= ~SDHC_CLK_DIVISOR_MASK; + val32 &= ~(SDHC_CLK_DIVISOR_MASK | SDHC_CLK_PRESCALE_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 boolean_t @@ -733,6 +810,7 @@ imx_sdhci_attach(device_t dev) WR4(sc, SDHC_WTMK_LVL, 0x08800880); sc->baseclk_hz = imx_ccm_sdhci_hz(); + sc->slot.max_clk = sc->baseclk_hz; /* * If the slot is flagged with the non-removable property, set our flag From owner-svn-src-head@freebsd.org Thu May 26 06:35:13 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69733B4A1CF; Thu, 26 May 2016 06:35:13 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16C3B16C9; Thu, 26 May 2016 06:35:13 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q6ZCvA097981; Thu, 26 May 2016 06:35:12 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q6ZC3U097979; Thu, 26 May 2016 06:35:12 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605260635.u4Q6ZC3U097979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Thu, 26 May 2016 06:35:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300710 - head/sys/dev/spibus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 06:35:13 -0000 Author: adrian Date: Thu May 26 06:35:11 2016 New Revision: 300710 URL: https://svnweb.freebsd.org/changeset/base/300710 Log: [spibus] add initial placeholders for transfer mode and frequency. This doesn't yet implement it in the controllers or the transfer calls, but it's a start. Obtained from: loos (frequency), ray/zrouter (transfer mode) Modified: head/sys/dev/spibus/spibus.c head/sys/dev/spibus/spibusvar.h Modified: head/sys/dev/spibus/spibus.c ============================================================================== --- head/sys/dev/spibus/spibus.c Thu May 26 03:55:27 2016 (r300709) +++ head/sys/dev/spibus/spibus.c Thu May 26 06:35:11 2016 (r300710) @@ -105,6 +105,7 @@ spibus_print_child(device_t dev, device_ retval += bus_print_child_header(dev, child); retval += printf(" at cs %d", devi->cs); + retval += printf(" mode %d", devi->mode); retval += bus_print_child_footer(dev, child); return (retval); @@ -117,6 +118,7 @@ spibus_probe_nomatch(device_t bus, devic device_printf(bus, "<unknown card>"); printf(" at cs %d\n", devi->cs); + printf(" mode %d", devi->mode); return; } @@ -149,6 +151,11 @@ spibus_read_ivar(device_t bus, device_t case SPIBUS_IVAR_CS: *(uint32_t *)result = devi->cs; break; + case SPIBUS_IVAR_MODE: + *(uint32_t *)result = devi->mode; + break; + case SPIBUS_IVAR_CLOCK: + *(uint32_t *)result = devi->clock; } return (0); } @@ -179,7 +186,9 @@ spibus_hinted_child(device_t bus, const child = BUS_ADD_CHILD(bus, 0, dname, dunit); devi = SPIBUS_IVAR(child); + devi->mode = SPIBUS_MODE_NONE; resource_int_value(dname, dunit, "cs", &devi->cs); + resource_int_value(dname, dunit, "mode", &devi->mode); } static int Modified: head/sys/dev/spibus/spibusvar.h ============================================================================== --- head/sys/dev/spibus/spibusvar.h Thu May 26 03:55:27 2016 (r300709) +++ head/sys/dev/spibus/spibusvar.h Thu May 26 06:35:11 2016 (r300710) @@ -34,13 +34,22 @@ struct spibus_softc device_t dev; }; +#define SPIBUS_MODE_NONE 0 +#define SPIBUS_MODE_CPHA 1 +#define SPIBUS_MODE_CPOL 2 +#define SPIBUS_MODE_CPOL_CPHA 3 + struct spibus_ivar { uint32_t cs; + uint32_t mode; + uint32_t clock; }; enum { - SPIBUS_IVAR_CS /* chip select that we're on */ + SPIBUS_IVAR_CS, /* chip select that we're on */ + SPIBUS_IVAR_MODE, /* SPI mode (0-3) */ + SPIBUS_IVAR_CLOCK, /* maximum clock freq for device */ }; #define SPIBUS_ACCESSOR(A, B, T) \ @@ -52,6 +61,8 @@ spibus_get_ ## A(device_t dev, T *t) } SPIBUS_ACCESSOR(cs, CS, uint32_t) +SPIBUS_ACCESSOR(mode, MODE, uint32_t) +SPIBUS_ACCESSOR(clock, CLOCK, uint32_t) extern driver_t spibus_driver; extern devclass_t spibus_devclass; From owner-svn-src-head@freebsd.org Thu May 26 06:36:59 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79158B4A258; Thu, 26 May 2016 06:36:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 468411869; Thu, 26 May 2016 06:36:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q6awM3098078; Thu, 26 May 2016 06:36:58 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q6awoU098077; Thu, 26 May 2016 06:36:58 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605260636.u4Q6awoU098077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Thu, 26 May 2016 06:36:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300711 - head/sys/dev/spibus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 06:36:59 -0000 Author: adrian Date: Thu May 26 06:36:58 2016 New Revision: 300711 URL: https://svnweb.freebsd.org/changeset/base/300711 Log: [spibus] add missing break. Pointy hat to: me Modified: head/sys/dev/spibus/spibus.c Modified: head/sys/dev/spibus/spibus.c ============================================================================== --- head/sys/dev/spibus/spibus.c Thu May 26 06:35:11 2016 (r300710) +++ head/sys/dev/spibus/spibus.c Thu May 26 06:36:58 2016 (r300711) @@ -156,6 +156,7 @@ spibus_read_ivar(device_t bus, device_t break; case SPIBUS_IVAR_CLOCK: *(uint32_t *)result = devi->clock; + break; } return (0); } From owner-svn-src-head@freebsd.org Thu May 26 06:37:34 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D57F4B4A2AF; Thu, 26 May 2016 06:37:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6D2E1A14; Thu, 26 May 2016 06:37:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q6bXkO098141; Thu, 26 May 2016 06:37:33 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q6bXH1098140; Thu, 26 May 2016 06:37:33 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605260637.u4Q6bXH1098140@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Thu, 26 May 2016 06:37:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300712 - head/sys/dev/spibus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 06:37:34 -0000 Author: adrian Date: Thu May 26 06:37:33 2016 New Revision: 300712 URL: https://svnweb.freebsd.org/changeset/base/300712 Log: [spibus] implement maximum clock frequency lookup from ofw. Obtained from: loos Modified: head/sys/dev/spibus/ofw_spibus.c Modified: head/sys/dev/spibus/ofw_spibus.c ============================================================================== --- head/sys/dev/spibus/ofw_spibus.c Thu May 26 06:36:58 2016 (r300711) +++ head/sys/dev/spibus/ofw_spibus.c Thu May 26 06:37:33 2016 (r300712) @@ -78,7 +78,7 @@ ofw_spibus_attach(device_t dev) struct spibus_softc *sc = device_get_softc(dev); struct ofw_spibus_devinfo *dinfo; phandle_t child; - pcell_t paddr; + pcell_t clock, paddr; device_t childdev; sc->dev = dev; @@ -103,6 +103,14 @@ ofw_spibus_attach(device_t dev) } /* + * Get the maximum clock frequency for device, zero means + * use the default bus speed. + */ + if (OF_getencprop(child, "spi-max-frequency", &clock, + sizeof(clock)) == -1) + clock = 0; + + /* * Now set up the SPI and OFW bus layer devinfo and add it * to the bus. */ @@ -111,6 +119,7 @@ ofw_spibus_attach(device_t dev) if (dinfo == NULL) continue; dinfo->opd_dinfo.cs = paddr; + dinfo->opd_dinfo.clock = clock; if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != 0) { free(dinfo, M_DEVBUF); From owner-svn-src-head@freebsd.org Thu May 26 07:02:22 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F43CB4A936; Thu, 26 May 2016 07:02:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD9381A25; Thu, 26 May 2016 07:02:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q72Lin008999; Thu, 26 May 2016 07:02:21 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q72KH0008996; Thu, 26 May 2016 07:02:20 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605260702.u4Q72KH0008996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Thu, 26 May 2016 07:02:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300713 - in head/sys: conf dev/spibus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 07:02:22 -0000 Author: adrian Date: Thu May 26 07:02:20 2016 New Revision: 300713 URL: https://svnweb.freebsd.org/changeset/base/300713 Log: [spigen] add initial spigen driver from green@ This is a simple ioctl and mmap API to issue SPI transactions from userland. It's useful for simple devices (eg spi temperature sensors, etc) for experimentation. TODO: * Write some documentation! Submitted by: green Added: head/sys/dev/spibus/spigen.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/spibus/spi.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu May 26 06:37:33 2016 (r300712) +++ head/sys/conf/files Thu May 26 07:02:20 2016 (r300713) @@ -2553,6 +2553,7 @@ dev/sound/midi/synth_if.m optional sound dev/spibus/ofw_spibus.c optional fdt spibus dev/spibus/spibus.c optional spibus \ dependency "spibus_if.h" +dev/spibus/spigen.c optional spigen dev/spibus/spibus_if.m optional spibus dev/ste/if_ste.c optional ste pci dev/stg/tmc18c30.c optional stg Modified: head/sys/dev/spibus/spi.h ============================================================================== --- head/sys/dev/spibus/spi.h Thu May 26 06:37:33 2016 (r300712) +++ head/sys/dev/spibus/spi.h Thu May 26 07:02:20 2016 (r300713) @@ -37,4 +37,6 @@ struct spi_command { uint32_t rx_data_sz; }; +#define SPI_COMMAND_INITIALIZER { 0 } + #define SPI_CHIP_SELECT_HIGH 0x1 /* Chip select high (else low) */ Added: head/sys/dev/spibus/spigen.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/spibus/spigen.c Thu May 26 07:02:20 2016 (r300713) @@ -0,0 +1,403 @@ +/*- + * Copyright (c) 2015 Brian Fundakowski Feldman. 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 <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/bus.h> +#include <sys/conf.h> +#include <sys/kernel.h> +#include <sys/lock.h> +#include <sys/malloc.h> +#include <sys/mman.h> +#include <sys/mutex.h> +#include <sys/module.h> +#include <sys/proc.h> +#include <sys/rwlock.h> +#include <sys/spigenio.h> +#include <sys/sysctl.h> +#include <sys/types.h> + +#include <vm/vm.h> +#include <vm/vm_extern.h> +#include <vm/vm_object.h> +#include <vm/vm_page.h> +#include <vm/vm_pager.h> + +#include <dev/spibus/spi.h> + +#include "spibus_if.h" + +struct spigen_softc { + device_t sc_dev; + struct cdev *sc_cdev; + struct mtx sc_mtx; + uint32_t sc_clock_speed; + uint32_t sc_command_length_max; /* cannot change while mmapped */ + uint32_t sc_data_length_max; /* cannot change while mmapped */ + vm_object_t sc_mmap_buffer; /* command, then data */ + vm_offset_t sc_mmap_kvaddr; + size_t sc_mmap_buffer_size; + int sc_mmap_busy; + int sc_debug; +}; + +static int +spigen_probe(device_t dev) +{ + device_set_desc(dev, "SPI Generic IO"); + return (0); +} + +static int spigen_open(struct cdev *, int, int, struct thread *); +static int spigen_ioctl(struct cdev *, u_long, caddr_t, int, struct thread *); +static int spigen_close(struct cdev *, int, int, struct thread *); +static d_mmap_single_t spigen_mmap_single; + +static struct cdevsw spigen_cdevsw = { + .d_version = D_VERSION, + .d_name = "spigen", + .d_open = spigen_open, + .d_ioctl = spigen_ioctl, + .d_mmap_single = spigen_mmap_single, + .d_close = spigen_close +}; + +static int +spigen_command_length_max_proc(SYSCTL_HANDLER_ARGS) +{ + struct spigen_softc *sc = (struct spigen_softc *)arg1; + uint32_t command_length_max; + int error; + + mtx_lock(&sc->sc_mtx); + command_length_max = sc->sc_command_length_max; + mtx_unlock(&sc->sc_mtx); + error = sysctl_handle_int(oidp, &command_length_max, + sizeof(command_length_max), req); + if (error == 0 && req->newptr != NULL) { + mtx_lock(&sc->sc_mtx); + if (sc->sc_mmap_buffer != NULL) + error = EBUSY; + else + sc->sc_command_length_max = command_length_max; + mtx_unlock(&sc->sc_mtx); + } + return (error); +} + +static int +spigen_data_length_max_proc(SYSCTL_HANDLER_ARGS) +{ + struct spigen_softc *sc = (struct spigen_softc *)arg1; + uint32_t data_length_max; + int error; + + mtx_lock(&sc->sc_mtx); + data_length_max = sc->sc_data_length_max; + mtx_unlock(&sc->sc_mtx); + error = sysctl_handle_int(oidp, &data_length_max, + sizeof(data_length_max), req); + if (error == 0 && req->newptr != NULL) { + mtx_lock(&sc->sc_mtx); + if (sc->sc_mmap_buffer != NULL) + error = EBUSY; + else + sc->sc_data_length_max = data_length_max; + mtx_unlock(&sc->sc_mtx); + } + return (error); +} + +static void +spigen_sysctl_init(struct spigen_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, "command_length_max", + CTLFLAG_MPSAFE | CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc), + spigen_command_length_max_proc, "IU", "SPI command header portion (octets)"); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "data_length_max", + CTLFLAG_MPSAFE | CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc), + spigen_data_length_max_proc, "IU", "SPI data trailer portion (octets)"); + SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "data", CTLFLAG_RW, + &sc->sc_debug, 0, "debug flags"); + +} + +static int +spigen_attach(device_t dev) +{ + struct spigen_softc *sc; + const int unit = device_get_unit(dev); + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_cdev = make_dev(&spigen_cdevsw, unit, + UID_ROOT, GID_OPERATOR, 0660, "spigen%d", unit); + sc->sc_cdev->si_drv1 = dev; + sc->sc_command_length_max = PAGE_SIZE; + sc->sc_data_length_max = PAGE_SIZE; + mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); + spigen_sysctl_init(sc); + + return (0); +} + +static int +spigen_open(struct cdev *dev, int oflags, int devtype, struct thread *td) +{ + + return (0); +} + +static int +spigen_transfer(struct cdev *cdev, struct spigen_transfer *st) +{ + struct spi_command transfer = SPI_COMMAND_INITIALIZER; + device_t dev = cdev->si_drv1; + struct spigen_softc *sc = device_get_softc(dev); + int error = 0; + + mtx_lock(&sc->sc_mtx); + if (st->st_command.iov_len == 0 || st->st_data.iov_len == 0) + error = EINVAL; + else if (st->st_command.iov_len > sc->sc_command_length_max || + st->st_data.iov_len > sc->sc_data_length_max) + error = ENOMEM; + mtx_unlock(&sc->sc_mtx); + if (error) + return (error); + +#if 0 + device_printf(dev, "cmd %p %u data %p %u\n", st->st_command.iov_base, + st->st_command.iov_len, st->st_data.iov_base, st->st_data.iov_len); +#endif + transfer.tx_cmd = transfer.rx_cmd = malloc(st->st_command.iov_len, + M_DEVBUF, M_WAITOK); + if (transfer.tx_cmd == NULL) + return (ENOMEM); + transfer.tx_data = transfer.rx_data = malloc(st->st_data.iov_len, + M_DEVBUF, M_WAITOK); + if (transfer.tx_data == NULL) { + free(transfer.tx_cmd, M_DEVBUF); + return (ENOMEM); + } + + error = copyin(st->st_command.iov_base, transfer.tx_cmd, + transfer.tx_cmd_sz = transfer.rx_cmd_sz = st->st_command.iov_len); + if (error == 0) + error = copyin(st->st_data.iov_base, transfer.tx_data, + transfer.tx_data_sz = transfer.rx_data_sz = + st->st_data.iov_len); + if (error == 0) + error = SPIBUS_TRANSFER(device_get_parent(dev), dev, &transfer); + if (error == 0) { + error = copyout(transfer.rx_cmd, st->st_command.iov_base, + transfer.rx_cmd_sz); + if (error == 0) + error = copyout(transfer.rx_data, st->st_data.iov_base, + transfer.rx_data_sz); + } + + free(transfer.tx_cmd, M_DEVBUF); + free(transfer.tx_data, M_DEVBUF); + return (error); +} + +static int +spigen_transfer_mmapped(struct cdev *cdev, struct spigen_transfer_mmapped *stm) +{ + struct spi_command transfer = SPI_COMMAND_INITIALIZER; + device_t dev = cdev->si_drv1; + struct spigen_softc *sc = device_get_softc(dev); + int error = 0; + + mtx_lock(&sc->sc_mtx); + if (sc->sc_mmap_busy) + error = EBUSY; + else if (stm->stm_command_length > sc->sc_command_length_max || + stm->stm_data_length > sc->sc_data_length_max) + error = E2BIG; + else if (sc->sc_mmap_buffer == NULL) + error = EINVAL; + else if (sc->sc_mmap_buffer_size < + stm->stm_command_length + stm->stm_data_length) + error = ENOMEM; + if (error == 0) + sc->sc_mmap_busy = 1; + mtx_unlock(&sc->sc_mtx); + if (error) + return (error); + + transfer.tx_cmd = transfer.rx_cmd = (void *)sc->sc_mmap_kvaddr; + transfer.tx_cmd_sz = transfer.rx_cmd_sz = stm->stm_command_length; + transfer.tx_data = transfer.rx_data = + (void *)(sc->sc_mmap_kvaddr + stm->stm_command_length); + transfer.tx_data_sz = transfer.rx_data_sz = stm->stm_data_length; + error = SPIBUS_TRANSFER(device_get_parent(dev), dev, &transfer); + + mtx_lock(&sc->sc_mtx); + KASSERT(sc->sc_mmap_busy, ("mmap no longer marked busy")); + sc->sc_mmap_busy = 0; + mtx_unlock(&sc->sc_mtx); + return (error); +} + +static int +spigen_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, + struct thread *td) +{ + device_t dev = cdev->si_drv1; + struct spigen_softc *sc = device_get_softc(dev); + int error; + + switch (cmd) { + case SPIGENIOC_TRANSFER: + error = spigen_transfer(cdev, (struct spigen_transfer *)data); + break; + case SPIGENIOC_TRANSFER_MMAPPED: + error = spigen_transfer_mmapped(cdev, (struct spigen_transfer_mmapped *)data); + break; + case SPIGENIOC_GET_CLOCK_SPEED: + mtx_lock(&sc->sc_mtx); + *(uint32_t *)data = sc->sc_clock_speed; + /* XXX TODO: implement spibus ivar call */ + mtx_unlock(&sc->sc_mtx); + error = 0; + break; + case SPIGENIOC_SET_CLOCK_SPEED: + mtx_lock(&sc->sc_mtx); + sc->sc_clock_speed = *(uint32_t *)data; + mtx_unlock(&sc->sc_mtx); + error = 0; + break; + default: + error = EOPNOTSUPP; + } + return (error); +} + +static int +spigen_mmap_single(struct cdev *cdev, vm_ooffset_t *offset, + vm_size_t size, struct vm_object **object, int nprot) +{ + device_t dev = cdev->si_drv1; + struct spigen_softc *sc = device_get_softc(dev); + vm_page_t *m; + size_t n, pages; + + if (size == 0 || + (nprot & (PROT_EXEC | PROT_READ | PROT_WRITE)) + != (PROT_READ | PROT_WRITE)) + return (EINVAL); + size = roundup2(size, PAGE_SIZE); + pages = size / PAGE_SIZE; + + mtx_lock(&sc->sc_mtx); + if (sc->sc_mmap_buffer != NULL) { + mtx_unlock(&sc->sc_mtx); + return (EBUSY); + } else if (size > sc->sc_command_length_max + sc->sc_data_length_max) { + mtx_unlock(&sc->sc_mtx); + return (E2BIG); + } + sc->sc_mmap_buffer_size = size; + *offset = 0; + sc->sc_mmap_buffer = *object = vm_pager_allocate(OBJT_PHYS, 0, size, + nprot, *offset, curthread->td_ucred); + m = malloc(sizeof(*m) * pages, M_TEMP, M_WAITOK); + VM_OBJECT_WLOCK(*object); + vm_object_reference_locked(*object); // kernel and userland both + for (n = 0; n < pages; n++) { + m[n] = vm_page_grab(*object, n, + VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_WIRED); + m[n]->valid = VM_PAGE_BITS_ALL; + } + VM_OBJECT_WUNLOCK(*object); + sc->sc_mmap_kvaddr = kva_alloc(size); + pmap_qenter(sc->sc_mmap_kvaddr, m, pages); + free(m, M_TEMP); + mtx_unlock(&sc->sc_mtx); + + if (*object == NULL) + return (EINVAL); + return (0); +} + +static int +spigen_close(struct cdev *cdev, int fflag, int devtype, struct thread *td) +{ + device_t dev = cdev->si_drv1; + struct spigen_softc *sc = device_get_softc(dev); + + mtx_lock(&sc->sc_mtx); + if (sc->sc_mmap_buffer != NULL) { + pmap_qremove(sc->sc_mmap_kvaddr, + sc->sc_mmap_buffer_size / PAGE_SIZE); + kva_free(sc->sc_mmap_kvaddr, sc->sc_mmap_buffer_size); + sc->sc_mmap_kvaddr = 0; + vm_object_deallocate(sc->sc_mmap_buffer); + sc->sc_mmap_buffer = NULL; + sc->sc_mmap_buffer_size = 0; + } + mtx_unlock(&sc->sc_mtx); + return (0); +} + +static int +spigen_detach(device_t dev) +{ + + return (EIO); +} + +static devclass_t spigen_devclass; + +static device_method_t spigen_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, spigen_probe), + DEVMETHOD(device_attach, spigen_attach), + DEVMETHOD(device_detach, spigen_detach), + + { 0, 0 } +}; + +static driver_t spigen_driver = { + "spigen", + spigen_methods, + sizeof(struct spigen_softc), +}; + +DRIVER_MODULE(spigen, spibus, spigen_driver, spigen_devclass, 0, 0); From owner-svn-src-head@freebsd.org Thu May 26 07:09:44 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AE35B4AA59; Thu, 26 May 2016 07:09:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D12911CA0; Thu, 26 May 2016 07:09:43 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q79hsU009284; Thu, 26 May 2016 07:09:43 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q79h3u009283; Thu, 26 May 2016 07:09:43 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605260709.u4Q79h3u009283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper <ngie@FreeBSD.org> Date: Thu, 26 May 2016 07:09:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300714 - head/contrib/top X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 07:09:44 -0000 Author: ngie Date: Thu May 26 07:09:42 2016 New Revision: 300714 URL: https://svnweb.freebsd.org/changeset/base/300714 Log: The readme provides a high-level overview of how to upgrade top(1). Differential Revision: https://reviews.freebsd.org/D6493 MFC after: 1 week Reviewed By: ngie Submitted by: Randy Westlund <rwestlun@gmail.com> Sponsored by: EMC / Isilon Storage Division Added: head/contrib/top/FREEBSD-upgrade Added: head/contrib/top/FREEBSD-upgrade ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/top/FREEBSD-upgrade Thu May 26 07:09:42 2016 (r300714) @@ -0,0 +1,22 @@ +$FreeBSD$ + +This file contains notes regarding the upgrade of top(1). See the vendor +import instructions at: + + https://www.freebsd.org/doc/en/articles/committers-guide/subversion-primer.html#svn-advanced-use-vendor-imports + +The upstream project pages for top(1) are: + + http://www.unixtop.org/ + + https://sourceforge.net/projects/unixtop/ + +contrib/top/machine.h specifies an interface that must be provided by the +target OS. That interface is implemented in usr.bin/top/machine.c + +To enable building on case-insensitive filesystems, the following files were +renamed: + + contrib/top/top.X -> contrib/top/top.xs + contrib/top/top.local.H -> contrib/top/top.local.hs + From owner-svn-src-head@freebsd.org Thu May 26 07:11:28 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 703D3B4AC76; Thu, 26 May 2016 07:11:28 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x235.google.com (mail-pf0-x235.google.com [IPv6:2607:f8b0:400e:c00::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4005D1F6C; Thu, 26 May 2016 07:11:28 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x235.google.com with SMTP id f144so14940841pfa.3; Thu, 26 May 2016 00:11:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=hTu6RcNsOKQEPEMlx+gUQ9s2Fe8Tvjson+/qkqGCcTo=; b=h3a/5NHY2zuGHVMmyTgszaRGgR/T3LdwHg2o5ZNdkZRwkZ1iDO5kNCwSia49mE38nf u4f43+lPHT5fCgHneaXMVMdiPazZgjoDUSeoL1V0a71X6CIhtbEuc21vKUTI5v5D2vD1 S9xHDB9aI7ZOzFoVoItVzOYTd+JK1gfL8cs81YW5Woe1urnYegRpKHxDGMU7lNYT1z1q lNyC77DZo9ZWdWVf08uIS+LOdA3MNf1AtmDX02R6WSd+61EIL9BxlqikWhGWA/nudUhg JUsvtyVZp4x2MFICm/SS0gdsjtJvqXhUrKt1DTtJ7dAh7+TPq8NVT16I28ui/a+m8pqN Cbvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=hTu6RcNsOKQEPEMlx+gUQ9s2Fe8Tvjson+/qkqGCcTo=; b=YKifElXHeZRLgwqmGMY82ePT1Pk3M39nIVqsOBWEPO6RDnpqTcs6RkTcsXLULaRWYh rgGidIh6mxWQIH2kgYH8rVlK3bsTkF7GpsU3t/swCJobcwFVh/RTmpyYOyclhDsGjtwB gieoNlBTbcgPoq7Gn/l1kmgNurdlJQ3ZMw3vkHirWLL9jHtja790pR/0mZJd25Cmf2dd KDePRbkQcvR4p7pbOnOSC+w6gb45Owa+pJe8TqmobXXPStA/OfnM1j0scD25O44QoiWc 2YGD7v2vNNogUGLAI/Ql4UkM4UCSU+A2uIzb53EiWwWIn5P6LWX3VdZqUIdHEMmCs1c2 qWZQ== X-Gm-Message-State: ALyK8tJYtI9qk/st2wyVXhu5CpKl5+i8e71rzwEHShhQJT2ofpwqQ9n5n/Bq8NPh67FLoQ== X-Received: by 10.98.4.195 with SMTP id 186mr11870693pfe.154.1464246687506; Thu, 26 May 2016 00:11:27 -0700 (PDT) Received: from pinklady.local (c-73-97-222-46.hsd1.wa.comcast.net. [73.97.222.46]) by smtp.gmail.com with ESMTPSA id f67sm3259256pff.62.2016.05.26.00.11.26 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 May 2016 00:11:26 -0700 (PDT) Subject: Re: svn commit: r300714 - head/contrib/top Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_41FE8064-6D91-4E95-9C37-6F670596C8CA"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.6b2 From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com> In-Reply-To: <201605260709.u4Q79h3u009283@repo.freebsd.org> Date: Thu, 26 May 2016 00:11:24 -0700 Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <C7A40F9E-0D98-4A78-B8BE-E02C21386394@gmail.com> References: <201605260709.u4Q79h3u009283@repo.freebsd.org> To: Garrett Cooper <ngie@FreeBSD.org> X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 07:11:28 -0000 --Apple-Mail=_41FE8064-6D91-4E95-9C37-6F670596C8CA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On May 26, 2016, at 00:09, Garrett Cooper <ngie@FreeBSD.org> wrote: >=20 > Author: ngie > Date: Thu May 26 07:09:42 2016 > New Revision: 300714 > URL: https://svnweb.freebsd.org/changeset/base/300714 >=20 > Log: The summary should have also said: Add compat/top/FREEBSD-upgrade > The readme provides a high-level overview of how to upgrade top(1). >=20 > Differential Revision: https://reviews.freebsd.org/D6493 > MFC after: 1 week > Reviewed By: ngie > Submitted by: Randy Westlund <rwestlun@gmail.com> > Sponsored by: EMC / Isilon Storage Division It was an experiment with trying to use arc commit. It comes close, but = it=E2=80=99s not perfect. Thanks! -Ngie --Apple-Mail=_41FE8064-6D91-4E95-9C37-6F670596C8CA Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJXRqGdAAoJEPWDqSZpMIYVc6wP/3eSGF/fgkit/rkgELrhOn1V 22SvfNHCalkwCPSuSjd1K/zYNFX2G/c+kUfIk0Psf2ack6zWFmKUUVjHb8XS7bXr iXHAq7xrFJsm/0aLwQxiEL+vCb6Sb5mG+NoO5qqsYdngMafKwwqU1JBwAyP9lzfR q/bkMmtDtRAYR88qHFiiWjTuOqR2ii9X+nefCrCOy8yxqFZvNTzSIzBTs7WWpVwJ N+MyfJQEYRRSf06RqBQ8WxlzAnWoWy+eIg6x28RTiZShqo2KvYDIo54+zflBc1bx MQSQQlWI5UX8eiefV0flvDsrWSSLBemdnm5JKPdmqvJtdi8n/YD6vZ+xzeJMdEo4 iEdxWMS1nh5GeOgcKUZnVLUSq9j1PMHOaX8Ajo6SxEL8YpMh0KAFOBrOv9INq7pw gF0eXWA310c6j+BPSJPMo6kwGQvyNPmyYm2faJqBTpoNG9qBTc3lyGXNKEHID4iT OhYSTn2SNNpVOsj2wLDdo5ur7uiSPm+pyK6zabTNRnu27YZH7R0XzXjeheTeT9OR CcQvNGl8pg8IeMXIc5M1kn/ELHiur6saZzQe0YcYpk9hA7UF+svFIh/inFO7W3kI CH+HJU3vUrABXN8PuNGmzmsOPhp7mf5rO8sOR5s2PVdudUHfKikPNfoQm/vkbdwY y2OtA+z4Adp+F0WESwYZ =+QRN -----END PGP SIGNATURE----- --Apple-Mail=_41FE8064-6D91-4E95-9C37-6F670596C8CA-- From owner-svn-src-head@freebsd.org Thu May 26 07:20:34 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1713B4AF8D; Thu, 26 May 2016 07:20:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F17A170D; Thu, 26 May 2016 07:20:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q7KXTs013260; Thu, 26 May 2016 07:20:33 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q7KXGt013257; Thu, 26 May 2016 07:20:33 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605260720.u4Q7KXGt013257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Thu, 26 May 2016 07:20:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300715 - in head/sys: conf dev/gpio modules/gpio/gpiospi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 07:20:34 -0000 Author: adrian Date: Thu May 26 07:20:33 2016 New Revision: 300715 URL: https://svnweb.freebsd.org/changeset/base/300715 Log: [gpiospi] add initial gpio SPI bit bang driver. Submitted by: ray Obtained from: zrouter Added: head/sys/dev/gpio/gpiospi.c (contents, props changed) head/sys/modules/gpio/gpiospi/ head/sys/modules/gpio/gpiospi/Makefile (contents, props changed) Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu May 26 07:09:42 2016 (r300714) +++ head/sys/conf/files Thu May 26 07:20:33 2016 (r300715) @@ -1531,6 +1531,7 @@ dev/gpio/gpioc.c optional gpio \ dependency "gpio_if.h" dev/gpio/gpioiic.c optional gpioiic dev/gpio/gpioled.c optional gpioled +dev/gpio/gpiospi.c optional gpiospi dev/gpio/gpio_if.m optional gpio dev/gpio/gpiobus_if.m optional gpio dev/gpio/ofw_gpiobus.c optional fdt gpio Added: head/sys/dev/gpio/gpiospi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/gpio/gpiospi.c Thu May 26 07:20:33 2016 (r300715) @@ -0,0 +1,402 @@ +/*- + * Copyright (c) 2011, Aleksandr Rybalko <ray@dlink.ua> + * 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 unmodified, 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 <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include "opt_gpio.h" + +#include <sys/param.h> +#include <sys/systm.h> + +#include <sys/bus.h> +#include <sys/kernel.h> +#include <sys/module.h> +#include <sys/rman.h> +#include <sys/sysctl.h> + +#include <sys/gpio.h> +#include "gpiobus_if.h" + +#include <dev/gpio/gpiobusvar.h> + +#include <dev/spibus/spi.h> +#include <dev/spibus/spibusvar.h> +#include "spibus_if.h" + +#ifdef GPIO_SPI_DEBUG +#define dprintf printf +#else +#define dprintf(x, arg...) +#endif /* GPIO_SPI_DEBUG */ + +struct gpio_spi_softc { + device_t sc_dev; + device_t sc_busdev; + int sc_freq; + uint8_t sc_sclk; + uint8_t sc_miso; + uint8_t sc_mosi; + uint8_t sc_cs0; + uint8_t sc_cs1; + uint8_t sc_cs2; + uint8_t sc_cs3; +}; + +static void gpio_spi_chip_activate(struct gpio_spi_softc *, int); +static void gpio_spi_chip_deactivate(struct gpio_spi_softc *, int); + +static int +gpio_spi_probe(device_t dev) +{ + device_set_desc(dev, "GPIO SPI bit-banging driver"); + return (0); +} + +static void +gpio_delay(struct gpio_spi_softc *sc) +{ + int d; + + d = sc->sc_freq / 1000000; + if (d == 0) + d = 1; + + DELAY(d); +} + +static int +gpio_spi_attach(device_t dev) +{ + uint32_t value; + struct gpio_spi_softc *sc; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_busdev = device_get_parent(dev); + + /* Required variables */ + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "sclk", &value)) + return (ENXIO); + sc->sc_sclk = value & 0xff; + + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "mosi", &value)) + return (ENXIO); + sc->sc_mosi = value & 0xff; + + /* Handle no miso; we just never read back from the device */ + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "miso", &value)) + value = 0xff; + sc->sc_miso = value & 0xff; + + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "cs0", &value)) + return (ENXIO); + sc->sc_cs0 = value & 0xff; + + /* Optional variables */ + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "cs1", &value)) + value = 0xff; + sc->sc_cs1 = value & 0xff; + + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "cs2", &value)) + value = 0xff; + sc->sc_cs2 = value & 0xff; + + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "cs3", &value)) + value = 0xff; + sc->sc_cs3 = value & 0xff; + + /* Default to 100KHz */ + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "freq", &value)) { + value = 100000; + } + sc->sc_freq = value; + + if (bootverbose) { + device_printf(dev, "frequency: %d Hz\n", + sc->sc_freq); + device_printf(dev, + "Use GPIO pins: sclk=%d, mosi=%d, miso=%d, " + "cs0=%d, cs1=%d, cs2=%d, cs3=%d\n", + sc->sc_sclk, sc->sc_mosi, sc->sc_miso, + sc->sc_cs0, sc->sc_cs1, sc->sc_cs2, sc->sc_cs3); + } + + /* Set directions */ + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sc_sclk, + GPIO_PIN_OUTPUT|GPIO_PIN_PULLDOWN); + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sc_mosi, + GPIO_PIN_OUTPUT|GPIO_PIN_PULLDOWN); + if (sc->sc_miso != 0xff) { + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sc_miso, + GPIO_PIN_INPUT|GPIO_PIN_PULLDOWN); + } + + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sc_cs0, + GPIO_PIN_OUTPUT|GPIO_PIN_PULLUP); + + if (sc->sc_cs1 != 0xff) + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sc_cs1, + GPIO_PIN_OUTPUT|GPIO_PIN_PULLUP); + if (sc->sc_cs2 != 0xff) + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sc_cs2, + GPIO_PIN_OUTPUT|GPIO_PIN_PULLUP); + if (sc->sc_cs3 != 0xff) + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sc_cs3, + GPIO_PIN_OUTPUT|GPIO_PIN_PULLUP); + + gpio_spi_chip_deactivate(sc, -1); + + device_add_child(dev, "spibus", -1); + return (bus_generic_attach(dev)); +} + +static int +gpio_spi_detach(device_t dev) +{ + + return (0); +} + +static void +gpio_spi_chip_activate(struct gpio_spi_softc *sc, int cs) +{ + + /* called with locked gpiobus */ + switch (cs) { + case 0: + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_cs0, 0); + break; + case 1: + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_cs1, 0); + break; + case 2: + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_cs2, 0); + break; + case 3: + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_cs3, 0); + break; + default: + device_printf(sc->sc_dev, "don't have CS%d\n", cs); + } + + gpio_delay(sc); +} + +static void +gpio_spi_chip_deactivate(struct gpio_spi_softc *sc, int cs) +{ + + /* called wth locked gpiobus */ + /* + * Put CSx to high + */ + switch (cs) { + case -1: + /* All CS */ + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_cs0, 1); + if (sc->sc_cs1 == 0xff) break; + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_cs1, 1); + if (sc->sc_cs2 == 0xff) break; + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_cs2, 1); + if (sc->sc_cs3 == 0xff) break; + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_cs3, 1); + break; + case 0: + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_cs0, 1); + break; + case 1: + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_cs1, 1); + break; + case 2: + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_cs2, 1); + break; + case 3: + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_cs3, 1); + break; + default: + device_printf(sc->sc_dev, "don't have CS%d\n", cs); + } +} + +static uint8_t +gpio_spi_txrx(struct gpio_spi_softc *sc, int cs, int mode, uint8_t data) +{ + uint32_t mask, out = 0; + unsigned int bit; + + + /* called with locked gpiobus */ + + for (mask = 0x80; mask > 0; mask >>= 1) { + if ((mode == SPIBUS_MODE_CPOL) || + (mode == SPIBUS_MODE_CPHA)) { + /* If mode 1 or 2 */ + + /* first step */ + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_mosi, (data & mask)?1:0); + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_sclk, 0); + gpio_delay(sc); + /* second step */ + if (sc->sc_miso != 0xff) { + GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, + sc->sc_miso, &bit); + out |= bit?mask:0; + } + /* Data captured */ + gpio_delay(sc); + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_sclk, 1); + } else { + /* If mode 0 or 3 */ + + /* first step */ + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_mosi, (data & mask)?1:0); + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_sclk, 1); + gpio_delay(sc); + /* second step */ + if (sc->sc_miso != 0xff) { + GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, + sc->sc_miso, &bit); + out |= bit?mask:0; + } + /* Data captured */ + gpio_delay(sc); + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_sclk, 0); + } + } + + return (out & 0xff); +} + +static int +gpio_spi_transfer(device_t dev, device_t child, struct spi_command *cmd) +{ + struct gpio_spi_softc *sc; + uint8_t *buf_in, *buf_out; + struct spibus_ivar *devi = SPIBUS_IVAR(child); + int i; + + 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")); + + gpio_spi_chip_activate(sc, devi->cs); + + /* Preset pins */ + if ((devi->mode == SPIBUS_MODE_CPOL) || + (devi->mode == SPIBUS_MODE_CPHA)) { + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_sclk, 1); + } else { + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_sclk, 0); + } + + /* + * Transfer command + */ + buf_out = (uint8_t *)cmd->tx_cmd; + buf_in = (uint8_t *)cmd->rx_cmd; + + for (i = 0; i < cmd->tx_cmd_sz; i++) + buf_in[i] = gpio_spi_txrx(sc, devi->cs, devi->mode, buf_out[i]); + + /* + * Receive/transmit data (depends on command) + */ + buf_out = (uint8_t *)cmd->tx_data; + buf_in = (uint8_t *)cmd->rx_data; + for (i = 0; i < cmd->tx_data_sz; i++) + buf_in[i] = gpio_spi_txrx(sc, devi->cs, devi->mode, buf_out[i]); + + /* Return pins to mode default */ + if ((devi->mode == SPIBUS_MODE_CPOL) || + (devi->mode == SPIBUS_MODE_CPHA)) { + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_sclk, 1); + } else { + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, + sc->sc_sclk, 0); + } + + gpio_spi_chip_deactivate(sc, devi->cs); + + return (0); +} + +static device_method_t gpio_spi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, gpio_spi_probe), + DEVMETHOD(device_attach, gpio_spi_attach), + DEVMETHOD(device_detach, gpio_spi_detach), + + DEVMETHOD(spibus_transfer, gpio_spi_transfer), + + {0, 0} +}; + +static driver_t gpio_spi_driver = { + "gpiospi", + gpio_spi_methods, + sizeof(struct gpio_spi_softc), +}; + +static devclass_t gpio_spi_devclass; + +DRIVER_MODULE(gpiospi, gpiobus, gpio_spi_driver, gpio_spi_devclass, 0, 0); +DRIVER_MODULE(spibus, gpiospi, spibus_driver, spibus_devclass, 0, 0); +MODULE_DEPEND(spi, gpiospi, 1, 1, 1); +MODULE_DEPEND(gpiobus, gpiospi, 1, 1, 1); Added: head/sys/modules/gpio/gpiospi/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/gpio/gpiospi/Makefile Thu May 26 07:20:33 2016 (r300715) @@ -0,0 +1,41 @@ +# +# Copyright (c) 2016 Adrian Chadd <adrian@FreeBSD.org>. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer, +# without modification. +# 2. Redistributions in binary form must reproduce at minimum a disclaimer +# similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any +# redistribution must be conditioned upon including a substantially +# similar Disclaimer requirement for further binary redistribution. +# +# NO WARRANTY +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY +# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, +# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGES. +# +# $FreeBSD$ +# + +.PATH: ${.CURDIR}/../../../dev/gpio/ + +KMOD= gpiospi +SRCS= gpiospi.c +SRCS+= device_if.h bus_if.h gpio_if.h gpiobus_if.h spibus_if.h +SRCS+= opt_gpio.h + +CFLAGS+= -I. -I${.CURDIR}/../../../dev/gpio/ + +.include <bsd.kmod.mk> From owner-svn-src-head@freebsd.org Thu May 26 08:41:57 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07D80B4B77E; Thu, 26 May 2016 08:41:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE80F1E4D; Thu, 26 May 2016 08:41:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q8ftN7045566; Thu, 26 May 2016 08:41:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q8ft9r045564; Thu, 26 May 2016 08:41:55 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605260841.u4Q8ft9r045564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Thu, 26 May 2016 08:41:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300718 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 08:41:57 -0000 Author: hselasky Date: Thu May 26 08:41:55 2016 New Revision: 300718 URL: https://svnweb.freebsd.org/changeset/base/300718 Log: Add support for boolean sysctl's. Because the size of bool can be implementation defined, make a bool sysctl handler which handle bools. Userspace sees the bools like unsigned 8-bit integers. Values are filtered to either 1 or 0 upon read and write, similar to what a compiler would do. Requested by: kmacy @ Sponsored by: Mellanox Technologies Modified: head/sys/kern/kern_sysctl.c head/sys/sys/sysctl.h Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Thu May 26 08:31:09 2016 (r300717) +++ head/sys/kern/kern_sysctl.c Thu May 26 08:41:55 2016 (r300718) @@ -1181,6 +1181,41 @@ static SYSCTL_NODE(_sysctl, 5, oiddescr, */ /* + * Handle a bool. + * Two cases: + * a variable: point arg1 at it. + * a constant: pass it in arg2. + */ + +int +sysctl_handle_bool(SYSCTL_HANDLER_ARGS) +{ + uint8_t temp; + int error; + + /* + * Attempt to get a coherent snapshot by making a copy of the data. + */ + if (arg1) + temp = *(bool *)arg1 ? 1 : 0; + else + temp = arg2 ? 1 : 0; + + error = SYSCTL_OUT(req, &temp, sizeof(temp)); + if (error || !req->newptr) + return (error); + + if (!arg1) + error = EPERM; + else { + error = SYSCTL_IN(req, &temp, sizeof(temp)); + if (!error) + *(bool *)arg1 = temp ? 1 : 0; + } + return (error); +} + +/* * Handle an int8_t, signed or unsigned. * Two cases: * a variable: point arg1 at it. Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Thu May 26 08:31:09 2016 (r300717) +++ head/sys/sys/sysctl.h Thu May 26 08:41:55 2016 (r300718) @@ -194,6 +194,7 @@ struct sysctl_oid { #define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l) #define SYSCTL_OUT_STR(r, p) (r->oldfunc)(r, p, strlen(p) + 1) +int sysctl_handle_bool(SYSCTL_HANDLER_ARGS); int sysctl_handle_8(SYSCTL_HANDLER_ARGS); int sysctl_handle_16(SYSCTL_HANDLER_ARGS); int sysctl_handle_32(SYSCTL_HANDLER_ARGS); @@ -329,6 +330,24 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e __arg, len, sysctl_handle_string, "A", __DESCR(descr)); \ }) +/* Oid for a bool. If ptr is NULL, val is returned. */ +#define SYSCTL_NULL_BOOL_PTR ((bool *)NULL) +#define SYSCTL_BOOL(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, \ + CTLTYPE_U8 | CTLFLAG_MPSAFE | (access), \ + ptr, val, sysctl_handle_bool, "CU", descr); \ + CTASSERT(((access) & CTLTYPE) == 0 && \ + sizeof(bool) == sizeof(*(ptr))) + +#define SYSCTL_ADD_BOOL(ctx, parent, nbr, name, access, ptr, val, descr) \ +({ \ + bool *__ptr = (ptr); \ + CTASSERT(((access) & CTLTYPE) == 0); \ + sysctl_add_oid(ctx, parent, nbr, name, \ + CTLTYPE_U8 | CTLFLAG_MPSAFE | (access), \ + __ptr, val, sysctl_handle_bool, "CU", __DESCR(descr)); \ +}) + /* Oid for a signed 8-bit int. If ptr is NULL, val is returned. */ #define SYSCTL_NULL_S8_PTR ((int8_t *)NULL) #define SYSCTL_S8(parent, nbr, name, access, ptr, val, descr) \ From owner-svn-src-head@freebsd.org Thu May 26 08:44:12 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A468B4B83C; Thu, 26 May 2016 08:44:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A43110B2; Thu, 26 May 2016 08:44:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q8iBi9047062; Thu, 26 May 2016 08:44:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q8iBNY047061; Thu, 26 May 2016 08:44:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605260844.u4Q8iBNY047061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Thu, 26 May 2016 08:44:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300719 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 08:44:12 -0000 Author: hselasky Date: Thu May 26 08:44:11 2016 New Revision: 300719 URL: https://svnweb.freebsd.org/changeset/base/300719 Log: Add support for boolean module parameters in the LinuxKPI. Requested by: kmacy @ Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Modified: head/sys/compat/linuxkpi/common/include/linux/moduleparam.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Thu May 26 08:41:55 2016 (r300718) +++ head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Thu May 26 08:44:11 2016 (r300719) @@ -50,6 +50,12 @@ #define LINUXKPI_PARAM_DESC(name) LINUXKPI_PARAM_CONCAT(linuxkpi_,LINUXKPI_PARAM_PREFIX,name,_desc) #define LINUXKPI_PARAM_NAME(name) LINUXKPI_PARAM_CONCAT(LINUXKPI_PARAM_PREFIX,name,,) +#define LINUXKPI_PARAM_bool(name, var) \ + extern const char LINUXKPI_PARAM_DESC(name)[]; \ + LINUXKPI_PARAM_PASS(SYSCTL_BOOL(LINUXKPI_PARAM_PARENT, OID_AUTO,\ + LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_DESC(name))) + #define LINUXKPI_PARAM_byte(name, var) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_U8(LINUXKPI_PARAM_PARENT, OID_AUTO, \ From owner-svn-src-head@freebsd.org Thu May 26 08:47:07 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AAD5B4B908; Thu, 26 May 2016 08:47:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B4F212AB; Thu, 26 May 2016 08:47:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q8l6bW047244; Thu, 26 May 2016 08:47:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q8l6pY047243; Thu, 26 May 2016 08:47:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605260847.u4Q8l6pY047243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Thu, 26 May 2016 08:47:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300720 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 08:47:07 -0000 Author: hselasky Date: Thu May 26 08:47:06 2016 New Revision: 300720 URL: https://svnweb.freebsd.org/changeset/base/300720 Log: Add more module parameter macros to the LinuxKPI. Obtained from: kmacy @ Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Modified: head/sys/compat/linuxkpi/common/include/linux/moduleparam.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Thu May 26 08:44:11 2016 (r300719) +++ head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Thu May 26 08:47:06 2016 (r300720) @@ -110,6 +110,12 @@ #define module_param(var, type, mode) \ LINUXKPI_PARAM_##type(var, var) +#define module_param_named_unsafe(name, var, type, mode) \ + LINUXKPI_PARAM_##type(name, var) + +#define module_param_unsafe(var, type, mode) \ + LINUXKPI_PARAM_##type(var, var) + #define module_param_array(var, type, addr_argc, mode) #define MODULE_PARM_DESC(name, desc) \ From owner-svn-src-head@freebsd.org Thu May 26 09:04:16 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00374B4BFF7; Thu, 26 May 2016 09:04:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2BCB10DC; Thu, 26 May 2016 09:04:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q94EoS054894; Thu, 26 May 2016 09:04:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q94EXw054893; Thu, 26 May 2016 09:04:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605260904.u4Q94EXw054893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Thu, 26 May 2016 09:04:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300721 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 09:04:16 -0000 Author: hselasky Date: Thu May 26 09:04:14 2016 New Revision: 300721 URL: https://svnweb.freebsd.org/changeset/base/300721 Log: Add support for runtime modifiable module parameters in the LinuxKPI. Linux module parameters have a permissions value. If any write bits are set we are allowed to modify the module parameter runtime. Reflect this when creating the static SYSCTL nodes. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Modified: head/sys/compat/linuxkpi/common/include/linux/moduleparam.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Thu May 26 08:47:06 2016 (r300720) +++ head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Thu May 26 09:04:14 2016 (r300721) @@ -44,77 +44,81 @@ #define LINUXKPI_PARAM_PREFIX /* empty prefix is the default */ #endif +#ifndef LINUXKPI_PARAM_PERM +#define LINUXKPI_PARAM_PERM(perm) (((perm) & 0222) ? CTLFLAG_RWTUN : CTLFLAG_RDTUN) +#endif + #define LINUXKPI_PARAM_CONCAT_SUB(a,b,c,d) a##b##c##d #define LINUXKPI_PARAM_CONCAT(...) LINUXKPI_PARAM_CONCAT_SUB(__VA_ARGS__) #define LINUXKPI_PARAM_PASS(...) __VA_ARGS__ #define LINUXKPI_PARAM_DESC(name) LINUXKPI_PARAM_CONCAT(linuxkpi_,LINUXKPI_PARAM_PREFIX,name,_desc) #define LINUXKPI_PARAM_NAME(name) LINUXKPI_PARAM_CONCAT(LINUXKPI_PARAM_PREFIX,name,,) -#define LINUXKPI_PARAM_bool(name, var) \ +#define LINUXKPI_PARAM_bool(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_BOOL(LINUXKPI_PARAM_PARENT, OID_AUTO,\ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) -#define LINUXKPI_PARAM_byte(name, var) \ +#define LINUXKPI_PARAM_byte(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_U8(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) -#define LINUXKPI_PARAM_short(name, var) \ +#define LINUXKPI_PARAM_short(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_S16(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) -#define LINUXKPI_PARAM_ushort(name, var) \ +#define LINUXKPI_PARAM_ushort(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_U16(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) -#define LINUXKPI_PARAM_int(name, var) \ +#define LINUXKPI_PARAM_int(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_INT(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0,\ LINUXKPI_PARAM_DESC(name))) -#define LINUXKPI_PARAM_uint(name, var) \ +#define LINUXKPI_PARAM_uint(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_UINT(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) -#define LINUXKPI_PARAM_long(name, var) \ +#define LINUXKPI_PARAM_long(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_LONG(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) -#define LINUXKPI_PARAM_ulong(name, var) \ +#define LINUXKPI_PARAM_ulong(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_ULONG(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) #define module_param_string(name, str, len, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_STRING(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, (str), (len), \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), (str), (len), \ LINUXKPI_PARAM_DESC(name))) #define module_param_named(name, var, type, mode) \ - LINUXKPI_PARAM_##type(name, var) + LINUXKPI_PARAM_##type(name, var, mode) #define module_param(var, type, mode) \ - LINUXKPI_PARAM_##type(var, var) + LINUXKPI_PARAM_##type(var, var, mode) #define module_param_named_unsafe(name, var, type, mode) \ - LINUXKPI_PARAM_##type(name, var) + LINUXKPI_PARAM_##type(name, var, mode) #define module_param_unsafe(var, type, mode) \ - LINUXKPI_PARAM_##type(var, var) + LINUXKPI_PARAM_##type(var, var, mode) #define module_param_array(var, type, addr_argc, mode) From owner-svn-src-head@freebsd.org Thu May 26 09:09:12 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFBA2B4928C; Thu, 26 May 2016 09:09:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9FC6918AA; Thu, 26 May 2016 09:09:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q99BKk055240; Thu, 26 May 2016 09:09:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q99Bhh055239; Thu, 26 May 2016 09:09:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605260909.u4Q99Bhh055239@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov <kib@FreeBSD.org> Date: Thu, 26 May 2016 09:09:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300722 - head/sys/x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 09:09:12 -0000 Author: kib Date: Thu May 26 09:09:11 2016 New Revision: 300722 URL: https://svnweb.freebsd.org/changeset/base/300722 Log: Only calibrate ICR read loop when not in x2APIC mode. Run-time switching between LAPIC modes is not supported, and there is no need to wait for IPI ack in x2APIC mode. So the calibrated delay is only needed for !x2APIC. This saves around a second of boot time on the real hardware for x2APIC. Sponsored by: The FreeBSD Foundation Modified: head/sys/x86/x86/local_apic.c Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Thu May 26 09:04:14 2016 (r300721) +++ head/sys/x86/x86/local_apic.c Thu May 26 09:09:11 2016 (r300722) @@ -525,19 +525,21 @@ native_lapic_init(vm_paddr_t addr) */ KASSERT((cpu_feature & CPUID_TSC) != 0 && tsc_freq != 0, ("TSC not initialized")); - r = rdtsc(); - for (rx = 0; rx < LOOPS; rx++) { - (void)lapic_read_icr_lo(); - ia32_pause(); - } - r = rdtsc() - r; - r1 = tsc_freq * LOOPS; - r2 = r * 1000000; - lapic_ipi_wait_mult = r1 >= r2 ? r1 / r2 : 1; - if (bootverbose) { - printf("LAPIC: ipi_wait() us multiplier %ju (r %ju tsc %ju)\n", - (uintmax_t)lapic_ipi_wait_mult, (uintmax_t)r, - (uintmax_t)tsc_freq); + if (!x2apic_mode) { + r = rdtsc(); + for (rx = 0; rx < LOOPS; rx++) { + (void)lapic_read_icr_lo(); + ia32_pause(); + } + r = rdtsc() - r; + r1 = tsc_freq * LOOPS; + r2 = r * 1000000; + lapic_ipi_wait_mult = r1 >= r2 ? r1 / r2 : 1; + if (bootverbose) { + printf("LAPIC: ipi_wait() us multiplier %ju (r %ju " + "tsc %ju)\n", (uintmax_t)lapic_ipi_wait_mult, + (uintmax_t)r, (uintmax_t)tsc_freq); + } } #undef LOOPS #endif /* SMP */ From owner-svn-src-head@freebsd.org Thu May 26 09:49:30 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58105B49B26; Thu, 26 May 2016 09:49:30 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 220021ABB; Thu, 26 May 2016 09:49:30 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q9nTiP069931; Thu, 26 May 2016 09:49:29 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q9nTx1069928; Thu, 26 May 2016 09:49:29 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201605260949.u4Q9nTx1069928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala <trasz@FreeBSD.org> Date: Thu, 26 May 2016 09:49:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300723 - in head/sys: dev/iser modules/iser X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 09:49:30 -0000 Author: trasz Date: Thu May 26 09:49:29 2016 New Revision: 300723 URL: https://svnweb.freebsd.org/changeset/base/300723 Log: Bring in the Mellanox implementation of iSER (iSCSI over RDMA) initiator, written by Sagi Grimberg <sagig at mellanox.com> and Max Gurtovoy <maxg at mellanox.com>. This code comes from https://github.com/sagigrimberg/iser-freebsd, branch iser-rebase-11-current-r291993. It's not connected to the build just yet; it still needs some tweaks to adapt to my changes to iSCSI infrastructure. Big thanks to Mellanox for their support for FreeBSD! Obtained from: Mellanox Technologies MFC after: 1 month Relnotes: yes Added: head/sys/dev/iser/ head/sys/dev/iser/icl_iser.c (contents, props changed) head/sys/dev/iser/icl_iser.h (contents, props changed) head/sys/dev/iser/iser_initiator.c (contents, props changed) head/sys/dev/iser/iser_memory.c (contents, props changed) head/sys/dev/iser/iser_verbs.c (contents, props changed) head/sys/modules/iser/ head/sys/modules/iser/Makefile (contents, props changed) Added: head/sys/dev/iser/icl_iser.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iser/icl_iser.c Thu May 26 09:49:29 2016 (r300723) @@ -0,0 +1,582 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2015, Mellanox Technologies, Inc. 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 "icl_iser.h" + +SYSCTL_NODE(_kern, OID_AUTO, iser, CTLFLAG_RW, 0, "iSER module"); +int iser_debug = 0; +SYSCTL_INT(_kern_iser, OID_AUTO, debug, CTLFLAG_RWTUN, + &iser_debug, 0, "Enable iser debug messages"); + +static MALLOC_DEFINE(M_ICL_ISER, "icl_iser", "iSCSI iser backend"); +static uma_zone_t icl_pdu_zone; + +static volatile u_int icl_iser_ncons; +struct iser_global ig; + +static icl_conn_new_pdu_t iser_conn_new_pdu; +static icl_conn_pdu_free_t iser_conn_pdu_free; +static icl_conn_pdu_data_segment_length_t iser_conn_pdu_data_segment_length; +static icl_conn_pdu_append_data_t iser_conn_pdu_append_data; +static icl_conn_pdu_queue_t iser_conn_pdu_queue; +static icl_conn_handoff_t iser_conn_handoff; +static icl_conn_free_t iser_conn_free; +static icl_conn_close_t iser_conn_close; +static icl_conn_release_t iser_conn_release; +static icl_conn_connect_t iser_conn_connect; +static icl_conn_connected_t iser_conn_connected; +static icl_conn_task_setup_t iser_conn_task_setup; +static icl_conn_task_done_t iser_conn_task_done; +static icl_conn_pdu_get_data_t iser_conn_pdu_get_data; + +static kobj_method_t icl_iser_methods[] = { + KOBJMETHOD(icl_conn_new_pdu, iser_conn_new_pdu), + KOBJMETHOD(icl_conn_pdu_free, iser_conn_pdu_free), + KOBJMETHOD(icl_conn_pdu_data_segment_length, iser_conn_pdu_data_segment_length), + KOBJMETHOD(icl_conn_pdu_append_data, iser_conn_pdu_append_data), + KOBJMETHOD(icl_conn_pdu_queue, iser_conn_pdu_queue), + KOBJMETHOD(icl_conn_handoff, iser_conn_handoff), + KOBJMETHOD(icl_conn_free, iser_conn_free), + KOBJMETHOD(icl_conn_close, iser_conn_close), + KOBJMETHOD(icl_conn_release, iser_conn_release), + KOBJMETHOD(icl_conn_connect, iser_conn_connect), + KOBJMETHOD(icl_conn_connected, iser_conn_connected), + KOBJMETHOD(icl_conn_task_setup, iser_conn_task_setup), + KOBJMETHOD(icl_conn_task_done, iser_conn_task_done), + KOBJMETHOD(icl_conn_pdu_get_data, iser_conn_pdu_get_data), + { 0, 0 } +}; + +DEFINE_CLASS(icl_iser, icl_iser_methods, sizeof(struct iser_conn)); + +/** + * iser_initialize_headers() - Initialize task headers + * @pdu: iser pdu + * @iser_conn: iser connection + * + * Notes: + * This routine may race with iser teardown flow for scsi + * error handling TMFs. So for TMF we should acquire the + * state mutex to avoid dereferencing the IB device which + * may have already been terminated (racing teardown sequence). + */ +int +iser_initialize_headers(struct icl_iser_pdu *pdu, struct iser_conn *iser_conn) +{ + struct iser_tx_desc *tx_desc = &pdu->desc; + struct iser_device *device = iser_conn->ib_conn.device; + u64 dma_addr; + int ret = 0; + + dma_addr = ib_dma_map_single(device->ib_device, (void *)tx_desc, + ISER_HEADERS_LEN, DMA_TO_DEVICE); + if (ib_dma_mapping_error(device->ib_device, dma_addr)) { + ret = -ENOMEM; + goto out; + } + + tx_desc->mapped = true; + tx_desc->dma_addr = dma_addr; + tx_desc->tx_sg[0].addr = tx_desc->dma_addr; + tx_desc->tx_sg[0].length = ISER_HEADERS_LEN; + tx_desc->tx_sg[0].lkey = device->mr->lkey; + +out: + + return (ret); +} + +int +iser_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *request, + const void *addr, size_t len, int flags) +{ + struct iser_conn *iser_conn = icl_to_iser_conn(ic); + + if (request->ip_bhs->bhs_opcode & ISCSI_BHS_OPCODE_LOGIN_REQUEST || + request->ip_bhs->bhs_opcode & ISCSI_BHS_OPCODE_TEXT_REQUEST) { + ISER_DBG("copy to login buff"); + memcpy(iser_conn->login_req_buf, addr, len); + request->ip_data_len = len; + } + + return (0); +} + +void +iser_conn_pdu_get_data(struct icl_conn *ic, struct icl_pdu *ip, + size_t off, void *addr, size_t len) +{ + /* If we have a receive data, copy it to upper layer buffer */ + if (ip->ip_data_mbuf) + memcpy(addr, ip->ip_data_mbuf + off, len); +} + +/* + * Allocate icl_pdu with empty BHS to fill up by the caller. + */ +struct icl_pdu * +iser_new_pdu(struct icl_conn *ic, int flags) +{ + struct icl_iser_pdu *iser_pdu; + struct icl_pdu *ip; + struct iser_conn *iser_conn = icl_to_iser_conn(ic); + + iser_pdu = uma_zalloc(icl_pdu_zone, flags | M_ZERO); + if (iser_pdu == NULL) { + ISER_WARN("failed to allocate %zd bytes", sizeof(*iser_pdu)); + return (NULL); + } + + iser_pdu->iser_conn = iser_conn; + ip = &iser_pdu->icl_pdu; + ip->ip_conn = ic; + ip->ip_bhs = &iser_pdu->desc.iscsi_header; + + return (ip); +} + +struct icl_pdu * +iser_conn_new_pdu(struct icl_conn *ic, int flags) +{ + return (iser_new_pdu(ic, flags)); +} + +void +iser_pdu_free(struct icl_conn *ic, struct icl_pdu *ip) +{ + struct icl_iser_pdu *iser_pdu = icl_to_iser_pdu(ip); + + uma_zfree(icl_pdu_zone, iser_pdu); +} + +size_t +iser_conn_pdu_data_segment_length(struct icl_conn *ic, + const struct icl_pdu *request) +{ + uint32_t len = 0; + + len += request->ip_bhs->bhs_data_segment_len[0]; + len <<= 8; + len += request->ip_bhs->bhs_data_segment_len[1]; + len <<= 8; + len += request->ip_bhs->bhs_data_segment_len[2]; + + return (len); +} + +void +iser_conn_pdu_free(struct icl_conn *ic, struct icl_pdu *ip) +{ + iser_pdu_free(ic, ip); +} + +static bool +is_control_opcode(uint8_t opcode) +{ + bool is_control = false; + + switch (opcode & ISCSI_OPCODE_MASK) { + case ISCSI_BHS_OPCODE_NOP_OUT: + case ISCSI_BHS_OPCODE_LOGIN_REQUEST: + case ISCSI_BHS_OPCODE_LOGOUT_REQUEST: + case ISCSI_BHS_OPCODE_TEXT_REQUEST: + is_control = true; + break; + case ISCSI_BHS_OPCODE_SCSI_COMMAND: + is_control = false; + break; + default: + ISER_ERR("unknown opcode %d", opcode); + } + + return (is_control); +} + +void +iser_conn_pdu_queue(struct icl_conn *ic, struct icl_pdu *ip) +{ + struct iser_conn *iser_conn = icl_to_iser_conn(ic); + struct icl_iser_pdu *iser_pdu = icl_to_iser_pdu(ip); + int ret; + + ret = iser_initialize_headers(iser_pdu, iser_conn); + if (ret) { + ISER_ERR("Failed to map TX descriptor pdu %p", iser_pdu); + return; + } + + if (is_control_opcode(ip->ip_bhs->bhs_opcode)) { + ret = iser_send_control(iser_conn, iser_pdu); + if (unlikely(ret)) + ISER_ERR("Failed to send control pdu %p", iser_pdu); + } else { + ret = iser_send_command(iser_conn, iser_pdu); + if (unlikely(ret)) + ISER_ERR("Failed to send command pdu %p", iser_pdu); + } +} + +static struct icl_conn * +iser_new_conn(const char *name, struct mtx *lock) +{ + struct iser_conn *iser_conn; + struct icl_conn *ic; + + refcount_acquire(&icl_iser_ncons); + + iser_conn = (struct iser_conn *)kobj_create(&icl_iser_class, M_ICL_ISER, M_WAITOK | M_ZERO); + if (!iser_conn) { + ISER_ERR("failed to allocate iser conn"); + refcount_release(&icl_iser_ncons); + return (NULL); + } + + cv_init(&iser_conn->up_cv, "iser_cv"); + sx_init(&iser_conn->state_mutex, "iser_conn_state_mutex"); + mtx_init(&iser_conn->ib_conn.beacon.flush_lock, "flush_lock", NULL, MTX_DEF); + cv_init(&iser_conn->ib_conn.beacon.flush_cv, "flush_cv"); + mtx_init(&iser_conn->ib_conn.lock, "lock", NULL, MTX_DEF); + + ic = &iser_conn->icl_conn; + ic->ic_lock = lock; + ic->ic_name = name; + ic->ic_driver = strdup("iser", M_TEMP); + ic->ic_iser = true; + + return (ic); +} + +void +iser_conn_free(struct icl_conn *ic) +{ + struct iser_conn *iser_conn = icl_to_iser_conn(ic); + + cv_destroy(&iser_conn->ib_conn.beacon.flush_cv); + mtx_destroy(&iser_conn->ib_conn.beacon.flush_lock); + sx_destroy(&iser_conn->state_mutex); + cv_destroy(&iser_conn->up_cv); + kobj_delete((struct kobj *)iser_conn, M_ICL_ISER); + refcount_release(&icl_iser_ncons); +} + +int +iser_conn_handoff(struct icl_conn *ic, int cmds_max) +{ + struct iser_conn *iser_conn = icl_to_iser_conn(ic); + int error = 0; + + sx_xlock(&iser_conn->state_mutex); + if (iser_conn->state != ISER_CONN_UP) { + error = EINVAL; + ISER_ERR("iser_conn %p state is %d, teardown started\n", + iser_conn, iser_conn->state); + goto out; + } + + /* + * In discovery session no need to allocate rx desc and posting recv + * work request + */ + if (ic->ic_session_type_discovery(ic)) + goto out; + + error = iser_alloc_rx_descriptors(iser_conn, cmds_max); + if (error) + goto out; + + error = iser_post_recvm(iser_conn, iser_conn->min_posted_rx); + if (error) + goto post_error; + + sx_xunlock(&iser_conn->state_mutex); + return (error); + +post_error: + iser_free_rx_descriptors(iser_conn); +out: + sx_xunlock(&iser_conn->state_mutex); + return (error); + +} + +/** + * Frees all conn objects + */ +void +iser_conn_release(struct icl_conn *ic) +{ + struct iser_conn *iser_conn = icl_to_iser_conn(ic); + struct ib_conn *ib_conn = &iser_conn->ib_conn; + struct iser_conn *curr, *tmp; + + mtx_lock(&ig.connlist_mutex); + /* + * Search for iser connection in global list. + * It may not be there in case of failure in connection establishment + * stage. + */ + list_for_each_entry_safe(curr, tmp, &ig.connlist, conn_list) { + if (iser_conn == curr) { + ISER_WARN("found iser_conn %p", iser_conn); + list_del(&iser_conn->conn_list); + } + } + mtx_unlock(&ig.connlist_mutex); + + /* + * In case we reconnecting or removing session, we need to + * release IB resources (which is safe to call more than once). + */ + sx_xlock(&iser_conn->state_mutex); + iser_free_ib_conn_res(iser_conn, true); + sx_xunlock(&iser_conn->state_mutex); + + if (ib_conn->cma_id != NULL) { + rdma_destroy_id(ib_conn->cma_id); + ib_conn->cma_id = NULL; + } + +} + +void +iser_conn_close(struct icl_conn *ic) +{ + struct iser_conn *iser_conn = icl_to_iser_conn(ic); + + ISER_INFO("closing conn %p", iser_conn); + + sx_xlock(&iser_conn->state_mutex); + /* + * In case iser connection is waiting on conditional variable + * (state PENDING) and we try to close it before connection establishment, + * we need to signal it to continue releasing connection properly. + */ + if (!iser_conn_terminate(iser_conn) && iser_conn->state == ISER_CONN_PENDING) + cv_signal(&iser_conn->up_cv); + sx_xunlock(&iser_conn->state_mutex); + +} + +int +iser_conn_connect(struct icl_conn *ic, int domain, int socktype, + int protocol, struct sockaddr *from_sa, struct sockaddr *to_sa) +{ + struct iser_conn *iser_conn = icl_to_iser_conn(ic); + struct ib_conn *ib_conn = &iser_conn->ib_conn; + int err = 0; + + sx_xlock(&iser_conn->state_mutex); + /* the device is known only --after-- address resolution */ + ib_conn->device = NULL; + + iser_conn->state = ISER_CONN_PENDING; + + ib_conn->cma_id = rdma_create_id(iser_cma_handler, (void *)iser_conn, + RDMA_PS_TCP, IB_QPT_RC); + if (IS_ERR(ib_conn->cma_id)) { + err = -PTR_ERR(ib_conn->cma_id); + ISER_ERR("rdma_create_id failed: %d", err); + goto id_failure; + } + + err = rdma_resolve_addr(ib_conn->cma_id, from_sa, to_sa, 1000); + if (err) { + ISER_ERR("rdma_resolve_addr failed: %d", err); + if (err < 0) + err = -err; + goto addr_failure; + } + + ISER_DBG("before cv_wait: %p", iser_conn); + cv_wait(&iser_conn->up_cv, &iser_conn->state_mutex); + ISER_DBG("after cv_wait: %p", iser_conn); + + if (iser_conn->state != ISER_CONN_UP) { + err = EIO; + goto addr_failure; + } + + err = iser_alloc_login_buf(iser_conn); + if (err) + goto addr_failure; + sx_xunlock(&iser_conn->state_mutex); + + mtx_lock(&ig.connlist_mutex); + list_add(&iser_conn->conn_list, &ig.connlist); + mtx_unlock(&ig.connlist_mutex); + + return (0); + +id_failure: + ib_conn->cma_id = NULL; +addr_failure: + sx_xunlock(&iser_conn->state_mutex); + return (err); +} + +/** + * Called with session spinlock held. + * No need to lock state mutex on an advisory check. + **/ +bool +iser_conn_connected(struct icl_conn *ic) +{ + struct iser_conn *iser_conn = icl_to_iser_conn(ic); + + return (iser_conn->state == ISER_CONN_UP); +} + +int +iser_conn_task_setup(struct icl_conn *ic, struct ccb_scsiio *csio, + uint32_t *task_tagp, void **prvp, struct icl_pdu *ip) +{ + struct icl_iser_pdu *iser_pdu = icl_to_iser_pdu(ip); + + *prvp = ip; + iser_pdu->csio = csio; + + return (0); +} + +void +iser_conn_task_done(struct icl_conn *ic, void *prv) +{ + struct icl_pdu *ip = prv; + struct icl_iser_pdu *iser_pdu = icl_to_iser_pdu(ip); + struct iser_device *device = iser_pdu->iser_conn->ib_conn.device; + struct iser_tx_desc *tx_desc = &iser_pdu->desc; + + if (iser_pdu->dir[ISER_DIR_IN]) { + iser_unreg_rdma_mem(iser_pdu, ISER_DIR_IN); + iser_dma_unmap_task_data(iser_pdu, + &iser_pdu->data[ISER_DIR_IN], + DMA_FROM_DEVICE); + } + + if (iser_pdu->dir[ISER_DIR_OUT]) { + iser_unreg_rdma_mem(iser_pdu, ISER_DIR_OUT); + iser_dma_unmap_task_data(iser_pdu, + &iser_pdu->data[ISER_DIR_OUT], + DMA_TO_DEVICE); + } + + if (likely(tx_desc->mapped)) { + ib_dma_unmap_single(device->ib_device, tx_desc->dma_addr, + ISER_HEADERS_LEN, DMA_TO_DEVICE); + tx_desc->mapped = false; + } + + iser_pdu_free(ic, ip); +} + +static u_int32_t +iser_hba_misc() +{ + return (PIM_UNMAPPED); +} + +static int +iser_limits(size_t *limitp) +{ + *limitp = 128 * 1024; + + return (0); +} + +static int +icl_iser_load(void) +{ + int error; + + ISER_DBG("Starting iSER datamover..."); + + icl_pdu_zone = uma_zcreate("icl_iser_pdu", sizeof(struct icl_iser_pdu), + NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, 0); + /* FIXME: Check rc */ + + refcount_init(&icl_iser_ncons, 0); + + error = icl_register("iser", 0, iser_limits, iser_new_conn, iser_hba_misc); + KASSERT(error == 0, ("failed to register iser")); + + memset(&ig, 0, sizeof(struct iser_global)); + + /* device init is called only after the first addr resolution */ + sx_init(&ig.device_list_mutex, "global_device_lock"); + INIT_LIST_HEAD(&ig.device_list); + mtx_init(&ig.connlist_mutex, "global_conn_lock", NULL, MTX_DEF); + INIT_LIST_HEAD(&ig.connlist); + sx_init(&ig.close_conns_mutex, "global_close_conns_lock"); + + return (error); +} + +static int +icl_iser_unload(void) +{ + ISER_DBG("Removing iSER datamover..."); + + if (icl_iser_ncons != 0) + return (EBUSY); + + sx_destroy(&ig.close_conns_mutex); + mtx_destroy(&ig.connlist_mutex); + sx_destroy(&ig.device_list_mutex); + + icl_unregister("iser"); + + uma_zdestroy(icl_pdu_zone); + + return (0); +} + +static int +icl_iser_modevent(module_t mod, int what, void *arg) +{ + switch (what) { + case MOD_LOAD: + return (icl_iser_load()); + case MOD_UNLOAD: + return (icl_iser_unload()); + default: + return (EINVAL); + } +} + +moduledata_t icl_iser_data = { + .name = "icl_iser", + .evhand = icl_iser_modevent, + .priv = 0 +}; + +DECLARE_MODULE(icl_iser, icl_iser_data, SI_SUB_DRIVERS, SI_ORDER_MIDDLE); +MODULE_DEPEND(icl_iser, icl, 1, 1, 1); +MODULE_DEPEND(icl_iser, iscsi, 1, 1, 1); +MODULE_DEPEND(icl_iser, ibcore, 1, 1, 1); +MODULE_DEPEND(icl_iser, linuxkpi, 1, 1, 1); +MODULE_VERSION(icl_iser, 1); + Added: head/sys/dev/iser/icl_iser.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iser/icl_iser.h Thu May 26 09:49:29 2016 (r300723) @@ -0,0 +1,547 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2015, Mellanox Technologies, Inc. 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. + */ + +#ifndef ICL_ISER_H +#define ICL_ISER_H + +/* + * iSCSI Common Layer for RDMA. + */ + +#include <sys/cdefs.h> +#include <sys/param.h> +#include <sys/capsicum.h> +#include <sys/condvar.h> +#include <sys/conf.h> +#include <sys/file.h> +#include <sys/kernel.h> +#include <sys/kthread.h> +#include <sys/lock.h> +#include <sys/mbuf.h> +#include <sys/mutex.h> +#include <sys/module.h> +#include <sys/protosw.h> +#include <sys/socket.h> +#include <sys/socketvar.h> +#include <sys/sysctl.h> +#include <sys/systm.h> +#include <sys/sx.h> +#include <sys/uio.h> +#include <sys/taskqueue.h> +#include <sys/bio.h> +#include <vm/uma.h> +#include <netinet/in.h> +#include <netinet/tcp.h> +#include <dev/iscsi/icl.h> +#include <dev/iscsi/iscsi_proto.h> +#include <icl_conn_if.h> +#include <cam/cam.h> +#include <cam/cam_ccb.h> +#include <rdma/ib_verbs.h> +#include <rdma/ib_fmr_pool.h> +#include <rdma/rdma_cm.h> + + +#define ISER_DBG(X, ...) \ + do { \ + if (unlikely(iser_debug > 2)) \ + printf("DEBUG: %s: " X "\n", \ + __func__, ## __VA_ARGS__); \ + } while (0) + +#define ISER_INFO(X, ...) \ + do { \ + if (unlikely(iser_debug > 1)) \ + printf("INFO: %s: " X "\n", \ + __func__, ## __VA_ARGS__); \ + } while (0) + +#define ISER_WARN(X, ...) \ + do { \ + if (unlikely(iser_debug > 0)) { \ + printf("WARNING: %s: " X "\n", \ + __func__, ## __VA_ARGS__); \ + } \ + } while (0) + +#define ISER_ERR(X, ...) \ + printf("ERROR: %s: " X "\n", __func__, ## __VA_ARGS__) + +#define ISER_VER 0x10 +#define ISER_WSV 0x08 +#define ISER_RSV 0x04 + +#define ISER_FASTREG_LI_WRID 0xffffffffffffffffULL +#define ISER_BEACON_WRID 0xfffffffffffffffeULL + +#define SHIFT_4K 12 +#define SIZE_4K (1ULL << SHIFT_4K) +#define MASK_4K (~(SIZE_4K-1)) + +/* support up to 512KB in one RDMA */ +#define ISCSI_ISER_SG_TABLESIZE (0x80000 >> SHIFT_4K) +#define ISER_DEF_XMIT_CMDS_MAX 256 + +/* the max RX (recv) WR supported by the iSER QP is defined by * + * max_recv_wr = commands_max + recv_beacon */ +#define ISER_QP_MAX_RECV_DTOS (ISER_DEF_XMIT_CMDS_MAX + 1) +#define ISER_MIN_POSTED_RX (ISER_DEF_XMIT_CMDS_MAX >> 2) + +/* QP settings */ +/* Maximal bounds on received asynchronous PDUs */ +#define ISER_MAX_RX_MISC_PDUS 4 /* NOOP_IN(2) , ASYNC_EVENT(2) */ +#define ISER_MAX_TX_MISC_PDUS 6 /* NOOP_OUT(2), TEXT(1), SCSI_TMFUNC(2), LOGOUT(1) */ + +/* the max TX (send) WR supported by the iSER QP is defined by * + * max_send_wr = T * (1 + D) + C ; D is how many inflight dataouts we expect * + * to have at max for SCSI command. The tx posting & completion handling code * + * supports -EAGAIN scheme where tx is suspended till the QP has room for more * + * send WR. D=8 comes from 64K/8K */ + +#define ISER_INFLIGHT_DATAOUTS 8 + +/* the send_beacon increase the max_send_wr by 1 */ +#define ISER_QP_MAX_REQ_DTOS (ISER_DEF_XMIT_CMDS_MAX * \ + (1 + ISER_INFLIGHT_DATAOUTS) + \ + ISER_MAX_TX_MISC_PDUS + \ + ISER_MAX_RX_MISC_PDUS + 1) + +#define ISER_GET_MAX_XMIT_CMDS(send_wr) ((send_wr \ + - ISER_MAX_TX_MISC_PDUS \ + - ISER_MAX_RX_MISC_PDUS - 1) / \ + (1 + ISER_INFLIGHT_DATAOUTS)) + +#define ISER_WC_BATCH_COUNT 16 +#define ISER_SIGNAL_CMD_COUNT 32 + +/* Maximal QP's recommended per CQ. In case we use more QP's per CQ we might * + * encounter a CQ overrun state. */ +#define ISCSI_ISER_MAX_CONN 8 +#define ISER_MAX_RX_LEN (ISER_QP_MAX_RECV_DTOS * ISCSI_ISER_MAX_CONN) +#define ISER_MAX_TX_LEN (ISER_QP_MAX_REQ_DTOS * ISCSI_ISER_MAX_CONN) +#define ISER_MAX_CQ_LEN (ISER_MAX_RX_LEN + ISER_MAX_TX_LEN + \ + ISCSI_ISER_MAX_CONN) + +#define ISER_ZBVA_NOT_SUPPORTED 0x80 +#define ISER_SEND_W_INV_NOT_SUPPORTED 0x40 + +#define icl_to_iser_conn(ic) \ + container_of(ic, struct iser_conn, icl_conn) +#define icl_to_iser_pdu(ip) \ + container_of(ip, struct icl_iser_pdu, icl_pdu) + +/** + * struct iser_hdr - iSER header + * + * @flags: flags support (zbva, remote_inv) + * @rsvd: reserved + * @write_stag: write rkey + * @write_va: write virtual address + * @reaf_stag: read rkey + * @read_va: read virtual address + */ +struct iser_hdr { + u8 flags; + u8 rsvd[3]; + __be32 write_stag; + __be64 write_va; + __be32 read_stag; + __be64 read_va; +} __attribute__((packed)); + +struct iser_cm_hdr { + u8 flags; + u8 rsvd[3]; +} __packed; + +/* Constant PDU lengths calculations */ +#define ISER_HEADERS_LEN (sizeof(struct iser_hdr) + ISCSI_BHS_SIZE) + +#define ISER_RECV_DATA_SEG_LEN 128 +#define ISER_RX_PAYLOAD_SIZE (ISER_HEADERS_LEN + ISER_RECV_DATA_SEG_LEN) + +#define ISER_RX_LOGIN_SIZE (ISER_HEADERS_LEN + ISCSI_DEF_MAX_RECV_SEG_LEN) + +enum iser_conn_state { + ISER_CONN_INIT, /* descriptor allocd, no conn */ + ISER_CONN_PENDING, /* in the process of being established */ + ISER_CONN_UP, /* up and running */ + ISER_CONN_TERMINATING, /* in the process of being terminated */ + ISER_CONN_DOWN, /* shut down */ + ISER_CONN_STATES_NUM +}; + +enum iser_task_status { + ISER_TASK_STATUS_INIT = 0, + ISER_TASK_STATUS_STARTED, + ISER_TASK_STATUS_COMPLETED +}; + +enum iser_data_dir { + ISER_DIR_IN = 0, /* to initiator */ + ISER_DIR_OUT, /* from initiator */ + ISER_DIRS_NUM +}; + +/** + * struct iser_mem_reg - iSER memory registration info + * + * @sge: memory region sg element + * @rkey: memory region remote key + * @mem_h: pointer to registration context (FMR/Fastreg) + */ +struct iser_mem_reg { + struct ib_sge sge; + u32 rkey; + void *mem_h; +}; + +enum iser_desc_type { + ISCSI_TX_CONTROL , + ISCSI_TX_SCSI_COMMAND, + ISCSI_TX_DATAOUT +}; + +/** + * struct iser_data_buf - iSER data buffer + * + * @sg: pointer to the sg list + * @size: num entries of this sg + * @data_len: total beffer byte len + * @dma_nents: returned by dma_map_sg + * @copy_buf: allocated copy buf for SGs unaligned + * for rdma which are copied + * @orig_sg: pointer to the original sg list (in case + * we used a copy) + * @sg_single: SG-ified clone of a non SG SC or + * unaligned SG + */ +struct iser_data_buf { + struct scatterlist sgl[ISCSI_ISER_SG_TABLESIZE]; + void *sg; + unsigned int size; + unsigned long data_len; + unsigned int dma_nents; + char *copy_buf; + struct scatterlist *orig_sg; + struct scatterlist sg_single; + }; + +/* fwd declarations */ +struct iser_conn; +struct ib_conn; +struct iser_device; + +/** + * struct iser_tx_desc - iSER TX descriptor (for send wr_id) + * + * @iser_header: iser header + * @iscsi_header: iscsi header (bhs) + * @type: command/control/dataout + * @dma_addr: header buffer dma_address + * @tx_sg: sg[0] points to iser/iscsi headers + * sg[1] optionally points to either of immediate data + * unsolicited data-out or control + * @num_sge: number sges used on this TX task + * @mapped: indicates if the descriptor is dma mapped + */ +struct iser_tx_desc { + struct iser_hdr iser_header; + struct iscsi_bhs iscsi_header __attribute__((packed)); + enum iser_desc_type type; + u64 dma_addr; + struct ib_sge tx_sg[2]; + int num_sge; + bool mapped; +}; + +#define ISER_RX_PAD_SIZE (256 - (ISER_RX_PAYLOAD_SIZE + \ + sizeof(u64) + sizeof(struct ib_sge))) +/** + * struct iser_rx_desc - iSER RX descriptor (for recv wr_id) + * + * @iser_header: iser header + * @iscsi_header: iscsi header + * @data: received data segment + * @dma_addr: receive buffer dma address + * @rx_sg: ib_sge of receive buffer + * @pad: for sense data TODO: Modify to maximum sense length supported + */ +struct iser_rx_desc { + struct iser_hdr iser_header; + struct iscsi_bhs iscsi_header; + char data[ISER_RECV_DATA_SEG_LEN]; + u64 dma_addr; + struct ib_sge rx_sg; + char pad[ISER_RX_PAD_SIZE]; +} __attribute__((packed)); + +struct icl_iser_pdu { + struct icl_pdu icl_pdu; + struct iser_tx_desc desc; + struct iser_conn *iser_conn; + enum iser_task_status status; + struct ccb_scsiio *csio; + int command_sent; + int dir[ISER_DIRS_NUM]; + struct iser_mem_reg rdma_reg[ISER_DIRS_NUM]; + struct iser_data_buf data[ISER_DIRS_NUM]; +}; + +/** + * struct iser_comp - iSER completion context + * + * @device: pointer to device handle + * @cq: completion queue + * @wcs: work completion array + * @tq: taskqueue handle + * @task: task to run task_fn + * @active_qps: Number of active QPs attached + * to completion context + */ +struct iser_comp { + struct iser_device *device; + struct ib_cq *cq; + struct ib_wc wcs[ISER_WC_BATCH_COUNT]; + struct taskqueue *tq; + struct task task; + int active_qps; +}; + +/** + * struct iser_device - iSER device handle + * + * @ib_device: RDMA device + * @pd: Protection Domain for this device + * @dev_attr: Device attributes container + * @mr: Global DMA memory region + * @event_handler: IB events handle routine + * @ig_list: entry in devices list + * @refcount: Reference counter, dominated by open iser connections + * @comps_used: Number of completion contexts used, Min between online + * cpus and device max completion vectors + * @comps: Dinamically allocated array of completion handlers + */ +struct iser_device { + struct ib_device *ib_device; + struct ib_pd *pd; + struct ib_device_attr dev_attr; + struct ib_mr *mr; + struct ib_event_handler event_handler; + struct list_head ig_list; + int refcount; + int comps_used; + struct iser_comp *comps; +}; + +/** + * struct iser_reg_resources - Fast registration recources + * + * @mr: memory region + * @frpl: fast reg page list + * @mr_valid: is mr valid indicator + */ +struct iser_reg_resources { + struct ib_mr *mr; + struct ib_fast_reg_page_list *frpl; + u8 mr_valid:1; +}; + +/** + * struct fast_reg_descriptor - Fast registration descriptor + * + * @list: entry in connection fastreg pool + * @rsc: data buffer registration resources + */ +struct fast_reg_descriptor { + struct list_head list; + struct iser_reg_resources rsc; +}; + + +/** + * struct iser_beacon - beacon to signal all flush errors were drained + * + * @send: send wr + * @recv: recv wr + * @flush_lock: protects flush_cv + * @flush_cv: condition variable for beacon flush + */ +struct iser_beacon { + union { + struct ib_send_wr send; + struct ib_recv_wr recv; + }; + struct mtx flush_lock; + struct cv flush_cv; +}; + +/** + * struct ib_conn - Infiniband related objects + * + * @cma_id: rdma_cm connection maneger handle + * @qp: Connection Queue-pair + * @device: reference to iser device + * @comp: iser completion context + */ +struct ib_conn { + struct rdma_cm_id *cma_id; + struct ib_qp *qp; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu May 26 09:53:26 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CE14B49DFF; Thu, 26 May 2016 09:53:26 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E08CB1F21; Thu, 26 May 2016 09:53:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4Q9rPJd073487; Thu, 26 May 2016 09:53:25 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q9rPDl073486; Thu, 26 May 2016 09:53:25 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201605260953.u4Q9rPDl073486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala <trasz@FreeBSD.org> Date: Thu, 26 May 2016 09:53:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300724 - head/sys/dev/iser X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 09:53:26 -0000 Author: trasz Date: Thu May 26 09:53:24 2016 New Revision: 300724 URL: https://svnweb.freebsd.org/changeset/base/300724 Log: The taskqueue_enqueue_fast() was removed in r296272. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iser/iser_verbs.c Modified: head/sys/dev/iser/iser_verbs.c ============================================================================== --- head/sys/dev/iser/iser_verbs.c Thu May 26 09:49:29 2016 (r300723) +++ head/sys/dev/iser/iser_verbs.c Thu May 26 09:53:24 2016 (r300724) @@ -185,7 +185,7 @@ iser_cq_callback(struct ib_cq *cq, void { struct iser_comp *comp = cq_context; - taskqueue_enqueue_fast(comp->tq, &comp->task); + taskqueue_enqueue(comp->tq, &comp->task); } /** From owner-svn-src-head@freebsd.org Thu May 26 10:03:23 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C6EEB4A14A; Thu, 26 May 2016 10:03:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D9B51483; Thu, 26 May 2016 10:03:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QA3MAr077093; Thu, 26 May 2016 10:03:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QA3MSX077092; Thu, 26 May 2016 10:03:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605261003.u4QA3MSX077092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Thu, 26 May 2016 10:03:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300725 - head/sys/compat/linuxkpi/common/include/asm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 10:03:23 -0000 Author: hselasky Date: Thu May 26 10:03:22 2016 New Revision: 300725 URL: https://svnweb.freebsd.org/changeset/base/300725 Log: Define ATOMIC_LONG_INIT() in the LinuxKPI. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Thu May 26 09:53:24 2016 (r300724) +++ head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Thu May 26 10:03:22 2016 (r300725) @@ -35,6 +35,8 @@ #include <sys/types.h> #include <machine/atomic.h> +#define ATOMIC_LONG_INIT(x) { .counter = (x) } + typedef struct { volatile long counter; } atomic_long_t; From owner-svn-src-head@freebsd.org Thu May 26 10:03:32 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 213A2B4A18B; Thu, 26 May 2016 10:03:32 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E528B1701; Thu, 26 May 2016 10:03:31 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QA3Vte077143; Thu, 26 May 2016 10:03:31 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QA3VYH077142; Thu, 26 May 2016 10:03:31 GMT (envelope-from br@FreeBSD.org) Message-Id: <201605261003.u4QA3VYH077142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin <br@FreeBSD.org> Date: Thu, 26 May 2016 10:03:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300726 - head/sys/riscv/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 10:03:32 -0000 Author: br Date: Thu May 26 10:03:30 2016 New Revision: 300726 URL: https://svnweb.freebsd.org/changeset/base/300726 Log: Increase the size and alignment of the setjmp buffer. This is required for future CPU extentions. Reviewed by: brooks Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Modified: head/sys/riscv/include/setjmp.h Modified: head/sys/riscv/include/setjmp.h ============================================================================== --- head/sys/riscv/include/setjmp.h Thu May 26 10:03:22 2016 (r300725) +++ head/sys/riscv/include/setjmp.h Thu May 26 10:03:30 2016 (r300726) @@ -39,7 +39,7 @@ #include <sys/cdefs.h> -#define _JBLEN 32 /* sp, ra, [f]s0-11, magic val, sigmask */ +#define _JBLEN 63 /* sp, ra, [f]s0-11, magic val, sigmask */ #define _JB_SIGMASK 21 #ifdef __ASSEMBLER__ @@ -54,10 +54,10 @@ * internally to avoid some run-time errors for mismatches. */ #if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE -typedef struct _sigjmp_buf { long _sjb[_JBLEN + 1]; } sigjmp_buf[1]; +typedef struct _sigjmp_buf { long _sjb[_JBLEN + 1] __aligned(16); } sigjmp_buf[1]; #endif -typedef struct _jmp_buf { long _jb[_JBLEN + 1]; } jmp_buf[1]; +typedef struct _jmp_buf { long _jb[_JBLEN + 1] __aligned(16); } jmp_buf[1]; #endif /* __ASSEMBLER__ */ #endif /* !_MACHINE_SETJMP_H_ */ From owner-svn-src-head@freebsd.org Thu May 26 10:30:04 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5408B4A8F6; Thu, 26 May 2016 10:30:04 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78CC612E9; Thu, 26 May 2016 10:30:04 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QAU3Qr084803; Thu, 26 May 2016 10:30:03 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QAU3KH084799; Thu, 26 May 2016 10:30:03 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201605261030.u4QAU3KH084799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala <trasz@FreeBSD.org> Date: Thu, 26 May 2016 10:30:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300727 - head/sys/dev/iser X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 10:30:04 -0000 Author: trasz Date: Thu May 26 10:30:03 2016 New Revision: 300727 URL: https://svnweb.freebsd.org/changeset/base/300727 Log: Make iser(4) buildable again by adjusting it for the recent changes in ICL interface. - the ordering of parameters to icl_conn_task_setup is different, so that the "cookie" is last. - the icl_conn_connected() method is gone, replaced by much simpler mechanism. I'd rather keep the ICL interface as small as possible. - I don't really like the s/offload/driver/g. The "tcp" is not a driver; "iser" is not really a driver either. I'd prefer to leave it as it is. - the check for ic_session_type_discovery() in iser_conn_handoff() is gone, as handoff cannot happen for discovery sessions. - ic_session_login_phase() and ic_session_type_discovery() are gone. If you had your handoff method called - you're no longer in either of those. - the way maxtags is passed is different; now it's simply ic->ic_maxtags. It's cleaner, and the old way would cause weird things to happen if fail_on_disconnection=1 and the user changed the maxtags sysctl before reconnecting (basically the CAM idea of maxtags would be different from iSER one). - icl_hba_misc() is gone; declare support for PIM_UNMAPPED by setting ic->ic_unmapped flag. - the way we find the "iser" ICL module is rewritten - we have a flag for icl_register() that says if the module is iSER-capable or not. - icl_conn_release() is gone; iser_conn_release() is called from iser_conn_free() (no functional change in this case) and at the beginning of icl_conn_connect(), to handle reconnection. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iser/icl_iser.c head/sys/dev/iser/icl_iser.h head/sys/dev/iser/iser_initiator.c Modified: head/sys/dev/iser/icl_iser.c ============================================================================== --- head/sys/dev/iser/icl_iser.c Thu May 26 10:03:30 2016 (r300726) +++ head/sys/dev/iser/icl_iser.c Thu May 26 10:30:03 2016 (r300727) @@ -37,6 +37,8 @@ static uma_zone_t icl_pdu_zone; static volatile u_int icl_iser_ncons; struct iser_global ig; +static void iser_conn_release(struct icl_conn *ic); + static icl_conn_new_pdu_t iser_conn_new_pdu; static icl_conn_pdu_free_t iser_conn_pdu_free; static icl_conn_pdu_data_segment_length_t iser_conn_pdu_data_segment_length; @@ -45,9 +47,7 @@ static icl_conn_pdu_queue_t iser_conn_pd static icl_conn_handoff_t iser_conn_handoff; static icl_conn_free_t iser_conn_free; static icl_conn_close_t iser_conn_close; -static icl_conn_release_t iser_conn_release; static icl_conn_connect_t iser_conn_connect; -static icl_conn_connected_t iser_conn_connected; static icl_conn_task_setup_t iser_conn_task_setup; static icl_conn_task_done_t iser_conn_task_done; static icl_conn_pdu_get_data_t iser_conn_pdu_get_data; @@ -61,9 +61,7 @@ static kobj_method_t icl_iser_methods[] KOBJMETHOD(icl_conn_handoff, iser_conn_handoff), KOBJMETHOD(icl_conn_free, iser_conn_free), KOBJMETHOD(icl_conn_close, iser_conn_close), - KOBJMETHOD(icl_conn_release, iser_conn_release), KOBJMETHOD(icl_conn_connect, iser_conn_connect), - KOBJMETHOD(icl_conn_connected, iser_conn_connected), KOBJMETHOD(icl_conn_task_setup, iser_conn_task_setup), KOBJMETHOD(icl_conn_task_done, iser_conn_task_done), KOBJMETHOD(icl_conn_pdu_get_data, iser_conn_pdu_get_data), @@ -263,8 +261,9 @@ iser_new_conn(const char *name, struct m ic = &iser_conn->icl_conn; ic->ic_lock = lock; ic->ic_name = name; - ic->ic_driver = strdup("iser", M_TEMP); + ic->ic_offload = strdup("iser", M_TEMP); ic->ic_iser = true; + ic->ic_unmapped = true; return (ic); } @@ -274,6 +273,7 @@ iser_conn_free(struct icl_conn *ic) { struct iser_conn *iser_conn = icl_to_iser_conn(ic); + iser_conn_release(ic); cv_destroy(&iser_conn->ib_conn.beacon.flush_cv); mtx_destroy(&iser_conn->ib_conn.beacon.flush_lock); sx_destroy(&iser_conn->state_mutex); @@ -283,7 +283,7 @@ iser_conn_free(struct icl_conn *ic) } int -iser_conn_handoff(struct icl_conn *ic, int cmds_max) +iser_conn_handoff(struct icl_conn *ic, int fd) { struct iser_conn *iser_conn = icl_to_iser_conn(ic); int error = 0; @@ -296,14 +296,7 @@ iser_conn_handoff(struct icl_conn *ic, i goto out; } - /* - * In discovery session no need to allocate rx desc and posting recv - * work request - */ - if (ic->ic_session_type_discovery(ic)) - goto out; - - error = iser_alloc_rx_descriptors(iser_conn, cmds_max); + error = iser_alloc_rx_descriptors(iser_conn, ic->ic_maxtags); if (error) goto out; @@ -311,6 +304,8 @@ iser_conn_handoff(struct icl_conn *ic, i if (error) goto post_error; + iser_conn->handoff_done = true; + sx_xunlock(&iser_conn->state_mutex); return (error); @@ -325,7 +320,7 @@ out: /** * Frees all conn objects */ -void +static void iser_conn_release(struct icl_conn *ic) { struct iser_conn *iser_conn = icl_to_iser_conn(ic); @@ -388,9 +383,12 @@ iser_conn_connect(struct icl_conn *ic, i struct ib_conn *ib_conn = &iser_conn->ib_conn; int err = 0; + iser_conn_release(ic); + sx_xlock(&iser_conn->state_mutex); /* the device is known only --after-- address resolution */ ib_conn->device = NULL; + iser_conn->handoff_done = false; iser_conn->state = ISER_CONN_PENDING; @@ -437,21 +435,10 @@ addr_failure: return (err); } -/** - * Called with session spinlock held. - * No need to lock state mutex on an advisory check. - **/ -bool -iser_conn_connected(struct icl_conn *ic) -{ - struct iser_conn *iser_conn = icl_to_iser_conn(ic); - - return (iser_conn->state == ISER_CONN_UP); -} - int -iser_conn_task_setup(struct icl_conn *ic, struct ccb_scsiio *csio, - uint32_t *task_tagp, void **prvp, struct icl_pdu *ip) +iser_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip, + struct ccb_scsiio *csio, + uint32_t *task_tagp, void **prvp) { struct icl_iser_pdu *iser_pdu = icl_to_iser_pdu(ip); @@ -492,12 +479,6 @@ iser_conn_task_done(struct icl_conn *ic, iser_pdu_free(ic, ip); } -static u_int32_t -iser_hba_misc() -{ - return (PIM_UNMAPPED); -} - static int iser_limits(size_t *limitp) { @@ -520,7 +501,7 @@ icl_iser_load(void) refcount_init(&icl_iser_ncons, 0); - error = icl_register("iser", 0, iser_limits, iser_new_conn, iser_hba_misc); + error = icl_register("iser", true, 0, iser_limits, iser_new_conn); KASSERT(error == 0, ("failed to register iser")); memset(&ig, 0, sizeof(struct iser_global)); @@ -547,7 +528,7 @@ icl_iser_unload(void) mtx_destroy(&ig.connlist_mutex); sx_destroy(&ig.device_list_mutex); - icl_unregister("iser"); + icl_unregister("iser", true); uma_zdestroy(icl_pdu_zone); @@ -575,8 +556,6 @@ moduledata_t icl_iser_data = { DECLARE_MODULE(icl_iser, icl_iser_data, SI_SUB_DRIVERS, SI_ORDER_MIDDLE); MODULE_DEPEND(icl_iser, icl, 1, 1, 1); -MODULE_DEPEND(icl_iser, iscsi, 1, 1, 1); MODULE_DEPEND(icl_iser, ibcore, 1, 1, 1); MODULE_DEPEND(icl_iser, linuxkpi, 1, 1, 1); MODULE_VERSION(icl_iser, 1); - Modified: head/sys/dev/iser/icl_iser.h ============================================================================== --- head/sys/dev/iser/icl_iser.h Thu May 26 10:03:30 2016 (r300726) +++ head/sys/dev/iser/icl_iser.h Thu May 26 10:30:03 2016 (r300727) @@ -148,6 +148,9 @@ #define ISER_ZBVA_NOT_SUPPORTED 0x80 #define ISER_SEND_W_INV_NOT_SUPPORTED 0x40 +#define ISCSI_DEF_MAX_RECV_SEG_LEN 8192 +#define ISCSI_OPCODE_MASK 0x3f + #define icl_to_iser_conn(ic) \ container_of(ic, struct iser_conn, icl_conn) #define icl_to_iser_pdu(ip) \ @@ -445,6 +448,7 @@ struct iser_conn { unsigned int rx_desc_head; struct iser_rx_desc *rx_descs; u32 num_rx_descs; + bool handoff_done; }; /** Modified: head/sys/dev/iser/iser_initiator.c ============================================================================== --- head/sys/dev/iser/iser_initiator.c Thu May 26 10:03:30 2016 (r300726) +++ head/sys/dev/iser/iser_initiator.c Thu May 26 10:30:03 2016 (r300727) @@ -415,7 +415,6 @@ iser_send_control(struct iser_conn *iser struct iser_tx_desc *mdesc; struct iser_device *device; size_t datalen = iser_pdu->icl_pdu.ip_data_len; - struct icl_conn *ic = &iser_conn->icl_conn; int err; mdesc = &iser_pdu->desc; @@ -442,8 +441,8 @@ iser_send_control(struct iser_conn *iser mdesc->num_sge = 2; } - /* For discovery session we re-use the login buffer */ - if (ic->ic_session_login_phase(ic) || ic->ic_session_type_discovery(ic)) { + /* For login phase and discovery session we re-use the login buffer */ + if (!iser_conn->handoff_done) { err = iser_post_recvl(iser_conn); if (err) goto send_control_error; From owner-svn-src-head@freebsd.org Thu May 26 10:50:40 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7A80B4AE2A; Thu, 26 May 2016 10:50:40 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A25F1E4E; Thu, 26 May 2016 10:50:40 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QAodTa092303; Thu, 26 May 2016 10:50:39 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QAodIb092300; Thu, 26 May 2016 10:50:39 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201605261050.u4QAodIb092300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill <jmcneill@FreeBSD.org> Date: Thu, 26 May 2016 10:50:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300728 - in head/sys: arm/allwinner dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 10:50:40 -0000 Author: jmcneill Date: Thu May 26 10:50:39 2016 New Revision: 300728 URL: https://svnweb.freebsd.org/changeset/base/300728 Log: Enable USB PHY regulators when requested by the host controller driver. Previously the USB PHY driver would enable all regulators at attach time. This prevented boards from booting when powered by the USB OTG port, as it didn't take VBUS presence into consideration. Modified: head/sys/arm/allwinner/a10_ehci.c head/sys/arm/allwinner/aw_usbphy.c head/sys/dev/usb/controller/generic_ohci.c Modified: head/sys/arm/allwinner/a10_ehci.c ============================================================================== --- head/sys/arm/allwinner/a10_ehci.c Thu May 26 10:30:03 2016 (r300727) +++ head/sys/arm/allwinner/a10_ehci.c Thu May 26 10:50:39 2016 (r300728) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include <arm/allwinner/allwinner_machdep.h> #include <dev/extres/clk/clk.h> #include <dev/extres/hwreset/hwreset.h> +#include <dev/extres/phy/phy.h> #define EHCI_HC_DEVSTR "Allwinner Integrated USB 2.0 controller" @@ -94,6 +95,7 @@ struct aw_ehci_softc { ehci_softc_t sc; clk_t clk; hwreset_t rst; + phy_t phy; }; struct aw_ehci_conf { @@ -225,6 +227,18 @@ a10_ehci_attach(device_t self) goto error; } + /* Enable USB PHY */ + err = phy_get_by_ofw_name(self, "usb", &aw_sc->phy); + if (err != 0) { + device_printf(self, "Could not get phy\n"); + goto error; + } + err = phy_enable(self, aw_sc->phy); + if (err != 0) { + device_printf(self, "Could not enable phy\n"); + goto error; + } + /* Enable passby */ reg_value = A10_READ_4(sc, SW_USB_PMU_IRQ_ENABLE); reg_value |= SW_AHB_INCR8; /* AHB INCR8 enable */ Modified: head/sys/arm/allwinner/aw_usbphy.c ============================================================================== --- head/sys/arm/allwinner/aw_usbphy.c Thu May 26 10:30:03 2016 (r300727) +++ head/sys/arm/allwinner/aw_usbphy.c Thu May 26 10:50:39 2016 (r300728) @@ -43,12 +43,16 @@ __FBSDID("$FreeBSD$"); #include <dev/ofw/ofw_bus.h> #include <dev/ofw/ofw_bus_subr.h> +#include <dev/gpio/gpiobusvar.h> #include <dev/extres/clk/clk.h> #include <dev/extres/hwreset/hwreset.h> #include <dev/extres/regulator/regulator.h> +#include <dev/extres/phy/phy.h> -#define USBPHY_NUMOFF 3 +#include "phy_if.h" + +#define USBPHY_NPHYS 4 static struct ofw_compat_data compat_data[] = { { "allwinner,sun4i-a10-usb-phy", 1 }, @@ -60,15 +64,28 @@ static struct ofw_compat_data compat_dat { NULL, 0 } }; +struct awusbphy_softc { + regulator_t reg[USBPHY_NPHYS]; + gpio_pin_t id_det_pin; + int id_det_valid; + gpio_pin_t vbus_det_pin; + int vbus_det_valid; +}; + static int awusbphy_init(device_t dev) { + struct awusbphy_softc *sc; + phandle_t node; char pname[20]; int error, off; regulator_t reg; hwreset_t rst; clk_t clk; + sc = device_get_softc(dev); + node = ofw_bus_get_node(dev); + /* Enable clocks */ for (off = 0; clk_get_by_ofw_index(dev, off, &clk) == 0; off++) { error = clk_enable(clk); @@ -89,17 +106,80 @@ awusbphy_init(device_t dev) } } - /* Enable regulator(s) */ - for (off = 0; off < USBPHY_NUMOFF; off++) { + /* Get regulators */ + for (off = 0; off < USBPHY_NPHYS; off++) { snprintf(pname, sizeof(pname), "usb%d_vbus-supply", off); - if (regulator_get_by_ofw_property(dev, pname, ®) != 0) - continue; - error = regulator_enable(reg); - if (error != 0) { - device_printf(dev, "couldn't enable regulator %s\n", - pname); + if (regulator_get_by_ofw_property(dev, pname, ®) == 0) + sc->reg[off] = reg; + } + + /* Get GPIOs */ + error = gpio_pin_get_by_ofw_property(dev, node, "usb0_id_det-gpios", + &sc->id_det_pin); + if (error == 0) + sc->id_det_valid = 1; + error = gpio_pin_get_by_ofw_property(dev, node, "usb0_vbus_det-gpios", + &sc->vbus_det_pin); + if (error == 0) + sc->vbus_det_valid = 1; + + return (0); +} + +static int +awusbphy_vbus_detect(device_t dev, int *val) +{ + struct awusbphy_softc *sc; + bool active; + int error; + + sc = device_get_softc(dev); + + if (sc->vbus_det_valid) { + error = gpio_pin_is_active(sc->vbus_det_pin, &active); + if (error != 0) return (error); - } + *val = active; + return (0); + } + + *val = 1; + return (0); +} + +static int +awusbphy_phy_enable(device_t dev, int phy, bool enable) +{ + struct awusbphy_softc *sc; + regulator_t reg; + int error, vbus_det; + + if (phy < 0 || phy >= USBPHY_NPHYS) + return (ERANGE); + + sc = device_get_softc(dev); + + /* Regulators are optional. If not found, return success. */ + reg = sc->reg[phy]; + if (reg == NULL) + return (0); + + if (enable) { + /* If an external vbus is detected, do not enable phy 0 */ + if (phy == 0) { + error = awusbphy_vbus_detect(dev, &vbus_det); + if (error == 0 && vbus_det == 1) + return (0); + } else + error = 0; + if (error == 0) + error = regulator_enable(reg); + } else + error = regulator_disable(reg); + if (error != 0) { + device_printf(dev, "couldn't %s regulator for phy %d\n", + enable ? "enable" : "disable", phy); + return (error); } return (0); @@ -124,9 +204,13 @@ awusbphy_attach(device_t dev) int error; error = awusbphy_init(dev); - if (error) + if (error) { device_printf(dev, "failed to initialize USB PHY, error %d\n", error); + return (error); + } + + phy_register_provider(dev); return (error); } @@ -136,16 +220,20 @@ static device_method_t awusbphy_methods[ DEVMETHOD(device_probe, awusbphy_probe), DEVMETHOD(device_attach, awusbphy_attach), + /* PHY interface */ + DEVMETHOD(phy_enable, awusbphy_phy_enable), + DEVMETHOD_END }; static driver_t awusbphy_driver = { "awusbphy", awusbphy_methods, - 0, + sizeof(struct awusbphy_softc) }; static devclass_t awusbphy_devclass; -DRIVER_MODULE(awusbphy, simplebus, awusbphy_driver, awusbphy_devclass, 0, 0); +EARLY_DRIVER_MODULE(awusbphy, simplebus, awusbphy_driver, awusbphy_devclass, + 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); MODULE_VERSION(awusbphy, 1); Modified: head/sys/dev/usb/controller/generic_ohci.c ============================================================================== --- head/sys/dev/usb/controller/generic_ohci.c Thu May 26 10:30:03 2016 (r300727) +++ head/sys/dev/usb/controller/generic_ohci.c Thu May 26 10:50:39 2016 (r300728) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #ifdef EXT_RESOURCES #include <dev/extres/clk/clk.h> #include <dev/extres/hwreset/hwreset.h> +#include <dev/extres/phy/phy.h> #endif #include "generic_usb_if.h" @@ -76,6 +77,7 @@ struct generic_ohci_softc { #ifdef EXT_RESOURCES hwreset_t rst; + phy_t phy; TAILQ_HEAD(, clk_list) clk_list; #endif }; @@ -180,6 +182,15 @@ generic_ohci_attach(device_t dev) goto error; } } + + /* Enable phy */ + if (phy_get_by_ofw_name(dev, "usb", &sc->phy) == 0) { + err = phy_enable(dev, sc->phy); + if (err != 0) { + device_printf(dev, "Could not enable phy\n"); + goto error; + } + } #endif if (GENERIC_USB_INIT(dev) != 0) { @@ -253,6 +264,14 @@ generic_ohci_detach(device_t dev) usb_bus_mem_free_all(&sc->ohci_sc.sc_bus, &ohci_iterate_hw_softc); #ifdef EXT_RESOURCES + /* Disable phy */ + if (sc->phy) { + err = phy_disable(dev, sc->phy); + if (err != 0) + device_printf(dev, "Could not disable phy\n"); + phy_release(sc->phy); + } + /* Disable clock */ TAILQ_FOREACH_SAFE(clk, &sc->clk_list, next, clk_tmp) { err = clk_disable(clk->clk); From owner-svn-src-head@freebsd.org Thu May 26 10:55:20 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F9B6B4AFD6; Thu, 26 May 2016 10:55:20 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E13D1234; Thu, 26 May 2016 10:55:20 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QAtJSR095689; Thu, 26 May 2016 10:55:19 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QAtJHU095688; Thu, 26 May 2016 10:55:19 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605261055.u4QAtJHU095688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk <avos@FreeBSD.org> Date: Thu, 26 May 2016 10:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300729 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 10:55:20 -0000 Author: avos Date: Thu May 26 10:55:19 2016 New Revision: 300729 URL: https://svnweb.freebsd.org/changeset/base/300729 Log: wpi: refresh manpage. Reflect all recent changes in the manpage: - add adhoc-demo and hostap into list of supported modes; add few examples for them; - mention encryption/decryption offload for CCMP cipher; - extend list of driver messages in the DIAGNOSTICS; - document hostap mode limitations / powersave instability in the CAVEATS section. Differential Revision: https://reviews.freebsd.org/D5149 Modified: head/share/man/man4/wpi.4 Modified: head/share/man/man4/wpi.4 ============================================================================== --- head/share/man/man4/wpi.4 Thu May 26 10:50:39 2016 (r300728) +++ head/share/man/man4/wpi.4 Thu May 26 10:55:19 2016 (r300729) @@ -1,6 +1,8 @@ .\" Copyright (c) 2004-2007 .\" Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. .\" Benjamin Close <Benjamin.Close@clearchain.com>. All rights reserved. +.\" Copyright (c) 2016 Andriy Voskoboinyk <avos@FreeBSD.org> +.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -26,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 15, 2015 +.Dd January 31, 2016 .Dt WPI 4 .Os .Sh NAME @@ -57,20 +59,39 @@ The driver provides support for the .Tn Intel 3945ABG Wireless network adapter. -.Nm -supports +The driver supports .Cm station , .Cm adhoc , +.Cm adhoc-demo , +.Cm hostap , and .Cm monitor mode operation. Only one virtual interface may be configured at any time. -For more information on configuring this device, see -.Xr ifconfig 8 . +.Pp +The +.Nm +driver can be configured to use +Wired Equivalent Privacy (WEP) or +Wi-Fi Protected Access (WPA-PSK and WPA2-PSK). +WPA is the de facto encryption standard for wireless networks. +It is strongly recommended that WEP +not be used as the sole mechanism +to secure wireless communication, +due to serious weaknesses in it. +The +.Nm +driver offloads both encryption and decryption of data frames to the +hardware for the CCMP cipher. .Pp This driver requires the firmware built with the .Nm wpifw module to work. +.Pp +The +.Nm +driver can be configured at runtime with +.Xr ifconfig 8 . .Sh FILES .Bl -tag -width ".Pa /usr/share/doc/legal/intel_wpi.LICENSE" -compact .It Pa /usr/share/doc/legal/intel_wpi.LICENSE @@ -95,10 +116,26 @@ ifconfig wlan0 create wlandev wpi0 ssid wepmode on wepkey 0x1234567890 weptxkey 1 up .Ed .Pp -Join a specific BSS network with 128-bit WEP encryption: +Create an IBSS network with 128-bit WEP encryption on the channel 4: .Bd -literal -offset indent ifconfig wlan0 create wlandev wpi0 wlanmode adhoc ssid my_net \e - wepmode on wepkey 0x01020304050607080910111213 weptxkey 1 + wepmode on wepkey 0x01020304050607080910111213 weptxkey 1 \e + channel 4 +.Ed +.Pp +Join/create an 802.11b IBSS network with network name +.Dq Li my_net : +.Bd -literal -offset indent +ifconfig wlan0 create wlandev wpi0 wlanmode adhoc +ifconfig wlan0 inet 192.168.0.22 netmask 0xffffff00 ssid my_net \e + mode 11b +.Ed +.Pp +Create an 802.11g host-based access point: +.Bd -literal -offset indent +ifconfig wlan0 create wlandev wpi0 wlanmode hostap +ifconfig wlan0 inet 192.168.0.10 netmask 0xffffff00 ssid my_ap \e + mode 11g .Ed .Sh DIAGNOSTICS .Bl -diag @@ -109,20 +146,53 @@ subsystem. Verify the .Xr wpifw firmware module is installed. +.It "wpi%d: %s: timeout waiting for adapter to initialize, error %d" +The onboard microcontroller failed to initialize in time. +This should not happen. +.It "wpi%d: %s: could not load boot firmware" +An attempt to upload the boot firmware image to the onboard microcontroller +failed. +This should not happen. +.It "wpi%d: device timeout" +A frame dispatched to the hardware for transmission did not complete in time. +The driver will reset the hardware and continue. +This should not happen. +.It "wpi%d: scan timeout" +Firmware scan command response was not received in time. +The driver will reset the hardware and continue. +This should not happen. .It "wpi%d: fatal firmware error" -An unknown error has occurred in the uploaded firmware, you may have to -unload/reload the driver to continue. -.It "wpi%d: Radio transmitter is switched off" +The onboard microcontroller crashed for some reason. +The driver will reset the hardware and continue. +This should not happen. +.It "wpi%d: RF switch: radio disabled" The hardware switch controlling the radio is currently turned off. Data transmission is not possible in this state. +.It "wpi%d: can't map mem space" +The driver was unable to map the device registers into the host address space. +This should not happen. +.It "wpi%d: can't map interrupt" +The driver was unable to allocate an IRQ for the device interrupt. +This should not happen. +.It "wpi%d: can't establish interrupt, error %d" +The driver was unable to install the device interrupt handler. +This should not happen. +.It "wpi%d: %s: bus_dmamap_load failed, error %d" +The driver was unable to map newly allocated mbuf to device +visible address space. +Contents of currently received frame will be lost. +This should not happen. .El .Sh SEE ALSO .Xr pci 4 , .Xr wlan 4 , +.Xr wlan_amrr 4 , .Xr wlan_ccmp 4 , .Xr wlan_tkip 4 , .Xr wlan_wep 4 , +.Xr wlan_xauth 4 , .Xr wpifw 4 , +.Xr hostapd 8 , .Xr ifconfig 8 , .Xr wpa_supplicant 8 .Sh AUTHORS @@ -138,7 +208,11 @@ ported .Nm to .Fx . -.Sh BUGS -Not all the error messages are documented here. -.Pp -Background scanning is not currently supported. +.Sh CAVEATS +Hostap mode is not directly supported by the device; +it is implemented through IBSS mode (as a result, DFS/passive +channels are not available in this mode). +.Pp +Powersave may be unstable on some networks (results in +occasional 'wpi%d: device timeout' messages); you can try +to disable it to improve device stability. From owner-svn-src-head@freebsd.org Thu May 26 11:10:33 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D6F1B4B50B; Thu, 26 May 2016 11:10:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FE771D97; Thu, 26 May 2016 11:10:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QBAW5x099645; Thu, 26 May 2016 11:10:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QBAW7W099643; Thu, 26 May 2016 11:10:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605261110.u4QBAW7W099643@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Thu, 26 May 2016 11:10:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300731 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 11:10:33 -0000 Author: hselasky Date: Thu May 26 11:10:31 2016 New Revision: 300731 URL: https://svnweb.freebsd.org/changeset/base/300731 Log: Use optimised complexity safe sorting routine instead of the kernel's "qsort()". The kernel's "qsort()" routine can in worst case spend O(N*N) amount of comparisons before the input array is sorted. It can also recurse a significant amount of times using up the kernel's interrupt thread stack. The custom sorting routine takes advantage of that the sorting key is only 64 bits. Based on set and cleared bits in the sorting key it partitions the array until it is sorted. This process has a recursion limit of 64 times, due to the number of set and cleared bits which can occur. Compiled with -O2 the sorting routine was measured to use 64-bytes of stack. Multiplying this by 64 gives a maximum stack consumption of 4096 bytes for AMD64. The same applies to the execution time, that the array to be sorted will not be traversed more than 64 times. When serving roughly 80Gb/s with 80K TCP connections, the old method consisting of "qsort()" and "tcp_lro_mbuf_compare_header()" used 1.4% CPU, while the new "tcp_lro_sort()" used 1.1% for LRO related sorting as measured by Intel Vtune. The testing was done using a sysctl to toggle between "qsort()" and "tcp_lro_sort()". Differential Revision: https://reviews.freebsd.org/D6472 Sponsored by: Mellanox Technologies Tested by: Netflix Reviewed by: gallatin, rrs, sephe, transport Modified: head/sys/netinet/tcp_lro.c head/sys/netinet/tcp_lro.h Modified: head/sys/netinet/tcp_lro.c ============================================================================== --- head/sys/netinet/tcp_lro.c Thu May 26 11:01:25 2016 (r300730) +++ head/sys/netinet/tcp_lro.c Thu May 26 11:10:31 2016 (r300731) @@ -111,9 +111,9 @@ tcp_lro_init_args(struct lro_ctrl *lc, s LIST_INIT(&lc->lro_active); /* compute size to allocate */ - size = (lro_mbufs * sizeof(struct mbuf *)) + + size = (lro_mbufs * sizeof(struct lro_mbuf_sort)) + (lro_entries * sizeof(*le)); - lc->lro_mbuf_data = (struct mbuf **) + lc->lro_mbuf_data = (struct lro_mbuf_sort *) malloc(size, M_LRO, M_NOWAIT | M_ZERO); /* check for out of memory */ @@ -149,7 +149,7 @@ tcp_lro_free(struct lro_ctrl *lc) /* free mbuf array, if any */ for (x = 0; x != lc->lro_mbuf_count; x++) - m_freem(lc->lro_mbuf_data[x]); + m_freem(lc->lro_mbuf_data[x].mb); lc->lro_mbuf_count = 0; /* free allocated memory, if any */ @@ -365,32 +365,102 @@ tcp_lro_flush(struct lro_ctrl *lc, struc LIST_INSERT_HEAD(&lc->lro_free, le, next); } -static int -tcp_lro_mbuf_compare_header(const void *ppa, const void *ppb) +#ifdef HAVE_INLINE_FLSLL +#define tcp_lro_msb_64(x) (1ULL << (flsll(x) - 1)) +#else +static inline uint64_t +tcp_lro_msb_64(uint64_t x) { - const struct mbuf *ma = *((const struct mbuf * const *)ppa); - const struct mbuf *mb = *((const struct mbuf * const *)ppb); - int ret; + x |= (x >> 1); + x |= (x >> 2); + x |= (x >> 4); + x |= (x >> 8); + x |= (x >> 16); + x |= (x >> 32); + return (x & ~(x >> 1)); +} +#endif - ret = M_HASHTYPE_GET(ma) - M_HASHTYPE_GET(mb); - if (ret != 0) - goto done; +/* + * The tcp_lro_sort() routine is comparable to qsort(), except it has + * a worst case complexity limit of O(MIN(N,64)*N), where N is the + * number of elements to sort and 64 is the number of sequence bits + * available. The algorithm is bit-slicing the 64-bit sequence number, + * sorting one bit at a time from the most significant bit until the + * least significant one, skipping the constant bits. + */ +static void +tcp_lro_sort(struct lro_mbuf_sort *parray, uint32_t size) +{ + struct lro_mbuf_sort temp; + uint64_t ones; + uint64_t zeros; + uint32_t x; + uint32_t y; + +repeat: + /* for small arrays bubble sort is faster */ + if (size <= 12) { + for (x = 0; x != size; x++) { + for (y = x + 1; y != size; y++) { + if (parray[x].seq > parray[y].seq) { + /* swap entries */ + temp = parray[x]; + parray[x] = parray[y]; + parray[y] = temp; + } + } + } + return; + } - if (ma->m_pkthdr.flowid > mb->m_pkthdr.flowid) - return (1); - else if (ma->m_pkthdr.flowid < mb->m_pkthdr.flowid) - return (-1); + /* compute sequence bits which are constant */ + ones = 0; + zeros = 0; + for (x = 0; x != size; x++) { + ones |= parray[x].seq; + zeros |= ~parray[x].seq; + } - ret = TCP_LRO_SEQUENCE(ma) - TCP_LRO_SEQUENCE(mb); -done: - return (ret); + /* compute bits which are not constant into "ones" */ + ones &= zeros; + if (ones == 0) + return; + + /* pick the most significant bit which is not constant */ + ones = tcp_lro_msb_64(ones); + + /* + * Move entries having cleared sequence bits to the beginning + * of the array: + */ + for (x = y = 0; y != size; y++) { + /* skip set bits */ + if (parray[y].seq & ones) + continue; + /* swap entries */ + temp = parray[x]; + parray[x] = parray[y]; + parray[y] = temp; + x++; + } + + KASSERT(x != 0 && x != size, ("Memory is corrupted\n")); + + /* sort zeros */ + tcp_lro_sort(parray, x); + + /* sort ones */ + parray += x; + size -= x; + goto repeat; } void tcp_lro_flush_all(struct lro_ctrl *lc) { - uint32_t hashtype; - uint32_t flowid; + uint64_t seq; + uint64_t nseq; unsigned x; /* check if no mbufs to flush */ @@ -398,30 +468,27 @@ tcp_lro_flush_all(struct lro_ctrl *lc) goto done; /* sort all mbufs according to stream */ - qsort(lc->lro_mbuf_data, lc->lro_mbuf_count, sizeof(struct mbuf *), - &tcp_lro_mbuf_compare_header); + tcp_lro_sort(lc->lro_mbuf_data, lc->lro_mbuf_count); /* input data into LRO engine, stream by stream */ - flowid = 0; - hashtype = M_HASHTYPE_NONE; + seq = 0; for (x = 0; x != lc->lro_mbuf_count; x++) { struct mbuf *mb; - mb = lc->lro_mbuf_data[x]; + /* get mbuf */ + mb = lc->lro_mbuf_data[x].mb; + + /* get sequence number, masking away the packet index */ + nseq = lc->lro_mbuf_data[x].seq & (-1ULL << 24); /* check for new stream */ - if (mb->m_pkthdr.flowid != flowid || - M_HASHTYPE_GET(mb) != hashtype) { - flowid = mb->m_pkthdr.flowid; - hashtype = M_HASHTYPE_GET(mb); + if (seq != nseq) { + seq = nseq; /* flush active streams */ tcp_lro_rx_done(lc); } -#ifdef TCP_LRO_RESET_SEQUENCE - /* reset sequence number */ - TCP_LRO_SEQUENCE(mb) = 0; -#endif + /* add packet to LRO engine */ if (tcp_lro_rx(lc, mb, 0) != 0) { /* input packet to network layer */ @@ -799,11 +866,14 @@ tcp_lro_queue_mbuf(struct lro_ctrl *lc, if (__predict_false(lc->lro_mbuf_count == lc->lro_mbuf_max)) tcp_lro_flush_all(lc); - /* store sequence number */ - TCP_LRO_SEQUENCE(mb) = lc->lro_mbuf_count; + /* create sequence number */ + lc->lro_mbuf_data[lc->lro_mbuf_count].seq = + (((uint64_t)M_HASHTYPE_GET(mb)) << 56) | + (((uint64_t)mb->m_pkthdr.flowid) << 24) | + ((uint64_t)lc->lro_mbuf_count); /* enter mbuf */ - lc->lro_mbuf_data[lc->lro_mbuf_count++] = mb; + lc->lro_mbuf_data[lc->lro_mbuf_count++].mb = mb; } /* end */ Modified: head/sys/netinet/tcp_lro.h ============================================================================== --- head/sys/netinet/tcp_lro.h Thu May 26 11:01:25 2016 (r300730) +++ head/sys/netinet/tcp_lro.h Thu May 26 11:10:31 2016 (r300731) @@ -38,9 +38,6 @@ #define TCP_LRO_ENTRIES 8 #endif -#define TCP_LRO_SEQUENCE(mb) \ - (mb)->m_pkthdr.PH_loc.thirtytwo[0] - struct lro_entry { LIST_ENTRY(lro_entry) next; struct mbuf *m_head; @@ -80,10 +77,15 @@ LIST_HEAD(lro_head, lro_entry); #define source_ip6 lesource.s_ip6 #define dest_ip6 ledest.d_ip6 +struct lro_mbuf_sort { + uint64_t seq; + struct mbuf *mb; +}; + /* NB: This is part of driver structs. */ struct lro_ctrl { struct ifnet *ifp; - struct mbuf **lro_mbuf_data; + struct lro_mbuf_sort *lro_mbuf_data; uint64_t lro_queued; uint64_t lro_flushed; uint64_t lro_bad_csum; From owner-svn-src-head@freebsd.org Thu May 26 11:12:37 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74120B4B796; Thu, 26 May 2016 11:12:37 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 371AA12D7; Thu, 26 May 2016 11:12:37 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QBCa8M003380; Thu, 26 May 2016 11:12:36 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QBCark003377; Thu, 26 May 2016 11:12:36 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605261112.u4QBCark003377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk <avos@FreeBSD.org> Date: Thu, 26 May 2016 11:12:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300732 - head/sys/dev/iwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 11:12:37 -0000 Author: avos Date: Thu May 26 11:12:36 2016 New Revision: 300732 URL: https://svnweb.freebsd.org/changeset/base/300732 Log: iwn: add watchdog for scanning. Restart device if scanning was not done in time. Tested by: david@catwhisker.org PR: 209198 Differential Revision: https://reviews.freebsd.org/D6176 Modified: head/sys/dev/iwn/if_iwn.c head/sys/dev/iwn/if_iwnvar.h Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Thu May 26 11:10:31 2016 (r300731) +++ head/sys/dev/iwn/if_iwn.c Thu May 26 11:12:36 2016 (r300732) @@ -235,6 +235,7 @@ static void iwn_xmit_task(void *arg0, in static int iwn_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); static int iwn_transmit(struct ieee80211com *, struct mbuf *); +static void iwn_scan_timeout(void *); static void iwn_watchdog(void *); static int iwn_ioctl(struct ieee80211com *, u_long , void *); static void iwn_parent(struct ieee80211com *); @@ -675,6 +676,7 @@ iwn_attach(device_t dev) iwn_radiotap_attach(sc); callout_init_mtx(&sc->calib_to, &sc->sc_mtx, 0); + callout_init_mtx(&sc->scan_timeout, &sc->sc_mtx, 0); callout_init_mtx(&sc->watchdog_to, &sc->sc_mtx, 0); TASK_INIT(&sc->sc_radioon_task, 0, iwn_radio_on, sc); TASK_INIT(&sc->sc_radiooff_task, 0, iwn_radio_off, sc); @@ -1406,6 +1408,7 @@ iwn_detach(device_t dev) taskqueue_free(sc->sc_tq); callout_drain(&sc->watchdog_to); + callout_drain(&sc->scan_timeout); callout_drain(&sc->calib_to); ieee80211_ifdetach(&sc->sc_ic); } @@ -3937,6 +3940,7 @@ iwn_notif_intr(struct iwn_softc *sc) scan->nchan, scan->status, scan->chan); #endif sc->sc_is_scanning = 0; + callout_stop(&sc->scan_timeout); IWN_UNLOCK(sc); ieee80211_scan_next(vap); IWN_LOCK(sc); @@ -4955,6 +4959,16 @@ iwn_transmit(struct ieee80211com *ic, st } static void +iwn_scan_timeout(void *arg) +{ + struct iwn_softc *sc = arg; + struct ieee80211com *ic = &sc->sc_ic; + + ic_printf(ic, "scan timeout\n"); + ieee80211_restart_all(ic); +} + +static void iwn_watchdog(void *arg) { struct iwn_softc *sc = arg; @@ -6972,6 +6986,8 @@ iwn_scan(struct iwn_softc *sc, struct ie hdr->nchan); error = iwn_cmd(sc, IWN_CMD_SCAN, buf, buflen, 1); free(buf, M_DEVBUF); + if (error == 0) + callout_reset(&sc->scan_timeout, 5*hz, iwn_scan_timeout, sc); DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__); Modified: head/sys/dev/iwn/if_iwnvar.h ============================================================================== --- head/sys/dev/iwn/if_iwnvar.h Thu May 26 11:10:31 2016 (r300731) +++ head/sys/dev/iwn/if_iwnvar.h Thu May 26 11:12:36 2016 (r300732) @@ -317,6 +317,7 @@ struct iwn_softc { int calib_cnt; struct iwn_calib_state calib; int last_calib_ticks; + struct callout scan_timeout; struct callout watchdog_to; struct iwn_fw_info fw; struct iwn_calib_info calibcmd[IWN5000_PHY_CALIB_MAX_RESULT]; @@ -378,7 +379,6 @@ struct iwn_softc { uint8_t chainmask; int sc_tx_timer; - int sc_scan_timer; /* Are we doing a scan? */ int sc_is_scanning; From owner-svn-src-head@freebsd.org Thu May 26 11:38:27 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABEA1B4BF62; Thu, 26 May 2016 11:38:27 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 644B010E4; Thu, 26 May 2016 11:38:27 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QBcQ6F010670; Thu, 26 May 2016 11:38:26 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QBcQtw010668; Thu, 26 May 2016 11:38:26 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201605261138.u4QBcQtw010668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen <tuexen@FreeBSD.org> Date: Thu, 26 May 2016 11:38:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300733 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 11:38:27 -0000 Author: tuexen Date: Thu May 26 11:38:26 2016 New Revision: 300733 URL: https://svnweb.freebsd.org/changeset/base/300733 Log: Make struct sctp_paddrthlds compliant to RFC 7829. Modified: head/sys/netinet/sctp_uio.h head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_uio.h ============================================================================== --- head/sys/netinet/sctp_uio.h Thu May 26 11:12:36 2016 (r300732) +++ head/sys/netinet/sctp_uio.h Thu May 26 11:38:26 2016 (r300733) @@ -590,6 +590,7 @@ struct sctp_paddrthlds { sctp_assoc_t spt_assoc_id; uint16_t spt_pathmaxrxt; uint16_t spt_pathpfthld; + uint16_t spt_pathcpthld; }; struct sctp_paddrinfo { Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Thu May 26 11:12:36 2016 (r300732) +++ head/sys/netinet/sctp_usrreq.c Thu May 26 11:38:26 2016 (r300733) @@ -3304,9 +3304,11 @@ flags_out: if (net != NULL) { thlds->spt_pathmaxrxt = net->failure_threshold; thlds->spt_pathpfthld = net->pf_threshold; + thlds->spt_pathcpthld = 0xffff; } else { thlds->spt_pathmaxrxt = stcb->asoc.def_net_failure; thlds->spt_pathpfthld = stcb->asoc.def_net_pf_threshold; + thlds->spt_pathcpthld = 0xffff; } thlds->spt_assoc_id = sctp_get_associd(stcb); SCTP_TCB_UNLOCK(stcb); @@ -3318,6 +3320,7 @@ flags_out: SCTP_INP_RLOCK(inp); thlds->spt_pathmaxrxt = inp->sctp_ep.def_net_failure; thlds->spt_pathpfthld = inp->sctp_ep.def_net_pf_threshold; + thlds->spt_pathcpthld = 0xffff; SCTP_INP_RUNLOCK(inp); } else { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); @@ -6345,6 +6348,11 @@ sctp_setopt(struct socket *so, int optna break; } } + if (thlds->spt_pathcpthld != 0xffff) { + error = EINVAL; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error); + break; + } if (stcb != NULL) { if (net != NULL) { net->failure_threshold = thlds->spt_pathmaxrxt; From owner-svn-src-head@freebsd.org Thu May 26 11:40:08 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A19C9B4A062; Thu, 26 May 2016 11:40:08 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6EF7413B9; Thu, 26 May 2016 11:40:08 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QBe7Ae010791; Thu, 26 May 2016 11:40:07 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QBe7pj010790; Thu, 26 May 2016 11:40:07 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201605261140.u4QBe7pj010790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala <trasz@FreeBSD.org> Date: Thu, 26 May 2016 11:40:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300734 - head/sys/dev/iser X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 11:40:08 -0000 Author: trasz Date: Thu May 26 11:40:07 2016 New Revision: 300734 URL: https://svnweb.freebsd.org/changeset/base/300734 Log: Fix crash on removal of an unconnected iSER session. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iser/icl_iser.c Modified: head/sys/dev/iser/icl_iser.c ============================================================================== --- head/sys/dev/iser/icl_iser.c Thu May 26 11:38:26 2016 (r300733) +++ head/sys/dev/iser/icl_iser.c Thu May 26 11:40:07 2016 (r300734) @@ -220,6 +220,9 @@ iser_conn_pdu_queue(struct icl_conn *ic, struct icl_iser_pdu *iser_pdu = icl_to_iser_pdu(ip); int ret; + if (iser_conn->state != ISER_CONN_UP) + return; + ret = iser_initialize_headers(iser_pdu, iser_conn); if (ret) { ISER_ERR("Failed to map TX descriptor pdu %p", iser_pdu); From owner-svn-src-head@freebsd.org Thu May 26 11:58:37 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8B20B4A698; Thu, 26 May 2016 11:58:37 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95FCA1F52; Thu, 26 May 2016 11:58:37 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QBwaB2017853; Thu, 26 May 2016 11:58:36 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QBwaVF017852; Thu, 26 May 2016 11:58:36 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605261158.u4QBwaVF017852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk <avos@FreeBSD.org> Date: Thu, 26 May 2016 11:58:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300735 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 11:58:37 -0000 Author: avos Date: Thu May 26 11:58:36 2016 New Revision: 300735 URL: https://svnweb.freebsd.org/changeset/base/300735 Log: bsdinstall: unbreak static address assignment for wired networks. This fixes regression introduced in r298946 (fixes static address assignment for wireless networks). Reported & submitted by: allanjude Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Thu May 26 11:40:07 2016 (r300734) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Thu May 26 11:58:36 2016 (r300735) @@ -84,7 +84,11 @@ retval=$? if [ "$BSDINSTALL_CONFIGCURRENT" ]; then . $BSDINSTALL_TMPETC/._rc.conf.net - ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE | sed "s|$2||"` + if [ -n "$2" ]; then + ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE | sed "s|$2||"` + else + ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE` + fi if [ "$defaultrouter" ]; then route delete -inet default route add -inet default $defaultrouter From owner-svn-src-head@freebsd.org Thu May 26 12:11:00 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF8D4B49373 for <svn-src-head@mailman.ysv.freebsd.org>; Thu, 26 May 2016 12:11:00 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yw0-x229.google.com (mail-yw0-x229.google.com [IPv6:2607:f8b0:4002:c05::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 91FCB1BD2 for <svn-src-head@freebsd.org>; Thu, 26 May 2016 12:11:00 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yw0-x229.google.com with SMTP id o16so74342031ywd.2 for <svn-src-head@freebsd.org>; Thu, 26 May 2016 05:11:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=7PkxIwmWiUnfejhiREJ3Jy0X5M3vvSCer2uZf8UBZOk=; b=s807XaauJ2lFIWS4lsO4OfXt/hS8H078+EDT8uQnC4blnxdlWTf+gcDs6KrbQAKL31 sH4HkUEnxW0Ud0+HalCYPHJZYdfDE4LQ3jVEfH8Va5U78OwLXGmTGNhyCYXN4HoSV862 y4pHv9BwXqaNQjm/9H4hWQ+M97Wy4PXHmfd+tffxKg+HBGL0//HRIS7oniy9NTA/EMDU bIQlNCwqLdjjfepnEvGWjbYi+t5YTQ35N1kpnbTKWvkENgQHjTsUKaCKE5ixqbvpMAZG o3UZ7RXRrLzDoeCAkxcShi3BIXXyiUv5EjDyGdlxtgF6h4gn5meZIgvyGoTWrcn9akiD 0qsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=7PkxIwmWiUnfejhiREJ3Jy0X5M3vvSCer2uZf8UBZOk=; b=SVnuE3bYO/tzKFRRUE2lOsxDb+RTXrJMfZP/Lu5pKR+7zhXfrdsXlxdVT6xA5i4dPf 81SYG7uYy3chFscsTP1+HhL/TTB2CCa44Gw1ZrCT0in+QdJhpR/NNyOKWLlnA7Z9ngEB ieJfRCq6c12fyWWIui8w4wHOhG02xEa6G7xmvmTeIoWoVXbuqMBefZXdrJdUtHpZGqbY V14pzXN5PSdvNLO0AXXo/QCk5MP0F1WYAhswHbvfRtQkX2NLacV63OSIQUDanq+GOSSk 8w5AF2kMXNcVpUj2/wqmQOgDM0a/YdK36T499jLLY7wBMiGfXKaZF4tPSjVVpwPzEQOK KMaQ== X-Gm-Message-State: ALyK8tJVuieeC1YUjPHrs8LrOgBMUiu/7SY4MWp4bJWfvSpMQ/pbJOgIutuFTCnBT3FpUqZk94QPQtbAmU/hdw== MIME-Version: 1.0 X-Received: by 10.37.13.68 with SMTP id 65mr5085120ybn.163.1464264659540; Thu, 26 May 2016 05:10:59 -0700 (PDT) Received: by 10.13.201.199 with HTTP; Thu, 26 May 2016 05:10:59 -0700 (PDT) In-Reply-To: <201605261110.u4QBAW7W099643@repo.freebsd.org> References: <201605261110.u4QBAW7W099643@repo.freebsd.org> Date: Thu, 26 May 2016 14:10:59 +0200 Message-ID: <CABh_MK=RKCwUpwuXd5YX0o9OgLUXn3wfVFEhd1f3HQbZyDavew@mail.gmail.com> Subject: Re: svn commit: r300731 - head/sys/netinet From: Ed Schouten <ed@nuxi.nl> To: Hans Petter Selasky <hselasky@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 12:11:00 -0000 Hi Hans, 2016-05-26 13:10 GMT+02:00 Hans Petter Selasky <hselasky@freebsd.org>: > Use optimised complexity safe sorting routine instead of the kernel's > "qsort()". Cool! Thanks for working on this! > The custom sorting routine takes advantage of that the sorting key is > only 64 bits. Based on set and cleared bits in the sorting key it > partitions the array until it is sorted. A sorting algorithm that uses such an approach is typically called Radix Sort: https://en.wikipedia.org/wiki/Radix_sort Would it make sense to mention this in the comments, instead of referring to it as a "bit-slice sorter algorithm"? -- Ed Schouten <ed@nuxi.nl> Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-head@freebsd.org Thu May 26 12:15:19 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91A9EB494A4; Thu, 26 May 2016 12:15:19 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C7001065; Thu, 26 May 2016 12:15:19 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id CD0261FE024; Thu, 26 May 2016 14:15:16 +0200 (CEST) Subject: Re: svn commit: r300731 - head/sys/netinet To: Ed Schouten <ed@nuxi.nl> References: <201605261110.u4QBAW7W099643@repo.freebsd.org> <CABh_MK=RKCwUpwuXd5YX0o9OgLUXn3wfVFEhd1f3HQbZyDavew@mail.gmail.com> Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Hans Petter Selasky <hps@selasky.org> Message-ID: <a4858a93-cfa6-421c-cd3b-3ff9b3feb95f@selasky.org> Date: Thu, 26 May 2016 14:18:36 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <CABh_MK=RKCwUpwuXd5YX0o9OgLUXn3wfVFEhd1f3HQbZyDavew@mail.gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 12:15:19 -0000 On 05/26/16 14:10, Ed Schouten wrote: > Hi Hans, > > 2016-05-26 13:10 GMT+02:00 Hans Petter Selasky <hselasky@freebsd.org>: >> Use optimised complexity safe sorting routine instead of the kernel's >> "qsort()". > > Cool! Thanks for working on this! > >> The custom sorting routine takes advantage of that the sorting key is >> only 64 bits. Based on set and cleared bits in the sorting key it >> partitions the array until it is sorted. > > A sorting algorithm that uses such an approach is typically called Radix Sort: > > https://en.wikipedia.org/wiki/Radix_sort > > Would it make sense to mention this in the comments, instead of > referring to it as a "bit-slice sorter algorithm"? Sure. Can you send me a patch? --HPS From owner-svn-src-head@freebsd.org Thu May 26 12:43:17 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46DC5B49E19; Thu, 26 May 2016 12:43:17 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A5C51067; Thu, 26 May 2016 12:43:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QChGoJ036216; Thu, 26 May 2016 12:43:16 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QChGLv036215; Thu, 26 May 2016 12:43:16 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201605261243.u4QChGLv036215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala <trasz@FreeBSD.org> Date: Thu, 26 May 2016 12:43:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300737 - head/sys/dev/iscsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 12:43:17 -0000 Author: trasz Date: Thu May 26 12:43:15 2016 New Revision: 300737 URL: https://svnweb.freebsd.org/changeset/base/300737 Log: Add a special case for iSER data tranfers. Obtained from: Mellanox Technologies MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iscsi/iscsi.c Modified: head/sys/dev/iscsi/iscsi.c ============================================================================== --- head/sys/dev/iscsi/iscsi.c Thu May 26 12:00:14 2016 (r300736) +++ head/sys/dev/iscsi/iscsi.c Thu May 26 12:43:15 2016 (r300737) @@ -866,6 +866,7 @@ iscsi_pdu_handle_scsi_response(struct ic struct ccb_scsiio *csio; size_t data_segment_len, received; uint16_t sense_len; + uint32_t resid; is = PDU_SESSION(response); @@ -880,6 +881,22 @@ iscsi_pdu_handle_scsi_response(struct ic } ccb = io->io_ccb; + + /* + * With iSER, after getting good response we can be sure + * that all the data has been successfully transferred. + */ + if (is->is_conn->ic_iser) { + resid = ntohl(bhssr->bhssr_residual_count); + if (bhssr->bhssr_flags & BHSSR_FLAGS_RESIDUAL_UNDERFLOW) { + io->io_received = ccb->csio.dxfer_len - resid; + } else if (bhssr->bhssr_flags & BHSSR_FLAGS_RESIDUAL_OVERFLOW) { + ISCSI_SESSION_WARN(is, "overflow: target indicates %d", resid); + } else { + io->io_received = ccb->csio.dxfer_len; + } + } + received = io->io_received; iscsi_outstanding_remove(is, io); ISCSI_SESSION_UNLOCK(is); From owner-svn-src-head@freebsd.org Thu May 26 13:14:09 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA518B4B5D0; Thu, 26 May 2016 13:14:09 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9133110F6; Thu, 26 May 2016 13:14:09 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QDE8nZ047159; Thu, 26 May 2016 13:14:08 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QDE8VT047157; Thu, 26 May 2016 13:14:08 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605261314.u4QDE8VT047157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk <avos@FreeBSD.org> Date: Thu, 26 May 2016 13:14:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300738 - in head: sbin/ifconfig sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 13:14:09 -0000 Author: avos Date: Thu May 26 13:14:08 2016 New Revision: 300738 URL: https://svnweb.freebsd.org/changeset/base/300738 Log: ifconfig: set by default FCC regulatory domain for wireless interfaces. Change default regulatory domain from DEBUG (no limitations; exposes all device channels) to FCC; as a result, newly created wireless interface with default settings will have less chances to violate country-specific regulations. This change will not affect drivers with pre-initialized regdomain structure (currentry ath(4) and mwl(4)); in that case, the default channel list must correspond to the default regdomain / country setting. You can switch to another regdomain / country via corresponding ifconfig(8) options; the driver must implement ic_getradiocaps() method to restore full channel list. Full country / regdomain list may be obtained via 'ifconfig <iface> list countries' command. Example: change country to Germany: ifconfig wlan0 down # all wlans on the device must be down ifconfig wlan0 country DE ifconfig wlan0 up # wpa_supplicant(8), dhclient(8) etc At the creation time: ifconfig wlan0 create wlandev wpi0 country DE To make changes permanent add the following line to the rc.conf(5): create_args_wlan0="country DE" Tested with - Intel 3945BG (wpi(4)). - WUSB54GC (rum(4)). Reviewed by: adrian Relnotes: yes Differential Revision: https://reviews.freebsd.org/D6228 Modified: head/sbin/ifconfig/ifieee80211.c head/sys/net80211/ieee80211_regdomain.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Thu May 26 12:43:15 2016 (r300737) +++ head/sbin/ifconfig/ifieee80211.c Thu May 26 13:14:08 2016 (r300738) @@ -5141,6 +5141,44 @@ print_string(const u_int8_t *buf, int le } } +static void +setdefregdomain(int s) +{ + struct regdata *rdp = getregdata(); + const struct regdomain *rd; + + /* Check if regdomain/country was already set by a previous call. */ + /* XXX is it possible? */ + if (regdomain.regdomain != 0 || + regdomain.country != CTRY_DEFAULT) + return; + + getregdomain(s); + + /* Check if it was already set by the driver. */ + if (regdomain.regdomain != 0 || + regdomain.country != CTRY_DEFAULT) + return; + + /* Set FCC/US as default. */ + rd = lib80211_regdomain_findbysku(rdp, SKU_FCC); + if (rd == NULL) + errx(1, "FCC regdomain was not found"); + + regdomain.regdomain = rd->sku; + if (rd->cc != NULL) + defaultcountry(rd); + + /* Send changes to net80211. */ + setregdomain_cb(s, ®domain); + + /* Cleanup (so it can be overriden by subsequent parameters). */ + regdomain.regdomain = 0; + regdomain.country = CTRY_DEFAULT; + regdomain.isocc[0] = 0; + regdomain.isocc[1] = 0; +} + /* * Virtual AP cloning support. */ @@ -5162,6 +5200,8 @@ wlan_create(int s, struct ifreq *ifr) ifr->ifr_data = (caddr_t) ¶ms; if (ioctl(s, SIOCIFCREATE2, ifr) < 0) err(1, "SIOCIFCREATE2"); + + setdefregdomain(s); } static Modified: head/sys/net80211/ieee80211_regdomain.c ============================================================================== --- head/sys/net80211/ieee80211_regdomain.c Thu May 26 12:43:15 2016 (r300737) +++ head/sys/net80211/ieee80211_regdomain.c Thu May 26 13:14:08 2016 (r300738) @@ -69,10 +69,7 @@ ieee80211_regdomain_attach(struct ieee80 { if (ic->ic_regdomain.regdomain == 0 && ic->ic_regdomain.country == CTRY_DEFAULT) { - ic->ic_regdomain.country = CTRY_UNITED_STATES; /* XXX */ ic->ic_regdomain.location = ' '; /* both */ - ic->ic_regdomain.isocc[0] = 'U'; /* XXX */ - ic->ic_regdomain.isocc[1] = 'S'; /* XXX */ /* NB: driver calls ieee80211_init_channels or similar */ } ic->ic_getradiocaps = null_getradiocaps; From owner-svn-src-head@freebsd.org Thu May 26 13:19:46 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C46AB4B8AC; Thu, 26 May 2016 13:19:46 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 097891B29; Thu, 26 May 2016 13:19:45 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QDJjfw047786; Thu, 26 May 2016 13:19:45 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QDJjpv047785; Thu, 26 May 2016 13:19:45 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201605261319.u4QDJjpv047785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko <arybchik@FreeBSD.org> Date: Thu, 26 May 2016 13:19:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300739 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 13:19:46 -0000 Author: arybchik Date: Thu May 26 13:19:44 2016 New Revision: 300739 URL: https://svnweb.freebsd.org/changeset/base/300739 Log: sfxge(4): correct parenthesis location in if coundition Found by lint on illumos. Submitted by: Garrett D'Amore <garrett at damore.org> Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Modified: head/sys/dev/sfxge/common/ef10_filter.c Modified: head/sys/dev/sfxge/common/ef10_filter.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_filter.c Thu May 26 13:14:08 2016 (r300738) +++ head/sys/dev/sfxge/common/ef10_filter.c Thu May 26 13:19:44 2016 (r300739) @@ -970,7 +970,7 @@ ef10_filter_supported_filters( { efx_rc_t rc; - if ((rc = efx_mcdi_get_parser_disp_info(enp, list, length) != 0)) + if ((rc = efx_mcdi_get_parser_disp_info(enp, list, length)) != 0) goto fail1; return (0); From owner-svn-src-head@freebsd.org Thu May 26 13:49:42 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16B28B4B29B; Thu, 26 May 2016 13:49:42 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6FAF1FD0; Thu, 26 May 2016 13:49:41 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QDneiH059005; Thu, 26 May 2016 13:49:40 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QDneJN059004; Thu, 26 May 2016 13:49:40 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201605261349.u4QDneJN059004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten <ed@FreeBSD.org> Date: Thu, 26 May 2016 13:49:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300741 - head/usr.bin/ar X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 13:49:42 -0000 Author: ed Date: Thu May 26 13:49:40 2016 New Revision: 300741 URL: https://svnweb.freebsd.org/changeset/base/300741 Log: Make code compile when basename() is POSIX compliant. In addition to the previous change I made to ar.c, pull in another basename() related fix. This change is similar to the one made to the ELF Toolchain version of ar, with the difference that the ELF Toolchain version lacks error handling for the strdup() call. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D6467 Modified: head/usr.bin/ar/write.c Modified: head/usr.bin/ar/write.c ============================================================================== --- head/usr.bin/ar/write.c Thu May 26 13:34:08 2016 (r300740) +++ head/usr.bin/ar/write.c Thu May 26 13:49:40 2016 (r300741) @@ -124,6 +124,7 @@ create_obj_from_file(struct bsdar *bsdar struct ar_obj *obj; struct stat sb; const char *bname; + char *tmpname; if (name == NULL) return (NULL); @@ -137,7 +138,10 @@ create_obj_from_file(struct bsdar *bsdar return (NULL); } - if ((bname = basename(name)) == NULL) + tmpname = strdup(name); + if (tmpname == NULL) + bsdar_errc(bsdar, EX_SOFTWARE, errno, "strdup failed"); + if ((bname = basename(tmpname)) == NULL) bsdar_errc(bsdar, EX_SOFTWARE, errno, "basename failed"); if (bsdar->options & AR_TR && strlen(bname) > _TRUNCATE_LEN) { if ((obj->name = malloc(_TRUNCATE_LEN + 1)) == NULL) @@ -147,6 +151,7 @@ create_obj_from_file(struct bsdar *bsdar } else if ((obj->name = strdup(bname)) == NULL) bsdar_errc(bsdar, EX_SOFTWARE, errno, "strdup failed"); + free(tmpname); if (fstat(obj->fd, &sb) < 0) { bsdar_warnc(bsdar, errno, "can't fstat file: %s", obj->name); From owner-svn-src-head@freebsd.org Thu May 26 13:58:05 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 759EFB4B40D; Thu, 26 May 2016 13:58:05 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-ig0-x22d.google.com (mail-ig0-x22d.google.com [IPv6:2607:f8b0:4001:c05::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 414D214A8; Thu, 26 May 2016 13:58:05 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-ig0-x22d.google.com with SMTP id ww4so90986729igb.1; Thu, 26 May 2016 06:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=donDJVCfMBVs8OQYTGp2DB0Bw2Y1rv0ZdoymMHkrFKY=; b=JsiRkMF8wT+GlKaAYVeEukC8V356ylmtkRDvKDR8xsW21Y4ZFj1GE9b9hUvxAUnTx0 FIjh5L0JxIeddRyqWA6KPkc78WXMAa90Tu8usdcr1fJ7yAzFCUwXxsW0d/FN0kuZ1s0M ZTinXilJDOuFkw7c/BPodf1cEKyFt4K143yhYPGZsZApYCTh4ty5s2YlDfJ916ntxs4a kEBOxwtlJ09V577DCQqENxnCr/AfZIFszaaQCpqAs1gizVGkpv2gqoxYsLTyWMwA9vPC zRPHFl7R/Ncjf5uYsnRpudmpeGrUmfUVYPa4spGdykw7JNCjUOLNi32+jfNmC+CQvt62 IEeA== 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; bh=donDJVCfMBVs8OQYTGp2DB0Bw2Y1rv0ZdoymMHkrFKY=; b=mFVv8tsVsjWFMdanG5EBEEtCEz4pzfPQnm2BvxMMuaJBPfn2M5hDibSpfkVuYMWDAG CsljxQ7CIkK+g7U4upgXIBDYSax0+tuEld3cEJULkqI4qxOWqgCqGiReTr07yq4CY4wY wAMV2YRkrCLw8EOe7G7n/Mam7cJ+bWSmJmteg70/4j3tsf1A8xUzI1ZIfMPsoe/llPR+ qdTpPY5N/aNq900GZkaopxIxU1fn8vOKEEULpCInzgk17JbBQTCWwkewF7GNvLf9nkgy Wsyju/zFlhZs8x4r4E41Qy5+eE4AsbVvvOXzth69uQsokGMcauEW2VVPjK9qiGexxSeq QdYA== X-Gm-Message-State: ALyK8tJ92mfGiJWmgLcXk0f1B/WrkRf/AmGFIey2ih5k88bdW1GJ8YwZmiv7bIuesMnOErMZOfSEuEXouzvPDw== X-Received: by 10.50.59.211 with SMTP id b19mr3432910igr.58.1464271084568; Thu, 26 May 2016 06:58:04 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.27.197 with HTTP; Thu, 26 May 2016 06:57:45 -0700 (PDT) In-Reply-To: <201605261349.u4QDneJN059004@repo.freebsd.org> References: <201605261349.u4QDneJN059004@repo.freebsd.org> From: Ed Maste <emaste@freebsd.org> Date: Thu, 26 May 2016 09:57:45 -0400 X-Google-Sender-Auth: B9ICzLarOJM_wmdzBIWEzpKRbLs Message-ID: <CAPyFy2BBdWArVG86GZF2HZQ8-9LRJ0bpVuyHF-=Hrx5Ma=kE4A@mail.gmail.com> Subject: Re: svn commit: r300741 - head/usr.bin/ar To: Ed Schouten <ed@freebsd.org> Cc: "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 13:58:05 -0000 On 26 May 2016 at 09:49, Ed Schouten <ed@freebsd.org> wrote: > This change is similar to the one made to the > ELF Toolchain version of ar, with the difference that the ELF Toolchain > version lacks error handling for the strdup() call. As an aside, I plan to migrate to the ELF Tool Chain version of brandelf, elfdump, and ar, after they gain any functionality that currently exists only in the versions in the FreeBSD tree. I'll bring the strdup error handling change from here upstream. From owner-svn-src-head@freebsd.org Thu May 26 14:17:59 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5571BB4BA61; Thu, 26 May 2016 14:17:59 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15AE917B4; Thu, 26 May 2016 14:17:59 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QEHwMC069938; Thu, 26 May 2016 14:17:58 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QEHwPg069936; Thu, 26 May 2016 14:17:58 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605261417.u4QEHwPg069936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk <avos@FreeBSD.org> Date: Thu, 26 May 2016 14:17:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300744 - head/sys/dev/rtwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 14:17:59 -0000 Author: avos Date: Thu May 26 14:17:57 2016 New Revision: 300744 URL: https://svnweb.freebsd.org/changeset/base/300744 Log: rtwn: replace hardcoded rate indices with their names (similar to r289758). - Use macros to define rate indices; don't hardcode them in code. - Add method for 'rate' -> 'rate index' conversion (and array for the opposite). - Determine if rate is CCK / OFDM via appropriate macro. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D4837 Modified: head/sys/dev/rtwn/if_rtwn.c head/sys/dev/rtwn/if_rtwnreg.h Modified: head/sys/dev/rtwn/if_rtwn.c ============================================================================== --- head/sys/dev/rtwn/if_rtwn.c Thu May 26 14:13:09 2016 (r300743) +++ head/sys/dev/rtwn/if_rtwn.c Thu May 26 14:17:57 2016 (r300744) @@ -1044,40 +1044,56 @@ rtwn_read_rom(struct rtwn_softc *sc) IEEE80211_ADDR_COPY(sc->sc_ic.ic_macaddr, rom->macaddr); } +static __inline uint8_t +rate2ridx(uint8_t rate) +{ + switch (rate) { + case 12: return 4; + case 18: return 5; + case 24: return 6; + case 36: return 7; + case 48: return 8; + case 72: return 9; + case 96: return 10; + case 108: return 11; + case 2: return 0; + case 4: return 1; + case 11: return 2; + case 22: return 3; + default: return RTWN_RIDX_UNKNOWN; + } +} + /* * Initialize rate adaptation in firmware. */ static int rtwn_ra_init(struct rtwn_softc *sc) { - static const uint8_t map[] = - { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 }; struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); struct ieee80211_node *ni = ieee80211_ref_node(vap->iv_bss); struct ieee80211_rateset *rs = &ni->ni_rates; struct r92c_fw_cmd_macid_cfg cmd; uint32_t rates, basicrates; - uint8_t mode; - int maxrate, maxbasicrate, error, i, j; + uint8_t maxrate, maxbasicrate, mode, ridx; + int error, i; /* Get normal and basic rates mask. */ rates = basicrates = 0; maxrate = maxbasicrate = 0; for (i = 0; i < rs->rs_nrates; i++) { /* Convert 802.11 rate to HW rate index. */ - for (j = 0; j < nitems(map); j++) - if ((rs->rs_rates[i] & IEEE80211_RATE_VAL) == map[j]) - break; - if (j == nitems(map)) /* Unknown rate, skip. */ + ridx = rate2ridx(IEEE80211_RV(rs->rs_rates[i])); + if (ridx == RTWN_RIDX_UNKNOWN) /* Unknown rate, skip. */ continue; - rates |= 1 << j; - if (j > maxrate) - maxrate = j; + rates |= 1 << ridx; + if (ridx > maxrate) + maxrate = ridx; if (rs->rs_rates[i] & IEEE80211_RATE_BASIC) { - basicrates |= 1 << j; - if (j > maxbasicrate) - maxbasicrate = j; + basicrates |= 1 << ridx; + if (ridx > maxbasicrate) + maxbasicrate = ridx; } } if (ic->ic_curmode == IEEE80211_MODE_11B) @@ -1358,7 +1374,7 @@ rtwn_update_avgrssi(struct rtwn_softc *s pwdb = 100; else pwdb = 100 + rssi; - if (rate <= 3) { + if (RTWN_RATE_IS_CCK(rate)) { /* CCK gain is smaller than OFDM/MCS gain. */ pwdb += 6; if (pwdb > 100) @@ -1390,7 +1406,7 @@ rtwn_get_rssi(struct rtwn_softc *sc, int uint8_t rpt; int8_t rssi; - if (rate <= 3) { + if (RTWN_RATE_IS_CCK(rate)) { cck = (struct r92c_rx_cck *)physt; if (sc->sc_flags & RTWN_FLAG_CCK_HIPWR) { rpt = (cck->agc_rpt >> 5) & 0x3; @@ -1503,22 +1519,7 @@ rtwn_rx_frame(struct rtwn_softc *sc, str tap->wr_flags = 0; if (!(rxdw3 & R92C_RXDW3_HT)) { - switch (rate) { - /* CCK. */ - case 0: tap->wr_rate = 2; break; - case 1: tap->wr_rate = 4; break; - case 2: tap->wr_rate = 11; break; - case 3: tap->wr_rate = 22; break; - /* OFDM. */ - case 4: tap->wr_rate = 12; break; - case 5: tap->wr_rate = 18; break; - case 6: tap->wr_rate = 24; break; - case 7: tap->wr_rate = 36; break; - case 8: tap->wr_rate = 48; break; - case 9: tap->wr_rate = 72; break; - case 10: tap->wr_rate = 96; break; - case 11: tap->wr_rate = 108; break; - } + tap->wr_rate = ridx2rate[rate]; } else if (rate >= 12) { /* MCS0~15. */ /* Bit 7 set means HT MCS instead of rate. */ tap->wr_rate = 0x80 | (rate - 12); @@ -1644,10 +1645,12 @@ rtwn_tx(struct rtwn_softc *sc, struct mb /* XXX TODO: implement rate control */ /* Send RTS at OFDM24. */ - txd->txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, 8)); + txd->txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, + RTWN_RIDX_OFDM24)); txd->txdw5 |= htole32(SM(R92C_TXDW5_RTSRATE_FBLIMIT, 0xf)); /* Send data at OFDM54. */ - txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 11)); + txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, + RTWN_RIDX_OFDM54)); txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE_FBLIMIT, 0x1f)); } else { @@ -1658,7 +1661,7 @@ rtwn_tx(struct rtwn_softc *sc, struct mb /* Force CCK1. */ txd->txdw4 |= htole32(R92C_TXDW4_DRVRATE); - txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 0)); + txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, RTWN_RIDX_CCK1)); } /* Set sequence number (already little endian). */ txd->txdseq = htole16(M_SEQNO_GET(m) % IEEE80211_SEQ_RANGE); @@ -2577,10 +2580,10 @@ rtwn_get_txpower(struct rtwn_softc *sc, memset(power, 0, RTWN_RIDX_COUNT * sizeof(power[0])); if (sc->regulatory == 0) { - for (ridx = 0; ridx <= 3; ridx++) + for (ridx = RTWN_RIDX_CCK1; ridx <= RTWN_RIDX_CCK11; ridx++) power[ridx] = base->pwr[0][ridx]; } - for (ridx = 4; ridx < RTWN_RIDX_COUNT; ridx++) { + for (ridx = RTWN_RIDX_OFDM6; ridx < RTWN_RIDX_COUNT; ridx++) { if (sc->regulatory == 3) { power[ridx] = base->pwr[0][ridx]; /* Apply vendor limits. */ @@ -2600,7 +2603,7 @@ rtwn_get_txpower(struct rtwn_softc *sc, /* Compute per-CCK rate Tx power. */ cckpow = rom->cck_tx_pwr[chain][group]; - for (ridx = 0; ridx <= 3; ridx++) { + for (ridx = RTWN_RIDX_CCK1; ridx <= RTWN_RIDX_CCK11; ridx++) { power[ridx] += cckpow; if (power[ridx] > R92C_MAX_TX_PWR) power[ridx] = R92C_MAX_TX_PWR; @@ -2618,7 +2621,7 @@ rtwn_get_txpower(struct rtwn_softc *sc, diff = rom->ofdm_tx_pwr_diff[group]; diff = (diff >> (chain * 4)) & 0xf; ofdmpow = htpow + diff; /* HT->OFDM correction. */ - for (ridx = 4; ridx <= 11; ridx++) { + for (ridx = RTWN_RIDX_OFDM6; ridx <= RTWN_RIDX_OFDM54; ridx++) { power[ridx] += ofdmpow; if (power[ridx] > R92C_MAX_TX_PWR) power[ridx] = R92C_MAX_TX_PWR; @@ -2630,7 +2633,7 @@ rtwn_get_txpower(struct rtwn_softc *sc, diff = (diff >> (chain * 4)) & 0xf; htpow += diff; /* HT40->HT20 correction. */ } - for (ridx = 12; ridx <= 27; ridx++) { + for (ridx = RTWN_RIDX_MCS0; ridx <= RTWN_RIDX_MCS15; ridx++) { power[ridx] += htpow; if (power[ridx] > R92C_MAX_TX_PWR) power[ridx] = R92C_MAX_TX_PWR; @@ -2639,7 +2642,7 @@ rtwn_get_txpower(struct rtwn_softc *sc, if (sc->sc_debug >= 4) { /* Dump per-rate Tx power values. */ printf("Tx power for chain %d:\n", chain); - for (ridx = 0; ridx < RTWN_RIDX_COUNT; ridx++) + for (ridx = RTWN_RIDX_CCK1; ridx < RTWN_RIDX_COUNT; ridx++) printf("Rate %d = %u\n", ridx, power[ridx]); } #endif Modified: head/sys/dev/rtwn/if_rtwnreg.h ============================================================================== --- head/sys/dev/rtwn/if_rtwnreg.h Thu May 26 14:13:09 2016 (r300743) +++ head/sys/dev/rtwn/if_rtwnreg.h Thu May 26 14:17:57 2016 (r300744) @@ -1158,6 +1158,25 @@ struct r92c_tx_desc { uint32_t reserved[4]; } __packed __attribute__((aligned(4))); +static const uint8_t ridx2rate[] = + { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 }; + +/* HW rate indices. */ +#define RTWN_RIDX_CCK1 0 +#define RTWN_RIDX_CCK11 3 +#define RTWN_RIDX_OFDM6 4 +#define RTWN_RIDX_OFDM24 8 +#define RTWN_RIDX_OFDM54 11 +#define RTWN_RIDX_MCS0 12 +#define RTWN_RIDX_MCS15 27 + +#define RTWN_RIDX_COUNT 28 +#define RTWN_RIDX_UNKNOWN (uint8_t)-1 + +#define RTWN_RATE_IS_CCK(rate) ((rate) <= RTWN_RIDX_CCK11) +#define RTWN_RATE_IS_OFDM(rate) ((rate) >= RTWN_RIDX_OFDM6 && \ + (rate) <= RTWN_RIDX_OFDM54) + /* * Driver definitions. @@ -1184,8 +1203,6 @@ struct r92c_tx_desc { #define RTWN_RXBUFSZ (16 * 1024) #define RTWN_TXBUFSZ (sizeof(struct r92c_tx_desc) + IEEE80211_MAX_LEN) -#define RTWN_RIDX_COUNT 28 - #define RTWN_TX_TIMEOUT 5000 /* ms */ #define RTWN_LED_LINK 0 From owner-svn-src-head@freebsd.org Thu May 26 14:19:25 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E62AB4BB04; Thu, 26 May 2016 14:19:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 002391A6E; Thu, 26 May 2016 14:19:24 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QEJOnR070172; Thu, 26 May 2016 14:19:24 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QEJOTv070171; Thu, 26 May 2016 14:19:24 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201605261419.u4QEJOTv070171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala <trasz@FreeBSD.org> Date: Thu, 26 May 2016 14:19:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300745 - head/usr.bin/iscsictl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 14:19:25 -0000 Author: trasz Date: Thu May 26 14:19:24 2016 New Revision: 300745 URL: https://svnweb.freebsd.org/changeset/base/300745 Log: Make iscsictl(8) actually report non-zero status on errors. The "failed" is negative, because the error returned from calls to ioctl(2) is negative. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/iscsictl/iscsictl.c Modified: head/usr.bin/iscsictl/iscsictl.c ============================================================================== --- head/usr.bin/iscsictl/iscsictl.c Thu May 26 14:17:57 2016 (r300744) +++ head/usr.bin/iscsictl/iscsictl.c Thu May 26 14:19:24 2016 (r300745) @@ -987,7 +987,7 @@ main(int argc, char **argv) if (error != 0) xo_err(1, "close"); - if (failed > 0) + if (failed != 0) return (1); xo_close_container("iscsictl"); From owner-svn-src-head@freebsd.org Thu May 26 14:21:04 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03F30B4BB7C; Thu, 26 May 2016 14:21:04 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5C601C4E; Thu, 26 May 2016 14:21:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QEL2H1070296; Thu, 26 May 2016 14:21:02 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QEL2aY070295; Thu, 26 May 2016 14:21:02 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201605261421.u4QEL2aY070295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala <trasz@FreeBSD.org> Date: Thu, 26 May 2016 14:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300746 - head/usr.bin/iscsictl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 14:21:04 -0000 Author: trasz Date: Thu May 26 14:21:02 2016 New Revision: 300746 URL: https://svnweb.freebsd.org/changeset/base/300746 Log: Do libxo cleanup even in case of errors. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/iscsictl/iscsictl.c Modified: head/usr.bin/iscsictl/iscsictl.c ============================================================================== --- head/usr.bin/iscsictl/iscsictl.c Thu May 26 14:19:24 2016 (r300745) +++ head/usr.bin/iscsictl/iscsictl.c Thu May 26 14:21:02 2016 (r300746) @@ -987,10 +987,11 @@ main(int argc, char **argv) if (error != 0) xo_err(1, "close"); + xo_close_container("iscsictl"); + xo_finish(); + if (failed != 0) return (1); - xo_close_container("iscsictl"); - xo_finish(); return (0); } From owner-svn-src-head@freebsd.org Thu May 26 14:26:50 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7560B4BE29; Thu, 26 May 2016 14:26:50 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 982D41186; Thu, 26 May 2016 14:26:50 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QEQnqv073716; Thu, 26 May 2016 14:26:49 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QEQn0a073715; Thu, 26 May 2016 14:26:49 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201605261426.u4QEQn0a073715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers <asomers@FreeBSD.org> Date: Thu, 26 May 2016 14:26:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300747 - head/usr.sbin/extattr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 14:26:50 -0000 Author: asomers Date: Thu May 26 14:26:49 2016 New Revision: 300747 URL: https://svnweb.freebsd.org/changeset/base/300747 Log: rmextattr(8) man page clarifications regarding -qq Reviewed by: ngie MFC after: 6 days X-MFC-With: 299085 Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D6422 Modified: head/usr.sbin/extattr/rmextattr.8 Modified: head/usr.sbin/extattr/rmextattr.8 ============================================================================== --- head/usr.sbin/extattr/rmextattr.8 Thu May 26 14:21:02 2016 (r300746) +++ head/usr.sbin/extattr/rmextattr.8 Thu May 26 14:26:49 2016 (r300747) @@ -108,7 +108,7 @@ Read attribute data from stdin instead o .It Fl q (Quiet.) Do not print out the pathname and suppress error messages. -When given twice, do not print a trailing newline. +When given twice, print only the attribute value, with no trailing newline. .It Fl s (Stringify.) Escape nonprinting characters and put quotes around the output. @@ -121,6 +121,7 @@ Print the output in hexadecimal. setextattr system md5 `md5 -q /boot/kernel/kernel` /boot/kernel/kernel md5 -q /boot/kernel/kernel | setextattr -i system md5 /boot/kernel/kernel getextattr system md5 /boot/kernel/kernel +getextattr -qq system md5 /boot/kernel/kernel | od -x lsextattr system /boot/kernel/kernel rmextattr system md5 /boot/kernel/kernel .Ed From owner-svn-src-head@freebsd.org Thu May 26 15:05:39 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 064E9B4BBA7; Thu, 26 May 2016 15:05:39 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C622E1FF7; Thu, 26 May 2016 15:05:38 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QF5b3N088495; Thu, 26 May 2016 15:05:37 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QF5bLU088493; Thu, 26 May 2016 15:05:37 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605261505.u4QF5bLU088493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk <avos@FreeBSD.org> Date: Thu, 26 May 2016 15:05:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300748 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 15:05:39 -0000 Author: avos Date: Thu May 26 15:05:37 2016 New Revision: 300748 URL: https://svnweb.freebsd.org/changeset/base/300748 Log: run: switch to ieee80211_add_channel_list_*() - Use device's channel list instead of default one (from ieee80211_init_channels()). - Add ic_getradiocaps() method. Differential Revision: https://reviews.freebsd.org/D6144 Modified: head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_runreg.h Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Thu May 26 14:26:49 2016 (r300747) +++ head/sys/dev/usb/wlan/if_run.c Thu May 26 15:05:37 2016 (r300748) @@ -423,6 +423,8 @@ static void run_rt5390_set_chan(struct r static void run_rt5592_set_chan(struct run_softc *, u_int); static int run_set_chan(struct run_softc *, struct ieee80211_channel *); static void run_set_channel(struct ieee80211com *); +static void run_getradiocaps(struct ieee80211com *, int, int *, + struct ieee80211_channel[]); static void run_scan_start(struct ieee80211com *); static void run_scan_end(struct ieee80211com *); static void run_update_beacon(struct ieee80211vap *, int); @@ -704,7 +706,6 @@ run_attach(device_t self) struct usb_attach_arg *uaa = device_get_ivars(self); struct ieee80211com *ic = &sc->sc_ic; uint32_t ver; - uint8_t bands[IEEE80211_MODE_BYTES]; uint8_t iface_index; int ntries, error; @@ -786,20 +787,15 @@ run_attach(device_t self) ic->ic_flags |= IEEE80211_F_DATAPAD; ic->ic_flags_ext |= IEEE80211_FEXT_SWBMISS; - memset(bands, 0, sizeof(bands)); - setbit(bands, IEEE80211_MODE_11B); - setbit(bands, IEEE80211_MODE_11G); - if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850 || - sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT3593_RF_3053 || - sc->rf_rev == RT5592_RF_5592) - setbit(bands, IEEE80211_MODE_11A); - ieee80211_init_channels(ic, NULL, bands); + run_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); ieee80211_ifattach(ic); ic->ic_scan_start = run_scan_start; ic->ic_scan_end = run_scan_end; ic->ic_set_channel = run_set_channel; + ic->ic_getradiocaps = run_getradiocaps; ic->ic_node_alloc = run_node_alloc; ic->ic_newassoc = run_newassoc; ic->ic_updateslot = run_updateslot; @@ -4784,6 +4780,28 @@ run_set_channel(struct ieee80211com *ic) } static void +run_getradiocaps(struct ieee80211com *ic, + int maxchans, int *nchans, struct ieee80211_channel chans[]) +{ + struct run_softc *sc = ic->ic_softc; + uint8_t bands[IEEE80211_MODE_BYTES]; + + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, + run_chan_2ghz, nitems(run_chan_2ghz), bands, 0); + + if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850 || + sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT3593_RF_3053 || + sc->rf_rev == RT5592_RF_5592) { + setbit(bands, IEEE80211_MODE_11A); + ieee80211_add_channel_list_5ghz(chans, maxchans, nchans, + run_chan_5ghz, nitems(run_chan_5ghz), bands, 0); + } +} + +static void run_scan_start(struct ieee80211com *ic) { struct run_softc *sc = ic->ic_softc; Modified: head/sys/dev/usb/wlan/if_runreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_runreg.h Thu May 26 14:26:49 2016 (r300747) +++ head/sys/dev/usb/wlan/if_runreg.h Thu May 26 15:05:37 2016 (r300748) @@ -1084,6 +1084,18 @@ struct rt2860_rxwi { { 137, 0x0f } /* + * Channel map for run(4) driver; taken from the table below. + */ +static const uint8_t run_chan_2ghz[] = + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; + +static const uint8_t run_chan_5ghz[] = + { 36, 38, 40, 44, 46, 48, 52, 54, 56, 60, 62, 64, 100, 102, 104, + 108, 110, 112, 116, 118, 120, 124, 126, 128, 132, 134, 136, 140, + 149, 151, 153, 157, 159, 161, 165, 167, 169, 171, 173, + 184, 188, 192, 196, 208, 212, 216 }; + +/* * Default settings for RF registers; values derived from the reference driver. */ #define RT2860_RF2850 \ From owner-svn-src-head@freebsd.org Thu May 26 15:12:55 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A09FB4BF3E; Thu, 26 May 2016 15:12:55 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2204D18BF; Thu, 26 May 2016 15:12:55 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QFCsV4092159; Thu, 26 May 2016 15:12:54 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QFCs9R092158; Thu, 26 May 2016 15:12:54 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605261512.u4QFCs9R092158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk <avos@FreeBSD.org> Date: Thu, 26 May 2016 15:12:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300749 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 15:12:55 -0000 Author: avos Date: Thu May 26 15:12:54 2016 New Revision: 300749 URL: https://svnweb.freebsd.org/changeset/base/300749 Log: ural: switch to ieee80211_add_channel_list_*() - Use device's channel list instead of default one (+ 12, 13 and 14 2GHz channels). - Add ic_getradiocaps() method. Differential Revision: https://reviews.freebsd.org/D6170 Modified: head/sys/dev/usb/wlan/if_ural.c Modified: head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- head/sys/dev/usb/wlan/if_ural.c Thu May 26 15:05:37 2016 (r300748) +++ head/sys/dev/usb/wlan/if_ural.c Thu May 26 15:12:54 2016 (r300749) @@ -166,6 +166,8 @@ static uint8_t ural_bbp_read(struct ura static void ural_rf_write(struct ural_softc *, uint8_t, uint32_t); static void ural_scan_start(struct ieee80211com *); static void ural_scan_end(struct ieee80211com *); +static void ural_getradiocaps(struct ieee80211com *, int, int *, + struct ieee80211_channel[]); static void ural_set_channel(struct ieee80211com *); static void ural_set_chan(struct ural_softc *, struct ieee80211_channel *); @@ -357,6 +359,14 @@ static const struct { { 161, 0x08808, 0x0242f, 0x00281 } }; +static const uint8_t ural_chan_2ghz[] = + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; + +static const uint8_t ural_chan_5ghz[] = + { 36, 40, 44, 48, 52, 56, 60, 64, + 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, + 149, 153, 157, 161 }; + static const struct usb_config ural_config[URAL_N_TRANSFER] = { [URAL_BULK_WR] = { .type = UE_BULK, @@ -424,7 +434,6 @@ ural_attach(device_t self) struct usb_attach_arg *uaa = device_get_ivars(self); struct ural_softc *sc = device_get_softc(self); struct ieee80211com *ic = &sc->sc_ic; - uint8_t bands[IEEE80211_MODE_BYTES]; uint8_t iface_index; int error; @@ -474,18 +483,15 @@ ural_attach(device_t self) | IEEE80211_C_WPA /* 802.11i */ ; - memset(bands, 0, sizeof(bands)); - setbit(bands, IEEE80211_MODE_11B); - setbit(bands, IEEE80211_MODE_11G); - if (sc->rf_rev == RAL_RF_5222) - setbit(bands, IEEE80211_MODE_11A); - ieee80211_init_channels(ic, NULL, bands); + ural_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); ieee80211_ifattach(ic); ic->ic_update_promisc = ural_update_promisc; ic->ic_raw_xmit = ural_raw_xmit; ic->ic_scan_start = ural_scan_start; ic->ic_scan_end = ural_scan_end; + ic->ic_getradiocaps = ural_getradiocaps; ic->ic_set_channel = ural_set_channel; ic->ic_parent = ural_parent; ic->ic_transmit = ural_transmit; @@ -1588,6 +1594,26 @@ ural_scan_end(struct ieee80211com *ic) } static void +ural_getradiocaps(struct ieee80211com *ic, + int maxchans, int *nchans, struct ieee80211_channel chans[]) +{ + struct ural_softc *sc = ic->ic_softc; + uint8_t bands[IEEE80211_MODE_BYTES]; + + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, + ural_chan_2ghz, nitems(ural_chan_2ghz), bands, 0); + + if (sc->rf_rev == RAL_RF_5222) { + setbit(bands, IEEE80211_MODE_11A); + ieee80211_add_channel_list_5ghz(chans, maxchans, nchans, + ural_chan_5ghz, nitems(ural_chan_5ghz), bands, 0); + } +} + +static void ural_set_channel(struct ieee80211com *ic) { struct ural_softc *sc = ic->ic_softc; From owner-svn-src-head@freebsd.org Thu May 26 15:45:38 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B371B4B885; Thu, 26 May 2016 15:45:38 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12A3A1CC4; Thu, 26 May 2016 15:45:37 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QFjbuE003364; Thu, 26 May 2016 15:45:37 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QFjaMH003360; Thu, 26 May 2016 15:45:36 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201605261545.u4QFjaMH003360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore <ian@FreeBSD.org> Date: Thu, 26 May 2016 15:45:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300750 - in head/sys/dev: extres/regulator gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 15:45:38 -0000 Author: ian Date: Thu May 26 15:45:36 2016 New Revision: 300750 URL: https://svnweb.freebsd.org/changeset/base/300750 Log: Rename gpiobus_map_pin() to gpiobus_acquire_pin(), to better reflect the fact that the caller is requesting exclusive use of the pin, and also to better match the inverse operation which is named gpiobus_release_pin(). Modified: head/sys/dev/extres/regulator/regulator_fixed.c head/sys/dev/gpio/gpiobus.c head/sys/dev/gpio/gpiobusvar.h head/sys/dev/gpio/ofw_gpiobus.c Modified: head/sys/dev/extres/regulator/regulator_fixed.c ============================================================================== --- head/sys/dev/extres/regulator/regulator_fixed.c Thu May 26 15:12:54 2016 (r300749) +++ head/sys/dev/extres/regulator/regulator_fixed.c Thu May 26 15:45:36 2016 (r300750) @@ -115,8 +115,8 @@ regnode_get_gpio_entry(struct gpiobus_pi } /* Reserve pin. */ - /* XXX Can we call gpiobus_map_pin() with gpio_list_mtx mutex held? */ - rv = gpiobus_map_pin(busdev, gpio_pin->pin); + /* XXX Can we call gpiobus_acquire_pin() with gpio_list_mtx held? */ + rv = gpiobus_acquire_pin(busdev, gpio_pin->pin); if (rv != 0) { mtx_unlock(&gpio_list_mtx); free(entry, M_FIXEDREGULATOR); Modified: head/sys/dev/gpio/gpiobus.c ============================================================================== --- head/sys/dev/gpio/gpiobus.c Thu May 26 15:12:54 2016 (r300749) +++ head/sys/dev/gpio/gpiobus.c Thu May 26 15:45:36 2016 (r300750) @@ -260,7 +260,7 @@ gpiobus_free_ivars(struct gpiobus_ivar * } int -gpiobus_map_pin(device_t bus, uint32_t pin) +gpiobus_acquire_pin(device_t bus, uint32_t pin) { struct gpiobus_softc *sc; @@ -291,13 +291,13 @@ gpiobus_release_pin(device_t bus, uint32 /* Consistency check. */ if (pin >= sc->sc_npins) { device_printf(bus, - "gpiobus_map_pin: invalid pin %d, max=%d\n", + "gpiobus_acquire_pin: invalid pin %d, max=%d\n", pin, sc->sc_npins - 1); return (-1); } if (!sc->sc_pins[pin].mapped) { - device_printf(bus, "gpiobus_map_pin: pin %d is not mapped\n", pin); + device_printf(bus, "gpiobus_acquire_pin: pin %d is not mapped\n", pin); return (-1); } sc->sc_pins[pin].mapped = 0; @@ -330,7 +330,7 @@ gpiobus_parse_pins(struct gpiobus_softc if ((mask & (1 << i)) == 0) continue; /* Reserve the GPIO pin. */ - if (gpiobus_map_pin(sc->sc_busdev, i) != 0) { + if (gpiobus_acquire_pin(sc->sc_busdev, i) != 0) { gpiobus_free_ivars(devi); return (EINVAL); } Modified: head/sys/dev/gpio/gpiobusvar.h ============================================================================== --- head/sys/dev/gpio/gpiobusvar.h Thu May 26 15:12:54 2016 (r300749) +++ head/sys/dev/gpio/gpiobusvar.h Thu May 26 15:45:36 2016 (r300750) @@ -137,7 +137,7 @@ int gpiobus_detach_bus(device_t); int gpiobus_init_softc(device_t); int gpiobus_alloc_ivars(struct gpiobus_ivar *); void gpiobus_free_ivars(struct gpiobus_ivar *); -int gpiobus_map_pin(device_t, uint32_t); +int gpiobus_acquire_pin(device_t, uint32_t); int gpiobus_release_pin(device_t, uint32_t); extern driver_t gpiobus_driver; Modified: head/sys/dev/gpio/ofw_gpiobus.c ============================================================================== --- head/sys/dev/gpio/ofw_gpiobus.c Thu May 26 15:12:54 2016 (r300749) +++ head/sys/dev/gpio/ofw_gpiobus.c Thu May 26 15:45:36 2016 (r300750) @@ -95,7 +95,7 @@ gpio_pin_get_by_ofw_impl(device_t consum return (ENXIO); /* Reserve GPIO pin. */ - rv = gpiobus_map_pin(busdev, pin.pin); + rv = gpiobus_acquire_pin(busdev, pin.pin); if (rv != 0) return (EBUSY); @@ -457,7 +457,7 @@ ofw_gpiobus_parse_gpios_impl(device_t co goto fail; } /* Reserve the GPIO pin. */ - if (gpiobus_map_pin(bussc->sc_busdev, (*pins)[j].pin) != 0) + if (gpiobus_acquire_pin(bussc->sc_busdev, (*pins)[j].pin) != 0) goto fail; j++; i += gpiocells + 1; From owner-svn-src-head@freebsd.org Thu May 26 15:56:28 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E71AB4BC16; Thu, 26 May 2016 15:56:28 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 306B71410; Thu, 26 May 2016 15:56:28 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QFuR9j007093; Thu, 26 May 2016 15:56:27 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QFuRHo007090; Thu, 26 May 2016 15:56:27 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605261556.u4QFuRHo007090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk <avos@FreeBSD.org> Date: Thu, 26 May 2016 15:56:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300751 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 15:56:28 -0000 Author: avos Date: Thu May 26 15:56:27 2016 New Revision: 300751 URL: https://svnweb.freebsd.org/changeset/base/300751 Log: zyd: switch to ieee80211_add_channel_list_*() - Use device's channel list instead of default one (adds 12, 13 and 14 2GHz channels). - Add ic_getradiocaps() method. Differential Revision: https://reviews.freebsd.org/D6171 Modified: head/sys/dev/usb/wlan/if_zyd.c head/sys/dev/usb/wlan/if_zydreg.h Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Thu May 26 15:45:36 2016 (r300750) +++ head/sys/dev/usb/wlan/if_zyd.c Thu May 26 15:56:27 2016 (r300751) @@ -164,6 +164,8 @@ static void zyd_stop(struct zyd_softc *) static int zyd_loadfirmware(struct zyd_softc *); static void zyd_scan_start(struct ieee80211com *); static void zyd_scan_end(struct ieee80211com *); +static void zyd_getradiocaps(struct ieee80211com *, int, int *, + struct ieee80211_channel[]); static void zyd_set_channel(struct ieee80211com *); static int zyd_rfmd_init(struct zyd_rf *); static int zyd_rfmd_switch_radio(struct zyd_rf *, int); @@ -334,7 +336,6 @@ zyd_attach(device_t dev) struct usb_attach_arg *uaa = device_get_ivars(dev); struct zyd_softc *sc = device_get_softc(dev); struct ieee80211com *ic = &sc->sc_ic; - uint8_t bands[IEEE80211_MODE_BYTES]; uint8_t iface_index; int error; @@ -388,15 +389,14 @@ zyd_attach(device_t dev) | IEEE80211_C_WPA /* 802.11i */ ; - memset(bands, 0, sizeof(bands)); - setbit(bands, IEEE80211_MODE_11B); - setbit(bands, IEEE80211_MODE_11G); - ieee80211_init_channels(ic, NULL, bands); + zyd_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); ieee80211_ifattach(ic); ic->ic_raw_xmit = zyd_raw_xmit; ic->ic_scan_start = zyd_scan_start; ic->ic_scan_end = zyd_scan_end; + ic->ic_getradiocaps = zyd_getradiocaps; ic->ic_set_channel = zyd_set_channel; ic->ic_vap_create = zyd_vap_create; ic->ic_vap_delete = zyd_vap_delete; @@ -2865,6 +2865,19 @@ zyd_scan_end(struct ieee80211com *ic) } static void +zyd_getradiocaps(struct ieee80211com *ic, + int maxchans, int *nchans, struct ieee80211_channel chans[]) +{ + uint8_t bands[IEEE80211_MODE_BYTES]; + + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, + zyd_chan_2ghz, nitems(zyd_chan_2ghz), bands, 0); +} + +static void zyd_set_channel(struct ieee80211com *ic) { struct zyd_softc *sc = ic->ic_softc; Modified: head/sys/dev/usb/wlan/if_zydreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_zydreg.h Thu May 26 15:45:36 2016 (r300750) +++ head/sys/dev/usb/wlan/if_zydreg.h Thu May 26 15:56:27 2016 (r300751) @@ -421,6 +421,10 @@ #define ZYD_CR254 0x93f8 #define ZYD_CR255 0x93fc +/* nitems(ZYD_*_CHANTABLE) */ +static const uint8_t zyd_chan_2ghz[] = + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; + /* copied nearly verbatim from the Linux driver rewrite */ #define ZYD_DEF_PHY \ { \ From owner-svn-src-head@freebsd.org Thu May 26 16:05:20 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68FDCB4BEFF; Thu, 26 May 2016 16:05:20 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43D431B46; Thu, 26 May 2016 16:05:20 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QG5J2e011014; Thu, 26 May 2016 16:05:19 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QG5JNJ011011; Thu, 26 May 2016 16:05:19 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605261605.u4QG5JNJ011011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk <avos@FreeBSD.org> Date: Thu, 26 May 2016 16:05:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300752 - head/sys/dev/ral X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 16:05:20 -0000 Author: avos Date: Thu May 26 16:05:19 2016 New Revision: 300752 URL: https://svnweb.freebsd.org/changeset/base/300752 Log: ral: switch to ieee80211_add_channel_list_*() - Use device's channel list instead of default one (from ieee80211_init_channels()). - Add ic_getradiocaps() method. Added channels: - 2GHz (all): 12, 13, 14. - 5GHz: * rt2661: 165 * rt2860: 38, 46, 54, 62, 102, 110, 118, 126, 134, 151, 159, 165, 167, 169, 171, 173. Differential Revision: https://reviews.freebsd.org/D6182 Modified: head/sys/dev/ral/rt2560.c head/sys/dev/ral/rt2661.c head/sys/dev/ral/rt2860.c Modified: head/sys/dev/ral/rt2560.c ============================================================================== --- head/sys/dev/ral/rt2560.c Thu May 26 15:56:27 2016 (r300751) +++ head/sys/dev/ral/rt2560.c Thu May 26 16:05:19 2016 (r300752) @@ -117,6 +117,8 @@ static void rt2560_beacon_expire(struct static void rt2560_wakeup_expire(struct rt2560_softc *); static void rt2560_scan_start(struct ieee80211com *); static void rt2560_scan_end(struct ieee80211com *); +static void rt2560_getradiocaps(struct ieee80211com *, int, int *, + struct ieee80211_channel[]); static void rt2560_set_channel(struct ieee80211com *); static void rt2560_setup_tx_desc(struct rt2560_softc *, struct rt2560_tx_desc *, uint32_t, int, int, int, @@ -187,6 +189,14 @@ static const uint32_t rt2560_rf2525e_r2[ static const uint32_t rt2560_rf2526_r2[] = RT2560_RF2526_R2; static const uint32_t rt2560_rf2526_hi_r2[] = RT2560_RF2526_HI_R2; +static const uint8_t rt2560_chan_2ghz[] = + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; + +static const uint8_t rt2560_chan_5ghz[] = + { 36, 40, 44, 48, 52, 56, 60, 64, + 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, + 149, 153, 157, 161 }; + static const struct { uint8_t chan; uint32_t r1, r2, r4; @@ -199,7 +209,6 @@ rt2560_attach(device_t dev, int id) { struct rt2560_softc *sc = device_get_softc(dev); struct ieee80211com *ic = &sc->sc_ic; - uint8_t bands[IEEE80211_MODE_BYTES]; int error; sc->sc_dev = dev; @@ -278,12 +287,8 @@ rt2560_attach(device_t dev, int id) #endif ; - memset(bands, 0, sizeof(bands)); - setbit(bands, IEEE80211_MODE_11B); - setbit(bands, IEEE80211_MODE_11G); - if (sc->rf_rev == RT2560_RF_5222) - setbit(bands, IEEE80211_MODE_11A); - ieee80211_init_channels(ic, NULL, bands); + rt2560_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); ieee80211_ifattach(ic); ic->ic_raw_xmit = rt2560_raw_xmit; @@ -291,6 +296,7 @@ rt2560_attach(device_t dev, int id) ic->ic_update_promisc = rt2560_update_promisc; ic->ic_scan_start = rt2560_scan_start; ic->ic_scan_end = rt2560_scan_end; + ic->ic_getradiocaps = rt2560_getradiocaps; ic->ic_set_channel = rt2560_set_channel; ic->ic_vap_create = rt2560_vap_create; @@ -2141,6 +2147,26 @@ rt2560_set_chan(struct rt2560_softc *sc, } static void +rt2560_getradiocaps(struct ieee80211com *ic, + int maxchans, int *nchans, struct ieee80211_channel chans[]) +{ + struct rt2560_softc *sc = ic->ic_softc; + uint8_t bands[IEEE80211_MODE_BYTES]; + + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, + rt2560_chan_2ghz, nitems(rt2560_chan_2ghz), bands, 0); + + if (sc->rf_rev == RT2560_RF_5222) { + setbit(bands, IEEE80211_MODE_11A); + ieee80211_add_channel_list_5ghz(chans, maxchans, nchans, + rt2560_chan_5ghz, nitems(rt2560_chan_5ghz), bands, 0); + } +} + +static void rt2560_set_channel(struct ieee80211com *ic) { struct rt2560_softc *sc = ic->ic_softc; Modified: head/sys/dev/ral/rt2661.c ============================================================================== --- head/sys/dev/ral/rt2661.c Thu May 26 15:56:27 2016 (r300751) +++ head/sys/dev/ral/rt2661.c Thu May 26 16:05:19 2016 (r300752) @@ -113,6 +113,8 @@ static void rt2661_mcu_wakeup(struct rt static void rt2661_mcu_cmd_intr(struct rt2661_softc *); static void rt2661_scan_start(struct ieee80211com *); static void rt2661_scan_end(struct ieee80211com *); +static void rt2661_getradiocaps(struct ieee80211com *, int, int *, + struct ieee80211_channel[]); static void rt2661_set_channel(struct ieee80211com *); static void rt2661_setup_tx_desc(struct rt2661_softc *, struct rt2661_tx_desc *, uint32_t, uint16_t, int, @@ -193,13 +195,19 @@ static const struct rfprog { RT2661_RF5225_2 }; +static const uint8_t rt2661_chan_2ghz[] = + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; +static const uint8_t rt2661_chan_5ghz[] = + { 36, 40, 44, 48, 52, 56, 60, 64, + 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, + 149, 153, 157, 161, 165 }; + int rt2661_attach(device_t dev, int id) { struct rt2661_softc *sc = device_get_softc(dev); struct ieee80211com *ic = &sc->sc_ic; uint32_t val; - uint8_t bands[IEEE80211_MODE_BYTES]; int error, ac, ntries; sc->sc_id = id; @@ -279,12 +287,8 @@ rt2661_attach(device_t dev, int id) #endif ; - memset(bands, 0, sizeof(bands)); - setbit(bands, IEEE80211_MODE_11B); - setbit(bands, IEEE80211_MODE_11G); - if (sc->rf_rev == RT2661_RF_5225 || sc->rf_rev == RT2661_RF_5325) - setbit(bands, IEEE80211_MODE_11A); - ieee80211_init_channels(ic, NULL, bands); + rt2661_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); ieee80211_ifattach(ic); #if 0 @@ -2762,6 +2766,26 @@ rt2661_scan_end(struct ieee80211com *ic) } static void +rt2661_getradiocaps(struct ieee80211com *ic, + int maxchans, int *nchans, struct ieee80211_channel chans[]) +{ + struct rt2661_softc *sc = ic->ic_softc; + uint8_t bands[IEEE80211_MODE_BYTES]; + + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, + rt2661_chan_2ghz, nitems(rt2661_chan_2ghz), bands, 0); + + if (sc->rf_rev == RT2661_RF_5225 || sc->rf_rev == RT2661_RF_5325) { + setbit(bands, IEEE80211_MODE_11A); + ieee80211_add_channel_list_5ghz(chans, maxchans, nchans, + rt2661_chan_5ghz, nitems(rt2661_chan_5ghz), bands, 0); + } +} + +static void rt2661_set_channel(struct ieee80211com *ic) { struct rt2661_softc *sc = ic->ic_softc; Modified: head/sys/dev/ral/rt2860.c ============================================================================== --- head/sys/dev/ral/rt2860.c Thu May 26 15:56:27 2016 (r300751) +++ head/sys/dev/ral/rt2860.c Thu May 26 16:05:19 2016 (r300752) @@ -138,6 +138,8 @@ static void rt2860_set_basicrates(struct const struct ieee80211_rateset *); static void rt2860_scan_start(struct ieee80211com *); static void rt2860_scan_end(struct ieee80211com *); +static void rt2860_getradiocaps(struct ieee80211com *, int, int *, + struct ieee80211_channel[]); static void rt2860_set_channel(struct ieee80211com *); static void rt2860_select_chan_group(struct rt2860_softc *, int); static void rt2860_set_chan(struct rt2860_softc *, u_int); @@ -226,13 +228,19 @@ static const struct { RT5392_DEF_RF }; +static const uint8_t rt2860_chan_2ghz[] = + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; +static const uint8_t rt2860_chan_5ghz[] = + { 36, 38, 40, 44, 46, 48, 52, 54, 56, 60, 62, 64, 100, 102, 104, + 108, 110, 112, 116, 118, 120, 124, 126, 128, 132, 134, 136, 140, + 149, 151, 153, 157, 159, 161, 165, 167, 169, 171, 173 }; + int rt2860_attach(device_t dev, int id) { struct rt2860_softc *sc = device_get_softc(dev); struct ieee80211com *ic = &sc->sc_ic; uint32_t tmp; - uint8_t bands[IEEE80211_MODE_BYTES]; int error, ntries, qid; sc->sc_dev = dev; @@ -319,18 +327,15 @@ rt2860_attach(device_t dev, int id) | IEEE80211_C_WME /* 802.11e */ ; - memset(bands, 0, sizeof(bands)); - setbit(bands, IEEE80211_MODE_11B); - setbit(bands, IEEE80211_MODE_11G); - if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850) - setbit(bands, IEEE80211_MODE_11A); - ieee80211_init_channels(ic, NULL, bands); + rt2860_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); ieee80211_ifattach(ic); ic->ic_wme.wme_update = rt2860_updateedca; ic->ic_scan_start = rt2860_scan_start; ic->ic_scan_end = rt2860_scan_end; + ic->ic_getradiocaps = rt2860_getradiocaps; ic->ic_set_channel = rt2860_set_channel; ic->ic_updateslot = rt2860_updateslot; ic->ic_update_promisc = rt2860_update_promisc; @@ -2299,6 +2304,26 @@ rt2860_scan_end(struct ieee80211com *ic) } static void +rt2860_getradiocaps(struct ieee80211com *ic, int maxchans, int *nchans, + struct ieee80211_channel chans[]) +{ + struct rt2860_softc *sc = ic->ic_softc; + uint8_t bands[IEEE80211_MODE_BYTES]; + + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, + rt2860_chan_2ghz, nitems(rt2860_chan_2ghz), bands, 0); + + if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850) { + setbit(bands, IEEE80211_MODE_11A); + ieee80211_add_channel_list_5ghz(chans, maxchans, nchans, + rt2860_chan_5ghz, nitems(rt2860_chan_5ghz), bands, 0); + } +} + +static void rt2860_set_channel(struct ieee80211com *ic) { struct rt2860_softc *sc = ic->ic_softc; From owner-svn-src-head@freebsd.org Thu May 26 16:15:11 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69335B4B218; Thu, 26 May 2016 16:15:11 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4332611E8; Thu, 26 May 2016 16:15:11 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QGFAuT014612; Thu, 26 May 2016 16:15:10 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QGFAfA014609; Thu, 26 May 2016 16:15:10 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605261615.u4QGFAfA014609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk <avos@FreeBSD.org> Date: Thu, 26 May 2016 16:15:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300753 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 16:15:11 -0000 Author: avos Date: Thu May 26 16:15:10 2016 New Revision: 300753 URL: https://svnweb.freebsd.org/changeset/base/300753 Log: urtw: switch to ieee80211_add_channel_list_2ghz(). - Use device's channel list instead of default one (from ieee80211_init_channels()). - Add ic_getradiocaps() method. Modified: head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_urtwreg.h Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Thu May 26 16:05:19 2016 (r300752) +++ head/sys/dev/usb/wlan/if_urtw.c Thu May 26 16:15:10 2016 (r300753) @@ -206,6 +206,9 @@ static uint8_t urtw_8225z2_agc[] = { 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31 }; +static const uint8_t urtw_chan_2ghz[] = + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; + static uint32_t urtw_8225_channel[] = { 0x0000, /* dummy channel 0 */ 0x085c, /* 1 */ @@ -662,6 +665,8 @@ static int urtw_raw_xmit(struct ieee802 const struct ieee80211_bpf_params *); static void urtw_scan_start(struct ieee80211com *); static void urtw_scan_end(struct ieee80211com *); +static void urtw_getradiocaps(struct ieee80211com *, int, int *, + struct ieee80211_channel[]); static void urtw_set_channel(struct ieee80211com *); static void urtw_update_mcast(struct ieee80211com *); static int urtw_tx_start(struct urtw_softc *, @@ -785,7 +790,6 @@ urtw_attach(device_t dev) struct urtw_softc *sc = device_get_softc(dev); struct usb_attach_arg *uaa = device_get_ivars(dev); struct ieee80211com *ic = &sc->sc_ic; - uint8_t bands[IEEE80211_MODE_BYTES]; uint8_t iface_index = URTW_IFACE_INDEX; /* XXX */ uint16_t n_setup; uint32_t data; @@ -877,15 +881,16 @@ urtw_attach(device_t dev) IEEE80211_C_BGSCAN | /* capable of bg scanning */ IEEE80211_C_WPA; /* 802.11i */ - memset(bands, 0, sizeof(bands)); - setbit(bands, IEEE80211_MODE_11B); - setbit(bands, IEEE80211_MODE_11G); - ieee80211_init_channels(ic, NULL, bands); + /* XXX TODO: setup regdomain if URTW_EPROM_CHANPLAN_BY_HW bit is set.*/ + + urtw_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); ieee80211_ifattach(ic); ic->ic_raw_xmit = urtw_raw_xmit; ic->ic_scan_start = urtw_scan_start; ic->ic_scan_end = urtw_scan_end; + ic->ic_getradiocaps = urtw_getradiocaps; ic->ic_set_channel = urtw_set_channel; ic->ic_updateslot = urtw_updateslot; ic->ic_vap_create = urtw_vap_create; @@ -1564,6 +1569,19 @@ urtw_scan_end(struct ieee80211com *ic) } static void +urtw_getradiocaps(struct ieee80211com *ic, + int maxchans, int *nchans, struct ieee80211_channel chans[]) +{ + uint8_t bands[IEEE80211_MODE_BYTES]; + + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, + urtw_chan_2ghz, nitems(urtw_chan_2ghz), bands, 0); +} + +static void urtw_set_channel(struct ieee80211com *ic) { struct urtw_softc *sc = ic->ic_softc; Modified: head/sys/dev/usb/wlan/if_urtwreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_urtwreg.h Thu May 26 16:05:19 2016 (r300752) +++ head/sys/dev/usb/wlan/if_urtwreg.h Thu May 26 16:15:10 2016 (r300753) @@ -253,6 +253,7 @@ /* for EEPROM */ #define URTW_EPROM_CHANPLAN 0x03 +#define URTW_EPROM_CHANPLAN_BY_HW (0x80) #define URTW_EPROM_TXPW_BASE 0x05 #define URTW_EPROM_RFCHIPID 0x06 #define URTW_EPROM_RFCHIPID_RTL8225U (5) From owner-svn-src-head@freebsd.org Thu May 26 16:39:13 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3463AB4BBBB; Thu, 26 May 2016 16:39:13 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BCB41437; Thu, 26 May 2016 16:39:12 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QGdCH2022611; Thu, 26 May 2016 16:39:12 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QGdBZY022606; Thu, 26 May 2016 16:39:11 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605261639.u4QGdBZY022606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk <avos@FreeBSD.org> Date: Thu, 26 May 2016 16:39:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300754 - in head/sys/dev: rtwn urtwn usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 16:39:13 -0000 Author: avos Date: Thu May 26 16:39:11 2016 New Revision: 300754 URL: https://svnweb.freebsd.org/changeset/base/300754 Log: urtwn, rtwn, rsu: switch to ieee80211_add_channel_list_2ghz(). - Use device's channel list instead of default one (from ieee80211_init_channels()); adds 12 - 14 2GHz channels. - Add ic_getradiocaps() method. Modified: head/sys/dev/rtwn/if_rtwn.c head/sys/dev/rtwn/if_rtwnreg.h head/sys/dev/urtwn/if_urtwn.c head/sys/dev/urtwn/if_urtwnreg.h head/sys/dev/usb/wlan/if_rsu.c Modified: head/sys/dev/rtwn/if_rtwn.c ============================================================================== --- head/sys/dev/rtwn/if_rtwn.c Thu May 26 16:15:10 2016 (r300753) +++ head/sys/dev/rtwn/if_rtwn.c Thu May 26 16:39:11 2016 (r300754) @@ -172,6 +172,8 @@ static void rtwn_set_rx_bssid_all(struct static void rtwn_set_gain(struct rtwn_softc *, uint8_t); static void rtwn_scan_start(struct ieee80211com *); static void rtwn_scan_end(struct ieee80211com *); +static void rtwn_getradiocaps(struct ieee80211com *, int, int *, + struct ieee80211_channel[]); static void rtwn_set_channel(struct ieee80211com *); static void rtwn_update_mcast(struct ieee80211com *); static void rtwn_set_chan(struct rtwn_softc *, @@ -230,6 +232,9 @@ MODULE_DEPEND(rtwn, pci, 1, 1, 1); MODULE_DEPEND(rtwn, wlan, 1, 1, 1); MODULE_DEPEND(rtwn, firmware, 1, 1, 1); +static const uint8_t rtwn_chan_2ghz[] = + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; + static int rtwn_probe(device_t dev) { @@ -251,7 +256,6 @@ rtwn_attach(device_t dev) struct rtwn_softc *sc = device_get_softc(dev); struct ieee80211com *ic = &sc->sc_ic; uint32_t lcsr; - uint8_t bands[IEEE80211_MODE_BYTES]; int i, count, error, rid; sc->sc_dev = dev; @@ -352,17 +356,18 @@ rtwn_attach(device_t dev) | IEEE80211_C_WME /* 802.11e */ ; - memset(bands, 0, sizeof(bands)); - setbit(bands, IEEE80211_MODE_11B); - setbit(bands, IEEE80211_MODE_11G); - ieee80211_init_channels(ic, NULL, bands); + /* XXX TODO: setup regdomain if R92C_CHANNEL_PLAN_BY_HW bit is set. */ + + rtwn_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); ieee80211_ifattach(ic); ic->ic_wme.wme_update = rtwn_updateedca; ic->ic_update_mcast = rtwn_update_mcast; - ic->ic_scan_start =rtwn_scan_start; + ic->ic_scan_start = rtwn_scan_start; ic->ic_scan_end = rtwn_scan_end; + ic->ic_getradiocaps = rtwn_getradiocaps; ic->ic_set_channel = rtwn_set_channel; ic->ic_raw_xmit = rtwn_raw_xmit; ic->ic_transmit = rtwn_transmit; @@ -2717,6 +2722,19 @@ rtwn_scan_end(struct ieee80211com *ic) } static void +rtwn_getradiocaps(struct ieee80211com *ic, + int maxchans, int *nchans, struct ieee80211_channel chans[]) +{ + uint8_t bands[IEEE80211_MODE_BYTES]; + + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, + rtwn_chan_2ghz, nitems(rtwn_chan_2ghz), bands, 0); +} + +static void rtwn_set_channel(struct ieee80211com *ic) { struct rtwn_softc *sc = ic->ic_softc; Modified: head/sys/dev/rtwn/if_rtwnreg.h ============================================================================== --- head/sys/dev/rtwn/if_rtwnreg.h Thu May 26 16:15:10 2016 (r300753) +++ head/sys/dev/rtwn/if_rtwnreg.h Thu May 26 16:39:11 2016 (r300754) @@ -1014,6 +1014,8 @@ struct r92c_rom { uint8_t rf_opt3; uint8_t rf_opt4; uint8_t channel_plan; +#define R92C_CHANNEL_PLAN_BY_HW 0x80 + uint8_t version; uint8_t curstomer_id; } __packed; Modified: head/sys/dev/urtwn/if_urtwn.c ============================================================================== --- head/sys/dev/urtwn/if_urtwn.c Thu May 26 16:15:10 2016 (r300753) +++ head/sys/dev/urtwn/if_urtwn.c Thu May 26 16:39:11 2016 (r300754) @@ -350,6 +350,8 @@ static void urtwn_set_rx_bssid_all(stru static void urtwn_set_gain(struct urtwn_softc *, uint8_t); static void urtwn_scan_start(struct ieee80211com *); static void urtwn_scan_end(struct ieee80211com *); +static void urtwn_getradiocaps(struct ieee80211com *, int, int *, + struct ieee80211_channel[]); static void urtwn_set_channel(struct ieee80211com *); static int urtwn_wme_update(struct ieee80211com *); static void urtwn_update_slot(struct ieee80211com *); @@ -458,6 +460,9 @@ static const struct wme_to_queue { { R92C_EDCA_VO_PARAM, URTWN_BULK_TX_VO} }; +static const uint8_t urtwn_chan_2ghz[] = + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; + static int urtwn_match(device_t self) { @@ -492,7 +497,6 @@ urtwn_attach(device_t self) struct usb_attach_arg *uaa = device_get_ivars(self); struct urtwn_softc *sc = device_get_softc(self); struct ieee80211com *ic = &sc->sc_ic; - uint8_t bands[IEEE80211_MODE_BYTES]; int error; device_set_usb_desc(self); @@ -608,17 +612,16 @@ urtwn_attach(device_t self) ic->ic_rxstream = sc->nrxchains; } - memset(bands, 0, sizeof(bands)); - setbit(bands, IEEE80211_MODE_11B); - setbit(bands, IEEE80211_MODE_11G); - if (urtwn_enable_11n) - setbit(bands, IEEE80211_MODE_11NG); - ieee80211_init_channels(ic, NULL, bands); + /* XXX TODO: setup regdomain if R92C_CHANNEL_PLAN_BY_HW bit is set. */ + + urtwn_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); ieee80211_ifattach(ic); ic->ic_raw_xmit = urtwn_raw_xmit; ic->ic_scan_start = urtwn_scan_start; ic->ic_scan_end = urtwn_scan_end; + ic->ic_getradiocaps = urtwn_getradiocaps; ic->ic_set_channel = urtwn_set_channel; ic->ic_transmit = urtwn_transmit; ic->ic_parent = urtwn_parent; @@ -4744,6 +4747,21 @@ urtwn_scan_end(struct ieee80211com *ic) } static void +urtwn_getradiocaps(struct ieee80211com *ic, + int maxchans, int *nchans, struct ieee80211_channel chans[]) +{ + uint8_t bands[IEEE80211_MODE_BYTES]; + + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + if (urtwn_enable_11n) + setbit(bands, IEEE80211_MODE_11NG); + ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, + urtwn_chan_2ghz, nitems(urtwn_chan_2ghz), bands, 0); +} + +static void urtwn_set_channel(struct ieee80211com *ic) { struct urtwn_softc *sc = ic->ic_softc; Modified: head/sys/dev/urtwn/if_urtwnreg.h ============================================================================== --- head/sys/dev/urtwn/if_urtwnreg.h Thu May 26 16:15:10 2016 (r300753) +++ head/sys/dev/urtwn/if_urtwnreg.h Thu May 26 16:39:11 2016 (r300754) @@ -1018,6 +1018,8 @@ struct r92c_rom { uint8_t rf_opt3; uint8_t rf_opt4; uint8_t channel_plan; +#define R92C_CHANNEL_PLAN_BY_HW 0x80 + uint8_t version; uint8_t customer_id; } __packed; Modified: head/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- head/sys/dev/usb/wlan/if_rsu.c Thu May 26 16:15:10 2016 (r300753) +++ head/sys/dev/usb/wlan/if_rsu.c Thu May 26 16:39:11 2016 (r300754) @@ -170,6 +170,8 @@ static struct ieee80211vap * static void rsu_vap_delete(struct ieee80211vap *); static void rsu_scan_start(struct ieee80211com *); static void rsu_scan_end(struct ieee80211com *); +static void rsu_getradiocaps(struct ieee80211com *, int, int *, + struct ieee80211_channel[]); static void rsu_set_channel(struct ieee80211com *); static void rsu_update_mcast(struct ieee80211com *); static int rsu_alloc_rx_list(struct rsu_softc *); @@ -252,6 +254,9 @@ MODULE_DEPEND(rsu, firmware, 1, 1, 1); MODULE_VERSION(rsu, 1); USB_PNP_HOST_INFO(rsu_devs); +static const uint8_t rsu_chan_2ghz[] = + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; + static uint8_t rsu_wme_ac_xfer_map[4] = { [WME_AC_BE] = RSU_BULK_TX_BE_BK, [WME_AC_BK] = RSU_BULK_TX_BE_BK, @@ -404,7 +409,6 @@ rsu_attach(device_t self) struct rsu_softc *sc = device_get_softc(self); struct ieee80211com *ic = &sc->sc_ic; int error; - uint8_t bands[IEEE80211_MODE_BYTES]; uint8_t iface_index; struct usb_interface *iface; const char *rft; @@ -534,18 +538,14 @@ rsu_attach(device_t self) ic->ic_rxstream = sc->sc_nrxstream; } - /* Set supported .11b and .11g rates. */ - memset(bands, 0, sizeof(bands)); - setbit(bands, IEEE80211_MODE_11B); - setbit(bands, IEEE80211_MODE_11G); - if (sc->sc_ht) - setbit(bands, IEEE80211_MODE_11NG); - ieee80211_init_channels(ic, NULL, bands); + rsu_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); ieee80211_ifattach(ic); ic->ic_raw_xmit = rsu_raw_xmit; ic->ic_scan_start = rsu_scan_start; ic->ic_scan_end = rsu_scan_end; + ic->ic_getradiocaps = rsu_getradiocaps; ic->ic_set_channel = rsu_set_channel; ic->ic_vap_create = rsu_vap_create; ic->ic_vap_delete = rsu_vap_delete; @@ -699,6 +699,23 @@ rsu_scan_end(struct ieee80211com *ic) } static void +rsu_getradiocaps(struct ieee80211com *ic, + int maxchans, int *nchans, struct ieee80211_channel chans[]) +{ + struct rsu_softc *sc = ic->ic_softc; + uint8_t bands[IEEE80211_MODE_BYTES]; + + /* Set supported .11b and .11g rates. */ + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + if (sc->sc_ht) + setbit(bands, IEEE80211_MODE_11NG); + ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, + rsu_chan_2ghz, nitems(rsu_chan_2ghz), bands, 0); +} + +static void rsu_set_channel(struct ieee80211com *ic __unused) { /* We are unable to switch channels, yet. */ From owner-svn-src-head@freebsd.org Thu May 26 16:48:21 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8750FB4BD76; Thu, 26 May 2016 16:48:21 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E52E1A52; Thu, 26 May 2016 16:48:21 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QGmKw5026150; Thu, 26 May 2016 16:48:20 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QGmKZ2026149; Thu, 26 May 2016 16:48:20 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605261648.u4QGmKZ2026149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk <avos@FreeBSD.org> Date: Thu, 26 May 2016 16:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300755 - head/sys/dev/bwi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 16:48:21 -0000 Author: avos Date: Thu May 26 16:48:20 2016 New Revision: 300755 URL: https://svnweb.freebsd.org/changeset/base/300755 Log: bwi: switch to ieee80211_add_channel_list_2ghz(). - Use device's channel list instead of default one (from ieee80211_init_channels()); adds 12 - 14 2GHz channels. - Add ic_getradiocaps() method. Modified: head/sys/dev/bwi/if_bwi.c Modified: head/sys/dev/bwi/if_bwi.c ============================================================================== --- head/sys/dev/bwi/if_bwi.c Thu May 26 16:39:11 2016 (r300754) +++ head/sys/dev/bwi/if_bwi.c Thu May 26 16:48:20 2016 (r300755) @@ -110,6 +110,8 @@ static int bwi_raw_xmit(struct ieee80211 const struct ieee80211_bpf_params *); static void bwi_watchdog(void *); static void bwi_scan_start(struct ieee80211com *); +static void bwi_getradiocaps(struct ieee80211com *, int, int *, + struct ieee80211_channel[]); static void bwi_set_channel(struct ieee80211com *); static void bwi_scan_end(struct ieee80211com *); static int bwi_newstate(struct ieee80211vap *, enum ieee80211_state, int); @@ -303,6 +305,9 @@ static const struct { [108] = { 7, 3 } }; +static const uint8_t bwi_chan_2ghz[] = + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; + #ifdef BWI_DEBUG #ifdef BWI_DEBUG_VERBOSE static uint32_t bwi_debug = BWI_DBG_ATTACH | BWI_DBG_INIT | BWI_DBG_TXPOWER; @@ -356,7 +361,6 @@ bwi_attach(struct bwi_softc *sc) device_t dev = sc->sc_dev; struct bwi_mac *mac; struct bwi_phy *phy; - uint8_t bands[IEEE80211_MODE_BYTES]; int i, error; BWI_LOCK_INIT(sc); @@ -453,15 +457,12 @@ bwi_attach(struct bwi_softc *sc) /* * Setup ratesets, phytype, channels and get MAC address */ - memset(bands, 0, sizeof(bands)); if (phy->phy_mode == IEEE80211_MODE_11B || phy->phy_mode == IEEE80211_MODE_11G) { - setbit(bands, IEEE80211_MODE_11B); if (phy->phy_mode == IEEE80211_MODE_11B) { ic->ic_phytype = IEEE80211_T_DS; } else { ic->ic_phytype = IEEE80211_T_OFDM; - setbit(bands, IEEE80211_MODE_11G); } bwi_get_eaddr(sc, BWI_SPROM_11BG_EADDR, ic->ic_macaddr); @@ -475,7 +476,6 @@ bwi_attach(struct bwi_softc *sc) } } else if (phy->phy_mode == IEEE80211_MODE_11A) { /* TODO:11A */ - setbit(bands, IEEE80211_MODE_11A); error = ENXIO; goto fail; } else { @@ -487,7 +487,8 @@ bwi_attach(struct bwi_softc *sc) BWI_SPROM_CARD_INFO_LOCALE); DPRINTF(sc, BWI_DBG_ATTACH, "locale: %d\n", sc->sc_locale); /* XXX use locale */ - ieee80211_init_channels(ic, NULL, bands); + bwi_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); ic->ic_softc = sc; ic->ic_name = device_get_nameunit(dev); @@ -509,6 +510,7 @@ bwi_attach(struct bwi_softc *sc) ic->ic_updateslot = bwi_updateslot; ic->ic_scan_start = bwi_scan_start; ic->ic_scan_end = bwi_scan_end; + ic->ic_getradiocaps = bwi_getradiocaps; ic->ic_set_channel = bwi_set_channel; ic->ic_transmit = bwi_transmit; ic->ic_parent = bwi_parent; @@ -1676,6 +1678,43 @@ bwi_scan_start(struct ieee80211com *ic) } static void +bwi_getradiocaps(struct ieee80211com *ic, + int maxchans, int *nchans, struct ieee80211_channel chans[]) +{ + struct bwi_softc *sc = ic->ic_softc; + struct bwi_mac *mac; + struct bwi_phy *phy; + uint8_t bands[IEEE80211_MODE_BYTES]; + + /* + * XXX First MAC is known to exist + * TODO2 + */ + mac = &sc->sc_mac[0]; + phy = &mac->mac_phy; + + memset(bands, 0, sizeof(bands)); + switch (phy->phy_mode) { + case IEEE80211_MODE_11G: + setbit(bands, IEEE80211_MODE_11G); + /* FALLTHROUGH */ + case IEEE80211_MODE_11B: + setbit(bands, IEEE80211_MODE_11B); + break; + case IEEE80211_MODE_11A: + /* TODO:11A */ + setbit(bands, IEEE80211_MODE_11A); + device_printf(sc->sc_dev, "no 11a support\n"); + return; + default: + panic("unknown phymode %d\n", phy->phy_mode); + } + + ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, + bwi_chan_2ghz, nitems(bwi_chan_2ghz), bands, 0); +} + +static void bwi_set_channel(struct ieee80211com *ic) { struct bwi_softc *sc = ic->ic_softc; From owner-svn-src-head@freebsd.org Thu May 26 16:51:39 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 783DBB4BEDD; Thu, 26 May 2016 16:51:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AB3B1D7B; Thu, 26 May 2016 16:51:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QGpc1i026892; Thu, 26 May 2016 16:51:38 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QGpcOQ026891; Thu, 26 May 2016 16:51:38 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605261651.u4QGpcOQ026891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov <kib@FreeBSD.org> Date: Thu, 26 May 2016 16:51:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300756 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 16:51:39 -0000 Author: kib Date: Thu May 26 16:51:38 2016 New Revision: 300756 URL: https://svnweb.freebsd.org/changeset/base/300756 Log: Style changes to some most outrageous violations in vm_object_collapse(). Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Thu May 26 16:48:20 2016 (r300755) +++ head/sys/vm/vm_object.c Thu May 26 16:51:38 2016 (r300756) @@ -1669,11 +1669,11 @@ vm_object_qcollapse(vm_object_t object) void vm_object_collapse(vm_object_t object) { + vm_object_t backing_object, new_backing_object; + VM_OBJECT_ASSERT_WLOCKED(object); - - while (TRUE) { - vm_object_t backing_object; + while (TRUE) { /* * Verify that the conditions are right for collapse: * @@ -1699,14 +1699,13 @@ vm_object_collapse(vm_object_t object) break; } - if ( - object->paging_in_progress != 0 || - backing_object->paging_in_progress != 0 - ) { + if (object->paging_in_progress != 0 || + backing_object->paging_in_progress != 0) { vm_object_qcollapse(object); VM_OBJECT_WUNLOCK(backing_object); break; } + /* * We know that we can either collapse the backing object (if * the parent is the only reference to it) or (perhaps) have @@ -1796,8 +1795,6 @@ vm_object_collapse(vm_object_t object) object_collapses++; } else { - vm_object_t new_backing_object; - /* * If we do not entirely shadow the backing object, * there is nothing we can do so we give up. From owner-svn-src-head@freebsd.org Thu May 26 16:53:51 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA1DAB4BFD9; Thu, 26 May 2016 16:53:51 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B80371FD3; Thu, 26 May 2016 16:53:51 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QGrovj029605; Thu, 26 May 2016 16:53:50 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QGroHo029604; Thu, 26 May 2016 16:53:50 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201605261653.u4QGroHo029604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore <ian@FreeBSD.org> Date: Thu, 26 May 2016 16:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300757 - head/sys/dev/ofw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 16:53:52 -0000 Author: ian Date: Thu May 26 16:53:50 2016 New Revision: 300757 URL: https://svnweb.freebsd.org/changeset/base/300757 Log: Fix a typo in a comment. Modified: head/sys/dev/ofw/ofw_bus_subr.h Modified: head/sys/dev/ofw/ofw_bus_subr.h ============================================================================== --- head/sys/dev/ofw/ofw_bus_subr.h Thu May 26 16:51:38 2016 (r300756) +++ head/sys/dev/ofw/ofw_bus_subr.h Thu May 26 16:53:50 2016 (r300757) @@ -114,7 +114,7 @@ phandle_t ofw_bus_find_compatible(phandl /* Helper to search for a child with a given name */ phandle_t ofw_bus_find_child(phandle_t, const char *); -/* Helper routine to find a device_t child matchig a given phandle_t */ +/* Helper routine to find a device_t child matching a given phandle_t */ device_t ofw_bus_find_child_device_by_phandle(device_t bus, phandle_t node); /* Helper routines for parsing lists */ From owner-svn-src-head@freebsd.org Thu May 26 16:59:30 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E23A4B4A0E8; Thu, 26 May 2016 16:59:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B02701201; Thu, 26 May 2016 16:59:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QGxTKk029855; Thu, 26 May 2016 16:59:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QGxTkx029854; Thu, 26 May 2016 16:59:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605261659.u4QGxTkx029854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov <kib@FreeBSD.org> Date: Thu, 26 May 2016 16:59:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300758 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 16:59:31 -0000 Author: kib Date: Thu May 26 16:59:29 2016 New Revision: 300758 URL: https://svnweb.freebsd.org/changeset/base/300758 Log: Prevent parallel object collapses. Both vm_object_collapse_scan() and swap_pager_copy() might unlock the object, which allows the parallel collapse to execute. Besides destroying the object, it also might move the reference from parent to the backing object, firing the assertion ref_count == 1. Collapses are prevented by bumping paging_in_progress counters on both the object and its backing object. Reported by: cem Tested by: pho (previous version) Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week X-Differential revision: https://reviews.freebsd.org/D6085 Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Thu May 26 16:53:50 2016 (r300757) +++ head/sys/vm/vm_object.c Thu May 26 16:59:29 2016 (r300758) @@ -1717,6 +1717,9 @@ vm_object_collapse(vm_object_t object) * case. */ if (backing_object->ref_count == 1) { + vm_object_pip_add(object, 1); + vm_object_pip_add(backing_object, 1); + /* * If there is exactly one reference to the backing * object, we can collapse it into the parent. @@ -1788,11 +1791,13 @@ vm_object_collapse(vm_object_t object) KASSERT(backing_object->ref_count == 1, ( "backing_object %p was somehow re-referenced during collapse!", backing_object)); + vm_object_pip_wakeup(backing_object); backing_object->type = OBJT_DEAD; backing_object->ref_count = 0; VM_OBJECT_WUNLOCK(backing_object); vm_object_destroy(backing_object); + vm_object_pip_wakeup(object); object_collapses++; } else { /* From owner-svn-src-head@freebsd.org Thu May 26 17:06:44 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7A63B4A347; Thu, 26 May 2016 17:06:44 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A8A81886; Thu, 26 May 2016 17:06:44 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QH6hnA033458; Thu, 26 May 2016 17:06:43 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QH6hUF033457; Thu, 26 May 2016 17:06:43 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605261706.u4QH6hUF033457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk <avos@FreeBSD.org> Date: Thu, 26 May 2016 17:06:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300759 - head/sys/dev/ral X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 17:06:44 -0000 Author: avos Date: Thu May 26 17:06:43 2016 New Revision: 300759 URL: https://svnweb.freebsd.org/changeset/base/300759 Log: ral: add missing ic_getradiocaps() assignment. Modified: head/sys/dev/ral/rt2661.c Modified: head/sys/dev/ral/rt2661.c ============================================================================== --- head/sys/dev/ral/rt2661.c Thu May 26 16:59:29 2016 (r300758) +++ head/sys/dev/ral/rt2661.c Thu May 26 17:06:43 2016 (r300759) @@ -296,6 +296,7 @@ rt2661_attach(device_t dev, int id) #endif ic->ic_scan_start = rt2661_scan_start; ic->ic_scan_end = rt2661_scan_end; + ic->ic_getradiocaps = rt2661_getradiocaps; ic->ic_set_channel = rt2661_set_channel; ic->ic_updateslot = rt2661_update_slot; ic->ic_update_promisc = rt2661_update_promisc; From owner-svn-src-head@freebsd.org Thu May 26 17:54:23 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A22E4B4B25F; Thu, 26 May 2016 17:54:23 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C8D91474; Thu, 26 May 2016 17:54:23 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from toad2.stack.nl (toad2.stack.nl [IPv6:2001:610:1108:5010::161]) by mx1.stack.nl (Postfix) with ESMTP id E9DA1B80A9; Thu, 26 May 2016 19:54:19 +0200 (CEST) Received: by toad2.stack.nl (Postfix, from userid 1677) id E10A4892B2; Thu, 26 May 2016 19:54:20 +0200 (CEST) Date: Thu, 26 May 2016 19:54:20 +0200 From: Jilles Tjoelker <jilles@stack.nl> To: John Baldwin <jhb@freebsd.org> Cc: Alan Somers <asomers@freebsd.org>, Peter Wemm <peter@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Subject: Re: svn commit: r300557 - head/usr.sbin/apmd Message-ID: <20160526175420.GA31199@stack.nl> References: <201605240315.u4O3FkMt001717@repo.freebsd.org> <CAOtMX2jU=GNKbGUeMrSHZsxd8GLe9gd-ycYZS8ST_85+ai+JBA@mail.gmail.com> <2084098.Ir36lcS1Gf@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2084098.Ir36lcS1Gf@ralph.baldwin.cx> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 17:54:23 -0000 On Tue, May 24, 2016 at 08:52:32AM -0700, John Baldwin wrote: > On Monday, May 23, 2016 09:24:41 PM Alan Somers wrote: > > On Mon, May 23, 2016 at 9:15 PM, Peter Wemm <peter@freebsd.org> wrote: > > > Author: peter > > > Date: Tue May 24 03:15:46 2016 > > > New Revision: 300557 > > > URL: https://svnweb.freebsd.org/changeset/base/300557 > > > Log: > > > It seems <sys/types.h> is a new prerequisite for <bitstring.h> after > > > r300539. Attempt to fix the build for i386. > > > Modified: > > > head/usr.sbin/apmd/apmd.c > > > head/usr.sbin/apmd/apmdlex.l > > > head/usr.sbin/apmd/apmdparse.y > > Are you sure this is necessary, even after 300544? > Actually, we try to avoid nested includes when possible for userland, > so I'd be inclined to drop the <sys/types.h> nested include and just > add <sys/types.h> to the places that need it. Userland code in the > base system is supposed to have <sys/types.h> or <sys/param.h> as the > first #include anyway (which apmd was not following), so any fixes to > userland are probably style fixes anyway. This is traditional BSD convention, but headers specified by POSIX work differently. POSIX headers can be included alone, so files that only include POSIX headers rarely need #include <sys/types.h>. This often causes some ugliness in the header file to use hidden names for things to reduce namespace pollution. Since <bitstring.h> is not specified by POSIX, it is not required to work without prerequisites. -- Jilles Tjoelker From owner-svn-src-head@freebsd.org Thu May 26 18:01:04 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 908CAB4B3CB; Thu, 26 May 2016 18:01:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 492D519EC; Thu, 26 May 2016 18:01:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QI13iq051784; Thu, 26 May 2016 18:01:03 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QI13ui051783; Thu, 26 May 2016 18:01:03 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605261801.u4QI13ui051783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd <adrian@FreeBSD.org> Date: Thu, 26 May 2016 18:01:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300760 - head/sys/dev/siba X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 18:01:04 -0000 Author: adrian Date: Thu May 26 18:01:03 2016 New Revision: 300760 URL: https://svnweb.freebsd.org/changeset/base/300760 Log: [siba] use the generic bus methods where appropriate. Submitted by: jhibbits Differential Revision: https://reviews.freebsd.org/D802 Modified: head/sys/dev/siba/siba_bwn.c Modified: head/sys/dev/siba/siba_bwn.c ============================================================================== --- head/sys/dev/siba/siba_bwn.c Thu May 26 17:06:43 2016 (r300759) +++ head/sys/dev/siba/siba_bwn.c Thu May 26 18:01:03 2016 (r300760) @@ -177,43 +177,17 @@ siba_bwn_detach(device_t dev) } static int -siba_bwn_shutdown(device_t dev) -{ - device_t *devlistp; - int devcnt, error = 0, i; - - error = device_get_children(dev, &devlistp, &devcnt); - if (error != 0) - return (error); - - for (i = 0 ; i < devcnt ; i++) - device_shutdown(devlistp[i]); - free(devlistp, M_TEMP); - return (0); -} - -static int siba_bwn_suspend(device_t dev) { struct siba_bwn_softc *ssc = device_get_softc(dev); struct siba_softc *siba = &ssc->ssc_siba; - device_t *devlistp; - int devcnt, error = 0, i, j; + int error; + + error = bus_generic_suspend(dev); - error = device_get_children(dev, &devlistp, &devcnt); if (error != 0) return (error); - for (i = 0 ; i < devcnt ; i++) { - error = DEVICE_SUSPEND(devlistp[i]); - if (error) { - for (j = 0; j < i; j++) - DEVICE_RESUME(devlistp[j]); - free(devlistp, M_TEMP); - return (error); - } - } - free(devlistp, M_TEMP); return (siba_core_suspend(siba)); } @@ -222,20 +196,14 @@ siba_bwn_resume(device_t dev) { struct siba_bwn_softc *ssc = device_get_softc(dev); struct siba_softc *siba = &ssc->ssc_siba; - device_t *devlistp; - int devcnt, error = 0, i; + int error; error = siba_core_resume(siba); if (error != 0) return (error); - error = device_get_children(dev, &devlistp, &devcnt); - if (error != 0) - return (error); + bus_generic_resume(dev); - for (i = 0 ; i < devcnt ; i++) - DEVICE_RESUME(devlistp[i]); - free(devlistp, M_TEMP); return (0); } @@ -410,7 +378,7 @@ static device_method_t siba_bwn_methods[ DEVMETHOD(device_probe, siba_bwn_probe), DEVMETHOD(device_attach, siba_bwn_attach), DEVMETHOD(device_detach, siba_bwn_detach), - DEVMETHOD(device_shutdown, siba_bwn_shutdown), + DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, siba_bwn_suspend), DEVMETHOD(device_resume, siba_bwn_resume), From owner-svn-src-head@freebsd.org Thu May 26 18:18:09 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B04AB4B852; Thu, 26 May 2016 18:18:09 +0000 (UTC) (envelope-from peter@wemm.org) Received: from smtp2.wemm.org (smtp2.wemm.org [IPv6:2001:470:67:39d::78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp2.wemm.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1794412CD; Thu, 26 May 2016 18:18:09 +0000 (UTC) (envelope-from peter@wemm.org) Received: from overcee.wemm.org (canning.wemm.org [192.203.228.65]) by smtp2.wemm.org (Postfix) with ESMTP id C3DC7CCD; Thu, 26 May 2016 11:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=m20140428; t=1464286688; bh=TIlevw0EqVITpSr4tPhOTiHmfKvwMHR7FBuekkRJoaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=iZkyHnQmOf+MVqHEaS5yQ6y/i2kIIKLzZU9cWtpNK/dKVa3XWf8dBzmCaCdMbnLsi nmPX/L0tDZ+G4KFndahw0Ml9mVFVpLI7wSxlWMmekJKudWv/EaVvqyuMCsCp7Aexsj 28AYhm/Pr1vEvq4IZUiUB3XrQGs89E3CHVNjrrdA= From: Peter Wemm <peter@wemm.org> To: Jilles Tjoelker <jilles@stack.nl> Cc: John Baldwin <jhb@freebsd.org>, Alan Somers <asomers@freebsd.org>, Peter Wemm <peter@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Subject: Re: svn commit: r300557 - head/usr.sbin/apmd Date: Thu, 26 May 2016 11:18:03 -0700 Message-ID: <47237366.96sRQ3voAD@overcee.wemm.org> User-Agent: KMail/4.14.3 (FreeBSD/11.0-CURRENT; KDE/4.14.3; amd64; ; ) In-Reply-To: <20160526175420.GA31199@stack.nl> References: <201605240315.u4O3FkMt001717@repo.freebsd.org> <2084098.Ir36lcS1Gf@ralph.baldwin.cx> <20160526175420.GA31199@stack.nl> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1848827.f2x5KYXUg7"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 18:18:09 -0000 --nextPart1848827.f2x5KYXUg7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" On Thursday, May 26, 2016 07:54:20 PM Jilles Tjoelker wrote: > On Tue, May 24, 2016 at 08:52:32AM -0700, John Baldwin wrote: > > On Monday, May 23, 2016 09:24:41 PM Alan Somers wrote: > > > On Mon, May 23, 2016 at 9:15 PM, Peter Wemm <peter@freebsd.org> w= rote: > > > > Author: peter > > > > Date: Tue May 24 03:15:46 2016 > > > > New Revision: 300557 > > > > URL: https://svnweb.freebsd.org/changeset/base/300557 > > > >=20 > > > > Log: > > > > It seems <sys/types.h> is a new prerequisite for <bitstring.h= > after > > > > r300539. Attempt to fix the build for i386. > > > >=20 > > > > Modified: > > > > head/usr.sbin/apmd/apmd.c > > > > head/usr.sbin/apmd/apmdlex.l > > > > head/usr.sbin/apmd/apmdparse.y > > >=20 > > > Are you sure this is necessary, even after 300544? > >=20 > > Actually, we try to avoid nested includes when possible for userlan= d, > > so I'd be inclined to drop the <sys/types.h> nested include and jus= t > > add <sys/types.h> to the places that need it. Userland code in the= > > base system is supposed to have <sys/types.h> or <sys/param.h> as t= he > > first #include anyway (which apmd was not following), so any fixes = to > > userland are probably style fixes anyway. >=20 > This is traditional BSD convention, but headers specified by POSIX wo= rk > differently. POSIX headers can be included alone, so files that only > include POSIX headers rarely need #include <sys/types.h>. This often > causes some ugliness in the header file to use hidden names for thing= s > to reduce namespace pollution. >=20 > Since <bitstring.h> is not specified by POSIX, it is not required to > work without prerequisites. FWIW I have no investment in the commit I made - I needed it to compile= for=20 the cluster. Feel free to change/revert my commit so long as world com= piles. =2D-=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI= 6FJV UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246 --nextPart1848827.f2x5KYXUg7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJXRz3bAAoJEDXWlwnsgJ4EgQIIANHjw5AVkQjvTr9493oSXrqD qLb5GQLL95B2CMcTK8R121R2AEnaK/QsvebrIwMSrvD7EiKZbvKoCmTWy0tIjMc3 YumfZ0TmCw9NMbQ3rZR1LtECyxKshz+tc8EtfnbipUxZJrc75AFY5txzgQSwNvAN aMKrj9XSk9jCSmjXqa6X/gNzDjg9M73M7L4rzZSq6pEkyYvIk8mXNldKtJfcQ7c0 Lkv64X2TNUtOlNTHQ0ARY2DrIh0rMKdOEhOXSBMab5lHK5C+N5dUy1caIjOHGkxT j+00YGKBWg4xchPLg5ZlFQED+ZEP6zSPPwuMWC0zPzRmEaR4D4kBHg5MZt9HP28= =mt8b -----END PGP SIGNATURE----- --nextPart1848827.f2x5KYXUg7-- From owner-svn-src-head@freebsd.org Thu May 26 18:24:01 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A707B4BA58; Thu, 26 May 2016 18:24:01 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D2741A5B; Thu, 26 May 2016 18:24:01 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QIO0rr062742; Thu, 26 May 2016 18:24:00 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QIO0if062741; Thu, 26 May 2016 18:24:00 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201605261824.u4QIO0if062741@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber <gjb@FreeBSD.org> Date: Thu, 26 May 2016 18:24:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300761 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 18:24:01 -0000 Author: gjb Date: Thu May 26 18:24:00 2016 New Revision: 300761 URL: https://svnweb.freebsd.org/changeset/base/300761 Log: Disconnect the AZURE target from the CLOUDWARE list. Microsoft has graciously overtaken publication of FreeBSD on Azure since 10.3-RELEASE. Many thanks to Microsoft for their support of FreeBSD on Azure. The configuration file and Makefile.azure are not (yet) planned to be removed, as they may be useful in the future. Sponsored by: The FreeBSD Foundation Modified: head/release/Makefile.vm Modified: head/release/Makefile.vm ============================================================================== --- head/release/Makefile.vm Thu May 26 18:01:03 2016 (r300760) +++ head/release/Makefile.vm Thu May 26 18:24:00 2016 (r300761) @@ -15,8 +15,7 @@ VMDK_DESC= VMWare, VirtualBox disk image QCOW2_DESC= Qemu, KVM disk image RAW_DESC= Unformatted raw disk image -CLOUDWARE?= AZURE \ - EC2 \ +CLOUDWARE?= EC2 \ GCE \ OPENSTACK \ VAGRANT-VIRTUALBOX \ From owner-svn-src-head@freebsd.org Thu May 26 18:26:45 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9997B4BB2F; Thu, 26 May 2016 18:26:45 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA4CB1C9B; Thu, 26 May 2016 18:26:45 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QIQi8e062913; Thu, 26 May 2016 18:26:44 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QIQipa062912; Thu, 26 May 2016 18:26:44 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201605261826.u4QIQipa062912@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber <gjb@FreeBSD.org> Date: Thu, 26 May 2016 18:26:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300762 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 18:26:46 -0000 Author: gjb Date: Thu May 26 18:26:44 2016 New Revision: 300762 URL: https://svnweb.freebsd.org/changeset/base/300762 Log: Disconnect the OPENSTACK target from the CLOUDWARE list. This was reported to not work as expected, and feedback following the report was never received. In addition, we do not publish these anywhere publicly. The configuration file is not (yet) removed, in hopes that the remaining details on the original issues can be resolved, and we can publish the resulting images in the future. Sponsored by: The FreeBSD Foundation Modified: head/release/Makefile.vm Modified: head/release/Makefile.vm ============================================================================== --- head/release/Makefile.vm Thu May 26 18:24:00 2016 (r300761) +++ head/release/Makefile.vm Thu May 26 18:26:44 2016 (r300762) @@ -17,7 +17,6 @@ RAW_DESC= Unformatted raw disk image CLOUDWARE?= EC2 \ GCE \ - OPENSTACK \ VAGRANT-VIRTUALBOX \ VAGRANT-VMWARE AZURE_FORMAT= vhdf From owner-svn-src-head@freebsd.org Thu May 26 18:28:11 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A3E4B4BBB7; Thu, 26 May 2016 18:28:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A6CB1E15; Thu, 26 May 2016 18:28:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QISAHw063004; Thu, 26 May 2016 18:28:10 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QISA6e063003; Thu, 26 May 2016 18:28:10 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201605261828.u4QISA6e063003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin <jhb@FreeBSD.org> Date: Thu, 26 May 2016 18:28:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300763 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 18:28:11 -0000 Author: jhb Date: Thu May 26 18:28:10 2016 New Revision: 300763 URL: https://svnweb.freebsd.org/changeset/base/300763 Log: Update default KMODDIR in comment after r299393. Submitted by: hselasky Modified: head/share/mk/bsd.own.mk Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Thu May 26 18:26:44 2016 (r300762) +++ head/share/mk/bsd.own.mk Thu May 26 18:28:10 2016 (r300763) @@ -49,7 +49,7 @@ # # # KMODDIR Base path for loadable kernel modules -# (see kld(4)). [/boot/kernel] +# (see kld(4)). [/boot/module] # # KMODOWN Kernel and KLD owner. [${BINOWN}] # From owner-svn-src-head@freebsd.org Thu May 26 18:28:38 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E558CB4BC06; Thu, 26 May 2016 18:28:38 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6D9D1F8B; Thu, 26 May 2016 18:28:38 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A4ED0B97D; Thu, 26 May 2016 14:28:37 -0400 (EDT) From: John Baldwin <jhb@freebsd.org> To: Hans Petter Selasky <hps@selasky.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r299393 - in head: . share/mk Date: Thu, 26 May 2016 11:28:33 -0700 Message-ID: <6335113.N7gIF2Maer@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <08cfa0ac-ad92-c8f9-2141-e72088b17d41@selasky.org> References: <201605102232.u4AMWNvp000287@repo.freebsd.org> <08cfa0ac-ad92-c8f9-2141-e72088b17d41@selasky.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 26 May 2016 14:28:37 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 18:28:39 -0000 On Wednesday, May 25, 2016 03:27:07 PM Hans Petter Selasky wrote: > On 05/11/16 00:32, John Baldwin wrote: > > Author: jhb > > Date: Tue May 10 22:32:23 2016 > > New Revision: 299393 > > URL: https://svnweb.freebsd.org/changeset/base/299393 > > > > Log: > > Change the default installation directory for modules to /boot/modules. > > > > Kernel installs always override KMODDIR when installing modules, so > > this default setting is only used for standalone module builds. Many > > out-of-tree modules manually override KMODDIR already to avoid placing > > modules in /boot/kernel. This now makes that behavior the default. > > > > Discussed on: arch@ > > Reviewed by: imp > > Relnotes: yes > > > > Just a small nit: > > There is a comment in bsd.own.mk which needs updating too: > > > # > > # KMODDIR Base path for loadable kernel modules > > # (see kld(4)). [/boot/kernel] Oops, thanks. Fixed. -- John Baldwin From owner-svn-src-head@freebsd.org Thu May 26 18:35:38 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEBF0B4BE29; Thu, 26 May 2016 18:35:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 719A214EB; Thu, 26 May 2016 18:35:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QIZbSN066705; Thu, 26 May 2016 18:35:37 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QIZblp066704; Thu, 26 May 2016 18:35:37 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201605261835.u4QIZblp066704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin <jhb@FreeBSD.org> Date: Thu, 26 May 2016 18:35:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300764 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 18:35:38 -0000 Author: jhb Date: Thu May 26 18:35:37 2016 New Revision: 300764 URL: https://svnweb.freebsd.org/changeset/base/300764 Log: Don't reuse the source mbuf in tcp_respond() if it is not writable. Not all mbufs passed up from device drivers are M_WRITABLE(). In particular, the Chelsio T4/T5 driver uses a feature called "buffer packing" to receive multiple frames in a single receive buffer. The mbufs for these frames all share the same external storage so are treated as read-only by the rest of the stack when multiple frames are in flight. Previously tcp_respond() would blindly overwrite read-only mbufs when INVARIANTS was disabled or panic with an assertion failure if INVARIANTS was enabled. Note that the new case is a bit of a mix of the two other cases in tcp_respond(). The TCP and IP headers must be copied explicitly into the new mbuf instead of being inherited (similar to the m == NULL case), but the addresses and ports must be swapped in the reply (similar to the m != NULL case). Reviewed by: glebius Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Thu May 26 18:28:10 2016 (r300763) +++ head/sys/netinet/tcp_subr.c Thu May 26 18:35:37 2016 (r300764) @@ -934,16 +934,54 @@ tcp_respond(struct tcpcb *tp, void *ipge } bcopy((caddr_t)th, (caddr_t)nth, sizeof(struct tcphdr)); flags = TH_ACK; + } else if (!M_WRITABLE(m)) { + struct mbuf *n; + + /* Can't reuse 'm', allocate a new mbuf. */ + n = m_gethdr(M_NOWAIT, MT_DATA); + if (n == NULL) { + m_freem(m); + return; + } + + if (!m_dup_pkthdr(n, m, M_NOWAIT)) { + m_freem(m); + m_freem(n); + return; + } + + n->m_data += max_linkhdr; + /* m_len is set later */ +#define xchg(a,b,type) { type t; t=a; a=b; b=t; } +#ifdef INET6 + if (isipv6) { + bcopy((caddr_t)ip6, mtod(n, caddr_t), + sizeof(struct ip6_hdr)); + ip6 = mtod(n, struct ip6_hdr *); + xchg(ip6->ip6_dst, ip6->ip6_src, struct in6_addr); + nth = (struct tcphdr *)(ip6 + 1); + } else +#endif /* INET6 */ + { + bcopy((caddr_t)ip, mtod(n, caddr_t), sizeof(struct ip)); + ip = mtod(n, struct ip *); + xchg(ip->ip_dst.s_addr, ip->ip_src.s_addr, uint32_t); + nth = (struct tcphdr *)(ip + 1); + } + bcopy((caddr_t)th, (caddr_t)nth, sizeof(struct tcphdr)); + xchg(nth->th_dport, nth->th_sport, uint16_t); + th = nth; + m_freem(m); + m = n; } else { /* * reuse the mbuf. - * XXX MRT We inherrit the FIB, which is lucky. + * XXX MRT We inherit the FIB, which is lucky. */ m_freem(m->m_next); m->m_next = NULL; m->m_data = (caddr_t)ipgen; /* m_len is set later */ -#define xchg(a,b,type) { type t; t=a; a=b; b=t; } #ifdef INET6 if (isipv6) { xchg(ip6->ip6_dst, ip6->ip6_src, struct in6_addr); From owner-svn-src-head@freebsd.org Thu May 26 18:48:38 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81F4AB4B0BB; Thu, 26 May 2016 18:48:38 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFD81E5C; Thu, 26 May 2016 18:48:38 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QImbC9070492; Thu, 26 May 2016 18:48:37 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QImbaT070491; Thu, 26 May 2016 18:48:37 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201605261848.u4QImbaT070491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber <gjb@FreeBSD.org> Date: Thu, 26 May 2016 18:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300767 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 18:48:38 -0000 Author: gjb Date: Thu May 26 18:48:37 2016 New Revision: 300767 URL: https://svnweb.freebsd.org/changeset/base/300767 Log: Remove the cw*-install target. All operations are performed on the original output file, and nothing is ever done with the copied file (as in, no modifications and/or publication from the copied file). Sponsored by: The FreeBSD Foundation Modified: head/release/Makefile.vm Modified: head/release/Makefile.vm ============================================================================== --- head/release/Makefile.vm Thu May 26 18:39:18 2016 (r300766) +++ head/release/Makefile.vm Thu May 26 18:48:37 2016 (r300767) @@ -62,15 +62,6 @@ cw-${_CW:tl}: -S ${WORLDDIR} -o ${.OBJDIR}/${${_CW}IMAGE} -c ${${_CW}CONF} touch ${.TARGET} -cw${_CW:tl}-install: - mkdir -p ${DESTDIR}/${_CW:tl} - cp -p ${${_CW}IMAGE} \ - ${DESTDIR}/${_CW:tl}/${${_CW}_DISK} - cd ${DESTDIR}/${_CW:tl} && sha512 ${${_CW}_DISK}* > \ - ${DESTDIR}/${_CW:tl}/CHECKSUM.SHA512 - cd ${DESTDIR}/${_CW:tl} && sha256 ${${_CW}_DISK}* > \ - ${DESTDIR}/${_CW:tl}/CHECKSUM.SHA256 - cw${_CW:tl}-package: @# Special target to handle packaging cloud images in the formats @# specific to each hosting provider. From owner-svn-src-head@freebsd.org Thu May 26 18:50:58 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A20F3B4B12E; Thu, 26 May 2016 18:50:58 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F427106E; Thu, 26 May 2016 18:50:58 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QIovA6071202; Thu, 26 May 2016 18:50:57 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QIovbY071201; Thu, 26 May 2016 18:50:57 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201605261850.u4QIovbY071201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber <gjb@FreeBSD.org> Date: Thu, 26 May 2016 18:50:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300768 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 18:50:58 -0000 Author: gjb Date: Thu May 26 18:50:57 2016 New Revision: 300768 URL: https://svnweb.freebsd.org/changeset/base/300768 Log: Update a commented line to replace recently-removed images with images that are published. Sponsored by: The FreeBSD Foundation Modified: head/release/release.conf.sample Modified: head/release/release.conf.sample ============================================================================== --- head/release/release.conf.sample Thu May 26 18:48:37 2016 (r300767) +++ head/release/release.conf.sample Thu May 26 18:50:57 2016 (r300768) @@ -109,4 +109,4 @@ PORTBRANCH="ports/head@rHEAD" ## If WITH_CLOUDWARE is set to a non-empty value, this is a list of providers ## to create disk images. -#CLOUDWARE="AZURE OPENSTACK" +#CLOUDWARE="EC2 GCE VAGRANT-VIRTUALBOX VAGRANT-VMWARE" From owner-svn-src-head@freebsd.org Thu May 26 18:52:28 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E0F7B4B278; Thu, 26 May 2016 18:52:28 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3DF713DE; Thu, 26 May 2016 18:52:27 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QIqRrL073898; Thu, 26 May 2016 18:52:27 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QIqRGn073897; Thu, 26 May 2016 18:52:27 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201605261852.u4QIqRGn073897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza <loos@FreeBSD.org> Date: Thu, 26 May 2016 18:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300769 - head/sys/arm/ti X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 18:52:28 -0000 Author: loos Date: Thu May 26 18:52:26 2016 New Revision: 300769 URL: https://svnweb.freebsd.org/changeset/base/300769 Log: Only do the touch screen setup when the 'ti,wires' property is present. While here fix a typo in a debug message. Modified: head/sys/arm/ti/ti_adc.c Modified: head/sys/arm/ti/ti_adc.c ============================================================================== --- head/sys/arm/ti/ti_adc.c Thu May 26 18:50:57 2016 (r300768) +++ head/sys/arm/ti/ti_adc.c Thu May 26 18:52:26 2016 (r300769) @@ -732,7 +732,7 @@ ti_adc_attach(device_t dev) sc->sc_charge_delay = DEFAULT_CHARGE_DELAY; /* Read "tsc" node properties */ child = ofw_bus_find_child(node, "tsc"); - if (child != 0) { + if (child != 0 && OF_hasprop(child, "ti,wires")) { if ((OF_getprop(child, "ti,wires", &cell, sizeof(cell))) > 0) sc->sc_tsc_wires = fdt32_to_cpu(cell); if ((OF_getprop(child, "ti,coordinate-readouts", &cell, sizeof(cell))) > 0) @@ -745,7 +745,7 @@ ti_adc_attach(device_t dev) sizeof(*wire_configs), (void **)&wire_configs); if (nwire_configs != sc->sc_tsc_wires) { device_printf(sc->sc_dev, - "invalid nubmer of ti,wire-config: %d (should be %d)\n", + "invalid number of ti,wire-config: %d (should be %d)\n", nwire_configs, sc->sc_tsc_wires); OF_prop_free(wire_configs); return (EINVAL); From owner-svn-src-head@freebsd.org Thu May 26 18:52:50 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB634B4B2C1; Thu, 26 May 2016 18:52:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89D4716CE; Thu, 26 May 2016 18:52:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QIqnj8073958; Thu, 26 May 2016 18:52:49 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QIqn5w073953; Thu, 26 May 2016 18:52:49 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201605261852.u4QIqn5w073953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric <dim@FreeBSD.org> Date: Thu, 26 May 2016 18:52:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300770 - in head: . contrib/libc++/include contrib/libc++/include/experimental contrib/libc++/include/ext contrib/libc++/src contrib/libc++/src/include contrib/libc++/src/support lib/l... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 18:52:51 -0000 Author: dim Date: Thu May 26 18:52:49 2016 New Revision: 300770 URL: https://svnweb.freebsd.org/changeset/base/300770 Log: Update libc++ to 3.8.0. Excerpted list of fixes (with upstream revision numbers): r242679 Implement the plugin-based version of std::search. There are no searchers yet; those are coming soon. r242682 Implement the default searcher for std::experimental::search. r243728 Add <experimental/any> v2. r245330 implement more of N4258 - Cleaning up noexcept in the standard library. Specifically add new noexcept stuff to vector and string's move-assignment operations r245334 Fix PR22606 - Leak pthread_key with static storage duration to ensure all of thread-local destructors are called. r245335 Fix PR23589: std::function doesn't recognize null pointer to varargs function. r247036 Implementation of Boyer-Moore and Boyer-Moore-Horspool searchers for the LFTS. r249325 Implement LWG#2063, and update the issues links to point to the github generated pages r249738 Split <ctype.h> out of <cctype>. r249739 Split <errno.h> out of <cerrno>. r249740 Split <float.h> out of <cfloat>. r249741 Split <inttypes.h> out of <cinttypes>. r249742 Split <math.h> out of <cmath>. r249743 Split <setjmp.h> out of <csetjmp>. r249761 Split <stddef.h> out of <cstddef>. r249798 Split <stdio.h> out of <cstdio>. r249800 Split <stdlib.h> out of <cstdlib>. r249889 Split <wchar.h> out of <cwchar>. r249890 Split <wctype.h> out of <cwctype>. r249929 Split <string.h> out of <cstring>. r250254 ABI versioning macros for libc++. r251246 Fix LWG#2244: basic_istream::seekg r251247 Fix LWG#2127: Move-construction with raw_storage_iterator. r251253 Fix LWG#2476: scoped_allocator_adaptor is not assignable r251257 Fix LWG#2489: mem_fn() should be noexcept r251618 Implement P0004R1 'Remove Deprecated iostreams aliases' r251766 Implement the first part of P0006R0: Adopt Type Traits Variable Templates for C++17. r252195 Implement P0092R1 for C++1z r252350 Allow deque to handle incomplete types. r252406 More of P0006R0: type traits variable aliases for C++17. r252407 Implement LWG#2353: std::next is over-constrained r252905 Implement P0074: Making owner_less more flexible r253215 Implement P0013R1: Logical Operator Type Traits. r253274 Implement P0007: Constant View: A proposal for a std::as_const helper function template. r254119 Add static_assert to set/multiset/map/multimap/forward_list/deque that the allocator's value_type match the container's value_type. r254283 Implement more of P0006; Type Traits Variable Templates. r255941 LWG2485: get() should be overloaded for const tuple&&. r256325 Fix LWG Issue #2367 - Fixing std::tuple and std::pair's default constructors. r256652 Fix for ALL undefined behavior in <list>. r256859 First half of LWG#2354: 'Unnecessary copying when inserting into maps with braced-init syntax' Exp-run: antoine Relnotes: yes Added: head/contrib/libc++/include/__nullptr - copied unchanged from r298146, vendor/libc++/dist/include/__nullptr head/contrib/libc++/include/ctype.h - copied unchanged from r298146, vendor/libc++/dist/include/ctype.h head/contrib/libc++/include/errno.h - copied unchanged from r298146, vendor/libc++/dist/include/errno.h head/contrib/libc++/include/experimental/any - copied unchanged from r298146, vendor/libc++/dist/include/experimental/any head/contrib/libc++/include/experimental/functional - copied unchanged from r298146, vendor/libc++/dist/include/experimental/functional head/contrib/libc++/include/float.h - copied unchanged from r298146, vendor/libc++/dist/include/float.h head/contrib/libc++/include/inttypes.h - copied unchanged from r298146, vendor/libc++/dist/include/inttypes.h head/contrib/libc++/include/math.h - copied unchanged from r298146, vendor/libc++/dist/include/math.h head/contrib/libc++/include/setjmp.h - copied unchanged from r298146, vendor/libc++/dist/include/setjmp.h head/contrib/libc++/include/stddef.h - copied unchanged from r298146, vendor/libc++/dist/include/stddef.h head/contrib/libc++/include/stdio.h - copied unchanged from r298146, vendor/libc++/dist/include/stdio.h head/contrib/libc++/include/stdlib.h - copied unchanged from r298146, vendor/libc++/dist/include/stdlib.h head/contrib/libc++/include/wchar.h - copied unchanged from r298146, vendor/libc++/dist/include/wchar.h head/contrib/libc++/include/wctype.h - copied unchanged from r298146, vendor/libc++/dist/include/wctype.h head/contrib/libc++/src/any.cpp - copied unchanged from r298146, vendor/libc++/dist/src/any.cpp head/contrib/libc++/src/include/ - copied from r298146, vendor/libc++/dist/src/include/ Deleted: head/contrib/libc++/src/config_elast.h head/contrib/libc++/src/support/ Modified: head/Makefile.inc1 head/contrib/libc++/include/__config head/contrib/libc++/include/__functional_03 head/contrib/libc++/include/__functional_base head/contrib/libc++/include/__functional_base_03 head/contrib/libc++/include/__hash_table head/contrib/libc++/include/__locale head/contrib/libc++/include/__mutex_base head/contrib/libc++/include/__split_buffer head/contrib/libc++/include/__tree head/contrib/libc++/include/__tuple head/contrib/libc++/include/algorithm head/contrib/libc++/include/array head/contrib/libc++/include/atomic head/contrib/libc++/include/bitset head/contrib/libc++/include/cctype head/contrib/libc++/include/cerrno head/contrib/libc++/include/cfenv head/contrib/libc++/include/cfloat head/contrib/libc++/include/chrono head/contrib/libc++/include/cinttypes head/contrib/libc++/include/cmath head/contrib/libc++/include/complex.h head/contrib/libc++/include/condition_variable head/contrib/libc++/include/csetjmp head/contrib/libc++/include/cstddef head/contrib/libc++/include/cstdio head/contrib/libc++/include/cstdlib head/contrib/libc++/include/cwchar head/contrib/libc++/include/cwctype head/contrib/libc++/include/deque head/contrib/libc++/include/exception head/contrib/libc++/include/experimental/algorithm head/contrib/libc++/include/experimental/dynarray head/contrib/libc++/include/ext/hash_map head/contrib/libc++/include/forward_list head/contrib/libc++/include/functional head/contrib/libc++/include/future head/contrib/libc++/include/ios head/contrib/libc++/include/istream head/contrib/libc++/include/iterator head/contrib/libc++/include/limits head/contrib/libc++/include/list head/contrib/libc++/include/locale head/contrib/libc++/include/map head/contrib/libc++/include/memory head/contrib/libc++/include/module.modulemap head/contrib/libc++/include/mutex head/contrib/libc++/include/random head/contrib/libc++/include/ratio head/contrib/libc++/include/regex head/contrib/libc++/include/scoped_allocator head/contrib/libc++/include/set head/contrib/libc++/include/string head/contrib/libc++/include/thread head/contrib/libc++/include/tuple head/contrib/libc++/include/type_traits head/contrib/libc++/include/unordered_map head/contrib/libc++/include/utility head/contrib/libc++/include/valarray head/contrib/libc++/include/vector head/contrib/libc++/src/exception.cpp head/contrib/libc++/src/future.cpp head/contrib/libc++/src/ios.cpp head/contrib/libc++/src/locale.cpp head/contrib/libc++/src/memory.cpp head/contrib/libc++/src/mutex.cpp head/contrib/libc++/src/new.cpp head/contrib/libc++/src/stdexcept.cpp head/contrib/libc++/src/system_error.cpp head/contrib/libc++/src/typeinfo.cpp head/lib/libc++/Makefile Directory Properties: head/contrib/libc++/ (props changed) Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu May 26 18:52:26 2016 (r300769) +++ head/Makefile.inc1 Thu May 26 18:52:49 2016 (r300770) @@ -500,7 +500,7 @@ HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MT HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT .endif -CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \ +CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCXXFLAGS} ${XCFLAGS}" \ CPP="${XCPP} ${XCFLAGS}" \ AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \ Modified: head/contrib/libc++/include/__config ============================================================================== --- head/contrib/libc++/include/__config Thu May 26 18:52:26 2016 (r300769) +++ head/contrib/libc++/include/__config Thu May 26 18:52:49 2016 (r300770) @@ -11,19 +11,37 @@ #ifndef _LIBCPP_CONFIG #define _LIBCPP_CONFIG -#if !defined(_MSC_VER) || defined(__clang__) +#if defined(_MSC_VER) && !defined(__clang__) +#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER +#endif + +#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER #pragma GCC system_header #endif +#ifdef __cplusplus + #ifdef __GNUC__ #define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) #else #define _GNUC_VER 0 #endif -#define _LIBCPP_VERSION 3700 +#define _LIBCPP_VERSION 3800 +#ifndef _LIBCPP_ABI_VERSION #define _LIBCPP_ABI_VERSION 1 +#endif + +#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 +// Change short string represention so that string data starts at offset 0, +// improving its alignment in some cases. +#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT +// Fix deque iterator type in order to support incomplete types. +#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE +// Fix undefined behavior in how std::list stores it's linked nodes. +#define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB +#endif #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y #define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) @@ -37,6 +55,9 @@ #ifndef __has_builtin #define __has_builtin(__x) 0 #endif +#ifndef __has_extension +#define __has_extension(__x) 0 +#endif #ifndef __has_feature #define __has_feature(__x) 0 #endif @@ -61,6 +82,16 @@ #endif // __BIG_ENDIAN__ #endif // __BIG_ENDIAN__ +#ifdef __BYTE_ORDER__ +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define _LIBCPP_LITTLE_ENDIAN 1 +#define _LIBCPP_BIG_ENDIAN 0 +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +#define _LIBCPP_LITTLE_ENDIAN 0 +#define _LIBCPP_BIG_ENDIAN 1 +#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +#endif // __BYTE_ORDER__ + #ifdef __FreeBSD__ # include <sys/endian.h> # if _BYTE_ORDER == _LITTLE_ENDIAN @@ -227,9 +258,12 @@ #if defined(__clang__) -#if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \ - !defined(__arm__) -#define _LIBCPP_ALTERNATE_STRING_LAYOUT +// _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for +// _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility. +#if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \ + !defined(__arm__)) || \ + defined(_LIBCPP_ALTERNATE_STRING_LAYOUT) +#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT #endif #if __has_feature(cxx_alignas) @@ -273,6 +307,10 @@ typedef __char32_t char32_t; #define _LIBCPP_UNUSED __attribute__((__unused__)) +#if !(__has_feature(cxx_default_function_template_args)) +#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS +#endif + #if !(__has_feature(cxx_defaulted_functions)) #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS #endif // !(__has_feature(cxx_defaulted_functions)) @@ -354,14 +392,19 @@ typedef __char32_t char32_t; #elif defined(__ANDROID__) #define _LIBCPP_HAS_QUICK_EXIT #elif defined(__linux__) -#include <features.h> +#if !defined(_LIBCPP_HAS_MUSL_LIBC) +# include <features.h> #if __GLIBC_PREREQ(2, 15) #define _LIBCPP_HAS_QUICK_EXIT #endif #if __GLIBC_PREREQ(2, 17) #define _LIBCPP_HAS_C11_FEATURES #endif +#else // defined(_LIBCPP_HAS_MUSL_LIBC) +#define _LIBCPP_HAS_QUICK_EXIT +#define _LIBCPP_HAS_C11_FEATURES #endif +#endif // __linux__ #endif #if !(__has_feature(cxx_noexcept)) @@ -390,6 +433,11 @@ namespace std { #define _LIBCPP_HAS_NO_ASAN #endif +// Allow for build-time disabling of unsigned integer sanitization +#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute((no_sanitize("unsigned-integer-overflow"))) +#endif + #elif defined(__GNUC__) #define _ALIGNAS(x) __attribute__((__aligned__(x))) @@ -437,6 +485,7 @@ namespace std { #define _LIBCPP_HAS_NO_ADVANCED_SFINAE #define _LIBCPP_HAS_NO_DECLTYPE +#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS #define _LIBCPP_HAS_NO_NULLPTR @@ -444,22 +493,18 @@ namespace std { #define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_HAS_NO_RVALUE_REFERENCES -#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS #define _LIBCPP_HAS_NO_STRONG_ENUMS #define _LIBCPP_HAS_NO_NOEXCEPT #else // __GXX_EXPERIMENTAL_CXX0X__ -#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS - #if _GNUC_VER < 403 +#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS #define _LIBCPP_HAS_NO_RVALUE_REFERENCES -#endif - -#if _GNUC_VER < 403 #define _LIBCPP_HAS_NO_STATIC_ASSERT #endif + #if _GNUC_VER < 404 #define _LIBCPP_HAS_NO_DECLTYPE #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS @@ -498,7 +543,6 @@ using namespace _LIBCPP_NAMESPACE __attr #elif defined(_LIBCPP_MSVC) #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES -#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER #define _LIBCPP_HAS_NO_CONSTEXPR #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES @@ -532,9 +576,9 @@ namespace std { #define _LIBCPP_NORETURN __attribute__((noreturn)) #define _LIBCPP_UNUSED +#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES #define _LIBCPP_HAS_NO_ADVANCED_SFINAE -#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #define _LIBCPP_HAS_NO_NOEXCEPT #define _LIBCPP_HAS_NO_NULLPTR @@ -579,9 +623,11 @@ typedef unsigned int char32_t; #ifdef _LIBCPP_HAS_NO_STATIC_ASSERT +extern "C++" { template <bool> struct __static_assert_test; template <> struct __static_assert_test<true> {}; template <unsigned> struct __static_assert_check {}; +} #define static_assert(__b, __m) \ typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \ _LIBCPP_CONCAT(__t, __LINE__) @@ -724,6 +770,12 @@ template <unsigned> struct __static_asse #define _LIBCPP_CONSTEXPR_AFTER_CXX11 #endif +#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES +# define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x) +#else +# define _LIBCPP_EXPLICIT_MOVE(x) (x) +#endif + #ifndef _LIBCPP_HAS_NO_ASAN extern "C" void __sanitizer_annotate_contiguous_container( const void *, const void *, const void *, const void *); @@ -733,7 +785,7 @@ extern "C" void __sanitizer_annotate_con // g++ and cl.exe have RTTI on by default and define a macro when it is. // g++ only defines the macro in 4.3.2 and onwards. #if !defined(_LIBCPP_NO_RTTI) -# if defined(__GNUG__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \ +# if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \ (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI) # define _LIBCPP_NO_RTTI # elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI) @@ -765,7 +817,7 @@ extern "C" void __sanitizer_annotate_con #define _LIBCPP_HAS_NO_STDOUT #endif -#if defined(__ANDROID__) || defined(__CloudABI__) +#if defined(__ANDROID__) || defined(__CloudABI__) || defined(_LIBCPP_HAS_MUSL_LIBC) #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE #endif @@ -775,4 +827,21 @@ extern "C" void __sanitizer_annotate_con #define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS #endif -#endif // _LIBCPP_CONFIG +#if __has_feature(cxx_atomic) || __has_extension(c_atomic) +#define _LIBCPP_HAS_C_ATOMIC_IMP +#elif _GNUC_VER > 407 +#define _LIBCPP_HAS_GCC_ATOMIC_IMP +#endif + +#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \ + || defined(_LIBCPP_HAS_NO_THREADS) +#define _LIBCPP_HAS_NO_ATOMIC_HEADER +#endif + +#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +#endif + +#endif // __cplusplus + +#endif // _LIBCPP_CONFIG Modified: head/contrib/libc++/include/__functional_03 ============================================================================== --- head/contrib/libc++/include/__functional_03 Thu May 26 18:52:26 2016 (r300769) +++ head/contrib/libc++/include/__functional_03 Thu May 26 18:52:49 2016 (r300770) @@ -17,218 +17,7 @@ #pragma GCC system_header #endif -template <class _Tp> -class __mem_fn - : public __weak_result_type<_Tp> -{ -public: - // types - typedef _Tp type; -private: - type __f_; - -public: - _LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) : __f_(__f) {} - - // invoke - - typename __invoke_return<type>::type - operator() () const - { - return __invoke(__f_); - } - - template <class _A0> - typename __invoke_return0<type, _A0>::type - operator() (_A0& __a0) const - { - return __invoke(__f_, __a0); - } - - template <class _A0, class _A1> - typename __invoke_return1<type, _A0, _A1>::type - operator() (_A0& __a0, _A1& __a1) const - { - return __invoke(__f_, __a0, __a1); - } - - template <class _A0, class _A1, class _A2> - typename __invoke_return2<type, _A0, _A1, _A2>::type - operator() (_A0& __a0, _A1& __a1, _A2& __a2) const - { - return __invoke(__f_, __a0, __a1, __a2); - } -}; - -template<class _Rp, class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp _Tp::*> -mem_fn(_Rp _Tp::* __pm) -{ - return __mem_fn<_Rp _Tp::*>(__pm); -} - -template<class _Rp, class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)()> -mem_fn(_Rp (_Tp::* __pm)()) -{ - return __mem_fn<_Rp (_Tp::*)()>(__pm); -} - -template<class _Rp, class _Tp, class _A0> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0)> -mem_fn(_Rp (_Tp::* __pm)(_A0)) -{ - return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1)> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1)) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2)) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm); -} - -template<class _Rp, class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)() const> -mem_fn(_Rp (_Tp::* __pm)() const) -{ - return __mem_fn<_Rp (_Tp::*)() const>(__pm); -} - -template<class _Rp, class _Tp, class _A0> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0) const> -mem_fn(_Rp (_Tp::* __pm)(_A0) const) -{ - return __mem_fn<_Rp (_Tp::*)(_A0) const>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1) const> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const>(__pm); -} - -template<class _Rp, class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)() volatile> -mem_fn(_Rp (_Tp::* __pm)() volatile) -{ - return __mem_fn<_Rp (_Tp::*)() volatile>(__pm); -} - -template<class _Rp, class _Tp, class _A0> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0) volatile> -mem_fn(_Rp (_Tp::* __pm)(_A0) volatile) -{ - return __mem_fn<_Rp (_Tp::*)(_A0) volatile>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) volatile) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) volatile) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile>(__pm); -} - -template<class _Rp, class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)() const volatile> -mem_fn(_Rp (_Tp::* __pm)() const volatile) -{ - return __mem_fn<_Rp (_Tp::*)() const volatile>(__pm); -} - -template<class _Rp, class _Tp, class _A0> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0) const volatile> -mem_fn(_Rp (_Tp::* __pm)(_A0) const volatile) -{ - return __mem_fn<_Rp (_Tp::*)(_A0) const volatile>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const volatile) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const volatile) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile>(__pm); -} - -// bad_function_call - -class _LIBCPP_EXCEPTION_ABI bad_function_call - : public exception -{ -}; - -template<class _Fp> class _LIBCPP_TYPE_VIS_ONLY function; // undefined - -namespace __function -{ - -template<class _Fp> -struct __maybe_derive_from_unary_function -{ -}; - -template<class _Rp, class _A1> -struct __maybe_derive_from_unary_function<_Rp(_A1)> - : public unary_function<_A1, _Rp> -{ -}; - -template<class _Fp> -struct __maybe_derive_from_binary_function -{ -}; - -template<class _Rp, class _A1, class _A2> -struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)> - : public binary_function<_A1, _A2, _Rp> -{ -}; +namespace __function { template<class _Fp> class __base; @@ -662,15 +451,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; - template <class _Fp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const _Fp&) {return true;} - template <class _R2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (*__p)()) {return __p;} - template <class _R2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_R2()>& __p) {return __p;} public: typedef _Rp result_type; @@ -769,7 +549,7 @@ function<_Rp()>::function(_Fp __f, typename enable_if<!is_integral<_Fp>::value>::type*) : __f_(0) { - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, allocator<_Fp>, _Rp()> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -796,7 +576,7 @@ function<_Rp()>::function(allocator_arg_ : __f_(0) { typedef allocator_traits<_Alloc> __alloc_traits; - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, _Alloc, _Rp()> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -947,27 +727,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; - template <class _Fp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const _Fp&) {return true;} - template <class _R2, class _B0> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (*__p)(_B0)) {return __p;} - template <class _R2, class _Cp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)()) {return __p;} - template <class _R2, class _Cp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)() const) {return __p;} - template <class _R2, class _Cp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)() volatile) {return __p;} - template <class _R2, class _Cp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)() const volatile) {return __p;} - template <class _R2, class _B0> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_R2(_B0)>& __p) {return __p;} public: typedef _Rp result_type; @@ -1066,7 +825,7 @@ function<_Rp(_A0)>::function(_Fp __f, typename enable_if<!is_integral<_Fp>::value>::type*) : __f_(0) { - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -1093,7 +852,7 @@ function<_Rp(_A0)>::function(allocator_a : __f_(0) { typedef allocator_traits<_Alloc> __alloc_traits; - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, _Alloc, _Rp(_A0)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -1244,27 +1003,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; - template <class _Fp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const _Fp&) {return true;} - template <class _R2, class _B0, class _B1> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (*__p)(_B0, _B1)) {return __p;} - template <class _R2, class _Cp, class _B1> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1)) {return __p;} - template <class _R2, class _Cp, class _B1> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1) const) {return __p;} - template <class _R2, class _Cp, class _B1> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1) volatile) {return __p;} - template <class _R2, class _Cp, class _B1> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1) const volatile) {return __p;} - template <class _R2, class _B0, class _B1> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_R2(_B0, _B1)>& __p) {return __p;} public: typedef _Rp result_type; @@ -1363,7 +1101,7 @@ function<_Rp(_A0, _A1)>::function(_Fp __ typename enable_if<!is_integral<_Fp>::value>::type*) : __f_(0) { - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -1390,7 +1128,7 @@ function<_Rp(_A0, _A1)>::function(alloca : __f_(0) { typedef allocator_traits<_Alloc> __alloc_traits; - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -1540,27 +1278,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; - template <class _Fp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const _Fp&) {return true;} - template <class _R2, class _B0, class _B1, class _B2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (*__p)(_B0, _B1, _B2)) {return __p;} - template <class _R2, class _Cp, class _B1, class _B2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2)) {return __p;} - template <class _R2, class _Cp, class _B1, class _B2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) const) {return __p;} - template <class _R2, class _Cp, class _B1, class _B2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) volatile) {return __p;} - template <class _R2, class _Cp, class _B1, class _B2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) const volatile) {return __p;} - template <class _R2, class _B0, class _B1, class _B2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_R2(_B0, _B1, _B2)>& __p) {return __p;} public: typedef _Rp result_type; @@ -1660,7 +1377,7 @@ function<_Rp(_A0, _A1, _A2)>::function(_ typename enable_if<!is_integral<_Fp>::value>::type*) : __f_(0) { - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1, _A2)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -1687,7 +1404,7 @@ function<_Rp(_A0, _A1, _A2)>::function(a : __f_(0) { typedef allocator_traits<_Alloc> __alloc_traits; - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -1856,274 +1573,4 @@ void swap(function<_Fp>& __x, function<_Fp>& __y) {return __x.swap(__y);} -template<class _Tp> struct __is_bind_expression : public false_type {}; -template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_bind_expression - : public __is_bind_expression<typename remove_cv<_Tp>::type> {}; - -template<class _Tp> struct __is_placeholder : public integral_constant<int, 0> {}; -template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_placeholder - : public __is_placeholder<typename remove_cv<_Tp>::type> {}; - -namespace placeholders -{ - -template <int _Np> struct __ph {}; - -extern __ph<1> _1; -extern __ph<2> _2; -extern __ph<3> _3; -extern __ph<4> _4; -extern __ph<5> _5; -extern __ph<6> _6; -extern __ph<7> _7; -extern __ph<8> _8; -extern __ph<9> _9; -extern __ph<10> _10; - -} // placeholders - -template<int _Np> -struct __is_placeholder<placeholders::__ph<_Np> > - : public integral_constant<int, _Np> {}; - -template <class _Tp, class _Uj> -inline _LIBCPP_INLINE_VISIBILITY -_Tp& -__mu(reference_wrapper<_Tp> __t, _Uj&) -{ - return __t.get(); -} -/* -template <bool _IsBindExpr, class _Ti, class ..._Uj> -struct __mu_return1 {}; - -template <class _Ti, class ..._Uj> -struct __mu_return1<true, _Ti, _Uj...> -{ - typedef typename result_of<_Ti(_Uj...)>::type type; -}; - -template <class _Ti, class ..._Uj, size_t ..._Indx> -inline _LIBCPP_INLINE_VISIBILITY -typename __mu_return1<true, _Ti, _Uj...>::type -__mu_expand(_Ti& __ti, tuple<_Uj...>&& __uj, __tuple_indices<_Indx...>) -{ - __ti(_VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj))...); -} - -template <class _Ti, class ..._Uj> -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_bind_expression<_Ti>::value, - typename __mu_return1<is_bind_expression<_Ti>::value, _Ti, _Uj...>::type ->::type -__mu(_Ti& __ti, tuple<_Uj...>& __uj) -{ - typedef typename __make_tuple_indices<sizeof...(_Uj)>::type __indices; - return __mu_expand(__ti, __uj, __indices()); -} - -template <bool IsPh, class _Ti, class _Uj> -struct __mu_return2 {}; - -template <class _Ti, class _Uj> -struct __mu_return2<true, _Ti, _Uj> -{ - typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _Uj>::type type; -}; - -template <class _Ti, class _Uj> -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - 0 < is_placeholder<_Ti>::value, - typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type ->::type -__mu(_Ti&, _Uj& __uj) -{ - const size_t _Indx = is_placeholder<_Ti>::value - 1; - // compiler bug workaround - typename tuple_element<_Indx, _Uj>::type __t = _VSTD::get<_Indx>(__uj); - return __t; -// return _VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj)); -} - -template <class _Ti, class _Uj> -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - !is_bind_expression<_Ti>::value && - is_placeholder<_Ti>::value == 0 && - !__is_reference_wrapper<_Ti>::value, - _Ti& ->::type -__mu(_Ti& __ti, _Uj& __uj) -{ - return __ti; -} - -template <class _Ti, bool IsBindEx, bool IsPh, class _TupleUj> -struct ____mu_return; - -template <class _Ti, class ..._Uj> -struct ____mu_return<_Ti, true, false, tuple<_Uj...> > -{ - typedef typename result_of<_Ti(_Uj...)>::type type; -}; - -template <class _Ti, class _TupleUj> -struct ____mu_return<_Ti, false, true, _TupleUj> -{ - typedef typename tuple_element<is_placeholder<_Ti>::value - 1, - _TupleUj>::type&& type; -}; - -template <class _Ti, class _TupleUj> -struct ____mu_return<_Ti, false, false, _TupleUj> -{ - typedef _Ti& type; -}; - -template <class _Ti, class _TupleUj> -struct __mu_return - : public ____mu_return<_Ti, - is_bind_expression<_Ti>::value, - 0 < is_placeholder<_Ti>::value, - _TupleUj> -{ -}; - -template <class _Ti, class _TupleUj> -struct __mu_return<reference_wrapper<_Ti>, _TupleUj> -{ - typedef _Ti& type; -}; - -template <class _Fp, class _BoundArgs, class _TupleUj> -struct __bind_return; - -template <class _Fp, class ..._BoundArgs, class _TupleUj> -struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj> -{ - typedef typename __ref_return - < - _Fp&, - typename __mu_return - < - _BoundArgs, - _TupleUj - >::type... - >::type type; -}; - -template <class _Fp, class ..._BoundArgs, class _TupleUj> -struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj> -{ - typedef typename __ref_return - < - _Fp&, - typename __mu_return - < - const _BoundArgs, - _TupleUj - >::type... - >::type type; -}; - -template <class _Fp, class _BoundArgs, size_t ..._Indx, class _Args> -inline _LIBCPP_INLINE_VISIBILITY -typename __bind_return<_Fp, _BoundArgs, _Args>::type -__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, - _Args&& __args) -{ - return __invoke(__f, __mu(_VSTD::get<_Indx>(__bound_args), __args)...); -} - -template<class _Fp, class ..._BoundArgs> -class __bind -{ - _Fp __f_; - tuple<_BoundArgs...> __bound_args_; - - typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices; -public: - template <class _Gp, class ..._BA> - explicit __bind(_Gp&& __f, _BA&& ...__bound_args) - : __f_(_VSTD::forward<_Gp>(__f)), - __bound_args_(_VSTD::forward<_BA>(__bound_args)...) {} - - template <class ..._Args> - typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type - operator()(_Args&& ...__args) - { - // compiler bug workaround - return __apply_functor(__f_, __bound_args_, __indices(), - tuple<_Args&&...>(__args...)); - } - - template <class ..._Args> - typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type - operator()(_Args&& ...__args) const - { - return __apply_functor(__f_, __bound_args_, __indices(), - tuple<_Args&&...>(__args...)); - } -}; - -template<class _Fp, class ..._BoundArgs> -struct __is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {}; - -template<class _Rp, class _Fp, class ..._BoundArgs> -class __bind_r - : public __bind<_Fp, _BoundArgs...> -{ - typedef __bind<_Fp, _BoundArgs...> base; -public: - typedef _Rp result_type; - - template <class _Gp, class ..._BA> - explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args) - : base(_VSTD::forward<_Gp>(__f), - _VSTD::forward<_BA>(__bound_args)...) {} - - template <class ..._Args> - result_type - operator()(_Args&& ...__args) - { - typedef __invoke_void_return_wrapper<_Rp> _Invoker; - return _Invoker::__call(static_cast<base&>(*this), _VSTD::forward<_Args>(__args)...); - } - - template <class ..._Args> - result_type - operator()(_Args&& ...__args) const - { - typedef __invoke_void_return_wrapper<_Rp> _Invoker; - return _Invoker::__call(static_cast<base const&>(*this), _VSTD::forward<_Args>(__args)...); - } -}; - -template<class _Rp, class _Fp, class ..._BoundArgs> -struct __is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {}; - -template<class _Fp, class ..._BoundArgs> -inline _LIBCPP_INLINE_VISIBILITY -__bind<typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> -bind(_Fp&& __f, _BoundArgs&&... __bound_args) -{ - typedef __bind<typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> type; - return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...); -} - -template<class _Rp, class _Fp, class ..._BoundArgs> -inline _LIBCPP_INLINE_VISIBILITY -__bind_r<_Rp, typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> -bind(_Fp&& __f, _BoundArgs&&... __bound_args) -{ - typedef __bind_r<_Rp, typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> type; - return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...); -} -*/ - #endif // _LIBCPP_FUNCTIONAL_03 Modified: head/contrib/libc++/include/__functional_base ============================================================================== --- head/contrib/libc++/include/__functional_base Thu May 26 18:52:26 2016 (r300769) +++ head/contrib/libc++/include/__functional_base Thu May 26 18:52:49 2016 (r300770) @@ -77,62 +77,6 @@ struct _LIBCPP_TYPE_VIS_ONLY less<void> }; #endif -// addressof - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -_Tp* -addressof(_Tp& __x) _NOEXCEPT -{ - return (_Tp*)&reinterpret_cast<const volatile char&>(__x); -} - -#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF) -// Objective-C++ Automatic Reference Counting uses qualified pointers -// that require special addressof() signatures. When -// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler -// itself is providing these definitions. Otherwise, we provide them. -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__strong _Tp* -addressof(__strong _Tp& __x) _NOEXCEPT -{ - return &__x; -} - -#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__weak _Tp* -addressof(__weak _Tp& __x) _NOEXCEPT -{ - return &__x; -} -#endif - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__autoreleasing _Tp* -addressof(__autoreleasing _Tp& __x) _NOEXCEPT -{ - return &__x; -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__unsafe_unretained _Tp* -addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT -{ - return &__x; -} -#endif - -#ifdef _LIBCPP_HAS_NO_VARIADICS - -#include <__functional_base_03> - -#else // _LIBCPP_HAS_NO_VARIADICS - // __weak_result_type template <class _Tp> @@ -314,6 +258,8 @@ struct __weak_result_type<_Rp (_Cp::*)(_ { }; + +#ifndef _LIBCPP_HAS_NO_VARIADICS // 3 or more arguments *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu May 26 18:57:27 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6DB3B4B375; Thu, 26 May 2016 18:57:27 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F32218B5; Thu, 26 May 2016 18:57:27 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QIvQ6v074168; Thu, 26 May 2016 18:57:26 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QIvQpN074167; Thu, 26 May 2016 18:57:26 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201605261857.u4QIvQpN074167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim <jkim@FreeBSD.org> Date: Thu, 26 May 2016 18:57:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300771 - head/sys/netgraph/netflow X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 18:57:27 -0000 Author: jkim Date: Thu May 26 18:57:26 2016 New Revision: 300771 URL: https://svnweb.freebsd.org/changeset/base/300771 Log: Use bit_count(3) instead of four bitcount32() calls. Reviewed by: asomers, ngie Differential Revision: https://reviews.freebsd.org/D6543 Modified: head/sys/netgraph/netflow/netflow.c Modified: head/sys/netgraph/netflow/netflow.c ============================================================================== --- head/sys/netgraph/netflow/netflow.c Thu May 26 18:52:49 2016 (r300770) +++ head/sys/netgraph/netflow/netflow.c Thu May 26 18:57:26 2016 (r300771) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_route.h" #include <sys/param.h> +#include <sys/bitstring.h> #include <sys/systm.h> #include <sys/counter.h> #include <sys/kernel.h> @@ -147,6 +148,19 @@ ip6_hash(struct flow6_rec *r) r->dst.r_dst6.__u6_addr.__u6_addr32[3]); } } + +static inline int +ip6_masklen(struct in6_addr *saddr, struct rt_addrinfo *info) +{ + const int nbits = sizeof(*saddr) * NBBY; + int mlen; + + if (info->rti_addrs & RTA_NETMASK) + bit_count((bitstr_t *)saddr, 0, nbits, &mlen); + else + mlen = nbits; + return (mlen); +} #endif /* @@ -399,11 +413,6 @@ hash_insert(priv_p priv, struct flow_has } #ifdef INET6 -/* XXX: make normal function, instead of.. */ -#define ipv6_masklen(x) bitcount32((x).__u6_addr.__u6_addr32[0]) + \ - bitcount32((x).__u6_addr.__u6_addr32[1]) + \ - bitcount32((x).__u6_addr.__u6_addr32[2]) + \ - bitcount32((x).__u6_addr.__u6_addr32[3]) static int hash6_insert(priv_p priv, struct flow_hash_entry *hsh6, struct flow6_rec *r, int plen, uint8_t flags, uint8_t tcp_flags) @@ -460,11 +469,7 @@ hash6_insert(priv_p priv, struct flow_ha fle6->f.n.next_hop6 = ((struct sockaddr_in6 *)&rt_gateway)->sin6_addr; - if (info.rti_addrs & RTA_NETMASK) - fle6->f.dst_mask = - ipv6_masklen(sin6_mask.sin6_addr); - else - fle6->f.dst_mask = 128; + fle6->f.dst_mask = ip6_masklen(&sin6_mask.sin6_addr, &info); rib_free_info(&info); } @@ -483,13 +488,8 @@ hash6_insert(priv_p priv, struct flow_ha info.rti_info[RTAX_NETMASK] = (struct sockaddr *)&sin6_mask; if (rib_lookup_info(r->fib, (struct sockaddr *)&sin6, 0, 0, - &info) == 0) { - if (info.rti_addrs & RTA_NETMASK) - fle6->f.src_mask = - ipv6_masklen(sin6_mask.sin6_addr); - else - fle6->f.src_mask = 128; - } + &info) == 0) + fle6->f.src_mask = ip6_masklen(&sin6_mask.sin6_addr, &info); } /* Push new flow at the and of hash. */ @@ -497,7 +497,6 @@ hash6_insert(priv_p priv, struct flow_ha return (0); } -#undef ipv6_masklen #endif From owner-svn-src-head@freebsd.org Thu May 26 19:17:52 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E608FB4B9C8; Thu, 26 May 2016 19:17:52 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B79441515; Thu, 26 May 2016 19:17:52 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QJHpED081504; Thu, 26 May 2016 19:17:51 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QJHpPx081503; Thu, 26 May 2016 19:17:51 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201605261917.u4QJHpPx081503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim <jkim@FreeBSD.org> Date: Thu, 26 May 2016 19:17:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300772 - head/sys/netgraph/netflow X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 19:17:53 -0000 Author: jkim Date: Thu May 26 19:17:51 2016 New Revision: 300772 URL: https://svnweb.freebsd.org/changeset/base/300772 Log: Fix style(9). Modified: head/sys/netgraph/netflow/netflow.c Modified: head/sys/netgraph/netflow/netflow.c ============================================================================== --- head/sys/netgraph/netflow/netflow.c Thu May 26 18:57:26 2016 (r300771) +++ head/sys/netgraph/netflow/netflow.c Thu May 26 19:17:51 2016 (r300772) @@ -469,7 +469,8 @@ hash6_insert(priv_p priv, struct flow_ha fle6->f.n.next_hop6 = ((struct sockaddr_in6 *)&rt_gateway)->sin6_addr; - fle6->f.dst_mask = ip6_masklen(&sin6_mask.sin6_addr, &info); + fle6->f.dst_mask = + ip6_masklen(&sin6_mask.sin6_addr, &info); rib_free_info(&info); } @@ -489,7 +490,8 @@ hash6_insert(priv_p priv, struct flow_ha if (rib_lookup_info(r->fib, (struct sockaddr *)&sin6, 0, 0, &info) == 0) - fle6->f.src_mask = ip6_masklen(&sin6_mask.sin6_addr, &info); + fle6->f.src_mask = + ip6_masklen(&sin6_mask.sin6_addr, &info); } /* Push new flow at the and of hash. */ From owner-svn-src-head@freebsd.org Thu May 26 19:29:31 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B465AB4BED5; Thu, 26 May 2016 19:29:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D3BA1F3A; Thu, 26 May 2016 19:29:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QJTU13085436; Thu, 26 May 2016 19:29:30 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QJTTV5085421; Thu, 26 May 2016 19:29:29 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201605261929.u4QJTTV5085421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" <cem@FreeBSD.org> Date: Thu, 26 May 2016 19:29:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300773 - in head/sys: crypto crypto/aesni crypto/sha2 crypto/siphash kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 19:29:31 -0000 Author: cem Date: Thu May 26 19:29:29 2016 New Revision: 300773 URL: https://svnweb.freebsd.org/changeset/base/300773 Log: crypto routines: Hint minimum buffer sizes to the compiler Use the C99 'static' keyword to hint to the compiler IVs and output digest sizes. The keyword informs the compiler of the minimum valid size for a given array. Obviously not every pointer can be validated (i.e., the compiler can produce false negative but not false positive reports). No functional change. No ABI change. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/crypto/aesni/aesni.h head/sys/crypto/aesni/aesni_wrap.c head/sys/crypto/sha1.c head/sys/crypto/sha1.h head/sys/crypto/sha2/sha256.h head/sys/crypto/sha2/sha256c.c head/sys/crypto/sha2/sha384.h head/sys/crypto/sha2/sha512.h head/sys/crypto/sha2/sha512c.c head/sys/crypto/siphash/siphash.c head/sys/crypto/siphash/siphash.h head/sys/kern/md4c.c head/sys/kern/md5c.c head/sys/sys/md4.h head/sys/sys/md5.h Modified: head/sys/crypto/aesni/aesni.h ============================================================================== --- head/sys/crypto/aesni/aesni.h Thu May 26 19:17:51 2016 (r300772) +++ head/sys/crypto/aesni/aesni.h Thu May 26 19:29:29 2016 (r300773) @@ -79,23 +79,23 @@ void aesni_set_deckey(const uint8_t *enc */ void aesni_encrypt_cbc(int rounds, const void *key_schedule /*__aligned(16)*/, size_t len, const uint8_t *from, uint8_t *to, - const uint8_t iv[AES_BLOCK_LEN]); + const uint8_t iv[static AES_BLOCK_LEN]); void aesni_decrypt_cbc(int rounds, const void *key_schedule /*__aligned(16)*/, - size_t len, uint8_t *buf, const uint8_t iv[AES_BLOCK_LEN]); + size_t len, uint8_t *buf, const uint8_t iv[static AES_BLOCK_LEN]); void aesni_encrypt_ecb(int rounds, const void *key_schedule /*__aligned(16)*/, size_t len, const uint8_t *from, uint8_t *to); void aesni_decrypt_ecb(int rounds, const void *key_schedule /*__aligned(16)*/, size_t len, const uint8_t *from, uint8_t *to); void aesni_encrypt_icm(int rounds, const void *key_schedule /*__aligned(16)*/, size_t len, const uint8_t *from, uint8_t *to, - const uint8_t iv[AES_BLOCK_LEN]); + const uint8_t iv[static AES_BLOCK_LEN]); void aesni_encrypt_xts(int rounds, const void *data_schedule /*__aligned(16)*/, const void *tweak_schedule /*__aligned(16)*/, size_t len, - const uint8_t *from, uint8_t *to, const uint8_t iv[AES_BLOCK_LEN]); + const uint8_t *from, uint8_t *to, const uint8_t iv[static AES_BLOCK_LEN]); void aesni_decrypt_xts(int rounds, const void *data_schedule /*__aligned(16)*/, const void *tweak_schedule /*__aligned(16)*/, size_t len, - const uint8_t *from, uint8_t *to, const uint8_t iv[AES_BLOCK_LEN]); + const uint8_t *from, uint8_t *to, const uint8_t iv[static AES_BLOCK_LEN]); /* GCM & GHASH functions */ void AES_GCM_encrypt(const unsigned char *in, unsigned char *out, Modified: head/sys/crypto/aesni/aesni_wrap.c ============================================================================== --- head/sys/crypto/aesni/aesni_wrap.c Thu May 26 19:17:51 2016 (r300772) +++ head/sys/crypto/aesni/aesni_wrap.c Thu May 26 19:29:29 2016 (r300773) @@ -55,7 +55,7 @@ struct blocks8 { void aesni_encrypt_cbc(int rounds, const void *key_schedule, size_t len, - const uint8_t *from, uint8_t *to, const uint8_t iv[AES_BLOCK_LEN]) + const uint8_t *from, uint8_t *to, const uint8_t iv[static AES_BLOCK_LEN]) { __m128i tot, ivreg; size_t i; @@ -74,7 +74,7 @@ aesni_encrypt_cbc(int rounds, const void void aesni_decrypt_cbc(int rounds, const void *key_schedule, size_t len, - uint8_t *buf, const uint8_t iv[AES_BLOCK_LEN]) + uint8_t *buf, const uint8_t iv[static AES_BLOCK_LEN]) { __m128i blocks[8]; struct blocks8 *blks; @@ -204,7 +204,7 @@ nextc(__m128i x) void aesni_encrypt_icm(int rounds, const void *key_schedule, size_t len, - const uint8_t *from, uint8_t *to, const uint8_t iv[AES_BLOCK_LEN]) + const uint8_t *from, uint8_t *to, const uint8_t iv[static AES_BLOCK_LEN]) { __m128i tot; __m128i tmp1, tmp2, tmp3, tmp4; @@ -378,7 +378,7 @@ aesni_crypt_xts_block8(int rounds, const static void aesni_crypt_xts(int rounds, const __m128i *data_schedule, const __m128i *tweak_schedule, size_t len, const uint8_t *from, - uint8_t *to, const uint8_t iv[AES_BLOCK_LEN], int do_encrypt) + uint8_t *to, const uint8_t iv[static AES_BLOCK_LEN], int do_encrypt) { __m128i tweakreg; uint8_t tweak[AES_XTS_BLOCKSIZE] __aligned(16); @@ -418,7 +418,7 @@ aesni_crypt_xts(int rounds, const __m128 void aesni_encrypt_xts(int rounds, const void *data_schedule, const void *tweak_schedule, size_t len, const uint8_t *from, uint8_t *to, - const uint8_t iv[AES_BLOCK_LEN]) + const uint8_t iv[static AES_BLOCK_LEN]) { aesni_crypt_xts(rounds, data_schedule, tweak_schedule, len, from, to, @@ -428,7 +428,7 @@ aesni_encrypt_xts(int rounds, const void void aesni_decrypt_xts(int rounds, const void *data_schedule, const void *tweak_schedule, size_t len, const uint8_t *from, uint8_t *to, - const uint8_t iv[AES_BLOCK_LEN]) + const uint8_t iv[static AES_BLOCK_LEN]) { aesni_crypt_xts(rounds, data_schedule, tweak_schedule, len, from, to, Modified: head/sys/crypto/sha1.c ============================================================================== --- head/sys/crypto/sha1.c Thu May 26 19:17:51 2016 (r300772) +++ head/sys/crypto/sha1.c Thu May 26 19:29:29 2016 (r300773) @@ -249,16 +249,14 @@ sha1_loop(ctxt, input, len) } void -sha1_result(ctxt, digest0) - struct sha1_ctxt *ctxt; - caddr_t digest0; +sha1_result(struct sha1_ctxt *ctxt, char digest0[static SHA1_RESULTLEN]) { u_int8_t *digest; digest = (u_int8_t *)digest0; sha1_pad(ctxt); #if BYTE_ORDER == BIG_ENDIAN - bcopy(&ctxt->h.b8[0], digest, 20); + bcopy(&ctxt->h.b8[0], digest, SHA1_RESULTLEN); #else digest[0] = ctxt->h.b8[3]; digest[1] = ctxt->h.b8[2]; digest[2] = ctxt->h.b8[1]; digest[3] = ctxt->h.b8[0]; Modified: head/sys/crypto/sha1.h ============================================================================== --- head/sys/crypto/sha1.h Thu May 26 19:17:51 2016 (r300772) +++ head/sys/crypto/sha1.h Thu May 26 19:29:29 2016 (r300773) @@ -35,8 +35,8 @@ * implemented by Jun-ichiro itojun Itoh <itojun@itojun.org> */ -#ifndef _NETINET6_SHA1_H_ -#define _NETINET6_SHA1_H_ +#ifndef _CRYPTO_SHA1_H_ +#define _CRYPTO_SHA1_H_ struct sha1_ctxt { union { @@ -55,11 +55,13 @@ struct sha1_ctxt { }; typedef struct sha1_ctxt SHA1_CTX; +#define SHA1_RESULTLEN (160/8) + #ifdef _KERNEL extern void sha1_init(struct sha1_ctxt *); extern void sha1_pad(struct sha1_ctxt *); extern void sha1_loop(struct sha1_ctxt *, const u_int8_t *, size_t); -extern void sha1_result(struct sha1_ctxt *, caddr_t); +extern void sha1_result(struct sha1_ctxt *, char[static SHA1_RESULTLEN]); /* compatibilty with other SHA1 source codes */ #define SHA1Init(x) sha1_init((x)) @@ -67,6 +69,4 @@ extern void sha1_result(struct sha1_ctxt #define SHA1Final(x, y) sha1_result((y), (x)) #endif /* _KERNEL */ -#define SHA1_RESULTLEN (160/8) - -#endif /*_NETINET6_SHA1_H_*/ +#endif /*_CRYPTO_SHA1_H_*/ Modified: head/sys/crypto/sha2/sha256.h ============================================================================== --- head/sys/crypto/sha2/sha256.h Thu May 26 19:17:51 2016 (r300772) +++ head/sys/crypto/sha2/sha256.h Thu May 26 19:29:29 2016 (r300773) @@ -78,7 +78,7 @@ __BEGIN_DECLS void SHA256_Init(SHA256_CTX *); void SHA256_Update(SHA256_CTX *, const void *, size_t); -void SHA256_Final(unsigned char [SHA256_DIGEST_LENGTH], SHA256_CTX *); +void SHA256_Final(unsigned char [static SHA256_DIGEST_LENGTH], SHA256_CTX *); #ifndef _KERNEL char *SHA256_End(SHA256_CTX *, char *); char *SHA256_Data(const void *, unsigned int, char *); Modified: head/sys/crypto/sha2/sha256c.c ============================================================================== --- head/sys/crypto/sha2/sha256c.c Thu May 26 19:17:51 2016 (r300772) +++ head/sys/crypto/sha2/sha256c.c Thu May 26 19:29:29 2016 (r300773) @@ -287,17 +287,17 @@ SHA256_Update(SHA256_CTX * ctx, const vo * and clears the context state. */ void -SHA256_Final(unsigned char digest[32], SHA256_CTX * ctx) +SHA256_Final(unsigned char digest[static SHA256_DIGEST_LENGTH], SHA256_CTX *ctx) { /* Add padding */ SHA256_Pad(ctx); /* Write the hash */ - be32enc_vect(digest, ctx->state, 32); + be32enc_vect(digest, ctx->state, SHA256_DIGEST_LENGTH); /* Clear the context state */ - memset((void *)ctx, 0, sizeof(*ctx)); + memset(ctx, 0, sizeof(*ctx)); } #ifdef WEAK_REFS Modified: head/sys/crypto/sha2/sha384.h ============================================================================== --- head/sys/crypto/sha2/sha384.h Thu May 26 19:17:51 2016 (r300772) +++ head/sys/crypto/sha2/sha384.h Thu May 26 19:29:29 2016 (r300773) @@ -74,7 +74,7 @@ __BEGIN_DECLS void SHA384_Init(SHA384_CTX *); void SHA384_Update(SHA384_CTX *, const void *, size_t); -void SHA384_Final(unsigned char [SHA384_DIGEST_LENGTH], SHA384_CTX *); +void SHA384_Final(unsigned char [static SHA384_DIGEST_LENGTH], SHA384_CTX *); #ifndef _KERNEL char *SHA384_End(SHA384_CTX *, char *); char *SHA384_Data(const void *, unsigned int, char *); Modified: head/sys/crypto/sha2/sha512.h ============================================================================== --- head/sys/crypto/sha2/sha512.h Thu May 26 19:17:51 2016 (r300772) +++ head/sys/crypto/sha2/sha512.h Thu May 26 19:29:29 2016 (r300773) @@ -77,7 +77,7 @@ __BEGIN_DECLS void SHA512_Init(SHA512_CTX *); void SHA512_Update(SHA512_CTX *, const void *, size_t); -void SHA512_Final(unsigned char [SHA512_DIGEST_LENGTH], SHA512_CTX *); +void SHA512_Final(unsigned char [static SHA512_DIGEST_LENGTH], SHA512_CTX *); #ifndef _KERNEL char *SHA512_End(SHA512_CTX *, char *); char *SHA512_Data(const void *, unsigned int, char *); Modified: head/sys/crypto/sha2/sha512c.c ============================================================================== --- head/sys/crypto/sha2/sha512c.c Thu May 26 19:17:51 2016 (r300772) +++ head/sys/crypto/sha2/sha512c.c Thu May 26 19:29:29 2016 (r300773) @@ -311,7 +311,7 @@ SHA512_Update(SHA512_CTX * ctx, const vo * and clears the context state. */ void -SHA512_Final(unsigned char digest[SHA512_DIGEST_LENGTH], SHA512_CTX * ctx) +SHA512_Final(unsigned char digest[static SHA512_DIGEST_LENGTH], SHA512_CTX *ctx) { /* Add padding */ @@ -321,7 +321,7 @@ SHA512_Final(unsigned char digest[SHA512 be64enc_vect(digest, ctx->state, SHA512_DIGEST_LENGTH); /* Clear the context state */ - memset((void *)ctx, 0, sizeof(*ctx)); + memset(ctx, 0, sizeof(*ctx)); } /*** SHA-384: *********************************************************/ @@ -361,7 +361,7 @@ SHA384_Update(SHA384_CTX * ctx, const vo * and clears the context state. */ void -SHA384_Final(unsigned char digest[SHA384_DIGEST_LENGTH], SHA384_CTX * ctx) +SHA384_Final(unsigned char digest[static SHA384_DIGEST_LENGTH], SHA384_CTX *ctx) { /* Add padding */ @@ -371,7 +371,7 @@ SHA384_Final(unsigned char digest[SHA384 be64enc_vect(digest, ctx->state, SHA384_DIGEST_LENGTH); /* Clear the context state */ - memset((void *)ctx, 0, sizeof(*ctx)); + memset(ctx, 0, sizeof(*ctx)); } #ifdef WEAK_REFS Modified: head/sys/crypto/siphash/siphash.c ============================================================================== --- head/sys/crypto/siphash/siphash.c Thu May 26 19:17:51 2016 (r300772) +++ head/sys/crypto/siphash/siphash.c Thu May 26 19:29:29 2016 (r300773) @@ -71,7 +71,7 @@ SipHash_InitX(SIPHASH_CTX *ctx, int rc, } void -SipHash_SetKey(SIPHASH_CTX *ctx, const uint8_t key[16]) +SipHash_SetKey(SIPHASH_CTX *ctx, const uint8_t key[static SIPHASH_KEY_LENGTH]) { uint64_t k[2]; @@ -167,7 +167,7 @@ SipHash_Update(SIPHASH_CTX *ctx, const v } void -SipHash_Final(void *dst, SIPHASH_CTX *ctx) +SipHash_Final(uint8_t dst[static SIPHASH_DIGEST_LENGTH], SIPHASH_CTX *ctx) { uint64_t r; @@ -196,8 +196,8 @@ SipHash_End(SIPHASH_CTX *ctx) } uint64_t -SipHashX(SIPHASH_CTX *ctx, int rc, int rf, const uint8_t key[16], - const void *src, size_t len) +SipHashX(SIPHASH_CTX *ctx, int rc, int rf, + const uint8_t key[static SIPHASH_KEY_LENGTH], const void *src, size_t len) { SipHash_InitX(ctx, rc, rf); Modified: head/sys/crypto/siphash/siphash.h ============================================================================== --- head/sys/crypto/siphash/siphash.h Thu May 26 19:17:51 2016 (r300772) +++ head/sys/crypto/siphash/siphash.h Thu May 26 19:29:29 2016 (r300773) @@ -68,14 +68,14 @@ typedef struct _SIPHASH_CTX { #define SipHash24_Init(x) SipHash_InitX((x), 2, 4) #define SipHash48_Init(x) SipHash_InitX((x), 4, 8) void SipHash_InitX(SIPHASH_CTX *, int, int); -void SipHash_SetKey(SIPHASH_CTX *, const uint8_t [16]); +void SipHash_SetKey(SIPHASH_CTX *, const uint8_t[static SIPHASH_KEY_LENGTH]); void SipHash_Update(SIPHASH_CTX *, const void *, size_t); -void SipHash_Final(void *, SIPHASH_CTX *); +void SipHash_Final(uint8_t[static SIPHASH_DIGEST_LENGTH], SIPHASH_CTX *); uint64_t SipHash_End(SIPHASH_CTX *); #define SipHash24(x, y, z, i) SipHashX((x), 2, 4, (y), (z), (i)); #define SipHash48(x, y, z, i) SipHashX((x), 4, 8, (y), (z), (i)); -uint64_t SipHashX(SIPHASH_CTX *, int, int, const uint8_t [16], const void *, +uint64_t SipHashX(SIPHASH_CTX *, int, int, const uint8_t[static SIPHASH_KEY_LENGTH], const void *, size_t); int SipHash24_TestVectors(void); Modified: head/sys/kern/md4c.c ============================================================================== --- head/sys/kern/md4c.c Thu May 26 19:17:51 2016 (r300772) +++ head/sys/kern/md4c.c Thu May 26 19:29:29 2016 (r300773) @@ -164,9 +164,7 @@ MD4_CTX *context; /* MD4 finalization. Ends an MD4 message-digest operation, writing the the message digest and zeroizing the context. */ -void MD4Final (digest, context) -unsigned char digest[16]; /* message digest */ -MD4_CTX *context; /* context */ +void MD4Final (unsigned char digest[static 16], MD4_CTX *context) { /* Do padding */ MD4Pad (context); @@ -176,7 +174,7 @@ MD4_CTX *context; /* Zeroize sensitive information. */ - bzero((POINTER)context, sizeof (*context)); + bzero(context, sizeof (*context)); } /* MD4 basic transformation. Transforms state based on block. Modified: head/sys/kern/md5c.c ============================================================================== --- head/sys/kern/md5c.c Thu May 26 19:17:51 2016 (r300772) +++ head/sys/kern/md5c.c Thu May 26 19:29:29 2016 (r300773) @@ -217,18 +217,16 @@ MD5Pad (MD5_CTX *context) */ void -MD5Final (digest, context) - unsigned char digest[16]; - MD5_CTX *context; +MD5Final(unsigned char digest[static MD5_DIGEST_LENGTH], MD5_CTX *context) { /* Do padding. */ MD5Pad (context); /* Store state in digest */ - Encode (digest, context->state, 16); + Encode (digest, context->state, MD5_DIGEST_LENGTH); /* Zeroize sensitive information. */ - memset ((void *)context, 0, sizeof (*context)); + memset (context, 0, sizeof (*context)); } /* MD5 basic transformation. Transforms state based on block. */ Modified: head/sys/sys/md4.h ============================================================================== --- head/sys/sys/md4.h Thu May 26 19:17:51 2016 (r300772) +++ head/sys/sys/md4.h Thu May 26 19:29:29 2016 (r300773) @@ -39,10 +39,7 @@ __BEGIN_DECLS void MD4Init(MD4_CTX *); void MD4Update(MD4_CTX *, const unsigned char *, unsigned int); void MD4Pad(MD4_CTX *); -void MD4Final(unsigned char [16], MD4_CTX *); -char * MD4End(MD4_CTX *, char *); -char * MD4File(const char *, char *); -char * MD4Data(const unsigned char *, unsigned int, char *); +void MD4Final(unsigned char [static 16], MD4_CTX *); __END_DECLS #endif /* _MD4_H_ */ Modified: head/sys/sys/md5.h ============================================================================== --- head/sys/sys/md5.h Thu May 26 19:17:51 2016 (r300772) +++ head/sys/sys/md5.h Thu May 26 19:29:29 2016 (r300773) @@ -44,10 +44,6 @@ typedef struct MD5Context { __BEGIN_DECLS void MD5Init (MD5_CTX *); void MD5Update (MD5_CTX *, const void *, unsigned int); -void MD5Final (unsigned char [16], MD5_CTX *); -char * MD5End(MD5_CTX *, char *); -char * MD5File(const char *, char *); -char * MD5FileChunk(const char *, char *, off_t, off_t); -char * MD5Data(const void *, unsigned int, char *); +void MD5Final (unsigned char[static MD5_DIGEST_LENGTH], MD5_CTX *); __END_DECLS #endif /* _SYS_MD5_H_ */ From owner-svn-src-head@freebsd.org Thu May 26 20:19:59 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45F37B4BB9E; Thu, 26 May 2016 20:19:59 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 36E601D59; Thu, 26 May 2016 20:19:59 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by freefall.freebsd.org (Postfix) with ESMTP id D96C01AF2; Thu, 26 May 2016 20:19:58 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Date: Thu, 26 May 2016 20:19:57 +0000 From: Glen Barber <gjb@FreeBSD.org> To: "Conrad E. Meyer" <cem@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300773 - in head/sys: crypto crypto/aesni crypto/sha2 crypto/siphash kern sys Message-ID: <20160526201957.GU3335@FreeBSD.org> References: <201605261929.u4QJTTV5085421@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dw6fAZ2Gq7hkCwZ4" Content-Disposition: inline In-Reply-To: <201605261929.u4QJTTV5085421@repo.freebsd.org> X-Operating-System: FreeBSD 11.0-CURRENT amd64 X-SCUD-Definition: Sudden Completely Unexpected Dataloss X-SULE-Definition: Sudden Unexpected Learning Event X-PEKBAC-Definition: Problem Exists, Keyboard Between Admin/Computer User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 20:19:59 -0000 --dw6fAZ2Gq7hkCwZ4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 26, 2016 at 07:29:29PM +0000, Conrad E. Meyer wrote: > Author: cem > Date: Thu May 26 19:29:29 2016 > New Revision: 300773 > URL: https://svnweb.freebsd.org/changeset/base/300773 >=20 > Log: > crypto routines: Hint minimum buffer sizes to the compiler > =20 > Use the C99 'static' keyword to hint to the compiler IVs and output dig= est > sizes. The keyword informs the compiler of the minimum valid size for = a given > array. Obviously not every pointer can be validated (i.e., the compile= r can > produce false negative but not false positive reports). > =20 > No functional change. No ABI change. > =20 >=20 This change breaks -CURRENT. --- lib/libmd__L --- md5hl.c:48:10: warning: implicit declaration of function '_libmd_MD5FileChu= nk' is invalid in C99 [-Wimplicit-function-declaration] return (MD5FileChunk(filename, buf, 0, 0)); ^ /usr/src/lib/libmd/md5.h:32:22: note: expanded from macro 'MD5FileChunk' #define MD5FileChunk _libmd_MD5FileChunk ^ Glen --dw6fAZ2Gq7hkCwZ4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXR1ptAAoJEAMUWKVHj+KTOCIP/A6fXVR8MGtkeWDyeFgOdjuD y9Uu/9EXXzqwrE5FwwTryfSNG3uUll6kZE79bjTbkMR59McSt214IU9puo11+980 1GAThTp6K6boG0sxPBFOr2rEjGd3PO3t5OS9/wrHQsSfmdNn2a2V1G/RbDeMGEq+ yVldBpD5RchlmuQb/hf6hknTZ/MOe/MT1spf1NPXZRJMAI/D76jCL9TKpHxuVc3K gdV92YUpbAFkiQeAljR35+Y6o1bCPfPk22vlPoCYda0OCTq05u1TK6fd8hM6WYdB ETy9uNhS/2TRz98fc447sa624hraAmyhfpopQ1GDwWauLoIYA9N4/Pi7p41gtIpt ilTc6dW4jBtl8B+EaOV8uUckaWwDV+lZ29JxB19OG293cVZZpFeONhrIACdxuTlE 9kuUeINPTs0X0v5/Lp2ldV+oDmagZeNMjuW1GN6MrD4I1B8Fdej3P8Fda7J1Fn4d U8d5Lwd4L4Sc0NJg5cOC4s/c0onWjLsjLMvvlEEGQqr2qU5fAAyw9Jx+0M+tyYZR V+8ag3/StByTE00oI8sVt4+eowja9SHmRVCXkDgMxMlew5Apf98jPKmWULwSJrs4 nibpVsyR4/DO2HevdmRLzIF2pnDtuTBkLsRHFRVrOSrGO81IHIIWQlSnCN+vixrF 8s9K9zYhdIEMwmLc+9e4 =rlt8 -----END PGP SIGNATURE----- --dw6fAZ2Gq7hkCwZ4-- From owner-svn-src-head@freebsd.org Thu May 26 20:37:51 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 193A0B4B258; Thu, 26 May 2016 20:37:51 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF7A51A39; Thu, 26 May 2016 20:37:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QKbo1j010356; Thu, 26 May 2016 20:37:50 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QKboBj010354; Thu, 26 May 2016 20:37:50 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201605262037.u4QKboBj010354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" <cem@FreeBSD.org> Date: Thu, 26 May 2016 20:37:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300774 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 20:37:51 -0000 Author: cem Date: Thu May 26 20:37:49 2016 New Revision: 300774 URL: https://svnweb.freebsd.org/changeset/base/300774 Log: Ifndef KERNEL the userspace-only routines in sys/md[45].h A follow-up to r300773. Nothing in the kernel uses those definitions, but apparently libmd includes the sys/md45 headers. Fix the build. Reported by: gjb Pointy-hat: cem Sponsored by: EMC / Isilon Storage Division Modified: head/sys/sys/md4.h head/sys/sys/md5.h Modified: head/sys/sys/md4.h ============================================================================== --- head/sys/sys/md4.h Thu May 26 19:29:29 2016 (r300773) +++ head/sys/sys/md4.h Thu May 26 20:37:49 2016 (r300774) @@ -40,6 +40,11 @@ void MD4Init(MD4_CTX *); void MD4Update(MD4_CTX *, const unsigned char *, unsigned int); void MD4Pad(MD4_CTX *); void MD4Final(unsigned char [static 16], MD4_CTX *); +#ifndef _KERNEL +char * MD4End(MD4_CTX *, char *); +char * MD4File(const char *, char *); +char * MD4Data(const unsigned char *, unsigned int, char *); +#endif __END_DECLS #endif /* _MD4_H_ */ Modified: head/sys/sys/md5.h ============================================================================== --- head/sys/sys/md5.h Thu May 26 19:29:29 2016 (r300773) +++ head/sys/sys/md5.h Thu May 26 20:37:49 2016 (r300774) @@ -45,5 +45,11 @@ __BEGIN_DECLS void MD5Init (MD5_CTX *); void MD5Update (MD5_CTX *, const void *, unsigned int); void MD5Final (unsigned char[static MD5_DIGEST_LENGTH], MD5_CTX *); +#ifndef _KERNEL +char * MD5End(MD5_CTX *, char *); +char * MD5File(const char *, char *); +char * MD5FileChunk(const char *, char *, off_t, off_t); +char * MD5Data(const void *, unsigned int, char *); +#endif __END_DECLS #endif /* _SYS_MD5_H_ */ From owner-svn-src-head@freebsd.org Thu May 26 20:45:08 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77C45B4B432; Thu, 26 May 2016 20:45:08 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 0E64A1EB4; Thu, 26 May 2016 20:45:07 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: svn commit: r300774 - head/sys/sys To: "Conrad E. Meyer" <cem@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201605262037.u4QKboBj010354@repo.freebsd.org> From: Jung-uk Kim <jkim@FreeBSD.org> Message-ID: <34b0824d-3e31-beb3-5d77-81ef980c435f@FreeBSD.org> Date: Thu, 26 May 2016 16:45:02 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <201605262037.u4QKboBj010354@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3D4NKI4oEkEHNqc7tAmfnLCwo1T7cX3dk" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 20:45:08 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --3D4NKI4oEkEHNqc7tAmfnLCwo1T7cX3dk Content-Type: multipart/mixed; boundary="N7AqxerXXPreDAl1kIxwdFp56hXdvsg71" From: Jung-uk Kim <jkim@FreeBSD.org> To: "Conrad E. Meyer" <cem@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <34b0824d-3e31-beb3-5d77-81ef980c435f@FreeBSD.org> Subject: Re: svn commit: r300774 - head/sys/sys References: <201605262037.u4QKboBj010354@repo.freebsd.org> In-Reply-To: <201605262037.u4QKboBj010354@repo.freebsd.org> --N7AqxerXXPreDAl1kIxwdFp56hXdvsg71 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/26/16 04:37 PM, Conrad E. Meyer wrote: > Author: cem > Date: Thu May 26 20:37:49 2016 > New Revision: 300774 > URL: https://svnweb.freebsd.org/changeset/base/300774 >=20 > Log: > Ifndef KERNEL the userspace-only routines in sys/md[45].h > =20 > A follow-up to r300773. Nothing in the kernel uses those definitions= , but > apparently libmd includes the sys/md45 headers. Fix the build. =2E.. libmd/md4.h does not include sys/md4.h. Jung-uk Kim --N7AqxerXXPreDAl1kIxwdFp56hXdvsg71-- --3D4NKI4oEkEHNqc7tAmfnLCwo1T7cX3dk Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXR2BTAAoJEHyflib82/FGud0H/jNGZHDVoXni7BMZecHH5KB4 lFvOyi5NeMZDEfdRjMKRteTPmRWrlESEt1U0LCXb0lWwlz5lmhPR4F7kNdDrsl3X AzWtBPRFEpyVcySAUZJMrPSYotZ/K2gpI/AWb5fqptyajUw8TBTWa64w5lrasRin nF4HSnwapvzGYhLltfsQfJio8vUjaKwG+XmboujH0dQ9PVnAdGOkeFllrAI//tF9 73Efi3FT/cU16NEQ1HEC4ypYVm//OmwSp31hiUOSryDCyfxFiea5LxGyl8iZTY4u c0ZpodU/nJwttqbXND9DxBviiDlnVberszym0xGZQv87Wb90f7k3slQCz1kFcYc= =0yxO -----END PGP SIGNATURE----- --3D4NKI4oEkEHNqc7tAmfnLCwo1T7cX3dk-- From owner-svn-src-head@freebsd.org Thu May 26 20:55:16 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62652B4B72D; Thu, 26 May 2016 20:55:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1629814B7; Thu, 26 May 2016 20:55:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QKtF8h017469; Thu, 26 May 2016 20:55:15 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QKtFcJ017468; Thu, 26 May 2016 20:55:15 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201605262055.u4QKtFcJ017468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten <ed@FreeBSD.org> Date: Thu, 26 May 2016 20:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300775 - head/lib/libc/stdlib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 20:55:16 -0000 Author: ed Date: Thu May 26 20:55:15 2016 New Revision: 300775 URL: https://svnweb.freebsd.org/changeset/base/300775 Log: Let l64a() properly null terminate its result. Though the buffer used by l64a() is initialized with null bytes, repetetive calls may end up having trailing garbage of previous invocations because we don't end up terminating the string. Instead of importing NetBSD's fix, use this opportunity to simplify this function dramatically, for example by just storing the Base64 character set in a string. There is also no need to do the bitmasking, as we can just use the proper integer type from <stdint.h>. MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D6511 Modified: head/lib/libc/stdlib/l64a.c Modified: head/lib/libc/stdlib/l64a.c ============================================================================== --- head/lib/libc/stdlib/l64a.c Thu May 26 20:37:49 2016 (r300774) +++ head/lib/libc/stdlib/l64a.c Thu May 26 20:55:15 2016 (r300775) @@ -12,18 +12,13 @@ __RCSID("$NetBSD: l64a.c,v 1.13 2003/07/ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include <stdint.h> #include <stdlib.h> -#define ADOT 46 /* ASCII '.' */ -#define ASLASH ADOT + 1 /* ASCII '/' */ -#define A0 48 /* ASCII '0' */ -#define AA 65 /* ASCII 'A' */ -#define Aa 97 /* ASCII 'a' */ - char * l64a(long value) { - static char buf[8]; + static char buf[7]; (void)l64a_r(value, buf, sizeof(buf)); return (buf); @@ -32,21 +27,18 @@ l64a(long value) int l64a_r(long value, char *buffer, int buflen) { - long v; - int digit; - - v = value & (long)0xffffffff; - for (; v != 0 && buflen > 1; buffer++, buflen--) { - digit = v & 0x3f; - if (digit < 2) - *buffer = digit + ADOT; - else if (digit < 12) - *buffer = digit + A0 - 2; - else if (digit < 38) - *buffer = digit + AA - 12; - else - *buffer = digit + Aa - 38; + static const char chars[] = + "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + uint32_t v; + + v = value; + while (buflen-- > 0) { + if (v == 0) { + *buffer = '\0'; + return (0); + } + *buffer++ = chars[v & 0x3f]; v >>= 6; } - return (v == 0 ? 0 : -1); + return (-1); } From owner-svn-src-head@freebsd.org Thu May 26 21:07:32 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E8C7B4BA5C; Thu, 26 May 2016 21:07:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 688101BEA; Thu, 26 May 2016 21:07:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id u4QL7UOg009283 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 26 May 2016 14:07:31 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id u4QL7Ujs009282; Thu, 26 May 2016 14:07:30 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 26 May 2016 14:07:30 -0700 From: Gleb Smirnoff <glebius@FreeBSD.org> To: Hans Petter Selasky <hselasky@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300489 - head/sys/kern Message-ID: <20160526210730.GH58287@FreeBSD.org> References: <201605231031.u4NAVspJ081312@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201605231031.u4NAVspJ081312@repo.freebsd.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 21:07:32 -0000 On Mon, May 23, 2016 at 10:31:54AM +0000, Hans Petter Selasky wrote: H> Author: hselasky H> Date: Mon May 23 10:31:54 2016 H> New Revision: 300489 H> URL: https://svnweb.freebsd.org/changeset/base/300489 H> H> Log: H> Use DELAY() instead of _sleep() when SCHEDULER_STOPPED() is set inside H> pause_sbt(). This allows pause() to continue working during a panic() H> which is not invoking KDB. This is useful when debugging graphics H> drivers using the LinuxKPI. H> H> Obtained from: kmacy @ H> MFC after: 1 week I wonder if this will help me with my freezes after panics in geom_mirror() and in mps(4), which I handled as similar patches to these drivers theirselves. Thanks! H> Modified: head/sys/kern/kern_synch.c H> ============================================================================== H> --- head/sys/kern/kern_synch.c Mon May 23 09:44:06 2016 (r300488) H> +++ head/sys/kern/kern_synch.c Mon May 23 10:31:54 2016 (r300489) H> @@ -327,7 +327,7 @@ pause_sbt(const char *wmesg, sbintime_t H> if (sbt == 0) H> sbt = tick_sbt; H> H> - if (cold || kdb_active) { H> + if (cold || kdb_active || SCHEDULER_STOPPED()) { H> /* H> * We delay one second at a time to avoid overflowing the H> * system specific DELAY() function(s): -- Totus tuus, Glebius. From owner-svn-src-head@freebsd.org Thu May 26 21:08:46 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FD0DB4BB02; Thu, 26 May 2016 21:08:46 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5A5E1D82; Thu, 26 May 2016 21:08:45 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QL8jfe021336; Thu, 26 May 2016 21:08:45 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QL8iY7021334; Thu, 26 May 2016 21:08:44 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201605262108.u4QL8iY7021334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber <gjb@FreeBSD.org> Date: Thu, 26 May 2016 21:08:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300776 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 21:08:46 -0000 Author: gjb Date: Thu May 26 21:08:44 2016 New Revision: 300776 URL: https://svnweb.freebsd.org/changeset/base/300776 Log: Remove vestigial cloudware-install bits missed in r300767. Sponsored by: The FreeBSD Foundation Modified: head/release/Makefile head/release/Makefile.vm Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Thu May 26 20:55:15 2016 (r300775) +++ head/release/Makefile Thu May 26 21:08:44 2016 (r300776) @@ -291,7 +291,7 @@ real-release: ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS} -install: release-install vm-install cloudware-install +install: release-install vm-install release-install: .if defined(DESTDIR) && !empty(DESTDIR) Modified: head/release/Makefile.vm ============================================================================== --- head/release/Makefile.vm Thu May 26 20:55:15 2016 (r300775) +++ head/release/Makefile.vm Thu May 26 21:08:44 2016 (r300776) @@ -46,7 +46,6 @@ CLEANFILES+= ${_CW:tl}.img \ ${_CW:tl}.${${_CW:tu}_FORMAT} \ ${_CW:tl}.${${_CW:tu}_FORMAT}.raw \ cw${_CW:tl}-package -CLOUDINSTALL+= cw${_CW:tl}-install CLOUDPACKAGE+= cw${_CW:tl}-package ${_CW:tu}IMAGE= ${_CW:tl}.${${_CW:tu}_FORMAT} . if exists(${.CURDIR}/tools/${_CW:tl}.conf) && !defined(${_CW:tu}CONF) @@ -145,11 +144,6 @@ cloudware-release: ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${CLOUDTARGETS} .endif -cloudware-install: -.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE) - ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${CLOUDINSTALL} -.endif - .include "${.CURDIR}/Makefile.ec2" .include "${.CURDIR}/Makefile.azure" .include "${.CURDIR}/Makefile.gce" From owner-svn-src-head@freebsd.org Thu May 26 21:09:09 2016 Return-Path: <owner-svn-src-head@freebsd.org> Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 432D4B4BB68; Thu, 26 May 2016 21:09:09 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EE621EE8; Thu, 26 May 2016 21:09:08 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QL98qG021404; Thu, 26 May 2016 21:09:08 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QL97Hl021395; Thu, 26 May 2016 21:09:07 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201605262109.u4QL97Hl021395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot <manu@FreeBSD.org> Date: Thu, 26 May 2016 21:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300777 - in head/sys: arm/allwinner boot/fdt/dts/arm dev/iicbus/twsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 26 May 2016 21:09:09 -0000 Author: manu Date: Thu May 26 21:09:07 2016 New Revision: 300777 URL: https://svnweb.freebsd.org/changeset/base/300777 Log: Add support for interrupts, sensors and GPIO for AXP209 PMIC. Pressing the PEK (power enable key) will shutdown the board. Some events are reported to devd via system "PMU" and subsystem "Battery", "AC" and "USB" such as connected/disconnected. Some sensors values (power source voltage/current) are reported via sysctl (dev.axp209_pmu.X.) It also expose a gpioc node usable in kernel and userland. Only 3 of the 4 GPIO are exposed (The GPIO3 is different and mostly unused on boards). Most popular boards uses GPIO1 as a sense pin for OTG power. Add a dtsi file that adds gpio-controller capability to the device as upstream doesn't defined it and include it in our custom DTS. Reviewed by: jmcneill Approved by: cognet (mentor) Differential Revision: https://reviews.freebsd.org/D6135 Added: head/sys/arm/allwinner/axp209reg.h (contents, props changed) head/sys/boot/fdt/dts/arm/xpowers-axp209.dtsi (contents, props changed) Modified: head/sys/arm/allwinner/axp209.c head/sys/boot/fdt/dts/arm/bananapi.dts head/sys/boot/fdt/dts/arm/cubieboard.dts head/sys/boot/fdt/dts/arm/cubieboard2.dts head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts head/sys/boot/fdt/dts/arm/olinuxino-lime.dts head/sys/dev/iicbus/twsi/a10_twsi.c Modified: head/sys/arm/allwinner/axp209.c ============================================================================== --- head/sys/arm/allwinner/axp209.c Thu May 26 21:08:44 2016 (r300776) +++ head/sys/arm/allwinner/axp209.c Thu May 26 21:09:07 2016 (r300777) @@ -1,5 +1,6 @@ /*- - * Copyright (c) 2015 Emmanuel Vadot <manu@bidouilliste.com> + * Copyright (c) 2015-2016 Emmanuel Vadot <manu@freebsd.org> + * Copyright (c) 2016 Jared McNeill <jmcneill@invisible.ca> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include <sys/time.h> #include <sys/bus.h> #include <sys/proc.h> +#include <sys/gpio.h> #include <sys/reboot.h> #include <sys/resource.h> #include <sys/rman.h> @@ -46,40 +48,45 @@ __FBSDID("$FreeBSD$"); #include <dev/iicbus/iicbus.h> #include <dev/iicbus/iiconf.h> +#include <dev/gpio/gpiobusvar.h> + #include <dev/ofw/openfirm.h> #include <dev/ofw/ofw_bus.h> #include <dev/ofw/ofw_bus_subr.h> -#include "iicbus_if.h" - -/* Power State Register */ -#define AXP209_PSR 0x00 -#define AXP209_PSR_ACIN 0x80 -#define AXP209_PSR_ACIN_SHIFT 7 -#define AXP209_PSR_VBUS 0x20 -#define AXP209_PSR_VBUS_SHIFT 5 - -/* Shutdown and battery control */ -#define AXP209_SHUTBAT 0x32 -#define AXP209_SHUTBAT_SHUTDOWN 0x80 - -/* Temperature monitor */ -#define AXP209_TEMPMON 0x5e -#define AXP209_TEMPMON_H(a) ((a) << 4) -#define AXP209_TEMPMON_L(a) ((a) & 0xf) -#define AXP209_TEMPMON_MIN 1447 /* -144.7C */ +#include <arm/allwinner/axp209reg.h> -#define AXP209_0C_TO_K 2731 +#include "iicbus_if.h" +#include "gpio_if.h" struct axp209_softc { + device_t dev; uint32_t addr; - struct intr_config_hook enum_hook; + struct resource * res[1]; + void * intrcookie; + struct intr_config_hook intr_hook; + device_t gpiodev; + struct mtx mtx; +}; + +/* GPIO3 is different, don't expose it for now */ +static const struct { + const char *name; + uint8_t ctrl_reg; +} axp209_pins[] = { + { "GPIO0", AXP209_GPIO0_CTRL }, + { "GPIO1", AXP209_GPIO1_CTRL }, + { "GPIO2", AXP209_GPIO2_CTRL }, }; -enum axp209_sensor { - AXP209_TEMP +static struct resource_spec axp_res_spec[] = { + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { -1, 0, 0 } }; +#define AXP_LOCK(sc) mtx_lock(&(sc)->mtx) +#define AXP_UNLOCK(sc) mtx_unlock(&(sc)->mtx) + static int axp209_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size) { @@ -125,16 +132,75 @@ axp209_sysctl(SYSCTL_HANDLER_ARGS) uint8_t data[2]; int val, error; - if (sensor != AXP209_TEMP) + switch (sensor) { + case AXP209_TEMP: + error = axp209_read(dev, AXP209_TEMPMON, data, 2); + if (error != 0) + return (error); + + /* Temperature is between -144.7C and 264.8C, step +0.1C */ + val = (AXP209_SENSOR_H(data[0]) | AXP209_SENSOR_L(data[1])) - + AXP209_TEMPMON_MIN + AXP209_0C_TO_K; + break; + case AXP209_ACVOLT: + error = axp209_read(dev, AXP209_ACIN_VOLTAGE, data, 2); + if (error != 0) + return (error); + + val = (AXP209_SENSOR_H(data[0]) | AXP209_SENSOR_L(data[1])) * + AXP209_VOLT_STEP; + break; + case AXP209_ACCURRENT: + error = axp209_read(dev, AXP209_ACIN_CURRENT, data, 2); + if (error != 0) + return (error); + + val = (AXP209_SENSOR_H(data[0]) | AXP209_SENSOR_L(data[1])) * + AXP209_ACCURRENT_STEP; + break; + case AXP209_VBUSVOLT: + error = axp209_read(dev, AXP209_VBUS_VOLTAGE, data, 2); + if (error != 0) + return (error); + + val = (AXP209_SENSOR_H(data[0]) | AXP209_SENSOR_L(data[1])) * + AXP209_VOLT_STEP; + break; + case AXP209_VBUSCURRENT: + error = axp209_read(dev, AXP209_VBUS_CURRENT, data, 2); + if (error != 0) + return (error); + + val = (AXP209_SENSOR_H(data[0]) | AXP209_SENSOR_L(data[1])) * + AXP209_VBUSCURRENT_STEP; + break; + case AXP209_BATVOLT: + error = axp209_read(dev, AXP209_BAT_VOLTAGE, data, 2); + if (error != 0) + return (error); + + val = (AXP209_SENSOR_H(data[0]) | AXP209_SENSOR_L(data[1])) * + AXP209_BATVOLT_STEP; + break; + case AXP209_BATCHARGECURRENT: + error = axp209_read(dev, AXP209_BAT_CHARGE_CURRENT, data, 2); + if (error != 0) + return (error); + + val = (AXP209_SENSOR_H(data[0]) | AXP209_SENSOR_L(data[1])) * + AXP209_BATCURRENT_STEP; + break; + case AXP209_BATDISCHARGECURRENT: + error = axp209_read(dev, AXP209_BAT_DISCHARGE_CURRENT, data, 2); + if (error != 0) + return (error); + + val = (AXP209_SENSOR_BAT_H(data[0]) | + AXP209_SENSOR_BAT_L(data[1])) * AXP209_BATCURRENT_STEP; + break; + default: return (ENOENT); - - error = axp209_read(dev, AXP209_TEMPMON, data, 2); - if (error != 0) - return (error); - - /* Temperature is between -144.7C and 264.8C, step +0.1C */ - val = (AXP209_TEMPMON_H(data[0]) | AXP209_TEMPMON_L(data[1])) - - AXP209_TEMPMON_MIN + AXP209_0C_TO_K; + } return sysctl_handle_opaque(oidp, &val, sizeof(val), req); } @@ -154,32 +220,317 @@ axp209_shutdown(void *devp, int howto) axp209_write(dev, AXP209_SHUTBAT, AXP209_SHUTBAT_SHUTDOWN); } +static void +axp_intr(void *arg) +{ + struct axp209_softc *sc; + uint8_t reg; + + sc = arg; + + axp209_read(sc->dev, AXP209_IRQ1_STATUS, ®, 1); + if (reg) { + if (reg & AXP209_IRQ1_AC_OVERVOLT) + devctl_notify("PMU", "AC", "overvoltage", NULL); + if (reg & AXP209_IRQ1_VBUS_OVERVOLT) + devctl_notify("PMU", "USB", "overvoltage", NULL); + if (reg & AXP209_IRQ1_VBUS_LOW) + devctl_notify("PMU", "USB", "undervoltage", NULL); + if (reg & AXP209_IRQ1_AC_CONN) + devctl_notify("PMU", "AC", "plugged", NULL); + if (reg & AXP209_IRQ1_AC_DISCONN) + devctl_notify("PMU", "AC", "unplugged", NULL); + if (reg & AXP209_IRQ1_VBUS_CONN) + devctl_notify("PMU", "USB", "plugged", NULL); + if (reg & AXP209_IRQ1_VBUS_DISCONN) + devctl_notify("PMU", "USB", "unplugged", NULL); + axp209_write(sc->dev, AXP209_IRQ1_STATUS, AXP209_IRQ_ACK); + } + + axp209_read(sc->dev, AXP209_IRQ2_STATUS, ®, 1); + if (reg) { + if (reg & AXP209_IRQ2_BATT_CHARGED) + devctl_notify("PMU", "Battery", "charged", NULL); + if (reg & AXP209_IRQ2_BATT_CHARGING) + devctl_notify("PMU", "Battery", "charging", NULL); + if (reg & AXP209_IRQ2_BATT_CONN) + devctl_notify("PMU", "Battery", "connected", NULL); + if (reg & AXP209_IRQ2_BATT_DISCONN) + devctl_notify("PMU", "Battery", "disconnected", NULL); + if (reg & AXP209_IRQ2_BATT_TEMP_LOW) + devctl_notify("PMU", "Battery", "low temp", NULL); + if (reg & AXP209_IRQ2_BATT_TEMP_OVER) + devctl_notify("PMU", "Battery", "high temp", NULL); + axp209_write(sc->dev, AXP209_IRQ2_STATUS, AXP209_IRQ_ACK); + } + + axp209_read(sc->dev, AXP209_IRQ3_STATUS, ®, 1); + if (reg) { + if (reg & AXP209_IRQ3_PEK_SHORT) + shutdown_nice(RB_POWEROFF); + axp209_write(sc->dev, AXP209_IRQ3_STATUS, AXP209_IRQ_ACK); + } + + axp209_read(sc->dev, AXP209_IRQ4_STATUS, ®, 1); + if (reg) { + axp209_write(sc->dev, AXP209_IRQ4_STATUS, AXP209_IRQ_ACK); + } + + axp209_read(sc->dev, AXP209_IRQ5_STATUS, ®, 1); + if (reg) { + axp209_write(sc->dev, AXP209_IRQ5_STATUS, AXP209_IRQ_ACK); + } +} + +static device_t +axp209_gpio_get_bus(device_t dev) +{ + struct axp209_softc *sc; + + sc = device_get_softc(dev); + + return (sc->gpiodev); +} + static int -axp209_probe(device_t dev) +axp209_gpio_pin_max(device_t dev, int *maxpin) { + *maxpin = nitems(axp209_pins) - 1; - if (!ofw_bus_status_okay(dev)) - return (ENXIO); + return (0); +} - if (!ofw_bus_is_compatible(dev, "x-powers,axp209")) - return (ENXIO); +static int +axp209_gpio_pin_getname(device_t dev, uint32_t pin, char *name) +{ + if (pin >= nitems(axp209_pins)) + return (EINVAL); - device_set_desc(dev, "X-Power AXP209 Power Management Unit"); + snprintf(name, GPIOMAXNAME, "%s", axp209_pins[pin].name); - return (BUS_PROBE_DEFAULT); + return (0); } static int -axp209_attach(device_t dev) +axp209_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) +{ + if (pin >= nitems(axp209_pins)) + return (EINVAL); + + *caps = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT; + + return (0); +} + +static int +axp209_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags) { struct axp209_softc *sc; + uint8_t data, func; + int error; + + if (pin >= nitems(axp209_pins)) + return (EINVAL); + + sc = device_get_softc(dev); + + AXP_LOCK(sc); + error = axp209_read(dev, axp209_pins[pin].ctrl_reg, &data, 1); + if (error == 0) { + func = data & AXP209_GPIO_FUNC_MASK; + if (func == AXP209_GPIO_FUNC_INPUT) + *flags = GPIO_PIN_INPUT; + else if (func == AXP209_GPIO_FUNC_DRVLO || + func == AXP209_GPIO_FUNC_DRVHI) + *flags = GPIO_PIN_OUTPUT; + else + *flags = 0; + } + AXP_UNLOCK(sc); + + return (error); +} + +static int +axp209_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) +{ + struct axp209_softc *sc; + uint8_t data; + int error; + + if (pin >= nitems(axp209_pins)) + return (EINVAL); + + sc = device_get_softc(dev); + + AXP_LOCK(sc); + error = axp209_read(dev, axp209_pins[pin].ctrl_reg, &data, 1); + if (error == 0) { + data &= ~AXP209_GPIO_FUNC_MASK; + if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) != 0) { + if ((flags & GPIO_PIN_OUTPUT) == 0) + data |= AXP209_GPIO_FUNC_INPUT; + } + error = axp209_write(dev, axp209_pins[pin].ctrl_reg, data); + } + AXP_UNLOCK(sc); + + return (error); +} + +static int +axp209_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) +{ + struct axp209_softc *sc; + uint8_t data, func; + int error; + + if (pin >= nitems(axp209_pins)) + return (EINVAL); + + sc = device_get_softc(dev); + + AXP_LOCK(sc); + error = axp209_read(dev, axp209_pins[pin].ctrl_reg, &data, 1); + if (error == 0) { + func = data & AXP209_GPIO_FUNC_MASK; + switch (func) { + case AXP209_GPIO_FUNC_DRVLO: + *val = 0; + break; + case AXP209_GPIO_FUNC_DRVHI: + *val = 1; + break; + case AXP209_GPIO_FUNC_INPUT: + error = axp209_read(dev, AXP209_GPIO_STATUS, &data, 1); + if (error == 0) + *val = (data & AXP209_GPIO_DATA(pin)) ? 1 : 0; + break; + default: + error = EIO; + break; + } + } + AXP_UNLOCK(sc); + + return (error); +} + +static int +axp209_gpio_pin_set(device_t dev, uint32_t pin, unsigned int val) +{ + struct axp209_softc *sc; + uint8_t data, func; + int error; + + if (pin >= nitems(axp209_pins)) + return (EINVAL); + + sc = device_get_softc(dev); + + AXP_LOCK(sc); + error = axp209_read(dev, axp209_pins[pin].ctrl_reg, &data, 1); + if (error == 0) { + func = data & AXP209_GPIO_FUNC_MASK; + switch (func) { + case AXP209_GPIO_FUNC_DRVLO: + case AXP209_GPIO_FUNC_DRVHI: + /* GPIO2 can't be set to 1 */ + if (pin == 2 && val == 1) { + error = EINVAL; + break; + } + data &= ~AXP209_GPIO_FUNC_MASK; + data |= val; + break; + default: + error = EIO; + break; + } + } + if (error == 0) + error = axp209_write(dev, axp209_pins[pin].ctrl_reg, data); + AXP_UNLOCK(sc); + + return (error); +} + + +static int +axp209_gpio_pin_toggle(device_t dev, uint32_t pin) +{ + struct axp209_softc *sc; + uint8_t data, func; + int error; + + if (pin >= nitems(axp209_pins)) + return (EINVAL); + + sc = device_get_softc(dev); + + AXP_LOCK(sc); + error = axp209_read(dev, axp209_pins[pin].ctrl_reg, &data, 1); + if (error == 0) { + func = data & AXP209_GPIO_FUNC_MASK; + switch (func) { + case AXP209_GPIO_FUNC_DRVLO: + /* Pin 2 can't be set to 1*/ + if (pin == 2) { + error = EINVAL; + break; + } + data &= ~AXP209_GPIO_FUNC_MASK; + data |= AXP209_GPIO_FUNC_DRVHI; + break; + case AXP209_GPIO_FUNC_DRVHI: + data &= ~AXP209_GPIO_FUNC_MASK; + data |= AXP209_GPIO_FUNC_DRVLO; + break; + default: + error = EIO; + break; + } + } + if (error == 0) + error = axp209_write(dev, axp209_pins[pin].ctrl_reg, data); + AXP_UNLOCK(sc); + + return (error); +} + +static int +axp209_gpio_map_gpios(device_t bus, phandle_t dev, phandle_t gparent, + int gcells, pcell_t *gpios, uint32_t *pin, uint32_t *flags) +{ + if (gpios[0] >= nitems(axp209_pins)) + return (EINVAL); + + *pin = gpios[0]; + *flags = gpios[1]; + + return (0); +} + +static phandle_t +axp209_get_node(device_t dev, device_t bus) +{ + return (ofw_bus_get_node(dev)); +} + +static void +axp209_start(void *pdev) +{ + device_t dev; + struct axp209_softc *sc; const char *pwr_name[] = {"Battery", "AC", "USB", "AC and USB"}; uint8_t data; uint8_t pwr_src; - sc = device_get_softc(dev); + dev = pdev; + sc = device_get_softc(dev); sc->addr = iicbus_get_addr(dev); + sc->dev = dev; if (bootverbose) { /* @@ -195,22 +546,154 @@ axp209_attach(device_t dev) pwr_name[pwr_src]); } + /* Only enable interrupts that we are interested in */ + axp209_write(dev, AXP209_IRQ1_ENABLE, + AXP209_IRQ1_AC_OVERVOLT | + AXP209_IRQ1_AC_DISCONN | + AXP209_IRQ1_AC_CONN | + AXP209_IRQ1_VBUS_OVERVOLT | + AXP209_IRQ1_VBUS_DISCONN | + AXP209_IRQ1_VBUS_CONN); + axp209_write(dev, AXP209_IRQ2_ENABLE, + AXP209_IRQ2_BATT_CONN | + AXP209_IRQ2_BATT_DISCONN | + AXP209_IRQ2_BATT_CHARGE_ACCT_ON | + AXP209_IRQ2_BATT_CHARGE_ACCT_OFF | + AXP209_IRQ2_BATT_CHARGING | + AXP209_IRQ2_BATT_CHARGED | + AXP209_IRQ2_BATT_TEMP_OVER | + AXP209_IRQ2_BATT_TEMP_LOW); + axp209_write(dev, AXP209_IRQ3_ENABLE, + AXP209_IRQ3_PEK_SHORT | AXP209_IRQ3_PEK_LONG); + axp209_write(dev, AXP209_IRQ4_ENABLE, AXP209_IRQ4_APS_LOW_2); + axp209_write(dev, AXP209_IRQ5_ENABLE, 0x0); + EVENTHANDLER_REGISTER(shutdown_final, axp209_shutdown, dev, SHUTDOWN_PRI_LAST); + /* Enable ADC sensors */ + if (axp209_write(dev, AXP209_ADC_ENABLE1, + AXP209_ADC1_BATVOLT | AXP209_ADC1_BATCURRENT | + AXP209_ADC1_ACVOLT | AXP209_ADC1_ACCURRENT | + AXP209_ADC1_VBUSVOLT | AXP209_ADC1_VBUSCURRENT) != -1) { + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "acvolt", + CTLTYPE_INT | CTLFLAG_RD, + dev, AXP209_ACVOLT, axp209_sysctl, "I", + "AC Voltage (microVolt)"); + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "accurrent", + CTLTYPE_INT | CTLFLAG_RD, + dev, AXP209_ACCURRENT, axp209_sysctl, "I", + "AC Current (microAmpere)"); + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "vbusvolt", + CTLTYPE_INT | CTLFLAG_RD, + dev, AXP209_VBUSVOLT, axp209_sysctl, "I", + "VBUS Voltage (microVolt)"); + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "vbuscurrent", + CTLTYPE_INT | CTLFLAG_RD, + dev, AXP209_VBUSCURRENT, axp209_sysctl, "I", + "VBUS Current (microAmpere)"); + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "batvolt", + CTLTYPE_INT | CTLFLAG_RD, + dev, AXP209_BATVOLT, axp209_sysctl, "I", + "Battery Voltage (microVolt)"); + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "batchargecurrent", + CTLTYPE_INT | CTLFLAG_RD, + dev, AXP209_BATCHARGECURRENT, axp209_sysctl, "I", + "Battery Charging Current (microAmpere)"); + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "batdischargecurrent", + CTLTYPE_INT | CTLFLAG_RD, + dev, AXP209_BATDISCHARGECURRENT, axp209_sysctl, "I", + "Battery Discharging Current (microAmpere)"); + } else { + device_printf(dev, "Couldn't enable ADC sensors\n"); + } + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "temp", CTLTYPE_INT | CTLFLAG_RD, dev, AXP209_TEMP, axp209_sysctl, "IK", "Internal temperature"); + if ((bus_setup_intr(dev, sc->res[0], INTR_TYPE_MISC | INTR_MPSAFE, + NULL, axp_intr, sc, &sc->intrcookie))) + device_printf(dev, "unable to register interrupt handler\n"); + + config_intrhook_disestablish(&sc->intr_hook); +} + +static int +axp209_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "x-powers,axp209")) + return (ENXIO); + + device_set_desc(dev, "X-Powers AXP209 Power Management Unit"); + + return (BUS_PROBE_DEFAULT); +} + +static int +axp209_attach(device_t dev) +{ + struct axp209_softc *sc; + + sc = device_get_softc(dev); + mtx_init(&sc->mtx, device_get_nameunit(dev), NULL, MTX_DEF); + + if (bus_alloc_resources(dev, axp_res_spec, sc->res) != 0) { + device_printf(dev, "can't allocate device resources\n"); + return (ENXIO); + } + + sc->intr_hook.ich_func = axp209_start; + sc->intr_hook.ich_arg = dev; + + if (config_intrhook_establish(&sc->intr_hook) != 0) + return (ENOMEM); + + sc->gpiodev = gpiobus_attach_bus(dev); + return (0); } static device_method_t axp209_methods[] = { DEVMETHOD(device_probe, axp209_probe), DEVMETHOD(device_attach, axp209_attach), - {0, 0}, + + /* GPIO interface */ + DEVMETHOD(gpio_get_bus, axp209_gpio_get_bus), + DEVMETHOD(gpio_pin_max, axp209_gpio_pin_max), + DEVMETHOD(gpio_pin_getname, axp209_gpio_pin_getname), + DEVMETHOD(gpio_pin_getcaps, axp209_gpio_pin_getcaps), + DEVMETHOD(gpio_pin_getflags, axp209_gpio_pin_getflags), + DEVMETHOD(gpio_pin_setflags, axp209_gpio_pin_setflags), + DEVMETHOD(gpio_pin_get, axp209_gpio_pin_get), + DEVMETHOD(gpio_pin_set, axp209_gpio_pin_set), + DEVMETHOD(gpio_pin_toggle, axp209_gpio_pin_toggle), + DEVMETHOD(gpio_map_gpios, axp209_gpio_map_gpios), + + /* OFW bus interface */ + DEVMETHOD(ofw_bus_get_node, axp209_get_node), + + DEVMETHOD_END }; static driver_t axp209_driver = { @@ -220,7 +703,14 @@ static driver_t axp209_driver = { }; static devclass_t axp209_devclass; +extern devclass_t ofwgpiobus_devclass, gpioc_devclass; +extern driver_t ofw_gpiobus_driver, gpioc_driver; -DRIVER_MODULE(axp209, iicbus, axp209_driver, axp209_devclass, 0, 0); +EARLY_DRIVER_MODULE(axp209, iicbus, axp209_driver, axp209_devclass, + 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); +EARLY_DRIVER_MODULE(ofw_gpiobus, axp209_pmu, ofw_gpiobus_driver, + ofwgpiobus_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); +EARLY_DRIVER_MODULE(gpioc, axp209_pmu, gpioc_driver, gpioc_devclass, + 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); MODULE_VERSION(axp209, 1); MODULE_DEPEND(axp209, iicbus, 1, 1, 1); Added: head/sys/arm/allwinner/axp209reg.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/axp209reg.h Thu May 26 21:09:07 2016 (r300777) @@ -0,0 +1,160 @@ +/*- + * Copyright (c) 2016 Emmanuel Vadot <manu@freeebsd.org> + * 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