From 8a5d9dcfa14f82a0246958e0220a53a2618b53dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Wed, 23 Apr 2014 23:19:34 +0200 Subject: Correctly program BAR addresses of PCI devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note that offsets are PReP ones, so this breaks compatibility with hardware which has different values. Signed-off-by: Hervé Poussineau Signed-off-by: Andreas Färber --- src/pci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pci.c b/src/pci.c index 38aad27..d917370 100644 --- a/src/pci.c +++ b/src/pci.c @@ -1723,8 +1723,13 @@ static inline void pci_update_device (pci_bridge_t *bridge, addr = 0x30; /* PCI ROM */ else addr = 0x10 + (i * sizeof(uint32_t)); + if (device->regions[i] & 0x00000001) { pci_config_writel(bridge, device->bus, device->devfn, - addr, device->regions[i]); + addr, device->regions[i] - 0x80000000); + } else { + pci_config_writel(bridge, device->bus, device->devfn, + addr, device->regions[i] - 0xc0000000); + } } } } -- cgit v1.2.1