[OpenBIOS] [PATCH 3/5] pci: fix AAPL, address property for IO space mappings
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Sat Jan 2 21:44:18 CET 2016
According to "Designing PCI Cards and Drivers for Power Macintosh Computers" the
AAPL,address property should be an array of virtual addresses representing the
bus addresses in the assigned-addresses array.
While this works for PCI memory addresses, IO addresses are incorrect because
the calculated address is still the PCI bus address. Switch over to using the
new space-aware pci_bus_addr_to_host_addr() so that addresses in both memory
and IO space are correctly calculated.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
openbios-devel/drivers/pci.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c
index 97d3ef3..45e954b 100644
--- a/openbios-devel/drivers/pci.c
+++ b/openbios-devel/drivers/pci.c
@@ -594,13 +594,18 @@ static void pci_set_AAPL_address(const pci_config_t *config)
{
phandle_t dev = get_cur_dev();
cell props[7];
- int ncells, i;
+ uint32_t mask;
+ int ncells, i, flags, space_code;
ncells = 0;
for (i = 0; i < 6; i++) {
if (!config->assigned[i] || !config->sizes[i])
continue;
- props[ncells++] = config->assigned[i] & ~0x0000000F;
+ pci_decode_pci_addr(config->assigned[i],
+ &flags, &space_code, &mask);
+
+ props[ncells++] = pci_bus_addr_to_host_addr(space_code,
+ config->assigned[i] & ~mask);
}
if (ncells)
set_property(dev, "AAPL,address", (char *)props,
--
1.7.10.4
More information about the OpenBIOS
mailing list