[OpenBIOS] Adding new device in the middle of device-tree
balaton at eik.bme.hu
Sun May 28 12:38:47 CEST 2017
On Sat, 27 May 2017, Tarl Neustaedter wrote:
> On 2017-May-27 16:59 , BALATON Zoltan wrote:
>> Is there a way to add a new device in the middle of the device tree
>> (before or after an existing node) from Forth? If I try:
>> dev / new-device " newdev" device-name finish-device show-devs
>> /newdev appears at the end of the device-tree but that's not what I
>> want. I need this device to go at a specific place in the middle but I
>> could not find out how to achieve that. Any ideas?
> Nope. That's the way it generally works, the node is added at the
> beginning or end of a linked list for that level. You'd have to fiddle
> with private structures to change the order.
If there's a way to add it to the beginning instead of the end that may
work as well. How to do that? Or I was thinking about copying the exising
device tree one by one and insert the new device to the copy at the right
place, then replacing the device tree with the new one but I'm not sure
how to do that. Could you give some hints?
> But why do you care where it appears in the tree? You should always be
> finding the node by name and/or unit address, so it shouldn't matter
> what order things are in.
I'm trying to do this so I don't need the patch to OpenBIOS:
Unfortunately the code relying on this (which I can't change) seems to
have some assumptions about order of pci busses in the device tree and
only works if added before the exising entry (i.e. /pci at f0000000 has to
come before /pci at f2000000).
More information about the OpenBIOS