| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
|
| 3 |
#include <intelblocks/xhci.h> |
| 4 |
|
| 5 |
/* |
| 6 |
* USB Port Wake Enable (UPWE) on usb attach/detach |
| 7 |
* Arg0 - Port Number |
| 8 |
* Arg1 - Port 1 Status and control offset |
| 9 |
* Arg2 - xHCI Memory-mapped address |
| 10 |
*/ |
| 11 |
Method (UPWE, 3, Serialized) |
| 12 |
{ |
| 13 |
Local0 = Arg1 + ((Arg0 - 1) * 0x10) |
| 14 |
|
| 15 |
/* Map ((XMEM << 16) + Local0 in PSCR */ |
| 16 |
OperationRegion (PSCR, SystemMemory, (Arg2 << 16) + Local0, 0x10) |
| 17 |
Field (PSCR, DWordAcc, NoLock, Preserve) |
| 18 |
{ |
| 19 |
PSCT, 32, |
| 20 |
} |
| 21 |
Local0 = PSCT |
| 22 |
Local0 &= PORTSCN_BITS_OFF_MASK |
| 23 |
Local0 |= PORTSCN_WAKE_ON_BOTH_CONNECT_DISCONNECT_ENABLE |
| 24 |
PSCT = Local0 |
| 25 |
} |
| 26 |
|
| 27 |
/* |
| 28 |
* USB Wake Enable Setup (UWES) |
| 29 |
* Arg0 - Port enable bitmap |
| 30 |
* Arg1 - Port 1 Status and control offset |
| 31 |
* Arg2 - xHCI Memory-mapped address |
| 32 |
*/ |
| 33 |
Method (UWES, 3, Serialized) |
| 34 |
{ |
| 35 |
Local0 = Arg0 |
| 36 |
|
| 37 |
While (1) { |
| 38 |
FindSetRightBit (Local0, Local1) |
| 39 |
If (Local1 == 0) { |
| 40 |
Break |
| 41 |
} |
| 42 |
UPWE (Local1, Arg1, Arg2) |
| 43 |
/* |
| 44 |
* Clear the lowest set bit in Local0 since it was |
| 45 |
* processed. |
| 46 |
*/ |
| 47 |
Local0 &= (Local0 - 1) |
| 48 |
} |
| 49 |
} |