[edk2-devel] [PATCH v1 33/41] PrmPkg: Update PRM OpRegion

Michael Kubacki mikuback at linux.microsoft.com
Tue Mar 22 16:19:39 UTC 2022


From: Liu Yun Y <yun.y.liu at intel.com>

1. Enable new PRM OpRegion structure
2. Add PRM Handler Update Lock/Unlock support

Cc: Andrew Fish <afish at apple.com>
Cc: Kang Gao <kang.gao at intel.com>
Cc: Michael D Kinney <michael.d.kinney at intel.com>
Cc: Michael Kubacki <michael.kubacki at microsoft.com>
Cc: Leif Lindholm <leif at nuviainc.com>
Cc: Benjamin You <benjamin.you at intel.com>
Cc: Liu Yun <yun.y.liu at intel.com>
Cc: Ankit Sinha <ankit.sinha at intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone at intel.com>
Signed-off-by: Liu Yun <yun.y.liu at intel.com>
---
 PrmPkg/PrmSsdtInstallDxe/Prm.asl | 131 +++++++++++++-------
 1 file changed, 88 insertions(+), 43 deletions(-)

diff --git a/PrmPkg/PrmSsdtInstallDxe/Prm.asl b/PrmPkg/PrmSsdtInstallDxe/Prm.asl
index 0457d09e6954..20a6fef9be7b 100644
--- a/PrmPkg/PrmSsdtInstallDxe/Prm.asl
+++ b/PrmPkg/PrmSsdtInstallDxe/Prm.asl
@@ -1,7 +1,7 @@
 /** @file
   The definition block in ACPI table for PRM Operation Region
 
-  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2020-2021, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -16,60 +16,105 @@ DefinitionBlock (
 {
     Scope (\_SB)
     {
-        //
-        // PRM Bridge Device
-        //
-
-        Device (PRMB)
-        {
-            Name (_HID, "80860222")
-            Name (_CID, "80860222")
-            Name (_DDN, "PRM Bridge Device")
-            Name (_STA, 0xF)
-            OperationRegion (OPR1, 0x80, 0, 16)
-            Field (OPR1, DWordAcc, NoLock, Preserve) //Make it ByteAcc for parameter validation
-            {
-                Var0, 128
-            }
-            Method (SETV, 1, Serialized)
-            {
-                CopyObject (Arg0, \_SB.PRMB.Var0)
-            }
-        }
-
         //
         // PRM Test Device
         //
-
         Device (PRMT)
         {
             Name (_HID, "80860223")
             Name (_CID, "80860223")
             Name (_DDN, "PRM Test Device")
-            Name (_STA, 0xF)
-            Name (BUF1, Buffer(16)
+
+            // PrmSamplePrintModule handler GUIDs
+            Name (BUF1, ToUUID("d5f2ad5f-a347-4d3e-87bc-c2ce63029cc8"))
+            Name (BUF2, ToUUID("a9e7adc3-8cd0-429a-8915-10946ebde318"))
+            Name (BUFN, ToUUID("b688c214-4081-4eeb-8d26-1eb5a3bcf11a"))
+
+            //PRM operation region format
+            OperationRegion (PRMR, PlatformRtMechanism, 0, 1)
+            Field (PRMR, BufferAcc, NoLock, Preserve) //Make it ByteAcc for parameter validation
             {
-                0x5F, 0xAD, 0xF2, 0xD5, 0x47, 0xA3, 0x3E, 0x4D, //Guid_0
-                0x87, 0xBC, 0xC2, 0xCE, 0x63, 0x02, 0x9C, 0xC8, //Guid_1
-            })
-            Name (BUF2, Buffer(16)
+                PRMF, 8
+            }
+
+            /*
+            * Control method to invoke PRM OperationRegion handler
+            * Arg0 contains a buffer representing a _DSM GUID
+            */
+            Method (RUNS, 1)
             {
-                0xC3, 0xAD, 0xE7, 0xA9, 0xD0, 0x8C, 0x9A, 0x42, //Guid_0
-                0x89, 0x15, 0x10, 0x94, 0x6E, 0xBD, 0xE3, 0x18, //Guid_1
-            })
-            Name (BUF3, Buffer(16)
+                /* Local0 is the PRM data buffer */
+                Local0 = buffer (26){}
+
+                /* Create byte fields over the buffer */
+                CreateByteField (Local0, 0x0, PSTA)
+                CreateQWordField (Local0, 0x1, USTA)
+                CreateByteField (Local0, 0x9, CMD)
+                CreateField (Local0, 0x50, 0x80, GUID)
+
+                /* Fill in the command and data fields of the data buffer */
+                CMD = 0 // run command
+                GUID = Arg0
+
+                /* Invoke PRM OperationRegion Handler and store the result into Local0 */
+                Local0 = (PRMF = Local0)
+
+                /* Return status */
+                Return (PSTA)
+            }
+
+            /*
+            * Control method to lock a PRM transaction
+            * Arg0 contains a buffer representing a _DSM GUID
+            */
+            Method (LCKH, 1)
             {
-                0x14, 0xC2, 0x88, 0xB6, 0x81, 0x40, 0xEB, 0x4E, //Guid_0
-                0x8D, 0x26, 0x1E, 0xB5, 0xA3, 0xBC, 0xF1, 0x1A, //Guid_1
-            })
-            Method (NTST)
+                /* Local0 is the PRM data buffer */
+                Local0 = buffer (26){}
+
+                /* Create byte fields over the buffer */
+                CreateByteField (Local0, 0x0, STAT)
+                CreateByteField (Local0, 0x9, CMD)
+                CreateField (Local0, 0x50, 0x80, GUID)
+                CMD = 1 // Lock command
+                GUID = Arg0
+                Local0 = (PRMF = Local0)
+
+                /* Note STAT contains the return status */
+                Return (STAT)
+            }
+
+            /*
+            * Control method to unlock a PRM transaction
+            * Arg0 contains a buffer representing a _DSM GUID
+            */
+            Method (ULCK, 1)
             {
-                \_SB.PRMB.SETV (BUF1)
+                /* Local0 is the PRM data buffer */
+                Local0 = buffer (26){}
+
+                /* Create byte fields over the buffer */
+                CreateByteField (Local0, 0x0, STAT)
+                CreateByteField (Local0, 0x9, CMD)
+                CreateField (Local0, 0x50, 0x80, GUID)
+                CMD = 2 // Unlock command
+                GUID = Arg0
+                Local0 = (PRMF = Local0)
+
+               /* Note STAT contains the return status */
+                Return (STAT)
+            }
+
+            /*
+            *Bit [0] Set if the device is present.
+            *Bit [1] Set if the device is enabled and decoding its resources.
+            *Bit [2] Set if the device should be shown in the UI.
+            *Bit [3] Set if the device is functioning properly (cleared if device failed its diagnostics).
+            */
+            Method (_STA, 0, NotSerialized)
+            {
+                Return (0x0B) // Device present, but not shown
             }
         }
     }
-
-} // End of Definition Block
-
-
-
+}
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87875): https://edk2.groups.io/g/devel/message/87875
Mute This Topic: https://groups.io/mt/89956040/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list