]>
Commit | Line | Data |
---|---|---|
e433785a GH |
1 | /* |
2 | * QEMU USB EHCI Emulation | |
3 | * | |
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. | |
8 | * | |
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. | |
13 | * | |
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/>. | |
16 | */ | |
17 | ||
18 | #include "hw/usb/hcd-ehci.h" | |
e433785a GH |
19 | |
20 | static const VMStateDescription vmstate_ehci_sysbus = { | |
21 | .name = "ehci-sysbus", | |
22 | .version_id = 2, | |
23 | .minimum_version_id = 1, | |
24 | .fields = (VMStateField[]) { | |
25 | VMSTATE_STRUCT(ehci, EHCISysBusState, 2, vmstate_ehci, EHCIState), | |
26 | VMSTATE_END_OF_LIST() | |
27 | } | |
28 | }; | |
29 | ||
30 | static Property ehci_sysbus_properties[] = { | |
31 | DEFINE_PROP_UINT32("maxframes", EHCISysBusState, ehci.maxframes, 128), | |
32 | DEFINE_PROP_END_OF_LIST(), | |
33 | }; | |
34 | ||
35 | static int usb_ehci_sysbus_initfn(SysBusDevice *dev) | |
36 | { | |
5aa3ca9f | 37 | EHCISysBusState *i = SYS_BUS_EHCI(dev); |
e433785a GH |
38 | EHCIState *s = &i->ehci; |
39 | ||
40 | s->capsbase = 0x100; | |
41 | s->opregbase = 0x140; | |
2b29f492 | 42 | s->dma = &dma_context_memory; |
e433785a GH |
43 | |
44 | usb_ehci_initfn(s, DEVICE(dev)); | |
45 | sysbus_init_irq(dev, &s->irq); | |
46 | sysbus_init_mmio(dev, &s->mem); | |
47 | return 0; | |
48 | } | |
49 | ||
50 | static void ehci_sysbus_class_init(ObjectClass *klass, void *data) | |
51 | { | |
52 | DeviceClass *dc = DEVICE_CLASS(klass); | |
53 | SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); | |
54 | ||
55 | k->init = usb_ehci_sysbus_initfn; | |
56 | dc->vmsd = &vmstate_ehci_sysbus; | |
57 | dc->props = ehci_sysbus_properties; | |
58 | } | |
59 | ||
5aa3ca9f AF |
60 | static const TypeInfo ehci_type_info = { |
61 | .name = TYPE_SYS_BUS_EHCI, | |
e433785a GH |
62 | .parent = TYPE_SYS_BUS_DEVICE, |
63 | .instance_size = sizeof(EHCISysBusState), | |
5aa3ca9f | 64 | .abstract = true, |
e433785a GH |
65 | .class_init = ehci_sysbus_class_init, |
66 | }; | |
67 | ||
5aa3ca9f AF |
68 | static const TypeInfo ehci_xlnx_type_info = { |
69 | .name = "xlnx,ps7-usb", | |
70 | .parent = TYPE_SYS_BUS_EHCI, | |
71 | }; | |
72 | ||
e433785a GH |
73 | static void ehci_sysbus_register_types(void) |
74 | { | |
5aa3ca9f | 75 | type_register_static(&ehci_type_info); |
e433785a GH |
76 | type_register_static(&ehci_xlnx_type_info); |
77 | } | |
78 | ||
79 | type_init(ehci_sysbus_register_types) |