diff mbox

[for-2.0,1/2] ohw: correctly program BAR addresses of PCI devices

Message ID 1396387092-5667-2-git-send-email-hpoussin@reactos.org
State New
Headers show

Commit Message

Hervé Poussineau April 1, 2014, 9:18 p.m. UTC
Note that offsets are PReP ones, so this breaks compatibility with hardware which has different values.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 src/pci.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/src/pci.c b/src/pci.c
index 38aad27..7c0ebad 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));
-            pci_config_writel(bridge, device->bus, device->devfn,
-                              addr, device->regions[i]);
+            if (device->regions[i] & 0x00000001) {
+                pci_config_writel(bridge, device->bus, device->devfn,
+                                  addr, device->regions[i] - 0x80000000);
+            } else {
+                pci_config_writel(bridge, device->bus, device->devfn,
+                                  addr, device->regions[i] - 0xc0000000);
+            }
         }
     }
 }