[OpenBIOS] [PATCH] Add USB OHCI + HID driver

Alexander Graf agraf at suse.de
Tue Jun 3 17:43:43 CEST 2014


On 06/03/2014 01:26 AM, BALATON Zoltan wrote:
> 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?

See Segher's reply :). Bus mastering is non-trivial on real hardware, 
especially when you're firmware.

> 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.


Alex




More information about the OpenBIOS mailing list