Hi Pedro:

  //  The description here is the judgment state,we can watch to XHC PORTSC register.
  // according to Xhc Spec 5.4.8 chapter Table39.we can knowleadge more information.
  // We need to pay attention to the PED CCS and PLS bits of the PORTSC register.

+    State = XhcReadOpReg (Xhc, Offset);
+      if ((((State & 0x1e0) >> 5) == 6) && ((State & 3) == 0)) {   
                        ↓                                                   ↓
                  PLS bit                                   PED and CCS bit

//  PLS: Port Link State    PED: Port Enabled/Disabled    CCS: Current Connect Status 
//  If the CCS bit and PED are 0, the device is disconnected and the port is not enabled.
//  If PLS is 6, the controller state machine is abnormal and software intervention is required.



// According to Usb3.2 spec 7.5.2 chapter.Inactive is a state where a link has failed Enhanced SuperSpeed operation.
// The software is required to perform a warm reset operation.
// Therefore, according to the Xhc1.1 spec 5.8 chapter Table39, we can write 1 to its highest bit and perform a hot reset operation to restore the controller.


+        State |= 0x80000000;

   For the value of this block, the above explanation has been made, and the discussion can be continued at the same time.

Thanks!