[SLOF] [PATCH slof 1/2] fdt: Factor out code to replace a phandle in place
Alexey Kardashevskiy
aik at ozlabs.ru
Tue May 29 18:06:07 AEST 2018
On 19/5/18 2:10 am, Thomas Huth wrote:
> On 14.05.2018 12:03, Alexey Kardashevskiy wrote:
>> We generate a fake XICS phandle in QEMU and SLOF replaces that phandle
>> with the real one (i.e. SLOF's node address) in interrupt-parent and
>> interrupt-map properties. These properties are handled differently -
>> the interrupt-map is fixed in place while interrupt-parent is
>> decoded+encoded+set as a property.
>>
>> This changes interrupt-parent fixing code to do what the interrupt-map
>> code does because soon we are going to have more phandles to fix and some
>> contain an array of phandles (such as "ibm,npu").
[snip]
>> +
>> \ Replace one phandle "old" with a phandle "new" in "node" and recursively
>> \ in its child nodes:
>> : fdt-replace-all-phandles ( old new node -- )
>> @@ -288,14 +305,8 @@ fdt-claim-reserve
>> ( old new prop-addr prop-len R: node )
>> fdt-replace-interrupt-map
>> THEN
>> - s" interrupt-parent" r@ get-property 0= IF
>> - ( old new prop-addr prop-len R: node )
>> - decode-int -rot 2drop ( old new val R: node )
>> - 2 pick = IF ( old new R: node )
>> - dup encode-int s" interrupt-parent" r@ set-property
>> - TRUE TO (fdt-phandle-replaced)
>> - THEN
>> - THEN
>> +
>> + 2dup s" interrupt-parent" r@ (fdt-replace-phandles)
>> \ ... add more properties that have to be fixed here ...
>> r>
>> \ Now recurse over all child nodes: ( old new node )
>
> Apart from the nits, this looks ok to me for small properties. But how
> do you make sure that you do not accidentally replace the wrong spot in
> bigger properties later?
btw when I tried updating the commit log, I realized that I do not
understand why we fix the "interrupt-parent" at all. Git points to
https://github.com/aik/SLOF/commit/82954d but that does not explain it
either, do you have any memories about that? :)
--
Alexey
More information about the SLOF
mailing list