PrmAcpiTable.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /** @file
  2. Definition for the Platform Runtime Mechanism (PRM) ACPI table (PRMT).
  3. Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
  4. Copyright (c) Microsoft Corporation
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #ifndef PRMT_ACPI_TABLE_H_
  8. #define PRMT_ACPI_TABLE_H_
  9. #include <Base.h>
  10. #include <IndustryStandard/Acpi10.h>
  11. #define PRM_TABLE_SIGNATURE SIGNATURE_32 ('P', 'R', 'M', 'T')
  12. #define PRM_TABLE_REVISION 0x0
  13. #define PRM_MODULE_INFORMATION_STRUCT_REVISION 0x00
  14. #define PRM_HANDLER_INFORMATION_STRUCT_REVISION 0x00
  15. #pragma pack(push, 1)
  16. //
  17. // Platform Runtime Mechanism (PRM) ACPI Table (PRMT) structures
  18. //
  19. typedef struct {
  20. UINT16 StructureRevision; ///< Revision of this structure
  21. UINT16 StructureLength; ///< Length in bytes of this structure
  22. GUID Identifier; ///< GUID of the PRM handler for this structure
  23. UINT64 PhysicalAddress; ///< Physical address of this PRM handler
  24. UINT64 StaticDataBuffer; ///< Physical address of the static data buffer for
  25. ///< this PRM handler (PRM_DATA_BUFFER *)
  26. UINT64 AcpiParameterBuffer; ///< Physical address of the parameter buffer
  27. ///< for this PRM handler (PRM_DATA_BUFFER *)
  28. ///< that is only used in the case of _DSM invocation.
  29. ///< If _DSM invocation is not used, this value is
  30. ///< ignored.
  31. } PRM_HANDLER_INFORMATION_STRUCT;
  32. typedef struct {
  33. UINT16 StructureRevision; ///< Revision of this structure
  34. UINT16 StructureLength; ///< Length in bytes of this structure including the
  35. ///< variable length PRM Handler Info array
  36. GUID Identifier; ///< GUID of the PRM module for this structure
  37. UINT16 MajorRevision; ///< PRM module major revision
  38. UINT16 MinorRevision; ///< PRM module minor revision
  39. UINT16 HandlerCount; ///< Number of entries in the Handler Info array
  40. UINT32 HandlerInfoOffset; ///< Offset in bytes from the beginning of this
  41. ///< structure to the Handler Info array
  42. UINT64 RuntimeMmioRanges; ///< Physical address of the PRM MMIO Ranges
  43. ///< structure (PRM_MODULE_RUNTIME_MMIO_RANGES *)
  44. PRM_HANDLER_INFORMATION_STRUCT HandlerInfoStructure[1];
  45. } PRM_MODULE_INFORMATION_STRUCT;
  46. typedef struct {
  47. EFI_ACPI_DESCRIPTION_HEADER Header; ///< Standard ACPI description header
  48. GUID PrmPlatformGuid; ///< A GUID that uniquely identifies this platform.
  49. ///< Used to check for compatibility in PRM module
  50. ///< runtime updates.
  51. UINT32 PrmModuleInfoOffset; ///< Offset in bytes from the beginning of this
  52. ///< structure to the PRM Module Info array
  53. UINT32 PrmModuleInfoCount; ///< Number of entries in the PRM Module Info array
  54. PRM_MODULE_INFORMATION_STRUCT PrmModuleInfoStructure[1];
  55. } PRM_ACPI_DESCRIPTION_TABLE;
  56. #pragma pack(pop)
  57. //
  58. // Helper macros to build PRM Information structures
  59. //
  60. // Todo: Revisit whether to use; currently both macros are not used
  61. //
  62. #define PRM_MODULE_INFORMATION_STRUCTURE(ModuleGuid, ModuleRevision, HandlerCount, PrmHanderInfoStructureArray) { \
  63. { \
  64. PRM_MODULE_INFORMATION_STRUCT_REVISION, /* UINT16 StructureRevision; */ \
  65. (OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure) + (HandlerCount * sizeof (PRM_HANDLER_INFORMATION_STRUCT))) /* UINT16 StructureLength; */ \
  66. ModuleGuid, /* GUID ModuleGuid; */ \
  67. ModuleRevision, /* UINT16 ModuleRevision */ \
  68. HandlerCount, /* UINT16 HandlerCount */ \
  69. OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoOffset), /* UINT32 HandlerInfoOffset */ \
  70. PrmHanderInfoStructureArray /* PRM_HANDLER_INFORMATION_STRUCT HandlerInfoStructure */ \
  71. } \
  72. }
  73. #define PRM_HANDLER_INFORMATION_STRUCTURE(HandlerGuid, PhysicalAddress) { \
  74. { \
  75. PRM_HANDLER_INFORMATION_STRUCT_REVISION, /* UINT16 StructureRevision; */ \
  76. sizeof (PRM_HANDLER_INFORMATION_STRUCT), /* UINT16 StructureLength; */ \
  77. HandlerGuid, /* GUID HandlerGuid; */ \
  78. PhysicalAddress, /* UINT64 PhysicalAddress */ \
  79. } \
  80. }
  81. #endif // _PRMT_ACPI_TABLE_H_