Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

303 lines
5.8 KiB

  1. /*++
  2. Copyright (c) 1997, Microsoft Corporation:
  3. Module Name:
  4. acpios.h
  5. Abstract:
  6. Functions which reside within the OS specific portion of the ACPI driver
  7. Author:
  8. Environment:
  9. NT Kernel Mode, Win9x Driver
  10. --*/
  11. #ifdef WIN95_BUILD
  12. #define LOCKABLE_PRAGMA
  13. #define ACPI_LOCKABLE_CODE code_seg("PAGE", "CODE")
  14. #define ACPI_LOCKABLE_DATA data_seg(".edata", "DATA")
  15. #else
  16. #endif
  17. //
  18. // Open mode and other flags
  19. //
  20. #define OF_READONLY 0x00000000
  21. #define OF_WRITEONLY 0x00000001
  22. #define OF_READWRITE 0x00000002
  23. #define OF_SHARE_DENYALL 0x00000010
  24. #define OF_SHARE_DENYWRITE 0x00000020
  25. #define OF_SHARE_DENYREAD 0x00000030
  26. #define OF_SHARE_DENYNONE 0x00000040
  27. #define OF_INHERIT_NONE 0x00000080
  28. #define OF_DISABLE_INT24 0x00200000
  29. #define OF_AUTOCOMMITONWRITE 0x00400000
  30. //
  31. // Create attribute flags
  32. //
  33. #define CF_READONLY 0x00000001
  34. #define CF_HIDDEN 0x00000002
  35. #define CF_SYSTEM 0x00000004
  36. #define CF_VOL_LABEL 0x00000008
  37. #define CF_ARCHIVE 0x00000020
  38. //
  39. // Action flags
  40. //
  41. #define AF_EXIST_FAIL 0x00000000
  42. #define AF_EXIST_OPEN 0x00000001
  43. #define AF_EXIST_REPLACE 0x00000002
  44. #define AF_NOTEXIST_FAIL 0x00000000
  45. #define AF_NOTEXIST_CREATE 0x00000010
  46. //
  47. // Registry flags
  48. //
  49. #define REGF_HARDWARE 0x00000000
  50. #define REGF_SOFTWARE 0x00000001
  51. //
  52. // ACPI Registry key.
  53. //
  54. #define ACPI_REGISTRY_KEY \
  55. L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\ACPI"
  56. //
  57. // Where to find the ACPI Registry information
  58. //
  59. #define ACPI_PARAMETERS_REGISTRY_KEY \
  60. "\\Registry\\Machine\\System\\CurrentControlSet\\Services\\ACPI\\Parameters"
  61. //
  62. // Where to find the procesor information
  63. //
  64. #define ACPI_PROCESSOR_INFORMATION_KEY \
  65. "\\Registry\\Machine\\Hardware\\Description\\System\\CentralProcessor\\0"
  66. //
  67. // String that identifies processor stepping information
  68. //
  69. #define ACPI_PROCESSOR_STEPPING_IDENTIFIER "Stepping"
  70. NTSTATUS
  71. ACPIDispatchForwardIrp(
  72. PDEVICE_OBJECT DeviceObject,
  73. PIRP Irp
  74. );
  75. //
  76. // These are the functions that the OS-Specific part of the driver *must*
  77. // export
  78. //
  79. VOID
  80. ACPIAssert(
  81. ULONG Condition,
  82. ULONG ErrorCode,
  83. PCHAR ReplacementText,
  84. PCHAR SupplementalText,
  85. ULONG Flags
  86. );
  87. #define ACPISimpleHardwareAssert(x,y) \
  88. ACPIAssert((ULONG)(x),(y),0,0,BS_HARDWAREBIOS)
  89. #define ACPISimpleFatalHardwareAssert(x,y) \
  90. ACPIAssert((x),(y),0,0,BS_HARDWAREBIOS|BS_REAPER)
  91. #define ACPISimpleSoftwareAssert(x,y) \
  92. ACPIAssert((x),(y),0,0,BS_SOFTWARE)
  93. #define ACPISimpleFatalSoftwareAssert(x,y) \
  94. ACPIAssert((x),(y),0,0,BS_SOFTWARE|BS_REAPER)
  95. #define ACPISimpleUnknownAssert(x,y) \
  96. ACPIAssert((x),(y),0,0,0)
  97. #define ACPISimpleFatalUnknownAssert(x,y) \
  98. ACPIAssert((x),(y),0,0,BS_REAPER)
  99. #if 0
  100. ULONG
  101. DbgPrompt(
  102. PSZ pszPrompt,
  103. PSZ pszBuff,
  104. ULONG dwcbLen
  105. );
  106. #endif
  107. NTSTATUS
  108. NotifyHalWithMachineStates(
  109. VOID
  110. );
  111. NTSTATUS
  112. OSCloseHandle(
  113. HANDLE Handle
  114. );
  115. PNSOBJ
  116. OSConvertDeviceHandleToPNSOBJ(
  117. PVOID DeviceHandle
  118. );
  119. NTSTATUS
  120. OSCreateHandle(
  121. PSZ KeyName,
  122. HANDLE ParentHandle,
  123. PHANDLE ChildHandle
  124. );
  125. NTSTATUS
  126. OSGetRegistryValue(
  127. IN HANDLE ParentHandle,
  128. IN PWSTR ValueName,
  129. OUT PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64 *Information
  130. );
  131. VOID
  132. OSInitialize(
  133. PDRIVER_OBJECT DriverObject
  134. );
  135. BOOLEAN
  136. OSInterruptVector(
  137. PVOID Context
  138. );
  139. VOID
  140. OSInitializeCallbacks(
  141. VOID
  142. );
  143. NTSTATUS EXPORT
  144. OSNotifyDeviceEnum(
  145. PNSOBJ AcpiObject
  146. );
  147. NTSTATUS EXPORT
  148. OSNotifyDeviceCheck(
  149. PNSOBJ AcpiObject
  150. );
  151. NTSTATUS EXPORT
  152. OSNotifyDeviceWake(
  153. PNSOBJ AcpiObject
  154. );
  155. NTSTATUS EXPORT
  156. OSNotifyDeviceEject(
  157. PNSOBJ AcpiObject
  158. );
  159. VOID EXPORT
  160. OSNotifyDeviceWakeByGPEEvent(
  161. IN ULONG GpeBit,
  162. IN ULONG GpeRegister,
  163. IN ULONG GpeMask
  164. );
  165. NTSTATUS
  166. OSOpenHandle(
  167. PSZ KeyName,
  168. HANDLE ParentHandle,
  169. PHANDLE ChildHandle
  170. );
  171. NTSTATUS
  172. OSOpenLargestSubkey(
  173. HANDLE ParentHandle,
  174. PHANDLE ChildHandle,
  175. ULONG RomVersion
  176. );
  177. NTSTATUS
  178. OSOpenUnicodeHandle(
  179. PUNICODE_STRING KeyName,
  180. HANDLE ParentHandle,
  181. PHANDLE ChildHandle
  182. );
  183. NTSTATUS
  184. OSReadAcpiConfigurationData(
  185. PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64 *KeyInfo
  186. );
  187. NTSTATUS
  188. OSReadRegValue(
  189. PSZ ValueName,
  190. HANDLE ParentHandle,
  191. PVOID Buffer,
  192. PULONG BufferSize
  193. );
  194. NTSTATUS
  195. OSWriteRegValue(
  196. PSZ ValueName,
  197. HANDLE Handle,
  198. PVOID Data,
  199. ULONG DataSize
  200. );
  201. VOID
  202. OSQueueWorkItem(
  203. IN PWORK_QUEUE_ITEM WorkItem
  204. );
  205. //
  206. // NT only deals with Device Objects so this can be done directly
  207. // from acpipowr.c
  208. // Memphis may be dealing with a PDO or DevNode so OS Specific
  209. // code needs to determine which and convert.
  210. //
  211. #ifndef _WIN32_WINNT
  212. extern ULONG gPm1Status;
  213. VOID
  214. OSDeviceCheck (
  215. PVOID DeviceHandle
  216. );
  217. VOID
  218. OSDeviceCheckOnParent (
  219. PVOID DeviceHandle
  220. );
  221. VOID
  222. WakeupFrom (
  223. PNSOBJ pnsobj
  224. );
  225. BOOLEAN
  226. OSLockRegion (
  227. ULONG dwRegionAddr,
  228. ULONG dwRegionSize
  229. );
  230. BOOLEAN
  231. OSUnlockRegion (
  232. ULONG dwRegionAddr,
  233. ULONG dwRegionSize
  234. );
  235. BOOLEAN
  236. OSVerifyBuffer (
  237. PVOID pvBuff,
  238. ULONG dwLen
  239. );
  240. VOID
  241. OSSleep (
  242. ULONG dwUSecs
  243. );
  244. #endif