Home | History | Annotate | Line # | Download | only in acpiexec
aecommon.h revision 1.1.1.4
      1      1.1    jruoho /******************************************************************************
      2      1.1    jruoho  *
      3      1.1    jruoho  * Module Name: aecommon - common include for the AcpiExec utility
      4      1.1    jruoho  *
      5      1.1    jruoho  *****************************************************************************/
      6      1.1    jruoho 
      7  1.1.1.2    jruoho /*
      8  1.1.1.4  christos  * Copyright (C) 2000 - 2014, Intel Corp.
      9      1.1    jruoho  * All rights reserved.
     10      1.1    jruoho  *
     11  1.1.1.2    jruoho  * Redistribution and use in source and binary forms, with or without
     12  1.1.1.2    jruoho  * modification, are permitted provided that the following conditions
     13  1.1.1.2    jruoho  * are met:
     14  1.1.1.2    jruoho  * 1. Redistributions of source code must retain the above copyright
     15  1.1.1.2    jruoho  *    notice, this list of conditions, and the following disclaimer,
     16  1.1.1.2    jruoho  *    without modification.
     17  1.1.1.2    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  1.1.1.2    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  1.1.1.2    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  1.1.1.2    jruoho  *    including a substantially similar Disclaimer requirement for further
     21  1.1.1.2    jruoho  *    binary redistribution.
     22  1.1.1.2    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
     23  1.1.1.2    jruoho  *    of any contributors may be used to endorse or promote products derived
     24  1.1.1.2    jruoho  *    from this software without specific prior written permission.
     25  1.1.1.2    jruoho  *
     26  1.1.1.2    jruoho  * Alternatively, this software may be distributed under the terms of the
     27  1.1.1.2    jruoho  * GNU General Public License ("GPL") version 2 as published by the Free
     28  1.1.1.2    jruoho  * Software Foundation.
     29  1.1.1.2    jruoho  *
     30  1.1.1.2    jruoho  * NO WARRANTY
     31  1.1.1.2    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  1.1.1.2    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  1.1.1.2    jruoho  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  1.1.1.2    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  1.1.1.2    jruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  1.1.1.2    jruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  1.1.1.2    jruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  1.1.1.2    jruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  1.1.1.2    jruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  1.1.1.2    jruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  1.1.1.2    jruoho  * POSSIBILITY OF SUCH DAMAGES.
     42  1.1.1.2    jruoho  */
     43      1.1    jruoho 
     44      1.1    jruoho #ifndef _AECOMMON
     45      1.1    jruoho #define _AECOMMON
     46      1.1    jruoho 
     47      1.1    jruoho #ifdef _MSC_VER                 /* disable some level-4 warnings */
     48      1.1    jruoho #pragma warning(disable:4100)   /* warning C4100: unreferenced formal parameter */
     49      1.1    jruoho #endif
     50      1.1    jruoho 
     51      1.1    jruoho #include "acpi.h"
     52      1.1    jruoho #include "accommon.h"
     53      1.1    jruoho #include "acparser.h"
     54      1.1    jruoho #include "amlcode.h"
     55      1.1    jruoho #include "acnamesp.h"
     56      1.1    jruoho #include "acdebug.h"
     57      1.1    jruoho #include "actables.h"
     58      1.1    jruoho #include "acinterp.h"
     59  1.1.1.4  christos #include "amlresrc.h"
     60      1.1    jruoho #include "acapps.h"
     61      1.1    jruoho 
     62  1.1.1.2    jruoho #include <stdio.h>
     63  1.1.1.2    jruoho #include <stdlib.h>
     64  1.1.1.2    jruoho #include <string.h>
     65  1.1.1.2    jruoho #include <signal.h>
     66  1.1.1.2    jruoho 
     67      1.1    jruoho extern BOOLEAN              AcpiGbl_IgnoreErrors;
     68      1.1    jruoho extern UINT8                AcpiGbl_RegionFillValue;
     69  1.1.1.3  christos extern UINT8                AcpiGbl_UseHwReducedFadt;
     70  1.1.1.3  christos extern BOOLEAN              AcpiGbl_DisplayRegionAccess;
     71  1.1.1.3  christos extern BOOLEAN              AcpiGbl_DoInterfaceTests;
     72  1.1.1.4  christos extern BOOLEAN              AcpiGbl_LoadTestTables;
     73  1.1.1.4  christos extern ACPI_CONNECTION_INFO AeMyContext;
     74      1.1    jruoho 
     75  1.1.1.2    jruoho /* Check for unexpected exceptions */
     76  1.1.1.2    jruoho 
     77  1.1.1.2    jruoho #define AE_CHECK_STATUS(Name, Status, Expected) \
     78  1.1.1.2    jruoho     if (Status != Expected) \
     79  1.1.1.2    jruoho     { \
     80  1.1.1.2    jruoho         AcpiOsPrintf ("Unexpected %s from %s (%s-%d)\n", \
     81  1.1.1.2    jruoho             AcpiFormatException (Status), #Name, _AcpiModuleName, __LINE__); \
     82  1.1.1.2    jruoho     }
     83  1.1.1.2    jruoho 
     84  1.1.1.2    jruoho /* Check for unexpected non-AE_OK errors */
     85  1.1.1.2    jruoho 
     86  1.1.1.2    jruoho #define AE_CHECK_OK(Name, Status)   AE_CHECK_STATUS (Name, Status, AE_OK);
     87      1.1    jruoho 
     88      1.1    jruoho typedef struct ae_table_desc
     89      1.1    jruoho {
     90      1.1    jruoho     ACPI_TABLE_HEADER       *Table;
     91      1.1    jruoho     struct ae_table_desc    *Next;
     92      1.1    jruoho 
     93      1.1    jruoho } AE_TABLE_DESC;
     94      1.1    jruoho 
     95      1.1    jruoho /*
     96      1.1    jruoho  * Debug Regions
     97      1.1    jruoho  */
     98      1.1    jruoho typedef struct ae_region
     99      1.1    jruoho {
    100      1.1    jruoho     ACPI_PHYSICAL_ADDRESS   Address;
    101      1.1    jruoho     UINT32                  Length;
    102      1.1    jruoho     void                    *Buffer;
    103      1.1    jruoho     void                    *NextRegion;
    104      1.1    jruoho     UINT8                   SpaceId;
    105      1.1    jruoho 
    106      1.1    jruoho } AE_REGION;
    107      1.1    jruoho 
    108      1.1    jruoho typedef struct ae_debug_regions
    109      1.1    jruoho {
    110      1.1    jruoho     UINT32                  NumberOfRegions;
    111      1.1    jruoho     AE_REGION               *RegionList;
    112      1.1    jruoho 
    113      1.1    jruoho } AE_DEBUG_REGIONS;
    114      1.1    jruoho 
    115      1.1    jruoho 
    116      1.1    jruoho #define TEST_OUTPUT_LEVEL(lvl)          if ((lvl) & OutputLevel)
    117      1.1    jruoho 
    118      1.1    jruoho #define OSD_PRINT(lvl,fp)               TEST_OUTPUT_LEVEL(lvl) {\
    119      1.1    jruoho                                             AcpiOsPrintf PARAM_LIST(fp);}
    120      1.1    jruoho 
    121  1.1.1.2    jruoho void ACPI_SYSTEM_XFACE
    122      1.1    jruoho AeCtrlCHandler (
    123      1.1    jruoho     int                     Sig);
    124      1.1    jruoho 
    125      1.1    jruoho ACPI_STATUS
    126      1.1    jruoho AeBuildLocalTables (
    127      1.1    jruoho     UINT32                  TableCount,
    128      1.1    jruoho     AE_TABLE_DESC           *TableList);
    129      1.1    jruoho 
    130      1.1    jruoho ACPI_STATUS
    131      1.1    jruoho AeInstallTables (
    132      1.1    jruoho     void);
    133      1.1    jruoho 
    134      1.1    jruoho void
    135      1.1    jruoho AeDumpNamespace (
    136      1.1    jruoho     void);
    137      1.1    jruoho 
    138      1.1    jruoho void
    139      1.1    jruoho AeDumpObject (
    140      1.1    jruoho     char                    *MethodName,
    141      1.1    jruoho     ACPI_BUFFER             *ReturnObj);
    142      1.1    jruoho 
    143      1.1    jruoho void
    144      1.1    jruoho AeDumpBuffer (
    145      1.1    jruoho     UINT32                  Address);
    146      1.1    jruoho 
    147      1.1    jruoho void
    148      1.1    jruoho AeExecute (
    149      1.1    jruoho     char                    *Name);
    150      1.1    jruoho 
    151      1.1    jruoho void
    152      1.1    jruoho AeSetScope (
    153      1.1    jruoho     char                    *Name);
    154      1.1    jruoho 
    155      1.1    jruoho void
    156      1.1    jruoho AeCloseDebugFile (
    157      1.1    jruoho     void);
    158      1.1    jruoho 
    159      1.1    jruoho void
    160      1.1    jruoho AeOpenDebugFile (
    161      1.1    jruoho     char                    *Name);
    162      1.1    jruoho 
    163      1.1    jruoho ACPI_STATUS
    164      1.1    jruoho AeDisplayAllMethods (
    165      1.1    jruoho     UINT32                  DisplayCount);
    166      1.1    jruoho 
    167      1.1    jruoho ACPI_STATUS
    168  1.1.1.2    jruoho AeInstallEarlyHandlers (
    169  1.1.1.2    jruoho     void);
    170  1.1.1.2    jruoho 
    171  1.1.1.2    jruoho ACPI_STATUS
    172  1.1.1.2    jruoho AeInstallLateHandlers (
    173      1.1    jruoho     void);
    174      1.1    jruoho 
    175      1.1    jruoho void
    176      1.1    jruoho AeMiscellaneousTests (
    177      1.1    jruoho     void);
    178      1.1    jruoho 
    179      1.1    jruoho ACPI_STATUS
    180      1.1    jruoho AeRegionHandler (
    181      1.1    jruoho     UINT32                  Function,
    182      1.1    jruoho     ACPI_PHYSICAL_ADDRESS   Address,
    183      1.1    jruoho     UINT32                  BitWidth,
    184      1.1    jruoho     UINT64                  *Value,
    185      1.1    jruoho     void                    *HandlerContext,
    186      1.1    jruoho     void                    *RegionContext);
    187      1.1    jruoho 
    188      1.1    jruoho UINT32
    189      1.1    jruoho AeGpeHandler (
    190  1.1.1.2    jruoho     ACPI_HANDLE             GpeDevice,
    191  1.1.1.2    jruoho     UINT32                  GpeNumber,
    192  1.1.1.2    jruoho     void                    *Context);
    193  1.1.1.2    jruoho 
    194  1.1.1.2    jruoho void
    195  1.1.1.2    jruoho AeGlobalEventHandler (
    196  1.1.1.2    jruoho     UINT32                  Type,
    197  1.1.1.2    jruoho     ACPI_HANDLE             GpeDevice,
    198  1.1.1.2    jruoho     UINT32                  EventNumber,
    199      1.1    jruoho     void                    *Context);
    200      1.1    jruoho 
    201  1.1.1.4  christos /* aeregion */
    202  1.1.1.4  christos 
    203  1.1.1.4  christos ACPI_STATUS
    204  1.1.1.4  christos AeInstallDeviceHandlers (
    205  1.1.1.4  christos     void);
    206  1.1.1.4  christos 
    207  1.1.1.4  christos void
    208  1.1.1.4  christos AeInstallRegionHandlers (
    209  1.1.1.4  christos     void);
    210  1.1.1.4  christos 
    211  1.1.1.4  christos void
    212  1.1.1.4  christos AeOverrideRegionHandlers (
    213  1.1.1.4  christos     void);
    214  1.1.1.4  christos 
    215  1.1.1.4  christos 
    216      1.1    jruoho #endif /* _AECOMMON */
    217