]> git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/Tcg/TcgSmm/Tpm.asl
SecurityPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / SecurityPkg / Tcg / TcgSmm / Tpm.asl
1 /** @file
2 The TPM definition block in ACPI table for physical presence
3 and MemoryClear.
4
5 Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 DefinitionBlock (
11 "Tpm.aml",
12 "SSDT",
13 2,
14 "INTEL ",
15 "TcgTable",
16 0x1000
17 )
18 {
19 Scope (\_SB)
20 {
21 Device (TPM)
22 {
23 //
24 // Define _HID, "PNP0C31" is defined in
25 // "Secure Startup-FVE and TPM Admin BIOS and Platform Requirements"
26 //
27 Name (_HID, EISAID ("PNP0C31"))
28
29 //
30 // Readable name of this device, don't know if this way is correct yet
31 //
32 Name (_STR, Unicode ("TPM 1.2 Device"))
33
34 //
35 // Return the resource consumed by TPM device
36 //
37 Name (_CRS, ResourceTemplate () {
38 Memory32Fixed (ReadWrite, 0xfed40000, 0x5000)
39 })
40
41 //
42 // Operational region for Smi port access
43 //
44 OperationRegion (SMIP, SystemIO, 0xB2, 1)
45 Field (SMIP, ByteAcc, NoLock, Preserve)
46 {
47 IOB2, 8
48 }
49
50 //
51 // Operational region for TPM access
52 //
53 OperationRegion (TPMR, SystemMemory, 0xfed40000, 0x5000)
54 Field (TPMR, AnyAcc, NoLock, Preserve)
55 {
56 ACC0, 8,
57 }
58
59 //
60 // Operational region for TPM support, TPM Physical Presence and TPM Memory Clear
61 // Region Offset 0xFFFF0000 and Length 0xF0 will be fixed in C code.
62 //
63 OperationRegion (TNVS, SystemMemory, 0xFFFF0000, 0xF0)
64 Field (TNVS, AnyAcc, NoLock, Preserve)
65 {
66 PPIN, 8, // Software SMI for Physical Presence Interface
67 PPIP, 32, // Used for save physical presence paramter
68 PPRP, 32, // Physical Presence request operation response
69 PPRQ, 32, // Physical Presence request operation
70 LPPR, 32, // Last Physical Presence request operation
71 FRET, 32, // Physical Presence function return code
72 MCIN, 8, // Software SMI for Memory Clear Interface
73 MCIP, 32, // Used for save the Mor paramter
74 MORD, 32, // Memory Overwrite Request Data
75 MRET, 32, // Memory Overwrite function return code
76 UCRQ, 32 // Phyical Presence request operation to Get User Confirmation Status
77 }
78
79 Method (PTS, 1, Serialized)
80 {
81 //
82 // Detect Sx state for MOR, only S4, S5 need to handle
83 //
84 If (LAnd (LLess (Arg0, 6), LGreater (Arg0, 3)))
85 {
86 //
87 // Bit4 -- DisableAutoDetect. 0 -- Firmware MAY autodetect.
88 //
89 If (LNot (And (MORD, 0x10)))
90 {
91 //
92 // Trigger the SMI through ACPI _PTS method.
93 //
94 Store (0x02, MCIP)
95
96 //
97 // Trigger the SMI interrupt
98 //
99 Store (MCIN, IOB2)
100 }
101 }
102 Return (0)
103 }
104
105 Method (_STA, 0)
106 {
107 if (LEqual (ACC0, 0xff))
108 {
109 Return (0)
110 }
111 Return (0x0f)
112 }
113
114 //
115 // TCG Hardware Information
116 //
117 Method (HINF, 1, Serialized, 0, {BuffObj, PkgObj}, {UnknownObj}) // IntObj
118 {
119 //
120 // Switch by function index
121 //
122 Switch (ToInteger(Arg0))
123 {
124 Case (0)
125 {
126 //
127 // Standard query
128 //
129 Return (Buffer () {0x03})
130 }
131 Case (1)
132 {
133 //
134 // Return failure if no TPM present
135 //
136 Name(TPMV, Package () {0x01, Package () {0x1, 0x20}})
137 if (LEqual (_STA (), 0x00))
138 {
139 Return (Package () {0x00})
140 }
141
142 //
143 // Return TPM version
144 //
145 Return (TPMV)
146 }
147 Default {BreakPoint}
148 }
149 Return (Buffer () {0})
150 }
151
152 Name(TPM2, Package (0x02){
153 Zero,
154 Zero
155 })
156
157 Name(TPM3, Package (0x03){
158 Zero,
159 Zero,
160 Zero
161 })
162
163 //
164 // TCG Physical Presence Interface
165 //
166 Method (TPPI, 2, Serialized, 0, {BuffObj, PkgObj, IntObj, StrObj}, {UnknownObj, UnknownObj}) // IntObj, PkgObj
167 {
168 //
169 // Switch by function index
170 //
171 Switch (ToInteger(Arg0))
172 {
173 Case (0)
174 {
175 //
176 // Standard query, supports function 1-8
177 //
178 Return (Buffer () {0xFF, 0x01})
179 }
180 Case (1)
181 {
182 //
183 // a) Get Physical Presence Interface Version
184 //
185 Return ("1.2")
186 }
187 Case (2)
188 {
189 //
190 // b) Submit TPM Operation Request to Pre-OS Environment
191 //
192
193 Store (DerefOf (Index (Arg1, 0x00)), PPRQ)
194 Store (0x02, PPIP)
195
196 //
197 // Trigger the SMI interrupt
198 //
199 Store (PPIN, IOB2)
200 Return (FRET)
201
202
203 }
204 Case (3)
205 {
206 //
207 // c) Get Pending TPM Operation Requested By the OS
208 //
209
210 Store (PPRQ, Index (TPM2, 0x01))
211 Return (TPM2)
212 }
213 Case (4)
214 {
215 //
216 // d) Get Platform-Specific Action to Transition to Pre-OS Environment
217 //
218 Return (2)
219 }
220 Case (5)
221 {
222 //
223 // e) Return TPM Operation Response to OS Environment
224 //
225 Store (0x05, PPIP)
226
227 //
228 // Trigger the SMI interrupt
229 //
230 Store (PPIN, IOB2)
231
232 Store (LPPR, Index (TPM3, 0x01))
233 Store (PPRP, Index (TPM3, 0x02))
234
235 Return (TPM3)
236 }
237 Case (6)
238 {
239
240 //
241 // f) Submit preferred user language (Not implemented)
242 //
243
244 Return (3)
245
246 }
247 Case (7)
248 {
249 //
250 // g) Submit TPM Operation Request to Pre-OS Environment 2
251 //
252 Store (7, PPIP)
253 Store (DerefOf (Index (Arg1, 0x00)), PPRQ)
254
255 //
256 // Trigger the SMI interrupt
257 //
258 Store (PPIN, IOB2)
259 Return (FRET)
260 }
261 Case (8)
262 {
263 //
264 // e) Get User Confirmation Status for Operation
265 //
266 Store (8, PPIP)
267 Store (DerefOf (Index (Arg1, 0x00)), UCRQ)
268
269 //
270 // Trigger the SMI interrupt
271 //
272 Store (PPIN, IOB2)
273
274 Return (FRET)
275 }
276
277 Default {BreakPoint}
278 }
279 Return (1)
280 }
281
282 Method (TMCI, 2, Serialized, 0, IntObj, {UnknownObj, UnknownObj}) // IntObj, PkgObj
283 {
284 //
285 // Switch by function index
286 //
287 Switch (ToInteger (Arg0))
288 {
289 Case (0)
290 {
291 //
292 // Standard query, supports function 1-1
293 //
294 Return (Buffer () {0x03})
295 }
296 Case (1)
297 {
298 //
299 // Save the Operation Value of the Request to MORD (reserved memory)
300 //
301 Store (DerefOf (Index (Arg1, 0x00)), MORD)
302
303 //
304 // Trigger the SMI through ACPI _DSM method.
305 //
306 Store (0x01, MCIP)
307
308 //
309 // Trigger the SMI interrupt
310 //
311 Store (MCIN, IOB2)
312 Return (MRET)
313 }
314 Default {BreakPoint}
315 }
316 Return (1)
317 }
318
319 Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj})
320 {
321
322 //
323 // TCG Hardware Information
324 //
325 If(LEqual(Arg0, ToUUID ("cf8e16a5-c1e8-4e25-b712-4f54a96702c8")))
326 {
327 Return (HINF (Arg2))
328 }
329
330 //
331 // TCG Physical Presence Interface
332 //
333 If(LEqual(Arg0, ToUUID ("3dddfaa6-361b-4eb4-a424-8d10089d1653")))
334 {
335 Return (TPPI (Arg2, Arg3))
336 }
337
338 //
339 // TCG Memory Clear Interface
340 //
341 If(LEqual(Arg0, ToUUID ("376054ed-cc13-4675-901c-4756d7f2d45d")))
342 {
343 Return (TMCI (Arg2, Arg3))
344 }
345
346 Return (Buffer () {0})
347 }
348 }
349 }
350 }