1
1

acapps.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. /******************************************************************************
  2. *
  3. * Module Name: acapps - common include for ACPI applications/tools
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2019, 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 _ACAPPS
  43. #define _ACAPPS
  44. #ifdef ACPI_USE_STANDARD_HEADERS
  45. #include <sys/stat.h>
  46. #endif /* ACPI_USE_STANDARD_HEADERS */
  47. /* Common info for tool signons */
  48. #define ACPICA_NAME "Intel ACPI Component Architecture"
  49. #define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2019 Intel Corporation"
  50. #if ACPI_MACHINE_WIDTH == 64
  51. #define ACPI_WIDTH " (64-bit version)"
  52. #elif ACPI_MACHINE_WIDTH == 32
  53. #define ACPI_WIDTH " (32-bit version)"
  54. #else
  55. #error unknown ACPI_MACHINE_WIDTH
  56. #define ACPI_WIDTH " (unknown bit width, not 32 or 64)"
  57. #endif
  58. /* Macros for signons and file headers */
  59. #define ACPI_COMMON_SIGNON(UtilityName) \
  60. "\n%s\n%s version %8.8X\n%s\n\n", \
  61. ACPICA_NAME, \
  62. UtilityName, ((UINT32) ACPI_CA_VERSION), \
  63. ACPICA_COPYRIGHT
  64. #define ACPI_COMMON_HEADER(UtilityName, Prefix) \
  65. "%s%s\n%s%s version %8.8X%s\n%s%s\n%s\n", \
  66. Prefix, ACPICA_NAME, \
  67. Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, \
  68. Prefix, ACPICA_COPYRIGHT, \
  69. Prefix
  70. #define ACPI_COMMON_BUILD_TIME \
  71. "Build date/time: %s %s\n", __DATE__, __TIME__
  72. /* Macros for usage messages */
  73. #define ACPI_USAGE_HEADER(Usage) \
  74. printf ("Usage: %s\nOptions:\n", Usage);
  75. #define ACPI_USAGE_TEXT(Description) \
  76. printf (Description);
  77. #define ACPI_OPTION(Name, Description) \
  78. printf (" %-20s%s\n", Name, Description);
  79. /* Check for unexpected exceptions */
  80. #define ACPI_CHECK_STATUS(Name, Status, Expected) \
  81. if (Status != Expected) \
  82. { \
  83. AcpiOsPrintf ("Unexpected %s from %s (%s-%d)\n", \
  84. AcpiFormatException (Status), #Name, _AcpiModuleName, __LINE__); \
  85. }
  86. /* Check for unexpected non-AE_OK errors */
  87. #define ACPI_CHECK_OK(Name, Status) ACPI_CHECK_STATUS (Name, Status, AE_OK);
  88. #define FILE_SUFFIX_DISASSEMBLY "dsl"
  89. #define FILE_SUFFIX_BINARY_TABLE ".dat" /* Needs the dot */
  90. /* acfileio */
  91. ACPI_STATUS
  92. AcGetAllTablesFromFile (
  93. char *Filename,
  94. UINT8 GetOnlyAmlTables,
  95. ACPI_NEW_TABLE_DESC **ReturnListHead);
  96. void
  97. AcDeleteTableList (
  98. ACPI_NEW_TABLE_DESC *ListHead);
  99. BOOLEAN
  100. AcIsFileBinary (
  101. FILE *File);
  102. ACPI_STATUS
  103. AcValidateTableHeader (
  104. FILE *File,
  105. long TableOffset);
  106. /* Values for GetOnlyAmlTables */
  107. #define ACPI_GET_ONLY_AML_TABLES TRUE
  108. #define ACPI_GET_ALL_TABLES FALSE
  109. /*
  110. * getopt
  111. */
  112. int
  113. AcpiGetopt(
  114. int argc,
  115. char **argv,
  116. char *opts);
  117. int
  118. AcpiGetoptArgument (
  119. int argc,
  120. char **argv);
  121. extern int AcpiGbl_Optind;
  122. extern int AcpiGbl_Opterr;
  123. extern int AcpiGbl_SubOptChar;
  124. extern char *AcpiGbl_Optarg;
  125. /*
  126. * cmfsize - Common get file size function
  127. */
  128. UINT32
  129. CmGetFileSize (
  130. ACPI_FILE File);
  131. /*
  132. * adwalk
  133. */
  134. void
  135. AcpiDmCrossReferenceNamespace (
  136. ACPI_PARSE_OBJECT *ParseTreeRoot,
  137. ACPI_NAMESPACE_NODE *NamespaceRoot,
  138. ACPI_OWNER_ID OwnerId);
  139. void
  140. AcpiDmDumpTree (
  141. ACPI_PARSE_OBJECT *Origin);
  142. void
  143. AcpiDmFindOrphanMethods (
  144. ACPI_PARSE_OBJECT *Origin);
  145. void
  146. AcpiDmFinishNamespaceLoad (
  147. ACPI_PARSE_OBJECT *ParseTreeRoot,
  148. ACPI_NAMESPACE_NODE *NamespaceRoot,
  149. ACPI_OWNER_ID OwnerId);
  150. void
  151. AcpiDmConvertParseObjects (
  152. ACPI_PARSE_OBJECT *ParseTreeRoot,
  153. ACPI_NAMESPACE_NODE *NamespaceRoot);
  154. /*
  155. * adfile
  156. */
  157. ACPI_STATUS
  158. AdInitialize (
  159. void);
  160. char *
  161. FlGenerateFilename (
  162. char *InputFilename,
  163. char *Suffix);
  164. ACPI_STATUS
  165. FlSplitInputPathname (
  166. char *InputPath,
  167. char **OutDirectoryPath,
  168. char **OutFilename);
  169. char *
  170. FlGetFileBasename (
  171. char *FilePathname);
  172. char *
  173. AdGenerateFilename (
  174. char *Prefix,
  175. char *TableId);
  176. void
  177. AdWriteTable (
  178. ACPI_TABLE_HEADER *Table,
  179. UINT32 Length,
  180. char *TableName,
  181. char *OemTableId);
  182. #endif /* _ACAPPS */