diff mbox

[v2,1/2] ohw: correctly program BAR addresses of PCI devices

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

Commit Message

Hervé Poussineau April 23, 2014, 9:19 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>
---

Indentation may look strange, but I tried to stay consistent with other parts of the file.

 src/pci.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Alexander Graf May 27, 2014, 11:22 p.m. UTC | #1
On 23.04.14 23:19, Hervé Poussineau wrote:
> Note that offsets are PReP ones, so this breaks compatibility with hardware which has different values.

So that means that this patch breaks non-PReP? I don't think we want 
that ;).


Alex
Andreas Färber May 27, 2014, 11:28 p.m. UTC | #2
Am 28.05.2014 01:22, schrieb Alexander Graf:
> 
> On 23.04.14 23:19, Hervé Poussineau wrote:
>> Note that offsets are PReP ones, so this breaks compatibility with
>> hardware which has different values.
> 
> So that means that this patch breaks non-PReP? I don't think we want
> that ;).

Please note that these patches are for OHW, and -M prep is the only
machine to still use OHW these days, with the QEMU counterparts touching
only PReP AFAICS, so I see no reason not to fix OHW - would you rather
guard that with some #ifdef to make it clearer?

I'm not sure about the correctness of these patches, so I'm dependent on
review and - more likely - need to finally carve some time for simply
testing whether they break anything and, if not, apply them.

Andreas
Mark Cave-Ayland May 28, 2014, 8:01 a.m. UTC | #3
On 28/05/14 00:28, Andreas Färber wrote:

> Am 28.05.2014 01:22, schrieb Alexander Graf:
>>
>> On 23.04.14 23:19, Hervé Poussineau wrote:
>>> Note that offsets are PReP ones, so this breaks compatibility with
>>> hardware which has different values.
>>
>> So that means that this patch breaks non-PReP? I don't think we want
>> that ;).
>
> Please note that these patches are for OHW, and -M prep is the only
> machine to still use OHW these days, with the QEMU counterparts touching
> only PReP AFAICS, so I see no reason not to fix OHW - would you rather
> guard that with some #ifdef to make it clearer?
>
> I'm not sure about the correctness of these patches, so I'm dependent on
> review and - more likely - need to finally carve some time for simply
> testing whether they break anything and, if not, apply them.

Given that Hervé has actually managed to boot real OSs with these 
patches, I'd be inclined to accept them.

Andreas, I remember asking before but can't remember if I got an answer 
or not as to what is in your PReP test image suite? If we can get the 
same images, then we can help you with testing :)


ATB,

Mark.
diff mbox

Patch

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);
+            }
         }
     }
 }