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