Home | History | Annotate | Line # | Download | only in debugger
dbcmds.c revision 1.1.1.5
      1      1.1    jruoho /*******************************************************************************
      2      1.1    jruoho  *
      3  1.1.1.2    jruoho  * Module Name: dbcmds - Miscellaneous debug commands and output routines
      4      1.1    jruoho  *
      5      1.1    jruoho  ******************************************************************************/
      6      1.1    jruoho 
      7  1.1.1.2    jruoho /*
      8  1.1.1.5  christos  * Copyright (C) 2000 - 2015, 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 #include "acpi.h"
     45      1.1    jruoho #include "accommon.h"
     46      1.1    jruoho #include "acevents.h"
     47      1.1    jruoho #include "acdebug.h"
     48  1.1.1.3  christos #include "acnamesp.h"
     49      1.1    jruoho #include "acresrc.h"
     50      1.1    jruoho #include "actables.h"
     51      1.1    jruoho 
     52      1.1    jruoho #ifdef ACPI_DEBUGGER
     53      1.1    jruoho 
     54      1.1    jruoho #define _COMPONENT          ACPI_CA_DEBUGGER
     55      1.1    jruoho         ACPI_MODULE_NAME    ("dbcmds")
     56      1.1    jruoho 
     57      1.1    jruoho 
     58      1.1    jruoho /* Local prototypes */
     59      1.1    jruoho 
     60      1.1    jruoho static void
     61      1.1    jruoho AcpiDmCompareAmlResources (
     62      1.1    jruoho     UINT8                   *Aml1Buffer,
     63      1.1    jruoho     ACPI_RSDESC_SIZE        Aml1BufferLength,
     64      1.1    jruoho     UINT8                   *Aml2Buffer,
     65      1.1    jruoho     ACPI_RSDESC_SIZE        Aml2BufferLength);
     66      1.1    jruoho 
     67      1.1    jruoho static ACPI_STATUS
     68      1.1    jruoho AcpiDmTestResourceConversion (
     69      1.1    jruoho     ACPI_NAMESPACE_NODE     *Node,
     70      1.1    jruoho     char                    *Name);
     71      1.1    jruoho 
     72  1.1.1.3  christos static ACPI_STATUS
     73  1.1.1.3  christos AcpiDbResourceCallback (
     74  1.1.1.3  christos     ACPI_RESOURCE           *Resource,
     75  1.1.1.3  christos     void                    *Context);
     76  1.1.1.3  christos 
     77  1.1.1.3  christos static ACPI_STATUS
     78  1.1.1.3  christos AcpiDbDeviceResources (
     79  1.1.1.3  christos     ACPI_HANDLE             ObjHandle,
     80  1.1.1.3  christos     UINT32                  NestingLevel,
     81  1.1.1.3  christos     void                    *Context,
     82  1.1.1.3  christos     void                    **ReturnValue);
     83  1.1.1.3  christos 
     84  1.1.1.3  christos static void
     85  1.1.1.3  christos AcpiDbDoOneSleepState (
     86  1.1.1.3  christos     UINT8                   SleepState);
     87  1.1.1.3  christos 
     88      1.1    jruoho 
     89      1.1    jruoho /*******************************************************************************
     90      1.1    jruoho  *
     91      1.1    jruoho  * FUNCTION:    AcpiDbConvertToNode
     92      1.1    jruoho  *
     93  1.1.1.3  christos  * PARAMETERS:  InString            - String to convert
     94      1.1    jruoho  *
     95      1.1    jruoho  * RETURN:      Pointer to a NS node
     96      1.1    jruoho  *
     97  1.1.1.3  christos  * DESCRIPTION: Convert a string to a valid NS pointer. Handles numeric or
     98  1.1.1.3  christos  *              alphanumeric strings.
     99      1.1    jruoho  *
    100      1.1    jruoho  ******************************************************************************/
    101      1.1    jruoho 
    102  1.1.1.2    jruoho ACPI_NAMESPACE_NODE *
    103      1.1    jruoho AcpiDbConvertToNode (
    104      1.1    jruoho     char                    *InString)
    105      1.1    jruoho {
    106      1.1    jruoho     ACPI_NAMESPACE_NODE     *Node;
    107  1.1.1.3  christos     ACPI_SIZE               Address;
    108      1.1    jruoho 
    109      1.1    jruoho 
    110      1.1    jruoho     if ((*InString >= 0x30) && (*InString <= 0x39))
    111      1.1    jruoho     {
    112      1.1    jruoho         /* Numeric argument, convert */
    113      1.1    jruoho 
    114  1.1.1.3  christos         Address = ACPI_STRTOUL (InString, NULL, 16);
    115  1.1.1.3  christos         Node = ACPI_TO_POINTER (Address);
    116      1.1    jruoho         if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
    117      1.1    jruoho         {
    118  1.1.1.4  christos             AcpiOsPrintf ("Address %p is invalid",
    119      1.1    jruoho                 Node);
    120      1.1    jruoho             return (NULL);
    121      1.1    jruoho         }
    122      1.1    jruoho 
    123      1.1    jruoho         /* Make sure pointer is valid NS node */
    124      1.1    jruoho 
    125      1.1    jruoho         if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
    126      1.1    jruoho         {
    127  1.1.1.4  christos             AcpiOsPrintf ("Address %p is not a valid namespace node [%s]\n",
    128      1.1    jruoho                     Node, AcpiUtGetDescriptorName (Node));
    129      1.1    jruoho             return (NULL);
    130      1.1    jruoho         }
    131      1.1    jruoho     }
    132      1.1    jruoho     else
    133      1.1    jruoho     {
    134  1.1.1.3  christos         /*
    135  1.1.1.3  christos          * Alpha argument: The parameter is a name string that must be
    136  1.1.1.3  christos          * resolved to a Namespace object.
    137      1.1    jruoho          */
    138      1.1    jruoho         Node = AcpiDbLocalNsLookup (InString);
    139      1.1    jruoho         if (!Node)
    140      1.1    jruoho         {
    141  1.1.1.4  christos             AcpiOsPrintf ("Could not find [%s] in namespace, defaulting to root node\n",
    142  1.1.1.4  christos                 InString);
    143      1.1    jruoho             Node = AcpiGbl_RootNode;
    144      1.1    jruoho         }
    145      1.1    jruoho     }
    146      1.1    jruoho 
    147      1.1    jruoho     return (Node);
    148      1.1    jruoho }
    149      1.1    jruoho 
    150      1.1    jruoho 
    151      1.1    jruoho /*******************************************************************************
    152      1.1    jruoho  *
    153      1.1    jruoho  * FUNCTION:    AcpiDbSleep
    154      1.1    jruoho  *
    155  1.1.1.3  christos  * PARAMETERS:  ObjectArg           - Desired sleep state (0-5). NULL means
    156  1.1.1.3  christos  *                                    invoke all possible sleep states.
    157      1.1    jruoho  *
    158      1.1    jruoho  * RETURN:      Status
    159      1.1    jruoho  *
    160  1.1.1.3  christos  * DESCRIPTION: Simulate sleep/wake sequences
    161      1.1    jruoho  *
    162      1.1    jruoho  ******************************************************************************/
    163      1.1    jruoho 
    164      1.1    jruoho ACPI_STATUS
    165      1.1    jruoho AcpiDbSleep (
    166      1.1    jruoho     char                    *ObjectArg)
    167      1.1    jruoho {
    168      1.1    jruoho     UINT8                   SleepState;
    169  1.1.1.3  christos     UINT32                  i;
    170  1.1.1.3  christos 
    171  1.1.1.3  christos 
    172  1.1.1.3  christos     ACPI_FUNCTION_TRACE (AcpiDbSleep);
    173  1.1.1.3  christos 
    174  1.1.1.3  christos 
    175  1.1.1.3  christos     /* Null input (no arguments) means to invoke all sleep states */
    176  1.1.1.3  christos 
    177  1.1.1.3  christos     if (!ObjectArg)
    178  1.1.1.3  christos     {
    179  1.1.1.3  christos         AcpiOsPrintf ("Invoking all possible sleep states, 0-%d\n",
    180  1.1.1.3  christos             ACPI_S_STATES_MAX);
    181  1.1.1.3  christos 
    182  1.1.1.3  christos         for (i = 0; i <= ACPI_S_STATES_MAX; i++)
    183  1.1.1.3  christos         {
    184  1.1.1.3  christos             AcpiDbDoOneSleepState ((UINT8) i);
    185  1.1.1.3  christos         }
    186  1.1.1.3  christos 
    187  1.1.1.3  christos         return_ACPI_STATUS (AE_OK);
    188  1.1.1.3  christos     }
    189      1.1    jruoho 
    190  1.1.1.3  christos     /* Convert argument to binary and invoke the sleep state */
    191      1.1    jruoho 
    192      1.1    jruoho     SleepState = (UINT8) ACPI_STRTOUL (ObjectArg, NULL, 0);
    193  1.1.1.3  christos     AcpiDbDoOneSleepState (SleepState);
    194  1.1.1.3  christos     return_ACPI_STATUS (AE_OK);
    195  1.1.1.3  christos }
    196  1.1.1.3  christos 
    197  1.1.1.3  christos 
    198  1.1.1.3  christos /*******************************************************************************
    199  1.1.1.3  christos  *
    200  1.1.1.3  christos  * FUNCTION:    AcpiDbDoOneSleepState
    201  1.1.1.3  christos  *
    202  1.1.1.3  christos  * PARAMETERS:  SleepState          - Desired sleep state (0-5)
    203  1.1.1.3  christos  *
    204  1.1.1.3  christos  * RETURN:      Status
    205  1.1.1.3  christos  *
    206  1.1.1.3  christos  * DESCRIPTION: Simulate a sleep/wake sequence
    207  1.1.1.3  christos  *
    208  1.1.1.3  christos  ******************************************************************************/
    209  1.1.1.3  christos 
    210  1.1.1.3  christos static void
    211  1.1.1.3  christos AcpiDbDoOneSleepState (
    212  1.1.1.3  christos     UINT8                   SleepState)
    213  1.1.1.3  christos {
    214  1.1.1.3  christos     ACPI_STATUS             Status;
    215  1.1.1.3  christos     UINT8                   SleepTypeA;
    216  1.1.1.3  christos     UINT8                   SleepTypeB;
    217  1.1.1.3  christos 
    218  1.1.1.3  christos 
    219  1.1.1.3  christos     /* Validate parameter */
    220  1.1.1.3  christos 
    221  1.1.1.3  christos     if (SleepState > ACPI_S_STATES_MAX)
    222  1.1.1.3  christos     {
    223  1.1.1.3  christos         AcpiOsPrintf ("Sleep state %d out of range (%d max)\n",
    224  1.1.1.3  christos             SleepState, ACPI_S_STATES_MAX);
    225  1.1.1.3  christos         return;
    226  1.1.1.3  christos     }
    227  1.1.1.3  christos 
    228  1.1.1.3  christos     AcpiOsPrintf ("\n---- Invoking sleep state S%d (%s):\n",
    229  1.1.1.3  christos         SleepState, AcpiGbl_SleepStateNames[SleepState]);
    230  1.1.1.3  christos 
    231  1.1.1.3  christos     /* Get the values for the sleep type registers (for display only) */
    232  1.1.1.3  christos 
    233  1.1.1.3  christos     Status = AcpiGetSleepTypeData (SleepState, &SleepTypeA, &SleepTypeB);
    234  1.1.1.3  christos     if (ACPI_FAILURE (Status))
    235  1.1.1.3  christos     {
    236  1.1.1.3  christos         AcpiOsPrintf ("Could not evaluate [%s] method, %s\n",
    237  1.1.1.3  christos             AcpiGbl_SleepStateNames[SleepState],
    238  1.1.1.3  christos             AcpiFormatException (Status));
    239  1.1.1.3  christos         return;
    240  1.1.1.3  christos     }
    241      1.1    jruoho 
    242  1.1.1.3  christos     AcpiOsPrintf (
    243  1.1.1.3  christos         "Register values for sleep state S%d: Sleep-A: %.2X, Sleep-B: %.2X\n",
    244  1.1.1.3  christos         SleepState, SleepTypeA, SleepTypeB);
    245  1.1.1.3  christos 
    246  1.1.1.3  christos     /* Invoke the various sleep/wake interfaces */
    247  1.1.1.3  christos 
    248  1.1.1.3  christos     AcpiOsPrintf ("**** Sleep: Prepare to sleep (S%d) ****\n",
    249  1.1.1.3  christos         SleepState);
    250      1.1    jruoho     Status = AcpiEnterSleepStatePrep (SleepState);
    251      1.1    jruoho     if (ACPI_FAILURE (Status))
    252      1.1    jruoho     {
    253  1.1.1.3  christos         goto ErrorExit;
    254      1.1    jruoho     }
    255      1.1    jruoho 
    256  1.1.1.3  christos     AcpiOsPrintf ("**** Sleep: Going to sleep (S%d) ****\n",
    257  1.1.1.3  christos         SleepState);
    258      1.1    jruoho     Status = AcpiEnterSleepState (SleepState);
    259      1.1    jruoho     if (ACPI_FAILURE (Status))
    260      1.1    jruoho     {
    261  1.1.1.3  christos         goto ErrorExit;
    262  1.1.1.3  christos     }
    263  1.1.1.3  christos 
    264  1.1.1.3  christos     AcpiOsPrintf ("**** Wake: Prepare to return from sleep (S%d) ****\n",
    265  1.1.1.3  christos         SleepState);
    266  1.1.1.3  christos     Status = AcpiLeaveSleepStatePrep (SleepState);
    267  1.1.1.3  christos     if (ACPI_FAILURE (Status))
    268  1.1.1.3  christos     {
    269  1.1.1.3  christos         goto ErrorExit;
    270      1.1    jruoho     }
    271      1.1    jruoho 
    272  1.1.1.3  christos     AcpiOsPrintf ("**** Wake: Return from sleep (S%d) ****\n",
    273  1.1.1.3  christos         SleepState);
    274      1.1    jruoho     Status = AcpiLeaveSleepState (SleepState);
    275  1.1.1.3  christos     if (ACPI_FAILURE (Status))
    276  1.1.1.3  christos     {
    277  1.1.1.3  christos         goto ErrorExit;
    278  1.1.1.3  christos     }
    279      1.1    jruoho 
    280  1.1.1.3  christos     return;
    281  1.1.1.3  christos 
    282  1.1.1.3  christos 
    283  1.1.1.3  christos ErrorExit:
    284  1.1.1.3  christos     ACPI_EXCEPTION ((AE_INFO, Status, "During invocation of sleep state S%d",
    285  1.1.1.3  christos         SleepState));
    286      1.1    jruoho }
    287      1.1    jruoho 
    288  1.1.1.3  christos 
    289      1.1    jruoho /*******************************************************************************
    290      1.1    jruoho  *
    291      1.1    jruoho  * FUNCTION:    AcpiDbDisplayLocks
    292      1.1    jruoho  *
    293      1.1    jruoho  * PARAMETERS:  None
    294      1.1    jruoho  *
    295      1.1    jruoho  * RETURN:      None
    296      1.1    jruoho  *
    297      1.1    jruoho  * DESCRIPTION: Display information about internal mutexes.
    298      1.1    jruoho  *
    299      1.1    jruoho  ******************************************************************************/
    300      1.1    jruoho 
    301      1.1    jruoho void
    302      1.1    jruoho AcpiDbDisplayLocks (
    303      1.1    jruoho     void)
    304      1.1    jruoho {
    305      1.1    jruoho     UINT32                  i;
    306      1.1    jruoho 
    307      1.1    jruoho 
    308      1.1    jruoho     for (i = 0; i < ACPI_MAX_MUTEX; i++)
    309      1.1    jruoho     {
    310      1.1    jruoho         AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i),
    311      1.1    jruoho             AcpiGbl_MutexInfo[i].ThreadId == ACPI_MUTEX_NOT_ACQUIRED
    312      1.1    jruoho                 ? "Locked" : "Unlocked");
    313      1.1    jruoho     }
    314      1.1    jruoho }
    315      1.1    jruoho 
    316      1.1    jruoho 
    317      1.1    jruoho /*******************************************************************************
    318      1.1    jruoho  *
    319      1.1    jruoho  * FUNCTION:    AcpiDbDisplayTableInfo
    320      1.1    jruoho  *
    321  1.1.1.3  christos  * PARAMETERS:  TableArg            - Name of table to be displayed
    322      1.1    jruoho  *
    323      1.1    jruoho  * RETURN:      None
    324      1.1    jruoho  *
    325  1.1.1.3  christos  * DESCRIPTION: Display information about loaded tables. Current
    326      1.1    jruoho  *              implementation displays all loaded tables.
    327      1.1    jruoho  *
    328      1.1    jruoho  ******************************************************************************/
    329      1.1    jruoho 
    330      1.1    jruoho void
    331      1.1    jruoho AcpiDbDisplayTableInfo (
    332      1.1    jruoho     char                    *TableArg)
    333      1.1    jruoho {
    334      1.1    jruoho     UINT32                  i;
    335      1.1    jruoho     ACPI_TABLE_DESC         *TableDesc;
    336      1.1    jruoho     ACPI_STATUS             Status;
    337      1.1    jruoho 
    338      1.1    jruoho 
    339  1.1.1.3  christos     /* Header */
    340  1.1.1.3  christos 
    341  1.1.1.4  christos     AcpiOsPrintf ("Idx ID    Status Type              TableHeader (Sig, Address, Length)\n");
    342  1.1.1.3  christos 
    343      1.1    jruoho     /* Walk the entire root table list */
    344      1.1    jruoho 
    345      1.1    jruoho     for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
    346      1.1    jruoho     {
    347      1.1    jruoho         TableDesc = &AcpiGbl_RootTableList.Tables[i];
    348  1.1.1.3  christos 
    349  1.1.1.3  christos         /* Index and Table ID */
    350  1.1.1.3  christos 
    351  1.1.1.3  christos         AcpiOsPrintf ("%3u %.2u ", i, TableDesc->OwnerId);
    352  1.1.1.3  christos 
    353  1.1.1.3  christos         /* Decode the table flags */
    354  1.1.1.3  christos 
    355  1.1.1.3  christos         if (!(TableDesc->Flags & ACPI_TABLE_IS_LOADED))
    356  1.1.1.3  christos         {
    357  1.1.1.3  christos             AcpiOsPrintf ("NotLoaded ");
    358  1.1.1.3  christos         }
    359  1.1.1.3  christos         else
    360  1.1.1.3  christos         {
    361  1.1.1.3  christos             AcpiOsPrintf ("   Loaded ");
    362  1.1.1.3  christos         }
    363  1.1.1.3  christos 
    364  1.1.1.3  christos         switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
    365  1.1.1.3  christos         {
    366  1.1.1.4  christos         case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL:
    367  1.1.1.3  christos 
    368  1.1.1.4  christos             AcpiOsPrintf ("External/virtual  ");
    369  1.1.1.3  christos             break;
    370  1.1.1.3  christos 
    371  1.1.1.4  christos         case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL:
    372  1.1.1.3  christos 
    373  1.1.1.4  christos             AcpiOsPrintf ("Internal/physical ");
    374  1.1.1.3  christos             break;
    375  1.1.1.3  christos 
    376  1.1.1.4  christos         case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL:
    377  1.1.1.3  christos 
    378  1.1.1.4  christos             AcpiOsPrintf ("Internal/virtual  ");
    379  1.1.1.3  christos             break;
    380  1.1.1.3  christos 
    381  1.1.1.3  christos         default:
    382  1.1.1.3  christos 
    383  1.1.1.4  christos             AcpiOsPrintf ("INVALID TYPE      ");
    384  1.1.1.3  christos             break;
    385  1.1.1.3  christos         }
    386      1.1    jruoho 
    387      1.1    jruoho         /* Make sure that the table is mapped */
    388      1.1    jruoho 
    389  1.1.1.4  christos         Status = AcpiTbValidateTable (TableDesc);
    390      1.1    jruoho         if (ACPI_FAILURE (Status))
    391      1.1    jruoho         {
    392      1.1    jruoho             return;
    393      1.1    jruoho         }
    394      1.1    jruoho 
    395      1.1    jruoho         /* Dump the table header */
    396      1.1    jruoho 
    397      1.1    jruoho         if (TableDesc->Pointer)
    398      1.1    jruoho         {
    399      1.1    jruoho             AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer);
    400      1.1    jruoho         }
    401      1.1    jruoho         else
    402      1.1    jruoho         {
    403      1.1    jruoho             /* If the pointer is null, the table has been unloaded */
    404      1.1    jruoho 
    405      1.1    jruoho             ACPI_INFO ((AE_INFO, "%4.4s - Table has been unloaded",
    406      1.1    jruoho                 TableDesc->Signature.Ascii));
    407      1.1    jruoho         }
    408      1.1    jruoho     }
    409      1.1    jruoho }
    410      1.1    jruoho 
    411      1.1    jruoho 
    412      1.1    jruoho /*******************************************************************************
    413      1.1    jruoho  *
    414  1.1.1.2    jruoho  * FUNCTION:    AcpiDbUnloadAcpiTable
    415      1.1    jruoho  *
    416  1.1.1.3  christos  * PARAMETERS:  ObjectName          - Namespace pathname for an object that
    417  1.1.1.3  christos  *                                    is owned by the table to be unloaded
    418      1.1    jruoho  *
    419  1.1.1.3  christos  * RETURN:      None
    420      1.1    jruoho  *
    421  1.1.1.3  christos  * DESCRIPTION: Unload an ACPI table, via any namespace node that is owned
    422  1.1.1.3  christos  *              by the table.
    423      1.1    jruoho  *
    424      1.1    jruoho  ******************************************************************************/
    425      1.1    jruoho 
    426  1.1.1.2    jruoho void
    427  1.1.1.2    jruoho AcpiDbUnloadAcpiTable (
    428  1.1.1.3  christos     char                    *ObjectName)
    429      1.1    jruoho {
    430  1.1.1.3  christos     ACPI_NAMESPACE_NODE     *Node;
    431  1.1.1.2    jruoho     ACPI_STATUS             Status;
    432      1.1    jruoho 
    433      1.1    jruoho 
    434  1.1.1.3  christos     /* Translate name to an Named object */
    435      1.1    jruoho 
    436  1.1.1.3  christos     Node = AcpiDbConvertToNode (ObjectName);
    437  1.1.1.3  christos     if (!Node)
    438      1.1    jruoho     {
    439  1.1.1.3  christos         return;
    440      1.1    jruoho     }
    441      1.1    jruoho 
    442  1.1.1.3  christos     Status = AcpiUnloadParentTable (ACPI_CAST_PTR (ACPI_HANDLE, Node));
    443  1.1.1.3  christos     if (ACPI_SUCCESS (Status))
    444  1.1.1.3  christos     {
    445  1.1.1.3  christos         AcpiOsPrintf ("Parent of [%s] (%p) unloaded and uninstalled\n",
    446  1.1.1.3  christos             ObjectName, Node);
    447  1.1.1.3  christos     }
    448  1.1.1.3  christos     else
    449  1.1.1.3  christos     {
    450  1.1.1.3  christos         AcpiOsPrintf ("%s, while unloading parent table of [%s]\n",
    451  1.1.1.3  christos             AcpiFormatException (Status), ObjectName);
    452  1.1.1.3  christos     }
    453      1.1    jruoho }
    454      1.1    jruoho 
    455      1.1    jruoho 
    456      1.1    jruoho /*******************************************************************************
    457      1.1    jruoho  *
    458  1.1.1.2    jruoho  * FUNCTION:    AcpiDbSendNotify
    459      1.1    jruoho  *
    460  1.1.1.3  christos  * PARAMETERS:  Name                - Name of ACPI object where to send notify
    461  1.1.1.3  christos  *              Value               - Value of the notify to send.
    462      1.1    jruoho  *
    463      1.1    jruoho  * RETURN:      None
    464      1.1    jruoho  *
    465  1.1.1.3  christos  * DESCRIPTION: Send an ACPI notification. The value specified is sent to the
    466  1.1.1.2    jruoho  *              named object as an ACPI notify.
    467      1.1    jruoho  *
    468      1.1    jruoho  ******************************************************************************/
    469      1.1    jruoho 
    470  1.1.1.2    jruoho void
    471  1.1.1.2    jruoho AcpiDbSendNotify (
    472  1.1.1.2    jruoho     char                    *Name,
    473  1.1.1.2    jruoho     UINT32                  Value)
    474      1.1    jruoho {
    475  1.1.1.2    jruoho     ACPI_NAMESPACE_NODE     *Node;
    476  1.1.1.2    jruoho     ACPI_STATUS             Status;
    477  1.1.1.2    jruoho 
    478      1.1    jruoho 
    479  1.1.1.2    jruoho     /* Translate name to an Named object */
    480      1.1    jruoho 
    481  1.1.1.2    jruoho     Node = AcpiDbConvertToNode (Name);
    482  1.1.1.2    jruoho     if (!Node)
    483      1.1    jruoho     {
    484  1.1.1.2    jruoho         return;
    485      1.1    jruoho     }
    486      1.1    jruoho 
    487  1.1.1.3  christos     /* Dispatch the notify if legal */
    488      1.1    jruoho 
    489  1.1.1.3  christos     if (AcpiEvIsNotifyObject (Node))
    490      1.1    jruoho     {
    491  1.1.1.2    jruoho         Status = AcpiEvQueueNotifyRequest (Node, Value);
    492  1.1.1.2    jruoho         if (ACPI_FAILURE (Status))
    493  1.1.1.2    jruoho         {
    494  1.1.1.2    jruoho             AcpiOsPrintf ("Could not queue notify\n");
    495  1.1.1.2    jruoho         }
    496  1.1.1.3  christos     }
    497  1.1.1.3  christos     else
    498  1.1.1.3  christos     {
    499  1.1.1.3  christos         AcpiOsPrintf (
    500  1.1.1.3  christos             "Named object [%4.4s] Type %s, must be Device/Thermal/Processor type\n",
    501  1.1.1.3  christos             AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type));
    502  1.1.1.2    jruoho     }
    503      1.1    jruoho }
    504      1.1    jruoho 
    505      1.1    jruoho 
    506      1.1    jruoho /*******************************************************************************
    507      1.1    jruoho  *
    508  1.1.1.2    jruoho  * FUNCTION:    AcpiDbDisplayInterfaces
    509      1.1    jruoho  *
    510  1.1.1.2    jruoho  * PARAMETERS:  ActionArg           - Null, "install", or "remove"
    511  1.1.1.2    jruoho  *              InterfaceNameArg    - Name for install/remove options
    512      1.1    jruoho  *
    513  1.1.1.2    jruoho  * RETURN:      None
    514      1.1    jruoho  *
    515  1.1.1.2    jruoho  * DESCRIPTION: Display or modify the global _OSI interface list
    516      1.1    jruoho  *
    517      1.1    jruoho  ******************************************************************************/
    518      1.1    jruoho 
    519      1.1    jruoho void
    520  1.1.1.2    jruoho AcpiDbDisplayInterfaces (
    521  1.1.1.2    jruoho     char                    *ActionArg,
    522  1.1.1.2    jruoho     char                    *InterfaceNameArg)
    523      1.1    jruoho {
    524  1.1.1.2    jruoho     ACPI_INTERFACE_INFO     *NextInterface;
    525  1.1.1.2    jruoho     char                    *SubString;
    526      1.1    jruoho     ACPI_STATUS             Status;
    527      1.1    jruoho 
    528      1.1    jruoho 
    529  1.1.1.2    jruoho     /* If no arguments, just display current interface list */
    530  1.1.1.2    jruoho 
    531  1.1.1.2    jruoho     if (!ActionArg)
    532      1.1    jruoho     {
    533  1.1.1.2    jruoho         (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex,
    534  1.1.1.2    jruoho                     ACPI_WAIT_FOREVER);
    535  1.1.1.2    jruoho 
    536  1.1.1.2    jruoho         NextInterface = AcpiGbl_SupportedInterfaces;
    537  1.1.1.2    jruoho         while (NextInterface)
    538  1.1.1.2    jruoho         {
    539  1.1.1.2    jruoho             if (!(NextInterface->Flags & ACPI_OSI_INVALID))
    540  1.1.1.2    jruoho             {
    541  1.1.1.2    jruoho                 AcpiOsPrintf ("%s\n", NextInterface->Name);
    542  1.1.1.2    jruoho             }
    543  1.1.1.2    jruoho             NextInterface = NextInterface->Next;
    544  1.1.1.2    jruoho         }
    545  1.1.1.2    jruoho 
    546  1.1.1.2    jruoho         AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
    547      1.1    jruoho         return;
    548      1.1    jruoho     }
    549      1.1    jruoho 
    550  1.1.1.2    jruoho     /* If ActionArg exists, so must InterfaceNameArg */
    551      1.1    jruoho 
    552  1.1.1.2    jruoho     if (!InterfaceNameArg)
    553      1.1    jruoho     {
    554  1.1.1.2    jruoho         AcpiOsPrintf ("Missing Interface Name argument\n");
    555  1.1.1.2    jruoho         return;
    556  1.1.1.2    jruoho     }
    557  1.1.1.2    jruoho 
    558  1.1.1.2    jruoho     /* Uppercase the action for match below */
    559      1.1    jruoho 
    560  1.1.1.2    jruoho     AcpiUtStrupr (ActionArg);
    561  1.1.1.2    jruoho 
    562  1.1.1.2    jruoho     /* Install - install an interface */
    563  1.1.1.2    jruoho 
    564  1.1.1.2    jruoho     SubString = ACPI_STRSTR ("INSTALL", ActionArg);
    565  1.1.1.2    jruoho     if (SubString)
    566  1.1.1.2    jruoho     {
    567  1.1.1.2    jruoho         Status = AcpiInstallInterface (InterfaceNameArg);
    568      1.1    jruoho         if (ACPI_FAILURE (Status))
    569      1.1    jruoho         {
    570  1.1.1.2    jruoho             AcpiOsPrintf ("%s, while installing \"%s\"\n",
    571  1.1.1.2    jruoho                 AcpiFormatException (Status), InterfaceNameArg);
    572      1.1    jruoho         }
    573  1.1.1.2    jruoho         return;
    574      1.1    jruoho     }
    575      1.1    jruoho 
    576  1.1.1.2    jruoho     /* Remove - remove an interface */
    577  1.1.1.2    jruoho 
    578  1.1.1.2    jruoho     SubString = ACPI_STRSTR ("REMOVE", ActionArg);
    579  1.1.1.2    jruoho     if (SubString)
    580  1.1.1.2    jruoho     {
    581  1.1.1.2    jruoho         Status = AcpiRemoveInterface (InterfaceNameArg);
    582      1.1    jruoho         if (ACPI_FAILURE (Status))
    583      1.1    jruoho         {
    584  1.1.1.2    jruoho             AcpiOsPrintf ("%s, while removing \"%s\"\n",
    585  1.1.1.2    jruoho                 AcpiFormatException (Status), InterfaceNameArg);
    586      1.1    jruoho         }
    587  1.1.1.2    jruoho         return;
    588      1.1    jruoho     }
    589      1.1    jruoho 
    590  1.1.1.2    jruoho     /* Invalid ActionArg */
    591      1.1    jruoho 
    592  1.1.1.2    jruoho     AcpiOsPrintf ("Invalid action argument: %s\n", ActionArg);
    593  1.1.1.2    jruoho     return;
    594      1.1    jruoho }
    595      1.1    jruoho 
    596      1.1    jruoho 
    597      1.1    jruoho /*******************************************************************************
    598      1.1    jruoho  *
    599  1.1.1.3  christos  * FUNCTION:    AcpiDbDisplayTemplate
    600  1.1.1.3  christos  *
    601  1.1.1.3  christos  * PARAMETERS:  BufferArg           - Buffer name or address
    602  1.1.1.3  christos  *
    603  1.1.1.3  christos  * RETURN:      None
    604  1.1.1.3  christos  *
    605  1.1.1.3  christos  * DESCRIPTION: Dump a buffer that contains a resource template
    606  1.1.1.3  christos  *
    607  1.1.1.3  christos  ******************************************************************************/
    608  1.1.1.3  christos 
    609  1.1.1.3  christos void
    610  1.1.1.3  christos AcpiDbDisplayTemplate (
    611  1.1.1.3  christos     char                    *BufferArg)
    612  1.1.1.3  christos {
    613  1.1.1.3  christos     ACPI_NAMESPACE_NODE     *Node;
    614  1.1.1.3  christos     ACPI_STATUS             Status;
    615  1.1.1.3  christos     ACPI_BUFFER             ReturnBuffer;
    616  1.1.1.3  christos 
    617  1.1.1.3  christos 
    618  1.1.1.3  christos     /* Translate BufferArg to an Named object */
    619  1.1.1.3  christos 
    620  1.1.1.3  christos     Node = AcpiDbConvertToNode (BufferArg);
    621  1.1.1.3  christos     if (!Node || (Node == AcpiGbl_RootNode))
    622  1.1.1.3  christos     {
    623  1.1.1.3  christos         AcpiOsPrintf ("Invalid argument: %s\n", BufferArg);
    624  1.1.1.3  christos         return;
    625  1.1.1.3  christos     }
    626  1.1.1.3  christos 
    627  1.1.1.3  christos     /* We must have a buffer object */
    628  1.1.1.3  christos 
    629  1.1.1.3  christos     if (Node->Type != ACPI_TYPE_BUFFER)
    630  1.1.1.3  christos     {
    631  1.1.1.3  christos         AcpiOsPrintf ("Not a Buffer object, cannot be a template: %s\n",
    632  1.1.1.3  christos             BufferArg);
    633  1.1.1.3  christos         return;
    634  1.1.1.3  christos     }
    635  1.1.1.3  christos 
    636  1.1.1.3  christos     ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
    637  1.1.1.3  christos     ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
    638  1.1.1.3  christos 
    639  1.1.1.3  christos     /* Attempt to convert the raw buffer to a resource list */
    640  1.1.1.3  christos 
    641  1.1.1.3  christos     Status = AcpiRsCreateResourceList (Node->Object, &ReturnBuffer);
    642  1.1.1.3  christos 
    643  1.1.1.3  christos     AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
    644  1.1.1.3  christos     AcpiDbgLevel |= ACPI_LV_RESOURCES;
    645  1.1.1.3  christos 
    646  1.1.1.3  christos     if (ACPI_FAILURE (Status))
    647  1.1.1.3  christos     {
    648  1.1.1.3  christos         AcpiOsPrintf ("Could not convert Buffer to a resource list: %s, %s\n",
    649  1.1.1.3  christos             BufferArg, AcpiFormatException (Status));
    650  1.1.1.3  christos         goto DumpBuffer;
    651  1.1.1.3  christos     }
    652  1.1.1.3  christos 
    653  1.1.1.3  christos     /* Now we can dump the resource list */
    654  1.1.1.3  christos 
    655  1.1.1.3  christos     AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE,
    656  1.1.1.3  christos         ReturnBuffer.Pointer));
    657  1.1.1.3  christos 
    658  1.1.1.3  christos DumpBuffer:
    659  1.1.1.3  christos     AcpiOsPrintf ("\nRaw data buffer:\n");
    660  1.1.1.3  christos     AcpiUtDebugDumpBuffer ((UINT8 *) Node->Object->Buffer.Pointer,
    661  1.1.1.3  christos         Node->Object->Buffer.Length,
    662  1.1.1.3  christos         DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
    663  1.1.1.3  christos 
    664  1.1.1.3  christos     AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
    665  1.1.1.3  christos     return;
    666  1.1.1.3  christos }
    667  1.1.1.3  christos 
    668  1.1.1.3  christos 
    669  1.1.1.3  christos /*******************************************************************************
    670  1.1.1.3  christos  *
    671      1.1    jruoho  * FUNCTION:    AcpiDmCompareAmlResources
    672      1.1    jruoho  *
    673      1.1    jruoho  * PARAMETERS:  Aml1Buffer          - Contains first resource list
    674      1.1    jruoho  *              Aml1BufferLength    - Length of first resource list
    675      1.1    jruoho  *              Aml2Buffer          - Contains second resource list
    676      1.1    jruoho  *              Aml2BufferLength    - Length of second resource list
    677      1.1    jruoho  *
    678      1.1    jruoho  * RETURN:      None
    679      1.1    jruoho  *
    680      1.1    jruoho  * DESCRIPTION: Compare two AML resource lists, descriptor by descriptor (in
    681      1.1    jruoho  *              order to isolate a miscompare to an individual resource)
    682      1.1    jruoho  *
    683      1.1    jruoho  ******************************************************************************/
    684      1.1    jruoho 
    685      1.1    jruoho static void
    686      1.1    jruoho AcpiDmCompareAmlResources (
    687      1.1    jruoho     UINT8                   *Aml1Buffer,
    688      1.1    jruoho     ACPI_RSDESC_SIZE        Aml1BufferLength,
    689      1.1    jruoho     UINT8                   *Aml2Buffer,
    690      1.1    jruoho     ACPI_RSDESC_SIZE        Aml2BufferLength)
    691      1.1    jruoho {
    692      1.1    jruoho     UINT8                   *Aml1;
    693      1.1    jruoho     UINT8                   *Aml2;
    694  1.1.1.3  christos     UINT8                   *Aml1End;
    695  1.1.1.3  christos     UINT8                   *Aml2End;
    696      1.1    jruoho     ACPI_RSDESC_SIZE        Aml1Length;
    697      1.1    jruoho     ACPI_RSDESC_SIZE        Aml2Length;
    698      1.1    jruoho     ACPI_RSDESC_SIZE        Offset = 0;
    699      1.1    jruoho     UINT8                   ResourceType;
    700      1.1    jruoho     UINT32                  Count = 0;
    701  1.1.1.3  christos     UINT32                  i;
    702      1.1    jruoho 
    703      1.1    jruoho 
    704      1.1    jruoho     /* Compare overall buffer sizes (may be different due to size rounding) */
    705      1.1    jruoho 
    706      1.1    jruoho     if (Aml1BufferLength != Aml2BufferLength)
    707      1.1    jruoho     {
    708      1.1    jruoho         AcpiOsPrintf (
    709  1.1.1.3  christos             "**** Buffer length mismatch in converted AML: Original %X, New %X ****\n",
    710      1.1    jruoho             Aml1BufferLength, Aml2BufferLength);
    711      1.1    jruoho     }
    712      1.1    jruoho 
    713      1.1    jruoho     Aml1 = Aml1Buffer;
    714      1.1    jruoho     Aml2 = Aml2Buffer;
    715  1.1.1.3  christos     Aml1End = Aml1Buffer + Aml1BufferLength;
    716  1.1.1.3  christos     Aml2End = Aml2Buffer + Aml2BufferLength;
    717      1.1    jruoho 
    718      1.1    jruoho     /* Walk the descriptor lists, comparing each descriptor */
    719      1.1    jruoho 
    720  1.1.1.3  christos     while ((Aml1 < Aml1End) && (Aml2 < Aml2End))
    721      1.1    jruoho     {
    722      1.1    jruoho         /* Get the lengths of each descriptor */
    723      1.1    jruoho 
    724      1.1    jruoho         Aml1Length = AcpiUtGetDescriptorLength (Aml1);
    725      1.1    jruoho         Aml2Length = AcpiUtGetDescriptorLength (Aml2);
    726      1.1    jruoho         ResourceType = AcpiUtGetResourceType (Aml1);
    727      1.1    jruoho 
    728      1.1    jruoho         /* Check for descriptor length match */
    729      1.1    jruoho 
    730      1.1    jruoho         if (Aml1Length != Aml2Length)
    731      1.1    jruoho         {
    732      1.1    jruoho             AcpiOsPrintf (
    733  1.1.1.3  christos                 "**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X Len1 %X, Len2 %X ****\n",
    734      1.1    jruoho                 Count, ResourceType, Offset, Aml1Length, Aml2Length);
    735      1.1    jruoho         }
    736      1.1    jruoho 
    737      1.1    jruoho         /* Check for descriptor byte match */
    738      1.1    jruoho 
    739      1.1    jruoho         else if (ACPI_MEMCMP (Aml1, Aml2, Aml1Length))
    740      1.1    jruoho         {
    741      1.1    jruoho             AcpiOsPrintf (
    742      1.1    jruoho                 "**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n",
    743      1.1    jruoho                 Count, ResourceType, Offset);
    744  1.1.1.3  christos 
    745  1.1.1.3  christos             for (i = 0; i < Aml1Length; i++)
    746  1.1.1.3  christos             {
    747  1.1.1.3  christos                 if (Aml1[i] != Aml2[i])
    748  1.1.1.3  christos                 {
    749  1.1.1.3  christos                     AcpiOsPrintf (
    750  1.1.1.3  christos                         "Mismatch at byte offset %.2X: is %2.2X, should be %2.2X\n",
    751  1.1.1.3  christos                         i, Aml2[i], Aml1[i]);
    752  1.1.1.3  christos                 }
    753  1.1.1.3  christos             }
    754      1.1    jruoho         }
    755      1.1    jruoho 
    756      1.1    jruoho         /* Exit on EndTag descriptor */
    757      1.1    jruoho 
    758      1.1    jruoho         if (ResourceType == ACPI_RESOURCE_NAME_END_TAG)
    759      1.1    jruoho         {
    760      1.1    jruoho             return;
    761      1.1    jruoho         }
    762      1.1    jruoho 
    763      1.1    jruoho         /* Point to next descriptor in each buffer */
    764      1.1    jruoho 
    765      1.1    jruoho         Count++;
    766      1.1    jruoho         Offset += Aml1Length;
    767      1.1    jruoho         Aml1 += Aml1Length;
    768      1.1    jruoho         Aml2 += Aml2Length;
    769      1.1    jruoho     }
    770      1.1    jruoho }
    771      1.1    jruoho 
    772      1.1    jruoho 
    773      1.1    jruoho /*******************************************************************************
    774      1.1    jruoho  *
    775      1.1    jruoho  * FUNCTION:    AcpiDmTestResourceConversion
    776      1.1    jruoho  *
    777  1.1.1.3  christos  * PARAMETERS:  Node                - Parent device node
    778  1.1.1.3  christos  *              Name                - resource method name (_CRS)
    779      1.1    jruoho  *
    780      1.1    jruoho  * RETURN:      Status
    781      1.1    jruoho  *
    782      1.1    jruoho  * DESCRIPTION: Compare the original AML with a conversion of the AML to
    783      1.1    jruoho  *              internal resource list, then back to AML.
    784      1.1    jruoho  *
    785      1.1    jruoho  ******************************************************************************/
    786      1.1    jruoho 
    787      1.1    jruoho static ACPI_STATUS
    788      1.1    jruoho AcpiDmTestResourceConversion (
    789      1.1    jruoho     ACPI_NAMESPACE_NODE     *Node,
    790      1.1    jruoho     char                    *Name)
    791      1.1    jruoho {
    792      1.1    jruoho     ACPI_STATUS             Status;
    793  1.1.1.3  christos     ACPI_BUFFER             ReturnBuffer;
    794  1.1.1.3  christos     ACPI_BUFFER             ResourceBuffer;
    795      1.1    jruoho     ACPI_BUFFER             NewAml;
    796      1.1    jruoho     ACPI_OBJECT             *OriginalAml;
    797      1.1    jruoho 
    798      1.1    jruoho 
    799      1.1    jruoho     AcpiOsPrintf ("Resource Conversion Comparison:\n");
    800      1.1    jruoho 
    801      1.1    jruoho     NewAml.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
    802  1.1.1.3  christos     ReturnBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
    803  1.1.1.3  christos     ResourceBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
    804      1.1    jruoho 
    805      1.1    jruoho     /* Get the original _CRS AML resource template */
    806      1.1    jruoho 
    807  1.1.1.3  christos     Status = AcpiEvaluateObject (Node, Name, NULL, &ReturnBuffer);
    808      1.1    jruoho     if (ACPI_FAILURE (Status))
    809      1.1    jruoho     {
    810      1.1    jruoho         AcpiOsPrintf ("Could not obtain %s: %s\n",
    811      1.1    jruoho             Name, AcpiFormatException (Status));
    812      1.1    jruoho         return (Status);
    813      1.1    jruoho     }
    814      1.1    jruoho 
    815      1.1    jruoho     /* Get the AML resource template, converted to internal resource structs */
    816      1.1    jruoho 
    817  1.1.1.3  christos     Status = AcpiGetCurrentResources (Node, &ResourceBuffer);
    818      1.1    jruoho     if (ACPI_FAILURE (Status))
    819      1.1    jruoho     {
    820      1.1    jruoho         AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
    821      1.1    jruoho             AcpiFormatException (Status));
    822      1.1    jruoho         goto Exit1;
    823      1.1    jruoho     }
    824      1.1    jruoho 
    825      1.1    jruoho     /* Convert internal resource list to external AML resource template */
    826      1.1    jruoho 
    827  1.1.1.3  christos     Status = AcpiRsCreateAmlResources (&ResourceBuffer, &NewAml);
    828      1.1    jruoho     if (ACPI_FAILURE (Status))
    829      1.1    jruoho     {
    830      1.1    jruoho         AcpiOsPrintf ("AcpiRsCreateAmlResources failed: %s\n",
    831      1.1    jruoho             AcpiFormatException (Status));
    832      1.1    jruoho         goto Exit2;
    833      1.1    jruoho     }
    834      1.1    jruoho 
    835      1.1    jruoho     /* Compare original AML to the newly created AML resource list */
    836      1.1    jruoho 
    837  1.1.1.3  christos     OriginalAml = ReturnBuffer.Pointer;
    838      1.1    jruoho 
    839  1.1.1.3  christos     AcpiDmCompareAmlResources (OriginalAml->Buffer.Pointer,
    840  1.1.1.3  christos         (ACPI_RSDESC_SIZE) OriginalAml->Buffer.Length,
    841      1.1    jruoho         NewAml.Pointer, (ACPI_RSDESC_SIZE) NewAml.Length);
    842      1.1    jruoho 
    843      1.1    jruoho     /* Cleanup and exit */
    844      1.1    jruoho 
    845      1.1    jruoho     ACPI_FREE (NewAml.Pointer);
    846      1.1    jruoho Exit2:
    847  1.1.1.3  christos     ACPI_FREE (ResourceBuffer.Pointer);
    848      1.1    jruoho Exit1:
    849  1.1.1.3  christos     ACPI_FREE (ReturnBuffer.Pointer);
    850      1.1    jruoho     return (Status);
    851      1.1    jruoho }
    852      1.1    jruoho 
    853      1.1    jruoho 
    854      1.1    jruoho /*******************************************************************************
    855      1.1    jruoho  *
    856  1.1.1.3  christos  * FUNCTION:    AcpiDbResourceCallback
    857      1.1    jruoho  *
    858  1.1.1.3  christos  * PARAMETERS:  ACPI_WALK_RESOURCE_CALLBACK
    859      1.1    jruoho  *
    860  1.1.1.3  christos  * RETURN:      Status
    861      1.1    jruoho  *
    862  1.1.1.3  christos  * DESCRIPTION: Simple callback to exercise AcpiWalkResources and
    863  1.1.1.3  christos  *              AcpiWalkResourceBuffer.
    864      1.1    jruoho  *
    865      1.1    jruoho  ******************************************************************************/
    866      1.1    jruoho 
    867  1.1.1.3  christos static ACPI_STATUS
    868  1.1.1.3  christos AcpiDbResourceCallback (
    869  1.1.1.3  christos     ACPI_RESOURCE           *Resource,
    870  1.1.1.3  christos     void                    *Context)
    871  1.1.1.3  christos {
    872  1.1.1.3  christos 
    873  1.1.1.3  christos     return (AE_OK);
    874  1.1.1.3  christos }
    875  1.1.1.3  christos 
    876  1.1.1.3  christos 
    877  1.1.1.3  christos /*******************************************************************************
    878  1.1.1.3  christos  *
    879  1.1.1.3  christos  * FUNCTION:    AcpiDbDeviceResources
    880  1.1.1.3  christos  *
    881  1.1.1.3  christos  * PARAMETERS:  ACPI_WALK_CALLBACK
    882  1.1.1.3  christos  *
    883  1.1.1.3  christos  * RETURN:      Status
    884  1.1.1.3  christos  *
    885  1.1.1.3  christos  * DESCRIPTION: Display the _PRT/_CRS/_PRS resources for a device object.
    886  1.1.1.3  christos  *
    887  1.1.1.3  christos  ******************************************************************************/
    888  1.1.1.3  christos 
    889  1.1.1.3  christos static ACPI_STATUS
    890  1.1.1.3  christos AcpiDbDeviceResources (
    891  1.1.1.3  christos     ACPI_HANDLE             ObjHandle,
    892  1.1.1.3  christos     UINT32                  NestingLevel,
    893  1.1.1.3  christos     void                    *Context,
    894  1.1.1.3  christos     void                    **ReturnValue)
    895      1.1    jruoho {
    896      1.1    jruoho     ACPI_NAMESPACE_NODE     *Node;
    897  1.1.1.3  christos     ACPI_NAMESPACE_NODE     *PrtNode = NULL;
    898  1.1.1.3  christos     ACPI_NAMESPACE_NODE     *CrsNode = NULL;
    899  1.1.1.3  christos     ACPI_NAMESPACE_NODE     *PrsNode = NULL;
    900  1.1.1.3  christos     ACPI_NAMESPACE_NODE     *AeiNode = NULL;
    901  1.1.1.3  christos     char                    *ParentPath;
    902  1.1.1.3  christos     ACPI_BUFFER             ReturnBuffer;
    903      1.1    jruoho     ACPI_STATUS             Status;
    904      1.1    jruoho 
    905      1.1    jruoho 
    906  1.1.1.3  christos     Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
    907  1.1.1.3  christos     ParentPath = AcpiNsGetExternalPathname (Node);
    908  1.1.1.3  christos     if (!ParentPath)
    909  1.1.1.3  christos     {
    910  1.1.1.3  christos         return (AE_NO_MEMORY);
    911  1.1.1.3  christos     }
    912      1.1    jruoho 
    913  1.1.1.3  christos     /* Get handles to the resource methods for this device */
    914      1.1    jruoho 
    915  1.1.1.3  christos     (void) AcpiGetHandle (Node, METHOD_NAME__PRT, ACPI_CAST_PTR (ACPI_HANDLE, &PrtNode));
    916  1.1.1.3  christos     (void) AcpiGetHandle (Node, METHOD_NAME__CRS, ACPI_CAST_PTR (ACPI_HANDLE, &CrsNode));
    917  1.1.1.3  christos     (void) AcpiGetHandle (Node, METHOD_NAME__PRS, ACPI_CAST_PTR (ACPI_HANDLE, &PrsNode));
    918  1.1.1.3  christos     (void) AcpiGetHandle (Node, METHOD_NAME__AEI, ACPI_CAST_PTR (ACPI_HANDLE, &AeiNode));
    919  1.1.1.3  christos     if (!PrtNode && !CrsNode && !PrsNode && !AeiNode)
    920      1.1    jruoho     {
    921  1.1.1.3  christos         goto Cleanup;   /* Nothing to do */
    922      1.1    jruoho     }
    923      1.1    jruoho 
    924  1.1.1.3  christos     AcpiOsPrintf ("\nDevice: %s\n", ParentPath);
    925  1.1.1.3  christos 
    926      1.1    jruoho     /* Prepare for a return object of arbitrary size */
    927      1.1    jruoho 
    928  1.1.1.3  christos     ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
    929  1.1.1.3  christos     ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE;
    930  1.1.1.3  christos 
    931      1.1    jruoho 
    932      1.1    jruoho     /* _PRT */
    933      1.1    jruoho 
    934  1.1.1.3  christos     if (PrtNode)
    935  1.1.1.3  christos     {
    936  1.1.1.3  christos         AcpiOsPrintf ("Evaluating _PRT\n");
    937      1.1    jruoho 
    938  1.1.1.3  christos         Status = AcpiEvaluateObject (PrtNode, NULL, NULL, &ReturnBuffer);
    939  1.1.1.3  christos         if (ACPI_FAILURE (Status))
    940  1.1.1.3  christos         {
    941  1.1.1.3  christos             AcpiOsPrintf ("Could not evaluate _PRT: %s\n",
    942  1.1.1.3  christos                 AcpiFormatException (Status));
    943  1.1.1.3  christos             goto GetCrs;
    944  1.1.1.3  christos         }
    945      1.1    jruoho 
    946  1.1.1.3  christos         ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
    947  1.1.1.3  christos         ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE;
    948      1.1    jruoho 
    949  1.1.1.3  christos         Status = AcpiGetIrqRoutingTable (Node, &ReturnBuffer);
    950  1.1.1.3  christos         if (ACPI_FAILURE (Status))
    951  1.1.1.3  christos         {
    952  1.1.1.3  christos             AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n",
    953  1.1.1.3  christos                 AcpiFormatException (Status));
    954  1.1.1.3  christos             goto GetCrs;
    955  1.1.1.3  christos         }
    956      1.1    jruoho 
    957  1.1.1.3  christos         AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer));
    958      1.1    jruoho     }
    959      1.1    jruoho 
    960      1.1    jruoho 
    961      1.1    jruoho     /* _CRS */
    962      1.1    jruoho 
    963      1.1    jruoho GetCrs:
    964  1.1.1.3  christos     if (CrsNode)
    965  1.1.1.3  christos     {
    966  1.1.1.3  christos         AcpiOsPrintf ("Evaluating _CRS\n");
    967      1.1    jruoho 
    968  1.1.1.3  christos         ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
    969  1.1.1.3  christos         ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE;
    970      1.1    jruoho 
    971  1.1.1.3  christos         Status = AcpiEvaluateObject (CrsNode, NULL, NULL, &ReturnBuffer);
    972  1.1.1.3  christos         if (ACPI_FAILURE (Status))
    973  1.1.1.3  christos         {
    974  1.1.1.3  christos             AcpiOsPrintf ("Could not evaluate _CRS: %s\n",
    975  1.1.1.3  christos                 AcpiFormatException (Status));
    976  1.1.1.3  christos             goto GetPrs;
    977  1.1.1.3  christos         }
    978      1.1    jruoho 
    979  1.1.1.3  christos         /* This code exercises the AcpiWalkResources interface */
    980      1.1    jruoho 
    981  1.1.1.3  christos         Status = AcpiWalkResources (Node, METHOD_NAME__CRS,
    982  1.1.1.3  christos             AcpiDbResourceCallback, NULL);
    983  1.1.1.3  christos         if (ACPI_FAILURE (Status))
    984  1.1.1.3  christos         {
    985  1.1.1.3  christos             AcpiOsPrintf ("AcpiWalkResources failed: %s\n",
    986  1.1.1.3  christos                 AcpiFormatException (Status));
    987  1.1.1.3  christos             goto GetPrs;
    988  1.1.1.3  christos         }
    989      1.1    jruoho 
    990  1.1.1.3  christos         /* Get the _CRS resource list (test ALLOCATE buffer) */
    991      1.1    jruoho 
    992  1.1.1.3  christos         ReturnBuffer.Pointer = NULL;
    993  1.1.1.3  christos         ReturnBuffer.Length  = ACPI_ALLOCATE_LOCAL_BUFFER;
    994  1.1.1.3  christos 
    995  1.1.1.3  christos         Status = AcpiGetCurrentResources (Node, &ReturnBuffer);
    996  1.1.1.3  christos         if (ACPI_FAILURE (Status))
    997  1.1.1.3  christos         {
    998  1.1.1.3  christos             AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
    999  1.1.1.3  christos                 AcpiFormatException (Status));
   1000  1.1.1.3  christos             goto GetPrs;
   1001  1.1.1.3  christos         }
   1002      1.1    jruoho 
   1003  1.1.1.3  christos         /* This code exercises the AcpiWalkResourceBuffer interface */
   1004      1.1    jruoho 
   1005  1.1.1.3  christos         Status = AcpiWalkResourceBuffer (&ReturnBuffer,
   1006  1.1.1.3  christos             AcpiDbResourceCallback, NULL);
   1007  1.1.1.3  christos         if (ACPI_FAILURE (Status))
   1008  1.1.1.3  christos         {
   1009  1.1.1.3  christos             AcpiOsPrintf ("AcpiWalkResourceBuffer failed: %s\n",
   1010  1.1.1.3  christos                 AcpiFormatException (Status));
   1011  1.1.1.3  christos             goto EndCrs;
   1012  1.1.1.3  christos         }
   1013      1.1    jruoho 
   1014  1.1.1.3  christos         /* Dump the _CRS resource list */
   1015      1.1    jruoho 
   1016  1.1.1.3  christos         AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE,
   1017  1.1.1.3  christos             ReturnBuffer.Pointer));
   1018      1.1    jruoho 
   1019  1.1.1.3  christos         /*
   1020  1.1.1.3  christos          * Perform comparison of original AML to newly created AML. This
   1021  1.1.1.3  christos          * tests both the AML->Resource conversion and the Resource->AML
   1022  1.1.1.3  christos          * conversion.
   1023  1.1.1.3  christos          */
   1024  1.1.1.3  christos         (void) AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS);
   1025  1.1.1.3  christos 
   1026  1.1.1.3  christos         /* Execute _SRS with the resource list */
   1027  1.1.1.3  christos 
   1028  1.1.1.3  christos         AcpiOsPrintf ("Evaluating _SRS\n");
   1029  1.1.1.3  christos 
   1030  1.1.1.3  christos         Status = AcpiSetCurrentResources (Node, &ReturnBuffer);
   1031  1.1.1.3  christos         if (ACPI_FAILURE (Status))
   1032  1.1.1.3  christos         {
   1033  1.1.1.3  christos             AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n",
   1034  1.1.1.3  christos                 AcpiFormatException (Status));
   1035  1.1.1.3  christos             goto EndCrs;
   1036  1.1.1.3  christos         }
   1037  1.1.1.3  christos 
   1038  1.1.1.3  christos EndCrs:
   1039  1.1.1.3  christos         ACPI_FREE (ReturnBuffer.Pointer);
   1040      1.1    jruoho     }
   1041      1.1    jruoho 
   1042      1.1    jruoho 
   1043      1.1    jruoho     /* _PRS */
   1044      1.1    jruoho 
   1045      1.1    jruoho GetPrs:
   1046  1.1.1.3  christos     if (PrsNode)
   1047  1.1.1.3  christos     {
   1048  1.1.1.3  christos         AcpiOsPrintf ("Evaluating _PRS\n");
   1049  1.1.1.3  christos 
   1050  1.1.1.3  christos         ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
   1051  1.1.1.3  christos         ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE;
   1052      1.1    jruoho 
   1053  1.1.1.3  christos         Status = AcpiEvaluateObject (PrsNode, NULL, NULL, &ReturnBuffer);
   1054  1.1.1.3  christos         if (ACPI_FAILURE (Status))
   1055  1.1.1.3  christos         {
   1056  1.1.1.3  christos             AcpiOsPrintf ("Could not evaluate _PRS: %s\n",
   1057  1.1.1.3  christos                 AcpiFormatException (Status));
   1058  1.1.1.3  christos             goto GetAei;
   1059  1.1.1.3  christos         }
   1060      1.1    jruoho 
   1061  1.1.1.3  christos         ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
   1062  1.1.1.3  christos         ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE;
   1063      1.1    jruoho 
   1064  1.1.1.3  christos         Status = AcpiGetPossibleResources (Node, &ReturnBuffer);
   1065  1.1.1.3  christos         if (ACPI_FAILURE (Status))
   1066  1.1.1.3  christos         {
   1067  1.1.1.3  christos             AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n",
   1068  1.1.1.3  christos                 AcpiFormatException (Status));
   1069  1.1.1.3  christos             goto GetAei;
   1070  1.1.1.3  christos         }
   1071  1.1.1.3  christos 
   1072  1.1.1.3  christos         AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
   1073      1.1    jruoho     }
   1074      1.1    jruoho 
   1075      1.1    jruoho 
   1076  1.1.1.3  christos     /* _AEI */
   1077  1.1.1.3  christos 
   1078  1.1.1.3  christos GetAei:
   1079  1.1.1.3  christos     if (AeiNode)
   1080      1.1    jruoho     {
   1081  1.1.1.3  christos         AcpiOsPrintf ("Evaluating _AEI\n");
   1082  1.1.1.3  christos 
   1083  1.1.1.3  christos         ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
   1084  1.1.1.3  christos         ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE;
   1085  1.1.1.3  christos 
   1086  1.1.1.3  christos         Status = AcpiEvaluateObject (AeiNode, NULL, NULL, &ReturnBuffer);
   1087  1.1.1.3  christos         if (ACPI_FAILURE (Status))
   1088  1.1.1.3  christos         {
   1089  1.1.1.3  christos             AcpiOsPrintf ("Could not evaluate _AEI: %s\n",
   1090  1.1.1.3  christos                 AcpiFormatException (Status));
   1091  1.1.1.3  christos             goto Cleanup;
   1092  1.1.1.3  christos         }
   1093  1.1.1.3  christos 
   1094  1.1.1.3  christos         ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
   1095  1.1.1.3  christos         ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE;
   1096  1.1.1.3  christos 
   1097  1.1.1.3  christos         Status = AcpiGetEventResources (Node, &ReturnBuffer);
   1098  1.1.1.3  christos         if (ACPI_FAILURE (Status))
   1099  1.1.1.3  christos         {
   1100  1.1.1.3  christos             AcpiOsPrintf ("AcpiGetEventResources failed: %s\n",
   1101  1.1.1.3  christos                 AcpiFormatException (Status));
   1102  1.1.1.3  christos             goto Cleanup;
   1103  1.1.1.3  christos         }
   1104  1.1.1.3  christos 
   1105  1.1.1.3  christos         AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
   1106      1.1    jruoho     }
   1107      1.1    jruoho 
   1108      1.1    jruoho 
   1109      1.1    jruoho Cleanup:
   1110  1.1.1.3  christos     ACPI_FREE (ParentPath);
   1111  1.1.1.3  christos     return (AE_OK);
   1112  1.1.1.3  christos }
   1113  1.1.1.3  christos 
   1114  1.1.1.3  christos 
   1115  1.1.1.3  christos /*******************************************************************************
   1116  1.1.1.3  christos  *
   1117  1.1.1.3  christos  * FUNCTION:    AcpiDbDisplayResources
   1118  1.1.1.3  christos  *
   1119  1.1.1.3  christos  * PARAMETERS:  ObjectArg           - String object name or object pointer.
   1120  1.1.1.3  christos  *                                    NULL or "*" means "display resources for
   1121  1.1.1.3  christos  *                                    all devices"
   1122  1.1.1.3  christos  *
   1123  1.1.1.3  christos  * RETURN:      None
   1124  1.1.1.3  christos  *
   1125  1.1.1.3  christos  * DESCRIPTION: Display the resource objects associated with a device.
   1126  1.1.1.3  christos  *
   1127  1.1.1.3  christos  ******************************************************************************/
   1128  1.1.1.3  christos 
   1129  1.1.1.3  christos void
   1130  1.1.1.3  christos AcpiDbDisplayResources (
   1131  1.1.1.3  christos     char                    *ObjectArg)
   1132  1.1.1.3  christos {
   1133  1.1.1.3  christos     ACPI_NAMESPACE_NODE     *Node;
   1134  1.1.1.3  christos 
   1135  1.1.1.3  christos 
   1136  1.1.1.3  christos     AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
   1137  1.1.1.3  christos     AcpiDbgLevel |= ACPI_LV_RESOURCES;
   1138  1.1.1.3  christos 
   1139  1.1.1.3  christos     /* Asterisk means "display resources for all devices" */
   1140  1.1.1.3  christos 
   1141  1.1.1.3  christos     if (!ObjectArg || (!ACPI_STRCMP (ObjectArg, "*")))
   1142  1.1.1.3  christos     {
   1143  1.1.1.3  christos         (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
   1144  1.1.1.3  christos                     ACPI_UINT32_MAX, AcpiDbDeviceResources, NULL, NULL, NULL);
   1145  1.1.1.3  christos     }
   1146  1.1.1.3  christos     else
   1147  1.1.1.3  christos     {
   1148  1.1.1.3  christos         /* Convert string to object pointer */
   1149  1.1.1.3  christos 
   1150  1.1.1.3  christos         Node = AcpiDbConvertToNode (ObjectArg);
   1151  1.1.1.3  christos         if (Node)
   1152  1.1.1.3  christos         {
   1153  1.1.1.3  christos             if (Node->Type != ACPI_TYPE_DEVICE)
   1154  1.1.1.3  christos             {
   1155  1.1.1.3  christos                 AcpiOsPrintf ("%4.4s: Name is not a device object (%s)\n",
   1156  1.1.1.3  christos                     Node->Name.Ascii, AcpiUtGetTypeName (Node->Type));
   1157  1.1.1.3  christos             }
   1158  1.1.1.3  christos             else
   1159  1.1.1.3  christos             {
   1160  1.1.1.3  christos                 (void) AcpiDbDeviceResources (Node, 0, NULL, NULL);
   1161  1.1.1.3  christos             }
   1162  1.1.1.3  christos         }
   1163  1.1.1.3  christos     }
   1164      1.1    jruoho 
   1165      1.1    jruoho     AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
   1166      1.1    jruoho }
   1167      1.1    jruoho 
   1168      1.1    jruoho 
   1169  1.1.1.3  christos #if (!ACPI_REDUCED_HARDWARE)
   1170      1.1    jruoho /*******************************************************************************
   1171      1.1    jruoho  *
   1172      1.1    jruoho  * FUNCTION:    AcpiDbGenerateGpe
   1173      1.1    jruoho  *
   1174  1.1.1.3  christos  * PARAMETERS:  GpeArg              - Raw GPE number, ascii string
   1175  1.1.1.3  christos  *              BlockArg            - GPE block number, ascii string
   1176  1.1.1.3  christos  *                                    0 or 1 for FADT GPE blocks
   1177      1.1    jruoho  *
   1178      1.1    jruoho  * RETURN:      None
   1179      1.1    jruoho  *
   1180  1.1.1.3  christos  * DESCRIPTION: Simulate firing of a GPE
   1181      1.1    jruoho  *
   1182      1.1    jruoho  ******************************************************************************/
   1183      1.1    jruoho 
   1184      1.1    jruoho void
   1185      1.1    jruoho AcpiDbGenerateGpe (
   1186      1.1    jruoho     char                    *GpeArg,
   1187      1.1    jruoho     char                    *BlockArg)
   1188      1.1    jruoho {
   1189  1.1.1.4  christos     UINT32                  BlockNumber = 0;
   1190      1.1    jruoho     UINT32                  GpeNumber;
   1191      1.1    jruoho     ACPI_GPE_EVENT_INFO     *GpeEventInfo;
   1192      1.1    jruoho 
   1193      1.1    jruoho 
   1194  1.1.1.4  christos     GpeNumber = ACPI_STRTOUL (GpeArg, NULL, 0);
   1195      1.1    jruoho 
   1196  1.1.1.4  christos     /*
   1197  1.1.1.4  christos      * If no block arg, or block arg == 0 or 1, use the FADT-defined
   1198  1.1.1.4  christos      * GPE blocks.
   1199  1.1.1.4  christos      */
   1200  1.1.1.4  christos     if (BlockArg)
   1201  1.1.1.4  christos     {
   1202  1.1.1.4  christos         BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0);
   1203  1.1.1.4  christos         if (BlockNumber == 1)
   1204  1.1.1.4  christos         {
   1205  1.1.1.4  christos             BlockNumber = 0;
   1206  1.1.1.4  christos         }
   1207  1.1.1.4  christos     }
   1208      1.1    jruoho 
   1209      1.1    jruoho     GpeEventInfo = AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber),
   1210      1.1    jruoho         GpeNumber);
   1211      1.1    jruoho     if (!GpeEventInfo)
   1212      1.1    jruoho     {
   1213      1.1    jruoho         AcpiOsPrintf ("Invalid GPE\n");
   1214      1.1    jruoho         return;
   1215      1.1    jruoho     }
   1216      1.1    jruoho 
   1217  1.1.1.2    jruoho     (void) AcpiEvGpeDispatch (NULL, GpeEventInfo, GpeNumber);
   1218      1.1    jruoho }
   1219      1.1    jruoho 
   1220  1.1.1.3  christos void
   1221  1.1.1.3  christos AcpiDbGenerateSci (
   1222  1.1.1.3  christos     void)
   1223  1.1.1.3  christos {
   1224  1.1.1.3  christos     AcpiEvSciDispatch ();
   1225  1.1.1.3  christos }
   1226  1.1.1.3  christos 
   1227  1.1.1.3  christos #endif /* !ACPI_REDUCED_HARDWARE */
   1228  1.1.1.3  christos 
   1229      1.1    jruoho #endif /* ACPI_DEBUGGER */
   1230