2013-03-18 05:06:52 +08:00
|
|
|
#
|
2014-02-12 17:39:32 +08:00
|
|
|
# Copyright 2010, 2013, 2014 Red Hat, Inc.
|
2013-03-18 05:06:52 +08:00
|
|
|
#
|
2018-04-04 21:35:41 +08:00
|
|
|
# This work is licensed under the GNU GPLv2 or later.
|
2018-03-21 03:00:02 +08:00
|
|
|
# See the COPYING file in the top-level directory.
|
2013-03-18 05:06:52 +08:00
|
|
|
|
2018-03-21 00:18:35 +08:00
|
|
|
from .device import Device
|
2018-03-21 00:27:37 +08:00
|
|
|
from ..xmlbuilder import XMLProperty
|
2013-03-18 05:06:52 +08:00
|
|
|
|
2013-04-14 02:34:52 +08:00
|
|
|
|
2018-03-21 00:18:35 +08:00
|
|
|
class DeviceController(Device):
|
2018-03-21 22:53:34 +08:00
|
|
|
XML_NAME = "controller"
|
2013-03-18 05:06:52 +08:00
|
|
|
|
2013-07-16 09:52:18 +08:00
|
|
|
TYPE_IDE = "ide"
|
|
|
|
TYPE_FDC = "fdc"
|
|
|
|
TYPE_SCSI = "scsi"
|
|
|
|
TYPE_SATA = "sata"
|
|
|
|
TYPE_VIRTIOSERIAL = "virtio-serial"
|
|
|
|
TYPE_USB = "usb"
|
|
|
|
TYPE_PCI = "pci"
|
|
|
|
TYPE_CCID = "ccid"
|
2019-03-21 04:24:41 +08:00
|
|
|
TYPE_XENBUS = "xenbus"
|
2018-09-07 04:05:12 +08:00
|
|
|
|
2013-07-18 05:58:24 +08:00
|
|
|
@staticmethod
|
|
|
|
def get_usb2_controllers(conn):
|
|
|
|
ret = []
|
2018-03-21 00:18:35 +08:00
|
|
|
ctrl = DeviceController(conn)
|
2013-07-18 05:58:24 +08:00
|
|
|
ctrl.type = "usb"
|
|
|
|
ctrl.model = "ich9-ehci1"
|
|
|
|
ret.append(ctrl)
|
|
|
|
|
2018-03-21 00:18:35 +08:00
|
|
|
ctrl = DeviceController(conn)
|
2013-07-18 05:58:24 +08:00
|
|
|
ctrl.type = "usb"
|
|
|
|
ctrl.model = "ich9-uhci1"
|
|
|
|
ctrl.master_startport = 0
|
|
|
|
ret.append(ctrl)
|
|
|
|
|
2018-03-21 00:18:35 +08:00
|
|
|
ctrl = DeviceController(conn)
|
2013-07-18 05:58:24 +08:00
|
|
|
ctrl.type = "usb"
|
|
|
|
ctrl.model = "ich9-uhci2"
|
|
|
|
ctrl.master_startport = 2
|
|
|
|
ret.append(ctrl)
|
|
|
|
|
2018-03-21 00:18:35 +08:00
|
|
|
ctrl = DeviceController(conn)
|
2013-07-18 05:58:24 +08:00
|
|
|
ctrl.type = "usb"
|
|
|
|
ctrl.model = "ich9-uhci3"
|
|
|
|
ctrl.master_startport = 4
|
|
|
|
ret.append(ctrl)
|
|
|
|
return ret
|
|
|
|
|
2017-06-29 03:35:07 +08:00
|
|
|
@staticmethod
|
2017-07-11 07:40:19 +08:00
|
|
|
def get_usb3_controller(conn, guest):
|
2018-10-04 06:53:16 +08:00
|
|
|
ignore = guest
|
2018-03-21 00:18:35 +08:00
|
|
|
ctrl = DeviceController(conn)
|
2017-06-29 03:35:07 +08:00
|
|
|
ctrl.type = "usb"
|
|
|
|
ctrl.model = "nec-xhci"
|
2019-06-08 04:06:52 +08:00
|
|
|
if conn.support.conn_qemu_xhci():
|
2017-07-11 07:40:19 +08:00
|
|
|
ctrl.model = "qemu-xhci"
|
2019-06-08 04:06:52 +08:00
|
|
|
if conn.support.conn_usb3_ports():
|
2018-10-04 23:55:57 +08:00
|
|
|
# 15 is the max ports qemu supports, might as well
|
|
|
|
# Add as many as possible
|
|
|
|
ctrl.ports = 15
|
2017-06-29 03:35:07 +08:00
|
|
|
return ctrl
|
|
|
|
|
2013-07-18 05:58:24 +08:00
|
|
|
|
2019-05-12 20:54:36 +08:00
|
|
|
_XML_PROP_ORDER = ["type", "index", "model", "master_startport",
|
|
|
|
"driver_queues", "maxGrantFrames"]
|
2013-03-18 05:06:52 +08:00
|
|
|
|
2013-09-20 01:27:30 +08:00
|
|
|
type = XMLProperty("./@type")
|
|
|
|
model = XMLProperty("./@model")
|
|
|
|
vectors = XMLProperty("./@vectors", is_int=True)
|
|
|
|
ports = XMLProperty("./@ports", is_int=True)
|
2019-03-21 04:24:41 +08:00
|
|
|
maxGrantFrames = XMLProperty("./@maxGrantFrames", is_int=True)
|
2018-09-02 10:01:14 +08:00
|
|
|
index = XMLProperty("./@index", is_int=True)
|
2013-07-24 20:46:55 +08:00
|
|
|
|
2019-08-29 01:17:32 +08:00
|
|
|
driver_iothread = XMLProperty("./driver/@iothread", is_int=True)
|
|
|
|
driver_queues = XMLProperty("./driver/@queues", is_int=True)
|
|
|
|
|
|
|
|
master_startport = XMLProperty("./master/@startport", is_int=True)
|