oprgnos.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /*++
  2. Copyright (c) 2012 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. oprgnos.h
  9. Abstract:
  10. This header contains definitions for operating system support of ACPI
  11. Operation Regions.
  12. Author:
  13. Evan Green 17-Nov-2012
  14. --*/
  15. //
  16. // ------------------------------------------------------------------- Includes
  17. //
  18. //
  19. // ---------------------------------------------------------------- Definitions
  20. //
  21. #define ACPI_OS_ALLOCATION_TAG 0x4F6C6D41 // 'OlmA'
  22. //
  23. // ------------------------------------------------------ Data Type Definitions
  24. //
  25. typedef enum _ACPI_OPERATION_REGION_SPACE {
  26. OperationRegionSystemMemory = 0,
  27. OperationRegionSystemIo = 1,
  28. OperationRegionPciConfig = 2,
  29. OperationRegionEmbeddedController = 3,
  30. OperationRegionSmBus = 4,
  31. OperationRegionCmos = 5,
  32. OperationRegionPciBarTarget = 6,
  33. OperationRegionIpmi = 7,
  34. OperationRegionCount
  35. } ACPI_OPERATION_REGION_SPACE, *PACPI_OPERATION_REGION_SPACE;
  36. typedef
  37. KSTATUS
  38. (*PACPI_OPERATION_REGION_CREATE) (
  39. PVOID AcpiObject,
  40. ULONGLONG Offset,
  41. ULONGLONG Length,
  42. PVOID *OsContext
  43. );
  44. /*++
  45. Routine Description:
  46. This routine creates an ACPI Operation Region of a known type. This region
  47. will be used by AML code to access system hardware.
  48. Arguments:
  49. AcpiObject - Supplies a pointer to the ACPI object that represents the new
  50. operation region.
  51. Offset - Supplies an offset in the given address space to start the
  52. Operation Region.
  53. Length - Supplies the length, in bytes, of the Operation Region.
  54. OsContext - Supplies a pointer where an opaque pointer will be returned by
  55. the OS support routines on success. This pointer will be passed to the
  56. OS Operation Region access and destruction routines, and can store
  57. any OS-specific context related to the Operation Region.
  58. Return Value:
  59. STATUS_SUCCESS on success.
  60. Other error codes on failure.
  61. --*/
  62. typedef
  63. VOID
  64. (*PACPI_OPERATION_REGION_DESTROY) (
  65. PVOID OsContext
  66. );
  67. /*++
  68. Routine Description:
  69. This routine tears down OS support for an ACPI Operation Region.
  70. Arguments:
  71. OsContext - Supplies the context pointer supplied by the OS when the
  72. Operation Region was created.
  73. Return Value:
  74. None. No further accesses to the given operation region will be made.
  75. --*/
  76. typedef
  77. KSTATUS
  78. (*PACPI_OPERATION_REGION_READ) (
  79. PVOID OsContext,
  80. ULONGLONG Offset,
  81. ULONG Size,
  82. PVOID Value
  83. );
  84. /*++
  85. Routine Description:
  86. This routine performs a read from an Operation Region.
  87. Arguments:
  88. OsContext - Supplies the context pointer supplied by the OS when the
  89. Operation Region was created.
  90. Offset - Supplies the byte offset within the operation region to read from.
  91. Size - Supplies the size of the read to perform. Valid values are 8, 16,
  92. 32, and 64. Other values are considered invalid.
  93. Value - Supplies a pointer where the value from the read will be returned
  94. on success.
  95. Return Value:
  96. STATUS_SUCCESS on success.
  97. Other error codes on failure.
  98. --*/
  99. typedef
  100. KSTATUS
  101. (*PACPI_OPERATION_REGION_WRITE) (
  102. PVOID OsContext,
  103. ULONGLONG Offset,
  104. ULONG Size,
  105. PVOID Value
  106. );
  107. /*++
  108. Routine Description:
  109. This routine performs a write to an Operation Region.
  110. Arguments:
  111. OsContext - Supplies the context pointer supplied by the OS when the
  112. Operation Region was created.
  113. Offset - Supplies the byte offset within the operation region to write to.
  114. Size - Supplies the size of the write to perform. Valid values are 8, 16,
  115. 32, and 64. Other values are considered invalid.
  116. Value - Supplies a pointer to a buffer containing the value to write.
  117. Return Value:
  118. STATUS_SUCCESS on success.
  119. Other error codes on failure.
  120. --*/
  121. /*++
  122. Structure Description:
  123. This structure describes the function table for ACPI Operation Region
  124. support of one address space type.
  125. Members:
  126. Create - Supplies a pointer to a function that creates new Operation
  127. Regions.
  128. Destroy - Supplies a pointer to a function that destroys an Operation
  129. Region.
  130. Read - Supplies a pointer to a function that performs 8, 16, 32, and 64 bit
  131. reads from an Operation Region.
  132. Write - Supplies a pointer to a function that performs 8, 16, 32, and 64 bit
  133. writes to an Operation Region.
  134. --*/
  135. typedef struct _ACPI_OPERATION_REGION_FUNCTION_TABLE {
  136. PACPI_OPERATION_REGION_CREATE Create;
  137. PACPI_OPERATION_REGION_DESTROY Destroy;
  138. PACPI_OPERATION_REGION_READ Read;
  139. PACPI_OPERATION_REGION_WRITE Write;
  140. } ACPI_OPERATION_REGION_FUNCTION_TABLE, *PACPI_OPERATION_REGION_FUNCTION_TABLE;
  141. //
  142. // -------------------------------------------------------------------- Globals
  143. //
  144. //
  145. // Define the global operation region access array. This table must be defined
  146. // by the OS support portion.
  147. //
  148. extern PACPI_OPERATION_REGION_FUNCTION_TABLE
  149. AcpiOperationRegionFunctionTable[OperationRegionCount];
  150. //
  151. // -------------------------------------------------------- Function Prototypes
  152. //