From owner-freebsd-current@FreeBSD.ORG Sat Oct 15 16:33:06 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 DA2EF106564A; Sat, 15 Oct 2011 16:33:06 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 1F0288FC15; Sat, 15 Oct 2011 16:33:05 +0000 (UTC) Received: by wwi18 with SMTP id 18so1406299wwi.31 for ; Sat, 15 Oct 2011 09:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=pI1eEBl/0LpQ/1OnaWUj22ELIHWRyXBgzVVJtcbFG00=; b=EXofEtCTXvapQ62NM+YzwIEOi0SJSYsAJUrsRutkGN8fdi1sSBubDw4RuFXRVAAOyn kevlvLY591GgMRrLWJSXZ9ENvGpudhKYAEd5fQ61w0gR7SHgI8p1ahrOIBZmh66vE3Ph 8gs1BGeleJyhRaUohVjciz1WRDuJm9iqvkVWM= MIME-Version: 1.0 Received: by 10.216.135.207 with SMTP id u57mr1506321wei.56.1318696384883; Sat, 15 Oct 2011 09:33:04 -0700 (PDT) Sender: c.jayachandran@gmail.com Received: by 10.216.188.3 with HTTP; Sat, 15 Oct 2011 09:33:04 -0700 (PDT) In-Reply-To: <4E99A319.20801@freebsd.org> References: <4E989C28.3030606@freebsd.org> <4E99A319.20801@freebsd.org> Date: Sat, 15 Oct 2011 22:03:04 +0530 X-Google-Sender-Auth: DYuotYzwOGrdsM_UEK6w_-6lxcQ Message-ID: From: "Jayachandran C." To: Nathan Whitehorn Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Rafal Jaworowski , Marcel Moolenaar , FreeBSD Current 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:33:06 -0000 On Sat, Oct 15, 2011 at 8:43 PM, Nathan Whitehorn wrote: > On 10/15/11 01:12, Jayachandran C. wrote: >> >> On Sat, Oct 15, 2011 at 2:01 AM, Nathan Whitehorn >> =A0wrote: >>> >>> On 10/14/11 14:10, Jayachandran C. wrote: >>>> >>>> I'm planning commit this -CURRENT if there an no objections. >>>> >>>> In the current implementation, phandle is used to store a pointer to >>>> the location inside the device tree. =A0Since 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. >>>> >>>> Review or testing from device tree users will be welcome. >>>> >>>> JC. >>> >>> 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. >> >> I am actually using the offset from the beginning of FDT (fdtp) as >> phandle. =A0I 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. > > 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. Well, the existing FDT code returns 0 as the invalid handle and I do not want to change that in this commit. 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. JC.