From owner-svn-src-projects@FreeBSD.ORG Sun Mar 18 00:08:54 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2C49E106566B; Sun, 18 Mar 2012 00:08:54 +0000 (UTC) (envelope-from gjb@semihalf.com) Received: from smtp.semihalf.com (smtp.semihalf.com [213.17.239.109]) by mx1.freebsd.org (Postfix) with ESMTP id C65418FC18; Sun, 18 Mar 2012 00:08:53 +0000 (UTC) Received: from localhost (unknown [213.17.239.109]) by smtp.semihalf.com (Postfix) with ESMTP id 4EEF5EC2EB; Sun, 18 Mar 2012 01:08:45 +0100 (CET) X-Virus-Scanned: by amavisd-new at semihalf.com Received: from smtp.semihalf.com ([213.17.239.109]) by localhost (smtp.semihalf.com [213.17.239.109]) (amavisd-new, port 10024) with ESMTP id TGCIePMWC3rD; Sun, 18 Mar 2012 01:08:44 +0100 (CET) Received: from [172.17.136.194] (adsl-64-175-228-30.dsl.sntc01.pacbell.net [64.175.228.30]) by smtp.semihalf.com (Postfix) with ESMTPSA id 40C84EBE32; Sun, 18 Mar 2012 01:08:43 +0100 (CET) Message-ID: <4F652791.3020103@semihalf.com> Date: Sun, 18 Mar 2012 01:08:49 +0100 From: Grzegorz Bernacki User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201203171710.q2HHAFiq079651@svn.freebsd.org> <20120317215156.GJ1340@garage.freebsd.pl> In-Reply-To: <20120317215156.GJ1340@garage.freebsd.pl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-projects@freebsd.org, Grzegorz Bernacki , src-committers@freebsd.org Subject: Re: svn commit: r233091 - in projects/nand: sbin/fdisk sys/sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 00:08:54 -0000 W dniu 2012-03-17 22:51, Pawel Jakub Dawidek pisze: > On Sat, Mar 17, 2012 at 05:10:15PM +0000, Grzegorz Bernacki wrote: >> Author: gber >> Date: Sat Mar 17 17:10:14 2012 >> New Revision: 233091 >> URL: http://svn.freebsd.org/changeset/base/233091 >> >> Log: >> Add ioctl and structures for accessing nand disk devices. > Grzegorz, this is really wrong way to do it. Neither geom_dev nor > geom_disk are the places to add NAND specific ioctls. > > The DEV GEOM class will forward unknown ioctl to provider's class. In > this case to the DISK class. The DISK class will also forward ioctls to > your method. Take a look at the g_disk_ioctl() function. When you > configure your disk structure between disk_alloc() and disk_create() you > just need to set d_ioctl field to your ioctl method and handle all > ioctls specific to your class there. See disk(9) for more info. > > Ioctl is also the way you should send/receive metadata (eventually > BIO_GETATTR) and not to introduce new BIO types that will only be used > by one GEOM class. > > Don't hesitate to discuss this stuff on the freebsd-geom@ mailing list > to avoid surprises on the commit day. Thanks for comments. Let me check it one more time and I'll talk with you later. grzesiek >> Modified: projects/nand/sys/sys/disk.h >> ============================================================================== >> --- projects/nand/sys/sys/disk.h Sat Mar 17 16:40:15 2012 (r233090) >> +++ projects/nand/sys/sys/disk.h Sat Mar 17 17:10:14 2012 (r233091) >> @@ -116,6 +116,32 @@ void disk_err(struct bio *bp, const char >> * This should be a multiple of the sector size. >> */ >> >> +#define DIOCNOOBSIZE _IOR('d', 141, u_int) /* Get oob size */ >> + /*- >> + * Get the OOB area size of NAND flash device. >> + */ >> + >> +#define DIOCNBLKSIZE _IOR('d', 142, u_int) /* Get block size */ >> + /* - >> + * Get the block size of NAND flash device. >> + */ >> + >> +struct nand_oob_request { >> + off_t offset; /* offset in bytes, page-aligned */ >> + off_t length; /* length */ >> + void * ubuf; /* buffer supplied by user */ >> +}; >> + >> +#define DIOCNREADOOB _IOW('d', 143, struct nand_oob_request) /* Read OOB area */ >> + /*- >> + * Read page OOB area from NAND flash device. >> + */ >> + >> +#define DIOCNWRITEOOB _IOW('d', 144, struct nand_oob_request) /* Write OOB area */ >> + /*- >> + * Write page OOB area to NAND flash device. >> + */ >> + >> #define DIOCGPHYSPATH _IOR('d', 141, char[MAXPATHLEN]) >> /* >> * Get a string defining the physical path for a given provider. From owner-svn-src-projects@FreeBSD.ORG Sun Mar 18 00:16:05 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2A8DA1065680; Sun, 18 Mar 2012 00:16:05 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 0537E8FC08; Sun, 18 Mar 2012 00:16:03 +0000 (UTC) Received: by lboi15 with SMTP id i15so3664452lbo.13 for ; Sat, 17 Mar 2012 17:15:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=yK7A9L0yV3qrSLVxeMnFNqysj8MIXkyt0a2SIHQ8/kE=; b=esu3+fq6qxj5S8bIyY/dJ3vC/0dxLgRDccbrQ5R3c1s9IKkWQoSNylO6wJg+k+PH2s EOu/Kjm928VP24rk6NH2FGYNEfmZVAtjlfSLCB+OApXlvVAPU1FxGEqeBZWiw0rnpSRk dN2TJJT/dT8kjcbc82OxCDBSy2wOMjkHErdzWxiytwnz2P8hn19tZOTmwpNdbUwGFeLx +8ZNAzBmU4SKSKCSN5t2kKhTxLIQfltuBo53oFEBl/VyB2WKgaSFSAOWa/xOU5TRdVhH EfIvdqo9eD8/6XYFqBScYGNtzzKVw4F4QkqTSPrbkGeN7yhXqFcbiYByMPNNtMCuOYfC QjeQ== MIME-Version: 1.0 Received: by 10.152.147.202 with SMTP id tm10mr6057835lab.49.1332029757219; Sat, 17 Mar 2012 17:15:57 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.112.115.99 with HTTP; Sat, 17 Mar 2012 17:15:57 -0700 (PDT) In-Reply-To: <20120317162355.1f7736f5@kan.dyndns.org> References: <201203170323.q2H3NDCs048073@svn.freebsd.org> <20120317085609.GD1340@garage.freebsd.pl> <4F64D357.6080104@semihalf.com> <20120317162355.1f7736f5@kan.dyndns.org> Date: Sat, 17 Mar 2012 17:15:57 -0700 X-Google-Sender-Auth: lfjuSIK9en1BejBT3Wq6Q2FKdDQ Message-ID: From: Adrian Chadd To: Alexander Kabaev Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-projects@freebsd.org, Grzegorz Bernacki , Grzegorz Bernacki , Pawel Jakub Dawidek , src-committers@freebsd.org Subject: Re: svn commit: r233073 - projects/nand/sys/geom X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 00:16:05 -0000 .. that's why I said "for NOR", didn't I? :) The embedded hardware i use has NOR flash, not NAND flash. Adrian From owner-svn-src-projects@FreeBSD.ORG Sun Mar 18 01:02:41 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0888106566B; Sun, 18 Mar 2012 01:02:41 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-qa0-f54.google.com (mail-qa0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 25EA28FC0A; Sun, 18 Mar 2012 01:02:40 +0000 (UTC) Received: by qao25 with SMTP id 25so305910qao.13 for ; Sat, 17 Mar 2012 18:02:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; bh=GMIHPXoYDMJZjeUk/efJZG0F0l7IsTe6WOkT0y/ze2w=; b=UNY2ZNLDcz/x/KNjJ0WwIJvRM0u4qQn1kYQWNSA5LAWzfMJ1NvZdK4l+gsPYS4FKAD Ll+tg20pt4D0XN/L+AiYzBUjySr3uS9oNmawh15nN9zaj5gfsLep+tSNOxb6gy8HRtvm mZlpLDJwmQ3tq+l87lJ8PPWnkcQK3Uqc1SPCLPl6ifsg30UfFCa0x/GkhbLyqUFh/SS2 lxiqkof2c62U2HAhalk8r7+F7bkzoW3QrDB4kF/lJ78dNKB/+C2cvU0BvoJ8tsl7ws81 GgyWmaa9zVfPM02CUaoBLU6n9jbWoPas+qKjFgYLZHBy1QQMzkTZmUIOcocmftA09qGl gfAA== Received: by 10.224.220.16 with SMTP id hw16mr9552670qab.89.1332032560375; Sat, 17 Mar 2012 18:02:40 -0700 (PDT) Received: from kan.dyndns.org (c-24-63-226-98.hsd1.ma.comcast.net. [24.63.226.98]) by mx.google.com with ESMTPS id i19sm18286267qad.19.2012.03.17.18.02.39 (version=SSLv3 cipher=OTHER); Sat, 17 Mar 2012 18:02:39 -0700 (PDT) Date: Sat, 17 Mar 2012 21:02:32 -0400 From: Alexander Kabaev To: Adrian Chadd Message-ID: <20120317210232.669fcf50@kan.dyndns.org> In-Reply-To: References: <201203170323.q2H3NDCs048073@svn.freebsd.org> <20120317085609.GD1340@garage.freebsd.pl> <4F64D357.6080104@semihalf.com> <20120317162355.1f7736f5@kan.dyndns.org> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.6; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/i.RIU/VYtFVqw=VywzI24Bb"; protocol="application/pgp-signature" Cc: svn-src-projects@freebsd.org, Grzegorz Bernacki , Grzegorz Bernacki , Pawel Jakub Dawidek , src-committers@freebsd.org Subject: Re: svn commit: r233073 - projects/nand/sys/geom X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 01:02:41 -0000 --Sig_/i.RIU/VYtFVqw=VywzI24Bb Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sat, 17 Mar 2012 17:15:57 -0700 Adrian Chadd wrote: > .. that's why I said "for NOR", didn't I? :) >=20 > The embedded hardware i use has NOR flash, not NAND flash. >=20 Indeed, I forgot there are other flash technologies out there that are not necessarily as aggressively evil as NAND. My daily work has clouded my judgment here... --=20 Alexander Kabaev --Sig_/i.RIU/VYtFVqw=VywzI24Bb Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iD8DBQFPZTQuQ6z1jMm+XZYRAguRAKCOQ65mmnTPxZhodhlU63/w9ZSwQwCg4cfi WJUbmp9xaXz04n/vCSP5dBg= =fGvB -----END PGP SIGNATURE----- --Sig_/i.RIU/VYtFVqw=VywzI24Bb-- From owner-svn-src-projects@FreeBSD.ORG Sun Mar 18 03:57:46 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66016106566B; Sun, 18 Mar 2012 03:57:46 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail36.syd.optusnet.com.au (mail36.syd.optusnet.com.au [211.29.133.76]) by mx1.freebsd.org (Postfix) with ESMTP id 961028FC08; Sun, 18 Mar 2012 03:57:45 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail36.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q2I3vZTs029531 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 18 Mar 2012 14:57:36 +1100 Date: Sun, 18 Mar 2012 14:57:35 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pawel Jakub Dawidek In-Reply-To: <20120317215156.GJ1340@garage.freebsd.pl> Message-ID: <20120318142037.P1308@besplex.bde.org> References: <201203171710.q2HHAFiq079651@svn.freebsd.org> <20120317215156.GJ1340@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-projects@freebsd.org, Grzegorz Bernacki , src-committers@freebsd.org Subject: Re: svn commit: r233091 - in projects/nand: sbin/fdisk sys/sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 03:57:46 -0000 On Sat, 17 Mar 2012, Pawel Jakub Dawidek wrote: > On Sat, Mar 17, 2012 at 05:10:15PM +0000, Grzegorz Bernacki wrote: >> Log: >> Add ioctl and structures for accessing nand disk devices. > > Grzegorz, this is really wrong way to do it. Neither geom_dev nor > geom_disk are the places to add NAND specific ioctls. > ... This also has some style bugs. >> Modified: projects/nand/sys/sys/disk.h >> ============================================================================== >> --- projects/nand/sys/sys/disk.h Sat Mar 17 16:40:15 2012 (r233090) >> +++ projects/nand/sys/sys/disk.h Sat Mar 17 17:10:14 2012 (r233091) >> @@ -116,6 +116,32 @@ void disk_err(struct bio *bp, const char >> * This should be a multiple of the sector size. >> */ >> >> +#define DIOCNOOBSIZE _IOR('d', 141, u_int) /* Get oob size */ >> + /*- >> + * Get the OOB area size of NAND flash device. >> + */ >> + In KNF, there is a tab after #define. This rule was followed by all previous #define's in this file. In KNF, comments precede what they describe (except for short ones to the right of definitions). This rule was broken by almost all previous comments in this file, and the new code is mostly bug for bug compatible with that :-). In KNF, there are usually no verbose descriptions on #define's like this. Such comments belong in man pages. Such comments make the actual definitions hard to see. Here the density of code:comments is about 1/8. This rule was broken by almost all previous comments in this file, and the new code is bug for bug compatible with that. Of course, man pages are bug for bug compatible with this, and none even mentions the newer DIOCG* ioctls. Even the ~10 year old DIOCGMEDIASIZE ioctl is not documented in any man page. :-( The short comments to the right of the definitions are bogus when there is a verbose one after the definitions. Most old definitions have this bug. All new definitions have this bug. Comments beginning with "/*-" have special meanings. The "-" just tells indent(1) not to reformat the comment. Its typical use is to prevent formatting of comments that are hand-formatted with bullet points. There is one such comment in this file, and, correctly, only this one had the "-" markup. None of the new comments has fancy formatting, so the "-" in all of them is bogus. "/*-" is also conventionally abused to start copyright comments. Copyright comments normally have bullet points, and even if they didn't then their vendor might not want them reformatted, so they must start with "/*-" or alternatively "/**" anyway, so the convention does little except require correct style for them. >> +#define DIOCNBLKSIZE _IOR('d', 142, u_int) /* Get block size */ >> + /* - >> + * Get the block size of NAND flash device. >> + */ Here the "-" in the comment is just noise. >> + >> +struct nand_oob_request { >> + off_t offset; /* offset in bytes, page-aligned */ >> + off_t length; /* length */ >> + void * ubuf; /* buffer supplied by user */ >> +}; In KNF, #defines are placed all together, without type declarations in the middle. In KNF, struct members are only indented by 1 tab (or 1 tab plus 1 space to line up after a '*') if possible. When this is done, comments to the right of struct members are normally started in column 40. In KNF, the final '*' for pointers is attached to the name of the variable with no space between it and the name, not to the type with space[s] between it and the rest of the type. >> + >> +#define DIOCNREADOOB _IOW('d', 143, struct nand_oob_request) /* Read OOB area */ Now there is a tab after #define. In KNF, the maximum line length is 80. Here it is longer, with the help of a verbose struct tag name. Too-long lines are especially bogus when there is also a verbose comment about the same thing. Even if you don't write man pages in the comments, a comment that won't fit in 80 columns is sometimes needed, so it must be put on a separate line, but it is hard to format the extra lines for this nicely. >> + /*- >> + * Read page OOB area from NAND flash device. >> + */ >> + >> +#define DIOCNWRITEOOB _IOW('d', 144, struct nand_oob_request) /* Write OOB area */ Another with a correctly formatted #define and a too-long line. >> + /*- >> + * Write page OOB area to NAND flash device. >> + */ >> + >> #define DIOCGPHYSPATH _IOR('d', 141, char[MAXPATHLEN]) >> /* >> * Get a string defining the physical path for a given provider. Bruce From owner-svn-src-projects@FreeBSD.ORG Mon Mar 19 01:57:49 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 50E181065675; Mon, 19 Mar 2012 01:57:49 +0000 (UTC) (envelope-from gjb@semihalf.com) Received: from smtp.semihalf.com (smtp.semihalf.com [213.17.239.109]) by mx1.freebsd.org (Postfix) with ESMTP id CEF708FC24; Mon, 19 Mar 2012 01:57:48 +0000 (UTC) Received: from localhost (unknown [213.17.239.109]) by smtp.semihalf.com (Postfix) with ESMTP id 58724EC2E9; Mon, 19 Mar 2012 02:57:40 +0100 (CET) X-Virus-Scanned: by amavisd-new at semihalf.com Received: from smtp.semihalf.com ([213.17.239.109]) by localhost (smtp.semihalf.com [213.17.239.109]) (amavisd-new, port 10024) with ESMTP id 0y2YgR9XUQt1; Mon, 19 Mar 2012 02:57:39 +0100 (CET) Received: from [172.17.136.194] (adsl-64-175-228-30.dsl.sntc01.pacbell.net [64.175.228.30]) by smtp.semihalf.com (Postfix) with ESMTPSA id 8C4E4EBE32; Mon, 19 Mar 2012 02:57:37 +0100 (CET) Message-ID: <4F669290.8010109@semihalf.com> Date: Mon, 19 Mar 2012 02:57:36 +0100 From: Grzegorz Bernacki User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: Bruce Evans References: <201203171710.q2HHAFiq079651@svn.freebsd.org> <20120317215156.GJ1340@garage.freebsd.pl> <20120318142037.P1308@besplex.bde.org> In-Reply-To: <20120318142037.P1308@besplex.bde.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-projects@freebsd.org, Grzegorz Bernacki , Pawel Jakub Dawidek , src-committers@freebsd.org Subject: Re: svn commit: r233091 - in projects/nand: sbin/fdisk sys/sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:57:49 -0000 W dniu 2012-03-18 04:57, Bruce Evans pisze: > On Sat, 17 Mar 2012, Pawel Jakub Dawidek wrote: > >> On Sat, Mar 17, 2012 at 05:10:15PM +0000, Grzegorz Bernacki wrote: >>> Log: >>> Add ioctl and structures for accessing nand disk devices. >> >> Grzegorz, this is really wrong way to do it. Neither geom_dev nor >> geom_disk are the places to add NAND specific ioctls. >> ... > > This also has some style bugs. > >>> Modified: projects/nand/sys/sys/disk.h >>> ============================================================================== >>> >>> --- projects/nand/sys/sys/disk.h Sat Mar 17 16:40:15 2012 >>> (r233090) >>> +++ projects/nand/sys/sys/disk.h Sat Mar 17 17:10:14 2012 >>> (r233091) >>> @@ -116,6 +116,32 @@ void disk_err(struct bio *bp, const char >>> * This should be a multiple of the sector size. >>> */ >>> >>> +#define DIOCNOOBSIZE _IOR('d', 141, u_int) /* Get oob size */ >>> + /*- >>> + * Get the OOB area size of NAND flash device. >>> + */ >>> + > > In KNF, there is a tab after #define. This rule was followed by all > previous #define's in this file. > > In KNF, comments precede what they describe (except for short ones to > the right of definitions). This rule was broken by almost all previous > comments in this file, and the new code is mostly bug for bug compatible > with that :-). > > In KNF, there are usually no verbose descriptions on #define's like > this. Such comments belong in man pages. Such comments make the > actual definitions hard to see. Here the density of code:comments is > about 1/8. This rule was broken by almost all previous comments in > this file, and the new code is bug for bug compatible with that. Of > course, man pages are bug for bug compatible with this, and none even > mentions the newer DIOCG* ioctls. Even the ~10 year old DIOCGMEDIASIZE > ioctl is not documented in any man page. :-( > > The short comments to the right of the definitions are bogus when there > is a verbose one after the definitions. Most old definitions have this > bug. All new definitions have this bug. > > Comments beginning with "/*-" have special meanings. The "-" just > tells indent(1) not to reformat the comment. Its typical use is to > prevent formatting of comments that are hand-formatted with bullet > points. There is one such comment in this file, and, correctly, > only this one had the "-" markup. None of the new comments has fancy > formatting, so the "-" in all of them is bogus. "/*-" is also > conventionally abused to start copyright comments. Copyright comments > normally have bullet points, and even if they didn't then their vendor > might not want them reformatted, so they must start with "/*-" or > alternatively "/**" anyway, so the convention does little except > require correct style for them. > > >>> +#define DIOCNBLKSIZE _IOR('d', 142, u_int) /* Get block size */ >>> + /* - >>> + * Get the block size of NAND flash device. >>> + */ > > Here the "-" in the comment is just noise. > >>> + >>> +struct nand_oob_request { >>> + off_t offset; /* offset in bytes, page-aligned */ >>> + off_t length; /* length */ >>> + void * ubuf; /* buffer supplied by user */ >>> +}; > > In KNF, #defines are placed all together, without type declarations in > the middle. > > In KNF, struct members are only indented by 1 tab (or 1 tab plus 1 > space to line up after a '*') if possible. When this is done, comments > to the right of struct members are normally started in column 40. > > In KNF, the final '*' for pointers is attached to the name of the > variable > with no space between it and the name, not to the type with space[s] > between > it and the rest of the type. > >>> + >>> +#define DIOCNREADOOB _IOW('d', 143, struct >>> nand_oob_request) /* Read OOB area */ > > Now there is a tab after #define. > > In KNF, the maximum line length is 80. Here it is longer, with the help > of a verbose struct tag name. Too-long lines are especially bogus when > there is also a verbose comment about the same thing. Even if you don't > write man pages in the comments, a comment that won't fit in 80 columns > is sometimes needed, so it must be put on a separate line, but it is > hard to format the extra lines for this nicely. > >>> + /*- >>> + * Read page OOB area from NAND flash device. >>> + */ >>> + >>> +#define DIOCNWRITEOOB _IOW('d', 144, struct >>> nand_oob_request) /* Write OOB area */ > > Another with a correctly formatted #define and a too-long line. > >>> + /*- >>> + * Write page OOB area to NAND flash device. >>> + */ >>> + >>> #define DIOCGPHYSPATH _IOR('d', 141, char[MAXPATHLEN]) >>> /* >>> * Get a string defining the physical path for a given provider. > > Bruce Thanks for comments. We gonna cleanup this code. regards, grzesiek From owner-svn-src-projects@FreeBSD.ORG Mon Mar 19 18:41:44 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D305106566B; Mon, 19 Mar 2012 18:41:44 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 785B18FC14; Mon, 19 Mar 2012 18:41:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JIfiW3080992; Mon, 19 Mar 2012 18:41:44 GMT (envelope-from ambrisko@svn.freebsd.org) Received: (from ambrisko@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JIfinF080990; Mon, 19 Mar 2012 18:41:44 GMT (envelope-from ambrisko@svn.freebsd.org) Message-Id: <201203191841.q2JIfinF080990@svn.freebsd.org> From: Doug Ambrisko Date: Mon, 19 Mar 2012 18:41:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233189 - projects/head_mfi/sys/dev/mfi X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 18:41:44 -0000 Author: ambrisko Date: Mon Mar 19 18:41:43 2012 New Revision: 233189 URL: http://svn.freebsd.org/changeset/base/233189 Log: Update the pivot to >= 900000 to deal with the change in API for FreeBSD 9 and -current. Reviewed by: sbruno Modified: projects/head_mfi/sys/dev/mfi/mfi_linux.c Modified: projects/head_mfi/sys/dev/mfi/mfi_linux.c ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfi_linux.c Mon Mar 19 18:03:20 2012 (r233188) +++ projects/head_mfi/sys/dev/mfi/mfi_linux.c Mon Mar 19 18:41:43 2012 (r233189) @@ -29,7 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if __FreeBSD_version > 999999 +#if __FreeBSD_version >= 900000 #include #endif #include @@ -99,7 +99,7 @@ mfi_linux_ioctl(struct thread *p, struct break; } -#if __FreeBSD_version > 999999 +#if __FreeBSD_version >= 900000 if ((error = fget(p, args->fd, CAP_IOCTL, &fp)) != 0) #else if ((error = fget(p, args->fd, &fp)) != 0) From owner-svn-src-projects@FreeBSD.ORG Mon Mar 19 22:07:44 2012 Return-Path: Delivered-To: svn-src-projects@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F1D241065688; Mon, 19 Mar 2012 22:07:44 +0000 (UTC) (envelope-from doginou@kanar.ci0.org) Received: from kanar.ci0.org (unknown [IPv6:2a01:e0b:1:150:ca0a:a9ff:fef1:a4c9]) by mx1.freebsd.org (Postfix) with ESMTP id 2D5768FC1B; Mon, 19 Mar 2012 22:07:44 +0000 (UTC) Received: from kanar.ci0.org (nobody@localhost [127.0.0.1]) by kanar.ci0.org (8.14.5/8.14.5) with ESMTP id q2JM7KTe082910; Mon, 19 Mar 2012 23:07:20 +0100 (CET) (envelope-from doginou@kanar.ci0.org) Received: (from doginou@localhost) by kanar.ci0.org (8.14.5/8.14.5/Submit) id q2JM7Kek082909; Mon, 19 Mar 2012 23:07:20 +0100 (CET) (envelope-from doginou) Date: Mon, 19 Mar 2012 23:07:20 +0100 From: Olivier Houchard To: Bruce Evans Message-ID: <20120319220720.GB82571@ci0.org> References: <201203031223.q23CN73s081573@svn.freebsd.org> <20120304011922.G5792@besplex.bde.org> <20120303165737.GA26775@ci0.org> <20120306140646.S940@besplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120306140646.S940@besplex.bde.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-projects@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r232456 - projects/armv6/sys/arm/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 22:07:45 -0000 On Tue, Mar 06, 2012 at 03:58:36PM +1100, Bruce Evans wrote: > On Sat, 3 Mar 2012, Olivier Houchard wrote: > > >On Sun, Mar 04, 2012 at 02:14:46AM +1100, Bruce Evans wrote: > >>On Sat, 3 Mar 2012, Olivier Houchard wrote: > > Sorry this reply took so long. > Hi Bruce, Now I'm the one taking a long time to answer, sorry. > > > >I understand your concerns. These casts are indeed bogus, and will become > >even > >more when we'll support 64bits arm, which should come with 64bits long. > > Won't they just fail then, and need separate functions which mostly make > the problem go away, as on amd64? The patch seems to add a lot of 64-bit > support, which confused me at first. > Well, 64bits support is still far away, the architecture manual isn't even available yet, I just wrote that thinking it would be useful later, but of course more work will be required. > >I can't do much for long which should be 64bits even on 32bits machines, > >that > >is set in stone now, however I can certainly remove the bogus casts. > > > >Would the attached patch be OK for you ? > >It duplicates the various atomic functions to add a _long variant (for > >armv6 > >at least, for armv5 it just introduces _long variants which calls the _32 > >version, but at least it should catch any signedness/type error), and it > >removes the bogus casts for the ptr version, and just #defines it to the > >__32 > >version, since that's what uintptr_t is. > > This seems to be essentially correct -- don't use blind casts in macros, > and don't duplicate the functions (at least large ones), but provide > wrappers implemented as inline functions. The wrappers do the same thing > as the macros, but in a type-safe way. Perhaps they can be generated > a bit more automatically or otherwise reduced to 1 line each, but I don't > want to use complicated macros for this. > Yeah, I'd rather have them understandable. > % Index: atomic.h > % =================================================================== > % --- atomic.h (revision 232462) > % +++ atomic.h (working copy) > % @@ -74,6 +74,21 @@ > % #endif > % } > % > % +#define ATOMIC_ACQ_REL_LONG(NAME) \ > % +static __inline void \ > % +atomic_##NAME##_acq_long(__volatile u_long *p, u_long v) \ > % +{ \ > % + atomic_##NAME##_long(p, v); \ > % + __do_dmb(); \ > % +} \ > % + \ > % +static __inline void \ > % +atomic_##NAME##_rel_long(__volatile u_long *p, u_long v) \ > % +{ \ > % + __do_dmb(); \ > % + atomic_##NAME##_long(p, v); \ > % +} > % + > % #define ATOMIC_ACQ_REL(NAME, WIDTH) \ > % static __inline void \ > % atomic_##NAME##_acq_##WIDTH(__volatile uint##WIDTH##_t *p, > uint##WIDTH##_t v)\ > > Small functions can be done like this, by duplicating the code for > longs, and putting it in macros, but I think the above already has too > much macro-ization. Code like this is hard to read, and probably not > even much shorter and easier to write, if you organize the wrappers > in the best way. Well that's a matter of point of view, that would be a lot of wrappers to write, wrong ? > > % ... > % @@ -489,9 +649,64 @@ > % #define atomic_subtract_rel_32 atomic_subtract_32 > % #define atomic_subtract_acq_32 atomic_subtract_32 > % #define atomic_store_rel_32 atomic_store_32 > % +#define atomic_store_rel_long atomic_store_long > % #define atomic_load_acq_32 atomic_load_32 > % +#define atomic_load_acq_long atomic_load_long > % #undef __with_interrupts_disabled > % > % +static __inline void > % +atomic_add_long(volatile u_long *p, u_long v) > % +{ > % + > % + atomic_add_32((volatile uint32_t *)p, (volatile uint32_t)v); > % +} > > Most of the previous changes seem to be for adding 64-bit longs. Now I > think we're back in the 32-bit long case, with wrappers like I want > (more verbose than I want). > Actually, there're 2 sets of arm atomic functions, because the earlier revisions of the arm architectures lacked any decent way to do atomic operations, so we have to do it another way. Those earlier arm revisions will never support 64bits, so we can just use the 32bits versions. > Casting v seems bogus. How can a function parameter that is passed by > value be volatile? Old arm code has just 2 simimlar volatiles, > both for the non-pointer parameter in 2 cmpset_32's. Maybe it needs > to be volatile in the asm that accesses it, but I doubt this, and > casting it here doesn't make it volatile there. amd64 only uses > volatiles for pointed-to variables. Indeed those casts are just the result of me not thinking before copy/pasting code over and over, and they won't be committed. > > % ... > % #endif /* _LOCORE */ > > LOCORE ifdefs in atomic.h are bogus, and were removed on amd64. The > comment on this one is backwards, at least in the main arm tree (the > code says #ifndef, not #ifdef). Adding C functions unused LOCORE part > of the code ensure that it is unusable as well as unused in asm files. Right, it'll be gone when I'll commit it. Thanks a lot ! Olivier From owner-svn-src-projects@FreeBSD.ORG Mon Mar 19 22:23:07 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3FA6106566B; Mon, 19 Mar 2012 22:23:07 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FBCC8FC19; Mon, 19 Mar 2012 22:23:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JMN7xS089097; Mon, 19 Mar 2012 22:23:07 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JMN7gI089095; Mon, 19 Mar 2012 22:23:07 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201203192223.q2JMN7gI089095@svn.freebsd.org> From: Olivier Houchard Date: Mon, 19 Mar 2012 22:23:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233212 - projects/armv6/sys/arm/arm X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 22:23:07 -0000 Author: cognet Date: Mon Mar 19 22:23:07 2012 New Revision: 233212 URL: http://svn.freebsd.org/changeset/base/233212 Log: Forgot those bits when adding NO_EVENTTIMERS Modified: projects/armv6/sys/arm/arm/machdep.c Modified: projects/armv6/sys/arm/arm/machdep.c ============================================================================== --- projects/armv6/sys/arm/arm/machdep.c Mon Mar 19 22:20:47 2012 (r233211) +++ projects/armv6/sys/arm/arm/machdep.c Mon Mar 19 22:23:07 2012 (r233212) @@ -44,6 +44,7 @@ #include "opt_compat.h" #include "opt_ddb.h" +#include "opt_timer.h" #include __FBSDID("$FreeBSD$"); @@ -349,15 +350,19 @@ void cpu_idle(int busy) { +#ifndef NO_EVENTTIMERS if (!busy) { critical_enter(); cpu_idleclock(); } +#endif cpu_sleep(0); +#ifndef NO_EVENTTIMERS if (!busy) { cpu_activeclock(); critical_exit(); } +#endif } int From owner-svn-src-projects@FreeBSD.ORG Mon Mar 19 22:23:53 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 651CE106566C; Mon, 19 Mar 2012 22:23:53 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 509288FC08; Mon, 19 Mar 2012 22:23:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JMNrMp089156; Mon, 19 Mar 2012 22:23:53 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JMNroI089154; Mon, 19 Mar 2012 22:23:53 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201203192223.q2JMNroI089154@svn.freebsd.org> From: Olivier Houchard Date: Mon, 19 Mar 2012 22:23:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233213 - projects/armv6/sys/arm/arm X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 22:23:53 -0000 Author: cognet Date: Mon Mar 19 22:23:52 2012 New Revision: 233213 URL: http://svn.freebsd.org/changeset/base/233213 Log: Remove useless and potentially harmful cache flushes Modified: projects/armv6/sys/arm/arm/elf_trampoline.c Modified: projects/armv6/sys/arm/arm/elf_trampoline.c ============================================================================== --- projects/armv6/sys/arm/arm/elf_trampoline.c Mon Mar 19 22:23:07 2012 (r233212) +++ projects/armv6/sys/arm/arm/elf_trampoline.c Mon Mar 19 22:23:52 2012 (r233213) @@ -235,8 +235,6 @@ _startC(void) if ((cpufunc_id() & 0x0000f000) == 0x00009000) arm9_setup(); #endif - cpu_idcache_wbinv_all(); - cpu_l2cache_wbinv_all(); #endif __start(); } From owner-svn-src-projects@FreeBSD.ORG Mon Mar 19 22:26:15 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C94E21065786; Mon, 19 Mar 2012 22:26:15 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B28B8FC15; Mon, 19 Mar 2012 22:26:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JMQF3s089314; Mon, 19 Mar 2012 22:26:15 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JMQF0s089312; Mon, 19 Mar 2012 22:26:15 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201203192226.q2JMQF0s089312@svn.freebsd.org> From: Olivier Houchard Date: Mon, 19 Mar 2012 22:26:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233215 - projects/armv6/sys/arm/arm X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 22:26:15 -0000 Author: cognet Date: Mon Mar 19 22:26:15 2012 New Revision: 233215 URL: http://svn.freebsd.org/changeset/base/233215 Log: Those bit should have been committed as well, use the page tables provided by the BSP instead of assuming startup_pagetables is still available. Modified: projects/armv6/sys/arm/arm/locore.S Modified: projects/armv6/sys/arm/arm/locore.S ============================================================================== --- projects/armv6/sys/arm/arm/locore.S Mon Mar 19 22:26:02 2012 (r233214) +++ projects/armv6/sys/arm/arm/locore.S Mon Mar 19 22:26:15 2012 (r233215) @@ -229,6 +229,10 @@ Lend: .word _edata Lstartup_pagetable: .word STARTUP_PAGETABLE_ADDR +#ifdef SMP +Lstartup_pagetable_secondary: + .word temp_pagetable +#endif mmu_init_table: /* fill all table VA==PA */ /* map SDRAM VA==PA, WT cacheable */ @@ -240,6 +244,7 @@ mmu_init_table: MMU_INIT(PHYSADDR, PHYSADDR , 64, L1_TYPE_S|L1_SHARED|L1_S_C|L1_S_AP(AP_KRW)) /* map VA 0xc0000000..0xc3ffffff to PA */ MMU_INIT(KERNBASE, PHYSADDR, 64, L1_TYPE_S|L1_SHARED|L1_S_C|L1_S_AP(AP_KRW)) + MMU_INIT(0x48000000, 0x48000000, 1, L1_TYPE_S|L1_SHARED|L1_S_C|L1_S_AP(AP_KRW)) #endif .word 0 /* end of table */ #endif @@ -278,13 +283,16 @@ svcstk: Lsramaddr: .word 0xffff0080 -/* Use carefully!!! Changes r0, r1 */ +#if 0 #define AP_DEBUG(tmp) \ mrc p15, 0, r1, c0, c0, 5; \ ldr r0, Lsramaddr; \ add r0, r1, lsl #2; \ mov r1, tmp; \ str r1, [r0], #0x0000; +#else +#define AP_DEBUG(tmp) +#endif ASENTRY_NP(mptramp) @@ -322,6 +330,11 @@ ASENTRY_NP(mpentry) orr r7, r7, #(I32_bit|F32_bit) msr cpsr_c, r7 + + adr r7, Ltag + bic r7, r7, #0xf0000000 + orr r7, r7, #PHYSADDR + /* Disable MMU for a while */ mrc p15, 0, r2, c1, c0, 0 bic r2, r2, #(CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_DC_ENABLE |\ @@ -337,14 +350,17 @@ ASENTRY_NP(mpentry) AP_DEBUG(#3) Ltag: - ldr r0, Lstartup_pagetable + ldr r0, Lstartup_pagetable_secondary + bic r0, r0, #0xf0000000 + orr r0, r0, #PHYSADDR + ldr r0, [r0] #if defined(SMP) - orr r0, r0, #2 /* Set TTB shared memory flag */ + orr r0, r0, #0 /* Set TTB shared memory flag */ #endif mcr p15, 0, r0, c2, c0, 0 /* Set TTB */ mcr p15, 0, r0, c8, c7, 0 /* Flush TLB */ -#if defined(CPU_ARM11) || defined(CPU_MV_PJ4B) +#if defined(CPU_ARM11) || defined(CPU_MV_PJ4B) || defined(CPU_CORTEXA) mov r0, #0 mcr p15, 0, r0, c13, c0, 1 /* Set ASID to 0 */ #endif @@ -356,7 +372,7 @@ Ltag: mcr p15, 0, r0, c3, c0, 0 /* Enable MMU */ mrc p15, 0, r0, c1, c0, 0 -#if defined(CPU_ARM11) || defined(CPU_MV_PJ4B) +#if defined(CPU_ARM11) || defined(CPU_MV_PJ4B) || defined(CPU_CORTEXA) orr r0, r0, #CPU_CONTROL_V6_EXTPAGE #endif orr r0, r0, #(CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_DC_ENABLE) @@ -369,6 +385,7 @@ Ltag: adr r1, .Lstart ldmia r1, {r1, r2, sp} /* Set initial stack and */ mrc p15, 0, r0, c0, c0, 5 + and r0, r0, #15 mov r1, #2048 mul r2, r1, r0 sub sp, sp, r2 From owner-svn-src-projects@FreeBSD.ORG Mon Mar 19 22:34:25 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 577C8106566B; Mon, 19 Mar 2012 22:34:25 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 405998FC08; Mon, 19 Mar 2012 22:34:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JMYPpE089612; Mon, 19 Mar 2012 22:34:25 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JMYPUL089600; Mon, 19 Mar 2012 22:34:25 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201203192234.q2JMYPUL089600@svn.freebsd.org> From: Olivier Houchard Date: Mon, 19 Mar 2012 22:34:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233216 - in projects/armv6/sys: arm/arm arm/conf arm/include conf X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 22:34:25 -0000 Author: cognet Date: Mon Mar 19 22:34:24 2012 New Revision: 233216 URL: http://svn.freebsd.org/changeset/base/233216 Log: Add VFP/Neon support Submitted by: Mark Tinguely Added: projects/armv6/sys/arm/arm/vfp.c (contents, props changed) projects/armv6/sys/arm/include/vfp.h (contents, props changed) Modified: projects/armv6/sys/arm/arm/genassym.c projects/armv6/sys/arm/arm/swtch.S projects/armv6/sys/arm/arm/undefined.c projects/armv6/sys/arm/conf/PANDABOARD projects/armv6/sys/arm/include/fp.h projects/armv6/sys/arm/include/pcb.h projects/armv6/sys/arm/include/pcpu.h projects/armv6/sys/conf/files.arm projects/armv6/sys/conf/options.arm Modified: projects/armv6/sys/arm/arm/genassym.c ============================================================================== --- projects/armv6/sys/arm/arm/genassym.c Mon Mar 19 22:26:15 2012 (r233215) +++ projects/armv6/sys/arm/arm/genassym.c Mon Mar 19 22:34:24 2012 (r233216) @@ -34,7 +34,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include @@ -105,11 +107,22 @@ ASSYM(TF_PC, offsetof(struct trapframe, ASSYM(P_PID, offsetof(struct proc, p_pid)); ASSYM(P_FLAG, offsetof(struct proc, p_flag)); -#if !defined(SMP) +#ifdef ARM_TP_ADDRESS ASSYM(ARM_TP_ADDRESS, ARM_TP_ADDRESS); ASSYM(ARM_RAS_START, ARM_RAS_START); ASSYM(ARM_RAS_END, ARM_RAS_END); #endif + +#ifdef ARM_VFP_SUPPORT +ASSYM(PCB_VFPSTATE, offsetof(struct pcb, pcb_vfpstate)); +ASSYM(PCB_VFPCPU, offsetof(struct pcb, pcb_vfpcpu)); + +ASSYM(PC_VFPCTHREAD, offsetof(struct pcpu, pc_vfpcthread)); +ASSYM(PC_CPU, offsetof(struct pcpu, pc_cpu)); + +ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap)); +#endif + ASSYM(PAGE_SIZE, PAGE_SIZE); ASSYM(PDESIZE, PDESIZE); ASSYM(PMAP_DOMAIN_KERNEL, PMAP_DOMAIN_KERNEL); Modified: projects/armv6/sys/arm/arm/swtch.S ============================================================================== --- projects/armv6/sys/arm/arm/swtch.S Mon Mar 19 22:26:15 2012 (r233215) +++ projects/armv6/sys/arm/arm/swtch.S Mon Mar 19 22:34:24 2012 (r233216) @@ -88,15 +88,14 @@ __FBSDID("$FreeBSD$"); #define DOMAIN_CLIENT 0x01 #ifdef _ARM_ARCH_6 -#define GET_PCB(tmp) \ - mrc p15, 0, tmp, c13, c0, 4; \ - add tmp, tmp, #(PC_CURPCB) +#define GET_PCPU(tmp) \ + mrc p15, 0, tmp, c13, c0, 4; #else -.Lcurpcb: - .word _C_LABEL(__pcpu) + PC_CURPCB +.Lcurpcpu: + .word _C_LABEL(__pcpu) -#define GET_PCB(tmp) \ - ldr tmp, .Lcurpcb +#define GET_PCPU(tmp) \ + ldr tmp, .Lcurpcpu #endif .Lcpufuncs: @@ -108,11 +107,26 @@ ENTRY(cpu_throw) mov r5, r1 /* + * r0 = oldtd * r5 = newtd */ - ldr r7, [r5, #(TD_PCB)] /* r7 = new thread's PCB */ + GET_PCPU(r7) + +#ifdef ARM_VFP_SUPPORT + /* + * vfp_discard will clear pcpu->pc_vfpcthread, and modify + * and modify the control as needed. + */ + ldr r4, [r7, #(PC_VFPCTHREAD)] /* this thread using vfp? */ + cmp r0, r4 + bne 3f + bl _C_LABEL(vfp_discard) /* yes, shut down vfp */ +3: +#endif /* ARM_VFP_SUPPORT */ + ldr r7, [r5, #(TD_PCB)] /* r7 = new thread's PCB */ + /* Switch to lwp0 context */ ldr r9, .Lcpufuncs @@ -182,7 +196,7 @@ ENTRY(cpu_throw) /* Set the new tp */ ldr r6, [r5, #(TD_MD + MD_TP)] -#ifndef SMP +#ifdef ARM_TP_ADDRESS ldr r4, =ARM_TP_ADDRESS str r6, [r4] ldr r6, [r5, #(TD_MD + MD_RAS_START)] @@ -193,8 +207,8 @@ ENTRY(cpu_throw) mcr p15, 0, r6, c13, c0, 3 #endif /* Hook in a new pcb */ - GET_PCB(r6) - str r7, [r6] + GET_PCPU(r6) + str r7, [r6, #PC_CURPCB] ldmfd sp!, {r4-r7, pc} @@ -212,9 +226,9 @@ ENTRY(cpu_switch) str r1, [r7] /* Hook in a new pcb */ - GET_PCB(r7) + GET_PCPU(r7) ldr r2, [r1, #TD_PCB] - str r2, [r7] + str r2, [r7, #PC_CURPCB] /* rem: r1 = new process */ /* rem: interrupts are enabled */ @@ -240,7 +254,7 @@ ENTRY(cpu_switch) * NOTE: We can now use r8-r13 until it is time to restore * them for the new process. */ -#ifndef SMP +#ifdef ARM_TP_ADDRESS /* Store the old tp */ ldr r3, =ARM_TP_ADDRESS ldr r9, [r3] @@ -270,8 +284,6 @@ ENTRY(cpu_switch) /* Get the user structure for the new process in r9 */ ldr r9, [r1, #(TD_PCB)] - /* r1 now free! */ - mrs r3, cpsr /* * We can do that, since @@ -283,15 +295,39 @@ ENTRY(cpu_switch) str sp, [r2, #(PCB_UND_SP)] msr cpsr_c, r3 /* Restore the old mode */ - /* rem: r8 = old PCB */ + /* rem: r2 = old PCB */ /* rem: r9 = new PCB */ /* rem: interrupts are enabled */ - /* What else needs to be saved Only FPA stuff when that is supported */ +#ifdef ARM_VFP_SUPPORT + /* + * vfp_store will clear pcpu->pc_vfpcthread, save + * registers and state, and modify the control as needed. + * a future exception will bounce the backup settings in the fp unit. + * XXX vfp_store can't change r4 + */ + GET_PCPU(r7) + ldr r8, [r7, #(PC_VFPCTHREAD)] + cmp r4, r8 /* old thread used vfp? */ + bne 1f /* no, don't save */ + cmp r1, r4 /* same thread ? */ + beq 1f /* yes, skip vfp store */ +#ifdef SMP + ldr r8, [r7, #(PC_CPU)] /* last used on this cpu? */ + ldr r3, [r2, #(PCB_VFPCPU)] + cmp r8, r3 /* last cpu to use these registers? */ + bne 1f /* no. these values are stale */ +#endif + add r0, r2, #(PCB_VFPSTATE) + bl _C_LABEL(vfp_store) +1: +#endif /* ARM_VFP_SUPPORT */ + + /* r1 now free! */ /* Third phase : restore saved context */ - /* rem: r8 = old PCB */ + /* rem: r2 = old PCB */ /* rem: r9 = new PCB */ /* rem: interrupts are enabled */ @@ -459,6 +495,27 @@ ENTRY(savectx) /* Store all the registers in the process's pcb */ add r2, r0, #(PCB_R8) stmia r2, {r8-r13} +#ifdef ARM_VFP_SUPPORT + /* + * vfp_store will clear pcpu->pc_vfpcthread, save + * registers and state, and modify the control as needed. + * a future exception will bounce the backup settings in the fp unit. + */ + GET_PCPU(r7) + ldr r4, [r7, #(PC_VFPCTHREAD)] /* vfp thread */ + ldr r2, [r7, #(PC_CURTHREAD)] /* current thread */ + cmp r4, r2 + bne 1f +#ifdef SMP + ldr r2, [r7, #(PC_CPU)] /* last used on this cpu? */ + ldr r3, [r0, #(PCB_VFPCPU)] + cmp r2, r3 + bne 1f /* no. these values are stale */ +#endif + add r0, r0, #(PCB_VFPSTATE) + bl _C_LABEL(vfp_store) +1: +#endif /* ARM_VFP_SUPPORT */ ldmfd sp!, {r4-r7, pc} ENTRY(fork_trampoline) Modified: projects/armv6/sys/arm/arm/undefined.c ============================================================================== --- projects/armv6/sys/arm/arm/undefined.c Mon Mar 19 22:26:15 2012 (r233215) +++ projects/armv6/sys/arm/arm/undefined.c Mon Mar 19 22:34:24 2012 (r233216) @@ -237,10 +237,16 @@ undefinedinstruction(trapframe_t *frame) * instruction trap. */ + coprocessor = 0; if ((fault_instruction & (1 << 27)) != 0) coprocessor = (fault_instruction >> 8) & 0x0f; - else - coprocessor = 0; +#ifdef ARM_VFP_SUPPORT + else { /* check for special instructions */ + if (((fault_instruction & 0xfe000000) == 0xf2000000) || + ((fault_instruction & 0xff100000) == 0xf4000000)) + coprocessor = 10; /* vfp / simd */ + } +#endif /* ARM_VFP_SUPPORT */ if ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) { /* Added: projects/armv6/sys/arm/arm/vfp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/armv6/sys/arm/arm/vfp.c Mon Mar 19 22:34:24 2012 (r233216) @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2012 Mark Tinguely + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include +__FBSDID("$FreeBSD$"); + + +#include +#include +#include +#include + +#include +#include +#include +#include + +/* function prototypes */ +unsigned int get_coprocessorACR(void); +int vfp_bounce(u_int, u_int, struct trapframe *, int); +void vfp_discard(void); +void vfp_enable(void); +void vfp_init(void); +void vfp_restore(struct vfp_state *); +void vfp_store(struct vfp_state *); +void set_coprocessorACR(u_int); + +boolean_t vfp_exists; +static struct undefined_handler vfp10_uh, vfp11_uh; + +/* The VFMXR command using coprocessor commands */ +#define fmxr(reg, val) \ + __asm __volatile("mcr p10, 7, %0, " #reg " , c0, 0" :: "r" (val)); + +/* The VFMRX command using coprocessor commands */ +#define fmrx(reg) \ +({ u_int val = 0;\ + __asm __volatile("mrc p10, 7, %0, " #reg " , c0, 0" : "=r" (val));\ + val; \ +}) + +u_int +get_coprocessorACR(void) +{ + u_int val; + __asm __volatile("mrc p15, 0, %0, c1, c0, 2" : "=r" (val) : : "cc"); + return val; +} + +void +set_coprocessorACR(u_int val) +{ + __asm __volatile("mcr p15, 0, %0, c1, c0, 2\n\t" + "isb\n\t" + : : "r" (val) : "cc"); +} + + + /* called for each cpu */ +void +vfp_init(void) +{ + u_int fpsid, fpexc, tmp; + u_int coproc; + + coproc = get_coprocessorACR(); + coproc |= COPROC10 | COPROC11; + set_coprocessorACR(coproc); + + fpsid = fmrx(cr0); /* read the vfp system id */ + fpexc = fmrx(cr8); /* read the vfp exception reg */ + + if (!(fpsid & VFPSID_HARDSOFT_IMP)) { + vfp_exists = 1; + PCPU_SET(vfpsid, fpsid); /* save the VFPSID */ + if ((fpsid & VFPSID_SUBVERSION2_MASK) == VFP_ARCH3) { + tmp = fmrx(cr7); /* extended registers */ + PCPU_SET(vfpmvfr0, tmp); + tmp = fmrx(cr6); /* extended registers */ + PCPU_SET(vfpmvfr1, tmp); + } + /* initialize the coprocess 10 and 11 calls + * These are called to restore the registers and enable + * the VFP hardware. + */ + if (vfp10_uh.uh_handler == NULL) { + vfp10_uh.uh_handler = vfp_bounce; + vfp11_uh.uh_handler = vfp_bounce; + install_coproc_handler_static(10, &vfp10_uh); + install_coproc_handler_static(11, &vfp11_uh); + } + } +} + +SYSINIT(vfp, SI_SUB_CPU, SI_ORDER_ANY, vfp_init, NULL); + + +/* start VFP unit, restore the vfp registers from the PCB and retry + * the instruction + */ +int +vfp_bounce(u_int addr, u_int insn, struct trapframe *frame, int code) +{ + u_int fpexc; + struct pcb *curpcb; + struct thread *vfptd; + + if (!vfp_exists) + return 1; /* vfp does not exist */ + fpexc = fmrx(cr8); /* read the vfp exception reg */ + if (fpexc & VFPEXC_EN) { + vfptd = PCPU_GET(vfpcthread); + /* did the kernel call the vfp or exception that expect us + * to emulate the command. Newer hardware does not require + * emulation, so we don't emulate yet. + */ +#ifdef SMP + /* don't save if newer registers are on another processor */ + if (vfptd /* && (vfptd == curthread) */ && + (vfptd->td_pcb->pcb_vfpcpu == PCPU_GET(vfpcpu)) +#else + /* someone did not save their registers, */ + if (vfptd /* && (vfptd == curthread) */) +#endif + vfp_store(&vfptd->td_pcb->pcb_vfpstate); + + fpexc &= ~VFPEXC_EN; + fmxr(cr8, fpexc); /* turn vfp hardware off */ + if (vfptd == curthread) { + /* kill the process - we do not handle emulation */ + killproc(curthread->td_proc, "vfp emulation"); + return 1; + } + /* should not happen. someone did not save their context */ + printf("vfp_bounce: vfpcthread: %p curthread: %p\n", + vfptd, curthread); + } + fpexc |= VFPEXC_EN; + fmxr(cr8, fpexc); /* enable the vfp and repeat command */ + curpcb = PCPU_GET(curpcb); + /* If we were the last process to use the VFP, the process did not + * use a VFP on another processor, then the registers in the VFP + * will still be ours and are current. Eventually, we will make the + * restore smarter. + */ + vfp_restore(&curpcb->pcb_vfpstate); +#ifdef SMP + curpcb->pcb_cpu = PCPU_GET(cpu); +#endif + PCPU_SET(vfpcthread, PCPU_GET(curthread)); + return 0; +} + +/* vfs_store is called from from a VFP command to restore the registers and + * turn on the VFP hardware. + * Eventually we will use the information that this process was the last + * to use the VFP hardware and bypass the restore, just turn on the hardware. + */ +void +vfp_restore(struct vfp_state *vfpsave) +{ + u_int vfpscr = 0; + + if (vfpsave) { + __asm __volatile("ldc p10, c0, [%0], #128\n" /* d0-d31 */ +#ifndef VFPv2 + "ldcl p11, c0, [%0], #128\n" /* d16-d31 */ +#else + "add %0, %0, #128\n" /* slip missing regs */ +#endif + "ldr %1, [%0]\n" /* set old vfpscr */ + "mcr p10, 7, %1, cr1, c0, 0\n" + :: "r" (vfpsave), "r" (vfpscr)); + PCPU_SET(vfpcthread, PCPU_GET(curthread)); + } +} + +/* vfs_store is called from switch to save the vfp hardware registers + * into the pcb before switching to another process. + * we already know that the new process is different from this old + * process and that this process last used the VFP registers. + * Below we check to see if the VFP has been enabled since the last + * register save. + * This routine will exit with the VFP turned off. The next VFP user + * will trap to restore its registers and turn on the VFP hardware. + */ +void +vfp_store(struct vfp_state *vfpsave) +{ + u_int tmp, vfpscr = 0; + + tmp = fmrx(cr8); /* Is the vfp enabled? */ + if (vfpsave && tmp & VFPEXC_EN) { + __asm __volatile("stc p11, c0, [%1], #128\n" /* d0-d31 */ +#ifndef VFPv2 + "stcl p11, c0, [%1], #128\n" +#else + "add %1, %1, #128\n" +#endif + "mrc p10, 7, %0, cr1, c0, 0\n" + "str %0, [%1]\n" + : "=&r" (vfpscr) : "r" (vfpsave)); + } +#ifndef SMP + /* eventually we will use this information for UP also */ + PCPU_SET(vfpcthread, 0); +#endif + tmp &= ~VFPEXC_EN; /* disable the vfp hardware */ + fmxr(cr8 , tmp); +} + +/* discard the registers at cpu_thread_free() when fpcurthread == td. + * Turn off the VFP hardware. + */ +void +vfp_discard() +{ + u_int tmp = 0; + + PCPU_SET(vfpcthread, 0); /* permanent forget about reg */ + tmp = fmrx(cr8); + tmp &= ~VFPEXC_EN; /* turn off VFP hardware */ + fmxr(cr8, tmp); +} + +/* Enable the VFP hardware without restoring registers. + * Called when the registers are still in the VFP unit + */ +void +vfp_enable() +{ + u_int tmp = 0; + + tmp = fmrx(cr8); + tmp |= VFPEXC_EN; + fmxr(cr8 , tmp); +} Modified: projects/armv6/sys/arm/conf/PANDABOARD ============================================================================== --- projects/armv6/sys/arm/conf/PANDABOARD Mon Mar 19 22:26:15 2012 (r233215) +++ projects/armv6/sys/arm/conf/PANDABOARD Mon Mar 19 22:34:24 2012 (r233216) @@ -138,3 +138,6 @@ device twl_vreg options FDT options FDT_DTB_STATIC makeoptions FDT_DTS_FILE=pandaboard.dts + +device vfp # vfp/neon +options ARM_VFP_SUPPORT # vfp/neon Modified: projects/armv6/sys/arm/include/fp.h ============================================================================== --- projects/armv6/sys/arm/include/fp.h Mon Mar 19 22:26:15 2012 (r233215) +++ projects/armv6/sys/arm/include/fp.h Mon Mar 19 22:34:24 2012 (r233216) @@ -66,12 +66,19 @@ typedef struct fp_extended_precision fp_ * This needs to move and be hidden from userland. */ +#ifdef ARM_VFP_SUPPORT +struct vfp_state { + u_int64_t reg[32]; + u_int32_t fpscr; +}; +#else struct fpe_sp_state { unsigned int fp_flags; unsigned int fp_sr; unsigned int fp_cr; fp_reg_t fp_registers[16]; }; +#endif /* * Type for a saved FP context, if we want to translate the context to a Modified: projects/armv6/sys/arm/include/pcb.h ============================================================================== --- projects/armv6/sys/arm/include/pcb.h Mon Mar 19 22:26:15 2012 (r233215) +++ projects/armv6/sys/arm/include/pcb.h Mon Mar 19 22:34:24 2012 (r233216) @@ -80,7 +80,12 @@ struct pcb { #define PCB_NOALIGNFLT 0x00000002 caddr_t pcb_onfault; /* On fault handler */ struct pcb_arm32 un_32; +#ifdef ARM_VFP_SUPPORT + struct vfp_state pcb_vfpstate; /* VP/NEON state */ + u_int pcb_vfpcpu; /* VP/NEON last cpu */ +#else struct fpe_sp_state pcb_fpstate; /* Floating Point state */ +#endif }; /* Modified: projects/armv6/sys/arm/include/pcpu.h ============================================================================== --- projects/armv6/sys/arm/include/pcpu.h Mon Mar 19 22:26:15 2012 (r233215) +++ projects/armv6/sys/arm/include/pcpu.h Mon Mar 19 22:34:24 2012 (r233216) @@ -41,7 +41,18 @@ struct vmspace; #endif /* _KERNEL */ -#define PCPU_MD_FIELDS +#ifdef ARM_VFP_SUPPORT +#define PCPU_MD_FIELDS \ + unsigned int pc_cpu; \ + unsigned int pc_vfpsid; \ + unsigned int pc_vfpmvfr0; \ + unsigned int pc_vfpmvfr1; \ + struct thread *pc_vfpcthread; \ + struct pmap *pc_curpmap; +#else +#define PCPU_MD_FIELDS +#endif + #ifdef _KERNEL @@ -50,6 +61,7 @@ struct pcpu; extern struct pcpu *pcpup; #if ARM_ARCH_6 || ARM_ARCH_7A +/* or ARM_TP_ADDRESS mark REMOVE ME NOTE */ static inline struct pcpu * get_pcpu(void) { Added: projects/armv6/sys/arm/include/vfp.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/armv6/sys/arm/include/vfp.h Mon Mar 19 22:34:24 2012 (r233216) @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2012 Mark Tinguely + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * $FreeBSD$ + */ + + +#ifndef _MACHINE__VFP_H_ +#define _MACHINE__VFP_H_ + +/* fpsid, fpscr, fpexc are defined in the newer gas */ +#define VFPSID cr0 +#define VFPSCR cr1 +#define VMVFR1 cr6 +#define VMVFR0 cr7 +#define VFPEXC cr8 +#define VFPINST cr9 /* vfp 1 and 2 except instruction */ +#define VFPINST2 cr10 /* vfp 2? */ + +/* VFPSID */ +#define VFPSID_IMPLEMENTOR_OFF 24 +#define VFPSID_IMPLEMENTOR_MASK (0xff000000) +#define VFPSID_HARDSOFT_IMP (0x00800000) +#define VFPSID_SINGLE_PREC 20 /* version 1 and 2 */ +#define VFPSID_SUBVERSION_OFF 16 +#define VFPSID_SUBVERSION2_MASK (0x000f0000) /* version 1 and 2 */ +#define VFPSID_SUBVERSION3_MASK (0x007f0000) /* version 3 */ +#define VFP_ARCH3 (0x00030000) +#define VFPSID_PARTNUMBER_OFF 8 +#define VFPSID_PARTNUMBER_MASK (0x0000ff00) +#define VFPSID_VARIANT_OFF 4 +#define VFPSID_VARIANT_MASK (0x000000f0) +#define VFPSID_REVISION_MASK 0x0f + +/* VFPSCR */ +#define VFPSCR_CC_N (0x80000000) /* comparison less than */ +#define VFPSCR_CC_Z (0x40000000) /* comparison equal */ +#define VFPSCR_CC_C (0x20000000) /* comparison = > unordered */ +#define VFPSCR_CC_V (0x10000000) /* comparison unordered */ +#define VFPSCR_QC (0x08000000) /* saturation cululative */ +#define VFPSCR_DN (0x02000000) /* default NaN enable */ +#define VFPSCR_FZ (0x01000000) /* flush to zero enabled */ + +#define VFPSCR_RMODE_OFF 22 /* rounding mode offset */ +#define VFPSCR_RMODE_MASK (0x00c00000) /* rounding mode mask */ +#define VFPSCR_RMODE_RN (0x00000000) /* round nearest */ +#define VFPSCR_RMODE_RPI (0x00400000) /* round to plus infinity */ +#define VFPSCR_RMODE_RNI (0x00800000) /* round to neg infinity */ +#define VFPSCR_RMODE_RM (0x00c00000) /* round to zero */ + +#define VFPSCR_STRIDE_OFF 20 /* vector stride -1 */ +#define VFPSCR_STRIDE_MASK (0x00300000) +#define VFPSCR_LEN_OFF 16 /* vector length -1 */ +#define VFPSCR_LEN_MASK (0x00070000) +#define VFPSCR_IDE (0x00008000) /* input subnormal exc enable */ +#define VFPSCR_IXE (0x00001000) /* inexact exception enable */ +#define VFPSCR_UFE (0x00000800) /* underflow exception enable */ +#define VFPSCR_OFE (0x00000400) /* overflow exception enable */ +#define VFPSCR_DNZ (0x00000200) /* div by zero exception en */ +#define VFPSCR_IOE (0x00000100) /* invalid op exec enable */ +#define VFPSCR_IDC (0x00000080) /* input subnormal cumul */ +#define VFPSCR_IXC (0x00000010) /* Inexact cumulative flag */ +#define VFPSCR_UFC (0x00000008) /* underflow cumulative flag */ +#define VFPSCR_OFC (0x00000004) /* overflow cumulative flag */ +#define VFPSCR_DZC (0x00000002) /* division by zero flag */ +#define VFPSCR_IOC (0x00000001) /* invalid operation cumul */ + +/* VFPEXC */ +#define VFPEXC_EX (0x80000000) /* exception v1 v2 */ +#define VFPEXC_EN (0x40000000) /* vfp enable */ + +/* version 3 registers */ +/* VMVFR0 */ +#define VMVFR0_RM_OFF 28 +#define VMVFR0_RM_MASK (0xf0000000) /* VFP rounding modes */ + +#define VMVFR0_SV_OFF 24 +#define VMVFR0_SV_MASK (0x0f000000) /* VFP short vector supp */ +#define VMVFR0_SR_OFF 20 +#define VMVFR0_SR (0x00f00000) /* VFP hw sqrt supp */ +#define VMVFR0_D_OFF 16 +#define VMVFR0_D_MASK (0x000f0000) /* VFP divide supp */ +#define VMVFR0_TE_OFF 12 +#define VMVFR0_TE_MASK (0x0000f000) /* VFP trap exception supp */ +#define VMVFR0_DP_OFF 8 +#define VMVFR0_DP_MASK (0x00000f00) /* VFP double prec support */ +#define VMVFR0_SP_OFF 4 +#define VMVFR0_SP_MASK (0x000000f0) /* VFP single prec support */ +#define VMVFR0_RB_MASK (0x0000000f) /* VFP 64 bit media support */ + +/* VMVFR1 */ +#define VMVFR1_SP_OFF 16 +#define VMVFR1_SP_MASK (0x000f0000) /* Neon single prec support */ +#define VMVFR1_I_OFF 12 +#define VMVFR1_I_MASK (0x0000f000) /* Neon integer support */ +#define VMVFR1_LS_OFF 8 +#define VMVFR1_LS_MASK (0x00000f00) /* Neon ld/st instr support */ +#define VMVFR1_DN_OFF 4 +#define VMVFR1_DN_MASK (0x000000f0) /* Neon prop NaN support */ +#define VMVFR1_FZ_MASK (0x0000000f) /* Neon denormal arith supp */ + +#define COPROC10 (0x3 << 20) +#define COPROC11 (0x3 << 22) + + +#endif Modified: projects/armv6/sys/conf/files.arm ============================================================================== --- projects/armv6/sys/conf/files.arm Mon Mar 19 22:26:15 2012 (r233215) +++ projects/armv6/sys/conf/files.arm Mon Mar 19 22:34:24 2012 (r233216) @@ -48,6 +48,7 @@ arm/arm/uio_machdep.c standard arm/arm/undefined.c standard arm/arm/vectors.S standard arm/arm/vm_machdep.c standard +arm/arm/vfp.c optional vfp arm/fpe-arm/armfpe_glue.S optional armfpe arm/fpe-arm/armfpe_init.c optional armfpe arm/fpe-arm/armfpe.S optional armfpe Modified: projects/armv6/sys/conf/options.arm ============================================================================== --- projects/armv6/sys/conf/options.arm Mon Mar 19 22:26:15 2012 (r233215) +++ projects/armv6/sys/conf/options.arm Mon Mar 19 22:34:24 2012 (r233216) @@ -5,6 +5,7 @@ ARMFPE opt_global.h ARM_KERN_DIRECTMAP opt_vm.h ARM_L2_PIPT opt_global.h ARM_USE_SMALL_ALLOC opt_global.h +ARM_VFP_SUPPORT opt_global.h AT91C_MASTER_CLOCK opt_global.h AT91C_MAIN_CLOCK opt_at91.h COUNTS_PER_SEC opt_timer.h From owner-svn-src-projects@FreeBSD.ORG Wed Mar 21 15:54:45 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2A8821065670; Wed, 21 Mar 2012 15:54:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 14B838FC16; Wed, 21 Mar 2012 15:54:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2LFsjgQ083300; Wed, 21 Mar 2012 15:54:45 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2LFsiWv083296; Wed, 21 Mar 2012 15:54:44 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201203211554.q2LFsiWv083296@svn.freebsd.org> From: Adrian Chadd Date: Wed, 21 Mar 2012 15:54:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233279 - in projects/net80211_testsuite/wtap: 002 003 004 005 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 15:54:45 -0000 Author: adrian Date: Wed Mar 21 15:54:44 2012 New Revision: 233279 URL: http://svn.freebsd.org/changeset/base/233279 Log: Flesh out a few more 802.11s test cases. Submitted by: monthadar@gmail.com Added: projects/net80211_testsuite/wtap/002/ projects/net80211_testsuite/wtap/002/test.sh (contents, props changed) projects/net80211_testsuite/wtap/003/ projects/net80211_testsuite/wtap/003/test.sh (contents, props changed) projects/net80211_testsuite/wtap/004/ projects/net80211_testsuite/wtap/004/test.sh (contents, props changed) projects/net80211_testsuite/wtap/005/ projects/net80211_testsuite/wtap/005/test.sh (contents, props changed) Added: projects/net80211_testsuite/wtap/002/test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/net80211_testsuite/wtap/002/test.sh Wed Mar 21 15:54:44 2012 (r233279) @@ -0,0 +1,211 @@ +#!/bin/sh + +# This program requires: +# + wtap - to create/destroy the wtap instances +# + vis_map - to setup the visibility map between wtap instances +# + vimage - to configure/destroy vtap nodes + +# The name of the test that will be printed in the begining +TEST_NAME="4 nodes in line-topology with HWMPROOT NORMAL" + +# Global flags +FLAG_QUIET=0 + +# The number of nodes to test +NBR_NODES=4 + +# The subnet prefix +IP_SUBNET="192.168.2." + +cmd() +{ + if [ $FLAG_QUIET = 1 ]; then + echo "*** " $* >> output + $* >> output + else + echo "*** " $* + $* + fi +} + +info() +{ + if [ $FLAG_QUIET = 1 ]; then + echo "*** " $* >> output + else + echo "*** " $* + fi +} + +descr() +{ + cat < B <-> C <-> D + +* configures A to be ROOT (NORMAL) +* After a grace period the forwarding information for each + of B,C and D is checked to contain correct number of hops: + + ----NHOP 3 --------- + / ---NHOP 2------- | + |/ -NHOP 1-- | | + ||/ | | | + A <-----> B <-> C <-> D + +It is expected that the initial creation and discovery phase +will take some time so the initial run will fail until discovery +is done. A future extension to the test suite should be to +set lower/upper bounds on the discovery phase time. + +EOL +} + +setup() +{ + # Initialize output file + echo "" > output + echo "TEST: ${TEST_NAME}" + + # Create wtap/vimage nodes + for i in `seq 1 ${NBR_NODES}`; do + wtap_if="`expr $i - 1`" + info "Setup: vimage $i - wtap$wtap_if" + cmd vimage -c $i + cmd wtap c $wtap_if + done + + # Set visibility for each node to see the + # next node. + n="`expr ${NBR_NODES} - 1`" + for i in `seq 0 ${n}`; do + j="`expr ${i} + 1`" + cmd vis_map a $i $j + cmd vis_map a $j $i + done + + # Makes the visibility map plugin deliver packets to resp. dest. + cmd vis_map o + + # Create each wlan subinterface, place into the correct vnet + for i in `seq 0 ${n}`; do + vnet="`expr ${i} + 1`" + cmd ifconfig wlan${i} create wlandev wtap${i} wlanmode mesh + cmd ifconfig wlan${i} meshid mymesh + if [ ${i} = 0 ]; then + cmd ifconfig wlan${i} hwmprootmode normal + fi + cmd wlandebug -i wlan${i} hwmp + cmd ifconfig wlan${i} vnet ${vnet} + cmd jexec ${vnet} ifconfig wlan${i} up + + cmd jexec ${vnet} ifconfig wlan${i} inet ${IP_SUBNET}${vnet} + done +} + +run() +{ + NBR_TESTS=0 NBR_FAIL=0 + + # Wait for root to be discovered by all and then check if + # it is present in all nodes forwarding information (FI) + sleep_time=10 + info "Waiting ${sleep_time}s for network to settle" + sleep ${sleep_time} + + # Check that the forwarding information in nodes 2,3,4 + # have correct number of hops to root (1) + n="`expr ${NBR_NODES} - 1`" + for i in `seq 1 ${n}`; do + info "Checking forwarding information for ${i}.." + NBR_TESTS="`expr ${NBR_TESTS} + 1`" + j=`expr ${i} + 1` + # Check number of hops to root + FI=`jexec ${j} ifconfig wlan${i} list mesh | \ + egrep "^00:98:9a:98:96:97.*" | awk '{print $3}'` + if [ "${FI}" = "${i}" ]; then + info "CHECK: ${i} -> ${j}: SUCCESS" + else + info "CHECK: ${i} -> ${j}: FAILURE" + NBR_FAIL="`expr ${NBR_FAIL} + 1`" + fi + done + if [ $NBR_FAIL = 0 ]; then + echo "ALL TESTS PASSED" + else + echo "FAILED ${NBR_FAIL} of ${NBR_TESTS} TESTS" + fi +} + +teardown() +{ + n="`expr ${NBR_NODES} - 1`" + for i in `seq 0 ${n}`; do + vnet="`expr ${i} + 1`" + cmd jexec ${vnet} ifconfig wlan${i} destroy + done + for i in `seq 1 ${NBR_NODES}`; do + wtap_if="`expr $i - 1`" + cmd wtap d ${wtap_if} + cmd vimage -d ${i} + done +} + +EXEC_SETUP=0 +EXEC_RUN=0 +EXEC_TEARDOWN=0 +while [ "$#" -gt "0" ] +do + case $1 in + -q) + FLAG_QUIET=1 + ;; + 'all') + EXEC_SETUP=1 + EXEC_RUN=1 + EXEC_TEARDOWN=1 + ;; + 'setup') + EXEC_SETUP=1 + ;; + 'run') + EXEC_RUN=1 + ;; + 'teardown') + EXEC_TEARDOWN=1 + ;; + 'descr') + descr + exit 0 + ;; + *) + echo "$0 {all | setup | run | teardown | descr [-q]}" + exit 127 + ;; + esac + shift +done + +if [ $EXEC_SETUP = 1 ]; then + setup +fi +if [ $EXEC_RUN = 1 ]; then + run +fi +if [ $EXEC_TEARDOWN = 1 ]; then + teardown +fi + +exit 0 + Added: projects/net80211_testsuite/wtap/003/test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/net80211_testsuite/wtap/003/test.sh Wed Mar 21 15:54:44 2012 (r233279) @@ -0,0 +1,232 @@ +#!/bin/sh + +# This program requires: +# + wtap - to create/destroy the wtap instances +# + vis_map - to setup the visibility map between wtap instances +# + vimage - to configure/destroy vtap nodes + +# The name of the test that will be printed in the begining +TEST_NAME="3 nodes in a mesh topology" + +# Global flags +FLAG_QUIET=0 + +# The number of nodes to test +NBR_NODES=3 + +# The subnet prefix +IP_SUBNET="192.168.2." + +cmd() +{ + if [ $FLAG_QUIET = 1 ]; then + echo "*** " $* >> output + $* >> output + else + echo "*** " $* + $* + fi +} + +info() +{ + if [ $FLAG_QUIET = 1 ]; then + echo "*** " $* >> output + else + echo "*** " $* + fi +} + +descr() +{ + cat < output + echo "TEST: ${TEST_NAME}" + + # Create wtap/vimage nodes + for i in `seq 1 ${NBR_NODES}`; do + wtap_if="`expr $i - 1`" + info "Setup: vimage $i - wtap$wtap_if" + cmd vimage -c $i + cmd wtap c $wtap_if + done + + # Set visibility for each node to all other nodes. + n="`expr ${NBR_NODES} - 1`" + for i in `seq 0 ${n}`; do + for j in `seq 0 ${n}`; do + if [ $j != $i ]; then + cmd vis_map a $i $j + fi + done + done + + # Mark the visibility map plugin to start delivering packets. + cmd vis_map o + + # Create each wlan subinterface, place into the correct vnet + for i in `seq 0 ${n}`; do + vnet="`expr ${i} + 1`" + cmd ifconfig wlan${i} create wlandev wtap${i} wlanmode mesh + cmd ifconfig wlan${i} meshid mymesh + cmd wlandebug -i wlan${i} hwmp + cmd ifconfig wlan${i} vnet ${vnet} + cmd jexec ${vnet} ifconfig wlan${i} up + + cmd jexec ${vnet} ifconfig wlan${i} inet ${IP_SUBNET}${vnet} + done +} + +# Test statistics +NBR_TESTS=0 +NBR_FAIL=0 + +ping_all() +{ + # Test connectivity from each node to each other node + for i in `seq 1 ${NBR_NODES}`; do + for j in `seq 1 ${NBR_NODES}`; do + if [ "$i" != "$j" ]; then + # From vimage '$i' to vimage '$j'.. + info "* Checking ${i} -> ${j}.." + NBR_TESTS="`expr ${NBR_TESTS} + 1`" + # Return after a single successful packet + cmd jexec $i ping -q -t 5 -c 5 \ + -o ${IP_SUBNET}${j} + + if [ "$?" = "0" ]; then + info "CHECK: ${i} -> ${j}: SUCCESS" + else + info "CHECK: ${i} -> ${j}: FAILURE" + NBR_FAIL="`expr ${NBR_FAIL} + 1`" + fi + fi + done + done +} + +run() +{ + ping_all + + info "Removing link between 1 2" + cmd vis_map d 0 1 + cmd vis_map d 1 0 + + # NB: Because we still have not implemented lifetime decrementation + # we have to wait at least IEEE80211_INACT_RUN. + # XXX: Make IEEE80211_INACT_* SYSCTLs? + sleeptime=5 + info "Sleeping > ${sleeptime}s to timeout disconnected neighbor nodes." + sleep ${sleeptime} + + ping_all + + if [ $NBR_FAIL = 0 ]; then + echo "ALL TESTS PASSED" + else + echo "FAILED ${NBR_FAIL} of ${NBR_TESTS} TESTS" + fi +} + +teardown() +{ + n="`expr ${NBR_NODES} - 1`" + for i in `seq 0 ${n}`; do + vnet="`expr ${i} + 1`" + cmd jexec ${vnet} ifconfig wlan${i} destroy + done + for i in `seq 1 ${NBR_NODES}`; do + wtap_if="`expr $i - 1`" + cmd wtap d ${wtap_if} + cmd vimage -d ${i} + done +} + +EXEC_SETUP=0 +EXEC_RUN=0 +EXEC_TEARDOWN=0 +while [ "$#" -gt "0" ] +do + case $1 in + -q) + FLAG_QUIET=1 + ;; + 'all') + EXEC_SETUP=1 + EXEC_RUN=1 + EXEC_TEARDOWN=1 + ;; + 'setup') + EXEC_SETUP=1 + ;; + 'run') + EXEC_RUN=1 + ;; + 'teardown') + EXEC_TEARDOWN=1 + ;; + 'descr') + descr + exit 0 + ;; + *) + echo "$0 {all | setup | run | teardown | descr [-q]}" + exit 127 + ;; + esac + shift +done + +if [ $EXEC_SETUP = 1 ]; then + setup +fi +if [ $EXEC_RUN = 1 ]; then + run +fi +if [ $EXEC_TEARDOWN = 1 ]; then + teardown +fi + +exit 0 + Added: projects/net80211_testsuite/wtap/004/test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/net80211_testsuite/wtap/004/test.sh Wed Mar 21 15:54:44 2012 (r233279) @@ -0,0 +1,232 @@ +#!/bin/sh + +# This program requires: +# + wtap - to create/destroy the wtap instances +# + vis_map - to setup the visibility map between wtap instances +# + vimage - to configure/destroy vtap nodes + +# The name of the test that will be printed in the begining +TEST_NAME="2 nodes and one is PROXY" + +# Global flags +FLAG_QUIET=0 + +# The number of nodes to test +NBR_NODES=2 + +# The subnet prefix +IP_SUBNET="192.168.2." + +cmd() +{ + if [ $FLAG_QUIET = 1 ]; then + echo "*** " $* >> output + $* >> output + else + echo "*** " $* + $* + fi +} + +info() +{ + if [ $FLAG_QUIET = 1 ]; then + echo "*** " $* >> output + else + echo "*** " $* + fi +} + +descr() +{ + cat < A <-> B | + ------------- + +* does a ping test from each node to each other node. + +It is expected that the initial creation and discovery phase +will take some time so the initial run will fail until discovery +is done. A future extension to the test suite should be to +set lower/upper bounds on the discovery phase time. + +EOL +} + +setup() +{ + # Initialize output file + echo "" > output + echo "TEST: ${TEST_NAME}" + + # Create wtap/vimage nodes + for i in `seq 1 ${NBR_NODES}`; do + wtap_if="`expr $i - 1`" + info "Setup: vimage $i - wtap$wtap_if" + cmd vimage -c $i + cmd wtap c $wtap_if + done + # Need one more vimage for the PROXY node + cmd vimage -c 3 + + # Set visibility for each node to see the + # next node. + n="`expr ${NBR_NODES} - 1`" + for i in `seq 0 ${n}`; do + j="`expr ${i} + 1`" + cmd vis_map a $i $j + cmd vis_map a $j $i + done + + # Makes the visibility map plugin deliver packets to resp. dest. + cmd vis_map o + + # Create and setup PROXY node with corresponding bridge + cmd ifconfig epair0 create + cmd ifconfig epair0a vnet 1 + cmd ifconfig epair0b vnet 2 + cmd ifconfig bridge0 create + # Disables bridge filtering + cmd sysctl net.link.bridge.pfil_member=0 + cmd sysctl net.link.bridge.pfil_bridge=0 + cmd ifconfig bridge0 vnet 2 + + # Create each wlan subinterface, place into the correct vnet + for i in `seq 0 ${n}`; do + vnet="`expr ${i} + 2`" + cmd ifconfig wlan${i} create wlandev wtap${i} wlanmode mesh + cmd ifconfig wlan${i} meshid mymesh + cmd wlandebug -i wlan${i} hwmp + cmd ifconfig wlan${i} vnet ${vnet} + done + + # Bring all interfaces up. + # NB: Bridge need to be brought up before the bridged interfaces + cmd jexec 1 ifconfig epair0a inet 192.168.2.1 + cmd jexec 2 ifconfig bridge0 addm epair0b addm wlan0 up + cmd jexec 2 ifconfig epair0b up + cmd jexec 2 ifconfig wlan0 up + cmd jexec 2 ifconfig wlan0 inet ${IP_SUBNET}2 + cmd jexec 3 ifconfig wlan1 up + cmd jexec 3 ifconfig wlan1 inet ${IP_SUBNET}3 +} + +run() +{ + NBR_TESTS=0 NBR_FAIL=0 + + # Number of all nodes in this test + ALL_NODES=`expr ${NBR_NODES} + 1` + # Test connectivity from each node to each other node + for i in `seq 1 ${ALL_NODES}`; do + for j in `seq 1 ${ALL_NODES}`; do + if [ "$i" != "$j" ]; then + # From vimage '$i' to vimage '$j'.. + info "Checking ${i} -> ${j}.." + NBR_TESTS="`expr ${NBR_TESTS} + 1`" + # Return after a single successful packet + cmd jexec $i ping -q -t 5 -c 5 \ + -o ${IP_SUBNET}${j} + + if [ "$?" = "0" ]; then + info "CHECK: ${i} -> ${j}: SUCCESS" + else + info "CHECK: ${i} -> ${j}: FAILURE" + NBR_FAIL="`expr ${NBR_FAIL} + 1`" + fi + fi + done + done + if [ $NBR_FAIL = 0 ]; then + echo "ALL TESTS PASSED" + else + echo "FAILED ${NBR_FAIL} of ${NBR_TESTS} TESTS" + fi +} + +teardown() +{ + cmd vis_map c + cmd jexec 2 ifconfig bridge0 destroy + # Bring epair back to host view, we bring both back + # otherwise a panic occurs, ie one is not enough. + cmd ifconfig epair0a -vnet 1 + cmd ifconfig epair0b -vnet 2 + cmd ifconfig epair0a destroy + n="`expr ${NBR_NODES} - 1`" + for i in `seq 0 ${n}`; do + vnet="`expr ${i} + 2`" + cmd jexec ${vnet} ifconfig wlan${i} destroy + done + for i in `seq 1 ${NBR_NODES}`; do + wtap_if="`expr $i - 1`" + cmd wtap d ${wtap_if} + cmd vimage -d ${i} + done + cmd vimage -d 3 +} + +EXEC_SETUP=0 +EXEC_RUN=0 +EXEC_TEARDOWN=0 +while [ "$#" -gt "0" ] +do + case $1 in + -q) + FLAG_QUIET=1 + ;; + 'all') + EXEC_SETUP=1 + EXEC_RUN=1 + EXEC_TEARDOWN=1 + ;; + 'setup') + EXEC_SETUP=1 + ;; + 'run') + EXEC_RUN=1 + ;; + 'teardown') + EXEC_TEARDOWN=1 + ;; + 'descr') + descr + exit 0 + ;; + *) + echo "$0 {all | setup | run | teardown | descr [-q]}" + exit 127 + ;; + esac + shift +done + +if [ $EXEC_SETUP = 1 ]; then + setup +fi +if [ $EXEC_RUN = 1 ]; then + run +fi +if [ $EXEC_TEARDOWN = 1 ]; then + teardown +fi + +exit 0 + Added: projects/net80211_testsuite/wtap/005/test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/net80211_testsuite/wtap/005/test.sh Wed Mar 21 15:54:44 2012 (r233279) @@ -0,0 +1,249 @@ +#!/bin/sh + +# This program requires: +# + wtap - to create/destroy the wtap instances +# + vis_map - to setup the visibility map between wtap instances +# + vimage - to configure/destroy vtap nodes + +# The name of the test that will be printed in the begining +TEST_NAME="2 nodes and 2 PROXY nodes" + +# Global flags +FLAG_QUIET=0 + +# The number of nodes to test +NBR_NODES=2 + +# The subnet prefix +IP_SUBNET="192.168.2." + +cmd() +{ + if [ $FLAG_QUIET = 1 ]; then + echo "*** " $* >> output + $* >> output + else + echo "*** " $* + $* + fi +} + +info() +{ + if [ $FLAG_QUIET = 1 ]; then + echo "*** " $* >> output + else + echo "*** " $* + fi +} + +descr() +{ + cat < A <-> B <--|--> proxyB + --------------- + +* does a ping test from each node to each other node. + +It is expected that the initial creation and discovery phase +will take some time so the initial run will fail until discovery +is done. A future extension to the test suite should be to +set lower/upper bounds on the discovery phase time. + +EOL +} + +setup() +{ + # Initialize output file + echo "" > output + echo "TEST: ${TEST_NAME}" + + # Create wtap/vimage nodes + for i in `seq 1 ${NBR_NODES}`; do + wtap_if="`expr $i - 1`" + info "Setup: vimage $i - wtap$wtap_if" + cmd vimage -c $i + cmd wtap c $wtap_if + done + # Need one more vimage for the PROXY node + cmd vimage -c 3 + cmd vimage -c 4 + + # Set visibility for each node to see the + # next node. + n="`expr ${NBR_NODES} - 1`" + for i in `seq 0 ${n}`; do + j="`expr ${i} + 1`" + cmd vis_map a $i $j + cmd vis_map a $j $i + done + + # Makes the visibility map plugin deliver packets to resp. dest. + cmd vis_map o + + # Create and setup PROXY A/B node with corresponding bridge + # NB: both epair must be created before moving them outside + # host view, otherwise they will receive same MAC address. + cmd ifconfig epair0 create + cmd ifconfig epair1 create + cmd ifconfig epair0a vnet 1 + cmd ifconfig epair0b vnet 2 + cmd ifconfig epair1a vnet 4 + cmd ifconfig epair1b vnet 3 + cmd ifconfig bridge0 create + cmd ifconfig bridge1 create + cmd ifconfig bridge0 vnet 2 + cmd ifconfig bridge1 vnet 3 + + # Disables bridge filtering + cmd sysctl net.link.bridge.pfil_member=0 + cmd sysctl net.link.bridge.pfil_bridge=0 + + # Create each wlan subinterface, place into the correct vnet + for i in `seq 0 ${n}`; do + vnet="`expr ${i} + 2`" + cmd ifconfig wlan${i} create wlandev wtap${i} wlanmode mesh + cmd ifconfig wlan${i} meshid mymesh + cmd wlandebug -i wlan${i} hwmp+input+output+mesh + cmd ifconfig wlan${i} vnet ${vnet} + done + + # Bring all interfaces up. + # NB: Bridge need to be brought up before the bridged interfaces + cmd jexec 1 ifconfig epair0a inet 192.168.2.1 + cmd jexec 2 ifconfig bridge0 addm epair0b addm wlan0 up + cmd jexec 2 ifconfig epair0b up + cmd jexec 2 ifconfig wlan0 up + cmd jexec 2 ifconfig wlan0 inet ${IP_SUBNET}2 + cmd jexec 3 ifconfig bridge1 addm epair1b addm wlan1 up + cmd jexec 3 ifconfig epair1b up + cmd jexec 3 ifconfig wlan1 up + cmd jexec 3 ifconfig wlan1 inet ${IP_SUBNET}3 + cmd jexec 4 ifconfig epair1a inet 192.168.2.4 +} + +run() +{ + NBR_TESTS=0 NBR_FAIL=0 + + # Number of all nodes in this test + ALL_NODES=`expr ${NBR_NODES} + 2` + # Test connectivity from each node to each other node + for i in `seq 1 ${ALL_NODES}`; do + for j in `seq 1 ${ALL_NODES}`; do + if [ "$i" != "$j" ]; then + # From vimage '$i' to vimage '$j'.. + info "Checking ${i} -> ${j}.." + NBR_TESTS="`expr ${NBR_TESTS} + 1`" + # Return after a single successful packet + cmd jexec $i ping -q -t 5 -c 5 \ + -o ${IP_SUBNET}${j} + + if [ "$?" = "0" ]; then + info "CHECK: ${i} -> ${j}: SUCCESS" + else + info "CHECK: ${i} -> ${j}: FAILURE" + NBR_FAIL="`expr ${NBR_FAIL} + 1`" + fi + fi + done + done + if [ $NBR_FAIL = 0 ]; then + echo "ALL TESTS PASSED" + else + echo "FAILED ${NBR_FAIL} of ${NBR_TESTS} TESTS" + fi +} + +teardown() +{ + cmd vis_map c + cmd jexec 2 ifconfig bridge0 destroy + cmd jexec 3 ifconfig bridge1 destroy + # Bring epair back to host view, we bring both back + # otherwise a panic occurs, ie one is not enough. + cmd ifconfig epair0a -vnet 1 + cmd ifconfig epair0b -vnet 2 + cmd ifconfig epair0a destroy + cmd ifconfig epair1a -vnet 4 + cmd ifconfig epair1b -vnet 3 + cmd ifconfig epair1a destroy + n="`expr ${NBR_NODES} - 1`" + for i in `seq 0 ${n}`; do + vnet="`expr ${i} + 2`" + cmd jexec ${vnet} ifconfig wlan${i} destroy + done + for i in `seq 1 ${NBR_NODES}`; do + wtap_if="`expr $i - 1`" + cmd wtap d ${wtap_if} + cmd vimage -d ${i} + done + cmd vimage -d 3 + cmd vimage -d 4 +} + +EXEC_SETUP=0 +EXEC_RUN=0 +EXEC_TEARDOWN=0 +while [ "$#" -gt "0" ] +do + case $1 in + -q) + FLAG_QUIET=1 + ;; + 'all') + EXEC_SETUP=1 + EXEC_RUN=1 + EXEC_TEARDOWN=1 + ;; + 'setup') + EXEC_SETUP=1 + ;; + 'run') + EXEC_RUN=1 + ;; + 'teardown') + EXEC_TEARDOWN=1 + ;; + 'descr') + descr + exit 0 + ;; + *) + echo "$0 {all | setup | run | teardown | descr [-q]}" + exit 127 + ;; + esac + shift +done + +if [ $EXEC_SETUP = 1 ]; then + setup +fi +if [ $EXEC_RUN = 1 ]; then + run +fi +if [ $EXEC_TEARDOWN = 1 ]; then + teardown +fi + +exit 0 + From owner-svn-src-projects@FreeBSD.ORG Wed Mar 21 16:01:15 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3A7C1065670; Wed, 21 Mar 2012 16:01:15 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C01808FC1B; Wed, 21 Mar 2012 16:01:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2LG1FNZ083573; Wed, 21 Mar 2012 16:01:15 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2LG1F5U083572; Wed, 21 Mar 2012 16:01:15 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201203211601.q2LG1F5U083572@svn.freebsd.org> From: Adrian Chadd Date: Wed, 21 Mar 2012 16:01:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233280 - projects/net80211_testsuite/wtap X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 16:01:15 -0000 Author: adrian Date: Wed Mar 21 16:01:15 2012 New Revision: 233280 URL: http://svn.freebsd.org/changeset/base/233280 Log: Add a very simple (and dumb) script to run the wtap test suites. Added: projects/net80211_testsuite/wtap/run-all.sh (contents, props changed) Added: projects/net80211_testsuite/wtap/run-all.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/net80211_testsuite/wtap/run-all.sh Wed Mar 21 16:01:15 2012 (r233280) @@ -0,0 +1,10 @@ +#!/bin/sh + +TEST_CASES="001 002 003 004 005" + +for i in ${TEST_CASES}; do + echo "=== Test ${i}" + ${i}/test.sh setup + ${i}/test.sh run + ${i}/test.sh teardown +done From owner-svn-src-projects@FreeBSD.ORG Thu Mar 22 07:34:16 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71948106566B; Thu, 22 Mar 2012 07:34:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 443568FC16; Thu, 22 Mar 2012 07:34:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2M7YGVF013105; Thu, 22 Mar 2012 07:34:16 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2M7YGU6013104; Thu, 22 Mar 2012 07:34:16 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201203220734.q2M7YGU6013104@svn.freebsd.org> From: Ed Schouten Date: Thu, 22 Mar 2012 07:34:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233292 - projects/clangbsd X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 07:34:16 -0000 Author: ed Date: Thu Mar 22 07:34:15 2012 New Revision: 233292 URL: http://svn.freebsd.org/changeset/base/233292 Log: Bye bye ClangBSD! Deleted: projects/clangbsd/ From owner-svn-src-projects@FreeBSD.ORG Thu Mar 22 10:26:53 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D67CE106566B; Thu, 22 Mar 2012 10:26:53 +0000 (UTC) (envelope-from dmarion@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C0DD78FC08; Thu, 22 Mar 2012 10:26:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2MAQrZK020368; Thu, 22 Mar 2012 10:26:53 GMT (envelope-from dmarion@svn.freebsd.org) Received: (from dmarion@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2MAQr6x020364; Thu, 22 Mar 2012 10:26:53 GMT (envelope-from dmarion@svn.freebsd.org) Message-Id: <201203221026.q2MAQr6x020364@svn.freebsd.org> From: Damjan Marion Date: Thu, 22 Mar 2012 10:26:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233301 - in projects/armv6/sys/arm/ti: . am335x X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 10:26:53 -0000 Author: dmarion Date: Thu Mar 22 10:26:53 2012 New Revision: 233301 URL: http://svn.freebsd.org/changeset/base/233301 Log: Add PRCM and SCM prereqs for USB controller on AM335x Approved by: cognet (mentor) Modified: projects/armv6/sys/arm/ti/am335x/am335x_prcm.c projects/armv6/sys/arm/ti/am335x/am335x_scm_padconf.c projects/armv6/sys/arm/ti/ti_prcm.h Modified: projects/armv6/sys/arm/ti/am335x/am335x_prcm.c ============================================================================== --- projects/armv6/sys/arm/ti/am335x/am335x_prcm.c Thu Mar 22 09:51:31 2012 (r233300) +++ projects/armv6/sys/arm/ti/am335x/am335x_prcm.c Thu Mar 22 10:26:53 2012 (r233301) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #define CM_PER_L3S_CLKSTCTRL (CM_PER + 0x004) #define CM_PER_L3_CLKSTCTRL (CM_PER + 0x00C) #define CM_PER_CPGMAC0_CLKCTRL (CM_PER + 0x014) +#define CM_PER_USB0_CLKCTRL (CM_PER + 0x01C) #define CM_PER_I2C2_CLKCTRL (CM_PER + 0x044) #define CM_PER_I2C1_CLKCTRL (CM_PER + 0x048) #define CM_PER_TIMER7_CLKCTRL (CM_PER + 0x07C) @@ -78,6 +79,7 @@ __FBSDID("$FreeBSD$"); #define CM_WKUP_CONTROL_CLKCTRL (CM_WKUP + 0x004) #define CM_WKUP_CM_L3_AON_CLKSTCTRL (CM_WKUP + 0x01C) #define CM_WKUP_CM_CLKSEL_DPLL_MPU (CM_WKUP + 0x02C) +#define CM_WKUP_CM_CLKDCOLDO_DPLL_PER (CM_WKUP + 0x07C) #define CM_WKUP_I2C0_CLKCTRL (CM_WKUP + 0x0B8) #define CM_DPLL 0x500 @@ -111,6 +113,7 @@ static int am335x_clk_get_sysclk_freq(st static int am335x_clk_get_arm_fclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq); static void am335x_prcm_reset(void); static int am335x_clk_cpsw_activate(struct ti_clock_dev *clkdev); +static int am335x_clk_musb0_activate(struct ti_clock_dev *clkdev); #define AM335X_GENERIC_CLOCK_DEV(i) \ { .id = (i), \ @@ -147,6 +150,15 @@ struct ti_clock_dev ti_clk_devmap[] = { .clk_get_source_freq = NULL, }, + /* Mentor USB HS controller core clocks */ + { .id = MUSB0_CLK, + .clk_activate = am335x_clk_musb0_activate, + .clk_deactivate = NULL, + .clk_set_source = NULL, + .clk_accessible = NULL, + .clk_get_source_freq = NULL, + }, + /* DMTimer */ AM335X_GENERIC_CLOCK_DEV(DMTIMER2_CLK), AM335X_GENERIC_CLOCK_DEV(DMTIMER3_CLK), @@ -416,19 +428,12 @@ static int am335x_clk_cpsw_activate(struct ti_clock_dev *clkdev) { struct am335x_prcm_softc *sc = am335x_prcm_sc; - struct am335x_clk_details* clk_details; if (sc == NULL) return ENXIO; - clk_details = am335x_clk_details(clkdev->id); - - if (clk_details == NULL) - return (ENXIO); - - /* set MODULENAME to ENABLE */ - prcm_write_4(CM_PER_CPGMAC0_CLKCTRL, 2); + prcm_write_4(CM_PER_CPGMAC0_CLKCTRL, 2); /* wait for IDLEST to become Func(0) */ while(prcm_read_4(CM_PER_CPGMAC0_CLKCTRL) & (3<<16)); @@ -441,4 +446,30 @@ am335x_clk_cpsw_activate(struct ti_clock return(0); } +static int +am335x_clk_musb0_activate(struct ti_clock_dev *clkdev) +{ + struct am335x_prcm_softc *sc = am335x_prcm_sc; + + if (sc == NULL) + return ENXIO; + + /* set ST_DPLL_CLKDCOLDO(9) to CLK_GATED(1) */ + /* set DPLL_CLKDCOLDO_GATE_CTRL(8) to CLK_ENABLE(1)*/ + prcm_write_4(CM_WKUP_CM_CLKDCOLDO_DPLL_PER, 0x300); + + /*set MODULEMODE to ENABLE(2) */ + prcm_write_4(CM_PER_USB0_CLKCTRL, 2); + + /* wait for MODULEMODE to become ENABLE(2) */ + while ((prcm_read_4(CM_PER_USB0_CLKCTRL) & 0x3) != 2) + DELAY(10); + + /* wait for IDLEST to become Func(0) */ + while(prcm_read_4(CM_PER_USB0_CLKCTRL) & (3<<16)) + DELAY(10); + + return(0); +} + Modified: projects/armv6/sys/arm/ti/am335x/am335x_scm_padconf.c ============================================================================== --- projects/armv6/sys/arm/ti/am335x/am335x_scm_padconf.c Thu Mar 22 09:51:31 2012 (r233300) +++ projects/armv6/sys/arm/ti/am335x/am335x_scm_padconf.c Thu Mar 22 10:26:53 2012 (r233301) @@ -216,18 +216,20 @@ const struct ti_scm_padconf ti_padconf_d _PIN(0x9fc, "pmic_power_en", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa00, "ext_wakeup", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa04, "enz_kaldo_1p8v", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0xa08, "usb0_dm", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0xa0c, "usb0_dp", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0xa10, "usb0_ce", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0xa14, "usb0_id", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0xa18, "usb0_vbus", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0xa1c, "usb0_drvvbus", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0xa20, "usb1_dm", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0xa24, "usb1_dp", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0xa28, "usb1_ce", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0xa2c, "usb1_id", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0xa30, "usb1_vbus", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - _PIN(0xa34, "usb1_drvvbus", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +#endif + _PIN(0xa08, "USB0_DM", 0, 0, "USB0_DM", NULL, NULL, NULL, NULL, NULL, NULL, NULL), + _PIN(0xa0c, "USB0_DP", 0, 0, "USB0_DP", NULL, NULL, NULL, NULL, NULL, NULL, NULL), + _PIN(0xa10, "USB0_CE", 0, 0, "USB0_CE", NULL, NULL, NULL, NULL, NULL, NULL, NULL), + _PIN(0xa14, "USB0_ID", 0, 0, "USB0_ID", NULL, NULL, NULL, NULL, NULL, NULL, NULL), + _PIN(0xa18, "USB0_VBUS", 0, 0, "USB0_VBUS", NULL, NULL, NULL, NULL, NULL, NULL, NULL), + _PIN(0xa1c, "USB0_DRVVBUS", 18, 7, "USB0_DRVVBUS", NULL, NULL, NULL, NULL, NULL, NULL, "gpio0_18"), + _PIN(0xa20, "USB1_DM", 0, 0, "USB1_DM", NULL, NULL, NULL, NULL, NULL, NULL, NULL), + _PIN(0xa24, "USB1_DP", 0, 0, "USB1_DP", NULL, NULL, NULL, NULL, NULL, NULL, NULL), + _PIN(0xa28, "USB1_CE", 0, 0, "USB1_CE", NULL, NULL, NULL, NULL, NULL, NULL, NULL), + _PIN(0xa2c, "USB1_ID", 0, 0, "USB1_ID", NULL, NULL, NULL, NULL, NULL, NULL, NULL), + _PIN(0xa30, "USB1_VBUS", 0, 0, "USB1_VBUS", NULL, NULL, NULL, NULL, NULL, NULL, NULL), + _PIN(0xa34, "USB1_DRVVBUS", 109, 7, "USB1_DRVVBUS", NULL, NULL, NULL, NULL, NULL, NULL, "gpio3_13"), +#if 0 _PIN(0xa38, "ddr_resetn", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa3c, "ddr_csn0", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), _PIN(0xa40, "ddr_cke", 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), Modified: projects/armv6/sys/arm/ti/ti_prcm.h ============================================================================== --- projects/armv6/sys/arm/ti/ti_prcm.h Thu Mar 22 09:51:31 2012 (r233300) +++ projects/armv6/sys/arm/ti/ti_prcm.h Thu Mar 22 10:26:53 2012 (r233301) @@ -128,6 +128,9 @@ typedef enum { /* CPSW modules */ CPSW_CLK = 1000, + /* Mentor USB modules */ + MUSB0_CLK = 1100, + INVALID_CLK_IDENT } clk_ident_t; From owner-svn-src-projects@FreeBSD.ORG Thu Mar 22 15:21:10 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F1CB106566C; Thu, 22 Mar 2012 15:21:10 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 79B1A8FC0A; Thu, 22 Mar 2012 15:21:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2MFL94H029799; Thu, 22 Mar 2012 15:21:09 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2MFL9Mn029797; Thu, 22 Mar 2012 15:21:09 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201203221521.q2MFL9Mn029797@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 22 Mar 2012 15:21:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233309 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 15:21:10 -0000 Author: glebius Date: Thu Mar 22 15:21:09 2012 New Revision: 233309 URL: http://svn.freebsd.org/changeset/base/233309 Log: Improve readibility of pf_get_translation() removing a level of indentation and adding assertions for *skp and *nkp. Modified: projects/pf/head/sys/contrib/pf/net/pf_lb.c Modified: projects/pf/head/sys/contrib/pf/net/pf_lb.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_lb.c Thu Mar 22 15:14:10 2012 (r233308) +++ projects/pf/head/sys/contrib/pf/net/pf_lb.c Thu Mar 22 15:21:09 2012 (r233309) @@ -535,6 +535,11 @@ pf_get_translation(struct pf_pdesc *pd, u_int16_t sport, u_int16_t dport) { struct pf_rule *r = NULL; + struct pf_addr *naddr; + uint16_t *nport; + + KASSERT(*skp == NULL, ("*skp not NULL")); + KASSERT(*nkp == NULL, ("*nkp not NULL")); if (direction == PF_OUT) { r = pf_match_translation(pd, m, off, direction, kif, saddr, @@ -550,158 +555,137 @@ pf_get_translation(struct pf_pdesc *pd, saddr, sport, daddr, dport, PF_RULESET_BINAT); } - if (r != NULL) { - struct pf_addr *naddr; - u_int16_t *nport; + if (r == NULL) + return (NULL); - *skp = pf_state_key_setup(pd, saddr, daddr, sport, dport); - if (*skp == NULL) - return (NULL); - *nkp = pf_state_key_clone(*skp); - if (*nkp == NULL) { - uma_zfree(V_pf_state_key_z, skp); - *skp = NULL; - return (NULL); - } + *skp = pf_state_key_setup(pd, saddr, daddr, sport, dport); + if (*skp == NULL) + return (NULL); + *nkp = pf_state_key_clone(*skp); + if (*nkp == NULL) { + uma_zfree(V_pf_state_key_z, skp); + *skp = NULL; + return (NULL); + } - /* XXX We only modify one side for now. */ - naddr = &(*nkp)->addr[1]; - nport = &(*nkp)->port[1]; - - switch (r->action) { - case PF_NONAT: - case PF_NOBINAT: - case PF_NORDR: + /* XXX We only modify one side for now. */ + naddr = &(*nkp)->addr[1]; + nport = &(*nkp)->port[1]; + + switch (r->action) { + case PF_NONAT: + case PF_NOBINAT: + case PF_NORDR: + return (NULL); + case PF_NAT: + if (pf_get_sport(pd->af, pd->proto, r, saddr, daddr, dport, + naddr, nport, r->rpool.proxy_port[0], + r->rpool.proxy_port[1], sn)) { + DPFPRINTF(PF_DEBUG_MISC, + ("pf: NAT proxy port allocation (%u-%u) failed\n", + r->rpool.proxy_port[0], r->rpool.proxy_port[1])); return (NULL); - case PF_NAT: - if (pf_get_sport(pd->af, pd->proto, r, saddr, - daddr, dport, naddr, nport, r->rpool.proxy_port[0], - r->rpool.proxy_port[1], sn)) { - DPFPRINTF(PF_DEBUG_MISC, - ("pf: NAT proxy port allocation " - "(%u-%u) failed\n", - r->rpool.proxy_port[0], - r->rpool.proxy_port[1])); - return (NULL); - } - break; - case PF_BINAT: - switch (direction) { - case PF_OUT: - if (r->rpool.cur->addr.type == PF_ADDR_DYNIFTL){ - switch (pd->af) { + } + break; + case PF_BINAT: + switch (direction) { + case PF_OUT: + if (r->rpool.cur->addr.type == PF_ADDR_DYNIFTL){ + switch (pd->af) { #ifdef INET - case AF_INET: - if (r->rpool.cur->addr.p.dyn-> - pfid_acnt4 < 1) - return (NULL); - PF_POOLMASK(naddr, - &r->rpool.cur->addr.p.dyn-> - pfid_addr4, - &r->rpool.cur->addr.p.dyn-> - pfid_mask4, - saddr, AF_INET); - break; + case AF_INET: + if (r->rpool.cur->addr.p.dyn-> + pfid_acnt4 < 1) + return (NULL); + PF_POOLMASK(naddr, + &r->rpool.cur->addr.p.dyn-> + pfid_addr4, + &r->rpool.cur->addr.p.dyn-> + pfid_mask4, saddr, AF_INET); + break; #endif /* INET */ #ifdef INET6 - case AF_INET6: - if (r->rpool.cur->addr.p.dyn-> - pfid_acnt6 < 1) - return (NULL); - PF_POOLMASK(naddr, - &r->rpool.cur->addr.p.dyn-> - pfid_addr6, - &r->rpool.cur->addr.p.dyn-> - pfid_mask6, - saddr, AF_INET6); - break; -#endif /* INET6 */ - } - } else + case AF_INET6: + if (r->rpool.cur->addr.p.dyn-> + pfid_acnt6 < 1) + return (NULL); PF_POOLMASK(naddr, - &r->rpool.cur->addr.v.a.addr, - &r->rpool.cur->addr.v.a.mask, - saddr, pd->af); - break; - case PF_IN: - if (r->src.addr.type == PF_ADDR_DYNIFTL) { - switch (pd->af) { + &r->rpool.cur->addr.p.dyn-> + pfid_addr6, + &r->rpool.cur->addr.p.dyn-> + pfid_mask6, saddr, AF_INET6); + break; +#endif /* INET6 */ + } + } else + PF_POOLMASK(naddr, + &r->rpool.cur->addr.v.a.addr, + &r->rpool.cur->addr.v.a.mask, saddr, + pd->af); + break; + case PF_IN: + if (r->src.addr.type == PF_ADDR_DYNIFTL) { + switch (pd->af) { #ifdef INET - case AF_INET: - if (r->src.addr.p.dyn-> - pfid_acnt4 < 1) - return (NULL); - PF_POOLMASK(naddr, - &r->src.addr.p.dyn-> - pfid_addr4, - &r->src.addr.p.dyn-> - pfid_mask4, - daddr, AF_INET); - break; + case AF_INET: + if (r->src.addr.p.dyn-> pfid_acnt4 < 1) + return (NULL); + PF_POOLMASK(naddr, + &r->src.addr.p.dyn->pfid_addr4, + &r->src.addr.p.dyn->pfid_mask4, + daddr, AF_INET); + break; #endif /* INET */ #ifdef INET6 - case AF_INET6: - if (r->src.addr.p.dyn-> - pfid_acnt6 < 1) - return (NULL); - PF_POOLMASK(naddr, - &r->src.addr.p.dyn-> - pfid_addr6, - &r->src.addr.p.dyn-> - pfid_mask6, - daddr, AF_INET6); - break; -#endif /* INET6 */ - } - } else + case AF_INET6: + if (r->src.addr.p.dyn->pfid_acnt6 < 1) + return (NULL); PF_POOLMASK(naddr, - &r->src.addr.v.a.addr, - &r->src.addr.v.a.mask, daddr, - pd->af); - break; - } - break; - case PF_RDR: { - if (pf_map_addr(pd->af, r, saddr, naddr, NULL, sn)) - return (NULL); - if ((r->rpool.opts & PF_POOL_TYPEMASK) == - PF_POOL_BITMASK) - PF_POOLMASK(naddr, naddr, - &r->rpool.cur->addr.v.a.mask, daddr, - pd->af); - - if (r->rpool.proxy_port[1]) { - u_int32_t tmp_nport; - - tmp_nport = ((ntohs(dport) - - ntohs(r->dst.port[0])) % - (r->rpool.proxy_port[1] - - r->rpool.proxy_port[0] + 1)) + - r->rpool.proxy_port[0]; - - /* wrap around if necessary */ - if (tmp_nport > 65535) - tmp_nport -= 65535; - *nport = htons((u_int16_t)tmp_nport); - } else if (r->rpool.proxy_port[0]) - *nport = htons(r->rpool.proxy_port[0]); + &r->src.addr.p.dyn->pfid_addr6, + &r->src.addr.p.dyn->pfid_mask6, + daddr, AF_INET6); + break; +#endif /* INET6 */ + } + } else + PF_POOLMASK(naddr, &r->src.addr.v.a.addr, + &r->src.addr.v.a.mask, daddr, pd->af); break; } - default: - panic("%s: unknown action %u", __func__, r->action); - } - /* - * Translation was a NOP. - * Pretend there was no match. - */ - if (!bcmp(*skp, *nkp, sizeof(struct pf_state_key_cmp))) { - uma_zfree(V_pf_state_key_z, *nkp); - uma_zfree(V_pf_state_key_z, *skp); - *skp = *nkp = NULL; + break; + case PF_RDR: { + if (pf_map_addr(pd->af, r, saddr, naddr, NULL, sn)) return (NULL); - } + if ((r->rpool.opts & PF_POOL_TYPEMASK) == PF_POOL_BITMASK) + PF_POOLMASK(naddr, naddr, &r->rpool.cur->addr.v.a.mask, + daddr, pd->af); + + if (r->rpool.proxy_port[1]) { + uint32_t tmp_nport; + + tmp_nport = ((ntohs(dport) - ntohs(r->dst.port[0])) % + (r->rpool.proxy_port[1] - r->rpool.proxy_port[0] + + 1)) + r->rpool.proxy_port[0]; + + /* Wrap around if necessary. */ + if (tmp_nport > 65535) + tmp_nport -= 65535; + *nport = htons((uint16_t)tmp_nport); + } else if (r->rpool.proxy_port[0]) + *nport = htons(r->rpool.proxy_port[0]); + break; + } + default: + panic("%s: unknown action %u", __func__, r->action); + } + + if (!bcmp(*skp, *nkp, sizeof(struct pf_state_key_cmp))) { + /* Translation was a NOP. Pretend there was no match. */ + uma_zfree(V_pf_state_key_z, *nkp); + uma_zfree(V_pf_state_key_z, *skp); + *skp = *nkp = NULL; + return (NULL); } return (r); } - From owner-svn-src-projects@FreeBSD.ORG Fri Mar 23 05:44:44 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5FE63106566B; Fri, 23 Mar 2012 05:44:44 +0000 (UTC) (envelope-from gjb@semihalf.com) Received: from smtp.semihalf.com (smtp.semihalf.com [213.17.239.109]) by mx1.freebsd.org (Postfix) with ESMTP id 0B6518FC18; Fri, 23 Mar 2012 05:44:43 +0000 (UTC) Received: from localhost (unknown [213.17.239.109]) by smtp.semihalf.com (Postfix) with ESMTP id 7E26BC8A0D; Fri, 23 Mar 2012 06:44:35 +0100 (CET) X-Virus-Scanned: by amavisd-new at semihalf.com Received: from smtp.semihalf.com ([213.17.239.109]) by localhost (smtp.semihalf.com [213.17.239.109]) (amavisd-new, port 10024) with ESMTP id TmOYvORGJU1s; Fri, 23 Mar 2012 06:44:34 +0100 (CET) Received: from [172.17.136.194] (adsl-64-175-228-30.dsl.sntc01.pacbell.net [64.175.228.30]) by smtp.semihalf.com (Postfix) with ESMTPSA id 369C2C5BAD; Fri, 23 Mar 2012 06:44:32 +0100 (CET) Message-ID: <4F6C0DC4.60906@semihalf.com> Date: Fri, 23 Mar 2012 06:44:36 +0100 From: Grzegorz Bernacki User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201203171710.q2HHAFiq079651@svn.freebsd.org> <20120317215156.GJ1340@garage.freebsd.pl> In-Reply-To: <20120317215156.GJ1340@garage.freebsd.pl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-projects@freebsd.org, Grzegorz Bernacki , src-committers@freebsd.org Subject: Re: svn commit: r233091 - in projects/nand: sbin/fdisk sys/sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 05:44:44 -0000 W dniu 2012-03-17 22:51, Pawel Jakub Dawidek pisze: > On Sat, Mar 17, 2012 at 05:10:15PM +0000, Grzegorz Bernacki wrote: >> Author: gber >> Date: Sat Mar 17 17:10:14 2012 >> New Revision: 233091 >> URL: http://svn.freebsd.org/changeset/base/233091 >> >> Log: >> Add ioctl and structures for accessing nand disk devices. > Grzegorz, this is really wrong way to do it. Neither geom_dev nor > geom_disk are the places to add NAND specific ioctls. > > The DEV GEOM class will forward unknown ioctl to provider's class. In > this case to the DISK class. The DISK class will also forward ioctls to > your method. Take a look at the g_disk_ioctl() function. When you > configure your disk structure between disk_alloc() and disk_create() you > just need to set d_ioctl field to your ioctl method and handle all > ioctls specific to your class there. See disk(9) for more info. > > Ioctl is also the way you should send/receive metadata (eventually > BIO_GETATTR) and not to introduce new BIO types that will only be used > by one GEOM class. > > Don't hesitate to discuss this stuff on the freebsd-geom@ mailing list > to avoid surprises on the commit day. Hi Pawel, I am changing code the way suggested. I am going to get rid of our code in geom generic files and use ioctl to read/write metadata. I will commit code soon, so it can be reviewed and discussed. regards, grzesiek From owner-svn-src-projects@FreeBSD.ORG Fri Mar 23 14:12:51 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EE63D106564A; Fri, 23 Mar 2012 14:12:51 +0000 (UTC) (envelope-from cherry@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C140E8FC0C; Fri, 23 Mar 2012 14:12:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NECpkN079616; Fri, 23 Mar 2012 14:12:51 GMT (envelope-from cherry@svn.freebsd.org) Received: (from cherry@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NECplP079615; Fri, 23 Mar 2012 14:12:51 GMT (envelope-from cherry@svn.freebsd.org) Message-Id: <201203231412.q2NECplP079615@svn.freebsd.org> From: "Cherry G. Mathew" Date: Fri, 23 Mar 2012 14:12:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233364 - projects/amd64_xen_pv X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 14:12:52 -0000 Author: cherry Date: Fri Mar 23 14:12:51 2012 New Revision: 233364 URL: http://svn.freebsd.org/changeset/base/233364 Log: Create a project branch for work-in-progress on FreeBSD/Xen domU Paravirtualised support on amd64 Approved by gibbs (mentor) Added: - copied from r233363, head/ Directory Properties: projects/amd64_xen_pv/ (props changed) From owner-svn-src-projects@FreeBSD.ORG Fri Mar 23 14:38:49 2012 Return-Path: Delivered-To: svn-src-projects@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9B391065677; Fri, 23 Mar 2012 14:38:49 +0000 (UTC) (envelope-from gjb@semihalf.com) Received: from smtp.semihalf.com (smtp.semihalf.com [213.17.239.109]) by mx1.freebsd.org (Postfix) with ESMTP id 65A148FC0A; Fri, 23 Mar 2012 14:38:49 +0000 (UTC) Received: from localhost (unknown [213.17.239.109]) by smtp.semihalf.com (Postfix) with ESMTP id BABD8D9A25; Fri, 23 Mar 2012 15:38:40 +0100 (CET) X-Virus-Scanned: by amavisd-new at semihalf.com Received: from smtp.semihalf.com ([213.17.239.109]) by localhost (smtp.semihalf.com [213.17.239.109]) (amavisd-new, port 10024) with ESMTP id tEDnny6Sn9jW; Fri, 23 Mar 2012 15:38:40 +0100 (CET) Received: from [172.17.136.194] (adsl-64-175-228-30.dsl.sntc01.pacbell.net [64.175.228.30]) by smtp.semihalf.com (Postfix) with ESMTPSA id 6FABDD96E6; Fri, 23 Mar 2012 15:38:38 +0100 (CET) Message-ID: <4F6C8AF1.20703@semihalf.com> Date: Fri, 23 Mar 2012 15:38:41 +0100 From: Grzegorz Bernacki User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: Konstantin Belousov References: <201203170318.q2H3ITdI047893@svn.freebsd.org> <20120317085116.GC1340@garage.freebsd.pl> <20120317161050.GI75778@deviant.kiev.zoral.com.ua> In-Reply-To: <20120317161050.GI75778@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-projects@FreeBSD.org, Grzegorz Bernacki , Pawel Jakub Dawidek , src-committers@FreeBSD.org Subject: Re: svn commit: r233072 - projects/nand/sys/kern X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 14:38:49 -0000 W dniu 2012-03-17 17:10, Konstantin Belousov pisze: > On Sat, Mar 17, 2012 at 09:51:16AM +0100, Pawel Jakub Dawidek wrote: >> On Sat, Mar 17, 2012 at 03:18:29AM +0000, Grzegorz Bernacki wrote: >>> Author: gber >>> Date: Sat Mar 17 03:18:28 2012 >>> New Revision: 233072 >>> URL: http://svn.freebsd.org/changeset/base/233072 >>> >>> Log: >>> Add VFS changes necessary for NANDFS to work. >>> >>> Ignore B_MANAGED buffer by syncer and ignore signal when msleep as it >>> can cause file system inconsistency. >> I'd suggest running these changes through kib@. Especially vn_start_write() >> change below looks ugly, but maybe it is only temporary? > It is not only ugly (and object against it). > > If the change makes any difference for the filesystem, then I just argue > that the filesystem is broken. The vn_start_write() is done on the > VFS entry peripheral, long before filesystem code is hit. > > I did not looked at the managed changes, you would need to describe > what is wrong with current code and what is the purpose of the changes. > B_MANAGED came from xfs, it seems, or at least xfs is the only current > consumer of B_MANAGED buffers. Hi, Sorry for late response. Yes, it is workaround. We are going to remove it, when we are finished with other tasks. regards, grzesiek