[OpenBIOS] Adding new device in the middle of device-tree

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Thu Jul 13 20:53:56 CEST 2017


On 28/05/17 11:38, BALATON Zoltan wrote:

> 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:
> 
> https://mail.coreboot.org/pipermail/openbios/2017-January/009867.html
> 
> 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).

FWIW I've just been testing OpenBIOS git master ready for upstreaming to
QEMU and noticed the the recent changes to the PCI host bridge
properties have fixed PCI bus enumeration on FreeBSD PPC under -M mac99
(it still panics, but hey at least it finally sees a proper set of devices).

If you get a moment, can you try again with git master and report back
whether things have improved for you or not?


ATB,

Mark.



More information about the OpenBIOS mailing list