blob: 5e4908780bcc9c3f7a03d74b65a4e82d1261c553 [file] [log] [blame]
Lee Leahyb0005132015-05-12 18:19:47 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2009 coresystems GmbH
Duncan Lauriee32da952015-08-27 17:09:02 -07005 * Copyright (C) 2015 Google Inc.
Lee Leahy1d14b3e2015-05-12 18:23:27 -07006 * Copyright (C) 2015 Intel Corporation.
Lee Leahyb0005132015-05-12 18:19:47 -07007 *
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 Leahy1d14b3e2015-05-12 18:23:27 -070019 * Foundation, Inc.
Lee Leahyb0005132015-05-12 18:19:47 -070020 */
21
Lee Leahy1d14b3e2015-05-12 18:23:27 -070022/* XHCI Controller 0:14.0 */
Lee Leahyb0005132015-05-12 18:19:47 -070023
24Device (XHCI)
25{
26 Name (_ADR, 0x00140000)
27
Duncan Lauriee32da952015-08-27 17:09:02 -070028 Name (_PRW, Package () { GPE0_PME_B0, 3 })
29
30 Method (_DSW, 3)
31 {
32 Store (Arg0, PMEE)
33 }
34
35 Name (_S3D, 3) /* D3 supported in S3 */
36 Name (_S4D, 3) /* D3 supported in S4 */
37 Name (_S0W, 3) /* D3 can wake device in S0 */
38 Name (_S3W, 3) /* D3 can wake system from S3 */
39 Name (_S4W, 3) /* D3 can wake system from S4 */
Lee Leahyb0005132015-05-12 18:19:47 -070040
41 OperationRegion (XPRT, PCI_Config, 0x00, 0x100)
42 Field (XPRT, AnyAcc, NoLock, Preserve)
43 {
44 Offset (0x0),
Duncan Lauriee32da952015-08-27 17:09:02 -070045 DVID, 16, /* VENDORID */
Lee Leahyb0005132015-05-12 18:19:47 -070046 Offset (0x10),
47 , 16,
Lee Leahy1d14b3e2015-05-12 18:23:27 -070048 XMEM, 16, /* MEM_BASE */
Lee Leahyb0005132015-05-12 18:19:47 -070049 Offset (0x74),
Duncan Lauriee32da952015-08-27 17:09:02 -070050 D0D3, 2, /* POWERSTATE */
Lee Leahyb0005132015-05-12 18:19:47 -070051 , 6,
Lee Leahy1d14b3e2015-05-12 18:23:27 -070052 PMEE, 1, /* PME_EN */
Lee Leahyb0005132015-05-12 18:19:47 -070053 , 6,
Lee Leahy1d14b3e2015-05-12 18:23:27 -070054 PMES, 1, /* PME_STS */
Lee Leahyb0005132015-05-12 18:19:47 -070055 }
56
Duncan Lauriee32da952015-08-27 17:09:02 -070057 OperationRegion (XREG, SystemMemory,
58 Add (ShiftLeft (XMEM, 16), 0x8000), 0x200)
59 Field (XREG, DWordAcc, Lock, Preserve)
Lee Leahyb0005132015-05-12 18:19:47 -070060 {
Duncan Lauriee32da952015-08-27 17:09:02 -070061 Offset (0x1c4), /* USB2PMCTRL */
62 , 2,
63 UPSW, 2, /* U2PSUSPGP */
Lee Leahyb0005132015-05-12 18:19:47 -070064 }
65
Duncan Lauriee32da952015-08-27 17:09:02 -070066 Method (_PSC, 0, Serialized)
Lee Leahyb0005132015-05-12 18:19:47 -070067 {
68 Return (^D0D3)
69 }
70
71 Method (_PS0, 0, Serialized)
72 {
Duncan Lauriee32da952015-08-27 17:09:02 -070073 If (LEqual (^DVID, 0xFFFF)) {
74 Return
75 }
76 If (LOr (LEqual (^XMEM, 0xFFFF), LEqual (^XMEM, 0x0000))) {
77 Return
78 }
79
80 /* If device is in D3, set back to D0 */
81 If (LEqual (^D0D3, 3)) {
82 Store (Zero, ^D0D3)
83 Store (^D0D3, Local0)
84 }
85
86 /* Disable USB2 PHY SUS Well Power Gating */
87 Store (Zero, ^UPSW)
88
89 /*
90 * Apply USB2 PHPY Power Gating workaround if needed.
91 */
92 If (^^PMC.UWAB) {
93 /* Write to MTPMC to have PMC disable power gating */
94 Store (1, ^^PMC.MPMC)
95
96 /* Wait for PCH_PM_STS.MSG_FULL_STS to be 0 */
97 Store (10, Local0)
98 While (^^PMC.PMFS) {
99 If (LNot (Local0)) {
100 Break
101 }
102 Decrement (Local0)
103 Sleep (10)
104 }
105 }
Lee Leahyb0005132015-05-12 18:19:47 -0700106 }
Duncan Lauriee32da952015-08-27 17:09:02 -0700107
Lee Leahyb0005132015-05-12 18:19:47 -0700108 Method (_PS3, 0, Serialized)
109 {
Duncan Lauriee32da952015-08-27 17:09:02 -0700110 If (LEqual (^DVID, 0xFFFF)) {
111 Return
112 }
113 If (LOr (LEqual (^XMEM, 0xFFFF), LEqual (^XMEM, 0x0000))) {
114 Return
115 }
116
117 /* Clear PME Status */
118 Store (1, ^PMES)
119
120 /* Enable PME */
121 Store (1, ^PMEE)
122
123 /* If device is in D3, set back to D0 */
124 If (LEqual (^D0D3, 3)) {
125 Store (Zero, ^D0D3)
126 Store (^D0D3, Local0)
127 }
128
129 /* Enable USB2 PHY SUS Well Power Gating in D0/D0i2/D0i3/D3 */
130 Store (3, ^UPSW)
131
132 /* Now put device in D3 */
133 Store (3, ^D0D3)
134 Store (^D0D3, Local0)
135
136 /*
137 * Apply USB2 PHPY Power Gating workaround if needed.
138 * This code assumes XDCI is disabled, if it is enabled
139 * then this must also check if it is in D3 state too.
140 */
141 If (^^PMC.UWAB) {
142 /* Write to MTPMC to have PMC enable power gating */
143 Store (3, ^^PMC.MPMC)
144
145 /* Wait for PCH_PM_STS.MSG_FULL_STS to be 0 */
146 Store (10, Local0)
147 While (^^PMC.PMFS) {
148 If (LNot (Local0)) {
149 Break
150 }
151 Decrement (Local0)
152 Sleep (10)
153 }
154 }
Lee Leahyb0005132015-05-12 18:19:47 -0700155 }
156
Duncan Lauriee32da952015-08-27 17:09:02 -0700157 /* Root Hub for Skylake-LP PCH */
158 Device (RHUB)
159 {
160 Name (_ADR, Zero)
Lee Leahyb0005132015-05-12 18:19:47 -0700161
Duncan Lauriee32da952015-08-27 17:09:02 -0700162 /* USB2 */
163 Device (HS01) { Name (_ADR, 1) }
164 Device (HS02) { Name (_ADR, 2) }
165 Device (HS03) { Name (_ADR, 3) }
166 Device (HS04) { Name (_ADR, 4) }
167 Device (HS05) { Name (_ADR, 5) }
168 Device (HS06) { Name (_ADR, 6) }
169 Device (HS07) { Name (_ADR, 7) }
170 Device (HS08) { Name (_ADR, 8) }
171 Device (HS09) { Name (_ADR, 9) }
172 Device (HS10) { Name (_ADR, 10) }
Lee Leahyb0005132015-05-12 18:19:47 -0700173
Duncan Lauriee32da952015-08-27 17:09:02 -0700174 /* USBr */
175 Device (USR1) { Name (_ADR, 11) }
176 Device (USR2) { Name (_ADR, 12) }
Lee Leahyb0005132015-05-12 18:19:47 -0700177
Duncan Lauriee32da952015-08-27 17:09:02 -0700178 /* USB3 */
179 Device (SS01) { Name (_ADR, 13) }
180 Device (SS02) { Name (_ADR, 14) }
181 Device (SS03) { Name (_ADR, 15) }
182 Device (SS04) { Name (_ADR, 16) }
183 Device (SS05) { Name (_ADR, 17) }
184 Device (SS06) { Name (_ADR, 18) }
Lee Leahyb0005132015-05-12 18:19:47 -0700185 }
186}