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