Angel Pons | ae59387 | 2020-04-04 18:50:57 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 3 | |
Marc Jones | 2e8476c | 2017-10-05 21:56:15 -0600 | [diff] [blame] | 4 | /* 0:12.0 - EHCI */ |
| 5 | Device(EHC0) { |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 6 | Name(_ADR, 0x00120000) |
Marshall Dawson | fdb846d | 2018-09-26 15:43:21 -0600 | [diff] [blame] | 7 | Name(_PRW, Package() { 0xb, 3 }) |
Duncan Laurie | 32bdffa | 2018-05-07 15:37:28 -0700 | [diff] [blame] | 8 | Device (RHUB) { |
| 9 | Name (_ADR, Zero) |
| 10 | Device (HS01) { Name (_ADR, 1) } |
| 11 | Device (HS02) { Name (_ADR, 2) } |
| 12 | Device (HS03) { Name (_ADR, 3) } |
| 13 | Device (HS04) { Name (_ADR, 4) } |
| 14 | Device (HS05) { Name (_ADR, 5) } |
| 15 | Device (HS06) { Name (_ADR, 6) } |
| 16 | Device (HS07) { Name (_ADR, 7) } |
| 17 | Device (HS08) { Name (_ADR, 8) } |
| 18 | } |
Marshall Dawson | fdb846d | 2018-09-26 15:43:21 -0600 | [diff] [blame] | 19 | |
| 20 | Name(_PR0, Package() { P0U2 }) /* Indicate support for D0 */ |
| 21 | Name(_PR3, Package() { P3U2 }) /* Indicate support for D3cold */ |
| 22 | |
| 23 | Method(_S0W,0) { |
| 24 | Return(0) |
| 25 | } |
| 26 | |
| 27 | Method(_S3W,0) { |
| 28 | Return(4) |
| 29 | } |
| 30 | |
| 31 | Method(_S4W,0) { |
| 32 | Return(4) |
| 33 | } |
Marc Jones | 2e8476c | 2017-10-05 21:56:15 -0600 | [diff] [blame] | 34 | } /* end EHC0 */ |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 35 | |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 36 | |
| 37 | /* 0:10.0 - XHCI 0*/ |
| 38 | Device(XHC0) { |
| 39 | Name(_ADR, 0x00100000) |
Marshall Dawson | fdb846d | 2018-09-26 15:43:21 -0600 | [diff] [blame] | 40 | Name(_PRW, Package() { 0xb, 3 }) |
Duncan Laurie | 32bdffa | 2018-05-07 15:37:28 -0700 | [diff] [blame] | 41 | Device (SS01) { Name (_ADR, 1) } |
| 42 | Device (SS02) { Name (_ADR, 2) } |
| 43 | Device (SS03) { Name (_ADR, 3) } |
Marshall Dawson | fdb846d | 2018-09-26 15:43:21 -0600 | [diff] [blame] | 44 | |
| 45 | Name(_PR0, Package() { P0U3 }) /* Indicate support for D0 */ |
| 46 | Name(_PR3, Package() { P3U3 }) /* Indicate support for D3cold */ |
| 47 | |
| 48 | Method(_S0W,0) { |
| 49 | Return(0) |
| 50 | } |
| 51 | |
| 52 | Method(_S3W,0) { |
| 53 | Return(4) |
| 54 | } |
| 55 | |
| 56 | Method(_S4W,0) { |
| 57 | Return(4) |
| 58 | } |
| 59 | |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 60 | } /* end XHC0 */ |
Marshall Dawson | fdb846d | 2018-09-26 15:43:21 -0600 | [diff] [blame] | 61 | |
| 62 | Scope(\_SB) |
| 63 | { |
| 64 | Name(XHD0, 0) |
| 65 | Name(XHD3, 0) |
| 66 | PowerResource(P0U3, 0, 0) { |
| 67 | Method(_STA) { |
| 68 | Return(XHD0) |
| 69 | } |
| 70 | Method(_ON) { |
| 71 | Store(0x01, XHD0) |
| 72 | } |
| 73 | Method(_OFF) { |
| 74 | Store(0x00, XHD0) |
| 75 | } |
| 76 | } |
| 77 | PowerResource(P3U3, 0, 0) { |
| 78 | Method(_STA) { |
| 79 | Return(XHD3) |
| 80 | } |
| 81 | Method(_ON) { |
| 82 | Store(0x01, XHD3) |
| 83 | } |
| 84 | Method(_OFF) { |
| 85 | Store(0x00, XHD3) |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | Name(EHD0, 0) |
| 90 | Name(EHD3, 0) |
| 91 | PowerResource(P0U2, 0, 0) { |
| 92 | Method(_STA) { |
| 93 | Return(EHD0) |
| 94 | } |
| 95 | Method(_ON) { |
| 96 | Store(0x01, EHD0) |
| 97 | } |
| 98 | Method(_OFF) { |
| 99 | Store(0x00, EHD0) |
| 100 | } |
| 101 | } |
| 102 | PowerResource(P3U2, 0, 0) { |
| 103 | Method(_STA) { |
| 104 | Return(EHD3) |
| 105 | } |
| 106 | Method(_ON) { |
| 107 | Store(0x01, EHD3) |
| 108 | } |
| 109 | Method(_OFF) { |
| 110 | Store(0x00, EHD3) |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | OperationRegion(EHMC, SystemMemory, EH10, 0x100) |
| 116 | Field(EHMC, DwordAcc, NoLock, Preserve) |
| 117 | { |
| 118 | Offset(0xb0), |
| 119 | , 5, |
| 120 | ESIM, 1, |
| 121 | } |
| 122 | |
| 123 | Method(U2D3,0, Serialized) |
| 124 | { |
| 125 | if (LNotEqual(EH10, Zero)) { |
| 126 | Store (EH10, EHBA) |
| 127 | Store (One, EHME) |
| 128 | Store (ESIM, SSIM) |
| 129 | } |
| 130 | |
| 131 | if (LEqual(E_PS, 3)) { |
| 132 | Store (Zero, RQTY) |
| 133 | Store (One, RQ18) |
| 134 | |
| 135 | Store (U2SR, Local0) |
| 136 | while (Local0) { |
| 137 | Store (U2SR, Local0) |
| 138 | } |
| 139 | |
| 140 | Store (Zero, U2PD) |
| 141 | |
| 142 | Store (U2DS, Local0) |
| 143 | while (LNotEqual(Local0, Zero)) { |
| 144 | Store (U2DS, Local0) |
| 145 | } |
| 146 | |
| 147 | Store (0x03,U2TD) |
| 148 | |
| 149 | if (LEqual(U3TD, 0x03)) { /* Shutdown USB2 PLL */ |
| 150 | PWGC (0x40, 0) |
| 151 | Store (One, U2RP) |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | Method(U2D0,0, Serialized) |
| 157 | { |
| 158 | PWGC (0x40, 1) |
| 159 | Store (Zero, U2RP) |
| 160 | Store (0x00,U2TD) |
| 161 | |
| 162 | Store (Zero, U2TD) |
| 163 | Store (One, U2PD) |
| 164 | |
| 165 | Store (U2DS, Local0) |
| 166 | while (LNotEqual(Local0,0x7)) { |
| 167 | Store (U2DS, Local0) |
| 168 | } |
| 169 | |
| 170 | Store (One, RQTY) |
| 171 | Store (One, RQ18) |
| 172 | Store (U2SR, Local0) |
| 173 | while (LNot(Local0)) { |
| 174 | Store (U2SR, Local0) |
| 175 | } |
| 176 | Store (EHID, EH2C) |
| 177 | |
| 178 | |
| 179 | if (LNotEqual(EH10, Zero)) { |
| 180 | Store (EH10, EHBA) |
| 181 | Store (One, EHME) |
| 182 | Store (SSIM, ESIM) |
| 183 | } |
| 184 | |
| 185 | Store (ES54, EH54) |
| 186 | Store (ES64, EH64) |
| 187 | } |
| 188 | |
| 189 | Method(LXFW,3, Serialized) //Load Xhci FirmWare |
| 190 | { |
| 191 | Store (One, FWLM) /* Firmware Load Mode */ |
| 192 | Store (Arg0, ROAM) /* ROM/RAM */ |
| 193 | Store (Arg1, UA04) |
| 194 | Store (Arg2, UA08) |
| 195 | Store (One, FPLS) /* Firmware Preload Start */ |
| 196 | Store (FPLC, Local0) /* Firmware Preload Complete */ |
| 197 | while (LNot(Local0)) { |
| 198 | Store (FPLC, Local0) |
| 199 | } |
| 200 | Store (Zero, FPLS) |
| 201 | } |
| 202 | |
| 203 | Method(U3D3,0, Serialized) |
| 204 | { |
| 205 | if (LEqual(U_PS, 3)) { |
| 206 | X0_S () |
| 207 | |
| 208 | Or (PGA3, 0x20, PGA3) /* SwUsb3SlpShutdown */ |
| 209 | And (PGA3, 0x20, Local0) |
| 210 | while (LNot(Local0)) { /* wait for it to complete */ |
| 211 | And (PGA3, 0x20, Local0) |
| 212 | } |
| 213 | Store (One, UD3P) /* U3P_D3Cold_PWRDN */ |
| 214 | |
| 215 | Store (Zero, U3PD) /* PwrOnDev */ |
| 216 | Store (U3DS, Local0) |
| 217 | while (Local0) { /* RstBState, RefClkOkState, PwrRstBState */ |
| 218 | Store (U3DS, Local0) |
| 219 | } |
| 220 | |
| 221 | Store (0x3, U3TD) /* TargetedDeviceState */ |
| 222 | |
| 223 | Store (One, U3RP) /* USB3_RefClk_Pwdn */ |
| 224 | |
| 225 | if (Lequal(U2TD, 0x3)) { /* If EHCI targeted in D3cold */ |
| 226 | And (PGA3, 0x9f, PGA3) /* SwUsb2S5RstB */ |
| 227 | Store (One, U2RP) /* USB2_RefClk_Pwdn */ |
| 228 | } |
| 229 | Store (Zero, U3PG) /* XhcPwrGood */ |
| 230 | Store (One, U3PS) /* Usb3PowerSel */ |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | Method(U3D0,0, Serialized) |
| 235 | { |
| 236 | Store (Zero, U3PS) /* Usb3PowerSel */ |
| 237 | Store (One, U3PG) /* XhcPwrGood */ |
| 238 | |
| 239 | Store (Zero, U2RP) |
| 240 | Store (Zero, U3RP) |
| 241 | |
| 242 | And (PGA3, 0xdf, Local0) |
| 243 | Or (Local0, 0x40, Local0) |
| 244 | Store (Local0, PGA3) /* SwUsb2S5RstB */ |
| 245 | |
| 246 | Store (Zero, U3TD) /* TargetedDeviceState */ |
| 247 | Store (One, U3PD) /* PwrOnDev */ |
| 248 | |
| 249 | Store (U3DS, Local0) /* wait for RstBState, RefClkOkState, PwrRstBState */ |
| 250 | while (LNot(Lequal(Local0, 0x7))) { |
| 251 | Store (U3DS, Local0) |
| 252 | } |
| 253 | |
| 254 | Store (U3PY, Local0) /* USB3 PHY Lock */ |
| 255 | while (LNot(Local0)) { |
| 256 | Store (U3PY, Local0) |
| 257 | } |
| 258 | |
| 259 | Store (Zero, U3PR) /* U3P_RESTORE_RESET */ |
| 260 | |
| 261 | Store (AUSS, Local0) /* AutoSizeStart */ |
| 262 | if (LNotEqual(Local0,1)) { |
| 263 | Store(One, AUSS) |
| 264 | } |
| 265 | Store (AUSS, Local0) |
| 266 | while (LNotEqual(Local0,1)) { |
| 267 | Store (AUSS, Local0) |
| 268 | } |
| 269 | |
| 270 | LXFW (1, FW00, FW01) |
| 271 | LXFW (0, FW02, FW03) |
| 272 | |
| 273 | X0_R () |
| 274 | |
| 275 | Store (One, U3PR) /* U3P_RESTORE_RESET */ |
| 276 | Store (Zero, UD3P) /* U3P_D3Cold_PWRDN */ |
| 277 | Store (One, U3TD) /* TargetedDeviceState */ |
| 278 | } |
| 279 | |
| 280 | Name (SVBF, Buffer (0x1000) {0}) /* length from FchCarrizo.asl, new fields */ |
| 281 | CreateDWordField(SVBF, 0x000, S000) /* will be easier to add from there */ |
| 282 | CreateDWordField(SVBF, 0x004, S004) |
| 283 | CreateDWordField(SVBF, 0x008, S008) |
| 284 | CreateDWordField(SVBF, 0x00C, S00C) |
| 285 | CreateDWordField(SVBF, 0x018, S018) |
| 286 | CreateDWordField(SVBF, 0x01C, S01C) |
| 287 | CreateDWordField(SVBF, 0x020, S020) |
| 288 | CreateDWordField(SVBF, 0x030, S030) |
| 289 | CreateDWordField(SVBF, 0x118, S118) |
| 290 | CreateDWordField(SVBF, 0x158, S158) |
| 291 | CreateDWordField(SVBF, 0x198, S198) |
| 292 | CreateDWordField(SVBF, 0x1D8, S1D8) |
| 293 | CreateDWordField(SVBF, 0x300, S300) |
| 294 | CreateDWordField(SVBF, 0x304, S304) |
| 295 | CreateDWordField(SVBF, 0x308, S308) |
| 296 | CreateDWordField(SVBF, 0x30C, S30C) |
| 297 | CreateDWordField(SVBF, 0x310, S310) |
| 298 | CreateDWordField(SVBF, 0x428, S428) |
| 299 | CreateDWordField(SVBF, 0x438, S438) |
| 300 | CreateDWordField(SVBF, 0x43C, S43C) |
| 301 | CreateDWordField(SVBF, 0x458, S458) |
| 302 | CreateDWordField(SVBF, 0x468, S468) |
| 303 | CreateDWordField(SVBF, 0x46C, S46C) |
| 304 | CreateDWordField(SVBF, 0x470, S470) |
| 305 | CreateDWordField(SVBF, 0x480, S480) |
| 306 | CreateDWordField(SVBF, 0x484, S484) |
| 307 | CreateDWordField(SVBF, 0x488, S488) |
| 308 | CreateDWordField(SVBF, 0x48C, S48C) |
| 309 | CreateDWordField(SVBF, 0x730, EHID) /* EHCI SSID */ |
| 310 | CreateDWordField(SVBF, 0x734, XHID) /* XHCI SSID */ |
| 311 | CreateByteField(SVBF, 0x740, ES54) /* EHCI PCIx54 */ |
| 312 | CreateByteField(SVBF, 0x741, ES64) /* EHCI PCIx64 */ |
| 313 | CreateDWordField(SVBF, 0x7B0, SSIM) /* EHCI SIM BIT */ |
| 314 | |
| 315 | Method(X0_S,0) |
| 316 | { |
| 317 | Store (XH2C, XHID) |
| 318 | Store (0x00000000, IDEX) Store (DATA, S000) |
| 319 | Store (0x00000004, IDEX) Store (DATA, S004) |
| 320 | Store (0x00000008, IDEX) Store (DATA, S008) |
| 321 | Store (0x0000000c, IDEX) Store (DATA, S00C) |
| 322 | Store (0x00000018, IDEX) Store (DATA, S018) |
| 323 | Store (0x0000001c, IDEX) Store (DATA, S01C) |
| 324 | Store (0x00000020, IDEX) Store (DATA, S020) |
| 325 | Store (0x00000030, IDEX) Store (DATA, S030) |
| 326 | Store (0x00000118, IDEX) Store (DATA, S118) |
| 327 | Store (0x00000158, IDEX) Store (DATA, S158) |
| 328 | Store (0x00000198, IDEX) Store (DATA, S198) |
| 329 | Store (0x000001d8, IDEX) Store (DATA, S1D8) |
| 330 | Store (0x00000300, IDEX) Store (DATA, S300) |
| 331 | Store (0x00000304, IDEX) Store (DATA, S304) |
| 332 | Store (0x00000308, IDEX) Store (DATA, S308) |
| 333 | Store (0x0000030c, IDEX) Store (DATA, S30C) |
| 334 | Store (0x00000310, IDEX) Store (DATA, S310) |
| 335 | Store (0x40000028, IDEX) Store (DATA, S428) |
| 336 | Store (0x40000038, IDEX) Store (DATA, S438) |
| 337 | Store (0x4000003c, IDEX) Store (DATA, S43C) |
| 338 | Store (0x40000058, IDEX) Store (DATA, S458) |
| 339 | Store (0x40000068, IDEX) Store (DATA, S468) |
| 340 | Store (0x4000006c, IDEX) Store (DATA, S46C) |
| 341 | Store (0x40000070, IDEX) Store (DATA, S470) |
| 342 | Store (0x40000080, IDEX) Store (DATA, S480) |
| 343 | Store (0x40000084, IDEX) Store (DATA, S484) |
| 344 | Store (0x40000088, IDEX) Store (DATA, S488) |
| 345 | Store (0x4000008c, IDEX) Store (DATA, S48C) |
| 346 | } |
| 347 | |
| 348 | Method(X0_R,0) |
| 349 | { |
| 350 | Store (XHID, XH2C) |
| 351 | Store (0x00000000, IDEX) Store (S000, DATA) |
| 352 | Store (0x00000004, IDEX) Store (S004, DATA) |
| 353 | Store (0x00000008, IDEX) Store (S008, DATA) |
| 354 | Store (0x0000000c, IDEX) Store (S00C, DATA) |
| 355 | Store (0x00000018, IDEX) Store (S018, DATA) |
| 356 | Store (0x0000001c, IDEX) Store (S01C, DATA) |
| 357 | Store (0x00000020, IDEX) Store (S020, DATA) |
| 358 | Store (0x00000030, IDEX) Store (S030, DATA) |
| 359 | Store (0x00000118, IDEX) Store (S118, DATA) |
| 360 | Store (0x00000158, IDEX) Store (S158, DATA) |
| 361 | Store (0x00000198, IDEX) Store (S198, DATA) |
| 362 | Store (0x000001d8, IDEX) Store (S1D8, DATA) |
| 363 | Store (0x00000300, IDEX) Store (S300, DATA) |
| 364 | Store (0x00000304, IDEX) Store (S304, DATA) |
| 365 | Store (0x00000308, IDEX) Store (S308, DATA) |
| 366 | Store (0x0000030c, IDEX) Store (S30C, DATA) |
| 367 | Store (0x00000310, IDEX) Store (S310, DATA) |
| 368 | Store (0x40000028, IDEX) Store (S428, DATA) |
| 369 | Store (0x40000038, IDEX) Store (S438, DATA) |
| 370 | Store (0x4000003c, IDEX) Store (S43C, DATA) |
| 371 | Store (0x40000058, IDEX) Store (S458, DATA) |
| 372 | Store (0x40000068, IDEX) Store (S468, DATA) |
| 373 | Store (0x4000006c, IDEX) Store (S46C, DATA) |
| 374 | Store (0x40000070, IDEX) Store (S470, DATA) |
| 375 | Store (0x40000080, IDEX) Store (S480, DATA) |
| 376 | Store (0x40000084, IDEX) Store (S484, DATA) |
| 377 | Store (0x40000088, IDEX) Store (S488, DATA) |
| 378 | Store (0x4000008c, IDEX) Store (S48C, DATA) |
| 379 | } |