summaryrefslogtreecommitdiffstats
path: root/PrmPkg/PrmSsdtInstallDxe/Prm.asl
blob: c4c406e93e2f4b8041d6213229b043f62225a986 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/** @file
  The definition block in ACPI table for PRM Operation Region

  Copyright (c) 2020-2021, Intel Corporation. All rights reserved.<BR>
  SPDX-License-Identifier: BSD-2-Clause-Patent
**/

DefinitionBlock (
    "Prm.aml",
    "SSDT",
    2,
    "OEMID ",
    "PRMOPREG",
    0x1000
    )
{
    Scope (\_SB)
    {
        //
        // PRM Test Device
        //
        Device (PRMT)
        {
            Name (_HID, "80860223")
            Name (_CID, EisaId ("PNP0C02"))
            Name (_DDN, "PRM Test Device")

            //PRM operation region format
            OperationRegion (PRMR, PlatformRtMechanism, 0, 1)
            Field (PRMR, BufferAcc, NoLock, Preserve) //Make it ByteAcc for parameter validation
            {
                PRMF, 8
            }

            /*
            * Control method to invoke PRM OperationRegion handler
            * Arg0 contains a buffer representing a _DSM GUID
            */
            Method (RUNS, 1)
            {
                /* 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)
            {
                /* 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)
            {
                /* 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
            }
        }
    }
}