2 * QEMU USB EHCI Emulation
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or(at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 #include "hw/usb/hcd-ehci.h"
19 #include "hw/sysbus.h"
21 typedef struct EHCISysBusState
{
26 static const VMStateDescription vmstate_ehci_sysbus
= {
27 .name
= "ehci-sysbus",
29 .minimum_version_id
= 1,
30 .fields
= (VMStateField
[]) {
31 VMSTATE_STRUCT(ehci
, EHCISysBusState
, 2, vmstate_ehci
, EHCIState
),
36 static Property ehci_sysbus_properties
[] = {
37 DEFINE_PROP_UINT32("maxframes", EHCISysBusState
, ehci
.maxframes
, 128),
38 DEFINE_PROP_END_OF_LIST(),
41 static int usb_ehci_sysbus_initfn(SysBusDevice
*dev
)
43 EHCISysBusState
*i
= FROM_SYSBUS(EHCISysBusState
, dev
);
44 EHCIState
*s
= &i
->ehci
;
48 s
->dma
= &dma_context_memory
;
50 usb_ehci_initfn(s
, DEVICE(dev
));
51 sysbus_init_irq(dev
, &s
->irq
);
52 sysbus_init_mmio(dev
, &s
->mem
);
56 static void ehci_sysbus_class_init(ObjectClass
*klass
, void *data
)
58 DeviceClass
*dc
= DEVICE_CLASS(klass
);
59 SysBusDeviceClass
*k
= SYS_BUS_DEVICE_CLASS(klass
);
61 k
->init
= usb_ehci_sysbus_initfn
;
62 dc
->vmsd
= &vmstate_ehci_sysbus
;
63 dc
->props
= ehci_sysbus_properties
;
66 TypeInfo ehci_xlnx_type_info
= {
67 .name
= "xlnx,ps7-usb",
68 .parent
= TYPE_SYS_BUS_DEVICE
,
69 .instance_size
= sizeof(EHCISysBusState
),
70 .class_init
= ehci_sysbus_class_init
,
73 static void ehci_sysbus_register_types(void)
75 type_register_static(&ehci_xlnx_type_info
);
78 type_init(ehci_sysbus_register_types
)