oprgnos.h 5.1 KB

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