acutils.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086
  1. /******************************************************************************
  2. *
  3. * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2015, Intel Corp.
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions, and the following disclaimer,
  15. * without modification.
  16. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  17. * substantially similar to the "NO WARRANTY" disclaimer below
  18. * ("Disclaimer") and any redistribution must be conditioned upon
  19. * including a substantially similar Disclaimer requirement for further
  20. * binary redistribution.
  21. * 3. Neither the names of the above-listed copyright holders nor the names
  22. * of any contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * Alternatively, this software may be distributed under the terms of the
  26. * GNU General Public License ("GPL") version 2 as published by the Free
  27. * Software Foundation.
  28. *
  29. * NO WARRANTY
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  31. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  32. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  33. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  34. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  36. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  38. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  39. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGES.
  41. */
  42. #ifndef _ACUTILS_H
  43. #define _ACUTILS_H
  44. extern const UINT8 AcpiGbl_ResourceAmlSizes[];
  45. extern const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[];
  46. /* Strings used by the disassembler and debugger resource dump routines */
  47. #if defined(ACPI_DEBUG_OUTPUT) || defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
  48. extern const char *AcpiGbl_BmDecode[];
  49. extern const char *AcpiGbl_ConfigDecode[];
  50. extern const char *AcpiGbl_ConsumeDecode[];
  51. extern const char *AcpiGbl_DecDecode[];
  52. extern const char *AcpiGbl_HeDecode[];
  53. extern const char *AcpiGbl_IoDecode[];
  54. extern const char *AcpiGbl_LlDecode[];
  55. extern const char *AcpiGbl_MaxDecode[];
  56. extern const char *AcpiGbl_MemDecode[];
  57. extern const char *AcpiGbl_MinDecode[];
  58. extern const char *AcpiGbl_MtpDecode[];
  59. extern const char *AcpiGbl_RngDecode[];
  60. extern const char *AcpiGbl_RwDecode[];
  61. extern const char *AcpiGbl_ShrDecode[];
  62. extern const char *AcpiGbl_SizDecode[];
  63. extern const char *AcpiGbl_TrsDecode[];
  64. extern const char *AcpiGbl_TtpDecode[];
  65. extern const char *AcpiGbl_TypDecode[];
  66. extern const char *AcpiGbl_PpcDecode[];
  67. extern const char *AcpiGbl_IorDecode[];
  68. extern const char *AcpiGbl_DtsDecode[];
  69. extern const char *AcpiGbl_CtDecode[];
  70. extern const char *AcpiGbl_SbtDecode[];
  71. extern const char *AcpiGbl_AmDecode[];
  72. extern const char *AcpiGbl_SmDecode[];
  73. extern const char *AcpiGbl_WmDecode[];
  74. extern const char *AcpiGbl_CphDecode[];
  75. extern const char *AcpiGbl_CpoDecode[];
  76. extern const char *AcpiGbl_DpDecode[];
  77. extern const char *AcpiGbl_EdDecode[];
  78. extern const char *AcpiGbl_BpbDecode[];
  79. extern const char *AcpiGbl_SbDecode[];
  80. extern const char *AcpiGbl_FcDecode[];
  81. extern const char *AcpiGbl_PtDecode[];
  82. #endif
  83. /*
  84. * For the iASL compiler case, the output is redirected to stderr so that
  85. * any of the various ACPI errors and warnings do not appear in the output
  86. * files, for either the compiler or disassembler portions of the tool.
  87. */
  88. #ifdef ACPI_ASL_COMPILER
  89. #include <stdio.h>
  90. #define ACPI_MSG_REDIRECT_BEGIN \
  91. FILE *OutputFile = AcpiGbl_OutputFile; \
  92. AcpiOsRedirectOutput (stderr);
  93. #define ACPI_MSG_REDIRECT_END \
  94. AcpiOsRedirectOutput (OutputFile);
  95. #else
  96. /*
  97. * non-iASL case - no redirection, nothing to do
  98. */
  99. #define ACPI_MSG_REDIRECT_BEGIN
  100. #define ACPI_MSG_REDIRECT_END
  101. #endif
  102. /*
  103. * Common error message prefixes
  104. */
  105. #define ACPI_MSG_ERROR "ACPI Error: "
  106. #define ACPI_MSG_EXCEPTION "ACPI Exception: "
  107. #define ACPI_MSG_WARNING "ACPI Warning: "
  108. #define ACPI_MSG_INFO "ACPI: "
  109. #define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): "
  110. #define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): "
  111. /*
  112. * Common message suffix
  113. */
  114. #define ACPI_MSG_SUFFIX \
  115. AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber)
  116. /* Types for Resource descriptor entries */
  117. #define ACPI_INVALID_RESOURCE 0
  118. #define ACPI_FIXED_LENGTH 1
  119. #define ACPI_VARIABLE_LENGTH 2
  120. #define ACPI_SMALL_VARIABLE_LENGTH 3
  121. typedef
  122. ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
  123. UINT8 *Aml,
  124. UINT32 Length,
  125. UINT32 Offset,
  126. UINT8 ResourceIndex,
  127. void **Context);
  128. typedef
  129. ACPI_STATUS (*ACPI_PKG_CALLBACK) (
  130. UINT8 ObjectType,
  131. ACPI_OPERAND_OBJECT *SourceObject,
  132. ACPI_GENERIC_STATE *State,
  133. void *Context);
  134. typedef struct acpi_pkg_info
  135. {
  136. UINT8 *FreeSpace;
  137. ACPI_SIZE Length;
  138. UINT32 ObjectSpace;
  139. UINT32 NumPackages;
  140. } ACPI_PKG_INFO;
  141. /* Object reference counts */
  142. #define REF_INCREMENT (UINT16) 0
  143. #define REF_DECREMENT (UINT16) 1
  144. /* AcpiUtDumpBuffer */
  145. #define DB_BYTE_DISPLAY 1
  146. #define DB_WORD_DISPLAY 2
  147. #define DB_DWORD_DISPLAY 4
  148. #define DB_QWORD_DISPLAY 8
  149. /*
  150. * utnonansi - Non-ANSI C library functions
  151. */
  152. void
  153. AcpiUtStrupr (
  154. char *SrcString);
  155. void
  156. AcpiUtStrlwr (
  157. char *SrcString);
  158. int
  159. AcpiUtStricmp (
  160. char *String1,
  161. char *String2);
  162. ACPI_STATUS
  163. AcpiUtStrtoul64 (
  164. char *String,
  165. UINT32 Base,
  166. UINT64 *RetInteger);
  167. /*
  168. * utglobal - Global data structures and procedures
  169. */
  170. ACPI_STATUS
  171. AcpiUtInitGlobals (
  172. void);
  173. #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
  174. const char *
  175. AcpiUtGetMutexName (
  176. UINT32 MutexId);
  177. const char *
  178. AcpiUtGetNotifyName (
  179. UINT32 NotifyValue,
  180. ACPI_OBJECT_TYPE Type);
  181. #endif
  182. const char *
  183. AcpiUtGetTypeName (
  184. ACPI_OBJECT_TYPE Type);
  185. const char *
  186. AcpiUtGetNodeName (
  187. void *Object);
  188. const char *
  189. AcpiUtGetDescriptorName (
  190. void *Object);
  191. const char *
  192. AcpiUtGetReferenceName (
  193. ACPI_OPERAND_OBJECT *Object);
  194. const char *
  195. AcpiUtGetObjectTypeName (
  196. ACPI_OPERAND_OBJECT *ObjDesc);
  197. const char *
  198. AcpiUtGetRegionName (
  199. UINT8 SpaceId);
  200. const char *
  201. AcpiUtGetEventName (
  202. UINT32 EventId);
  203. char
  204. AcpiUtHexToAsciiChar (
  205. UINT64 Integer,
  206. UINT32 Position);
  207. UINT8
  208. AcpiUtAsciiCharToHex (
  209. int HexChar);
  210. BOOLEAN
  211. AcpiUtValidObjectType (
  212. ACPI_OBJECT_TYPE Type);
  213. /*
  214. * utinit - miscellaneous initialization and shutdown
  215. */
  216. ACPI_STATUS
  217. AcpiUtHardwareInitialize (
  218. void);
  219. void
  220. AcpiUtSubsystemShutdown (
  221. void);
  222. /*
  223. * utcopy - Object construction and conversion interfaces
  224. */
  225. ACPI_STATUS
  226. AcpiUtBuildSimpleObject(
  227. ACPI_OPERAND_OBJECT *Obj,
  228. ACPI_OBJECT *UserObj,
  229. UINT8 *DataSpace,
  230. UINT32 *BufferSpaceUsed);
  231. ACPI_STATUS
  232. AcpiUtBuildPackageObject (
  233. ACPI_OPERAND_OBJECT *Obj,
  234. UINT8 *Buffer,
  235. UINT32 *SpaceUsed);
  236. ACPI_STATUS
  237. AcpiUtCopyIobjectToEobject (
  238. ACPI_OPERAND_OBJECT *Obj,
  239. ACPI_BUFFER *RetBuffer);
  240. ACPI_STATUS
  241. AcpiUtCopyEobjectToIobject (
  242. ACPI_OBJECT *Obj,
  243. ACPI_OPERAND_OBJECT **InternalObj);
  244. ACPI_STATUS
  245. AcpiUtCopyISimpleToIsimple (
  246. ACPI_OPERAND_OBJECT *SourceObj,
  247. ACPI_OPERAND_OBJECT *DestObj);
  248. ACPI_STATUS
  249. AcpiUtCopyIobjectToIobject (
  250. ACPI_OPERAND_OBJECT *SourceDesc,
  251. ACPI_OPERAND_OBJECT **DestDesc,
  252. ACPI_WALK_STATE *WalkState);
  253. /*
  254. * utcreate - Object creation
  255. */
  256. ACPI_STATUS
  257. AcpiUtUpdateObjectReference (
  258. ACPI_OPERAND_OBJECT *Object,
  259. UINT16 Action);
  260. /*
  261. * utdebug - Debug interfaces
  262. */
  263. void
  264. AcpiUtInitStackPtrTrace (
  265. void);
  266. void
  267. AcpiUtTrackStackPtr (
  268. void);
  269. void
  270. AcpiUtTrace (
  271. UINT32 LineNumber,
  272. const char *FunctionName,
  273. const char *ModuleName,
  274. UINT32 ComponentId);
  275. void
  276. AcpiUtTracePtr (
  277. UINT32 LineNumber,
  278. const char *FunctionName,
  279. const char *ModuleName,
  280. UINT32 ComponentId,
  281. void *Pointer);
  282. void
  283. AcpiUtTraceU32 (
  284. UINT32 LineNumber,
  285. const char *FunctionName,
  286. const char *ModuleName,
  287. UINT32 ComponentId,
  288. UINT32 Integer);
  289. void
  290. AcpiUtTraceStr (
  291. UINT32 LineNumber,
  292. const char *FunctionName,
  293. const char *ModuleName,
  294. UINT32 ComponentId,
  295. char *String);
  296. void
  297. AcpiUtExit (
  298. UINT32 LineNumber,
  299. const char *FunctionName,
  300. const char *ModuleName,
  301. UINT32 ComponentId);
  302. void
  303. AcpiUtStatusExit (
  304. UINT32 LineNumber,
  305. const char *FunctionName,
  306. const char *ModuleName,
  307. UINT32 ComponentId,
  308. ACPI_STATUS Status);
  309. void
  310. AcpiUtValueExit (
  311. UINT32 LineNumber,
  312. const char *FunctionName,
  313. const char *ModuleName,
  314. UINT32 ComponentId,
  315. UINT64 Value);
  316. void
  317. AcpiUtPtrExit (
  318. UINT32 LineNumber,
  319. const char *FunctionName,
  320. const char *ModuleName,
  321. UINT32 ComponentId,
  322. UINT8 *Ptr);
  323. void
  324. AcpiUtDebugDumpBuffer (
  325. UINT8 *Buffer,
  326. UINT32 Count,
  327. UINT32 Display,
  328. UINT32 ComponentId);
  329. void
  330. AcpiUtDumpBuffer (
  331. UINT8 *Buffer,
  332. UINT32 Count,
  333. UINT32 Display,
  334. UINT32 Offset);
  335. #ifdef ACPI_APPLICATION
  336. void
  337. AcpiUtDumpBufferToFile (
  338. ACPI_FILE File,
  339. UINT8 *Buffer,
  340. UINT32 Count,
  341. UINT32 Display,
  342. UINT32 BaseOffset);
  343. #endif
  344. void
  345. AcpiUtReportError (
  346. char *ModuleName,
  347. UINT32 LineNumber);
  348. void
  349. AcpiUtReportInfo (
  350. char *ModuleName,
  351. UINT32 LineNumber);
  352. void
  353. AcpiUtReportWarning (
  354. char *ModuleName,
  355. UINT32 LineNumber);
  356. /*
  357. * utdelete - Object deletion and reference counts
  358. */
  359. void
  360. AcpiUtAddReference (
  361. ACPI_OPERAND_OBJECT *Object);
  362. void
  363. AcpiUtRemoveReference (
  364. ACPI_OPERAND_OBJECT *Object);
  365. void
  366. AcpiUtDeleteInternalPackageObject (
  367. ACPI_OPERAND_OBJECT *Object);
  368. void
  369. AcpiUtDeleteInternalSimpleObject (
  370. ACPI_OPERAND_OBJECT *Object);
  371. void
  372. AcpiUtDeleteInternalObjectList (
  373. ACPI_OPERAND_OBJECT **ObjList);
  374. /*
  375. * uteval - object evaluation
  376. */
  377. ACPI_STATUS
  378. AcpiUtEvaluateObject (
  379. ACPI_NAMESPACE_NODE *PrefixNode,
  380. char *Path,
  381. UINT32 ExpectedReturnBtypes,
  382. ACPI_OPERAND_OBJECT **ReturnDesc);
  383. ACPI_STATUS
  384. AcpiUtEvaluateNumericObject (
  385. char *ObjectName,
  386. ACPI_NAMESPACE_NODE *DeviceNode,
  387. UINT64 *Value);
  388. ACPI_STATUS
  389. AcpiUtExecute_STA (
  390. ACPI_NAMESPACE_NODE *DeviceNode,
  391. UINT32 *StatusFlags);
  392. ACPI_STATUS
  393. AcpiUtExecutePowerMethods (
  394. ACPI_NAMESPACE_NODE *DeviceNode,
  395. const char **MethodNames,
  396. UINT8 MethodCount,
  397. UINT8 *OutValues);
  398. /*
  399. * utids - device ID support
  400. */
  401. ACPI_STATUS
  402. AcpiUtExecute_HID (
  403. ACPI_NAMESPACE_NODE *DeviceNode,
  404. ACPI_PNP_DEVICE_ID **ReturnId);
  405. ACPI_STATUS
  406. AcpiUtExecute_UID (
  407. ACPI_NAMESPACE_NODE *DeviceNode,
  408. ACPI_PNP_DEVICE_ID **ReturnId);
  409. ACPI_STATUS
  410. AcpiUtExecute_CID (
  411. ACPI_NAMESPACE_NODE *DeviceNode,
  412. ACPI_PNP_DEVICE_ID_LIST **ReturnCidList);
  413. ACPI_STATUS
  414. AcpiUtExecute_CLS (
  415. ACPI_NAMESPACE_NODE *DeviceNode,
  416. ACPI_PNP_DEVICE_ID **ReturnId);
  417. /*
  418. * utlock - reader/writer locks
  419. */
  420. ACPI_STATUS
  421. AcpiUtCreateRwLock (
  422. ACPI_RW_LOCK *Lock);
  423. void
  424. AcpiUtDeleteRwLock (
  425. ACPI_RW_LOCK *Lock);
  426. ACPI_STATUS
  427. AcpiUtAcquireReadLock (
  428. ACPI_RW_LOCK *Lock);
  429. ACPI_STATUS
  430. AcpiUtReleaseReadLock (
  431. ACPI_RW_LOCK *Lock);
  432. ACPI_STATUS
  433. AcpiUtAcquireWriteLock (
  434. ACPI_RW_LOCK *Lock);
  435. void
  436. AcpiUtReleaseWriteLock (
  437. ACPI_RW_LOCK *Lock);
  438. /*
  439. * utobject - internal object create/delete/cache routines
  440. */
  441. ACPI_OPERAND_OBJECT *
  442. AcpiUtCreateInternalObjectDbg (
  443. const char *ModuleName,
  444. UINT32 LineNumber,
  445. UINT32 ComponentId,
  446. ACPI_OBJECT_TYPE Type);
  447. void *
  448. AcpiUtAllocateObjectDescDbg (
  449. const char *ModuleName,
  450. UINT32 LineNumber,
  451. UINT32 ComponentId);
  452. #define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t)
  453. #define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT)
  454. void
  455. AcpiUtDeleteObjectDesc (
  456. ACPI_OPERAND_OBJECT *Object);
  457. BOOLEAN
  458. AcpiUtValidInternalObject (
  459. void *Object);
  460. ACPI_OPERAND_OBJECT *
  461. AcpiUtCreatePackageObject (
  462. UINT32 Count);
  463. ACPI_OPERAND_OBJECT *
  464. AcpiUtCreateIntegerObject (
  465. UINT64 Value);
  466. ACPI_OPERAND_OBJECT *
  467. AcpiUtCreateBufferObject (
  468. ACPI_SIZE BufferSize);
  469. ACPI_OPERAND_OBJECT *
  470. AcpiUtCreateStringObject (
  471. ACPI_SIZE StringSize);
  472. ACPI_STATUS
  473. AcpiUtGetObjectSize(
  474. ACPI_OPERAND_OBJECT *Obj,
  475. ACPI_SIZE *ObjLength);
  476. /*
  477. * utosi - Support for the _OSI predefined control method
  478. */
  479. ACPI_STATUS
  480. AcpiUtInitializeInterfaces (
  481. void);
  482. ACPI_STATUS
  483. AcpiUtInterfaceTerminate (
  484. void);
  485. ACPI_STATUS
  486. AcpiUtInstallInterface (
  487. ACPI_STRING InterfaceName);
  488. ACPI_STATUS
  489. AcpiUtRemoveInterface (
  490. ACPI_STRING InterfaceName);
  491. ACPI_STATUS
  492. AcpiUtUpdateInterfaces (
  493. UINT8 Action);
  494. ACPI_INTERFACE_INFO *
  495. AcpiUtGetInterface (
  496. ACPI_STRING InterfaceName);
  497. ACPI_STATUS
  498. AcpiUtOsiImplementation (
  499. ACPI_WALK_STATE *WalkState);
  500. /*
  501. * utpredef - support for predefined names
  502. */
  503. const ACPI_PREDEFINED_INFO *
  504. AcpiUtGetNextPredefinedMethod (
  505. const ACPI_PREDEFINED_INFO *ThisName);
  506. const ACPI_PREDEFINED_INFO *
  507. AcpiUtMatchPredefinedMethod (
  508. char *Name);
  509. void
  510. AcpiUtGetExpectedReturnTypes (
  511. char *Buffer,
  512. UINT32 ExpectedBtypes);
  513. #if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP)
  514. const ACPI_PREDEFINED_INFO *
  515. AcpiUtMatchResourceName (
  516. char *Name);
  517. void
  518. AcpiUtDisplayPredefinedMethod (
  519. char *Buffer,
  520. const ACPI_PREDEFINED_INFO *ThisName,
  521. BOOLEAN MultiLine);
  522. UINT32
  523. AcpiUtGetResourceBitWidth (
  524. char *Buffer,
  525. UINT16 Types);
  526. #endif
  527. /*
  528. * utstate - Generic state creation/cache routines
  529. */
  530. void
  531. AcpiUtPushGenericState (
  532. ACPI_GENERIC_STATE **ListHead,
  533. ACPI_GENERIC_STATE *State);
  534. ACPI_GENERIC_STATE *
  535. AcpiUtPopGenericState (
  536. ACPI_GENERIC_STATE **ListHead);
  537. ACPI_GENERIC_STATE *
  538. AcpiUtCreateGenericState (
  539. void);
  540. ACPI_THREAD_STATE *
  541. AcpiUtCreateThreadState (
  542. void);
  543. ACPI_GENERIC_STATE *
  544. AcpiUtCreateUpdateState (
  545. ACPI_OPERAND_OBJECT *Object,
  546. UINT16 Action);
  547. ACPI_GENERIC_STATE *
  548. AcpiUtCreatePkgState (
  549. void *InternalObject,
  550. void *ExternalObject,
  551. UINT16 Index);
  552. ACPI_STATUS
  553. AcpiUtCreateUpdateStateAndPush (
  554. ACPI_OPERAND_OBJECT *Object,
  555. UINT16 Action,
  556. ACPI_GENERIC_STATE **StateList);
  557. ACPI_GENERIC_STATE *
  558. AcpiUtCreateControlState (
  559. void);
  560. void
  561. AcpiUtDeleteGenericState (
  562. ACPI_GENERIC_STATE *State);
  563. /*
  564. * utmath
  565. */
  566. ACPI_STATUS
  567. AcpiUtDivide (
  568. UINT64 InDividend,
  569. UINT64 InDivisor,
  570. UINT64 *OutQuotient,
  571. UINT64 *OutRemainder);
  572. ACPI_STATUS
  573. AcpiUtShortDivide (
  574. UINT64 InDividend,
  575. UINT32 Divisor,
  576. UINT64 *OutQuotient,
  577. UINT32 *OutRemainder);
  578. /*
  579. * utmisc
  580. */
  581. const ACPI_EXCEPTION_INFO *
  582. AcpiUtValidateException (
  583. ACPI_STATUS Status);
  584. BOOLEAN
  585. AcpiUtIsPciRootBridge (
  586. char *Id);
  587. #if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP)
  588. BOOLEAN
  589. AcpiUtIsAmlTable (
  590. ACPI_TABLE_HEADER *Table);
  591. #endif
  592. ACPI_STATUS
  593. AcpiUtWalkPackageTree (
  594. ACPI_OPERAND_OBJECT *SourceObject,
  595. void *TargetObject,
  596. ACPI_PKG_CALLBACK WalkCallback,
  597. void *Context);
  598. /* Values for Base above (16=Hex, 10=Decimal) */
  599. #define ACPI_ANY_BASE 0
  600. UINT32
  601. AcpiUtDwordByteSwap (
  602. UINT32 Value);
  603. void
  604. AcpiUtSetIntegerWidth (
  605. UINT8 Revision);
  606. #ifdef ACPI_DEBUG_OUTPUT
  607. void
  608. AcpiUtDisplayInitPathname (
  609. UINT8 Type,
  610. ACPI_NAMESPACE_NODE *ObjHandle,
  611. char *Path);
  612. #endif
  613. /*
  614. * utownerid - Support for Table/Method Owner IDs
  615. */
  616. ACPI_STATUS
  617. AcpiUtAllocateOwnerId (
  618. ACPI_OWNER_ID *OwnerId);
  619. void
  620. AcpiUtReleaseOwnerId (
  621. ACPI_OWNER_ID *OwnerId);
  622. /*
  623. * utresrc
  624. */
  625. ACPI_STATUS
  626. AcpiUtWalkAmlResources (
  627. ACPI_WALK_STATE *WalkState,
  628. UINT8 *Aml,
  629. ACPI_SIZE AmlLength,
  630. ACPI_WALK_AML_CALLBACK UserFunction,
  631. void **Context);
  632. ACPI_STATUS
  633. AcpiUtValidateResource (
  634. ACPI_WALK_STATE *WalkState,
  635. void *Aml,
  636. UINT8 *ReturnIndex);
  637. UINT32
  638. AcpiUtGetDescriptorLength (
  639. void *Aml);
  640. UINT16
  641. AcpiUtGetResourceLength (
  642. void *Aml);
  643. UINT8
  644. AcpiUtGetResourceHeaderLength (
  645. void *Aml);
  646. UINT8
  647. AcpiUtGetResourceType (
  648. void *Aml);
  649. ACPI_STATUS
  650. AcpiUtGetResourceEndTag (
  651. ACPI_OPERAND_OBJECT *ObjDesc,
  652. UINT8 **EndTag);
  653. /*
  654. * utstring - String and character utilities
  655. */
  656. void
  657. AcpiUtPrintString (
  658. char *String,
  659. UINT16 MaxLength);
  660. #if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP
  661. void
  662. UtConvertBackslashes (
  663. char *Pathname);
  664. #endif
  665. BOOLEAN
  666. AcpiUtValidAcpiName (
  667. char *Name);
  668. BOOLEAN
  669. AcpiUtValidAcpiChar (
  670. char Character,
  671. UINT32 Position);
  672. void
  673. AcpiUtRepairName (
  674. char *Name);
  675. #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
  676. BOOLEAN
  677. AcpiUtSafeStrcpy (
  678. char *Dest,
  679. ACPI_SIZE DestSize,
  680. char *Source);
  681. BOOLEAN
  682. AcpiUtSafeStrcat (
  683. char *Dest,
  684. ACPI_SIZE DestSize,
  685. char *Source);
  686. BOOLEAN
  687. AcpiUtSafeStrncat (
  688. char *Dest,
  689. ACPI_SIZE DestSize,
  690. char *Source,
  691. ACPI_SIZE MaxTransferLength);
  692. #endif
  693. /*
  694. * utmutex - mutex support
  695. */
  696. ACPI_STATUS
  697. AcpiUtMutexInitialize (
  698. void);
  699. void
  700. AcpiUtMutexTerminate (
  701. void);
  702. ACPI_STATUS
  703. AcpiUtAcquireMutex (
  704. ACPI_MUTEX_HANDLE MutexId);
  705. ACPI_STATUS
  706. AcpiUtReleaseMutex (
  707. ACPI_MUTEX_HANDLE MutexId);
  708. /*
  709. * utalloc - memory allocation and object caching
  710. */
  711. ACPI_STATUS
  712. AcpiUtCreateCaches (
  713. void);
  714. ACPI_STATUS
  715. AcpiUtDeleteCaches (
  716. void);
  717. ACPI_STATUS
  718. AcpiUtValidateBuffer (
  719. ACPI_BUFFER *Buffer);
  720. ACPI_STATUS
  721. AcpiUtInitializeBuffer (
  722. ACPI_BUFFER *Buffer,
  723. ACPI_SIZE RequiredLength);
  724. #ifdef ACPI_DBG_TRACK_ALLOCATIONS
  725. void *
  726. AcpiUtAllocateAndTrack (
  727. ACPI_SIZE Size,
  728. UINT32 Component,
  729. const char *Module,
  730. UINT32 Line);
  731. void *
  732. AcpiUtAllocateZeroedAndTrack (
  733. ACPI_SIZE Size,
  734. UINT32 Component,
  735. const char *Module,
  736. UINT32 Line);
  737. void
  738. AcpiUtFreeAndTrack (
  739. void *Address,
  740. UINT32 Component,
  741. const char *Module,
  742. UINT32 Line);
  743. void
  744. AcpiUtDumpAllocationInfo (
  745. void);
  746. void
  747. AcpiUtDumpAllocations (
  748. UINT32 Component,
  749. const char *Module);
  750. ACPI_STATUS
  751. AcpiUtCreateList (
  752. char *ListName,
  753. UINT16 ObjectSize,
  754. ACPI_MEMORY_LIST **ReturnCache);
  755. #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
  756. /*
  757. * utaddress - address range check
  758. */
  759. ACPI_STATUS
  760. AcpiUtAddAddressRange (
  761. ACPI_ADR_SPACE_TYPE SpaceId,
  762. ACPI_PHYSICAL_ADDRESS Address,
  763. UINT32 Length,
  764. ACPI_NAMESPACE_NODE *RegionNode);
  765. void
  766. AcpiUtRemoveAddressRange (
  767. ACPI_ADR_SPACE_TYPE SpaceId,
  768. ACPI_NAMESPACE_NODE *RegionNode);
  769. UINT32
  770. AcpiUtCheckAddressRange (
  771. ACPI_ADR_SPACE_TYPE SpaceId,
  772. ACPI_PHYSICAL_ADDRESS Address,
  773. UINT32 Length,
  774. BOOLEAN Warn);
  775. void
  776. AcpiUtDeleteAddressLists (
  777. void);
  778. /*
  779. * utxferror - various error/warning output functions
  780. */
  781. void ACPI_INTERNAL_VAR_XFACE
  782. AcpiUtPredefinedWarning (
  783. const char *ModuleName,
  784. UINT32 LineNumber,
  785. char *Pathname,
  786. UINT8 NodeFlags,
  787. const char *Format,
  788. ...);
  789. void ACPI_INTERNAL_VAR_XFACE
  790. AcpiUtPredefinedInfo (
  791. const char *ModuleName,
  792. UINT32 LineNumber,
  793. char *Pathname,
  794. UINT8 NodeFlags,
  795. const char *Format,
  796. ...);
  797. void ACPI_INTERNAL_VAR_XFACE
  798. AcpiUtPredefinedBiosError (
  799. const char *ModuleName,
  800. UINT32 LineNumber,
  801. char *Pathname,
  802. UINT8 NodeFlags,
  803. const char *Format,
  804. ...);
  805. void
  806. AcpiUtNamespaceError (
  807. const char *ModuleName,
  808. UINT32 LineNumber,
  809. const char *InternalName,
  810. ACPI_STATUS LookupStatus);
  811. void
  812. AcpiUtMethodError (
  813. const char *ModuleName,
  814. UINT32 LineNumber,
  815. const char *Message,
  816. ACPI_NAMESPACE_NODE *Node,
  817. const char *Path,
  818. ACPI_STATUS LookupStatus);
  819. /*
  820. * Utility functions for ACPI names and IDs
  821. */
  822. const AH_PREDEFINED_NAME *
  823. AcpiAhMatchPredefinedName (
  824. char *Nameseg);
  825. const AH_DEVICE_ID *
  826. AcpiAhMatchHardwareId (
  827. char *Hid);
  828. const char *
  829. AcpiAhMatchUuid (
  830. UINT8 *Data);
  831. /*
  832. * utprint - printf/vprintf output functions
  833. */
  834. const char *
  835. AcpiUtScanNumber (
  836. const char *String,
  837. UINT64 *NumberPtr);
  838. const char *
  839. AcpiUtPrintNumber (
  840. char *String,
  841. UINT64 Number);
  842. int
  843. AcpiUtVsnprintf (
  844. char *String,
  845. ACPI_SIZE Size,
  846. const char *Format,
  847. va_list Args);
  848. int
  849. AcpiUtSnprintf (
  850. char *String,
  851. ACPI_SIZE Size,
  852. const char *Format,
  853. ...);
  854. #ifdef ACPI_APPLICATION
  855. int
  856. AcpiUtFileVprintf (
  857. ACPI_FILE File,
  858. const char *Format,
  859. va_list Args);
  860. int
  861. AcpiUtFilePrintf (
  862. ACPI_FILE File,
  863. const char *Format,
  864. ...);
  865. #endif
  866. /*
  867. * utuuid -- UUID support functions
  868. */
  869. #if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP)
  870. void
  871. AcpiUtConvertStringToUuid (
  872. char *InString,
  873. UINT8 *UuidBuffer);
  874. #endif
  875. #endif /* _ACUTILS_H */