Home | History | Annotate | Line # | Download | only in acpihelp
acpihelp.h revision 1.1.1.14
      1       1.1    jruoho /******************************************************************************
      2       1.1    jruoho  *
      3       1.1    jruoho  * Module Name: acpihelp.h - Include file for AcpiHelp utility
      4       1.1    jruoho  *
      5       1.1    jruoho  *****************************************************************************/
      6       1.1    jruoho 
      7       1.1    jruoho /*
      8  1.1.1.14  christos  * Copyright (C) 2000 - 2021, Intel Corp.
      9       1.1    jruoho  * All rights reserved.
     10       1.1    jruoho  *
     11       1.1    jruoho  * Redistribution and use in source and binary forms, with or without
     12       1.1    jruoho  * modification, are permitted provided that the following conditions
     13       1.1    jruoho  * are met:
     14       1.1    jruoho  * 1. Redistributions of source code must retain the above copyright
     15       1.1    jruoho  *    notice, this list of conditions, and the following disclaimer,
     16       1.1    jruoho  *    without modification.
     17       1.1    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18       1.1    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
     19       1.1    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
     20       1.1    jruoho  *    including a substantially similar Disclaimer requirement for further
     21       1.1    jruoho  *    binary redistribution.
     22       1.1    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
     23       1.1    jruoho  *    of any contributors may be used to endorse or promote products derived
     24       1.1    jruoho  *    from this software without specific prior written permission.
     25       1.1    jruoho  *
     26       1.1    jruoho  * Alternatively, this software may be distributed under the terms of the
     27       1.1    jruoho  * GNU General Public License ("GPL") version 2 as published by the Free
     28       1.1    jruoho  * Software Foundation.
     29       1.1    jruoho  *
     30       1.1    jruoho  * NO WARRANTY
     31       1.1    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32       1.1    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  1.1.1.14  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     34       1.1    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35       1.1    jruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36       1.1    jruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37       1.1    jruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38       1.1    jruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39       1.1    jruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40       1.1    jruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41       1.1    jruoho  * POSSIBILITY OF SUCH DAMAGES.
     42       1.1    jruoho  */
     43       1.1    jruoho 
     44       1.1    jruoho #ifndef __ACPIHELP_H
     45       1.1    jruoho #define __ACPIHELP_H
     46       1.1    jruoho 
     47       1.1    jruoho 
     48       1.1    jruoho #include "acpi.h"
     49       1.1    jruoho #include "accommon.h"
     50       1.1    jruoho #include "acapps.h"
     51       1.1    jruoho 
     52       1.1    jruoho #include <sys/types.h>
     53       1.1    jruoho #ifdef WIN32
     54       1.1    jruoho #include <io.h>
     55       1.1    jruoho #include <direct.h>
     56       1.1    jruoho #endif
     57       1.1    jruoho 
     58       1.1    jruoho 
     59   1.1.1.8  christos /*
     60   1.1.1.8  christos  * Global variables. Defined in ahmain.c only, externed in all other files
     61   1.1.1.8  christos  */
     62   1.1.1.8  christos #undef ACPI_GLOBAL
     63   1.1.1.8  christos #undef ACPI_INIT_GLOBAL
     64   1.1.1.8  christos 
     65   1.1.1.8  christos #ifdef DEFINE_AHELP_GLOBALS
     66   1.1.1.8  christos #define ACPI_GLOBAL(type,name) \
     67   1.1.1.8  christos     extern type name; \
     68   1.1.1.8  christos     type name
     69   1.1.1.8  christos 
     70   1.1.1.8  christos #define ACPI_INIT_GLOBAL(type,name,value) \
     71   1.1.1.8  christos     type name=value
     72   1.1.1.8  christos 
     73   1.1.1.8  christos #else
     74   1.1.1.8  christos #ifndef ACPI_GLOBAL
     75   1.1.1.8  christos #define ACPI_GLOBAL(type,name) \
     76   1.1.1.8  christos     extern type name
     77   1.1.1.8  christos #endif
     78   1.1.1.8  christos 
     79   1.1.1.8  christos #ifndef ACPI_INIT_GLOBAL
     80   1.1.1.8  christos #define ACPI_INIT_GLOBAL(type,name,value) \
     81   1.1.1.8  christos     extern type name
     82   1.1.1.8  christos #endif
     83   1.1.1.8  christos #endif
     84   1.1.1.8  christos 
     85   1.1.1.8  christos 
     86   1.1.1.8  christos #define AH_BUFFER_LENGTH                128
     87   1.1.1.8  christos #define AH_LINE_BUFFER_LENGTH           512
     88   1.1.1.8  christos #define AH_MAX_ASL_LINE_LENGTH          70
     89   1.1.1.8  christos #define AH_MAX_AML_LINE_LENGTH          100
     90   1.1.1.8  christos 
     91   1.1.1.8  christos ACPI_GLOBAL (char,                      Gbl_Buffer[AH_BUFFER_LENGTH]);
     92   1.1.1.8  christos ACPI_GLOBAL (char,                      Gbl_LineBuffer[AH_LINE_BUFFER_LENGTH]);
     93   1.1.1.9  christos extern const AH_PREDEFINED_NAME         AslPredefinedInfo[];
     94   1.1.1.9  christos extern const AH_DEVICE_ID               AslDeviceIds[];
     95   1.1.1.8  christos 
     96   1.1.1.8  christos 
     97   1.1.1.8  christos #define AH_DISPLAY_EXCEPTION(Status, Name) \
     98   1.1.1.8  christos     printf ("%.4X: %s\n", Status, Name)
     99   1.1.1.8  christos 
    100   1.1.1.8  christos #define AH_DISPLAY_EXCEPTION_TEXT(Status, Exception) \
    101   1.1.1.8  christos     printf ("%.4X: %-28s (%s)\n", Status,\
    102   1.1.1.8  christos     Exception->Name, Exception->Description)
    103   1.1.1.8  christos 
    104   1.1.1.8  christos 
    105   1.1.1.5  christos typedef enum
    106   1.1.1.5  christos {
    107   1.1.1.5  christos     AH_DECODE_DEFAULT           = 0,
    108   1.1.1.5  christos     AH_DECODE_ASL,
    109   1.1.1.5  christos     AH_DECODE_ASL_KEYWORD,
    110   1.1.1.5  christos     AH_DECODE_PREDEFINED_NAME,
    111   1.1.1.5  christos     AH_DECODE_AML,
    112   1.1.1.5  christos     AH_DECODE_AML_OPCODE,
    113   1.1.1.7  christos     AH_DECODE_AML_TYPE,
    114   1.1.1.5  christos     AH_DECODE_ASL_AML,
    115   1.1.1.7  christos     AH_DECODE_EXCEPTION,
    116   1.1.1.7  christos 
    117   1.1.1.7  christos     AH_DISPLAY_DEVICE_IDS,
    118   1.1.1.5  christos     AH_DISPLAY_UUIDS,
    119   1.1.1.5  christos     AH_DISPLAY_TABLES,
    120  1.1.1.13  christos     AH_DISPLAY_DIRECTIVES,
    121  1.1.1.13  christos     AH_DECODE_ASL_EXCEPTION
    122   1.1.1.5  christos 
    123   1.1.1.5  christos } AH_OPTION_TYPES;
    124       1.1    jruoho 
    125       1.1    jruoho typedef struct ah_aml_opcode
    126       1.1    jruoho {
    127       1.1    jruoho     UINT16          OpcodeRangeStart;
    128       1.1    jruoho     UINT16          OpcodeRangeEnd;
    129       1.1    jruoho     char            *OpcodeString;
    130       1.1    jruoho     char            *OpcodeName;
    131       1.1    jruoho     char            *Type;
    132       1.1    jruoho     char            *FixedArguments;
    133       1.1    jruoho     char            *VariableArguments;
    134       1.1    jruoho     char            *Grammar;
    135       1.1    jruoho 
    136       1.1    jruoho } AH_AML_OPCODE;
    137       1.1    jruoho 
    138   1.1.1.7  christos typedef struct ah_aml_type
    139   1.1.1.7  christos {
    140   1.1.1.7  christos     char            *Name;
    141   1.1.1.7  christos     char            *Description;
    142   1.1.1.7  christos 
    143   1.1.1.7  christos } AH_AML_TYPE;
    144   1.1.1.7  christos 
    145       1.1    jruoho typedef struct ah_asl_operator
    146       1.1    jruoho {
    147       1.1    jruoho     char            *Name;
    148       1.1    jruoho     char            *Syntax;
    149       1.1    jruoho     char            *Description;
    150       1.1    jruoho 
    151       1.1    jruoho } AH_ASL_OPERATOR;
    152       1.1    jruoho 
    153       1.1    jruoho typedef struct ah_asl_keyword
    154       1.1    jruoho {
    155       1.1    jruoho     char            *Name;
    156       1.1    jruoho     char            *Description;
    157       1.1    jruoho     char            *KeywordList;
    158       1.1    jruoho 
    159       1.1    jruoho } AH_ASL_KEYWORD;
    160       1.1    jruoho 
    161   1.1.1.5  christos typedef struct ah_directive_info
    162   1.1.1.5  christos {
    163   1.1.1.5  christos     char            *Name;
    164   1.1.1.5  christos     char            *Description;
    165   1.1.1.5  christos 
    166   1.1.1.5  christos } AH_DIRECTIVE_INFO;
    167       1.1    jruoho 
    168   1.1.1.8  christos 
    169   1.1.1.8  christos /* Externals for various data tables */
    170   1.1.1.8  christos 
    171   1.1.1.8  christos extern const AH_AML_OPCODE          Gbl_AmlOpcodeInfo[];
    172   1.1.1.8  christos extern const AH_AML_TYPE            Gbl_AmlTypesInfo[];
    173   1.1.1.8  christos extern const AH_ASL_OPERATOR        Gbl_AslOperatorInfo[];
    174   1.1.1.8  christos extern const AH_ASL_KEYWORD         Gbl_AslKeywordInfo[];
    175   1.1.1.8  christos extern const AH_UUID                Gbl_AcpiUuids[];
    176   1.1.1.8  christos extern const AH_DIRECTIVE_INFO      Gbl_PreprocessorDirectives[];
    177  1.1.1.10  christos extern const AH_TABLE               AcpiGbl_SupportedTables[];
    178   1.1.1.8  christos 
    179       1.1    jruoho 
    180       1.1    jruoho void
    181       1.1    jruoho AhFindAmlOpcode (
    182       1.1    jruoho     char                    *Name);
    183       1.1    jruoho 
    184       1.1    jruoho void
    185       1.1    jruoho AhDecodeAmlOpcode (
    186       1.1    jruoho     char                    *Name);
    187       1.1    jruoho 
    188       1.1    jruoho void
    189   1.1.1.2  christos AhDecodeException (
    190   1.1.1.2  christos     char                    *Name);
    191   1.1.1.2  christos 
    192   1.1.1.2  christos void
    193  1.1.1.13  christos AhDecodeAslException (
    194  1.1.1.13  christos     char                    *Name);
    195  1.1.1.13  christos 
    196  1.1.1.13  christos void
    197       1.1    jruoho AhFindPredefinedNames (
    198       1.1    jruoho     char                    *Name);
    199       1.1    jruoho 
    200       1.1    jruoho void
    201   1.1.1.3  christos AhFindAslAndAmlOperators (
    202   1.1.1.3  christos     char                    *Name);
    203   1.1.1.3  christos 
    204   1.1.1.3  christos UINT32
    205       1.1    jruoho AhFindAslOperators (
    206       1.1    jruoho     char                    *Name);
    207       1.1    jruoho 
    208       1.1    jruoho void
    209       1.1    jruoho AhFindAslKeywords (
    210       1.1    jruoho     char                    *Name);
    211       1.1    jruoho 
    212   1.1.1.2  christos void
    213   1.1.1.7  christos AhFindAmlTypes (
    214   1.1.1.7  christos     char                    *Name);
    215   1.1.1.7  christos 
    216   1.1.1.7  christos void
    217   1.1.1.2  christos AhDisplayDeviceIds (
    218   1.1.1.3  christos     char                    *Name);
    219   1.1.1.3  christos 
    220   1.1.1.3  christos void
    221   1.1.1.5  christos AhDisplayTables (
    222   1.1.1.5  christos     void);
    223   1.1.1.5  christos 
    224   1.1.1.5  christos const AH_TABLE *
    225   1.1.1.5  christos AcpiAhGetTableInfo (
    226   1.1.1.5  christos     char                    *Signature);
    227   1.1.1.5  christos 
    228   1.1.1.5  christos void
    229   1.1.1.3  christos AhDisplayUuids (
    230   1.1.1.2  christos     void);
    231   1.1.1.2  christos 
    232   1.1.1.5  christos void
    233   1.1.1.5  christos AhDisplayDirectives (
    234   1.1.1.5  christos     void);
    235   1.1.1.5  christos 
    236   1.1.1.8  christos void
    237   1.1.1.8  christos AhPrintOneField (
    238   1.1.1.8  christos     UINT32                  Indent,
    239   1.1.1.8  christos     UINT32                  CurrentPosition,
    240   1.1.1.8  christos     UINT32                  MaxPosition,
    241   1.1.1.8  christos     const char              *Field);
    242   1.1.1.8  christos 
    243       1.1    jruoho #endif /* __ACPIHELP_H */
    244