2012-10-30 15:20:06 +04:00
|
|
|
/*
|
|
|
|
* QEMU USB EHCI Emulation
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2019-01-23 17:40:54 +03:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2012-10-30 15:20:06 +04:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
2019-01-23 17:40:54 +03:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
2012-10-30 15:20:06 +04:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2016-06-29 11:12:57 +03:00
|
|
|
|
|
|
|
#ifndef HW_USB_HCD_EHCI_H
|
|
|
|
#define HW_USB_HCD_EHCI_H
|
2012-10-30 15:20:06 +04:00
|
|
|
|
2012-12-17 21:20:00 +04:00
|
|
|
#include "qemu/timer.h"
|
2012-10-30 15:20:06 +04:00
|
|
|
#include "hw/usb.h"
|
2012-12-17 21:20:04 +04:00
|
|
|
#include "sysemu/dma.h"
|
2012-12-16 07:49:43 +04:00
|
|
|
#include "hw/pci/pci.h"
|
|
|
|
#include "hw/sysbus.h"
|
2020-09-03 23:43:22 +03:00
|
|
|
#include "qom/object.h"
|
2012-10-30 15:20:06 +04:00
|
|
|
|
|
|
|
#ifndef EHCI_DEBUG
|
|
|
|
#define EHCI_DEBUG 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if EHCI_DEBUG
|
|
|
|
#define DPRINTF printf
|
|
|
|
#else
|
|
|
|
#define DPRINTF(...)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define MMIO_SIZE 0x1000
|
|
|
|
#define CAPA_SIZE 0x10
|
|
|
|
|
2013-06-06 17:41:12 +04:00
|
|
|
#define NB_PORTS 6 /* Max. Number of downstream ports */
|
2012-10-30 15:20:06 +04:00
|
|
|
|
|
|
|
typedef struct EHCIPacket EHCIPacket;
|
|
|
|
typedef struct EHCIQueue EHCIQueue;
|
|
|
|
typedef struct EHCIState EHCIState;
|
|
|
|
|
|
|
|
/* EHCI spec version 1.0 Section 3.3
|
|
|
|
*/
|
|
|
|
typedef struct EHCIitd {
|
|
|
|
uint32_t next;
|
|
|
|
|
|
|
|
uint32_t transact[8];
|
|
|
|
#define ITD_XACT_ACTIVE (1 << 31)
|
|
|
|
#define ITD_XACT_DBERROR (1 << 30)
|
|
|
|
#define ITD_XACT_BABBLE (1 << 29)
|
|
|
|
#define ITD_XACT_XACTERR (1 << 28)
|
|
|
|
#define ITD_XACT_LENGTH_MASK 0x0fff0000
|
|
|
|
#define ITD_XACT_LENGTH_SH 16
|
|
|
|
#define ITD_XACT_IOC (1 << 15)
|
|
|
|
#define ITD_XACT_PGSEL_MASK 0x00007000
|
|
|
|
#define ITD_XACT_PGSEL_SH 12
|
|
|
|
#define ITD_XACT_OFFSET_MASK 0x00000fff
|
|
|
|
|
|
|
|
uint32_t bufptr[7];
|
|
|
|
#define ITD_BUFPTR_MASK 0xfffff000
|
|
|
|
#define ITD_BUFPTR_SH 12
|
|
|
|
#define ITD_BUFPTR_EP_MASK 0x00000f00
|
|
|
|
#define ITD_BUFPTR_EP_SH 8
|
|
|
|
#define ITD_BUFPTR_DEVADDR_MASK 0x0000007f
|
|
|
|
#define ITD_BUFPTR_DEVADDR_SH 0
|
|
|
|
#define ITD_BUFPTR_DIRECTION (1 << 11)
|
|
|
|
#define ITD_BUFPTR_MAXPKT_MASK 0x000007ff
|
|
|
|
#define ITD_BUFPTR_MAXPKT_SH 0
|
|
|
|
#define ITD_BUFPTR_MULT_MASK 0x00000003
|
|
|
|
#define ITD_BUFPTR_MULT_SH 0
|
|
|
|
} EHCIitd;
|
|
|
|
|
|
|
|
/* EHCI spec version 1.0 Section 3.4
|
|
|
|
*/
|
|
|
|
typedef struct EHCIsitd {
|
|
|
|
uint32_t next; /* Standard next link pointer */
|
|
|
|
uint32_t epchar;
|
|
|
|
#define SITD_EPCHAR_IO (1 << 31)
|
|
|
|
#define SITD_EPCHAR_PORTNUM_MASK 0x7f000000
|
|
|
|
#define SITD_EPCHAR_PORTNUM_SH 24
|
|
|
|
#define SITD_EPCHAR_HUBADD_MASK 0x007f0000
|
|
|
|
#define SITD_EPCHAR_HUBADDR_SH 16
|
|
|
|
#define SITD_EPCHAR_EPNUM_MASK 0x00000f00
|
|
|
|
#define SITD_EPCHAR_EPNUM_SH 8
|
|
|
|
#define SITD_EPCHAR_DEVADDR_MASK 0x0000007f
|
|
|
|
|
|
|
|
uint32_t uframe;
|
|
|
|
#define SITD_UFRAME_CMASK_MASK 0x0000ff00
|
|
|
|
#define SITD_UFRAME_CMASK_SH 8
|
|
|
|
#define SITD_UFRAME_SMASK_MASK 0x000000ff
|
|
|
|
|
|
|
|
uint32_t results;
|
|
|
|
#define SITD_RESULTS_IOC (1 << 31)
|
|
|
|
#define SITD_RESULTS_PGSEL (1 << 30)
|
|
|
|
#define SITD_RESULTS_TBYTES_MASK 0x03ff0000
|
|
|
|
#define SITD_RESULTS_TYBYTES_SH 16
|
|
|
|
#define SITD_RESULTS_CPROGMASK_MASK 0x0000ff00
|
|
|
|
#define SITD_RESULTS_CPROGMASK_SH 8
|
|
|
|
#define SITD_RESULTS_ACTIVE (1 << 7)
|
|
|
|
#define SITD_RESULTS_ERR (1 << 6)
|
|
|
|
#define SITD_RESULTS_DBERR (1 << 5)
|
|
|
|
#define SITD_RESULTS_BABBLE (1 << 4)
|
|
|
|
#define SITD_RESULTS_XACTERR (1 << 3)
|
|
|
|
#define SITD_RESULTS_MISSEDUF (1 << 2)
|
|
|
|
#define SITD_RESULTS_SPLITXSTATE (1 << 1)
|
|
|
|
|
|
|
|
uint32_t bufptr[2];
|
|
|
|
#define SITD_BUFPTR_MASK 0xfffff000
|
|
|
|
#define SITD_BUFPTR_CURROFF_MASK 0x00000fff
|
|
|
|
#define SITD_BUFPTR_TPOS_MASK 0x00000018
|
|
|
|
#define SITD_BUFPTR_TPOS_SH 3
|
|
|
|
#define SITD_BUFPTR_TCNT_MASK 0x00000007
|
|
|
|
|
|
|
|
uint32_t backptr; /* Standard next link pointer */
|
|
|
|
} EHCIsitd;
|
|
|
|
|
|
|
|
/* EHCI spec version 1.0 Section 3.5
|
|
|
|
*/
|
|
|
|
typedef struct EHCIqtd {
|
|
|
|
uint32_t next; /* Standard next link pointer */
|
|
|
|
uint32_t altnext; /* Standard next link pointer */
|
|
|
|
uint32_t token;
|
|
|
|
#define QTD_TOKEN_DTOGGLE (1 << 31)
|
|
|
|
#define QTD_TOKEN_TBYTES_MASK 0x7fff0000
|
|
|
|
#define QTD_TOKEN_TBYTES_SH 16
|
|
|
|
#define QTD_TOKEN_IOC (1 << 15)
|
|
|
|
#define QTD_TOKEN_CPAGE_MASK 0x00007000
|
|
|
|
#define QTD_TOKEN_CPAGE_SH 12
|
|
|
|
#define QTD_TOKEN_CERR_MASK 0x00000c00
|
|
|
|
#define QTD_TOKEN_CERR_SH 10
|
|
|
|
#define QTD_TOKEN_PID_MASK 0x00000300
|
|
|
|
#define QTD_TOKEN_PID_SH 8
|
|
|
|
#define QTD_TOKEN_ACTIVE (1 << 7)
|
|
|
|
#define QTD_TOKEN_HALT (1 << 6)
|
|
|
|
#define QTD_TOKEN_DBERR (1 << 5)
|
|
|
|
#define QTD_TOKEN_BABBLE (1 << 4)
|
|
|
|
#define QTD_TOKEN_XACTERR (1 << 3)
|
|
|
|
#define QTD_TOKEN_MISSEDUF (1 << 2)
|
|
|
|
#define QTD_TOKEN_SPLITXSTATE (1 << 1)
|
|
|
|
#define QTD_TOKEN_PING (1 << 0)
|
|
|
|
|
|
|
|
uint32_t bufptr[5]; /* Standard buffer pointer */
|
|
|
|
#define QTD_BUFPTR_MASK 0xfffff000
|
|
|
|
#define QTD_BUFPTR_SH 12
|
|
|
|
} EHCIqtd;
|
|
|
|
|
|
|
|
/* EHCI spec version 1.0 Section 3.6
|
|
|
|
*/
|
|
|
|
typedef struct EHCIqh {
|
|
|
|
uint32_t next; /* Standard next link pointer */
|
|
|
|
|
|
|
|
/* endpoint characteristics */
|
|
|
|
uint32_t epchar;
|
|
|
|
#define QH_EPCHAR_RL_MASK 0xf0000000
|
|
|
|
#define QH_EPCHAR_RL_SH 28
|
|
|
|
#define QH_EPCHAR_C (1 << 27)
|
|
|
|
#define QH_EPCHAR_MPLEN_MASK 0x07FF0000
|
|
|
|
#define QH_EPCHAR_MPLEN_SH 16
|
|
|
|
#define QH_EPCHAR_H (1 << 15)
|
|
|
|
#define QH_EPCHAR_DTC (1 << 14)
|
|
|
|
#define QH_EPCHAR_EPS_MASK 0x00003000
|
|
|
|
#define QH_EPCHAR_EPS_SH 12
|
|
|
|
#define EHCI_QH_EPS_FULL 0
|
|
|
|
#define EHCI_QH_EPS_LOW 1
|
|
|
|
#define EHCI_QH_EPS_HIGH 2
|
|
|
|
#define EHCI_QH_EPS_RESERVED 3
|
|
|
|
|
|
|
|
#define QH_EPCHAR_EP_MASK 0x00000f00
|
|
|
|
#define QH_EPCHAR_EP_SH 8
|
|
|
|
#define QH_EPCHAR_I (1 << 7)
|
|
|
|
#define QH_EPCHAR_DEVADDR_MASK 0x0000007f
|
|
|
|
#define QH_EPCHAR_DEVADDR_SH 0
|
|
|
|
|
|
|
|
/* endpoint capabilities */
|
|
|
|
uint32_t epcap;
|
|
|
|
#define QH_EPCAP_MULT_MASK 0xc0000000
|
|
|
|
#define QH_EPCAP_MULT_SH 30
|
|
|
|
#define QH_EPCAP_PORTNUM_MASK 0x3f800000
|
|
|
|
#define QH_EPCAP_PORTNUM_SH 23
|
|
|
|
#define QH_EPCAP_HUBADDR_MASK 0x007f0000
|
|
|
|
#define QH_EPCAP_HUBADDR_SH 16
|
|
|
|
#define QH_EPCAP_CMASK_MASK 0x0000ff00
|
|
|
|
#define QH_EPCAP_CMASK_SH 8
|
|
|
|
#define QH_EPCAP_SMASK_MASK 0x000000ff
|
|
|
|
#define QH_EPCAP_SMASK_SH 0
|
|
|
|
|
|
|
|
uint32_t current_qtd; /* Standard next link pointer */
|
|
|
|
uint32_t next_qtd; /* Standard next link pointer */
|
|
|
|
uint32_t altnext_qtd;
|
|
|
|
#define QH_ALTNEXT_NAKCNT_MASK 0x0000001e
|
|
|
|
#define QH_ALTNEXT_NAKCNT_SH 1
|
|
|
|
|
|
|
|
uint32_t token; /* Same as QTD token */
|
|
|
|
uint32_t bufptr[5]; /* Standard buffer pointer */
|
|
|
|
#define BUFPTR_CPROGMASK_MASK 0x000000ff
|
|
|
|
#define BUFPTR_FRAMETAG_MASK 0x0000001f
|
|
|
|
#define BUFPTR_SBYTES_MASK 0x00000fe0
|
|
|
|
#define BUFPTR_SBYTES_SH 5
|
|
|
|
} EHCIqh;
|
|
|
|
|
|
|
|
/* EHCI spec version 1.0 Section 3.7
|
|
|
|
*/
|
|
|
|
typedef struct EHCIfstn {
|
|
|
|
uint32_t next; /* Standard next link pointer */
|
|
|
|
uint32_t backptr; /* Standard next link pointer */
|
|
|
|
} EHCIfstn;
|
|
|
|
|
|
|
|
enum async_state {
|
|
|
|
EHCI_ASYNC_NONE = 0,
|
|
|
|
EHCI_ASYNC_INITIALIZED,
|
|
|
|
EHCI_ASYNC_INFLIGHT,
|
|
|
|
EHCI_ASYNC_FINISHED,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct EHCIPacket {
|
|
|
|
EHCIQueue *queue;
|
|
|
|
QTAILQ_ENTRY(EHCIPacket) next;
|
|
|
|
|
|
|
|
EHCIqtd qtd; /* copy of current QTD (being worked on) */
|
|
|
|
uint32_t qtdaddr; /* address QTD read from */
|
|
|
|
|
|
|
|
USBPacket packet;
|
|
|
|
QEMUSGList sgl;
|
|
|
|
int pid;
|
|
|
|
enum async_state async;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct EHCIQueue {
|
|
|
|
EHCIState *ehci;
|
|
|
|
QTAILQ_ENTRY(EHCIQueue) next;
|
|
|
|
uint32_t seen;
|
|
|
|
uint64_t ts;
|
|
|
|
int async;
|
|
|
|
int transact_ctr;
|
|
|
|
|
|
|
|
/* cached data from guest - needs to be flushed
|
|
|
|
* when guest removes an entry (doorbell, handshake sequence)
|
|
|
|
*/
|
|
|
|
EHCIqh qh; /* copy of current QH (being worked on) */
|
|
|
|
uint32_t qhaddr; /* address QH read from */
|
|
|
|
uint32_t qtdaddr; /* address QTD read from */
|
2012-12-14 17:35:29 +04:00
|
|
|
int last_pid; /* pid of last packet executed */
|
2012-10-30 15:20:06 +04:00
|
|
|
USBDevice *dev;
|
2018-12-06 15:10:34 +03:00
|
|
|
QTAILQ_HEAD(, EHCIPacket) packets;
|
2012-10-30 15:20:06 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef QTAILQ_HEAD(EHCIQueueHead, EHCIQueue) EHCIQueueHead;
|
|
|
|
|
|
|
|
struct EHCIState {
|
|
|
|
USBBus bus;
|
2013-09-09 12:18:17 +04:00
|
|
|
DeviceState *device;
|
2012-10-30 15:20:06 +04:00
|
|
|
qemu_irq irq;
|
|
|
|
MemoryRegion mem;
|
2013-04-10 20:15:49 +04:00
|
|
|
AddressSpace *as;
|
2012-10-30 15:20:06 +04:00
|
|
|
MemoryRegion mem_caps;
|
|
|
|
MemoryRegion mem_opreg;
|
|
|
|
MemoryRegion mem_ports;
|
|
|
|
int companion_count;
|
2014-08-29 16:40:08 +04:00
|
|
|
bool companion_enable;
|
2012-10-30 15:20:06 +04:00
|
|
|
uint16_t capsbase;
|
|
|
|
uint16_t opregbase;
|
2013-06-06 17:41:12 +04:00
|
|
|
uint16_t portscbase;
|
|
|
|
uint16_t portnr;
|
2012-10-30 15:20:06 +04:00
|
|
|
|
|
|
|
/* properties */
|
|
|
|
uint32_t maxframes;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* EHCI spec version 1.0 Section 2.3
|
|
|
|
* Host Controller Operational Registers
|
|
|
|
*/
|
|
|
|
uint8_t caps[CAPA_SIZE];
|
|
|
|
union {
|
2013-06-06 17:41:12 +04:00
|
|
|
uint32_t opreg[0x44/sizeof(uint32_t)];
|
2012-10-30 15:20:06 +04:00
|
|
|
struct {
|
|
|
|
uint32_t usbcmd;
|
|
|
|
uint32_t usbsts;
|
|
|
|
uint32_t usbintr;
|
|
|
|
uint32_t frindex;
|
|
|
|
uint32_t ctrldssegment;
|
|
|
|
uint32_t periodiclistbase;
|
|
|
|
uint32_t asynclistaddr;
|
|
|
|
uint32_t notused[9];
|
|
|
|
uint32_t configflag;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
uint32_t portsc[NB_PORTS];
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Internal states, shadow registers, etc
|
|
|
|
*/
|
|
|
|
QEMUTimer *frame_timer;
|
|
|
|
QEMUBH *async_bh;
|
2017-06-12 10:31:09 +03:00
|
|
|
bool working;
|
2012-10-30 15:20:06 +04:00
|
|
|
uint32_t astate; /* Current state in asynchronous schedule */
|
|
|
|
uint32_t pstate; /* Current state in periodic schedule */
|
|
|
|
USBPort ports[NB_PORTS];
|
|
|
|
USBPort *companion_ports[NB_PORTS];
|
|
|
|
uint32_t usbsts_pending;
|
|
|
|
uint32_t usbsts_frindex;
|
|
|
|
EHCIQueueHead aqueues;
|
|
|
|
EHCIQueueHead pqueues;
|
|
|
|
|
|
|
|
/* which address to look at next */
|
|
|
|
uint32_t a_fetch_addr;
|
|
|
|
uint32_t p_fetch_addr;
|
|
|
|
|
|
|
|
USBPacket ipacket;
|
|
|
|
QEMUSGList isgl;
|
|
|
|
|
|
|
|
uint64_t last_run_ns;
|
|
|
|
uint32_t async_stepdown;
|
2012-11-17 15:47:17 +04:00
|
|
|
uint32_t periodic_sched_active;
|
2012-10-30 15:20:06 +04:00
|
|
|
bool int_req_by_async;
|
2014-06-04 12:31:50 +04:00
|
|
|
VMChangeStateEntry *vmstate;
|
2012-10-30 15:20:06 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const VMStateDescription vmstate_ehci;
|
|
|
|
|
2013-06-06 17:41:10 +04:00
|
|
|
void usb_ehci_init(EHCIState *s, DeviceState *dev);
|
2017-02-08 05:42:55 +03:00
|
|
|
void usb_ehci_finalize(EHCIState *s);
|
2013-06-06 17:41:09 +04:00
|
|
|
void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp);
|
qdev: Unrealize must not fail
Devices may have component devices and buses.
Device realization may fail. Realization is recursive: a device's
realize() method realizes its components, and device_set_realized()
realizes its buses (which should in turn realize the devices on that
bus, except bus_set_realized() doesn't implement that, yet).
When realization of a component or bus fails, we need to roll back:
unrealize everything we realized so far. If any of these unrealizes
failed, the device would be left in an inconsistent state. Must not
happen.
device_set_realized() lets it happen: it ignores errors in the roll
back code starting at label child_realize_fail.
Since realization is recursive, unrealization must be recursive, too.
But how could a partly failed unrealize be rolled back? We'd have to
re-realize, which can fail. This design is fundamentally broken.
device_set_realized() does not roll back at all. Instead, it keeps
unrealizing, ignoring further errors.
It can screw up even for a device with no buses: if the lone
dc->unrealize() fails, it still unregisters vmstate, and calls
listeners' unrealize() callback.
bus_set_realized() does not roll back either. Instead, it stops
unrealizing.
Fortunately, no unrealize method can fail, as we'll see below.
To fix the design error, drop parameter @errp from all the unrealize
methods.
Any unrealize method that uses @errp now needs an update. This leads
us to unrealize() methods that can fail. Merely passing it to another
unrealize method cannot cause failure, though. Here are the ones that
do other things with @errp:
* virtio_serial_device_unrealize()
Fails when qbus_set_hotplug_handler() fails, but still does all the
other work. On failure, the device would stay realized with its
resources completely gone. Oops. Can't happen, because
qbus_set_hotplug_handler() can't actually fail here. Pass
&error_abort to qbus_set_hotplug_handler() instead.
* hw/ppc/spapr_drc.c's unrealize()
Fails when object_property_del() fails, but all the other work is
already done. On failure, the device would stay realized with its
vmstate registration gone. Oops. Can't happen, because
object_property_del() can't actually fail here. Pass &error_abort
to object_property_del() instead.
* spapr_phb_unrealize()
Fails and bails out when remove_drcs() fails, but other work is
already done. On failure, the device would stay realized with some
of its resources gone. Oops. remove_drcs() fails only when
chassis_from_bus()'s object_property_get_uint() fails, and it can't
here. Pass &error_abort to remove_drcs() instead.
Therefore, no unrealize method can fail before this patch.
device_set_realized()'s recursive unrealization via bus uses
object_property_set_bool(). Can't drop @errp there, so pass
&error_abort.
We similarly unrealize with object_property_set_bool() elsewhere,
always ignoring errors. Pass &error_abort instead.
Several unrealize methods no longer handle errors from other unrealize
methods: virtio_9p_device_unrealize(),
virtio_input_device_unrealize(), scsi_qdev_unrealize(), ...
Much of the deleted error handling looks wrong anyway.
One unrealize methods no longer ignore such errors:
usb_ehci_pci_exit().
Several realize methods no longer ignore errors when rolling back:
v9fs_device_realize_common(), pci_qdev_unrealize(),
spapr_phb_realize(), usb_qdev_realize(), vfio_ccw_realize(),
virtio_device_realize().
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200505152926.18877-17-armbru@redhat.com>
2020-05-05 18:29:24 +03:00
|
|
|
void usb_ehci_unrealize(EHCIState *s, DeviceState *dev);
|
2015-03-18 12:33:47 +03:00
|
|
|
void ehci_reset(void *opaque);
|
2012-12-06 15:15:58 +04:00
|
|
|
|
2012-12-16 07:49:43 +04:00
|
|
|
#define TYPE_PCI_EHCI "pci-ehci-usb"
|
2020-09-16 21:25:19 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(EHCIPCIState, PCI_EHCI)
|
2012-12-16 07:49:43 +04:00
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct EHCIPCIState {
|
2012-12-16 07:49:43 +04:00
|
|
|
/*< private >*/
|
|
|
|
PCIDevice pcidev;
|
|
|
|
/*< public >*/
|
|
|
|
|
|
|
|
EHCIState ehci;
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2012-12-16 07:49:43 +04:00
|
|
|
|
|
|
|
|
|
|
|
#define TYPE_SYS_BUS_EHCI "sysbus-ehci-usb"
|
2018-12-29 13:00:57 +03:00
|
|
|
#define TYPE_PLATFORM_EHCI "platform-ehci-usb"
|
2012-12-16 07:49:45 +04:00
|
|
|
#define TYPE_EXYNOS4210_EHCI "exynos4210-ehci-usb"
|
2020-03-12 01:18:40 +03:00
|
|
|
#define TYPE_AW_H3_EHCI "aw-h3-ehci-usb"
|
hw/arm/npcm7xx: Add EHCI and OHCI controllers
The NPCM730 and NPCM750 chips have a single USB host port shared between
a USB 2.0 EHCI host controller and a USB 1.1 OHCI host controller. This
adds support for both of them.
Testing notes:
* With -device usb-kbd, qemu will automatically insert a full-speed
hub, and the keyboard becomes controlled by the OHCI controller.
* With -device usb-kbd,bus=usb-bus.0,port=1, the keyboard is directly
attached to the port without any hubs, and the device becomes
controlled by the EHCI controller since it's high speed capable.
* With -device usb-kbd,bus=usb-bus.0,port=1,usb_version=1, the
keyboard is directly attached to the port, but it only advertises
itself as full-speed capable, so it becomes controlled by the OHCI
controller.
In all cases, the keyboard device enumerates correctly.
Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-10-24 00:06:36 +03:00
|
|
|
#define TYPE_NPCM7XX_EHCI "npcm7xx-ehci-usb"
|
2013-06-06 17:41:11 +04:00
|
|
|
#define TYPE_TEGRA2_EHCI "tegra2-ehci-usb"
|
2017-09-16 17:02:41 +03:00
|
|
|
#define TYPE_PPC4xx_EHCI "ppc4xx-ehci-usb"
|
2013-06-06 17:41:13 +04:00
|
|
|
#define TYPE_FUSBH200_EHCI "fusbh200-ehci-usb"
|
2012-12-16 07:49:45 +04:00
|
|
|
|
2020-09-16 21:25:18 +03:00
|
|
|
OBJECT_DECLARE_TYPE(EHCISysBusState, SysBusEHCIClass, SYS_BUS_EHCI)
|
2012-12-16 07:49:43 +04:00
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct EHCISysBusState {
|
2012-12-16 07:49:43 +04:00
|
|
|
/*< private >*/
|
|
|
|
SysBusDevice parent_obj;
|
|
|
|
/*< public >*/
|
|
|
|
|
|
|
|
EHCIState ehci;
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2012-12-16 07:49:43 +04:00
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct SysBusEHCIClass {
|
2012-12-16 07:49:44 +04:00
|
|
|
/*< private >*/
|
|
|
|
SysBusDeviceClass parent_class;
|
|
|
|
/*< public >*/
|
|
|
|
|
|
|
|
uint16_t capsbase;
|
|
|
|
uint16_t opregbase;
|
2013-06-06 17:41:12 +04:00
|
|
|
uint16_t portscbase;
|
|
|
|
uint16_t portnr;
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2012-12-16 07:49:44 +04:00
|
|
|
|
2020-09-16 21:25:19 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(FUSBH200EHCIState, FUSBH200_EHCI)
|
2013-06-06 17:41:13 +04:00
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct FUSBH200EHCIState {
|
2013-06-06 17:41:13 +04:00
|
|
|
/*< private >*/
|
|
|
|
EHCISysBusState parent_obj;
|
|
|
|
/*< public >*/
|
|
|
|
|
|
|
|
MemoryRegion mem_vendor;
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2013-06-06 17:41:13 +04:00
|
|
|
|
2012-12-06 15:15:58 +04:00
|
|
|
#endif
|