qemu/hw/usb/hcd-xhci-nec.c
<<
>>
Prefs
   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 "qemu/module.h"
  26#include "hw/pci/pci.h"
  27
  28#include "hcd-xhci.h"
  29
  30static Property nec_xhci_properties[] = {
  31    DEFINE_PROP_ON_OFF_AUTO("msi", XHCIState, msi, ON_OFF_AUTO_AUTO),
  32    DEFINE_PROP_ON_OFF_AUTO("msix", XHCIState, msix, ON_OFF_AUTO_AUTO),
  33    DEFINE_PROP_BIT("superspeed-ports-first",
  34                    XHCIState, flags, XHCI_FLAG_SS_FIRST, true),
  35    DEFINE_PROP_BIT("force-pcie-endcap", XHCIState, flags,
  36                    XHCI_FLAG_FORCE_PCIE_ENDCAP, false),
  37    DEFINE_PROP_UINT32("intrs", XHCIState, numintrs, MAXINTRS),
  38    DEFINE_PROP_UINT32("slots", XHCIState, numslots, MAXSLOTS),
  39    DEFINE_PROP_END_OF_LIST(),
  40};
  41
  42static void nec_xhci_class_init(ObjectClass *klass, void *data)
  43{
  44    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
  45    DeviceClass *dc = DEVICE_CLASS(klass);
  46
  47    dc->props       = nec_xhci_properties;
  48    k->vendor_id    = PCI_VENDOR_ID_NEC;
  49    k->device_id    = PCI_DEVICE_ID_NEC_UPD720200;
  50    k->revision     = 0x03;
  51}
  52
  53static const TypeInfo nec_xhci_info = {
  54    .name          = TYPE_NEC_XHCI,
  55    .parent        = TYPE_XHCI,
  56    .class_init    = nec_xhci_class_init,
  57};
  58
  59static void nec_xhci_register_types(void)
  60{
  61    type_register_static(&nec_xhci_info);
  62}
  63
  64type_init(nec_xhci_register_types)
  65