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

BALATON Zoltan balaton at eik.bme.hu
Thu Jun 26 12:55:48 CEST 2014


On Thu, 26 Jun 2014, Alexander Graf wrote:
> On 26.06.14 00:36, BALATON Zoltan wrote:
>> On Thu, 26 Jun 2014, Alexander Graf wrote:
>>> On 01.06.14 23:55, BALATON Zoltan wrote:
>>>> This driver is ported from CoreBoot's libpayload and fixed to work on
>>>> big endian CPUs (tested on PPC with QEMU). It is enough to support a
>>>> USB keyboard on an Apple Keylargo OHCI compliant USB host and makes
>>>> OpenBIOS usable on qemu-system-ppc64 with mac99 machine type as well
>>>> as allows to emulate PowerMac3,1 better.
>>>> 
>>>> Signed-off-by: BALATON Zoltan <balaton at eik.bme.hu>
>>>> Acked-by: Alexander Graf <agraf at suse.de>
>>>> ---
>>>> 
>>>> v2: improve init and teardown by moving pci configuration to the driver
>>>>      and giving up using the controller on quiesce interface call also
>>>>      resetting it to avoid runaway DMA until the OS driver takes over
>>>> v3: Only enable bus master bit in PCI config for QEMU
>>>> ---
>>> 
>>> [...]
>>> 
>>>> +hci_t *
>>>> +ohci_pci_init (pci_addr addr)
>>>> +{
>>>> +    u32 reg_base;
>>>> +#if defined(CONFIG_QEMU)
>>>> +    uint16_t cmd;
>>>> +
>>>> +    cmd = pci_config_read16(addr, PCI_COMMAND);
>>>> +    cmd |= PCI_COMMAND_BUS_MASTER;
>>>> +    pci_config_write16(addr, PCI_COMMAND, cmd);
>>>> +#endif
>>> 
>>> I don't think the driver will work without bus mastering.
>> 
>> So then apply the first version without this #if.
>> 
>>> Just don't match on it on non-QEMU machines and add a comment why you 
>>> don't.
>> 
>> Why not? Coreboot is supposed to work on real hardware too.
>
> No, it won't because it won't have bus mastering enabled. Do you want to be 
> the guy trying to debug why OHCI support doesn't only to find out that it's 
> because bus mastering isn't on?

I'm afraid I'll be the one to debug it if it breaks anyway... If it needs 
bus mastering everywhere then apply v2 without special casing QEMU. (You 
asked to put ifdefs around enabling bus mastering.) What I don't see is 
why should we special case this driver for QEMU if

1. It's supposed to works on real hardware too as it is used in CoreBoot
    in such situations
2. I'm not aware of any usage of OpenBIOS on anything else than QEMU

So restricting this driver for QEMU seems an unnecessary complication.
What am I missing?

Regards,
BALATON Zoltan



More information about the OpenBIOS mailing list