[SLOF] [PATCH slof v5 3/6] fdt: Pass the resulting device tree to QEMU

Alexey Kardashevskiy aik at ozlabs.ru
Mon Oct 16 23:06:15 AEDT 2017


On 16/10/17 20:07, Segher Boessenkool wrote:
> On Mon, Oct 16, 2017 at 07:35:11PM +1100, Alexey Kardashevskiy wrote:
>> On 16/10/17 19:02, Segher Boessenkool wrote:
>>> Is there no variable you can get the boot CPU from directly though?
>>
>> It does not seem so:
>>
>> board-qemu/slof/tree.fs
>>
>> \ Do not assume that cpu0 is available
>> : set-chosen-cpu
>>     " /cpus" find-device
>>     get-node child dup 0= ABORT" CPU not found"
>>     node>path open-dev encode-int s" cpu" set-chosen
>> ;
>> set-chosen-cpu
> 
> Oh lovely nasty code.
> 
> Maybe something like
> 
> 
> VARIABLE chosen-cpu-phandle
> VARIABLE chosen-cpu-ihandle
> : set-chosen-cpu ( -- )
>    s" /cpus" find-node  dup 0= ABORT" /cpus not found"
>    child                dup 0= ABORT" /cpus/cpu not found"
>    dup chosen-cpu-phandle !  0 0 rot open-node
>    dup chosen-cpu-ihandle !  encode-int s" cpu" set-chosen ;
> 
> 
> and then you can use   chosen-cpu-ihandle @   etc.?

I can do that but what is the exact benefit of doing it this way? It is
going to be used once really, and why would we need to cache both ihandle
and phandle but not reg (which we really care about here), for example?



-- 
Alexey


More information about the SLOF mailing list