On Tue, Jun 03, 2014 at 06:55:44PM +0200, BALATON Zoltan wrote:
On Tue, 3 Jun 2014, Alexander Graf wrote:
Sorry but I'm not sure I can follow what you mean. Why setting BUS_MASTER in PCI config would fail on real hardware?
See Segher's reply :). Bus mastering is non-trivial on real hardware, especially when you're firmware.
OK, I cannot test that but I doubt it's working already due to the lack of PCI bridge support.
There surely is support for a host bridge?
How and where could a function be provided that enables bus mastering?
Add pci details should just remain in pci.c. Export a function to enable bus mastering inside there and we should be safe from an abstraction level pov.
The code setting the bus master bit we are talking about _is_ in drivers/pci.c already. Do you want me to move it to it's own function and use that for both pci-ohci and rtl8139? (It's just three lines though and the same pattern is used for setting other bits elswhere so this could be done as a clean up afterwards maybe as a macro.)
I agree that the code that decides when to enable bus mastering should be in the device driver.
I'm still not sure what changes are needed if any.
It would be nice to test this on real hardware. If no one has that, just try to make sure your new code will not fail on hardware where the old code worked (like, don't run any "dangerous" code unless your device is detected).
Segher