2 * USB xHCI controller emulation
4 * Copyright (c) 2011 Securiforest
5 * Date: 2011-05-11 ; Author: Hector Martin <hector@marcansoft.com>
6 * Based on usb-ohci.c, emulates Renesas NEC USB 3.0
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
22 #include "qemu/osdep.h"
24 #include "qemu/module.h"
25 #include "hw/pci/pci.h"
26 #include "hw/qdev-properties.h"
28 #include "hcd-xhci-pci.h"
30 typedef struct XHCINecState
{
32 XHCIPciState parent_obj
;
39 static Property nec_xhci_properties
[] = {
40 DEFINE_PROP_ON_OFF_AUTO("msi", XHCIPciState
, msi
, ON_OFF_AUTO_AUTO
),
41 DEFINE_PROP_ON_OFF_AUTO("msix", XHCIPciState
, msix
, ON_OFF_AUTO_AUTO
),
42 DEFINE_PROP_BIT("superspeed-ports-first", XHCINecState
, flags
,
43 XHCI_FLAG_SS_FIRST
, true),
44 DEFINE_PROP_BIT("force-pcie-endcap", XHCINecState
, flags
,
45 XHCI_FLAG_FORCE_PCIE_ENDCAP
, false),
46 DEFINE_PROP_UINT32("intrs", XHCINecState
, intrs
, XHCI_MAXINTRS
),
47 DEFINE_PROP_UINT32("slots", XHCINecState
, slots
, XHCI_MAXSLOTS
),
48 DEFINE_PROP_END_OF_LIST(),
51 static void nec_xhci_instance_init(Object
*obj
)
53 XHCIPciState
*pci
= XHCI_PCI(obj
);
54 XHCINecState
*nec
= container_of(pci
, XHCINecState
, parent_obj
);
56 pci
->xhci
.flags
= nec
->flags
;
57 pci
->xhci
.numintrs
= nec
->intrs
;
58 pci
->xhci
.numslots
= nec
->slots
;
61 static void nec_xhci_class_init(ObjectClass
*klass
, void *data
)
63 PCIDeviceClass
*k
= PCI_DEVICE_CLASS(klass
);
64 DeviceClass
*dc
= DEVICE_CLASS(klass
);
66 device_class_set_props(dc
, nec_xhci_properties
);
67 k
->vendor_id
= PCI_VENDOR_ID_NEC
;
68 k
->device_id
= PCI_DEVICE_ID_NEC_UPD720200
;
72 static const TypeInfo nec_xhci_info
= {
73 .name
= TYPE_NEC_XHCI
,
74 .parent
= TYPE_XHCI_PCI
,
75 .instance_size
= sizeof(XHCINecState
),
76 .instance_init
= nec_xhci_instance_init
,
77 .class_init
= nec_xhci_class_init
,
80 static void nec_xhci_register_types(void)
82 type_register_static(&nec_xhci_info
);
85 type_init(nec_xhci_register_types
)