Ticket #13768: 0001-xhci-GetPortStatus-ClearPortFeature-PS_PLC-PS_WRC-fi.patch

File 0001-xhci-GetPortStatus-ClearPortFeature-PS_PLC-PS_WRC-fi.patch, 2.4 KB (added by hugeping, 3 years ago)
  • src/add-ons/kernel/bus_managers/usb/Hub.cpp

    From dfdddc763b127a5641a714c16399a498ee62c3f2 Mon Sep 17 00:00:00 2001
    From: Peter Kosyh <p.kosyh@gmail.com>
    Date: Wed, 10 Oct 2018 08:58:28 +0300
    Subject: [PATCH] xhci: GetPortStatus, ClearPortFeature (PS_PLC, PS_WRC) fix
    
    ---
     src/add-ons/kernel/bus_managers/usb/Hub.cpp | 15 +++++++++++++++
     src/add-ons/kernel/busses/usb/xhci.cpp      | 10 ++++++++--
     2 files changed, 23 insertions(+), 2 deletions(-)
    
    diff --git a/src/add-ons/kernel/bus_managers/usb/Hub.cpp b/src/add-ons/kernel/bus_managers/usb/Hub.cpp
    index 64bc4516f0..b9b88e4991 100644
    a b Hub::Explore(change_item **changeList)  
    335335                USB_REQUEST_CLEAR_FEATURE, C_PORT_RESET, i + 1,
    336336                0, NULL, 0, NULL);
    337337        }
     338
     339        if (fPortStatus[i].change & (1 << C_PORT_LINK_STATE)) {
     340            TRACE_ALWAYS("port %" B_PRId32 " link state changed\n", i);
     341            DefaultPipe()->SendRequest(USB_REQTYPE_CLASS | USB_REQTYPE_OTHER_OUT,
     342                USB_REQUEST_CLEAR_FEATURE, C_PORT_LINK_STATE, i + 1,
     343                0, NULL, 0, NULL);
     344        }
     345
     346        if (fPortStatus[i].change & (1 << C_PORT_BH_PORT_RESET)) {
     347            TRACE_ALWAYS("port %" B_PRId32 " was warm reset\n", i);
     348            DefaultPipe()->SendRequest(USB_REQTYPE_CLASS | USB_REQTYPE_OTHER_OUT,
     349                USB_REQUEST_CLEAR_FEATURE, C_PORT_BH_PORT_RESET, i + 1,
     350                0, NULL, 0, NULL);
     351        }
     352
    338353    }
    339354
    340355    // explore down the tree if we have hubs connected
  • src/add-ons/kernel/busses/usb/xhci.cpp

    diff --git a/src/add-ons/kernel/busses/usb/xhci.cpp b/src/add-ons/kernel/busses/usb/xhci.cpp
    index b70b51c4fb..b59605eff8 100644
    a b XHCI::GetPortStatus(uint8 index, usb_port_status* status)  
    17891789
    17901790    if (fPortSpeeds[index] == USB_SPEED_SUPER) {
    17911791        if (portStatus & PS_PLC)
    1792             status->change |= PORT_LINK_STATE;
     1792            status->change |= (1 << C_PORT_LINK_STATE);
    17931793        if (portStatus & PS_WRC)
    1794             status->change |= PORT_BH_PORT_RESET;
     1794            status->change |= (1 << C_PORT_BH_PORT_RESET);
    17951795    }
    17961796
    17971797    return B_OK;
    XHCI::ClearPortFeature(uint8 index, uint16 feature)  
    18741874    case C_PORT_RESET:
    18751875        WriteOpReg(portRegister, portStatus | PS_PRC);
    18761876        break;
     1877    case C_PORT_BH_PORT_RESET:
     1878        WriteOpReg(portRegister, portStatus | PS_WRC);
     1879        break;
     1880    case C_PORT_LINK_STATE:
     1881        WriteOpReg(portRegister, portStatus | PS_PLC);
     1882        break;
    18771883    default:
    18781884        return B_BAD_VALUE;
    18791885    }