[OpenBIOS] [PATCH 2/8] pci: include PCI bus id in ob_pci_decode_unit()

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sun Jun 11 12:00:31 CEST 2017


Instead of hard-coding the bus id to 0, grab the bus id from the first word
of the "bus-range" property. In particular this allows us to correctly
navigate the DT when trying to access a node with a unit id.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 drivers/pci.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci.c b/drivers/pci.c
index f8d18c4..2a59a75 100644
--- a/drivers/pci.c
+++ b/drivers/pci.c
@@ -181,7 +181,7 @@ ob_pci_decode_unit(int *idx)
 	ucell hi, mid, lo;
 	const char *arg = pop_fstr_copy();
 	int dev, fn, reg, ss, n, p, t;
-	int bus = 0;		/* no information */
+	int bus, len;
 	char *ptr;
 
 	PCI_DPRINTF("ob_pci_decode_unit idx=%p\n", idx);
@@ -273,6 +273,8 @@ ob_pci_decode_unit(int *idx)
 	}
 	free((char*)arg);
 
+	bus = get_int_property(get_cur_dev(), "bus-range", &len);
+
 	hi = n | p | t | (ss << 24) | (bus << 16) | (dev << 11) | (fn << 8) | reg;
 
 	PUSH(lo);
-- 
1.7.10.4




More information about the OpenBIOS mailing list