• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* SPDX-License-Identifier: GPL-2.0-only */
2
3/* Intel Cougar Point USB support */
4
5// EHCI Controller 0:1d.0
6
7Device (EHC1)
8{
9	Name(_ADR, 0x001d0000)
10
11	Name (_PRW, Package(){ 13, 4 }) // Power Resources for Wake
12
13	// Leave USB ports on for to allow Wake from USB
14
15	Method(_S3D,0)	// Highest D State in S3 State
16	{
17		Return (2)
18	}
19
20	Method(_S4D,0)	// Highest D State in S4 State
21	{
22		Return (2)
23	}
24
25	Device (HUB7)
26	{
27		Name (_ADR, 0x00000000)
28
29
30		// GPLD: Generate Port Location Data (PLD)
31		Method (GPLD, 1, Serialized)
32		 {
33
34			Name (PCKG, Package (0x01)
35			{
36				Buffer (0x10) {}
37			})
38
39			// REV: Revision 0x02 for ACPI 5.0
40			CreateField (DerefOf (PCKG [0]), 0, 0x07, REV)
41			REV = 0x02
42
43			// VISI: Port visibility to user per port
44			CreateField (DerefOf (PCKG [0]), 0x40, 1, VISI)
45			VISI = Arg0
46
47			Return (PCKG)
48		}
49
50		// How many are there?
51		Device (PRT1) { Name (_ADR, 1) } // USB Port 0
52		Device (PRT2) { Name (_ADR, 2) } // USB Port 1
53		Device (PRT3) { Name (_ADR, 3) } // USB Port 2
54		Device (PRT4) { Name (_ADR, 4) } // USB Port 3
55		Device (PRT5) { Name (_ADR, 5) } // USB Port 4
56		Device (PRT6) { Name (_ADR, 6) } // USB Port 5
57	}
58}
59
60// EHCI #2 Controller 0:1a.0
61
62Device (EHC2)
63{
64	Name(_ADR, 0x001a0000)
65
66	Name (_PRW, Package(){ 13, 4 }) // Power Resources for Wake
67
68	// Leave USB ports on for to allow Wake from USB
69
70	Method(_S3D,0)	// Highest D State in S3 State
71	{
72		Return (2)
73	}
74
75	Method(_S4D,0)	// Highest D State in S4 State
76	{
77		Return (2)
78	}
79
80	Device (HUB7)
81	{
82		Name (_ADR, 0x00000000)
83
84		// GPLD: Generate Port Location Data (PLD)
85		Method (GPLD, 1, Serialized)
86		 {
87			Name (PCKG, Package (0x01)
88			{
89				Buffer (0x10) {}
90			})
91
92			// REV: Revision 0x02 for ACPI 5.0
93			CreateField (DerefOf (PCKG [0]), 0, 0x07, REV)
94			REV = 0x02
95
96			// VISI: Port visibility to user per port
97			CreateField (DerefOf (PCKG [0]), 0x40, 1, VISI)
98			VISI = Arg0
99
100			Return (PCKG)
101		}
102
103		// How many are there?
104		Device (PRT1) { Name (_ADR, 1) } // USB Port 0
105		Device (PRT2) { Name (_ADR, 2) } // USB Port 1
106		Device (PRT3) { Name (_ADR, 3) } // USB Port 2
107		Device (PRT4) { Name (_ADR, 4) } // USB Port 3
108		Device (PRT5) { Name (_ADR, 5) } // USB Port 4
109		Device (PRT6) { Name (_ADR, 6) } // USB Port 5
110	}
111}
112
113Device (XHC)
114{
115	Name(_ADR, 0x00140000)
116	OperationRegion(XDEV, PCI_Config, 0, 256)
117	Field(XDEV, DWordAcc, NoLock, Preserve)
118	{
119		Offset(0xD0),
120		X2PR, 32,	// XUSB2PR
121		PRM2, 32,	// XUSB2PRM
122		SSEN, 32,	// USB3_PSSEN
123		RPM3, 32,	// USB3PRM
124		XPRT, 32,	// XHCI Ports
125	}
126
127	Name (_PRW, Package(){ 13, 4 }) // Power Resources for Wake
128
129	Method(POSC,2,Serialized)
130	{
131	/*
132	 * Arg0 - An Integer containing a count of entries in Arg3
133	 * Arg1 - A Buffer containing a list of DWORD capabilities
134	 */
135
136		// Create DWord field from the Capabilities Buffer
137		CreateDWordField(Arg1,0,CDW1)
138
139		// Check revision
140		If(Arg0 != 1) {
141			// Set unknown revision bit
142			CDW1 |= 8
143		}
144
145		// Set failure if xHCI is disabled by coreboot
146		If(XHCI == 0) {
147			CDW1 |= 2
148		}
149
150		// Query flag clear and xHCI in auto mode
151		If(!(CDW1 & 0x1) && (XHCI == 2 || XHCI  == 3)) {
152			Printf ("XHCI Switch")
153			Local0 = 0
154			Local0 = XPRT & 0x03
155			If(Local0 == 0 || Local0 == 1) {
156				Local1 = 0x0f
157			}
158			ElseIf(Local0 == 2) {
159				Local1 = 3
160			}
161			ElseIf(Local0 == 3) {
162				Local1 = 0
163			}
164			Local0 = RPM3 & 0xfffffff0
165			RPM3 = Local0 | Local1
166			Local0 = PRM2 & 0xfffffff0
167			PRM2 = Local0 | Local1
168			Local0 = SSEN & 0xfffffff0
169			SSEN = Local0 | Local1
170			Local0 = X2PR & 0xfffffff0
171			X2PR = Local0 | Local1
172		}
173		Return(Arg1)
174	}
175
176	// Leave USB ports on for to allow Wake from USB
177	Method(_S3D,0)	// Highest D State in S3 State
178	{
179		Return (2)
180	}
181
182	Method(_S4D,0)	// Highest D State in S4 State
183	{
184		Return (2)
185	}
186}
187