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