2 The TPM2 definition block in ACPI table for TCG2 physical presence
5 Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
6 (c)Copyright 2016 HP Development Company, L.P.<BR>
7 Copyright (c) 2017, Microsoft Corporation. All rights reserved. <BR>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
36 // TAG for patching TPM2.0 _HID
38 Name (_HID, "NNNN0000")
40 Name (_CID, "MSFT0101")
43 // Readable name of this device, don't know if this way is correct yet
45 Name (_STR, Unicode ("TPM 2.0 Device"))
48 // Operational region for Smi port access
50 OperationRegion (SMIP, SystemIO, 0xB2, 1)
51 Field (SMIP, ByteAcc, NoLock, Preserve)
57 // Operational region for TPM access
59 OperationRegion (TPMR, SystemMemory, 0xfed40000, 0x5000)
60 Field (TPMR, AnyAcc, NoLock, Preserve)
62 ACC0, 8, // TPM_ACCESS_0
64 INTE, 32, // TPM_INT_ENABLE_0
65 INTV, 8, // TPM_INT_VECTOR_0
67 INTS, 32, // TPM_INT_STATUS_0
68 INTF, 32, // TPM_INTF_CAPABILITY_0
69 STS0, 32, // TPM_STS_0
71 FIFO, 32, // TPM_DATA_FIFO_0
73 TID0, 32, // TPM_INTERFACE_ID_0
78 // Operational region for TPM support, TPM Physical Presence and TPM Memory Clear
79 // Region Offset 0xFFFF0000 and Length 0xF0 will be fixed in C code.
81 OperationRegion (TNVS, SystemMemory, 0xFFFF0000, 0xF0)
82 Field (TNVS, AnyAcc, NoLock, Preserve)
84 PPIN, 8, // Software SMI for Physical Presence Interface
85 PPIP, 32, // Used for save physical presence paramter
86 PPRP, 32, // Physical Presence request operation response
87 PPRQ, 32, // Physical Presence request operation
88 PPRM, 32, // Physical Presence request operation parameter
89 LPPR, 32, // Last Physical Presence request operation
90 FRET, 32, // Physical Presence function return code
91 MCIN, 8, // Software SMI for Memory Clear Interface
92 MCIP, 32, // Used for save the Mor paramter
93 MORD, 32, // Memory Overwrite Request Data
94 MRET, 32, // Memory Overwrite function return code
95 UCRQ, 32, // Phyical Presence request operation to Get User Confirmation Status
96 IRQN, 32, // IRQ Number for _CRS
97 SFRB, 8 // Is shortformed Pkglength for resource buffer
101 // Possible resource settings returned by _PRS method
102 // RESS : ResourceTemplate with PkgLength <=63
103 // RESL : ResourceTemplate with PkgLength > 63
105 // The format of the data has to follow the same format as
106 // _CRS (according to ACPI spec).
108 Name (RESS, ResourceTemplate() {
109 Memory32Fixed (ReadWrite, 0xfed40000, 0x5000)
110 Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , ) {1,2,3,4,5,6,7,8,9,10}
113 Name (RESL, ResourceTemplate() {
114 Memory32Fixed (ReadWrite, 0xfed40000, 0x5000)
115 Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , ) {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
119 // Current resource settings for _CRS method
121 Name(RES0, ResourceTemplate () {
122 Memory32Fixed (ReadWrite, 0xfed40000, 0x5000, REG0)
123 Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , INTR) {12}
126 Name(RES1, ResourceTemplate () {
127 Memory32Fixed (ReadWrite, 0xfed40000, 0x5000, REG1)
132 // Return the resource consumed by TPM device.
134 Method(_CRS,0,Serialized)
137 // IRQNum = 0 means disable IRQ support
139 If (LEqual(IRQN, 0)) {
144 CreateDWordField(RES0, ^INTR._INT, LIRQ)
151 // Set resources consumed by the TPM device. This is used to
152 // assign an interrupt number to the device. The input byte stream
153 // has to be the same as returned by _CRS (according to ACPI spec).
155 // Platform may choose to override this function with specific interrupt
156 // programing logic to replace FIFO/TIS SIRQ registers programing
158 Method(_SRS,1,Serialized)
161 // Do not configure Interrupt if IRQ Num is configured 0 by default
163 If (LNotEqual(IRQN, 0)) {
165 // Update resource descriptor
166 // Use the field name to identify the offsets in the argument
167 // buffer and RES0 buffer.
169 CreateDWordField(Arg0, ^INTR._INT, IRQ0)
170 CreateDWordField(RES0, ^INTR._INT, LIRQ)
174 CreateBitField(Arg0, ^INTR._HE, ITRG)
175 CreateBitField(RES0, ^INTR._HE, LTRG)
178 CreateBitField(Arg0, ^INTR._LL, ILVL)
179 CreateBitField(RES0, ^INTR._LL, LLVL)
183 // Update TPM FIFO PTP/TIS interface only, identified by TPM_INTERFACE_ID_x lowest
185 // 0000 - FIFO interface as defined in PTP for TPM 2.0 is active
186 // 1111 - FIFO interface as defined in TIS1.3 is active
188 If (LOr(LEqual (And (TID0, 0x0F), 0x00), LEqual (And (TID0, 0x0F), 0x0F))) {
190 // If FIFO interface, interrupt vector register is
191 // available. TCG PTP specification allows only
192 // values 1..15 in this field. For other interrupts
193 // the field should stay 0.
195 If (LLess (IRQ0, 16)) {
196 Store (And(IRQ0, 0xF), INTV)
199 // Interrupt enable register (TPM_INT_ENABLE_x) bits 3:4
200 // contains settings for interrupt polarity.
201 // The other bits of the byte enable individual interrupts.
202 // They should be all be zero, but to avoid changing the
203 // configuration, the other bits are be preserved.
209 // ACPI spec definitions:
210 // _HE: '1' is Edge, '0' is Level
211 // _LL: '1' is ActiveHigh, '0' is ActiveLow (inverted from TCG spec)
213 If (LEqual (ITRG, 1)) {
214 Or(INTE, 0x00000010, INTE)
216 And(INTE, 0xFFFFFFEF, INTE)
218 if (LEqual (ILVL, 0)) {
219 Or(INTE, 0x00000008, INTE)
221 And(INTE, 0xFFFFFFF7, INTE)
227 Method(_PRS,0,Serialized)
230 // IRQNum = 0 means disable IRQ support
232 If (LEqual(IRQN, 0)) {
234 } ElseIf(LEqual(SFRB, 0)) {
236 // Long format. Possible resources PkgLength > 63
241 // Short format. Possible resources PkgLength <=63
247 Method (PTS, 1, Serialized)
250 // Detect Sx state for MOR, only S4, S5 need to handle
252 If (LAnd (LLess (Arg0, 6), LGreater (Arg0, 3)))
255 // Bit4 -- DisableAutoDetect. 0 -- Firmware MAY autodetect.
257 If (LNot (And (MORD, 0x10)))
260 // Trigger the SMI through ACPI _PTS method.
265 // Trigger the SMI interrupt
275 if (LEqual (ACC0, 0xff))
283 // TCG Hardware Information
285 Method (HINF, 1, Serialized, 0, {BuffObj, PkgObj}, {UnknownObj}) // IntObj
288 // Switch by function index
290 Switch (ToInteger(Arg0))
297 Return (Buffer () {0x03})
302 // Return failure if no TPM present
304 Name(TPMV, Package () {0x01, Package () {0x2, 0x0}})
305 if (LEqual (_STA (), 0x00))
307 Return (Package () {0x00})
311 // Return TPM version
317 Return (Buffer () {0})
320 Name(TPM2, Package (0x02){
325 Name(TPM3, Package (0x03){
332 // TCG Physical Presence Interface
334 Method (TPPI, 2, Serialized, 0, {BuffObj, PkgObj, IntObj, StrObj}, {UnknownObj, UnknownObj}) // IntObj, PkgObj
337 // Switch by function index
339 Switch (ToInteger(Arg0))
344 // Standard query, supports function 1-8
346 Return (Buffer () {0xFF, 0x01})
351 // a) Get Physical Presence Interface Version
358 // b) Submit TPM Operation Request to Pre-OS Environment
361 Store (DerefOf (Index (Arg1, 0x00)), PPRQ)
366 // Trigger the SMI interrupt
376 // c) Get Pending TPM Operation Requested By the OS
379 Store (PPRQ, Index (TPM2, 0x01))
385 // d) Get Platform-Specific Action to Transition to Pre-OS Environment
392 // e) Return TPM Operation Response to OS Environment
397 // Trigger the SMI interrupt
401 Store (LPPR, Index (TPM3, 0x01))
402 Store (PPRP, Index (TPM3, 0x02))
410 // f) Submit preferred user language (Not implemented)
419 // g) Submit TPM Operation Request to Pre-OS Environment 2
422 Store (DerefOf (Index (Arg1, 0x00)), PPRQ)
424 If (LEqual (PPRQ, 23)) {
425 Store (DerefOf (Index (Arg1, 0x01)), PPRM)
429 // Trigger the SMI interrupt
437 // e) Get User Confirmation Status for Operation
440 Store (DerefOf (Index (Arg1, 0x00)), UCRQ)
443 // Trigger the SMI interrupt
455 Method (TMCI, 2, Serialized, 0, IntObj, {UnknownObj, UnknownObj}) // IntObj, PkgObj
458 // Switch by function index
460 Switch (ToInteger (Arg0))
465 // Standard query, supports function 1-1
467 Return (Buffer () {0x03})
472 // Save the Operation Value of the Request to MORD (reserved memory)
474 Store (DerefOf (Index (Arg1, 0x00)), MORD)
477 // Trigger the SMI through ACPI _DSM method.
482 // Trigger the SMI interrupt
492 Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj})
496 // TCG Hardware Information
498 If(LEqual(Arg0, ToUUID ("cf8e16a5-c1e8-4e25-b712-4f54a96702c8")))
504 // TCG Physical Presence Interface
506 If(LEqual(Arg0, ToUUID ("3dddfaa6-361b-4eb4-a424-8d10089d1653")))
508 Return (TPPI (Arg2, Arg3))
512 // TCG Memory Clear Interface
514 If(LEqual(Arg0, ToUUID ("376054ed-cc13-4675-901c-4756d7f2d45d")))
516 Return (TMCI (Arg2, Arg3))
519 Return (Buffer () {0})