From owner-svn-src-user@FreeBSD.ORG Sun May 13 23:36:02 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 1D463106566B; Sun, 13 May 2012 23:36:02 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from [127.0.0.1] (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 89E3614DBCD; Sun, 13 May 2012 23:36:01 +0000 (UTC) Message-ID: <4FB0455F.9010602@FreeBSD.org> Date: Sun, 13 May 2012 16:35:59 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Ulrich Spoerlein References: <201205111608.q4BG8ppa090644@svn.freebsd.org> In-Reply-To: <201205111608.q4BG8ppa090644@svn.freebsd.org> X-Enigmail-Version: 1.4.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-current , src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r235275 - projects user X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 May 2012 23:36:02 -0000 When you proposed these changes not only did I not see a consensus for you to move forward, I saw a non-zero number of people push back. Why did you proceed? Doug On 5/11/2012 9:08 AM, Ulrich Spoerlein wrote: > Author: uqs > Date: Fri May 11 16:08:51 2012 > New Revision: 235275 > URL: http://svn.freebsd.org/changeset/base/235275 > > Log: > Update guidelines on user/ and projects/ > > The goal is to make it clearer where future branches should be created. A > consistent layout under projects/ would also help with conversions to other > VCSes that do not follow the everything-is-a-subdir dogma. > > TL;DR > - If it's a branch of head that you want to merge back -> projects/ > - If it's something else -> user/your-login/ (e.g. portmaster, stress2, etc.) > > Discussed on: developers > Silence by: peter > > Modified: > user/GUIDELINES.txt > > Changes in other areas also in this revision: > Modified: > projects/GUIDELINES.txt > > Modified: user/GUIDELINES.txt > ============================================================================== > --- user/GUIDELINES.txt Fri May 11 16:04:55 2012 (r235274) > +++ user/GUIDELINES.txt Fri May 11 16:08:51 2012 (r235275) > @@ -1,16 +1,9 @@ > $FreeBSD$ > > -Golden rules: > -Rule #1: TAKE IT EASY! DON'T RUSH AND MAKE A MESS! ASK IF NEEDED! > -Rule #2: See rule #1, repeat as needed > +Guidelines for what can go in /user > +----------------------------------- > > -Peril sensitive sunglasses advisory: > -This is in flux. Expect refinement. Expect typos. > - > -Guidelines for what can go in /user and /projects > -------------------------------------------------- > - > -First of all, eveyrbody needs to keep in mind that this repository is > +First of all, everybody needs to keep in mind that this repository is > replicated as a unit. Anything that goes into the repository uses project > and volunteer resources. Once something goes in, it essentially never comes > out. Therefore, these are not dumping grounds to put random junk in the > @@ -19,82 +12,39 @@ tree that we have to mirror forever. > General guidelines: > > * Should be relevant to FreeBSD. > -* Should be at least concievably of interest to somebody else. > -* Should be in a format that is suitable to merge into the base tree. > +* Should be at least conceivably of interest to somebody else. > * Should be something that is worth people's time to read commit mail for. > * Write decent commit messages! > > +The difference between /projects and /user wasn't very clear in the past. > +Going forward /projects is reserved for branches of FreeBSD itself for possible > +re-integration into /head. Branches shall not be nested into e.g. > +/projects/foo/stable8, instead /projects/foo_stable8 shall be used. > > -The difference between /projects and /user is mostly one of intentions. > - > -If some WIP is intended to be committed to the main src tree, then it > -should go in /projects/$name/*. We encourage people to subscribe to projects > -commit messages. The reason is that WIP in projects can be expected to hit > -the base tree at some point. > - > -If some WIP is more of an experiment or speculative, that might not ever be > -merged, then it goes in /user/$username/$name/*. We don't encourage > -people to subscribe to user commit messages. > - > -If it is something unrelated to the src tree, it should probably go elsewhere. > -There will be a separate repostory made available for such things, whether it > -be a special version of mysql or xorg or gcc or whatever. > - > +/user can be used for tools and software tightly related to FreeBSD, but which > +is not a copy/branch of FreeBSD itself. > > Layout: > -Since this is for WIP that can concievably be merged, there is an argument > -that can be made that teaching the pre-commit scripts to sanity check WIP > -as it goes, rather than having a mammoth fixup being needed prior to merging. > - > -For that to work, the layout has to be predictable. eg: a branch of > -"head/sys/*" for a project called "ia65" should be /projects/ia65/sys/*. > -An experimental X11-aware verison of bin/ls/* in a user directory for jdoe > -would be /user/jdoe/x11-ls/bin/ls/*. > - > > -Creation and merging: > - > -Merging is in flux. The procedure as understood right now: > - > -Assume projects/ia65/sys. $BASE="svn+ssh://svn.freebsd.org/base" > +Since this is for auxiliary/experimental projects that might not be branched > +from head, an argument can be made that we teach the pre-commit scripts to > +sanity check WIP as it goes in. > > Initial creation: > - $ svn cp --parents $BASE/head/sys $BASE/projects/ia65/sys > + Assume user/pho/stress2. BASE="svn+ssh://svn.freebsd.org/base" > > -Then check it out: > - $ svn co $BASE/projects/ia65 > + $ svn mkdir $BASE/user/pho/stress2 > > -To integrate changes from head into your branch: > - $ cd ia65/sys ; svn update; svn status | read output! Should preferably be clean. > - (you may prefer to do merges in a second, clean checkout. It will be easier!) > - $ svn merge $BASE/head/sys > - (this merges head/sys/* into ., which is projects/ia65/sys) > +Then check it out: > + $ svn co $BASE/user/pho/stress2 > + $ hack, hack, hack > + $ svn add . > + (should schedule all files/dirs for addition) > + $ svn status > + (verify all files you want added, and only those are scheduled) > $ svn commit > > -To merge your changes into head/sys. > - $ mail -s 'Is it ok to merge projects/ia65 to head?' peter@freebsd.org > - $ wait_for_reply (the point is to have somebody on hand for the first > - timeto help rescue you if things go horribly wrong.) > - (set up a clean checkout of head/sys and projects/ia65/sys. MUST BE CLEAN!!) > - $ cd work > - $ svn co $BASE/head/sys > - $ svn co $BASE/projects/ia65/sys > - (If you've already got clean checkouts handy, replace with appropriate > - svn update commands) > - $ svn info head - NOTE CHANGE NUMBER!!! assume 12345 for this example. > - (now, bring projects/ia65 up to date with head, AS YOU JUST CHECKED IT OUT) > - $ svn merge $BASE/head/sys@12345 projects/ia65/sys > - (resolve conflicts) > - $ svn commit projects/ia65/sys > - (now, projects/ia65 is in sync with @12345, as is your head checkout) > - (reverse merge to base tree!) > - $ svn merge $BASE/projects/ia65/sys head/sys > - (resolve conflicts) > - $ svn commit head/sys > - $ profit! > - (regular svn users might wonder about merge --reintegrate. Our tree breaks > - it, sorry. We can't use it.) > - > -Tags: > - Place tags in your /user area if possible, even if the origin is a project. > - Tag by using svn cp $BASE/projects/xxx $BASE/user/jdoe/yyy. > +Other: > + > +If it is not covered here, and there's no established practice of doing what > +you're trying to achieve, always ask your peers first! > -- This .signature sanitized for your protection From owner-svn-src-user@FreeBSD.ORG Mon May 14 07:02:32 2012 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6F041065670; Mon, 14 May 2012 07:02:32 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from acme.spoerlein.net (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by mx1.freebsd.org (Postfix) with ESMTP id 5A5958FC0C; Mon, 14 May 2012 07:02:29 +0000 (UTC) Received: from localhost (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by acme.spoerlein.net (8.14.5/8.14.5) with ESMTP id q4E72SeG091364 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 14 May 2012 09:02:28 +0200 (CEST) (envelope-from uqs@FreeBSD.org) Date: Mon, 14 May 2012 09:02:28 +0200 From: Ulrich Spoerlein To: Doug Barton Message-ID: <20120514070228.GW71676@acme.spoerlein.net> Mail-Followup-To: Doug Barton , src-committers@freebsd.org, svn-src-user@freebsd.org, freebsd-current References: <201205111608.q4BG8ppa090644@svn.freebsd.org> <4FB0455F.9010602@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4FB0455F.9010602@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-current , src-committers@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r235275 - projects user X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 May 2012 07:02:33 -0000 On Sun, 2012-05-13 at 16:35:59 -0700, Doug Barton wrote: > When you proposed these changes not only did I not see a consensus for > you to move forward, I saw a non-zero number of people push back. > > Why did you proceed? - I had a non-zero number of people tell me that it looked good. - Peter doesn't seem to mind the clarification. - No objections were raised after I send out the changed patch which basically keeps things the way they were originally intended. Did you actually read what has been committed? Uli - amazed that a change to a document that apparently no one is reading can cause such a fuss. From owner-svn-src-user@FreeBSD.ORG Mon May 14 09:14:00 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 5F810106564A; Mon, 14 May 2012 09:14:00 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from [127.0.0.1] (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id EBEB6153312; Mon, 14 May 2012 09:13:59 +0000 (UTC) Message-ID: <4FB0CCD7.3000802@FreeBSD.org> Date: Mon, 14 May 2012 02:13:59 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-user@freebsd.org, freebsd-current References: <201205111608.q4BG8ppa090644@svn.freebsd.org> <4FB0455F.9010602@FreeBSD.org> <20120514070228.GW71676@acme.spoerlein.net> In-Reply-To: <20120514070228.GW71676@acme.spoerlein.net> X-Enigmail-Version: 1.4.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r235275 - projects user X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 May 2012 09:14:00 -0000 On 5/14/2012 12:02 AM, Ulrich Spoerlein wrote: > Uli - amazed that a change to a document that apparently no one is > reading can cause such a fuss. ... which is the point that several of us tried to make, and which you seem to have ignored. The problem with committers not reading the documentation (such as it is) is not properly solved by changing the documentation. What I'm objecting to is your pointless deck-chair rearranging rather than addressing the real problem. -- This .signature sanitized for your protection From owner-svn-src-user@FreeBSD.ORG Wed May 16 22:13:02 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C66B11065675; Wed, 16 May 2012 22:13:02 +0000 (UTC) (envelope-from jceel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B18D08FC15; Wed, 16 May 2012 22:13:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4GMD2gx064615; Wed, 16 May 2012 22:13:02 GMT (envelope-from jceel@svn.freebsd.org) Received: (from jceel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4GMD27Y064613; Wed, 16 May 2012 22:13:02 GMT (envelope-from jceel@svn.freebsd.org) Message-Id: <201205162213.q4GMD27Y064613@svn.freebsd.org> From: Jakub Wojciech Klama Date: Wed, 16 May 2012 22:13:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235524 - user/jceel/soc2012_armv6/lib/libc/arm/gen X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 May 2012 22:13:02 -0000 Author: jceel Date: Wed May 16 22:13:02 2012 New Revision: 235524 URL: http://svn.freebsd.org/changeset/base/235524 Log: IFC @ r235472 Modified: user/jceel/soc2012_armv6/lib/libc/arm/gen/_set_tp.c Directory Properties: user/jceel/soc2012_armv6/lib/libc/ (props changed) Modified: user/jceel/soc2012_armv6/lib/libc/arm/gen/_set_tp.c ============================================================================== --- user/jceel/soc2012_armv6/lib/libc/arm/gen/_set_tp.c Wed May 16 21:07:19 2012 (r235523) +++ user/jceel/soc2012_armv6/lib/libc/arm/gen/_set_tp.c Wed May 16 22:13:02 2012 (r235524) @@ -35,5 +35,9 @@ void _set_tp(void *tp) { +#ifdef ARM_TP_ADDRESS *((struct tcb **)ARM_TP_ADDRESS) = tp; +#else + sysarch(ARM_SET_TP, tp); +#endif } From owner-svn-src-user@FreeBSD.ORG Wed May 16 22:21:58 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 502ED106566B; Wed, 16 May 2012 22:21:58 +0000 (UTC) (envelope-from jceel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A0CA8FC15; Wed, 16 May 2012 22:21:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4GMLwMN065035; Wed, 16 May 2012 22:21:58 GMT (envelope-from jceel@svn.freebsd.org) Received: (from jceel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4GMLw94065028; Wed, 16 May 2012 22:21:58 GMT (envelope-from jceel@svn.freebsd.org) Message-Id: <201205162221.q4GMLw94065028@svn.freebsd.org> From: Jakub Wojciech Klama Date: Wed, 16 May 2012 22:21:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235526 - in user/jceel/soc2012_armv6/sys: arm/ti dev/fdt dev/uart X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 May 2012 22:21:58 -0000 Author: jceel Date: Wed May 16 22:21:57 2012 New Revision: 235526 URL: http://svn.freebsd.org/changeset/base/235526 Log: Rewrite FDT bus ranges calculation: - bus ranges from DTS files are correctly read and used for translation of device register addresses. this includes empty "ranges;" property as well as encoded ranges tuples. - simplebuses can be freely nested (except for system console UART which should be placed in toplevel simplebus) - base addresses in resources (rman) are now physical. translation or mapping to virtual address is done via bus_space_map() and can be accessed via rman_get_bushandle(). - ti_mmchs driver is corrected to use physical registers base address from rman instead of using vtophys(). Modified: user/jceel/soc2012_armv6/sys/arm/ti/ti_mmchs.c user/jceel/soc2012_armv6/sys/dev/fdt/fdt_common.c user/jceel/soc2012_armv6/sys/dev/fdt/fdt_common.h user/jceel/soc2012_armv6/sys/dev/fdt/fdtbus.c user/jceel/soc2012_armv6/sys/dev/fdt/simplebus.c user/jceel/soc2012_armv6/sys/dev/uart/uart_bus_fdt.c Directory Properties: user/jceel/soc2012_armv6/ (props changed) Modified: user/jceel/soc2012_armv6/sys/arm/ti/ti_mmchs.c ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/ti/ti_mmchs.c Wed May 16 22:19:22 2012 (r235525) +++ user/jceel/soc2012_armv6/sys/arm/ti/ti_mmchs.c Wed May 16 22:21:57 2012 (r235526) @@ -1630,7 +1630,7 @@ ti_mmchs_activate(device_t dev) panic("Unknown OMAP device\n"); /* Get the physical address of the MMC data register, needed for DMA */ - addr = vtophys(rman_get_start(sc->sc_mem_res)); + addr = rman_get_start(sc->sc_mem_res); sc->sc_data_reg_paddr = addr + sc->sc_reg_off + MMCHS_DATA; /* Set the initial power state to off */ Modified: user/jceel/soc2012_armv6/sys/dev/fdt/fdt_common.c ============================================================================== --- user/jceel/soc2012_armv6/sys/dev/fdt/fdt_common.c Wed May 16 22:19:22 2012 (r235525) +++ user/jceel/soc2012_armv6/sys/dev/fdt/fdt_common.c Wed May 16 22:21:57 2012 (r235526) @@ -64,12 +64,30 @@ vm_offset_t fdt_immr_va; vm_offset_t fdt_immr_size; int -fdt_get_range(phandle_t node, int range_id, u_long *base, u_long *size) +fdt_immr_addr(vm_offset_t immr_va) { pcell_t ranges[6], *rangesptr; + phandle_t node; + u_long base, size; pcell_t addr_cells, size_cells, par_addr_cells; int len, tuple_size, tuples; + /* + * Try to access the SOC node directly i.e. through /aliases/. + */ + if ((node = OF_finddevice("soc")) != -1) + if (fdt_is_compatible_strict(node, "simple-bus")) + goto moveon; + /* + * Find the node the long way. + */ + if ((node = OF_finddevice("/")) == -1) + return (ENXIO); + + if ((node = fdt_find_compatible(node, "simple-bus", 1)) == 0) + return (ENXIO); + +moveon: if ((fdt_addrsize_cells(node, &addr_cells, &size_cells)) != 0) return (ENXIO); /* @@ -82,14 +100,6 @@ fdt_get_range(phandle_t node, int range_ len = OF_getproplen(node, "ranges"); if (len > sizeof(ranges)) return (ENOMEM); - if (len == 0) { - *base = 0; - *size = ULONG_MAX; - return (0); - } - - if (!(range_id < len)) - return (ERANGE); if (OF_getprop(node, "ranges", ranges, sizeof(ranges)) <= 0) return (EINVAL); @@ -102,48 +112,81 @@ fdt_get_range(phandle_t node, int range_ addr_cells, size_cells)) { return (ERANGE); } - *base = 0; - *size = 0; - rangesptr = &ranges[range_id]; + base = 0; + size = 0; + rangesptr = &ranges[0]; - *base = fdt_data_get((void *)rangesptr, addr_cells); + base = fdt_data_get((void *)rangesptr, addr_cells); rangesptr += addr_cells; - *base += fdt_data_get((void *)rangesptr, par_addr_cells); + base += fdt_data_get((void *)rangesptr, par_addr_cells); rangesptr += par_addr_cells; - *size = fdt_data_get((void *)rangesptr, size_cells); + size = fdt_data_get((void *)rangesptr, size_cells); + + fdt_immr_pa = base; + fdt_immr_va = immr_va; + fdt_immr_size = size; + return (0); } int -fdt_immr_addr(vm_offset_t immr_va) +fdt_read_ranges(phandle_t node, struct fdt_range **ranges, int addr_cells, + int par_addr_cells, int size_cells) { - phandle_t node; - u_long base, size; - int r; - - /* - * Try to access the SOC node directly i.e. through /aliases/. - */ - if ((node = OF_finddevice("soc")) != 0) - if (fdt_is_compatible_strict(node, "simple-bus")) - goto moveon; - /* - * Find the node the long way. - */ - if ((node = OF_finddevice("/")) == 0) - return (ENXIO); - - if ((node = fdt_find_compatible(node, "simple-bus", 1)) == 0) - return (ENXIO); + static pcell_t data[128]; + pcell_t *ptr; + int i, len, tuple_size, ranges_count; + + len = OF_getprop(node, "ranges", (void *)&data, sizeof data); + tuple_size = addr_cells + par_addr_cells + size_cells; + ranges_count = len != 0 ? len / tuple_size / sizeof(pcell_t) : 1; + + debugf("tuple_size=%d ranges_count=%d\n", tuple_size, ranges_count); + + ptr = data; + + if (*ranges == NULL) + *ranges = malloc(sizeof(struct fdt_range) * ranges_count, + M_TEMP, M_WAITOK | M_ZERO); + + /* empty ranges case */ + if (len == 0) { + (*ranges)[0].base = 0l; + (*ranges)[0].parent = 0l; + (*ranges)[0].size = ~0l; + return (1); + } -moveon: - if ((r = fdt_get_range(node, 0, &base, &size)) == 0) { - fdt_immr_pa = base; - fdt_immr_va = immr_va; - fdt_immr_size = size; + for (i = 0; i < ranges_count; i++) { + (*ranges)[i].base = fdt_data_get((void *)ptr, addr_cells); + ptr += addr_cells; + (*ranges)[i].parent = fdt_data_get((void *)ptr, par_addr_cells); + ptr += par_addr_cells; + (*ranges)[i].size = fdt_data_get((void *)ptr, size_cells); + ptr += size_cells; + + debugf("new range: base=%lx parent=%lx size=%lx\n", + (*ranges)[i].base, (*ranges[i]).parent, + (*ranges)[i].size); + } + + return (ranges_count); +} + +__inline u_long +fdt_ranges_lookup(struct fdt_range *ranges, int nranges, u_long addr, + u_long size) +{ + int n; + + for (n = 0; n < nranges; n++) { + if (ranges[n].base <= addr && (ranges[n].base + + ranges[n].size >= addr + size - 1)) { + return ranges[n].parent; + } } - return (r); + return 0; } /* @@ -419,19 +462,17 @@ fdt_regsize(phandle_t node, u_long *base } int -fdt_reg_to_rl(phandle_t node, struct resource_list *rl) +fdt_reg_to_rl(phandle_t node, struct resource_list *rl, + struct fdt_range *ranges, int ranges_count) { - u_long start, end, count; + u_long start, end, count, parent; pcell_t *reg, *regptr; pcell_t addr_cells, size_cells; int tuple_size, tuples; int i, rv; - long vaddr; - long busaddr, bussize; if (fdt_addrsize_cells(OF_parent(node), &addr_cells, &size_cells) != 0) return (ENXIO); - fdt_get_range(OF_parent(node), 0, &busaddr, &bussize); tuple_size = sizeof(pcell_t) * (addr_cells + size_cells); tuples = OF_getprop_alloc(node, "reg", tuple_size, (void **)®); @@ -453,15 +494,22 @@ fdt_reg_to_rl(phandle_t node, struct res reg += addr_cells + size_cells; /* Calculate address range relative to base. */ - start += busaddr; - if (bus_space_map(fdtbus_bs_tag, start, count, 0, &vaddr) != 0) - panic("Couldn't map the device memory"); - end = vaddr + count - 1; + parent = 0; + + if (ranges == NULL) + goto moveon; + + parent = fdt_ranges_lookup(ranges, ranges_count, start, count); + +moveon: + + start = parent + start; + end = start + count - 1; - debugf("reg addr start = %lx, end = %lx, count = %lx\n", vaddr, + debugf("reg addr start = %lx, end = %lx, count = %lx\n", start, end, count); - resource_list_add(rl, SYS_RES_MEMORY, i, vaddr, end, + resource_list_add(rl, SYS_RES_MEMORY, i, start, end, count); } rv = 0; Modified: user/jceel/soc2012_armv6/sys/dev/fdt/fdt_common.h ============================================================================== --- user/jceel/soc2012_armv6/sys/dev/fdt/fdt_common.h Wed May 16 22:19:22 2012 (r235525) +++ user/jceel/soc2012_armv6/sys/dev/fdt/fdt_common.h Wed May 16 22:21:57 2012 (r235526) @@ -40,6 +40,12 @@ #define DI_MAX_INTR_NUM 8 +struct fdt_range { + u_long base; + u_long parent; + u_long size; +}; + struct fdt_pci_range { u_long base_pci; u_long base_parent; @@ -90,8 +96,11 @@ int fdt_data_verify(void *, int); phandle_t fdt_find_compatible(phandle_t, const char *, int); int fdt_get_mem_regions(struct mem_region *, int *, uint32_t *); int fdt_get_phyaddr(phandle_t, device_t, int *, void **); -int fdt_get_range(phandle_t, int, u_long *, u_long *); int fdt_immr_addr(vm_offset_t); +int fdt_read_ranges(phandle_t node, struct fdt_range **ranges, int addr_cells, + int par_addr_cells, int size_cels); +u_long fdt_ranges_lookup(struct fdt_range *ranges, int nranges, u_long addr, + u_long size); int fdt_regsize(phandle_t, u_long *, u_long *); int fdt_intr_decode(phandle_t, pcell_t *, int *, int *, int *); int fdt_intr_to_rl(phandle_t, struct resource_list *, struct fdt_sense_level *); @@ -107,7 +116,7 @@ int fdt_pci_ranges_decode(phandle_t, str struct fdt_pci_range *); int fdt_pci_route_intr(int, int, int, int, struct fdt_pci_intr *, int *); int fdt_ranges_verify(pcell_t *, int, int, int, int); -int fdt_reg_to_rl(phandle_t, struct resource_list *); +int fdt_reg_to_rl(phandle_t, struct resource_list *, struct fdt_range *, int); int fdt_pm(phandle_t); #endif /* _FDT_COMMON_H_ */ Modified: user/jceel/soc2012_armv6/sys/dev/fdt/fdtbus.c ============================================================================== --- user/jceel/soc2012_armv6/sys/dev/fdt/fdtbus.c Wed May 16 22:19:22 2012 (r235525) +++ user/jceel/soc2012_armv6/sys/dev/fdt/fdtbus.c Wed May 16 22:21:57 2012 (r235526) @@ -290,7 +290,7 @@ newbus_device_create(device_t dev_par, p resource_list_init(&di->di_res); - if (fdt_reg_to_rl(node, &di->di_res)) { + if (fdt_reg_to_rl(node, &di->di_res, NULL, 0)) { device_printf(child, "could not process 'reg' property\n"); newbus_device_destroy(child); child = NULL; @@ -378,9 +378,7 @@ newbus_pci_create(device_t dev_par, phan } /* Calculate address range relative to base. */ - par_base &= 0x000ffffful; - start &= 0x000ffffful; - start += par_base + fdt_immr_va; + start += par_base; if (count == 0) count = par_size; end = start + count - 1; @@ -487,6 +485,7 @@ fdtbus_alloc_resource(device_t bus, devi struct rman *rm; struct fdtbus_devinfo *di; struct resource_list_entry *rle; + bus_space_handle_t bsh; int needactivate; /* @@ -541,8 +540,16 @@ fdtbus_alloc_resource(device_t bus, devi if (type == SYS_RES_IOPORT || type == SYS_RES_MEMORY) { /* XXX endianess should be set based on SOC node */ + if (bus_space_map(fdtbus_bs_tag, rman_get_start(res), + rman_get_size(res), 0, &bsh)) + printf("cannot map memory on 0x%lx\n", + rman_get_start(res)); + rman_set_bustag(res, fdtbus_bs_tag); - rman_set_bushandle(res, rman_get_start(res)); + rman_set_bushandle(res, bsh); + + debugf("%s: virtual register space: 0x%lx\n", + device_get_name(child), bsh); } if (needactivate) Modified: user/jceel/soc2012_armv6/sys/dev/fdt/simplebus.c ============================================================================== --- user/jceel/soc2012_armv6/sys/dev/fdt/simplebus.c Wed May 16 22:19:22 2012 (r235525) +++ user/jceel/soc2012_armv6/sys/dev/fdt/simplebus.c Wed May 16 22:21:57 2012 (r235526) @@ -59,8 +59,10 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_SIMPLEBUS, "simplebus", "simplebus devices information"); struct simplebus_softc { - int sc_addr_cells; - int sc_size_cells; + int sc_addr_cells; + int sc_size_cells; + struct fdt_range * sc_ranges; + int sc_ranges_count; }; struct simplebus_devinfo { @@ -129,6 +131,7 @@ static driver_t simplebus_driver = { devclass_t simplebus_devclass; DRIVER_MODULE(simplebus, fdtbus, simplebus_driver, simplebus_devclass, 0, 0); +DRIVER_MODULE(simplebus, simplebus, simplebus_driver, simplebus_devclass, 0, 0); static int simplebus_probe(device_t dev) @@ -146,11 +149,48 @@ static int simplebus_attach(device_t dev) { device_t dev_child; + device_t parent; struct simplebus_devinfo *di; struct simplebus_softc *sc; + struct simplebus_softc *parent_sc; phandle_t dt_node, dt_child; + int i, par_addr_cells; sc = device_get_softc(dev); + dt_node = ofw_bus_get_node(dev); + + if ((fdt_addrsize_cells(dt_node, &sc->sc_addr_cells, &sc->sc_size_cells)) != 0) + return (ENXIO); + + /* + * Process 'ranges' property + */ + par_addr_cells = fdt_parent_addr_cells(dt_node); + if (par_addr_cells > 2) + return (ERANGE); + + sc->sc_ranges_count = fdt_read_ranges(dt_node, &sc->sc_ranges, + sc->sc_addr_cells, par_addr_cells, sc->sc_size_cells); + if (sc->sc_ranges_count <= 0) + device_printf(dev, "WARNING: could not read bus ranges."); + + /* + * Check if we're nested. If so, look up parent simplebus + * ranges and merge it with ours. + */ + parent = device_get_parent(dev); + + if (device_get_devclass(parent) == simplebus_devclass) { + parent_sc = device_get_softc(parent); + for (i = 0; i < sc->sc_ranges_count; i++) { + sc->sc_ranges[i].parent += fdt_ranges_lookup( + parent_sc->sc_ranges, + parent_sc->sc_ranges_count, + sc->sc_ranges[i].parent, + sc->sc_ranges[i].size); + } + } + /* * Walk simple-bus and add direct subordinates as our children. @@ -175,7 +215,9 @@ simplebus_attach(device_t dev) } resource_list_init(&di->di_res); - if (fdt_reg_to_rl(dt_child, &di->di_res)) { + + if (fdt_reg_to_rl(dt_child, &di->di_res, sc->sc_ranges, + sc->sc_ranges_count)) { device_printf(dev, "%s: could not process 'reg' " "property\n", di->di_ofw.obd_name); Modified: user/jceel/soc2012_armv6/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- user/jceel/soc2012_armv6/sys/dev/uart/uart_bus_fdt.c Wed May 16 22:19:22 2012 (r235525) +++ user/jceel/soc2012_armv6/sys/dev/uart/uart_bus_fdt.c Wed May 16 22:21:57 2012 (r235526) @@ -137,10 +137,13 @@ uart_cpu_getdev(int devtype, struct uart { char buf[64]; struct uart_class *class; - phandle_t node, chosen; + phandle_t node, parent, chosen; pcell_t shift, br, rclk; - u_long start, size, pbase, psize; - int err; + u_long start, size; + struct fdt_range ranges[8]; + struct fdt_range *rptr = ranges; + int err, addr_cells, par_addr_cells, size_cells; + int nranges; uart_bus_space_mem = fdtbus_bs_tag; uart_bus_space_io = NULL; @@ -168,6 +171,21 @@ uart_cpu_getdev(int devtype, struct uart if (OF_finddevice(buf) != node) /* Only stdin == stdout is supported. */ return (ENXIO); + + /* + * Retrieve UART device parent bus + */ + if ((parent = OF_parent(node)) <= 0) + return (ENXIO); + if (fdt_addrsize_cells(parent, &addr_cells, &size_cells)) + return (ENXIO); + if ((par_addr_cells = fdt_parent_addr_cells(parent)) > 2) + return (ENXIO); + nranges = fdt_read_ranges(parent, &rptr, addr_cells, + par_addr_cells, size_cells); + if (nranges <= 0) + return (ENXIO); + /* * Retrieve serial attributes. */ @@ -203,8 +221,11 @@ uart_cpu_getdev(int devtype, struct uart if (err) return (ENXIO); - fdt_get_range(OF_parent(node), 0, &pbase, &psize); - start += pbase; + /* + * XXX this will not work with uart sitting on + * simplebus nested in other simplebus. + */ + start += fdt_ranges_lookup(ranges, nranges, start, size); return (bus_space_map(di->bas.bst, start, size, 0, &di->bas.bsh)); } From owner-svn-src-user@FreeBSD.ORG Thu May 17 16:47:24 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 006C61065673; Thu, 17 May 2012 16:47:24 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from adsum.doit.wisc.edu (adsum.doit.wisc.edu [144.92.197.210]) by mx1.freebsd.org (Postfix) with ESMTP id C18918FC14; Thu, 17 May 2012 16:47:23 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth1.wiscmail.wisc.edu by smtpauth1.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0M460050QBUTF200@smtpauth1.wiscmail.wisc.edu>; Thu, 17 May 2012 10:47:17 -0500 (CDT) Received: from anacreon.physics.wisc.edu (anacreon.physics.wisc.edu [128.104.160.176]) by smtpauth1.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0M4600F2WBUQZK30@smtpauth1.wiscmail.wisc.edu>; Thu, 17 May 2012 10:47:14 -0500 (CDT) Date: Thu, 17 May 2012 10:47:14 -0500 From: Nathan Whitehorn In-reply-to: <201205162221.q4GMLw94065028@svn.freebsd.org> To: Jakub Wojciech Klama Message-id: <4FB51D82.50501@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=128.104.160.176 X-Spam-PmxInfo: Server=avs-15, Version=5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.5.17.154219, SenderIP=128.104.160.176 References: <201205162221.q4GMLw94065028@svn.freebsd.org> User-Agent: Mozilla/5.0 (X11; U; FreeBSD powerpc; en-US; rv:1.9.2.28) Gecko/20120423 Thunderbird/3.1.20 Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r235526 - in user/jceel/soc2012_armv6/sys: arm/ti dev/fdt dev/uart X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 May 2012 16:47:24 -0000 On 05/16/12 17:21, Jakub Wojciech Klama wrote: > Author: jceel > Date: Wed May 16 22:21:57 2012 > New Revision: 235526 > URL: http://svn.freebsd.org/changeset/base/235526 > > Log: > Rewrite FDT bus ranges calculation: > > - bus ranges from DTS files are correctly read and used for translation > of device register addresses. this includes empty "ranges;" property > as well as encoded ranges tuples. > - simplebuses can be freely nested (except for system console UART which > should be placed in toplevel simplebus) > - base addresses in resources (rman) are now physical. translation or > mapping to virtual address is done via bus_space_map() and can be > accessed via rman_get_bushandle(). > - ti_mmchs driver is corrected to use physical registers base address > from rman instead of using vtophys(). [Replying randomly] Are there any plans to merge this stuff with the support code in dev/ofw (and maybe the not-so-MD bits in sys/powerpc and sys/sparc64)? It looks like there is a huge amount of code duplication and that the ofw implementations are in general more complete. -Nathan