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)
|
335 | 335 | USB_REQUEST_CLEAR_FEATURE, C_PORT_RESET, i + 1, |
336 | 336 | 0, NULL, 0, NULL); |
337 | 337 | } |
| 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 | |
338 | 353 | } |
339 | 354 | |
340 | 355 | // explore down the tree if we have hubs connected |
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)
|
1789 | 1789 | |
1790 | 1790 | if (fPortSpeeds[index] == USB_SPEED_SUPER) { |
1791 | 1791 | if (portStatus & PS_PLC) |
1792 | | status->change |= PORT_LINK_STATE; |
| 1792 | status->change |= (1 << C_PORT_LINK_STATE); |
1793 | 1793 | if (portStatus & PS_WRC) |
1794 | | status->change |= PORT_BH_PORT_RESET; |
| 1794 | status->change |= (1 << C_PORT_BH_PORT_RESET); |
1795 | 1795 | } |
1796 | 1796 | |
1797 | 1797 | return B_OK; |
… |
… |
XHCI::ClearPortFeature(uint8 index, uint16 feature)
|
1874 | 1874 | case C_PORT_RESET: |
1875 | 1875 | WriteOpReg(portRegister, portStatus | PS_PRC); |
1876 | 1876 | 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; |
1877 | 1883 | default: |
1878 | 1884 | return B_BAD_VALUE; |
1879 | 1885 | } |