From owner-svn-src-head@freebsd.org Fri Sep 30 04:38:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A6E9C0164A; Fri, 30 Sep 2016 04:38:15 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-ua0-x22a.google.com (mail-ua0-x22a.google.com [IPv6:2607:f8b0:400c:c08::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2002E3EF; Fri, 30 Sep 2016 04:38:15 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-ua0-x22a.google.com with SMTP id n13so84384618uaa.3; Thu, 29 Sep 2016 21:38:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=WMFl/TS2yZWoBxCq9ViPWFYeS1OHLSTvZKFOczf8z6w=; b=YnSFKWUcETWuUM8+l46dnb3NwKM/V8ME+25GxvLJWG/Utxd5lL0CVszbZjUggsR3jC NgmJD2HJ1XRXoos6JcjCB8I4NvRmpln+7Rm0XurSkhAouWZ5k6S2L8/XBc96gRXmnwuW dXR7cg1MEbwGUQB2N7Vu/SKwT+Rvez7yXFrN7kiwwIzRwoF1E9iB+lKVupb5QJRe+K1m aJBxAgjB2XCwKMhQGXcyyXqda7oDzgZnrWePIHHljt9NJuaIjK0UwTWETaDMzLs2Yzkg uEeUGnPU1wWNbOxOGiyVb9KxYVxbmFv261ue3yrVNZ+kcuwWTrc1Zl/5tRxvjOb7ooNV vBCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=WMFl/TS2yZWoBxCq9ViPWFYeS1OHLSTvZKFOczf8z6w=; b=Bg3Qg//LZ5+y+bjxmMCwx/h7VE5mes6KQ5U9OKm0a8SPiF8H0wClAj70cw7sX7aWIz l4lJWnKHlZe09S83wZu6rvB4bsca39mBU4zdPBlUn2cc/IeL7tEUtGe6ePeUAldplq8g 0rl78LhpSBObYHCuz5T6+I+uAOdMOYwMqyJYELoVBPULdpLIskg2OqC4W4FcnMvMJzNz Jy5iDxvM9gKUMGGoz+8sKkBuu3cmfhAk8i2G9WQ3lMgWuWvaSMKAyJoI/LcaFkbVMW2m 27pvayGnF9GwIKSrXeMmZlFYXCxniZKpDeNfPArT7To5d4o3sDEbrs4Aq29pWt8Mo111 FjeQ== X-Gm-Message-State: AA6/9RkQIHWlo8YysTg3/z1dEaGXV/ttBG4HuKa0nTs6/m8gNoB6aiS9gu4HpV0a7VwWdXBnKx5G5iwS37jsgA== X-Received: by 10.176.2.162 with SMTP id 31mr3575013uah.41.1475210293908; Thu, 29 Sep 2016 21:38:13 -0700 (PDT) MIME-Version: 1.0 Sender: chmeeedalf@gmail.com Received: by 10.103.72.141 with HTTP; Thu, 29 Sep 2016 21:38:13 -0700 (PDT) Received: by 10.103.72.141 with HTTP; Thu, 29 Sep 2016 21:38:13 -0700 (PDT) In-Reply-To: References: <201609300248.u8U2meEe014568@repo.freebsd.org> <889ba670-a36a-8b80-d9f9-8d8d23cce423@freebsd.org> From: Justin Hibbits Date: Thu, 29 Sep 2016 23:38:13 -0500 X-Google-Sender-Auth: -sTzQCn_pSCL6PoUDTdZrm4VlJ4 Message-ID: Subject: Re: svn commit: r306473 - head/sys/dev/fdt To: Nathan Whitehorn Cc: src-committers , svn-src-head@freebsd.org, svn-src-all@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2016 04:38:15 -0000 If I remember correctly, newbus will throw an error if you try to create two devices with the same number. Applying the logic of using the cell-index property for all device nodes, if two sub buses from simplebus have the same set of child nodes, with the same cell-index property values, one set of children would error and not attach. Of course this change is only for simplebus, so shouldn't have too big an impact. - Justin On Sep 29, 2016 23:23, "Nathan Whitehorn" wrote: > Eh, I don't care much, especially if it's for cosmetic reasons only. I'm > not sure I understand your suggested complication, but will leave the > choice to you in any case. > -Nathan > > On 09/29/16 21:16, Justin Hibbits wrote: > >> >> It's more cosmetic than anything else. I did realize a potential >> complication with it tonight, too, if newbus devices are created as >> children (like DMA channels in this case), and have the cell-index >> property. If you object it's an easy revert. >> >> - Justin >> >> >> On Sep 29, 2016 23:10, "Nathan Whitehorn" > > wrote: >> >> I'm a little dubious about this change. It's not really safe to >> rely on newbus unit numbers anywhere, so making them meaningful in >> this context seems like a bad idea. >> -Nathan >> >> On 09/29/16 19:48, Justin Hibbits wrote: >> >> Author: jhibbits >> Date: Fri Sep 30 02:48:40 2016 >> New Revision: 306473 >> URL: https://svnweb.freebsd.org/changeset/base/306473 >> >> >> Log: >> Use the cell-index property as the unit number if available. >> Summary: >> NXP/Freescale, among others, includes an optional >> cell-index property >> on nodes to denote the SoC block number of the node. This >> can be useful if, for >> example, a node is disabled or nonexistent in the fdt, or >> the blocks are not >> organized in address-sorted order. For instance, on the >> P1022, DMA2 is located >> at CCSR offset 0xC000, while DMA1 is located at 0x21000. >> Reviewed By: jmcneill >> Differential Revision: https://reviews.freebsd.org/D8054 >> >> >> Modified: >> head/sys/dev/fdt/simplebus.c >> >> Modified: head/sys/dev/fdt/simplebus.c >> ============================================================ >> ================== >> --- head/sys/dev/fdt/simplebus.c Fri Sep 30 01:42:29 >> 2016 (r306472) >> +++ head/sys/dev/fdt/simplebus.c Fri Sep 30 02:48:40 >> 2016 (r306473) >> @@ -265,6 +265,15 @@ simplebus_add_device(device_t dev, phand >> if ((ndi = simplebus_setup_dinfo(dev, node, di)) == NULL) >> return (NULL); >> + >> + /* >> + * If the order is unspecified, use the cell-index >> field, if available. >> + * The cell-index property is not part of any >> standard, but is widely >> + * used in NXP/Freescale and Marvell device trees. >> + */ >> + if (order == -1) >> + OF_getencprop(node, "cell-index", &order, >> sizeof(order)); >> + >> cdev = device_add_child_ordered(dev, order, name, unit); >> if (cdev == NULL) { >> device_printf(dev, "<%s>: device_add_child >> failed\n", >> >> >> >