6955860 hotplug does not work on uhci keyboard/mouse
authorfei feng - Sun Microsystems - Beijing China <Fei.Feng@Sun.COM>
Sat, 05 Jun 2010 20:44:25 +0800
changeset 12559 e3b3e6fd0267
parent 12558 9c40eb91511d
child 12560 3d812b8a789f
6955860 hotplug does not work on uhci keyboard/mouse
usr/src/uts/common/io/usb/hcd/uhci/uhcitgt.c
--- a/usr/src/uts/common/io/usb/hcd/uhci/uhcitgt.c	Fri Jun 04 14:47:43 2010 -0700
+++ b/usr/src/uts/common/io/usb/hcd/uhci/uhcitgt.c	Sat Jun 05 20:44:25 2010 +0800
@@ -454,8 +454,8 @@
 	    ph->p_usba_device->usb_root_hub_dip);
 	uhci_pipe_private_t	*pp = (uhci_pipe_private_t *)ph->p_hcd_private;
 	usb_ep_descr_t		*eptd = &ph->p_ep;
-	int i = 0;
-	uint_t new_port_status = 0, old_port_status = 0;
+	usb_port_t		port;
+	uint_t 			port_status = 0;
 
 	USB_DPRINTF_L2(PRINT_MASK_HCDI, uhcip->uhci_log_hdl,
 	    "uhci_hcdi_pipe_reset: usb_flags = 0x%x", usb_flags);
@@ -470,20 +470,14 @@
 	USB_DPRINTF_L2(PRINT_MASK_HCDI, uhcip->uhci_log_hdl,
 	    "uhci_hcdi_pipe_reset: try "
 	    "to enable disabled ports if necessary.");
-	for (i = 0; i < uhcip->uhci_root_hub.rh_num_ports; i++) {
-		old_port_status = Get_OpReg16(PORTSC[i]);
-		if (!(old_port_status & HCR_PORT_ENABLE)) {
-			Set_OpReg16(PORTSC[i],
-			    (old_port_status | HCR_PORT_ENABLE));
+	for (port = 0; port < uhcip->uhci_root_hub.rh_num_ports; port++) {
+		port_status = Get_OpReg16(PORTSC[port]);
+		if ((!(port_status & HCR_PORT_ENABLE)) &&
+		    (port_status & HCR_PORT_CCS) &&
+		    (!(port_status & HCR_PORT_CSC))) {
+			Set_OpReg16(PORTSC[port],
+			    (port_status | HCR_PORT_ENABLE));
 			drv_usecwait(UHCI_ONE_MS * 2);
-			new_port_status = Get_OpReg16(PORTSC[i]);
-			/*
-			 * Refresh Root Hub port status
-			 */
-			uhcip->uhci_root_hub.rh_port_status[i] =
-			    new_port_status;
-			uhcip->uhci_root_hub.rh_port_changes[i] |=
-			    ((old_port_status ^ new_port_status) & 0xff);
 		}
 	}