[OpenBIOS] [PATCH 3/4] arch/ppc/qemu: Add a node for the other (empty) PCI bus to the device tree

BALATON Zoltan balaton at eik.bme.hu
Sun Nov 20 19:04:45 CET 2016


QEMU emulates two of the three PCI buses found on real hardware because
some clients seem to need both and fail with only one present, but
OpenBIOS only handles a single PCI bus and initialises and puts in the
device tree only one of these: the second one which is where devices are
connected and also marks it bus 0. However, clients getting info from the
device tree may not know about this and thinking there is only one PCI
bus they erroneously use the address of the first bus to access PCI
config registers for devices on the second bus which silently fails as
these requests will go to the other empty bus emulated and return invalid
values. Devices mapped via MMIO still appear to work but they may not be
correctly initialised and some cards are not detected because of this.

Until support for multiple PCI buses is implemented add an empty node in
the device tree for the uninitialised bus to let clients know about it.
This is still not entirely correct as bus-range property does not match
real hardware but this fixes detecting PCI devices (such as USB) under
MorphOS and may also fix enabling the bus master bit needed with some
network cards and allow the workarund for this to be reverted.

Signed-off-by: BALATON Zoltan <balaton at eik.bme.hu>
---
 arch/ppc/qemu/tree.fs | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/ppc/qemu/tree.fs b/arch/ppc/qemu/tree.fs
index 5b6bbc6..e1708de 100644
--- a/arch/ppc/qemu/tree.fs
+++ b/arch/ppc/qemu/tree.fs
@@ -50,6 +50,18 @@ new-device
 	h# ff800000 encode-int encode+ " ranges" property
 finish-device
 
+\ Add empty node for first pci bus
+\ Remove this when pci driver is fixed to handle multiple buses
+new-device
+	" pci" device-name
+	" pci" device-type
+	h# f0000000 encode-int 02000000 encode-int encode+ " reg" property
+	3 encode-int " #address-cells" property
+	2 encode-int " #size-cells" property
+	1 encode-int " #interrupt-cells" property
+	0 encode-int 0 encode-int encode+ " bus-range" property
+finish-device
+
 \ -------------------------------------------------------------
 \ /packages
 \ -------------------------------------------------------------
-- 
2.7.4




More information about the OpenBIOS mailing list