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

Segher Boessenkool segher at kernel.crashing.org
Mon Oct 16 20:07:02 AEDT 2017


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.?


Segher


More information about the SLOF mailing list