Fixed device connect failure handling in all HCs (reset port parameters).
The old code has blocked the port after failure.
This commit is contained in:
parent
30e24fa3d5
commit
719592e2f3
@ -954,7 +954,6 @@ bool bx_uhci_core_c::set_connect_status(Bit8u port, bool connected)
|
||||
return 0;
|
||||
default:
|
||||
BX_PANIC(("USB device returned invalid speed value"));
|
||||
set_connect_status(port, 0);
|
||||
return 0;
|
||||
}
|
||||
if (hub.usb_port[port].low_speed) {
|
||||
@ -980,7 +979,6 @@ bool bx_uhci_core_c::set_connect_status(Bit8u port, bool connected)
|
||||
if (!device->get_connected()) {
|
||||
if (!device->init()) {
|
||||
BX_ERROR(("port #%d: connect failed", port+1));
|
||||
set_connect_status(port, 0);
|
||||
return 0;
|
||||
} else {
|
||||
BX_INFO(("port #%d: connect: %s", port+1, device->get_info()));
|
||||
|
@ -524,6 +524,10 @@ void bx_usb_ehci_c::init_device(Bit8u port, bx_list_c *portconf)
|
||||
sprintf(pname, "usb_ehci.hub.port%d.device", port+1);
|
||||
bx_list_c *sr_list = (bx_list_c*)SIM->get_param(pname, SIM->get_bochs_root());
|
||||
BX_EHCI_THIS hub.usb_port[port].device->register_state(sr_list);
|
||||
} else {
|
||||
((bx_param_enum_c*)portconf->get_by_name("device"))->set_by_name("none");
|
||||
((bx_param_string_c*)portconf->get_by_name("options"))->set("none");
|
||||
set_connect_status(port, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -550,7 +554,6 @@ bool bx_usb_ehci_c::set_connect_status(Bit8u port, bool connected)
|
||||
}
|
||||
if (device->get_speed() == USB_SPEED_SUPER) {
|
||||
BX_PANIC(("Super-speed device not supported on USB2 port."));
|
||||
set_connect_status(port, 0);
|
||||
return 0;
|
||||
}
|
||||
switch (device->get_speed()) {
|
||||
@ -571,12 +574,12 @@ bool bx_usb_ehci_c::set_connect_status(Bit8u port, bool connected)
|
||||
break;
|
||||
default:
|
||||
BX_ERROR(("device->get_speed() returned invalid speed value"));
|
||||
return 0;
|
||||
}
|
||||
BX_EHCI_THIS hub.usb_port[port].portsc.ccs = 1;
|
||||
if (!device->get_connected()) {
|
||||
if (!device->init()) {
|
||||
BX_ERROR(("port #%d: connect failed", port+1));
|
||||
set_connect_status(port, 0);
|
||||
return 0;
|
||||
} else {
|
||||
BX_INFO(("port #%d: connect: %s", port+1, device->get_info()));
|
||||
|
@ -497,6 +497,10 @@ void bx_usb_ohci_c::init_device(Bit8u port, bx_list_c *portconf)
|
||||
sprintf(pname, "usb_ohci.hub.port%d.device", port+1);
|
||||
bx_list_c *sr_list = (bx_list_c*)SIM->get_param(pname, SIM->get_bochs_root());
|
||||
BX_OHCI_THIS hub.usb_port[port].device->register_state(sr_list);
|
||||
} else {
|
||||
((bx_param_enum_c*)portconf->get_by_name("device"))->set_by_name("none");
|
||||
((bx_param_string_c*)portconf->get_by_name("options"))->set("none");
|
||||
usb_set_connect_status(port, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1468,18 +1472,15 @@ bool bx_usb_ohci_c::usb_set_connect_status(Bit8u port, bool connected)
|
||||
case USB_SPEED_HIGH:
|
||||
case USB_SPEED_SUPER:
|
||||
BX_PANIC(("HC supports 'low' or 'full' speed devices only."));
|
||||
usb_set_connect_status(port, 0);
|
||||
return 0;
|
||||
default:
|
||||
BX_PANIC(("USB device returned invalid speed value"));
|
||||
usb_set_connect_status(port, 0);
|
||||
return 0;
|
||||
}
|
||||
BX_OHCI_THIS hub.usb_port[port].HcRhPortStatus.ccs = 1;
|
||||
if (!device->get_connected()) {
|
||||
if (!device->init()) {
|
||||
BX_ERROR(("port #%d: connect failed", port+1));
|
||||
usb_set_connect_status(port, 0);
|
||||
return 0;
|
||||
} else {
|
||||
BX_INFO(("port #%d: connect: %s", port+1, device->get_info()));
|
||||
|
@ -211,6 +211,10 @@ void bx_usb_uhci_c::init_device(Bit8u port, bx_list_c *portconf)
|
||||
sprintf(pname, "usb_uhci.hub.port%d.device", port+1);
|
||||
bx_list_c *sr_list = (bx_list_c*)SIM->get_param(pname, SIM->get_bochs_root());
|
||||
BX_UHCI_THIS hub.usb_port[port].device->register_state(sr_list);
|
||||
} else {
|
||||
((bx_param_enum_c*)portconf->get_by_name("device"))->set_by_name("none");
|
||||
((bx_param_string_c*)portconf->get_by_name("options"))->set("none");
|
||||
set_connect_status(port, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -990,6 +990,10 @@ void bx_usb_xhci_c::init_device(Bit8u port, bx_list_c *portconf)
|
||||
sprintf(pname, "usb_xhci.hub.port%d.device", port+1);
|
||||
bx_list_c *sr_list = (bx_list_c*)SIM->get_param(pname, SIM->get_bochs_root());
|
||||
BX_XHCI_THIS hub.usb_port[port].device->register_state(sr_list);
|
||||
} else {
|
||||
((bx_param_enum_c*)portconf->get_by_name("device"))->set_by_name("none");
|
||||
((bx_param_string_c*)portconf->get_by_name("options"))->set("none");
|
||||
usb_set_connect_status(port, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3142,13 +3146,11 @@ bool bx_usb_xhci_c::usb_set_connect_status(Bit8u port, bool connected)
|
||||
if ((device->get_speed() == USB_SPEED_SUPER) &&
|
||||
!BX_XHCI_THIS hub.usb_port[port].is_usb3) {
|
||||
BX_PANIC(("Super-speed device not supported on USB2 port."));
|
||||
usb_set_connect_status(port, 0);
|
||||
return 0;
|
||||
}
|
||||
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, 0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -3167,14 +3169,12 @@ bool bx_usb_xhci_c::usb_set_connect_status(Bit8u port, bool connected)
|
||||
break;
|
||||
default:
|
||||
BX_PANIC(("USB device returned invalid speed value"));
|
||||
usb_set_connect_status(port, 0);
|
||||
return 0;
|
||||
}
|
||||
BX_XHCI_THIS hub.usb_port[port].portsc.ccs = 1;
|
||||
if (!device->get_connected()) {
|
||||
if (!device->init()) {
|
||||
BX_ERROR(("port #%d: connect failed", port+1));
|
||||
usb_set_connect_status(port, 0);
|
||||
return 0;
|
||||
} else {
|
||||
BX_INFO(("port #%d: connect: %s", port+1, device->get_info()));
|
||||
|
Loading…
Reference in New Issue
Block a user