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