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 SPDX-License-Identifier: BSD-2-Clause-Patent
30 // TAG for patching TPM2.0 _HID
32 Name (_HID, "NNNN0000")
34 Name (_CID, "MSFT0101")
37 // Readable name of this device, don't know if this way is correct yet
39 Name (_STR, Unicode ("TPM 2.0 Device"))
42 // Operational region for Smi port access
44 OperationRegion (SMIP, SystemIO, 0xB2, 1)
45 Field (SMIP, ByteAcc, NoLock, Preserve)
51 // Operational region for TPM access
53 OperationRegion (TPMR, SystemMemory, 0xfed40000, 0x5000)
54 Field (TPMR, AnyAcc, NoLock, Preserve)
56 ACC0, 8, // TPM_ACCESS_0
58 INTE, 32, // TPM_INT_ENABLE_0
59 INTV, 8, // TPM_INT_VECTOR_0
61 INTS, 32, // TPM_INT_STATUS_0
62 INTF, 32, // TPM_INTF_CAPABILITY_0
63 STS0, 32, // TPM_STS_0
65 FIFO, 32, // TPM_DATA_FIFO_0
67 TID0, 32, // TPM_INTERFACE_ID_0
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.
75 OperationRegion (TNVS, SystemMemory, 0xFFFF0000, 0xF0)
76 Field (TNVS, AnyAcc, NoLock, Preserve)
78 PPIN, 8, // Software SMI for Physical Presence Interface
79 PPIP, 32, // Used for save physical presence parameter
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 parameter
87 MORD, 32, // Memory Overwrite Request Data
88 MRET, 32, // Memory Overwrite function return code
89 UCRQ, 32, // Physical Presence request operation to Get User Confirmation Status
90 IRQN, 32, // IRQ Number for _CRS
91 SFRB, 8 // Is shortformed Pkglength for resource buffer
95 // Possible resource settings returned by _PRS method
96 // RESS : ResourceTemplate with PkgLength <=63
97 // RESL : ResourceTemplate with PkgLength > 63
99 // The format of the data has to follow the same format as
100 // _CRS (according to ACPI spec).
102 Name (RESS, ResourceTemplate() {
103 Memory32Fixed (ReadWrite, 0xfed40000, 0x5000)
104 Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , ) {1,2,3,4,5,6,7,8,9,10}
107 Name (RESL, ResourceTemplate() {
108 Memory32Fixed (ReadWrite, 0xfed40000, 0x5000)
109 Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , ) {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
113 // Current resource settings for _CRS method
115 Name(RES0, ResourceTemplate () {
116 Memory32Fixed (ReadWrite, 0xfed40000, 0x5000, REG0)
117 Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , INTR) {12}
120 Name(RES1, ResourceTemplate () {
121 Memory32Fixed (ReadWrite, 0xfed40000, 0x5000, REG1)
126 // Return the resource consumed by TPM device.
128 Method(_CRS,0,Serialized)
131 // IRQNum = 0 means disable IRQ support
133 If (LEqual(IRQN, 0)) {
138 CreateDWordField(RES0, ^INTR._INT, LIRQ)
145 // Set resources consumed by the TPM device. This is used to
146 // assign an interrupt number to the device. The input byte stream
147 // has to be the same as returned by _CRS (according to ACPI spec).
149 // Platform may choose to override this function with specific interrupt
150 // programing logic to replace FIFO/TIS SIRQ registers programing
152 Method(_SRS,1,Serialized)
155 // Do not configure Interrupt if IRQ Num is configured 0 by default
157 If (LNotEqual(IRQN, 0)) {
159 // Update resource descriptor
160 // Use the field name to identify the offsets in the argument
161 // buffer and RES0 buffer.
163 CreateDWordField(Arg0, ^INTR._INT, IRQ0)
164 CreateDWordField(RES0, ^INTR._INT, LIRQ)
168 CreateBitField(Arg0, ^INTR._HE, ITRG)
169 CreateBitField(RES0, ^INTR._HE, LTRG)
172 CreateBitField(Arg0, ^INTR._LL, ILVL)
173 CreateBitField(RES0, ^INTR._LL, LLVL)
177 // Update TPM FIFO PTP/TIS interface only, identified by TPM_INTERFACE_ID_x lowest
179 // 0000 - FIFO interface as defined in PTP for TPM 2.0 is active
180 // 1111 - FIFO interface as defined in TIS1.3 is active
182 If (LOr(LEqual (And (TID0, 0x0F), 0x00), LEqual (And (TID0, 0x0F), 0x0F))) {
184 // If FIFO interface, interrupt vector register is
185 // available. TCG PTP specification allows only
186 // values 1..15 in this field. For other interrupts
187 // the field should stay 0.
189 If (LLess (IRQ0, 16)) {
190 Store (And(IRQ0, 0xF), INTV)
193 // Interrupt enable register (TPM_INT_ENABLE_x) bits 3:4
194 // contains settings for interrupt polarity.
195 // The other bits of the byte enable individual interrupts.
196 // They should be all be zero, but to avoid changing the
197 // configuration, the other bits are be preserved.
203 // ACPI spec definitions:
204 // _HE: '1' is Edge, '0' is Level
205 // _LL: '1' is ActiveHigh, '0' is ActiveLow (inverted from TCG spec)
207 If (LEqual (ITRG, 1)) {
208 Or(INTE, 0x00000010, INTE)
210 And(INTE, 0xFFFFFFEF, INTE)
212 if (LEqual (ILVL, 0)) {
213 Or(INTE, 0x00000008, INTE)
215 And(INTE, 0xFFFFFFF7, INTE)
221 Method(_PRS,0,Serialized)
224 // IRQNum = 0 means disable IRQ support
226 If (LEqual(IRQN, 0)) {
228 } ElseIf(LEqual(SFRB, 0)) {
230 // Long format. Possible resources PkgLength > 63
235 // Short format. Possible resources PkgLength <=63
241 Method (PTS, 1, Serialized)
244 // Detect Sx state for MOR, only S4, S5 need to handle
246 If (LAnd (LLess (Arg0, 6), LGreater (Arg0, 3)))
249 // Bit4 -- DisableAutoDetect. 0 -- Firmware MAY autodetect.
251 If (LNot (And (MORD, 0x10)))
254 // Trigger the SMI through ACPI _PTS method.
259 // Trigger the SMI interrupt
269 if (LEqual (ACC0, 0xff))
277 // TCG Hardware Information
279 Method (HINF, 1, Serialized, 0, {BuffObj, PkgObj}, {UnknownObj}) // IntObj
282 // Switch by function index
284 Switch (ToInteger(Arg0))
291 Return (Buffer () {0x03})
296 // Return failure if no TPM present
298 Name(TPMV, Package () {0x01, Package () {0x2, 0x0}})
299 if (LEqual (_STA (), 0x00))
301 Return (Package () {0x00})
305 // Return TPM version
311 Return (Buffer () {0})
314 Name(TPM2, Package (0x02){
319 Name(TPM3, Package (0x03){
326 // TCG Physical Presence Interface
328 Method (TPPI, 2, Serialized, 0, {BuffObj, PkgObj, IntObj, StrObj}, {UnknownObj, UnknownObj}) // IntObj, PkgObj
331 // Switch by function index
333 Switch (ToInteger(Arg0))
338 // Standard query, supports function 1-8
340 Return (Buffer () {0xFF, 0x01})
345 // a) Get Physical Presence Interface Version
352 // b) Submit TPM Operation Request to Pre-OS Environment
355 Store (DerefOf (Index (Arg1, 0x00)), PPRQ)
360 // Trigger the SMI interrupt
370 // c) Get Pending TPM Operation Requested By the OS
373 Store (PPRQ, Index (TPM2, 0x01))
379 // d) Get Platform-Specific Action to Transition to Pre-OS Environment
386 // e) Return TPM Operation Response to OS Environment
391 // Trigger the SMI interrupt
395 Store (LPPR, Index (TPM3, 0x01))
396 Store (PPRP, Index (TPM3, 0x02))
404 // f) Submit preferred user language (Not implemented)
413 // g) Submit TPM Operation Request to Pre-OS Environment 2
416 Store (DerefOf (Index (Arg1, 0x00)), PPRQ)
418 If (LEqual (PPRQ, 23)) {
419 Store (DerefOf (Index (Arg1, 0x01)), PPRM)
423 // Trigger the SMI interrupt
431 // e) Get User Confirmation Status for Operation
434 Store (DerefOf (Index (Arg1, 0x00)), UCRQ)
437 // Trigger the SMI interrupt
449 Method (TMCI, 2, Serialized, 0, IntObj, {UnknownObj, UnknownObj}) // IntObj, PkgObj
452 // Switch by function index
454 Switch (ToInteger (Arg0))
459 // Standard query, supports function 1-1
461 Return (Buffer () {0x03})
466 // Save the Operation Value of the Request to MORD (reserved memory)
468 Store (DerefOf (Index (Arg1, 0x00)), MORD)
471 // Trigger the SMI through ACPI _DSM method.
476 // Trigger the SMI interrupt
486 Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj})
490 // TCG Hardware Information
492 If(LEqual(Arg0, ToUUID ("cf8e16a5-c1e8-4e25-b712-4f54a96702c8")))
498 // TCG Physical Presence Interface
500 If(LEqual(Arg0, ToUUID ("3dddfaa6-361b-4eb4-a424-8d10089d1653")))
502 Return (TPPI (Arg2, Arg3))
506 // TCG Memory Clear Interface
508 If(LEqual(Arg0, ToUUID ("376054ed-cc13-4675-901c-4756d7f2d45d")))
510 Return (TMCI (Arg2, Arg3))
513 Return (Buffer () {0})