xref: /openbmc/qemu/hw/usb/hcd-xhci-nec.c (revision ba632924)
1 /*
2  * USB xHCI controller emulation
3  *
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
7  *
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 of the License, or (at your option) any later version.
12  *
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.
17  *
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/>.
20  */
21 
22 #include "qemu/osdep.h"
23 #include "hw/hw.h"
24 #include "hw/usb.h"
25 #include "hw/pci/pci.h"
26 
27 #include "hcd-xhci.h"
28 
29 static Property nec_xhci_properties[] = {
30     DEFINE_PROP_ON_OFF_AUTO("msi", XHCIState, msi, ON_OFF_AUTO_AUTO),
31     DEFINE_PROP_ON_OFF_AUTO("msix", XHCIState, msix, ON_OFF_AUTO_AUTO),
32     DEFINE_PROP_BIT("superspeed-ports-first",
33                     XHCIState, flags, XHCI_FLAG_SS_FIRST, true),
34     DEFINE_PROP_BIT("force-pcie-endcap", XHCIState, flags,
35                     XHCI_FLAG_FORCE_PCIE_ENDCAP, false),
36     DEFINE_PROP_UINT32("intrs", XHCIState, numintrs, MAXINTRS),
37     DEFINE_PROP_UINT32("slots", XHCIState, numslots, MAXSLOTS),
38     DEFINE_PROP_END_OF_LIST(),
39 };
40 
41 static void nec_xhci_class_init(ObjectClass *klass, void *data)
42 {
43     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
44     DeviceClass *dc = DEVICE_CLASS(klass);
45 
46     dc->props       = nec_xhci_properties;
47     k->vendor_id    = PCI_VENDOR_ID_NEC;
48     k->device_id    = PCI_DEVICE_ID_NEC_UPD720200;
49     k->revision     = 0x03;
50 }
51 
52 static const TypeInfo nec_xhci_info = {
53     .name          = TYPE_NEC_XHCI,
54     .parent        = TYPE_XHCI,
55     .class_init    = nec_xhci_class_init,
56 };
57 
58 static void nec_xhci_register_types(void)
59 {
60     type_register_static(&nec_xhci_info);
61 }
62 
63 type_init(nec_xhci_register_types)
64