Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007-2009 coresystems GmbH |
| 5 | * Copyright (C) 2014 Google Inc. |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 6 | * Copyright (C) 2015 Intel Corporation. |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; version 2 of the License. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 19 | * Foundation, Inc. |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 20 | */ |
| 21 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 22 | /* XHCI Controller 0:14.0 */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 23 | |
| 24 | Device (XHCI) |
| 25 | { |
| 26 | Name (_ADR, 0x00140000) |
| 27 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 28 | Name (PLSD, 5) /* Port Link State - RxDetect */ |
| 29 | Name (PLSP, 7) /* Port Link State - Polling */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 30 | |
| 31 | OperationRegion (XPRT, PCI_Config, 0x00, 0x100) |
| 32 | Field (XPRT, AnyAcc, NoLock, Preserve) |
| 33 | { |
| 34 | Offset (0x0), |
| 35 | DVID, 16, |
| 36 | Offset (0x10), |
| 37 | , 16, |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 38 | XMEM, 16, /* MEM_BASE */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 39 | Offset (0x74), |
| 40 | D0D3, 2, |
| 41 | , 6, |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 42 | PMEE, 1, /* PME_EN */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 43 | , 6, |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 44 | PMES, 1, /* PME_STS */ |
| 45 | Offset (0xA8), |
| 46 | , 13, |
| 47 | MW13, 1, |
| 48 | MW14, 1, |
| 49 | , 17, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 50 | Offset (0xb0), |
| 51 | , 13, |
| 52 | MB13, 1, |
| 53 | MB14, 1, |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 54 | , 17, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 55 | Offset (0xd0), |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 56 | PR2, 32, /* USB2PR */ |
| 57 | PR2M, 32, /* USB2PRM */ |
| 58 | PR3, 32, /* USB3PR */ |
| 59 | PR3M, 32, /* USB3PRM */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 60 | } |
| 61 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 62 | Method (USRA,0){ |
| 63 | Return(11) |
| 64 | } |
| 65 | |
| 66 | Method (SSPA,0){ |
| 67 | Return (13) |
| 68 | } |
| 69 | |
| 70 | /* Clear status bits */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 71 | Method (LPCL, 0, Serialized) |
| 72 | { |
| 73 | OperationRegion (XREG, SystemMemory, |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 74 | ShiftLeft (^XMEM, 16), 0x600) |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 75 | Field (XREG, DWordAcc, Lock, Preserve) |
| 76 | { |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 77 | Offset (0x510), /* PORTSCNUSB3[0]*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 78 | PSC0, 32, |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 79 | Offset (0x520), /* PORTSCNUSB3[1]*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 80 | PSC1, 32, |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 81 | Offset (0x530), /* PORTSCNUSB3[2]*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 82 | PSC2, 32, |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 83 | Offset (0x540), /* PORTSCNUSB3[3]*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 84 | PSC3, 32, |
| 85 | } |
| 86 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 87 | /* Port Enabled/Disabled (Bit 1)*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 88 | Name (PEDB, ShiftLeft (1, 1)) |
| 89 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 90 | /* Change Status (Bits 23:17)*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 91 | Name (CHST, ShiftLeft (0x7f, 17)) |
| 92 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 93 | /* Port 0 */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 94 | And (PSC0, Not (PEDB), Local0) |
| 95 | Or (Local0, CHST, PSC0) |
| 96 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 97 | /* Port 1 */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 98 | And (PSC1, Not (PEDB), Local0) |
| 99 | Or (Local0, CHST, PSC1) |
| 100 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 101 | /* Port 2 */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 102 | And (PSC2, Not (PEDB), Local0) |
| 103 | Or (Local0, CHST, PSC2) |
| 104 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 105 | /* Port 3 */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 106 | And (PSC3, Not (PEDB), Local0) |
| 107 | Or (Local0, CHST, PSC3) |
| 108 | } |
| 109 | |
| 110 | Method (LPS0, 0, Serialized) |
| 111 | { |
| 112 | OperationRegion (XREG, SystemMemory, |
| 113 | ShiftLeft (^XMEM, 16), 0x600) |
| 114 | Field (XREG, DWordAcc, Lock, Preserve) |
| 115 | { |
| 116 | Offset (0x510), // PORTSCNUSB3 |
| 117 | , 5, |
| 118 | PLS1, 4, // [8:5] Port Link State |
| 119 | PPR1, 1, // [9] Port Power |
| 120 | , 7, |
| 121 | CSC1, 1, // [17] Connect Status Change |
| 122 | , 1, |
| 123 | WRC1, 1, // [19] Warm Port Reset Change |
| 124 | , 11, |
| 125 | WPR1, 1, // [31] Warm Port Reset |
| 126 | Offset (0x520), // PORTSCNUSB3 |
| 127 | , 5, |
| 128 | PLS2, 4, // [8:5] Port Link State |
| 129 | PPR2, 1, // [9] Port Power |
| 130 | , 7, |
| 131 | CSC2, 1, // [17] Connect Status Change |
| 132 | , 1, |
| 133 | WRC2, 1, // [19] Warm Port Reset Change |
| 134 | , 11, |
| 135 | WPR2, 1, // [31] Warm Port Reset |
| 136 | Offset (0x530), // PORTSCNUSB3 |
| 137 | , 5, |
| 138 | PLS3, 4, // [8:5] Port Link State |
| 139 | PPR3, 1, // [9] Port Power |
| 140 | , 7, |
| 141 | CSC3, 1, // [17] Connect Status Change |
| 142 | , 1, |
| 143 | WRC3, 1, // [19] Warm Port Reset Change |
| 144 | , 11, |
| 145 | WPR3, 1, // [31] Warm Port Reset |
| 146 | Offset (0x540), // PORTSCNUSB3 |
| 147 | , 5, |
| 148 | PLS4, 4, // [8:5] Port Link State |
| 149 | PPR4, 1, // [9] Port Power |
| 150 | , 7, |
| 151 | CSC4, 1, // [17] Connect Status Change |
| 152 | , 1, |
| 153 | WRC4, 1, // [19] Warm Port Reset Change |
| 154 | , 11, |
| 155 | WPR4, 1, // [31] Warm Port Reset |
| 156 | } |
| 157 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 158 | /* Wait for all powered ports to finish polling*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 159 | Store (10, Local0) |
| 160 | While (LOr (LOr (LAnd (LEqual (PPR1, 1), LEqual (PLS1, PLSP)), |
| 161 | LAnd (LEqual (PPR2, 1), LEqual (PLS2, PLSP))), |
| 162 | LOr (LAnd (LEqual (PPR3, 1), LEqual (PLS3, PLSP)), |
| 163 | LAnd (LEqual (PPR4, 1), LEqual (PLS4, PLSP))))) |
| 164 | { |
| 165 | If (LEqual (Local0, 0)) { |
| 166 | Break |
| 167 | } |
| 168 | Decrement (Local0) |
| 169 | Stall (10) |
| 170 | } |
| 171 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 172 | /* For each USB3 Port:*/ |
| 173 | /* If port is disconnected (PLS=5 PP=1 CSC=0)*/ |
| 174 | /* 1) Issue warm reset (WPR=1)*/ |
| 175 | /* 2) Poll for warm reset complete (WRC=0)*/ |
| 176 | /* 3) Write 1 to port status to clear*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 177 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 178 | /* Local# indicate if port is reset*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 179 | Store (0, Local1) |
| 180 | Store (0, Local2) |
| 181 | Store (0, Local3) |
| 182 | Store (0, Local4) |
| 183 | |
| 184 | If (LAnd (LEqual (PLS1, PLSD), |
| 185 | LAnd (LEqual (CSC1, 0), LEqual (PPR1, 1)))) { |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 186 | Store (1, WPR1) /* Issue warm reset*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 187 | Store (1, Local1) |
| 188 | } |
| 189 | If (LAnd (LEqual (PLS2, PLSD), |
| 190 | LAnd (LEqual (CSC2, 0), LEqual (PPR2, 1)))) { |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 191 | Store (1, WPR2) /* Issue warm reset*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 192 | Store (1, Local2) |
| 193 | } |
| 194 | If (LAnd (LEqual (PLS3, PLSD), |
| 195 | LAnd (LEqual (CSC3, 0), LEqual (PPR3, 1)))) { |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 196 | Store (1, WPR3) /* Issue warm reset*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 197 | Store (1, Local3) |
| 198 | } |
| 199 | If (LAnd (LEqual (PLS4, PLSD), |
| 200 | LAnd (LEqual (CSC4, 0), LEqual (PPR4, 1)))) { |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 201 | Store (1, WPR4) /* Issue warm reset*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 202 | Store (1, Local4) |
| 203 | } |
| 204 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 205 | /* Poll for warm reset complete on all ports that were reset*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 206 | Store (10, Local0) |
| 207 | While (LOr (LOr (LAnd (LEqual (Local1, 1), LEqual (WRC1, 0)), |
| 208 | LAnd (LEqual (Local2, 1), LEqual (WRC2, 0))), |
| 209 | LOr (LAnd (LEqual (Local3, 1), LEqual (WRC3, 0)), |
| 210 | LAnd (LEqual (Local4, 1), LEqual (WRC4, 0))))) |
| 211 | { |
| 212 | If (LEqual (Local0, 0)) { |
| 213 | Break |
| 214 | } |
| 215 | Decrement (Local0) |
| 216 | Stall (10) |
| 217 | } |
| 218 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 219 | /* Clear status bits in all ports */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 220 | LPCL () |
| 221 | } |
| 222 | |
| 223 | Method (_PSC, 0, NotSerialized) |
| 224 | { |
| 225 | Return (^D0D3) |
| 226 | } |
| 227 | |
| 228 | Method (_PS0, 0, Serialized) |
| 229 | { |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 230 | } |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 231 | Method (_PS3, 0, Serialized) |
| 232 | { |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | Name (_PRW, Package(){ 0x6d, 3 }) |
| 236 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 237 | /* Leave USB ports on for to allow Wake from USB */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 238 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 239 | Method (_S3D,0) /* Highest D State in S3 State*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 240 | { |
| 241 | Return (3) |
| 242 | } |
| 243 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 244 | Method (_S4D,0) /* Highest D State in S4 State*/ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 245 | { |
| 246 | Return (3) |
| 247 | } |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 248 | Device (HS01) |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 249 | { |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame^] | 250 | Name(_ADR, 0x01) |
| 251 | } |
| 252 | Device (HS02) |
| 253 | { |
| 254 | Name(_ADR, 0x02) |
| 255 | } |
| 256 | Device (HS03) |
| 257 | { |
| 258 | Name(_ADR, 0x03) |
| 259 | } |
| 260 | Device (HS04) |
| 261 | { |
| 262 | Name(_ADR, 0x04) |
| 263 | } |
| 264 | Device (HS05) |
| 265 | { |
| 266 | Name(_ADR, 0x05) |
| 267 | } |
| 268 | Device (HS06) |
| 269 | { |
| 270 | Name(_ADR, 0x06) |
| 271 | } |
| 272 | Device (HS07) |
| 273 | { |
| 274 | Name(_ADR, 0x07) |
| 275 | } |
| 276 | Device (HS08) |
| 277 | { |
| 278 | Name(_ADR, 0x08) |
| 279 | } |
| 280 | Device (HS09) |
| 281 | { |
| 282 | Name(_ADR, 0x09) |
| 283 | } |
| 284 | Device (HS10) |
| 285 | { |
| 286 | Name(_ADR, 0x10) |
| 287 | } |
| 288 | Device (USR1) |
| 289 | { |
| 290 | Method(_ADR) { Return (Add(USRA(),0)) } |
| 291 | } |
| 292 | Device (USR2) |
| 293 | { |
| 294 | Method(_ADR) { Return (Add(USRA(),1)) } |
| 295 | } |
| 296 | Device (SS01) |
| 297 | { |
| 298 | Method(_ADR) { Return (Add(SSPA(),0)) } |
| 299 | } |
| 300 | Device (SS02) |
| 301 | { |
| 302 | Method(_ADR) { Return (Add(SSPA(),1)) } |
| 303 | } |
| 304 | Device (SS03) |
| 305 | { |
| 306 | Method(_ADR) { Return (Add(SSPA(),2)) } |
| 307 | } |
| 308 | Device (SS04) |
| 309 | { |
| 310 | Method(_ADR) { Return (Add(SSPA(),3)) } |
| 311 | } |
| 312 | Device (SS05) |
| 313 | { |
| 314 | Method(_ADR) { Return (Add(SSPA(),4)) } |
| 315 | } |
| 316 | Device (SS06) |
| 317 | { |
| 318 | Method(_ADR) { Return (Add(SSPA(),5)) } |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 319 | } |
| 320 | } |
| 321 | |