Home | History | Annotate | Line # | Download | only in include
acapps.h revision 1.9
      1 /******************************************************************************
      2  *
      3  * Module Name: acapps - common include for ACPI applications/tools
      4  *
      5  *****************************************************************************/
      6 
      7 /*
      8  * Copyright (C) 2000 - 2016, Intel Corp.
      9  * All rights reserved.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions, and the following disclaimer,
     16  *    without modification.
     17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  *    including a substantially similar Disclaimer requirement for further
     21  *    binary redistribution.
     22  * 3. Neither the names of the above-listed copyright holders nor the names
     23  *    of any contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * Alternatively, this software may be distributed under the terms of the
     27  * GNU General Public License ("GPL") version 2 as published by the Free
     28  * Software Foundation.
     29  *
     30  * NO WARRANTY
     31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  * POSSIBILITY OF SUCH DAMAGES.
     42  */
     43 
     44 #ifndef _ACAPPS
     45 #define _ACAPPS
     46 
     47 #ifdef ACPI_USE_STANDARD_HEADERS
     48 #include <sys/stat.h>
     49 #endif /* ACPI_USE_STANDARD_HEADERS */
     50 
     51 /* Common info for tool signons */
     52 
     53 #define ACPICA_NAME                 "Intel ACPI Component Architecture"
     54 #define ACPICA_COPYRIGHT            "Copyright (c) 2000 - 2016 Intel Corporation"
     55 
     56 #if ACPI_MACHINE_WIDTH == 64
     57 #define ACPI_WIDTH          "-64"
     58 
     59 #elif ACPI_MACHINE_WIDTH == 32
     60 #define ACPI_WIDTH          "-32"
     61 
     62 #else
     63 #error unknown ACPI_MACHINE_WIDTH
     64 #define ACPI_WIDTH          "-??"
     65 
     66 #endif
     67 
     68 /* Macros for signons and file headers */
     69 #ifdef ACPI_REPRO
     70 #define ACPI_DATE "18 Dec 2013"
     71 #else
     72 #define ACPI_DATE __DATE__
     73 #endif
     74 
     75 #define ACPI_COMMON_SIGNON(UtilityName) \
     76     "\n%s\n%s version %8.8X%s\n%s\n\n", \
     77     ACPICA_NAME, \
     78     UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, \
     79     ACPICA_COPYRIGHT
     80 
     81 #define ACPI_COMMON_HEADER(UtilityName, Prefix) \
     82     "%s%s\n%s%s version %8.8X%s\n%s%s\n%s\n", \
     83     Prefix, ACPICA_NAME, \
     84     Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, \
     85     Prefix, ACPICA_COPYRIGHT, \
     86     Prefix
     87 
     88 /* Macros for usage messages */
     89 
     90 #define ACPI_USAGE_HEADER(Usage) \
     91     printf ("Usage: %s\nOptions:\n", Usage);
     92 
     93 #define ACPI_USAGE_TEXT(Description) \
     94     printf (Description);
     95 
     96 #define ACPI_OPTION(Name, Description) \
     97     printf ("  %-20s%s\n", Name, Description);
     98 
     99 
    100 /* Check for unexpected exceptions */
    101 
    102 #define ACPI_CHECK_STATUS(Name, Status, Expected) \
    103     if (Status != Expected) \
    104     { \
    105         AcpiOsPrintf ("Unexpected %s from %s (%s-%d)\n", \
    106             AcpiFormatException (Status), #Name, _AcpiModuleName, __LINE__); \
    107     }
    108 
    109 /* Check for unexpected non-AE_OK errors */
    110 
    111 
    112 #define ACPI_CHECK_OK(Name, Status)   ACPI_CHECK_STATUS (Name, Status, AE_OK);
    113 
    114 #define FILE_SUFFIX_DISASSEMBLY     "dsl"
    115 #define FILE_SUFFIX_BINARY_TABLE    ".dat" /* Needs the dot */
    116 
    117 
    118 /* acfileio */
    119 
    120 ACPI_STATUS
    121 AcGetAllTablesFromFile (
    122     char                    *Filename,
    123     UINT8                   GetOnlyAmlTables,
    124     ACPI_NEW_TABLE_DESC     **ReturnListHead);
    125 
    126 BOOLEAN
    127 AcIsFileBinary (
    128     FILE                    *File);
    129 
    130 ACPI_STATUS
    131 AcValidateTableHeader (
    132     FILE                    *File,
    133     long                    TableOffset);
    134 
    135 
    136 /* Values for GetOnlyAmlTables */
    137 
    138 #define ACPI_GET_ONLY_AML_TABLES    TRUE
    139 #define ACPI_GET_ALL_TABLES         FALSE
    140 
    141 
    142 /*
    143  * getopt
    144  */
    145 int
    146 AcpiGetopt(
    147     int                     argc,
    148     char                    **argv,
    149     char                    *opts);
    150 
    151 int
    152 AcpiGetoptArgument (
    153     int                     argc,
    154     char                    **argv);
    155 
    156 extern int                  AcpiGbl_Optind;
    157 extern int                  AcpiGbl_Opterr;
    158 extern int                  AcpiGbl_SubOptChar;
    159 extern char                 *AcpiGbl_Optarg;
    160 
    161 
    162 /*
    163  * cmfsize - Common get file size function
    164  */
    165 UINT32
    166 CmGetFileSize (
    167     ACPI_FILE               File);
    168 
    169 
    170 /*
    171  * adwalk
    172  */
    173 void
    174 AcpiDmCrossReferenceNamespace (
    175     ACPI_PARSE_OBJECT       *ParseTreeRoot,
    176     ACPI_NAMESPACE_NODE     *NamespaceRoot,
    177     ACPI_OWNER_ID           OwnerId);
    178 
    179 void
    180 AcpiDmDumpTree (
    181     ACPI_PARSE_OBJECT       *Origin);
    182 
    183 void
    184 AcpiDmFindOrphanMethods (
    185     ACPI_PARSE_OBJECT       *Origin);
    186 
    187 void
    188 AcpiDmFinishNamespaceLoad (
    189     ACPI_PARSE_OBJECT       *ParseTreeRoot,
    190     ACPI_NAMESPACE_NODE     *NamespaceRoot,
    191     ACPI_OWNER_ID           OwnerId);
    192 
    193 void
    194 AcpiDmConvertResourceIndexes (
    195     ACPI_PARSE_OBJECT       *ParseTreeRoot,
    196     ACPI_NAMESPACE_NODE     *NamespaceRoot);
    197 
    198 
    199 /*
    200  * adfile
    201  */
    202 ACPI_STATUS
    203 AdInitialize (
    204     void);
    205 
    206 char *
    207 FlGenerateFilename (
    208     char                    *InputFilename,
    209     char                    *Suffix);
    210 
    211 ACPI_STATUS
    212 FlSplitInputPathname (
    213     char                    *InputPath,
    214     char                    **OutDirectoryPath,
    215     char                    **OutFilename);
    216 
    217 char *
    218 AdGenerateFilename (
    219     char                    *Prefix,
    220     char                    *TableId);
    221 
    222 void
    223 AdWriteTable (
    224     ACPI_TABLE_HEADER       *Table,
    225     UINT32                  Length,
    226     char                    *TableName,
    227     char                    *OemTableId);
    228 
    229 #endif /* _ACAPPS */
    230