Prm.asl 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /** @file
  2. The definition block in ACPI table for PRM Operation Region
  3. Copyright (c) 2020-2021, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. DefinitionBlock (
  7. "Prm.aml",
  8. "SSDT",
  9. 2,
  10. "OEMID ",
  11. "PRMOPREG",
  12. 0x1000
  13. )
  14. {
  15. Scope (\_SB)
  16. {
  17. //
  18. // PRM Test Device
  19. //
  20. Device (PRMT)
  21. {
  22. Name (_HID, "80860223")
  23. Name (_CID, EisaId ("PNP0C02"))
  24. Name (_DDN, "PRM Test Device")
  25. //PRM operation region format
  26. OperationRegion (PRMR, PlatformRtMechanism, 0, 1)
  27. Field (PRMR, BufferAcc, NoLock, Preserve) //Make it ByteAcc for parameter validation
  28. {
  29. PRMF, 8
  30. }
  31. /*
  32. * Control method to invoke PRM OperationRegion handler
  33. * Arg0 contains a buffer representing a _DSM GUID
  34. */
  35. Method (RUNS, 1)
  36. {
  37. /* Local0 is the PRM data buffer */
  38. Local0 = buffer (26){}
  39. /* Create byte fields over the buffer */
  40. CreateByteField (Local0, 0x0, PSTA)
  41. CreateQWordField (Local0, 0x1, USTA)
  42. CreateByteField (Local0, 0x9, CMD)
  43. CreateField (Local0, 0x50, 0x80, GUID)
  44. /* Fill in the command and data fields of the data buffer */
  45. CMD = 0 // run command
  46. GUID = Arg0
  47. /* Invoke PRM OperationRegion Handler and store the result into Local0 */
  48. Local0 = (PRMF = Local0)
  49. /* Return status */
  50. Return (PSTA)
  51. }
  52. /*
  53. * Control method to lock a PRM transaction
  54. * Arg0 contains a buffer representing a _DSM GUID
  55. */
  56. Method (LCKH, 1)
  57. {
  58. /* Local0 is the PRM data buffer */
  59. Local0 = buffer (26){}
  60. /* Create byte fields over the buffer */
  61. CreateByteField (Local0, 0x0, STAT)
  62. CreateByteField (Local0, 0x9, CMD)
  63. CreateField (Local0, 0x50, 0x80, GUID)
  64. CMD = 1 // Lock command
  65. GUID = Arg0
  66. Local0 = (PRMF = Local0)
  67. /* Note STAT contains the return status */
  68. Return (STAT)
  69. }
  70. /*
  71. * Control method to unlock a PRM transaction
  72. * Arg0 contains a buffer representing a _DSM GUID
  73. */
  74. Method (ULCK, 1)
  75. {
  76. /* Local0 is the PRM data buffer */
  77. Local0 = buffer (26){}
  78. /* Create byte fields over the buffer */
  79. CreateByteField (Local0, 0x0, STAT)
  80. CreateByteField (Local0, 0x9, CMD)
  81. CreateField (Local0, 0x50, 0x80, GUID)
  82. CMD = 2 // Unlock command
  83. GUID = Arg0
  84. Local0 = (PRMF = Local0)
  85. /* Note STAT contains the return status */
  86. Return (STAT)
  87. }
  88. /*
  89. *Bit [0] Set if the device is present.
  90. *Bit [1] Set if the device is enabled and decoding its resources.
  91. *Bit [2] Set if the device should be shown in the UI.
  92. *Bit [3] Set if the device is functioning properly (cleared if device failed its diagnostics).
  93. */
  94. Method (_STA, 0, NotSerialized)
  95. {
  96. Return (0x0B) // Device present, but not shown
  97. }
  98. }
  99. }
  100. }