Source code of Windows XP (NT5)
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.

711 lines
25 KiB

  1. /*++
  2. Copyright (c) 1993-2001 Microsoft Corporation
  3. Module Name:
  4. amlikd.h
  5. Abstract:
  6. This header file (re)defines various flags used by the amli extension. These definitions
  7. are copied from different header files in the acpi and acpi kd ext dirs.
  8. --*/
  9. #ifndef _AMLIKD_
  10. #define _AMLIKD_
  11. /*** Defn's
  12. */
  13. #define ConPrintf dprintf
  14. #define MZERO MemZero
  15. #define ADDROF(s) GetExpression("ACPI!" s)
  16. #define FIELDADDROF(s,t,f) (PULONG64)(ADDROF(s) + FIELD_OFFSET(t, f))
  17. #define READMEMBYTE ReadMemByte
  18. #define READMEMWORD ReadMemWord
  19. #define READMEMDWORD ReadMemDWord
  20. #define READMEMULONGPTR ReadMemUlongPtr
  21. #define READSYMBYTE(s) ReadMemByte(ADDROF(s))
  22. #define READSYMWORD(s) ReadMemWord(ADDROF(s))
  23. #define READSYMDWORD(s) ReadMemDWord(ADDROF(s))
  24. #define READSYMULONGPTR(s) ReadMemUlongPtr(ADDROF(s))
  25. #define WRITEMEMBYTE(a,d) WriteMemory(a, &(d), sizeof(BYTE), NULL)
  26. #define WRITEMEMWORD(a,d) WriteMemory(a, &(d), sizeof(WORD), NULL)
  27. #define WRITEMEMDWORD(a,d) WriteMemory(a, &(d), sizeof(DWORD), NULL)
  28. #define WRITEMEMULONGPTR(a,d) WriteMemory(a, &(d), sizeof(ULONG_PTR), NULL)
  29. #define WRITESYMBYTE(s,d) WRITEMEMBYTE(ADDROF(s), d)
  30. #define WRITESYMWORD(s,d) WRITEMEMWORD(ADDROF(s), d)
  31. #define WRITESYMDWORD(s,d) WRITEMEMDWORD(ADDROF(s), d)
  32. #define WRITESYMULONGPTR(s,d) WRITEMEMULONGPTR(ADDROF(s), d)
  33. #define EXOP(op) (((op) << 8) | OP_EXT_PREFIX)
  34. #define LOCAL __cdecl
  35. #define STDCALL __stdcall
  36. #define MODNAME "AMLI"
  37. #define DBG_ERROR(x) ConPrintf(MODNAME "_DBGERR: "); \
  38. ConPrintf x; \
  39. ConPrintf("\n");
  40. #define ARG_ERROR(x) ConPrintf(MODNAME "_ARGERR: "); \
  41. ConPrintf x; \
  42. ConPrintf("\n");
  43. #define DEREF(x) ((x) = (x))
  44. #define ISLOWER(c) (((c) >= 'a') && ((c) <= 'z'))
  45. #define TOUPPER(c) ((CHAR)(ISLOWER(c)? ((c) & 0xdf): (c)))
  46. #define MEMCPY RtlCopyMemory
  47. #define MEMZERO RtlZeroMemory
  48. #define STRCPY(s1,s2) StrCpy(s1, s2, (ULONG)(-1))
  49. #define STRCPYN(s1,s2,n) StrCpy(s1, s2, (ULONG)(n))
  50. #define MAX_NAME_LEN 255
  51. #define NAMESEG_ROOT 0x5f5f5f5c // "\___"
  52. #define NAMESEG_BLANK 0x5f5f5f5f // "____"
  53. #define NAMESEG_NONE 0x00000000 // ""
  54. #define NAMESTR_ROOT "\\"
  55. // DNS flags
  56. #define DNSF_RECURSE 0x00000001
  57. // DS flags
  58. #define DSF_VERBOSE 0x00000001
  59. // dwfDebug flags
  60. #define DBGF_IN_DEBUGGER 0x00000001
  61. #define DBGF_IN_VXDMODE 0x00000002
  62. #define DBGF_IN_KDSHELL 0x00000004
  63. #define DBGF_VERBOSE_ON 0x00000008
  64. #define DBGF_AMLTRACE_ON 0x00000010
  65. #define DBGF_TRIGGER_MODE 0x00000020
  66. #define DBGF_SINGLE_STEP 0x00000040
  67. #define DBGF_STEP_OVER 0x00000080
  68. #define DBGF_STEP_MODES (DBGF_SINGLE_STEP | DBGF_STEP_OVER)
  69. #define DBGF_TRACE_NONEST 0x00000100
  70. #define DBGF_DUMPDATA_PHYADDR 0x00000200
  71. #define DBGF_DEBUGGER_REQ 0x00001000
  72. #define DBGF_CHECKING_TRACE 0x00002000
  73. #define DBGF_ERRBREAK_ON 0x00004000
  74. #define DBGF_LOGEVENT_ON 0x00008000
  75. #define DBGF_LOGEVENT_MUTEX 0x00010000
  76. #define DBGF_DEBUG_SPEW_ON 0x00020000
  77. // dwfAMLIInit flags
  78. #define AMLIIF_INIT_BREAK 0x00000001 //break at AMLIInit completion
  79. #define AMLIIF_LOADDDB_BREAK 0x00000002 //break at LoadDDB completion
  80. #define AMLIIF_NOCHK_TABLEVER 0x80000000 //do not check table version
  81. // Error codes
  82. #define UNASMERR_NONE 0
  83. #define UNASMERR_FATAL -1
  84. #define UNASMERR_INVALID_OPCODE -2
  85. #define UNASMERR_ABORT -3
  86. // Opcode classes
  87. #define OPCLASS_INVALID 0
  88. #define OPCLASS_DATA_OBJ 1
  89. #define OPCLASS_NAME_OBJ 2
  90. #define OPCLASS_CONST_OBJ 3
  91. #define OPCLASS_CODE_OBJ 4
  92. #define OPCLASS_ARG_OBJ 5
  93. #define OPCLASS_LOCAL_OBJ 6
  94. // NameSpace object types
  95. #define NSTYPE_UNKNOWN 'U'
  96. #define NSTYPE_SCOPE 'S'
  97. #define NSTYPE_FIELDUNIT 'F'
  98. #define NSTYPE_DEVICE 'D'
  99. #define NSTYPE_EVENT 'E'
  100. #define NSTYPE_METHOD 'M'
  101. #define NSTYPE_MUTEX 'X'
  102. #define NSTYPE_OPREGION 'O'
  103. #define NSTYPE_POWERRES 'P'
  104. #define NSTYPE_PROCESSOR 'C'
  105. #define NSTYPE_THERMALZONE 'T'
  106. #define NSTYPE_OBJALIAS 'A'
  107. #define NSTYPE_BUFFFIELD 'B'
  108. // Term classes
  109. #define UTC_PNP_MACRO 0x00100000
  110. #define UTC_REF_OBJECT 0x00200000
  111. #define UTC_FIELD_MACRO 0x00400000
  112. #define UTC_DATA_OBJECT 0x00800000
  113. #define UTC_NAMED_OBJECT 0x01000000
  114. #define UTC_NAMESPACE_MODIFIER 0x02000000
  115. #define UTC_OPCODE_TYPE1 0x04000000
  116. #define UTC_OPCODE_TYPE2 0x08000000
  117. #define UTC_CONST_NAME 0x10000000
  118. #define UTC_SHORT_NAME 0x20000000
  119. #define UTC_COMPILER_DIRECTIVE 0x40000000
  120. #define UTC_KEYWORD 0x80000000
  121. #define UTC_OPCODE (UTC_OPCODE_TYPE1 | UTC_OPCODE_TYPE2 | \
  122. UTC_SHORT_NAME | UTC_CONST_NAME | \
  123. UTC_DATA_OBJECT)
  124. // Term flags
  125. #define TF_ACTION_FLIST 0x00000001
  126. #define TF_ACTION_VLIST 0x00000002
  127. #define TF_PACKAGE_LEN 0x00000004
  128. #define TF_CHANGE_CHILDSCOPE 0x00000008
  129. #define TF_DELAY_UNASM 0x00000010
  130. #define TF_FIELD_MACRO UTC_FIELD_MACRO
  131. #define TF_DATA_OBJECT UTC_DATA_OBJECT
  132. #define TF_NAMED_OBJECT UTC_NAMED_OBJECT
  133. #define TF_NAMESPACE_MODIFIER UTC_NAMESPACE_MODIFIER
  134. #define TF_OPCODE_TYPE1 UTC_OPCODE_TYPE1
  135. #define TF_OPCODE_TYPE2 UTC_OPCODE_TYPE2
  136. #define TF_CONST_NAME UTC_CONST_NAME
  137. #define TF_SHORT_NAME UTC_SHORT_NAME
  138. #define TF_COMPILER_DIRECTIVE UTC_COMPILER_DIRECTIVE
  139. #define TF_KEYWORD UTC_KEYWORD
  140. #define TF_PNP_MACRO UTC_PNP_MACRO
  141. #define TF_OBJECT_LIST (UTC_NAMED_OBJECT | UTC_NAMESPACE_MODIFIER)
  142. #define TF_CODE_LIST (UTC_OPCODE_TYPE1 | UTC_OPCODE_TYPE2)
  143. #define TF_DATA_LIST 0x00010000
  144. #define TF_FIELD_LIST 0x00020000
  145. #define TF_BYTE_LIST 0x00040000
  146. #define TF_DWORD_LIST 0x00080000
  147. #define TF_PACKAGE_LIST (UTC_DATA_OBJECT | UTC_SHORT_NAME | \
  148. UTC_CONST_NAME)
  149. #define TF_ALL_LISTS (TF_DATA_OBJECT | TF_NAMED_OBJECT | \
  150. TF_NAMESPACE_MODIFIER | TF_OPCODE_TYPE1 | \
  151. TF_OPCODE_TYPE2 | TF_SHORT_NAME | \
  152. TF_CONST_NAME | TF_COMPILER_DIRECTIVE | \
  153. TF_DATA_LIST | TF_PACKAGE_LIST | \
  154. TF_FIELD_LIST | TF_PNP_MACRO | TF_BYTE_LIST |\
  155. TF_DWORD_LIST)
  156. /*** Opcode values
  157. */
  158. #define OP_NONE 0xffffffff //not a valid opcode
  159. #define OP_ZERO 0x00
  160. #define OP_ONE 0x01
  161. #define OP_ALIAS 0x06
  162. #define OP_NAME 0x08
  163. #define OP_BYTE 0x0a
  164. #define OP_WORD 0x0b
  165. #define OP_DWORD 0x0c
  166. #define OP_STRING 0x0d
  167. #define OP_SCOPE 0x10
  168. #define OP_BUFFER 0x11
  169. #define OP_PACKAGE 0x12
  170. #define OP_METHOD 0x14
  171. #define OP_DUAL_NAME_PREFIX 0x2e // '.'
  172. #define OP_MULTI_NAME_PREFIX 0x2f // '/'
  173. #define OP_EXT_PREFIX 0x5b // '['
  174. #define OP_ROOT_PREFIX 0x5c // '\'
  175. #define OP_PARENT_PREFIX 0x5e // '^'
  176. #define OP_LOCAL0 0x60 // '`'
  177. #define OP_LOCAL1 0x61 // 'a'
  178. #define OP_LOCAL2 0x62 // 'b'
  179. #define OP_LOCAL3 0x63 // 'c'
  180. #define OP_LOCAL4 0x64 // 'd'
  181. #define OP_LOCAL5 0x65 // 'e'
  182. #define OP_LOCAL6 0x66 // 'f'
  183. #define OP_LOCAL7 0x67 // 'g'
  184. #define OP_ARG0 0x68 // 'h'
  185. #define OP_ARG1 0x69 // 'i'
  186. #define OP_ARG2 0x6a // 'j'
  187. #define OP_ARG3 0x6b // 'k'
  188. #define OP_ARG4 0x6c // 'l'
  189. #define OP_ARG5 0x6d // 'm'
  190. #define OP_ARG6 0x6e // 'n'
  191. #define OP_STORE 0x70 // 'p'
  192. #define OP_REFOF 0x71
  193. #define OP_ADD 0x72
  194. #define OP_CONCAT 0x73
  195. #define OP_SUBTRACT 0x74
  196. #define OP_INCREMENT 0x75
  197. #define OP_DECREMENT 0x76
  198. #define OP_MULTIPLY 0x77
  199. #define OP_DIVIDE 0x78
  200. #define OP_SHIFTL 0x79
  201. #define OP_SHIFTR 0x7a
  202. #define OP_AND 0x7b
  203. #define OP_NAND 0x7c
  204. #define OP_OR 0x7d
  205. #define OP_NOR 0x7e
  206. #define OP_XOR 0x7f
  207. #define OP_NOT 0x80
  208. #define OP_FINDSETLBIT 0x81
  209. #define OP_FINDSETRBIT 0x82
  210. #define OP_DEREFOF 0x83
  211. #define OP_NOTIFY 0x86
  212. #define OP_SIZEOF 0x87
  213. #define OP_INDEX 0x88
  214. #define OP_MATCH 0x89
  215. #define OP_DWORDFIELD 0x8a
  216. #define OP_WORDFIELD 0x8b
  217. #define OP_BYTEFIELD 0x8c
  218. #define OP_BITFIELD 0x8d
  219. #define OP_OBJTYPE 0x8e
  220. #define OP_LAND 0x90
  221. #define OP_LOR 0x91
  222. #define OP_LNOT 0x92
  223. #define OP_LNOTEQ 0x9392
  224. #define OP_LLEQ 0x9492
  225. #define OP_LGEQ 0x9592
  226. #define OP_LEQ 0x93
  227. #define OP_LG 0x94
  228. #define OP_LL 0x95
  229. #define OP_IF 0xa0
  230. #define OP_ELSE 0xa1
  231. #define OP_WHILE 0xa2
  232. #define OP_NOP 0xa3
  233. #define OP_RETURN 0xa4
  234. #define OP_BREAK 0xa5
  235. #define OP_OSI 0xca
  236. #define OP_BREAKPOINT 0xcc
  237. #define OP_ONES 0xff
  238. #define EXOP_MUTEX 0x01
  239. #define EXOP_EVENT 0x02
  240. #define EXOP_CONDREFOF 0x12
  241. #define EXOP_CREATEFIELD 0x13
  242. #define EXOP_LOAD 0x20
  243. #define EXOP_STALL 0x21
  244. #define EXOP_SLEEP 0x22
  245. #define EXOP_ACQUIRE 0x23
  246. #define EXOP_SIGNAL 0x24
  247. #define EXOP_WAIT 0x25
  248. #define EXOP_RESET 0x26
  249. #define EXOP_RELEASE 0x27
  250. #define EXOP_FROMBCD 0x28
  251. #define EXOP_TOBCD 0x29
  252. #define EXOP_UNLOAD 0x2a
  253. #define EXOP_REVISION 0x30
  254. #define EXOP_DEBUG 0x31
  255. #define EXOP_FATAL 0x32
  256. #define EXOP_OPREGION 0x80
  257. #define EXOP_FIELD 0x81
  258. #define EXOP_DEVICE 0x82
  259. #define EXOP_PROCESSOR 0x83
  260. #define EXOP_POWERRES 0x84
  261. #define EXOP_THERMALZONE 0x85
  262. #define EXOP_IDXFIELD 0x86
  263. #define EXOP_BANKFIELD 0x87
  264. #define OP_MUTEX EXOP(EXOP_MUTEX)
  265. #define OP_EVENT EXOP(EXOP_EVENT)
  266. #define OP_CONDREFOF EXOP(EXOP_CONDREFOF)
  267. #define OP_CREATEFIELD EXOP(EXOP_CREATEFIELD)
  268. #define OP_LOAD EXOP(EXOP_LOAD)
  269. #define OP_STALL EXOP(EXOP_STALL)
  270. #define OP_SLEEP EXOP(EXOP_SLEEP)
  271. #define OP_ACQUIRE EXOP(EXOP_ACQUIRE)
  272. #define OP_SIGNAL EXOP(EXOP_SIGNAL)
  273. #define OP_WAIT EXOP(EXOP_WAIT)
  274. #define OP_RESET EXOP(EXOP_RESET)
  275. #define OP_RELEASE EXOP(EXOP_RELEASE)
  276. #define OP_FROMBCD EXOP(EXOP_FROMBCD)
  277. #define OP_TOBCD EXOP(EXOP_TOBCD)
  278. #define OP_UNLOAD EXOP(EXOP_UNLOAD)
  279. #define OP_REVISION EXOP(EXOP_REVISION)
  280. #define OP_DEBUG EXOP(EXOP_DEBUG)
  281. #define OP_FATAL EXOP(EXOP_FATAL)
  282. #define OP_OPREGION EXOP(EXOP_OPREGION)
  283. #define OP_FIELD EXOP(EXOP_FIELD)
  284. #define OP_DEVICE EXOP(EXOP_DEVICE)
  285. #define OP_PROCESSOR EXOP(EXOP_PROCESSOR)
  286. #define OP_POWERRES EXOP(EXOP_POWERRES)
  287. #define OP_THERMALZONE EXOP(EXOP_THERMALZONE)
  288. #define OP_IDXFIELD EXOP(EXOP_IDXFIELD)
  289. #define OP_BANKFIELD EXOP(EXOP_BANKFIELD)
  290. /*** Field flags
  291. */
  292. #define ACCTYPE_MASK 0x0f
  293. #define ACCTYPE_ANY 0x00 //AnyAcc
  294. #define ACCTYPE_BYTE 0x01 //ByteAcc
  295. #define ACCTYPE_WORD 0x02 //WordAcc
  296. #define ACCTYPE_DWORD 0x03 //DWordAcc
  297. #define ACCTYPE_BLOCK 0x04 //BlockAcc
  298. #define ACCTYPE_SMBSENDRECV 0x05 //SMBSendRecvAcc
  299. #define ACCTYPE_SMBQUICK 0x06 //SMBQuickAcc
  300. #define LOCKRULE_MASK 0x10
  301. #define LOCKRULE_NOLOCK 0x00 //NoLock
  302. #define LOCKRULE_LOCK 0x10 //Lock
  303. #define UPDATERULE_MASK 0x60
  304. #define UPDATERULE_PRESERVE 0x00 //Preserve
  305. #define UPDATERULE_WRITEASONES 0x20 //WriteAsOnes
  306. #define UPDATERULE_WRITEASZEROS 0x40 //WriteAsZeros
  307. //
  308. // Returns 1, 2 or 4 for BYTE, WORD or DWORD respectively and returns 1 for
  309. // any other sizes.
  310. //
  311. #define ACCSIZE(f) (((((f) & ACCTYPE_MASK) >= ACCTYPE_BYTE) && \
  312. (((f) & ACCTYPE_MASK) <= ACCTYPE_DWORD))? \
  313. (1 << (((f) & ACCTYPE_MASK) - 1)): 1)
  314. /*** Operation region space
  315. */
  316. #define REGSPACE_MEM 0 //SystemMemory
  317. #define REGSPACE_IO 1 //SystemIO
  318. #define REGSPACE_PCICFG 2 //PCI_Config
  319. #define REGSPACE_EC 3 //EmbeddedControl
  320. #define REGSPACE_SMB 4 //SMBus
  321. #define REGSPACE_CMOSCFG 5 //Cmos_Config
  322. #define REGSPACE_PCIBARTARGET 6 //PCIBARTarget
  323. /*** Method flags
  324. */
  325. #define METHOD_NUMARG_MASK 0x07
  326. #define METHOD_SYNCMASK 0x08
  327. #define METHOD_NOTSERIALIZED 0x00
  328. #define METHOD_SERIALIZED 0x08
  329. /*** Match operation values
  330. */
  331. #define MTR 0
  332. #define MEQ 1
  333. #define MLE 2
  334. #define MLT 3
  335. #define MGE 4
  336. #define MGT 5
  337. /*** IRQ Flags for short descriptor
  338. */
  339. #define _HE 0x01 //ActiveHigh, EdgeTrigger
  340. #define _LL 0x08 //ActiveLow, LevelTrigger
  341. #define _SHR 0x10 //Shared
  342. #define _EXC 0x00 //Exclusive
  343. /*** IRQ Flags for long descriptor
  344. */
  345. #define $EDG 0x02 //EdgeTrigger
  346. #define $LVL 0x00 //LevelTrigger
  347. #define $LOW 0x04 //ActiveLow
  348. #define $HGH 0x00 //ActiveHigh
  349. #define $SHR 0x08 //Shared
  350. #define $EXC 0x00 //Exclusive
  351. /*** DMA Flags
  352. */
  353. #define X8 0x00 //Transfer8
  354. #define X816 0x01 //Transfer8_16
  355. #define X16 0x02 //Transfer16
  356. #define NOBM 0x00 //NotBusMaster
  357. #define BM 0x04 //BusMaster
  358. #define COMP 0x00 //Compatibility
  359. #define TYPA 0x20 //TypeA
  360. #define TYPB 0x40 //TypeB
  361. #define TYPF 0x60 //TypeF
  362. /*** IO Flags
  363. */
  364. #define DC16 0x01 //Decode16
  365. #define DC10 0x00 //Decode10
  366. /*** Memory Flags
  367. */
  368. #define _RW 0x01 //Read/Write
  369. #define _ROM 0x00 //Read only
  370. /*** Address Space Descriptor General Flags
  371. */
  372. #define RCS 0x01 //Resource Consumer
  373. #define RPD 0x00 //Resource Producer
  374. #define BSD 0x02 //Bridge Subtractive Decode
  375. #define BPD 0x00 //Bridge Positive Decode
  376. #define MIF 0x04 //Min address is fixed
  377. #define NMIF 0x00 //Min address is not fixed
  378. #define MAF 0x08 //Max address is fixed
  379. #define NMAF 0x00 //Max address is not fixed
  380. /*** Memory Address Space Flags
  381. */
  382. #define CACH 0x02 //Cacheable
  383. #define WRCB 0x04 //WriteCombining
  384. #define PREF 0x06 //Prefetchable
  385. #define NCAC 0x00 //Non-Cacheable
  386. /*** IO Address Space Flags
  387. */
  388. #define ISA 0x02 //ISAOnly ranges
  389. #define NISA 0x01 //NonISAOnly ranges
  390. #define ERNG 0x03 //Entire range
  391. #define MAX_ARGS 7
  392. #define MAX_NSPATH_LEN 1275 //approx. 255*4 + 255 (255 NameSegs)
  393. //
  394. // N: NameStr
  395. // O: DataObj (num, string, buffer, package)
  396. // K: Keyword (e.g. NoLock, ByteAcc etc.)
  397. // D: DWord integer
  398. // W: Word integer
  399. // B: Byte integer
  400. // U: Numeric (any size integer)
  401. // S: SuperName (NameStr + Localx + Argx + Ret)
  402. // C: Opcode
  403. // Z: ASCIIZ string
  404. //
  405. #define AF TF_ACTION_FLIST //process after fixed list is parsed
  406. #define AV TF_ACTION_VLIST //process after variable list is parsed
  407. #define LN TF_PACKAGE_LEN //term requires package length
  408. #define CC TF_CHANGE_CHILDSCOPE //change to child scope
  409. #define DL TF_DATA_LIST //term expects buffer data list
  410. #define PL TF_PACKAGE_LIST //term expects package list
  411. #define FL TF_FIELD_LIST //term expects FieldList
  412. #define OL TF_OBJECT_LIST //term expects ObjectList
  413. #define LL TF_COMPILER_DIRECTIVE //term expects compiler directives
  414. #define CL TF_CODE_LIST //term expects CodeList
  415. #define AL TF_ALL_LISTS //term expects anything
  416. #define ML TF_PNP_MACRO //term expects PNPMacro
  417. #define BL TF_BYTE_LIST //term expects ByteList
  418. #define DD TF_DWORD_LIST //term expects DWordList
  419. #define SK TF_DELAY_UNASM //term cannot be unasmed on the first pass
  420. #define CD UTC_COMPILER_DIRECTIVE
  421. #define FM UTC_FIELD_MACRO
  422. #define CN UTC_CONST_NAME
  423. #define SN UTC_SHORT_NAME
  424. #define NS UTC_NAMESPACE_MODIFIER
  425. #define DO UTC_DATA_OBJECT
  426. #define KW UTC_KEYWORD
  427. #define NO UTC_NAMED_OBJECT
  428. #define C1 UTC_OPCODE_TYPE1
  429. #define C2 UTC_OPCODE_TYPE2
  430. #define RO UTC_REF_OBJECT
  431. #define PM UTC_PNP_MACRO
  432. #define UNK OBJTYPE_UNKNOWN
  433. #define INT OBJTYPE_INTDATA
  434. #define STR OBJTYPE_STRDATA
  435. #define BUF OBJTYPE_BUFFDATA
  436. #define PKG OBJTYPE_PKGDATA
  437. #define FDU OBJTYPE_FIELDUNIT
  438. #define DEV OBJTYPE_DEVICE
  439. #define EVT OBJTYPE_EVENT
  440. #define MET OBJTYPE_METHOD
  441. #define MUT OBJTYPE_MUTEX
  442. #define OPR OBJTYPE_OPREGION
  443. #define PWR OBJTYPE_POWERRES
  444. #define THM OBJTYPE_THERMALZONE
  445. #define BFD OBJTYPE_BUFFFIELD
  446. #define DDB OBJTYPE_DDBHANDLE
  447. //
  448. // Field flags
  449. //
  450. #define AANY (ACCTYPE_ANY | (ACCTYPE_MASK << 8))
  451. #define AB (ACCTYPE_BYTE | (ACCTYPE_MASK << 8))
  452. #define AW (ACCTYPE_WORD | (ACCTYPE_MASK << 8))
  453. #define ADW (ACCTYPE_DWORD | (ACCTYPE_MASK << 8))
  454. #define ABLK (ACCTYPE_BLOCK | (ACCTYPE_MASK << 8))
  455. #define ASSR (ACCTYPE_SMBSENDRECV | (ACCTYPE_MASK << 8))
  456. #define ASQ (ACCTYPE_SMBQUICK | (ACCTYPE_MASK << 8))
  457. #define LK (LOCKRULE_LOCK | (LOCKRULE_MASK << 8))
  458. #define NOLK (LOCKRULE_NOLOCK | (LOCKRULE_MASK << 8))
  459. #define PSRV (UPDATERULE_PRESERVE | (UPDATERULE_MASK << 8))
  460. #define WA1S (UPDATERULE_WRITEASONES | (UPDATERULE_MASK << 8))
  461. #define WA0S (UPDATERULE_WRITEASZEROS | (UPDATERULE_MASK << 8))
  462. //
  463. // Operation region space
  464. //
  465. #define MEM (REGSPACE_MEM | 0xff00)
  466. #define IO (REGSPACE_IO | 0xff00)
  467. #define CFG (REGSPACE_PCICFG | 0xff00)
  468. #define EC (REGSPACE_EC | 0xff00)
  469. #define SMB (REGSPACE_SMB | 0xff00)
  470. //
  471. // Method flags
  472. //
  473. #define SER (METHOD_SERIALIZED | (METHOD_SYNCMASK << 8))
  474. #define NOSER (METHOD_NOTSERIALIZED | (METHOD_SYNCMASK << 8))
  475. //
  476. // Match operation values
  477. //
  478. #define OMTR (MTR | 0xff00)
  479. #define OMEQ (MEQ | 0xff00)
  480. #define OMLE (MLE | 0xff00)
  481. #define OMLT (MLT | 0xff00)
  482. #define OMGE (MGE | 0xff00)
  483. #define OMGT (MGT | 0xff00)
  484. #define INVALID OPCLASS_INVALID
  485. #define DATAOBJ OPCLASS_DATA_OBJ
  486. #define NAMEOBJ OPCLASS_NAME_OBJ
  487. #define CONSTOBJ OPCLASS_CONST_OBJ
  488. #define CODEOBJ OPCLASS_CODE_OBJ
  489. #define ARGOBJ OPCLASS_ARG_OBJ
  490. #define LOCALOBJ OPCLASS_LOCAL_OBJ
  491. // Error codes
  492. #define ARGERR_NONE 0
  493. #define ARGERR_SEP_NOT_FOUND -1
  494. #define ARGERR_INVALID_NUMBER -2
  495. #define ARGERR_INVALID_ARG -3
  496. #define ARGERR_ASSERT_FAILED -4
  497. // Command argument flags
  498. #define AF_NOI 0x00000001 //NoIgnoreCase
  499. #define AF_SEP 0x00000002 //require separator
  500. // Command argument types
  501. #define AT_END 0 //end marker of arg table
  502. #define AT_STRING 1
  503. #define AT_NUM 2
  504. #define AT_ENABLE 3
  505. #define AT_DISABLE 4
  506. #define AT_ACTION 5
  507. // Debugger error codes
  508. #define DBGERR_NONE 0
  509. #define DBGERR_QUIT -1
  510. #define DBGERR_INVALID_CMD -2
  511. #define DBGERR_PARSE_ARGS -3
  512. #define DBGERR_CMD_FAILED -4
  513. #define DBGERR_INTERNAL_ERR -5
  514. // dwfFlags for AMLIGetNameSpaceObject
  515. #define NSF_LOCAL_SCOPE 0x00000001
  516. // dwfNS local flags
  517. #define NSF_EXIST_OK 0x00010000 //for CreateNameSpaceObject
  518. #define NSF_WARN_NOTFOUND 0x80000000 //for GetNameSpaceObject
  519. /*** Type definitions
  520. */
  521. typedef CHAR *PSZ;
  522. typedef ULONG NAMESEG;
  523. typedef UCHAR *PUCHAR;
  524. typedef struct _cmdarg CMDARG;
  525. typedef CMDARG *PCMDARG;
  526. typedef LONG (LOCAL *PFNARG)(PCMDARG, PSZ, ULONG, ULONG);
  527. struct _cmdarg
  528. {
  529. PSZ pszArgID; //argument ID string
  530. ULONG dwArgType; //AT_*
  531. ULONG dwfArg; //AF_*
  532. PVOID pvArgData; //AT_END: none
  533. //AT_STRING: PPSZ - ptr. to string ptr.
  534. //AT_NUM: PLONG - ptr. to number
  535. //AT_ENABLE: PULONG - ptr. to flags
  536. //AT_DISABLE: PULONG - ptr. to flags
  537. //AT_ACTION: none
  538. ULONG dwArgParam; //AT_END: none
  539. //AT_STRING: none
  540. //AT_NUM: base
  541. //AT_ENABLE: flag bit mask
  542. //AT_DISABLE: flag bit mask
  543. //AT_ACTION: none
  544. PFNARG pfnArg; //ptr. to argument verification function or
  545. // action function if AT_ACTION
  546. };
  547. typedef struct _dbgcmd
  548. {
  549. PSZ pszCmd;
  550. ULONG dwfCmd;
  551. PCMDARG pArgTable;
  552. PFNARG pfnCmd;
  553. } DBGCMD, *PDBGCMD;
  554. typedef struct _aslterm
  555. {
  556. PUCHAR ID;
  557. ULONG TermClass;
  558. ULONG TermData;
  559. ULONG OpCode;
  560. PUCHAR UnAsmArgTypes;
  561. PUCHAR ArgActions;
  562. ULONG Flags;
  563. } ASLTERM, *PASLTERM;
  564. typedef struct _opmap
  565. {
  566. UCHAR ExtendedOpCode;
  567. UCHAR OpCodeClass;
  568. } OPMAP, *POPMAP;
  569. //dwDataType values
  570. typedef enum _OBJTYPES {
  571. OBJTYPE_UNKNOWN = 0,
  572. OBJTYPE_INTDATA,
  573. OBJTYPE_STRDATA,
  574. OBJTYPE_BUFFDATA,
  575. OBJTYPE_PKGDATA,
  576. OBJTYPE_FIELDUNIT,
  577. OBJTYPE_DEVICE,
  578. OBJTYPE_EVENT,
  579. OBJTYPE_METHOD,
  580. OBJTYPE_MUTEX,
  581. OBJTYPE_OPREGION,
  582. OBJTYPE_POWERRES,
  583. OBJTYPE_PROCESSOR,
  584. OBJTYPE_THERMALZONE,
  585. OBJTYPE_BUFFFIELD,
  586. OBJTYPE_DDBHANDLE,
  587. OBJTYPE_DEBUG,
  588. //These are internal object types (not to be exported to the ASL code)
  589. OBJTYPE_INTERNAL = 0x80,
  590. OBJTYPE_OBJALIAS = 0x80,
  591. OBJTYPE_DATAALIAS,
  592. OBJTYPE_BANKFIELD,
  593. OBJTYPE_FIELD,
  594. OBJTYPE_INDEXFIELD,
  595. OBJTYPE_DATA,
  596. OBJTYPE_DATAFIELD,
  597. OBJTYPE_DATAOBJ,
  598. } OBJTYPES;
  599. /*** Local function prototypes
  600. */
  601. LONG LOCAL AMLIDbgDebugger(PCMDARG pArg, PSZ pszArg, ULONG dwArgNum, ULONG dwNonSWArgs);
  602. LONG LOCAL AMLIDbgDNS(PCMDARG pArg, PSZ pszArg, ULONG dwArgNum, ULONG dwNonSWArgs);
  603. LONG LOCAL DumpNSObj(PSZ pszPath, BOOLEAN fRecursive);
  604. VOID LOCAL DumpNSTree(PULONG64 pnsObj, ULONG dwLevel);
  605. LONG LOCAL AMLIDbgFind(PCMDARG pArg, PSZ pszArg, ULONG dwArgNum, ULONG dwNonSWArgs);
  606. BOOLEAN LOCAL FindNSObj(NAMESEG dwName, PULONG64 pnsRoot);
  607. PSZ LOCAL GetObjectPath(PULONG64 pns);
  608. PSZ LOCAL GetObjAddrPath(ULONG64 uipns);
  609. VOID LOCAL AMLIDumpObject(PULONG64 pdata, PSZ pszName, int iLevel);
  610. PSZ LOCAL AMLIGetObjectTypeName(ULONG dwObjType);
  611. PSZ LOCAL GetRegionSpaceName(UCHAR bRegionSpace);
  612. BOOLEAN LOCAL FindObjSymbol(ULONG64 uipObj, PULONG64 puipns, PULONG pdwOffset);
  613. VOID LOCAL PrintBuffData(PUCHAR pb, ULONG dwLen);
  614. BOOLEAN LOCAL IsNumber(PSZ pszStr, ULONG dwBase, PULONG64 puipValue);
  615. LONG LOCAL DbgParseArgs(PCMDARG ArgTable, PULONG pdwNumArgs, PULONG pdwNonSWArgs, PSZ pszTokenSeps);
  616. LONG LOCAL DbgParseOneArg(PCMDARG ArgTable, PSZ psz, ULONG dwArgNum, PULONG pdwNonSWArgs);
  617. PCMDARG LOCAL DbgMatchArg(PCMDARG ArgTable, PSZ *ppsz, PULONG pdwNonSWArgs);
  618. VOID MemZero(ULONG64 uipAddr, ULONG dwSize);
  619. BYTE ReadMemByte(ULONG64 uipAddr);
  620. WORD ReadMemWord(ULONG64 uipAddr);
  621. DWORD ReadMemDWord(ULONG64 uipAddr);
  622. ULONG_PTR ReadMemUlongPtr(ULONG64 uipAddr);
  623. PVOID LOCAL GetObjBuff(PULONG64 pdata);
  624. LONG LOCAL GetNSObj(PSZ pszObjPath, PULONG64 pnsScope, PULONG64 puipns, PULONG64 pns, ULONG dwfNS);
  625. PSZ LOCAL NameSegString(ULONG dwNameSeg);
  626. VOID STDCALL AMLIDbgExecuteCmd(PSZ pszCmd);
  627. LONG LOCAL AMLIDbgHelp(PCMDARG pArg, PSZ pszArg, ULONG dwArgNum, ULONG dwNonSWArgs);
  628. PSZ LOCAL StrCat(PSZ pszDst, PSZ pszSrc, ULONG n);
  629. ULONG LOCAL StrLen(PSZ psz, ULONG n);
  630. LONG LOCAL StrCmp(PSZ psz1, PSZ psz2, ULONG n, BOOLEAN fMatchCase);
  631. PSZ LOCAL StrCpy(PSZ pszDst, PSZ pszSrc, ULONG n);
  632. ULONG64 AMLIUtilStringToUlong64(PSZ String, PSZ *End, ULONG Base);
  633. #endif //_AMLIKD_