Home | History | Annotate | Line # | Download | only in acpiexec
      1 /******************************************************************************
      2  *
      3  * Module Name: aehandlers - Various handlers for acpiexec
      4  *
      5  *****************************************************************************/
      6 
      7 /******************************************************************************
      8  *
      9  * 1. Copyright Notice
     10  *
     11  * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.
     12  * All rights reserved.
     13  *
     14  * 2. License
     15  *
     16  * 2.1. This is your license from Intel Corp. under its intellectual property
     17  * rights. You may have additional license terms from the party that provided
     18  * you this software, covering your right to use that party's intellectual
     19  * property rights.
     20  *
     21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
     22  * copy of the source code appearing in this file ("Covered Code") an
     23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
     24  * base code distributed originally by Intel ("Original Intel Code") to copy,
     25  * make derivatives, distribute, use and display any portion of the Covered
     26  * Code in any form, with the right to sublicense such rights; and
     27  *
     28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
     29  * license (with the right to sublicense), under only those claims of Intel
     30  * patents that are infringed by the Original Intel Code, to make, use, sell,
     31  * offer to sell, and import the Covered Code and derivative works thereof
     32  * solely to the minimum extent necessary to exercise the above copyright
     33  * license, and in no event shall the patent license extend to any additions
     34  * to or modifications of the Original Intel Code. No other license or right
     35  * is granted directly or by implication, estoppel or otherwise;
     36  *
     37  * The above copyright and patent license is granted only if the following
     38  * conditions are met:
     39  *
     40  * 3. Conditions
     41  *
     42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
     43  * Redistribution of source code of any substantial portion of the Covered
     44  * Code or modification with rights to further distribute source must include
     45  * the above Copyright Notice, the above License, this list of Conditions,
     46  * and the following Disclaimer and Export Compliance provision. In addition,
     47  * Licensee must cause all Covered Code to which Licensee contributes to
     48  * contain a file documenting the changes Licensee made to create that Covered
     49  * Code and the date of any change. Licensee must include in that file the
     50  * documentation of any changes made by any predecessor Licensee. Licensee
     51  * must include a prominent statement that the modification is derived,
     52  * directly or indirectly, from Original Intel Code.
     53  *
     54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
     55  * Redistribution of source code of any substantial portion of the Covered
     56  * Code or modification without rights to further distribute source must
     57  * include the following Disclaimer and Export Compliance provision in the
     58  * documentation and/or other materials provided with distribution. In
     59  * addition, Licensee may not authorize further sublicense of source of any
     60  * portion of the Covered Code, and must include terms to the effect that the
     61  * license from Licensee to its licensee is limited to the intellectual
     62  * property embodied in the software Licensee provides to its licensee, and
     63  * not to intellectual property embodied in modifications its licensee may
     64  * make.
     65  *
     66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
     67  * substantial portion of the Covered Code or modification must reproduce the
     68  * above Copyright Notice, and the following Disclaimer and Export Compliance
     69  * provision in the documentation and/or other materials provided with the
     70  * distribution.
     71  *
     72  * 3.4. Intel retains all right, title, and interest in and to the Original
     73  * Intel Code.
     74  *
     75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
     76  * Intel shall be used in advertising or otherwise to promote the sale, use or
     77  * other dealings in products derived from or relating to the Covered Code
     78  * without prior written authorization from Intel.
     79  *
     80  * 4. Disclaimer and Export Compliance
     81  *
     82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
     83  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
     84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
     85  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
     86  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
     87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
     88  * PARTICULAR PURPOSE.
     89  *
     90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
     91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
     92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
     93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
     94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
     95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
     96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
     97  * LIMITED REMEDY.
     98  *
     99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
    100  * software or system incorporating such software without first obtaining any
    101  * required license or other approval from the U. S. Department of Commerce or
    102  * any other agency or department of the United States Government. In the
    103  * event Licensee exports any such software from the United States or
    104  * re-exports any such software from a foreign destination, Licensee shall
    105  * ensure that the distribution and export/re-export of the software is in
    106  * compliance with all laws, regulations, orders, or other restrictions of the
    107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
    108  * any of its subsidiaries will export/re-export any technical data, process,
    109  * software, or service, directly or indirectly, to any country for which the
    110  * United States government or any agency thereof requires an export license,
    111  * other governmental approval, or letter of assurance, without first obtaining
    112  * such license, approval or letter.
    113  *
    114  *****************************************************************************
    115  *
    116  * Alternatively, you may choose to be licensed under the terms of the
    117  * following license:
    118  *
    119  * Redistribution and use in source and binary forms, with or without
    120  * modification, are permitted provided that the following conditions
    121  * are met:
    122  * 1. Redistributions of source code must retain the above copyright
    123  *    notice, this list of conditions, and the following disclaimer,
    124  *    without modification.
    125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
    126  *    substantially similar to the "NO WARRANTY" disclaimer below
    127  *    ("Disclaimer") and any redistribution must be conditioned upon
    128  *    including a substantially similar Disclaimer requirement for further
    129  *    binary redistribution.
    130  * 3. Neither the names of the above-listed copyright holders nor the names
    131  *    of any contributors may be used to endorse or promote products derived
    132  *    from this software without specific prior written permission.
    133  *
    134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    145  *
    146  * Alternatively, you may choose to be licensed under the terms of the
    147  * GNU General Public License ("GPL") version 2 as published by the Free
    148  * Software Foundation.
    149  *
    150  *****************************************************************************/
    151 
    152 #include "aecommon.h"
    153 
    154 #define _COMPONENT          ACPI_TOOLS
    155         ACPI_MODULE_NAME    ("aehandlers")
    156 
    157 
    158 /* Local prototypes */
    159 
    160 static void
    161 AeNotifyHandler1 (
    162     ACPI_HANDLE             Device,
    163     UINT32                  Value,
    164     void                    *Context);
    165 
    166 static void
    167 AeNotifyHandler2 (
    168     ACPI_HANDLE             Device,
    169     UINT32                  Value,
    170     void                    *Context);
    171 
    172 static void
    173 AeCommonNotifyHandler (
    174     ACPI_HANDLE             Device,
    175     UINT32                  Value,
    176     UINT32                  HandlerId);
    177 
    178 static void
    179 AeDeviceNotifyHandler (
    180     ACPI_HANDLE             Device,
    181     UINT32                  Value,
    182     void                    *Context);
    183 
    184 static ACPI_STATUS
    185 AeTableHandler (
    186     UINT32                  Event,
    187     void                    *Table,
    188     void                    *Context);
    189 
    190 static void
    191 AeAttachedDataHandler (
    192     ACPI_HANDLE             Object,
    193     void                    *Data);
    194 
    195 static void
    196 AeAttachedDataHandler2 (
    197     ACPI_HANDLE             Object,
    198     void                    *Data);
    199 
    200 static UINT32
    201 AeInterfaceHandler (
    202     ACPI_STRING             InterfaceName,
    203     UINT32                  Supported);
    204 
    205 #if (!ACPI_REDUCED_HARDWARE)
    206 static UINT32
    207 AeEventHandler (
    208     void                    *Context);
    209 
    210 static UINT32
    211 AeSciHandler (
    212     void                    *Context);
    213 
    214 static char                *TableEvents[] =
    215 {
    216     "LOAD",
    217     "UNLOAD",
    218     "INSTALL",
    219     "UNINSTALL",
    220     "UNKNOWN"
    221 };
    222 #endif /* !ACPI_REDUCED_HARDWARE */
    223 
    224 
    225 static AE_DEBUG_REGIONS     AeRegions;
    226 
    227 
    228 /******************************************************************************
    229  *
    230  * FUNCTION:    AeNotifyHandler(s)
    231  *
    232  * PARAMETERS:  Standard notify handler parameters
    233  *
    234  * RETURN:      Status
    235  *
    236  * DESCRIPTION: Notify handlers for AcpiExec utility. Used by the ASL
    237  *              test suite(s) to communicate errors and other information to
    238  *              this utility via the Notify() operator. Tests notify handling
    239  *              and multiple notify handler support.
    240  *
    241  *****************************************************************************/
    242 
    243 static void
    244 AeNotifyHandler1 (
    245     ACPI_HANDLE             Device,
    246     UINT32                  Value,
    247     void                    *Context)
    248 {
    249     AeCommonNotifyHandler (Device, Value, 1);
    250 }
    251 
    252 static void
    253 AeNotifyHandler2 (
    254     ACPI_HANDLE             Device,
    255     UINT32                  Value,
    256     void                    *Context)
    257 {
    258     AeCommonNotifyHandler (Device, Value, 2);
    259 }
    260 
    261 static void
    262 AeCommonNotifyHandler (
    263     ACPI_HANDLE             Device,
    264     UINT32                  Value,
    265     UINT32                  HandlerId)
    266 {
    267     char                    *Type;
    268 
    269 
    270     Type = "Device";
    271     if (Value <= ACPI_MAX_SYS_NOTIFY)
    272     {
    273         Type = "System";
    274     }
    275 
    276     switch (Value)
    277     {
    278 #if 0
    279     case 0:
    280 
    281         printf (AE_PREFIX
    282             "Method Error 0x%X: Results not equal\n", Value);
    283         if (AcpiGbl_DebugFile)
    284         {
    285             AcpiOsPrintf (AE_PREFIX
    286                 "Method Error: Results not equal\n");
    287         }
    288         break;
    289 
    290     case 1:
    291 
    292         printf (AE_PREFIX
    293             "Method Error: Incorrect numeric result\n");
    294         if (AcpiGbl_DebugFile)
    295         {
    296             AcpiOsPrintf (AE_PREFIX
    297                 "Method Error: Incorrect numeric result\n");
    298         }
    299         break;
    300 
    301     case 2:
    302 
    303         printf (AE_PREFIX
    304             "Method Error: An operand was overwritten\n");
    305         if (AcpiGbl_DebugFile)
    306         {
    307             AcpiOsPrintf (AE_PREFIX
    308                 "Method Error: An operand was overwritten\n");
    309         }
    310         break;
    311 
    312 #endif
    313 
    314     default:
    315 
    316         printf (AE_PREFIX
    317             "Handler %u: Received a %s Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
    318             HandlerId, Type, AcpiUtGetNodeName (Device), Device, Value,
    319             AcpiUtGetNotifyName (Value, ACPI_TYPE_ANY));
    320         if (AcpiGbl_DebugFile)
    321         {
    322             AcpiOsPrintf (AE_PREFIX
    323                 "Handler %u: Received a %s notify, Value 0x%2.2X\n",
    324                 HandlerId, Type, Value);
    325         }
    326 
    327         (void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL);
    328         break;
    329     }
    330 }
    331 
    332 
    333 /******************************************************************************
    334  *
    335  * FUNCTION:    AeSystemNotifyHandler
    336  *
    337  * PARAMETERS:  Standard notify handler parameters
    338  *
    339  * RETURN:      Status
    340  *
    341  * DESCRIPTION: System notify handler for AcpiExec utility. Used by the ASL
    342  *              test suite(s) to communicate errors and other information to
    343  *              this utility via the Notify() operator.
    344  *
    345  *****************************************************************************/
    346 
    347 static void
    348 AeSystemNotifyHandler (
    349     ACPI_HANDLE                 Device,
    350     UINT32                      Value,
    351     void                        *Context)
    352 {
    353 
    354     printf (AE_PREFIX
    355         "Global:    Received a System Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
    356         AcpiUtGetNodeName (Device), Device, Value,
    357         AcpiUtGetNotifyName (Value, ACPI_TYPE_ANY));
    358     if (AcpiGbl_DebugFile)
    359     {
    360         AcpiOsPrintf (AE_PREFIX
    361             "Global:    Received a System Notify, Value 0x%2.2X\n", Value);
    362     }
    363 
    364     (void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL);
    365 }
    366 
    367 
    368 /******************************************************************************
    369  *
    370  * FUNCTION:    AeDeviceNotifyHandler
    371  *
    372  * PARAMETERS:  Standard notify handler parameters
    373  *
    374  * RETURN:      Status
    375  *
    376  * DESCRIPTION: Device notify handler for AcpiExec utility. Used by the ASL
    377  *              test suite(s) to communicate errors and other information to
    378  *              this utility via the Notify() operator.
    379  *
    380  *****************************************************************************/
    381 
    382 static void
    383 AeDeviceNotifyHandler (
    384     ACPI_HANDLE                 Device,
    385     UINT32                      Value,
    386     void                        *Context)
    387 {
    388 
    389     printf (AE_PREFIX
    390         "Global:    Received a Device Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
    391         AcpiUtGetNodeName (Device), Device, Value,
    392         AcpiUtGetNotifyName (Value, ACPI_TYPE_ANY));
    393     if (AcpiGbl_DebugFile)
    394     {
    395         AcpiOsPrintf (AE_PREFIX
    396             "Global:    Received a Device Notify, Value 0x%2.2X\n", Value);
    397     }
    398 
    399     (void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL);
    400 }
    401 
    402 
    403 /******************************************************************************
    404  *
    405  * FUNCTION:    AeTableHandler
    406  *
    407  * PARAMETERS:  Table handler
    408  *
    409  * RETURN:      Status
    410  *
    411  * DESCRIPTION: System table handler for AcpiExec utility.
    412  *
    413  *****************************************************************************/
    414 
    415 static ACPI_STATUS
    416 AeTableHandler (
    417     UINT32                  Event,
    418     void                    *Table,
    419     void                    *Context)
    420 {
    421 #if (!ACPI_REDUCED_HARDWARE)
    422     ACPI_STATUS             Status;
    423 #endif /* !ACPI_REDUCED_HARDWARE */
    424 
    425 
    426     if (Event > ACPI_NUM_TABLE_EVENTS)
    427     {
    428         Event = ACPI_NUM_TABLE_EVENTS;
    429     }
    430 
    431 #if (!ACPI_REDUCED_HARDWARE)
    432     /* Enable any GPEs associated with newly-loaded GPE methods */
    433 
    434     Status = AcpiUpdateAllGpes ();
    435     ACPI_CHECK_OK (AcpiUpdateAllGpes, Status);
    436 
    437     printf (AE_PREFIX "Table Event %s, [%4.4s] %p\n",
    438         TableEvents[Event],
    439         ((ACPI_TABLE_HEADER *) Table)->Signature, Table);
    440 #endif /* !ACPI_REDUCED_HARDWARE */
    441 
    442     return (AE_OK);
    443 }
    444 
    445 
    446 /******************************************************************************
    447  *
    448  * FUNCTION:    AeGpeHandler
    449  *
    450  * DESCRIPTION: Common GPE handler for acpiexec
    451  *
    452  *****************************************************************************/
    453 
    454 UINT32
    455 AeGpeHandler (
    456     ACPI_HANDLE             GpeDevice,
    457     UINT32                  GpeNumber,
    458     void                    *Context)
    459 {
    460     ACPI_NAMESPACE_NODE     *DeviceNode = (ACPI_NAMESPACE_NODE *) GpeDevice;
    461 
    462 
    463     AcpiOsPrintf (AE_PREFIX
    464         "GPE Handler received GPE %02X (GPE block %4.4s)\n",
    465         GpeNumber, GpeDevice ? DeviceNode->Name.Ascii : "FADT");
    466 
    467     return (ACPI_REENABLE_GPE);
    468 }
    469 
    470 
    471 /******************************************************************************
    472  *
    473  * FUNCTION:    AeGlobalEventHandler
    474  *
    475  * DESCRIPTION: Global GPE/Fixed event handler
    476  *
    477  *****************************************************************************/
    478 
    479 void
    480 AeGlobalEventHandler (
    481     UINT32                  Type,
    482     ACPI_HANDLE             Device,
    483     UINT32                  EventNumber,
    484     void                    *Context)
    485 {
    486     char                    *TypeName;
    487 
    488 
    489     switch (Type)
    490     {
    491     case ACPI_EVENT_TYPE_GPE:
    492 
    493         TypeName = "GPE";
    494         break;
    495 
    496     case ACPI_EVENT_TYPE_FIXED:
    497 
    498         TypeName = "FixedEvent";
    499         break;
    500 
    501     default:
    502 
    503         TypeName = "UNKNOWN";
    504         break;
    505     }
    506 
    507     AcpiOsPrintf (AE_PREFIX
    508         "Global Event Handler received: Type %s Number %.2X Dev %p\n",
    509         TypeName, EventNumber, Device);
    510 }
    511 
    512 
    513 /******************************************************************************
    514  *
    515  * FUNCTION:    AeAttachedDataHandler
    516  *
    517  * DESCRIPTION: Handler for deletion of nodes with attached data (attached via
    518  *              AcpiAttachData)
    519  *
    520  *****************************************************************************/
    521 
    522 static void
    523 AeAttachedDataHandler (
    524     ACPI_HANDLE             Object,
    525     void                    *Data)
    526 {
    527     ACPI_NAMESPACE_NODE     *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Data);
    528 
    529     ACPI_FUNCTION_NAME (AeAttachedDataHandler1);
    530 
    531 
    532     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
    533          "Received an attached data deletion at handler 1 on %4.4s\n",
    534         Node->Name.Ascii));
    535 }
    536 
    537 
    538 /******************************************************************************
    539  *
    540  * FUNCTION:    AeAttachedDataHandler2
    541  *
    542  * DESCRIPTION: Handler for deletion of nodes with attached data (attached via
    543  *              AcpiAttachData)
    544  *
    545  *****************************************************************************/
    546 
    547 static void
    548 AeAttachedDataHandler2 (
    549     ACPI_HANDLE             Object,
    550     void                    *Data)
    551 {
    552     ACPI_NAMESPACE_NODE     *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Data);
    553 
    554     ACPI_FUNCTION_NAME (AeAttachedDataHandler2);
    555 
    556 
    557     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
    558          "Received an attached data deletion at handler 2 on %4.4s\n",
    559         Node->Name.Ascii));
    560 }
    561 
    562 
    563 /******************************************************************************
    564  *
    565  * FUNCTION:    AeInterfaceHandler
    566  *
    567  * DESCRIPTION: Handler for _OSI invocations
    568  *
    569  *****************************************************************************/
    570 
    571 static UINT32
    572 AeInterfaceHandler (
    573     ACPI_STRING             InterfaceName,
    574     UINT32                  Supported)
    575 {
    576     ACPI_FUNCTION_NAME (AeInterfaceHandler);
    577 
    578 
    579     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
    580         "Received _OSI (\"%s\"), is %ssupported\n",
    581         InterfaceName, Supported == 0 ? "not " : ""));
    582 
    583     return (Supported);
    584 }
    585 
    586 
    587 #if (!ACPI_REDUCED_HARDWARE)
    588 /******************************************************************************
    589  *
    590  * FUNCTION:    AeEventHandler, AeSciHandler
    591  *
    592  * DESCRIPTION: Handler for Fixed Events and SCIs
    593  *
    594  *****************************************************************************/
    595 
    596 static UINT32
    597 AeEventHandler (
    598     void                    *Context)
    599 {
    600     return (0);
    601 }
    602 
    603 static UINT32
    604 AeSciHandler (
    605     void                    *Context)
    606 {
    607 
    608     AcpiOsPrintf (AE_PREFIX
    609         "Received an SCI at handler\n");
    610     return (0);
    611 }
    612 
    613 #endif /* !ACPI_REDUCED_HARDWARE */
    614 
    615 
    616 /*******************************************************************************
    617  *
    618  * FUNCTION:    AeInstallSciHandler
    619  *
    620  * PARAMETERS:  None
    621  *
    622  * RETURN:      Status
    623  *
    624  * DESCRIPTION: Install handler for SCIs. Exercise the code by doing an
    625  *              install/remove/install.
    626  *
    627  ******************************************************************************/
    628 
    629 static ACPI_STATUS
    630 AeInstallSciHandler (
    631     void)
    632 {
    633     ACPI_STATUS             Status;
    634 
    635 
    636     Status = AcpiInstallSciHandler (AeSciHandler, &AeMyContext);
    637     if (ACPI_FAILURE (Status))
    638     {
    639         ACPI_EXCEPTION ((AE_INFO, Status,
    640             "Could not install an SCI handler (1)"));
    641     }
    642 
    643     Status = AcpiRemoveSciHandler (AeSciHandler);
    644     if (ACPI_FAILURE (Status))
    645     {
    646         ACPI_EXCEPTION ((AE_INFO, Status,
    647             "Could not remove an SCI handler"));
    648     }
    649 
    650     Status = AcpiInstallSciHandler (AeSciHandler, &AeMyContext);
    651     if (ACPI_FAILURE (Status))
    652     {
    653         ACPI_EXCEPTION ((AE_INFO, Status,
    654             "Could not install an SCI handler (2)"));
    655     }
    656 
    657     return (Status);
    658 }
    659 
    660 
    661 /******************************************************************************
    662  *
    663  * FUNCTION:    AeInstallLateHandlers
    664  *
    665  * PARAMETERS:  None
    666  *
    667  * RETURN:      Status
    668  *
    669  * DESCRIPTION: Install handlers for the AcpiExec utility.
    670  *
    671  *****************************************************************************/
    672 
    673 ACPI_STATUS
    674 AeInstallLateHandlers (
    675     void)
    676 {
    677     ACPI_STATUS             Status;
    678     ACPI_HANDLE             Handle;
    679 
    680 
    681     Status = AcpiGetHandle (NULL, "\\_TZ.TZ1", &Handle);
    682     if (ACPI_SUCCESS (Status))
    683     {
    684         Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
    685             AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567));
    686         ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status);
    687 
    688         Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
    689             AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF));
    690         ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status);
    691 
    692         Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY,
    693             AeNotifyHandler1);
    694         ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status);
    695 
    696         Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY,
    697             AeNotifyHandler2);
    698         ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status);
    699 
    700         Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
    701             AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF));
    702         ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status);
    703 
    704         Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
    705             AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567));
    706         ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status);
    707     }
    708 
    709     Status = AcpiGetHandle (NULL, "\\_PR.CPU0", &Handle);
    710     if (ACPI_SUCCESS (Status))
    711     {
    712         Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
    713             AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567));
    714         ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status);
    715 
    716         Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
    717             AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF));
    718         ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status);
    719     }
    720 
    721 #if (!ACPI_REDUCED_HARDWARE)
    722     if (!AcpiGbl_ReducedHardware)
    723     {
    724         /* Install a user SCI handler */
    725 
    726         Status = AeInstallSciHandler ();
    727         ACPI_CHECK_OK (AeInstallSciHandler, Status);
    728 
    729         /* Install some fixed event handlers */
    730 
    731         Status = AcpiInstallFixedEventHandler (
    732             ACPI_EVENT_GLOBAL, AeEventHandler, NULL);
    733         ACPI_CHECK_OK (AcpiInstallFixedEventHandler, Status);
    734 
    735         Status = AcpiInstallFixedEventHandler (
    736             ACPI_EVENT_RTC, AeEventHandler, NULL);
    737         ACPI_CHECK_OK (AcpiInstallFixedEventHandler, Status);
    738     }
    739 #endif /* !ACPI_REDUCED_HARDWARE */
    740 
    741     AeMyContext.Connection = NULL;
    742     AeMyContext.AccessLength = 0xA5;
    743 
    744     /*
    745      * We will install a handler for each EC device, directly under the EC
    746      * device definition. This is unlike the other handlers which we install
    747      * at the root node. Also install memory and I/O handlers at any PCI
    748      * devices.
    749      */
    750     AeInstallDeviceHandlers ();
    751 
    752     /*
    753      * Install handlers for some of the "device driver" address spaces
    754      * such as SMBus, etc.
    755      */
    756     AeInstallRegionHandlers ();
    757     return (AE_OK);
    758 }
    759 
    760 
    761 /******************************************************************************
    762  *
    763  * FUNCTION:    AeInstallEarlyHandlers
    764  *
    765  * PARAMETERS:  None
    766  *
    767  * RETURN:      Status
    768  *
    769  * DESCRIPTION: Install handlers for the AcpiExec utility.
    770  *
    771  * Notes:       Don't install handler for PCI_Config, we want to use the
    772  *              default handler to exercise that code.
    773  *
    774  *****************************************************************************/
    775 
    776 ACPI_STATUS
    777 AeInstallEarlyHandlers (
    778     void)
    779 {
    780     ACPI_STATUS             Status;
    781     ACPI_HANDLE             Handle;
    782 
    783 
    784     ACPI_FUNCTION_ENTRY ();
    785 
    786 
    787     Status = AcpiInstallInterfaceHandler (AeInterfaceHandler);
    788     if (ACPI_FAILURE (Status))
    789     {
    790         printf ("Could not install interface handler, %s\n",
    791             AcpiFormatException (Status));
    792     }
    793 
    794     Status = AcpiInstallTableHandler (AeTableHandler, NULL);
    795     if (ACPI_FAILURE (Status))
    796     {
    797         printf ("Could not install table handler, %s\n",
    798             AcpiFormatException (Status));
    799     }
    800 
    801     Status = AcpiInstallExceptionHandler (AeExceptionHandler);
    802     if (ACPI_FAILURE (Status))
    803     {
    804         printf ("Could not install exception handler, %s\n",
    805             AcpiFormatException (Status));
    806     }
    807 
    808     /* Install global notify handlers */
    809 
    810     Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT,
    811         ACPI_SYSTEM_NOTIFY, AeSystemNotifyHandler, NULL);
    812     if (ACPI_FAILURE (Status))
    813     {
    814         printf ("Could not install a global system notify handler, %s\n",
    815             AcpiFormatException (Status));
    816     }
    817 
    818     Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT,
    819         ACPI_DEVICE_NOTIFY, AeDeviceNotifyHandler, NULL);
    820     if (ACPI_FAILURE (Status))
    821     {
    822         printf ("Could not install a global notify handler, %s\n",
    823             AcpiFormatException (Status));
    824     }
    825 
    826     Status = AcpiGetHandle (NULL, "\\_SB", &Handle);
    827     if (ACPI_SUCCESS (Status))
    828     {
    829         Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
    830             AeNotifyHandler1, NULL);
    831         if (ACPI_FAILURE (Status))
    832         {
    833             printf ("Could not install a notify handler, %s\n",
    834                 AcpiFormatException (Status));
    835         }
    836 
    837         Status = AcpiRemoveNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
    838             AeNotifyHandler1);
    839         if (ACPI_FAILURE (Status))
    840         {
    841             printf ("Could not remove a notify handler, %s\n",
    842                 AcpiFormatException (Status));
    843         }
    844 
    845         Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
    846             AeNotifyHandler1, NULL);
    847         ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status);
    848 
    849         Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY,
    850             AeNotifyHandler1);
    851         ACPI_CHECK_OK (AcpiRemoveNotifyHandler, Status);
    852 
    853 #if 0
    854         Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
    855             AeNotifyHandler1, NULL);
    856         if (ACPI_FAILURE (Status))
    857         {
    858             printf ("Could not install a notify handler, %s\n",
    859                 AcpiFormatException (Status));
    860         }
    861 #endif
    862 
    863         /* Install two handlers for _SB_ */
    864 
    865         Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
    866             AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567));
    867         ACPI_CHECK_OK(AcpiInstallNotifyHandler, Status);
    868 
    869         Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
    870             AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF));
    871         ACPI_CHECK_OK(AcpiInstallNotifyHandler, Status);
    872 
    873         /* Attempt duplicate handler installation, should fail */
    874 
    875         (void) AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
    876             AeNotifyHandler1, ACPI_CAST_PTR (void, 0x77777777));
    877 
    878         Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle);
    879         ACPI_CHECK_OK (AcpiAttachData, Status);
    880 
    881         Status = AcpiDetachData (Handle, AeAttachedDataHandler);
    882         ACPI_CHECK_OK (AcpiDetachData, Status);
    883 
    884         /* Test attach data at the root object */
    885 
    886         Status = AcpiAttachData (ACPI_ROOT_OBJECT, AeAttachedDataHandler,
    887             AcpiGbl_RootNode);
    888         ACPI_CHECK_OK (AcpiAttachData, Status);
    889 
    890         Status = AcpiAttachData (ACPI_ROOT_OBJECT, AeAttachedDataHandler2,
    891             AcpiGbl_RootNode);
    892         ACPI_CHECK_OK (AcpiAttachData, Status);
    893 
    894         /* Test support for multiple attaches */
    895 
    896         Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle);
    897         ACPI_CHECK_OK (AcpiAttachData, Status);
    898 
    899         Status = AcpiAttachData (Handle, AeAttachedDataHandler2, Handle);
    900         ACPI_CHECK_OK (AcpiAttachData, Status);
    901     }
    902     else
    903     {
    904         printf ("No _SB_ found, %s\n", AcpiFormatException (Status));
    905     }
    906 
    907     /*
    908      * Install handlers that will override the default handlers for some of
    909      * the space IDs.
    910      */
    911     AeOverrideRegionHandlers ();
    912 
    913     /*
    914      * Initialize the global Region Handler space
    915      * MCW 3/23/00
    916      */
    917     AeRegions.NumberOfRegions = 0;
    918     AeRegions.RegionList = NULL;
    919     return (AE_OK);
    920 }
    921