]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
SecurityPkg: Tcg2Smm: Enable TPM2.0 interrupt support
[mirror_edk2.git] / SecurityPkg / Tcg / Tcg2Smm / Tpm.asl
index f52830545eda709baf7c7d1e4303d1e8d402eb5d..f58efca1443de177d451849b29ccf5535fa5c139 100644 (file)
@@ -2,7 +2,7 @@
   The TPM2 definition block in ACPI table for TCG2 physical presence  \r
   and MemoryClear.\r
 \r
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
 (c)Copyright 2016 HP Development Company, L.P.<BR>\r
 Copyright (c) 2017, Microsoft Corporation.  All rights reserved. <BR>\r
 This program and the accompanying materials \r
@@ -92,20 +92,59 @@ DefinitionBlock (
         MCIP,   32, //   Used for save the Mor paramter\r
         MORD,   32, //   Memory Overwrite Request Data\r
         MRET,   32, //   Memory Overwrite function return code\r
-        UCRQ,   32  //   Phyical Presence request operation to Get User Confirmation Status \r
+        UCRQ,   32, //   Phyical Presence request operation to Get User Confirmation Status\r
+        IRQN,   32, //   IRQ Number for _CRS\r
+        SFRB,   8   //   Is shortformed Pkglength for resource buffer\r
       }\r
 \r
-      Name(RESO, ResourceTemplate () {\r
-        Memory32Fixed (ReadWrite, 0xfed40000, 0x5000, REGS)\r
+      //\r
+      // Possible resource settings returned by  _PRS method\r
+      //   RESS : ResourceTemplate with PkgLength <=63\r
+      //   RESL : ResourceTemplate with PkgLength > 63\r
+      //\r
+      // The format of the data has to follow the same format as\r
+      // _CRS (according to ACPI spec).\r
+      //\r
+      Name (RESS, ResourceTemplate() {\r
+        Memory32Fixed (ReadWrite, 0xfed40000, 0x5000)\r
+        Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , ) {1,2,3,4,5,6,7,8,9,10}\r
+      })\r
+\r
+      Name (RESL, ResourceTemplate() {\r
+        Memory32Fixed (ReadWrite, 0xfed40000, 0x5000)\r
+        Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , ) {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}\r
+      })\r
+\r
+      //\r
+      // Current resource settings for _CRS method\r
+      //\r
+      Name(RES0, ResourceTemplate () {\r
+        Memory32Fixed (ReadWrite, 0xfed40000, 0x5000, REG0)\r
         Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , INTR) {12}\r
       })\r
 \r
+      Name(RES1, ResourceTemplate () {\r
+        Memory32Fixed (ReadWrite, 0xfed40000, 0x5000, REG1)\r
+      })\r
+\r
+\r
       //\r
       // Return the resource consumed by TPM device.\r
       //\r
       Method(_CRS,0,Serialized)\r
       {\r
-        Return(RESO)\r
+        //\r
+        // IRQNum = 0 means disable IRQ support\r
+        //\r
+        If (LEqual(IRQN, 0)) {\r
+          Return (RES1)\r
+        }\r
+        Else\r
+        {\r
+          CreateDWordField(RES0, ^INTR._INT, LIRQ)\r
+          Store(IRQN, LIRQ)\r
+          Return (RES0)\r
+        }\r
       }\r
 \r
       //\r
@@ -113,23 +152,34 @@ DefinitionBlock (
       // assign an interrupt number to the device. The input byte stream\r
       // has to be the same as returned by _CRS (according to ACPI spec).\r
       //\r
+      // Platform may choose to override this function with specific interrupt\r
+      // programing logic to replace FIFO/TIS SIRQ registers programing\r
+      //\r
       Method(_SRS,1,Serialized)\r
       {\r
+        //\r
+        // Do not configure Interrupt if IRQ Num is configured 0 by default\r
+        //\r
+        If (LEqual(IRQN, 0)) {\r
+          Return (0)\r
+        }\r
+\r
         //\r
         // Update resource descriptor\r
         // Use the field name to identify the offsets in the argument\r
-        // buffer and RESO buffer.\r
+        // buffer and RES0 buffer.\r
         //\r
         CreateDWordField(Arg0, ^INTR._INT, IRQ0)\r
-        CreateDWordField(RESO, ^INTR._INT, LIRQ)\r
+        CreateDWordField(RES0, ^INTR._INT, LIRQ)\r
         Store(IRQ0, LIRQ)\r
+        Store(IRQ0, IRQN)\r
 \r
         CreateBitField(Arg0, ^INTR._HE, ITRG)\r
-        CreateBitField(RESO, ^INTR._HE, LTRG)\r
+        CreateBitField(RES0, ^INTR._HE, LTRG)\r
         Store(ITRG, LTRG)\r
 \r
         CreateBitField(Arg0, ^INTR._LL, ILVL)\r
-        CreateBitField(RESO, ^INTR._LL, LLVL)\r
+        CreateBitField(RES0, ^INTR._LL, LLVL)\r
         Store(ILVL, LLVL)\r
 \r
         //\r
@@ -176,15 +226,25 @@ DefinitionBlock (
         }\r
       }\r
 \r
-      //\r
-      // Possible resource settings.\r
-      // The format of the data has to follow the same format as\r
-      // _CRS (according to ACPI spec).\r
-      //\r
-      Name (_PRS, ResourceTemplate() {\r
-        Memory32Fixed (ReadWrite, 0xfed40000, 0x5000)\r
-        Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , SIRQ) {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}\r
-      })\r
+      Method(_PRS,0,Serialized)\r
+      {\r
+        //\r
+        // IRQNum = 0 means disable IRQ support\r
+        //\r
+        If (LEqual(IRQN, 0)) {\r
+          Return (RES1)\r
+        } ElseIf(LEqual(SFRB, 0)) {\r
+          //\r
+          // Long format. Possible resources PkgLength > 63\r
+          //\r
+          Return (RESL)\r
+        } Else {\r
+          //\r
+          // Short format. Possible resources PkgLength <=63\r
+          //\r
+          Return (RESS)\r
+        }\r
+      }\r
 \r
       Method (PTS, 1, Serialized)\r
       {  \r