qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v1 5/8] xilinx_zynq: add USB controllers


From: Peter Crosthwaite
Subject: Re: [Qemu-devel] [PATCH v1 5/8] xilinx_zynq: add USB controllers
Date: Fri, 26 Oct 2012 16:59:02 +1000

Next version up on list, Ive changed the approach a bit.

On Fri, Oct 26, 2012 at 4:49 PM, Gerd Hoffmann <address@hidden> wrote:
>   Hi,
>
>>> @@ -1312,29 +1320,24 @@ static TypeInfo piix3_uhci_info = {
>>>      .name          = "piix3-usb-uhci",
>>>      .parent        = TYPE_PCI_DEVICE,
>>>      .instance_size = sizeof(UHCIState),
>>> -    .class_init    = piix3_uhci_class_init,
>>> +    .class_init    = uhci_class_init,
>>
>> Therese three elements (parent, instance_size, class_init) are
>> repeated from one definition to the next. This will get tedious when
>> we eventually come to make the same fix for some of the other devices
>> that have large numbers of variants (pflash_cfi0x and m25p80 being
>> some of the angrier ones).
>
> I think we can also create TypeInfo at runtime (uhci_register_types in
> the uhci case).
Im comming I think this approach is ok for a small number of variants,
but for the large ones creating type_infos dynamically may be the way
to go.

> We'll just have to stick the name into UHCIInfo, build
> a static uhciinfo array, then generate & register TypeInfo from that.
>
Instead of create a new struct definition (e.g. UHCIInfo), I just used
the parent class definition (you would use PCIDeviceClass in the UHCI
case). EHCI was a little more complex cos of the multiple parents, but
UHCI you should just be able to pass a partially populated
PCIDeviceClass to class_data that class_init can pick fields out of.

> cheers,
>   Gerd
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]