Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Oct 2011 22:03:04 +0530
From:      "Jayachandran C." <jchandra@freebsd.org>
To:        Nathan Whitehorn <nwhitehorn@freebsd.org>
Cc:        Rafal Jaworowski <raj@semihalf.com>, Marcel Moolenaar <marcel@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: [RFC] FDT fix for 64 bit platforms
Message-ID:  <CA%2B7sy7DRTM%2Bmgxx4ogEwttLtsaVyWA5XQ4bnfJ54rQLmHZ34Pw@mail.gmail.com>
In-Reply-To: <4E99A319.20801@freebsd.org>
References:  <CA%2B7sy7AhU7WLuabx6HCtUgvEtUHWBmGe-eP=N8L9VknM65r-mg@mail.gmail.com> <4E989C28.3030606@freebsd.org> <CA%2B7sy7Ba6zrRGQuon%2B7FPk8EhgnpYLWTGv0EAPy0pdRXJfc3ZQ@mail.gmail.com> <4E99A319.20801@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Oct 15, 2011 at 8:43 PM, Nathan Whitehorn
<nwhitehorn@freebsd.org> wrote:
> On 10/15/11 01:12, Jayachandran C. wrote:
>>
>> On Sat, Oct 15, 2011 at 2:01 AM, Nathan Whitehorn
>> <nwhitehorn@freebsd.org> =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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2B7sy7DRTM%2Bmgxx4ogEwttLtsaVyWA5XQ4bnfJ54rQLmHZ34Pw>