From owner-freebsd-current@FreeBSD.ORG Sat Oct 15 16:48:26 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 135B2106564A; Sat, 15 Oct 2011 16:48:26 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id AF8CD8FC12; Sat, 15 Oct 2011 16:48:25 +0000 (UTC) Received: from [172.23.7.198] (natint3.juniper.net [66.129.224.36]) (authenticated bits=0) by mail.xcllnt.net (8.14.5/8.14.5) with ESMTP id p9FGmEY5039838 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 15 Oct 2011 09:48:22 -0700 (PDT) (envelope-from marcel@xcllnt.net) Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset=iso-8859-1 From: Marcel Moolenaar In-Reply-To: Date: Sat, 15 Oct 2011 09:48:08 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <82FC5404-7B93-426B-9303-14BD8BC37542@xcllnt.net> References: <4E989C28.3030606@freebsd.org> <4E99A319.20801@freebsd.org> To: "Jayachandran C." X-Mailer: Apple Mail (2.1244.3) Cc: Rafal Jaworowski , FreeBSD Current , Nathan Whitehorn , Andrew Duane Subject: Re: [RFC] FDT fix for 64 bit platforms X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2011 16:48:26 -0000 On Oct 15, 2011, at 9:33 AM, Jayachandran C. wrote: > On Sat, Oct 15, 2011 at 8:43 PM, Nathan Whitehorn > wrote: >> On 10/15/11 01:12, Jayachandran C. wrote: >>>=20 >>> On Sat, Oct 15, 2011 at 2:01 AM, Nathan Whitehorn >>> wrote: >>>>=20 >>>> On 10/14/11 14:10, Jayachandran C. wrote: >>>>>=20 >>>>> I'm planning commit this -CURRENT if there an no objections. >>>>>=20 >>>>> In the current implementation, phandle is used to store a pointer = to >>>>> the location inside the device tree. Since phandle_t is u32, this >>>>> will not work on 64 bit platforms. With this fix, the phandle is = the >>>>> offset from the start of device tree pointer 'fdtp', which will be = 32 >>>>> bit. >>>>>=20 >>>>> Review or testing from device tree users will be welcome. >>>>>=20 >>>>> JC. >>>>=20 >>>> Why not use offsets into the FDT rather than full pointers? I = believe >>>> having >>>> phandles greater than 32 bits violates the FDT spec, and declaring = that >>>> the >>>> FDT can't itself be larger than 4 GB seems reasonable. >>>=20 >>> I am actually using the offset from the beginning of FDT (fdtp) as >>> phandle. I cannot use the usual fdt offset (after off_dt_struct) as >>> phandle, because in that case offset of 0 is valid, but phandle 0 >>> should not be valid. >>=20 >> Why shouldn't phandle 0 be valid? The invalid phandle is -1. This is = one of >> the problems with our existing FDT code -- it makes all kinds of = wrong >> assumptions like this about IEEE 1275. >=20 > Well, the existing FDT code returns 0 as the invalid handle and I do > not want to change that in this commit. >=20 > If the return value is really wrong, we will need a bigger exercise to > change the return value and fix any callers which are affected by that > change. It should be fairly easy to change the base from fdtp to the "usual" fdt offset, so let me propose the following: 1. JC commits what he has and based on the current code. 2. We get all the facts on the table. I say this because I read different and contradictory things (0 being an invalid phandle in OF, negative phandles exist, etc). 3. We change the implementation, if such is warranted, in a separate effort. The point really is that 0 is an invalid phandle right now, right or wrong, and JCs changes are based on that. I see no problem proceeding on the path we're on, while we discuss what's the correct implementation and whether or not we should have a course change... Thoughts? --=20 Marcel Moolenaar marcel@xcllnt.net