Fix XHCI Address Device command (#244)
Was sending the SET_ADDRESS request using the wrong (old) slot context.
This commit is contained in:
parent
58663d3c68
commit
106e7fa03a
@ -2362,7 +2362,7 @@ Bit64u bx_usb_xhci_c::process_transfer_ring(int slot, int ep, Bit64u ring_addr,
|
||||
p->packet.pid = cur_direction;
|
||||
p->packet.devaddr = BX_XHCI_THIS hub.slots[slot].slot_context.device_address;
|
||||
p->packet.devep = (ep >> 1);
|
||||
p->packet.speed = broadcast_speed(slot);
|
||||
p->packet.speed = broadcast_speed(BX_XHCI_THIS hub.slots[slot].slot_context);
|
||||
#if HANDLE_TOGGLE_CONTROL
|
||||
p->packet.toggle = -1; // the xHCI handles the data toggle bit for USB2 devices
|
||||
#endif
|
||||
@ -2624,7 +2624,7 @@ void bx_usb_xhci_c::process_command_ring(void)
|
||||
if (BX_XHCI_THIS hub.slots[slot].slot_context.slot_state <= SLOT_STATE_DEFAULT) {
|
||||
int port_num = slot_context.rh_port_num - 1; // slot:port_num is 1 based
|
||||
new_addr = create_unique_address(slot);
|
||||
if (send_set_address(new_addr, port_num, slot) == 0) {
|
||||
if (send_set_address(new_addr, port_num, slot_context) == 0) {
|
||||
slot_context.slot_state = SLOT_STATE_ADDRESSED;
|
||||
slot_context.device_address = new_addr;
|
||||
ep_context.ep_state = EP_STATE_RUNNING;
|
||||
@ -3469,7 +3469,7 @@ int bx_usb_xhci_c::create_unique_address(int slot)
|
||||
return (slot + 1); // Windows may need the first one to be 2 (though it shouldn't know the difference for xHCI)
|
||||
}
|
||||
|
||||
int bx_usb_xhci_c::send_set_address(int addr, int port_num, int slot)
|
||||
int bx_usb_xhci_c::send_set_address(int addr, int port_num, SLOT_CONTEXT& slot_context)
|
||||
{
|
||||
static Bit8u setup_address[8] = { 0, 0x05, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
@ -3479,7 +3479,7 @@ int bx_usb_xhci_c::send_set_address(int addr, int port_num, int slot)
|
||||
USBPacket packet;
|
||||
packet.pid = USB_TOKEN_SETUP;
|
||||
packet.devep = 0;
|
||||
packet.speed = broadcast_speed(slot);
|
||||
packet.speed = broadcast_speed(slot_context);
|
||||
#if HANDLE_TOGGLE_CONTROL
|
||||
packet.toggle = -1; // the xHCI handles the data toggle bit for USB2 devices
|
||||
#endif
|
||||
@ -3497,11 +3497,11 @@ int bx_usb_xhci_c::send_set_address(int addr, int port_num, int slot)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int bx_usb_xhci_c::broadcast_speed(int slot)
|
||||
int bx_usb_xhci_c::broadcast_speed(SLOT_CONTEXT& slot_context)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
switch (BX_XHCI_THIS hub.slots[slot].slot_context.speed) {
|
||||
switch (slot_context.speed) {
|
||||
case 1:
|
||||
ret = USB_SPEED_FULL;
|
||||
break;
|
||||
@ -3516,7 +3516,7 @@ int bx_usb_xhci_c::broadcast_speed(int slot)
|
||||
ret = USB_SPEED_SUPER;
|
||||
break;
|
||||
default:
|
||||
BX_ERROR(("Invalid speed (%d) specified in Speed field of the Slot Context.", BX_XHCI_THIS hub.slots[slot].slot_context.speed));
|
||||
BX_ERROR(("Invalid speed (%d) specified in Speed field of the Slot Context.", slot_context.speed));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -628,7 +628,7 @@ private:
|
||||
static void remove_device(Bit8u port);
|
||||
static bool set_connect_status(Bit8u port, bool connected);
|
||||
|
||||
static int broadcast_speed(int slot);
|
||||
static int broadcast_speed(SLOT_CONTEXT& slot_context);
|
||||
static int broadcast_packet(USBPacket *p, int port);
|
||||
static Bit8u get_psceg(int port);
|
||||
static void xhci_timer_handler(void *);
|
||||
@ -658,7 +658,7 @@ private:
|
||||
static int validate_slot_context(const struct SLOT_CONTEXT *slot_context, int trb_command, int slot);
|
||||
static int validate_ep_context(const struct EP_CONTEXT *ep_context, int trb_command, Bit32u a_flags, int port_num, int ep_num);
|
||||
static int create_unique_address(int slot);
|
||||
static int send_set_address(int addr, int port_num, int slot);
|
||||
static int send_set_address(int addr, int port_num, SLOT_CONTEXT& slot_context);
|
||||
|
||||
static void dump_xhci_core(unsigned int slots, unsigned int eps);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user