On Tue, 3 Jun 2014, Alexander Graf wrote:
How about we leave the PCI magic be PCI magic and just provide a function that enables bus mastering?
- uint16_t cmd;
- cmd = pci_config_read16(addr, PCI_COMMAND);
- cmd |= PCI_COMMAND_BUS_MASTER;
Is this really the only bit that should be enabled? Who maps the BARs?
The existing code already takes care of configuring pci devices but did not set the bus master bit. (I also had to do the same for the network card for DMA to work correctly. This will be in a separate patch.)
Ok, I think this might fall apart on real hardware, but I doubt anyone really cares these days, so just setting BUS_MASTER works for me.
Sorry but I'm not sure I can follow what you mean. Why setting BUS_MASTER in PCI config would fail on real hardware? How and where could a function be provided that enables bus mastering? If there's a way to do it by the code that configures other parameters I'm fine with that but I don't know how that works and what part of that is in C and what is in Forth so I cannot provide such function. Or did you mean that after all it can be taken as it is now without further changes?
Regards, BALATON Zoltan