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.

287 lines
10 KiB

  1. /*** aml.h - AML Definitions
  2. *
  3. * Copyright (c) 1996,1997 Microsoft Corporation
  4. * Author: Michael Tsang (MikeTs)
  5. * Created 11/06/96
  6. *
  7. * MODIFICATION HISTORY
  8. */
  9. #ifndef _AML_H
  10. #define _AML_H
  11. /*** Macros
  12. */
  13. #define EXOP(op) (((op) << 8) | OP_EXT_PREFIX)
  14. /*** Opcode values
  15. */
  16. #define OP_NONE 0xffffffff //not a valid opcode
  17. #define OP_ZERO 0x00
  18. #define OP_ONE 0x01
  19. #define OP_ALIAS 0x06
  20. #define OP_NAME 0x08
  21. #define OP_BYTE 0x0a
  22. #define OP_WORD 0x0b
  23. #define OP_DWORD 0x0c
  24. #define OP_STRING 0x0d
  25. #define OP_SCOPE 0x10
  26. #define OP_BUFFER 0x11
  27. #define OP_PACKAGE 0x12
  28. #define OP_METHOD 0x14
  29. #define OP_DUAL_NAME_PREFIX 0x2e // '.'
  30. #define OP_MULTI_NAME_PREFIX 0x2f // '/'
  31. #define OP_EXT_PREFIX 0x5b // '['
  32. #define OP_ROOT_PREFIX 0x5c // '\'
  33. #define OP_PARENT_PREFIX 0x5e // '^'
  34. #define OP_LOCAL0 0x60 // '`'
  35. #define OP_LOCAL1 0x61 // 'a'
  36. #define OP_LOCAL2 0x62 // 'b'
  37. #define OP_LOCAL3 0x63 // 'c'
  38. #define OP_LOCAL4 0x64 // 'd'
  39. #define OP_LOCAL5 0x65 // 'e'
  40. #define OP_LOCAL6 0x66 // 'f'
  41. #define OP_LOCAL7 0x67 // 'g'
  42. #define OP_ARG0 0x68 // 'h'
  43. #define OP_ARG1 0x69 // 'i'
  44. #define OP_ARG2 0x6a // 'j'
  45. #define OP_ARG3 0x6b // 'k'
  46. #define OP_ARG4 0x6c // 'l'
  47. #define OP_ARG5 0x6d // 'm'
  48. #define OP_ARG6 0x6e // 'n'
  49. #define OP_STORE 0x70 // 'p'
  50. #define OP_REFOF 0x71
  51. #define OP_ADD 0x72
  52. #define OP_CONCAT 0x73
  53. #define OP_SUBTRACT 0x74
  54. #define OP_INCREMENT 0x75
  55. #define OP_DECREMENT 0x76
  56. #define OP_MULTIPLY 0x77
  57. #define OP_DIVIDE 0x78
  58. #define OP_SHIFTL 0x79
  59. #define OP_SHIFTR 0x7a
  60. #define OP_AND 0x7b
  61. #define OP_NAND 0x7c
  62. #define OP_OR 0x7d
  63. #define OP_NOR 0x7e
  64. #define OP_XOR 0x7f
  65. #define OP_NOT 0x80
  66. #define OP_FINDSETLBIT 0x81
  67. #define OP_FINDSETRBIT 0x82
  68. #define OP_DEREFOF 0x83
  69. #define OP_NOTIFY 0x86
  70. #define OP_SIZEOF 0x87
  71. #define OP_INDEX 0x88
  72. #define OP_MATCH 0x89
  73. #define OP_DWORDFIELD 0x8a
  74. #define OP_WORDFIELD 0x8b
  75. #define OP_BYTEFIELD 0x8c
  76. #define OP_BITFIELD 0x8d
  77. #define OP_OBJTYPE 0x8e
  78. #define OP_LAND 0x90
  79. #define OP_LOR 0x91
  80. #define OP_LNOT 0x92
  81. #define OP_LNOTEQ 0x9392
  82. #define OP_LLEQ 0x9492
  83. #define OP_LGEQ 0x9592
  84. #define OP_LEQ 0x93
  85. #define OP_LG 0x94
  86. #define OP_LL 0x95
  87. #define OP_IF 0xa0
  88. #define OP_ELSE 0xa1
  89. #define OP_WHILE 0xa2
  90. #define OP_NOP 0xa3
  91. #define OP_RETURN 0xa4
  92. #define OP_BREAK 0xa5
  93. #define OP_OSI 0xca
  94. #define OP_BREAKPOINT 0xcc
  95. #define OP_ONES 0xff
  96. #define EXOP_MUTEX 0x01
  97. #define EXOP_EVENT 0x02
  98. #define EXOP_CONDREFOF 0x12
  99. #define EXOP_CREATEFIELD 0x13
  100. #define EXOP_LOAD 0x20
  101. #define EXOP_STALL 0x21
  102. #define EXOP_SLEEP 0x22
  103. #define EXOP_ACQUIRE 0x23
  104. #define EXOP_SIGNAL 0x24
  105. #define EXOP_WAIT 0x25
  106. #define EXOP_RESET 0x26
  107. #define EXOP_RELEASE 0x27
  108. #define EXOP_FROMBCD 0x28
  109. #define EXOP_TOBCD 0x29
  110. #define EXOP_UNLOAD 0x2a
  111. #define EXOP_REVISION 0x30
  112. #define EXOP_DEBUG 0x31
  113. #define EXOP_FATAL 0x32
  114. #define EXOP_OPREGION 0x80
  115. #define EXOP_FIELD 0x81
  116. #define EXOP_DEVICE 0x82
  117. #define EXOP_PROCESSOR 0x83
  118. #define EXOP_POWERRES 0x84
  119. #define EXOP_THERMALZONE 0x85
  120. #define EXOP_IDXFIELD 0x86
  121. #define EXOP_BANKFIELD 0x87
  122. #define OP_MUTEX EXOP(EXOP_MUTEX)
  123. #define OP_EVENT EXOP(EXOP_EVENT)
  124. #define OP_CONDREFOF EXOP(EXOP_CONDREFOF)
  125. #define OP_CREATEFIELD EXOP(EXOP_CREATEFIELD)
  126. #define OP_LOAD EXOP(EXOP_LOAD)
  127. #define OP_STALL EXOP(EXOP_STALL)
  128. #define OP_SLEEP EXOP(EXOP_SLEEP)
  129. #define OP_ACQUIRE EXOP(EXOP_ACQUIRE)
  130. #define OP_SIGNAL EXOP(EXOP_SIGNAL)
  131. #define OP_WAIT EXOP(EXOP_WAIT)
  132. #define OP_RESET EXOP(EXOP_RESET)
  133. #define OP_RELEASE EXOP(EXOP_RELEASE)
  134. #define OP_FROMBCD EXOP(EXOP_FROMBCD)
  135. #define OP_TOBCD EXOP(EXOP_TOBCD)
  136. #define OP_UNLOAD EXOP(EXOP_UNLOAD)
  137. #define OP_REVISION EXOP(EXOP_REVISION)
  138. #define OP_DEBUG EXOP(EXOP_DEBUG)
  139. #define OP_FATAL EXOP(EXOP_FATAL)
  140. #define OP_OPREGION EXOP(EXOP_OPREGION)
  141. #define OP_FIELD EXOP(EXOP_FIELD)
  142. #define OP_DEVICE EXOP(EXOP_DEVICE)
  143. #define OP_PROCESSOR EXOP(EXOP_PROCESSOR)
  144. #define OP_POWERRES EXOP(EXOP_POWERRES)
  145. #define OP_THERMALZONE EXOP(EXOP_THERMALZONE)
  146. #define OP_IDXFIELD EXOP(EXOP_IDXFIELD)
  147. #define OP_BANKFIELD EXOP(EXOP_BANKFIELD)
  148. /*** Field flags
  149. */
  150. #define ACCTYPE_MASK 0x0f
  151. #define ACCTYPE_ANY 0x00 //AnyAcc
  152. #define ACCTYPE_BYTE 0x01 //ByteAcc
  153. #define ACCTYPE_WORD 0x02 //WordAcc
  154. #define ACCTYPE_DWORD 0x03 //DWordAcc
  155. #define ACCTYPE_QWORD 0x04 //QWordAcc
  156. #define ACCTYPE_BUFFER 0x05 //BufferAcc
  157. #define LOCKRULE_MASK 0x10
  158. #define LOCKRULE_NOLOCK 0x00 //NoLock
  159. #define LOCKRULE_LOCK 0x10 //Lock
  160. #define UPDATERULE_MASK 0x60
  161. #define UPDATERULE_PRESERVE 0x00 //Preserve
  162. #define UPDATERULE_WRITEASONES 0x20 //WriteAsOnes
  163. #define UPDATERULE_WRITEASZEROS 0x40 //WriteAsZeros
  164. #define ACCATTRIB_MASK 0xff00
  165. //
  166. // Returns 1, 2 or 4 for BYTE, WORD or DWORD respectively and returns 1 for
  167. // any other sizes.
  168. //
  169. #define ACCSIZE(f) (((((f) & ACCTYPE_MASK) >= ACCTYPE_BYTE) && \
  170. (((f) & ACCTYPE_MASK) <= ACCTYPE_DWORD))? \
  171. (1 << (((f) & ACCTYPE_MASK) - 1)): 1)
  172. /*** Operation region space
  173. */
  174. #define REGSPACE_MEM 0 //SystemMemory
  175. #define REGSPACE_IO 1 //SystemIO
  176. #define REGSPACE_PCICFG 2 //PCI_Config
  177. #define REGSPACE_EC 3 //EmbeddedControl
  178. #define REGSPACE_SMB 4 //SMBus
  179. #define REGSPACE_CMOSCFG 5 //Cmos_Config
  180. #define REGSPACE_PCIBARTARGET 6 //PCIBARTarget
  181. /*** Method flags
  182. */
  183. #define METHOD_NUMARG_MASK 0x07
  184. #define METHOD_SYNCMASK 0x08
  185. #define METHOD_NOTSERIALIZED 0x00
  186. #define METHOD_SERIALIZED 0x08
  187. /*** Match operation values
  188. */
  189. #define MTR 0
  190. #define MEQ 1
  191. #define MLE 2
  192. #define MLT 3
  193. #define MGE 4
  194. #define MGT 5
  195. /*** IRQ Flags for short descriptor
  196. */
  197. #define _HE 0x01 //ActiveHigh, EdgeTrigger
  198. #define _LL 0x08 //ActiveLow, LevelTrigger
  199. #define _SHR 0x10 //Shared
  200. #define _EXC 0x00 //Exclusive
  201. /*** IRQ Flags for long descriptor
  202. */
  203. #define $EDG 0x02 //EdgeTrigger
  204. #define $LVL 0x00 //LevelTrigger
  205. #define $LOW 0x04 //ActiveLow
  206. #define $HGH 0x00 //ActiveHigh
  207. #define $SHR 0x08 //Shared
  208. #define $EXC 0x00 //Exclusive
  209. /*** DMA Flags
  210. */
  211. #define X8 0x00 //Transfer8
  212. #define X816 0x01 //Transfer8_16
  213. #define X16 0x02 //Transfer16
  214. #define NOBM 0x00 //NotBusMaster
  215. #define BM 0x04 //BusMaster
  216. #define COMP 0x00 //Compatibility
  217. #define TYPA 0x20 //TypeA
  218. #define TYPB 0x40 //TypeB
  219. #define TYPF 0x60 //TypeF
  220. /*** IO Flags
  221. */
  222. #define DC16 0x01 //Decode16
  223. #define DC10 0x00 //Decode10
  224. /*** Memory Flags
  225. */
  226. #define _RW 0x01 //Read/Write
  227. #define _ROM 0x00 //Read only
  228. /*** Address Space Descriptor General Flags
  229. */
  230. #define RCS 0x01 //Resource Consumer
  231. #define RPD 0x00 //Resource Producer
  232. #define BSD 0x02 //Bridge Subtractive Decode
  233. #define BPD 0x00 //Bridge Positive Decode
  234. #define MIF 0x04 //Min address is fixed
  235. #define NMIF 0x00 //Min address is not fixed
  236. #define MAF 0x08 //Max address is fixed
  237. #define NMAF 0x00 //Max address is not fixed
  238. /*** Memory Address Space Flags
  239. */
  240. #define CACH 0x02 //Cacheable
  241. #define WRCB 0x04 //WriteCombining
  242. #define PREF 0x06 //Prefetchable
  243. #define NCAC 0x00 //Non-Cacheable
  244. /*** IO Address Space Flags
  245. */
  246. #define ISA 0x02 //ISAOnly ranges
  247. #define NISA 0x01 //NonISAOnly ranges
  248. #define ERNG 0x03 //Entire range
  249. #define MAX_ARGS 7
  250. #define MAX_NSPATH_LEN 1275 //approx. 255*4 + 255 (255 NameSegs)
  251. #endif //ifndef _AML_H