Some changes in the USB xHCI device

- The retry timer now calls process_transfer_ring() for enabled slots only.
- On USB3-only ports ignore device speed setup and try to enable super-speed mode.
This commit is contained in:
Volker Ruppert 2016-12-26 08:07:32 +00:00
parent 1f911bca60
commit a3cbba7006
3 changed files with 22 additions and 20 deletions

View File

@ -258,16 +258,6 @@ usb_device_c* usb_device_c::find_device(Bit8u addr)
}
}
bx_bool usb_device_c::set_speed(int speed)
{
if ((speed >= d.minspeed) && (speed <= d.maxspeed)) {
d.speed = speed;
return 1;
} else {
return 0;
}
}
// Generic USB packet handler
#define SETUP_STATE_IDLE 0

View File

@ -191,7 +191,16 @@ public:
bx_bool get_connected() {return d.connected;}
usbdev_type get_type() {return d.type;}
int get_speed() {return d.speed;}
bx_bool set_speed(int speed);
bx_bool set_speed(int speed)
{
if ((speed >= d.minspeed) && (speed <= d.maxspeed)) {
d.speed = speed;
return 1;
} else {
return 0;
}
}
Bit8u get_address() {return d.addr;}
void set_async_mode(bx_bool async) {d.async_mode = async;}
void set_event_handler(void *dev, USBCallback *cb, int port)

View File

@ -3011,10 +3011,12 @@ void bx_usb_xhci_c::xhci_timer(void)
return;
for (slot=1; slot<MAX_SLOTS; slot++) {
for (ep=1; ep<32; ep++) {
if (BX_XHCI_THIS hub.slots[slot].ep_context[ep].retry) {
if (--BX_XHCI_THIS hub.slots[slot].ep_context[ep].retry_counter <= 0) {
BX_XHCI_THIS process_transfer_ring(slot, ep);
if (BX_XHCI_THIS hub.slots[slot].enabled) {
for (ep=1; ep<32; ep++) {
if (BX_XHCI_THIS hub.slots[slot].ep_context[ep].retry) {
if (--BX_XHCI_THIS hub.slots[slot].ep_context[ep].retry_counter <= 0) {
BX_XHCI_THIS process_transfer_ring(slot, ep);
}
}
}
}
@ -3160,11 +3162,12 @@ void bx_usb_xhci_c::usb_set_connect_status(Bit8u port, int type, bx_bool connect
usb_set_connect_status(port, type, 0);
return;
}
if ((device->get_speed() != USB_SPEED_SUPER) &&
BX_XHCI_THIS hub.usb_port[port].is_usb3) {
BX_PANIC(("Only super-speed devices supported on USB3 port."));
usb_set_connect_status(port, type, 0);
return;
if (BX_XHCI_THIS hub.usb_port[port].is_usb3) {
if (!device->set_speed(USB_SPEED_SUPER)) {
BX_PANIC(("Only super-speed devices supported on USB3 port."));
usb_set_connect_status(port, type, 0);
return;
}
}
switch (device->get_speed()) {
case USB_SPEED_LOW: