From owner-freebsd-hackers@freebsd.org Thu Jun 4 23:02:02 2020 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A0E6335E41 for ; Thu, 4 Jun 2020 23:02:02 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic305-21.consmr.mail.gq1.yahoo.com (sonic305-21.consmr.mail.gq1.yahoo.com [98.137.64.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49dLrS4x5xz4DNB for ; Thu, 4 Jun 2020 23:02:00 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: FsHjRyYVM1k.EVzkncqkLKVr1to6fauIoTSWUNwSK_PX3VznL42IssUPWf9Km4g q6PCDlPaVemUHbmv2yeKCUiIBs1BEZwI_n4VPOQu1W.Y9CK2qeibuuB0FTeCh6KlUpfOWDJEMu17 UqQtkB4N.Zbj4k4IGiOSCdHuHEKAJjRHKXcQRk5PexW.8IEtKSTM9qpeBTU7cmvatbj4GBpIPt2y eVxlyyLDko00u90O_BE1QyKsfYJRE4DdbPeFCnailr.WbJDW.j2.eRs5Jyd9UVWUArzz3e1WbN_N QMZ2PvKzBK21IsvmmGZfxeB6QrmYr4iU3EOSjBL6dFwSrUBYrUKVQ8dArsDvsLRjMeOZEpwrWxYR DciCNo99zWuvKY9d6BZSLs1oPlsTo3p493swptnrq78FZTcveUW2oZ1nnfB3DfuhJs8dsk1aWHq. Fos3cEOigt0Q1Pc_6LFOM6WLR97FJ4xRWu_.vtk0BsO8p2oTFM4hWb0dhaiH6aG_EH_Z68IxZW6m 3NVDOQYxqXsWHybJN6dYVkuObF2uMrZz1xLJu2Ed3CsjzxlzO0kfYgZ.VX4pGJ_h96Jh1Bj4BkKE SPcrnQ5DAanJrjA4Fez4x_LMz0YZP3igK.nZNm0gzyAOpbShVTF.INu7ixS8Z8U2Y48ku6VV9EIN NKQFvu41tiXRTzCnRXNFncD1TtGcL6uAnH7lH9TMXn0HGj7X3qIzCK6cgpGgvBXA5VuvHpIA4gre 0iz2vhVH0KlJC.O5JbwQB9dwhZMhQ5UrsRiiZ9ic5s6cmdUQ6stA4ogSnar_rJQcDqiZVw0KMiW7 kWoMtXv33pnQmRxfXIj1Is.zrQwSlGt__hulXRCavd4SMLAD8IWKMjMG.Hb4hqSvoLyveuZUUkpC 0RAz0pT2yxiF1_Ft6SXsJtmyq2Sh_R99ncVf7e3Z5pXMLyw_JlUJ.bps7aWXOQfeJQWh3B9xFgPR TH6m3rUEnjCQnGd9g7AcpKjtlTXpByenZbDCdR2J4njxCW4XIFxkIp9rTvyfQkYn.kAGIBxu6TpJ 0BL8Ig8VxNtEHMVjocpUncznQiy0nXJ1CDh0XVMht0b1g3IE_b8cT1F3Xq3i1qKJ8WkbNrIDr3rQ ijhYXFPbYVsQUAg4_5KzyK2ndFJkvokYWKea9dJN3arNxP24JcyBsnv_n18G4KCaE10.PjJ7wWF_ ihLOxlrE47epoD5XMZbDMoEFd192kHdATTxn_B8fSeDblqVeT1Qgsyx9OmhuNgoxSZz8FFv02KWd dC_dEoF6KC2zk1F2Jc3DqbGLJ7Sq8H35nFUem3LXAPrABiBTRaLRox3JI0Ej6yPidIQck9s6hE9k sIgIe6ZOIRY66IE4MyGNub89OlHVM1RU6zC.VPmDhxGSKYMuaUrLK1gDCCg_y2_ESHQ23Q6RH56X YN4.Yp3snBALIU2wz Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.gq1.yahoo.com with HTTP; Thu, 4 Jun 2020 23:01:57 +0000 Received: by smtp422.mail.ne1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID d7199c91087251eb2b0f187614f4eef8; Thu, 04 Jun 2020 23:01:53 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: Can we hook a device as device to two different parent devices? From: Mark Millard In-Reply-To: <20200604215300.GH4213@funkthat.com> Date: Thu, 4 Jun 2020 16:01:52 -0700 Cc: FreeBSD Hackers , freebsd-drivers@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: References: <20200604215300.GH4213@funkthat.com> To: John-Mark Gurney X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Rspamd-Queue-Id: 49dLrS4x5xz4DNB X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.50 / 15.00]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; NEURAL_HAM_SHORT(-0.97)[-0.972]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; SUBJECT_ENDS_QUESTION(1.00)[]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.02)[-1.022]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; RCPT_COUNT_THREE(0.00)[3]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.00)[-1.004]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.64.84:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.64.84:from]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Jun 2020 23:02:02 -0000 [I'm only trying to follow along for my own edification in an area I'm not familiar with.] On 2020-Jun-4, at 14:53, John-Mark Gurney wrote: > Rajesh Kumar wrote this message on Fri, Jun 05, 2020 at 00:01 +0530: >> Thanks Warner and Andriy for your answers. >> >> Having said they are two separate instances, if the child driver calls the >> interface of two parents as below >> device1_interface(child_dev), then device_get_parent(child_dev) in the >> device1 interface will return device1 reference >> device2_interface(child_dev), then device_get_parent(child_dev) in the >> device2 interface will return device2 reference >> >> Is that right? > > I think you're confused. The device tree is a strict tree. This > means that a device can have ONLY one parent. The multiple parents > is simply saying that a device can attach at different points in the > tree... > > example, you have a device dev that is declared as possibly having both > pci and simplebus: > > nexus0 > acpi0 > pcib0 > pci0 > hostb0 > pcib1 > pci1 > dev0 > ofwbus0 > simplebus1 pnpinfo compat=simple-bus > dev1 > > This example (and entirely made up, I've merged the tree from two > different machines, running devinfo -v, only merged to make a point), > dev0, when calling device_get_parent, will get the pci1 device, and > dev1 when calling device_get_parent will get simplebus1... > > I think this might be what you said above, but couldn't follow the > device1_interface(child_dev) part, as that didn't make sense to me... You have 3 "dev" names mentioned above: dev, dev0, dev1 You mention "dev" as the "device". So am I to infer that for "dev" only one of dev0 vs. dev1 can be attached at a time (to its parent)? Code can still find out what the alternative would be for the other one of the two, but having both dev0 and dev1 based attachments at the same time can not be done? === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)