Home | History | Annotate | Line # | Download | only in acpiexec
aeinstall.c revision 1.1.1.8
      1      1.1  christos /******************************************************************************
      2      1.1  christos  *
      3      1.1  christos  * Module Name: aeinstall - Installation of operation region handlers
      4      1.1  christos  *
      5      1.1  christos  *****************************************************************************/
      6      1.1  christos 
      7      1.1  christos /*
      8  1.1.1.8  christos  * Copyright (C) 2000 - 2023, Intel Corp.
      9      1.1  christos  * All rights reserved.
     10      1.1  christos  *
     11      1.1  christos  * Redistribution and use in source and binary forms, with or without
     12      1.1  christos  * modification, are permitted provided that the following conditions
     13      1.1  christos  * are met:
     14      1.1  christos  * 1. Redistributions of source code must retain the above copyright
     15      1.1  christos  *    notice, this list of conditions, and the following disclaimer,
     16      1.1  christos  *    without modification.
     17      1.1  christos  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18      1.1  christos  *    substantially similar to the "NO WARRANTY" disclaimer below
     19      1.1  christos  *    ("Disclaimer") and any redistribution must be conditioned upon
     20      1.1  christos  *    including a substantially similar Disclaimer requirement for further
     21      1.1  christos  *    binary redistribution.
     22      1.1  christos  * 3. Neither the names of the above-listed copyright holders nor the names
     23      1.1  christos  *    of any contributors may be used to endorse or promote products derived
     24      1.1  christos  *    from this software without specific prior written permission.
     25      1.1  christos  *
     26      1.1  christos  * Alternatively, this software may be distributed under the terms of the
     27      1.1  christos  * GNU General Public License ("GPL") version 2 as published by the Free
     28      1.1  christos  * Software Foundation.
     29      1.1  christos  *
     30      1.1  christos  * NO WARRANTY
     31      1.1  christos  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32      1.1  christos  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  1.1.1.5  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     34      1.1  christos  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35      1.1  christos  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36      1.1  christos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37      1.1  christos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38      1.1  christos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39      1.1  christos  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40      1.1  christos  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41      1.1  christos  * POSSIBILITY OF SUCH DAMAGES.
     42      1.1  christos  */
     43      1.1  christos 
     44      1.1  christos #include "aecommon.h"
     45      1.1  christos 
     46      1.1  christos #define _COMPONENT          ACPI_TOOLS
     47      1.1  christos         ACPI_MODULE_NAME    ("aeinstall")
     48      1.1  christos 
     49      1.1  christos 
     50      1.1  christos static ACPI_STATUS
     51      1.1  christos AeRegionInit (
     52      1.1  christos     ACPI_HANDLE             RegionHandle,
     53      1.1  christos     UINT32                  Function,
     54      1.1  christos     void                    *HandlerContext,
     55      1.1  christos     void                    **RegionContext);
     56      1.1  christos 
     57      1.1  christos static ACPI_STATUS
     58      1.1  christos AeInstallEcHandler (
     59      1.1  christos     ACPI_HANDLE             ObjHandle,
     60      1.1  christos     UINT32                  Level,
     61      1.1  christos     void                    *Context,
     62      1.1  christos     void                    **ReturnValue);
     63      1.1  christos 
     64      1.1  christos static ACPI_STATUS
     65      1.1  christos AeInstallPciHandler (
     66      1.1  christos     ACPI_HANDLE             ObjHandle,
     67      1.1  christos     UINT32                  Level,
     68      1.1  christos     void                    *Context,
     69      1.1  christos     void                    **ReturnValue);
     70      1.1  christos 
     71  1.1.1.8  christos static ACPI_STATUS
     72  1.1.1.8  christos AeInstallGedHandler (
     73  1.1.1.8  christos     ACPI_HANDLE             ObjHandle,
     74  1.1.1.8  christos     UINT32                  Level,
     75  1.1.1.8  christos     void                    *Context,
     76  1.1.1.8  christos     void                    **ReturnValue);
     77  1.1.1.8  christos 
     78      1.1  christos 
     79      1.1  christos BOOLEAN                     AcpiGbl_DisplayRegionAccess = FALSE;
     80      1.1  christos ACPI_CONNECTION_INFO        AeMyContext;
     81      1.1  christos 
     82      1.1  christos 
     83      1.1  christos /*
     84      1.1  christos  * We will override some of the default region handlers, especially
     85      1.1  christos  * the SystemMemory handler, which must be implemented locally.
     86      1.1  christos  * These handlers are installed "early" - before any _REG methods
     87      1.1  christos  * are executed - since they are special in the sense that the ACPI spec
     88      1.1  christos  * declares that they must "always be available". Cannot override the
     89      1.1  christos  * DataTable region handler either -- needed for test execution.
     90      1.1  christos  *
     91      1.1  christos  * NOTE: The local region handler will simulate access to these address
     92      1.1  christos  * spaces by creating a memory buffer behind each operation region.
     93      1.1  christos  */
     94      1.1  christos static ACPI_ADR_SPACE_TYPE  DefaultSpaceIdList[] =
     95      1.1  christos {
     96      1.1  christos     ACPI_ADR_SPACE_SYSTEM_MEMORY,
     97      1.1  christos     ACPI_ADR_SPACE_SYSTEM_IO,
     98      1.1  christos     ACPI_ADR_SPACE_PCI_CONFIG,
     99      1.1  christos     ACPI_ADR_SPACE_EC
    100      1.1  christos };
    101      1.1  christos 
    102      1.1  christos /*
    103      1.1  christos  * We will install handlers for some of the various address space IDs.
    104      1.1  christos  * Test one user-defined address space (used by aslts).
    105      1.1  christos  */
    106      1.1  christos #define ACPI_ADR_SPACE_USER_DEFINED1        0x80
    107      1.1  christos #define ACPI_ADR_SPACE_USER_DEFINED2        0xE4
    108      1.1  christos 
    109      1.1  christos static ACPI_ADR_SPACE_TYPE  SpaceIdList[] =
    110      1.1  christos {
    111      1.1  christos     ACPI_ADR_SPACE_SMBUS,
    112      1.1  christos     ACPI_ADR_SPACE_CMOS,
    113      1.1  christos     ACPI_ADR_SPACE_PCI_BAR_TARGET,
    114      1.1  christos     ACPI_ADR_SPACE_IPMI,
    115      1.1  christos     ACPI_ADR_SPACE_GPIO,
    116      1.1  christos     ACPI_ADR_SPACE_GSBUS,
    117  1.1.1.3  christos     ACPI_ADR_SPACE_PLATFORM_COMM,
    118  1.1.1.6  christos     ACPI_ADR_SPACE_PLATFORM_RT,
    119      1.1  christos     ACPI_ADR_SPACE_FIXED_HARDWARE,
    120      1.1  christos     ACPI_ADR_SPACE_USER_DEFINED1,
    121      1.1  christos     ACPI_ADR_SPACE_USER_DEFINED2
    122      1.1  christos };
    123      1.1  christos 
    124      1.1  christos 
    125      1.1  christos /******************************************************************************
    126      1.1  christos  *
    127      1.1  christos  * FUNCTION:    AeRegionInit
    128      1.1  christos  *
    129      1.1  christos  * PARAMETERS:  Region init handler
    130      1.1  christos  *
    131      1.1  christos  * RETURN:      Status
    132      1.1  christos  *
    133      1.1  christos  * DESCRIPTION: Opregion init function.
    134      1.1  christos  *
    135      1.1  christos  *****************************************************************************/
    136      1.1  christos 
    137      1.1  christos static ACPI_STATUS
    138      1.1  christos AeRegionInit (
    139      1.1  christos     ACPI_HANDLE                 RegionHandle,
    140      1.1  christos     UINT32                      Function,
    141      1.1  christos     void                        *HandlerContext,
    142      1.1  christos     void                        **RegionContext)
    143      1.1  christos {
    144      1.1  christos 
    145      1.1  christos     if (Function == ACPI_REGION_DEACTIVATE)
    146      1.1  christos     {
    147      1.1  christos         *RegionContext = NULL;
    148      1.1  christos     }
    149      1.1  christos     else
    150      1.1  christos     {
    151      1.1  christos         *RegionContext = RegionHandle;
    152      1.1  christos     }
    153      1.1  christos 
    154      1.1  christos     return (AE_OK);
    155      1.1  christos }
    156      1.1  christos 
    157      1.1  christos 
    158      1.1  christos /******************************************************************************
    159      1.1  christos  *
    160      1.1  christos  * FUNCTION:    AeOverrideRegionHandlers
    161      1.1  christos  *
    162      1.1  christos  * PARAMETERS:  None
    163      1.1  christos  *
    164      1.1  christos  * RETURN:      None
    165      1.1  christos  *
    166      1.1  christos  * DESCRIPTION: Override the default region handlers for memory, i/o, and
    167      1.1  christos  *              pci_config. Also install a handler for EC. This is part of
    168      1.1  christos  *              the "install early handlers" functionality.
    169      1.1  christos  *
    170      1.1  christos  *****************************************************************************/
    171      1.1  christos 
    172      1.1  christos void
    173      1.1  christos AeOverrideRegionHandlers (
    174      1.1  christos     void)
    175      1.1  christos {
    176      1.1  christos     UINT32                  i;
    177      1.1  christos     ACPI_STATUS             Status;
    178      1.1  christos 
    179      1.1  christos     /*
    180      1.1  christos      * Install handlers that will override the default handlers for some of
    181      1.1  christos      * the space IDs.
    182      1.1  christos      */
    183      1.1  christos     for (i = 0; i < ACPI_ARRAY_LENGTH (DefaultSpaceIdList); i++)
    184      1.1  christos     {
    185      1.1  christos         /* Install handler at the root object */
    186      1.1  christos 
    187      1.1  christos         Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT,
    188      1.1  christos             DefaultSpaceIdList[i], AeRegionHandler, AeRegionInit,
    189      1.1  christos             &AeMyContext);
    190      1.1  christos 
    191      1.1  christos         if (ACPI_FAILURE (Status))
    192      1.1  christos         {
    193      1.1  christos             ACPI_EXCEPTION ((AE_INFO, Status,
    194      1.1  christos                 "Could not install an OpRegion handler for %s space(%u)",
    195      1.1  christos                 AcpiUtGetRegionName ((UINT8) DefaultSpaceIdList[i]),
    196      1.1  christos                 DefaultSpaceIdList[i]));
    197      1.1  christos         }
    198      1.1  christos     }
    199      1.1  christos }
    200      1.1  christos 
    201      1.1  christos 
    202      1.1  christos /******************************************************************************
    203      1.1  christos  *
    204      1.1  christos  * FUNCTION:    AeInstallRegionHandlers
    205      1.1  christos  *
    206      1.1  christos  * PARAMETERS:  None
    207      1.1  christos  *
    208      1.1  christos  * RETURN:      None
    209      1.1  christos  *
    210      1.1  christos  * DESCRIPTION: Install handlers for the address spaces other than
    211      1.1  christos  *              SystemMemory, SystemIO, and PCI_CONFIG.
    212      1.1  christos  *
    213      1.1  christos  *****************************************************************************/
    214      1.1  christos 
    215      1.1  christos void
    216      1.1  christos AeInstallRegionHandlers (
    217      1.1  christos     void)
    218      1.1  christos {
    219      1.1  christos     UINT32                  i;
    220      1.1  christos     ACPI_STATUS             Status;
    221      1.1  christos 
    222      1.1  christos 
    223      1.1  christos     /*
    224      1.1  christos      * Install handlers for some of the "device driver" address spaces
    225      1.1  christos      * such as SMBus, etc.
    226      1.1  christos      */
    227      1.1  christos     for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++)
    228      1.1  christos     {
    229      1.1  christos         /* Install handler at the root object */
    230      1.1  christos 
    231      1.1  christos         Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT,
    232      1.1  christos             SpaceIdList[i], AeRegionHandler, AeRegionInit,
    233      1.1  christos             &AeMyContext);
    234      1.1  christos 
    235      1.1  christos         if (ACPI_FAILURE (Status))
    236      1.1  christos         {
    237      1.1  christos             ACPI_EXCEPTION ((AE_INFO, Status,
    238      1.1  christos                 "Could not install an OpRegion handler for %s space(%u)",
    239      1.1  christos                 AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i]));
    240      1.1  christos             return;
    241      1.1  christos         }
    242      1.1  christos     }
    243      1.1  christos }
    244      1.1  christos 
    245  1.1.1.8  christos /*******************************************************************************
    246  1.1.1.8  christos  *
    247  1.1.1.8  christos  * FUNCTION:    AeInstallGedHandler
    248  1.1.1.8  christos  *
    249  1.1.1.8  christos  * PARAMETERS:  ACPI_WALK_NAMESPACE callback
    250  1.1.1.8  christos  *
    251  1.1.1.8  christos  * RETURN:      Status
    252  1.1.1.8  christos  *
    253  1.1.1.8  christos  * DESCRIPTION: Walk entire namespace, install a handler for every GED
    254  1.1.1.8  christos  *              device found.
    255  1.1.1.8  christos  *
    256  1.1.1.8  christos  ******************************************************************************/
    257  1.1.1.8  christos static ACPI_STATUS
    258  1.1.1.8  christos AeInstallGedHandler (
    259  1.1.1.8  christos     ACPI_HANDLE             ObjHandle,
    260  1.1.1.8  christos     UINT32                  Level,
    261  1.1.1.8  christos     void                    *Context,
    262  1.1.1.8  christos     void                    **ReturnValue)
    263  1.1.1.8  christos {
    264  1.1.1.8  christos 
    265  1.1.1.8  christos 	ACPI_BUFFER             ReturnBuffer;
    266  1.1.1.8  christos 	ACPI_STATUS Status;
    267  1.1.1.8  christos 	ACPI_RESOURCE *ResourceList;
    268  1.1.1.8  christos 	ACPI_RESOURCE_EXTENDED_IRQ *extended_irq_rsc;
    269  1.1.1.8  christos     ACPI_NAMESPACE_NODE     *Node;
    270  1.1.1.8  christos 	ACPI_NAMESPACE_NODE		*EvtMethodNode;
    271  1.1.1.8  christos 
    272  1.1.1.8  christos     ACPI_FUNCTION_ENTRY();
    273  1.1.1.8  christos 
    274  1.1.1.8  christos 	/* Obtain the Namespace Node of this GED object handle. */
    275  1.1.1.8  christos 	Node = AcpiNsValidateHandle (ObjHandle);
    276  1.1.1.8  christos 	if (!Node)
    277  1.1.1.8  christos 	{
    278  1.1.1.8  christos 		return (AE_BAD_PARAMETER);
    279  1.1.1.8  christos 	}
    280  1.1.1.8  christos 
    281  1.1.1.8  christos 	/*
    282  1.1.1.8  christos 	 * A GED device must have one _EVT method.
    283  1.1.1.8  christos 	 * Obtain the _EVT method and store it in the global
    284  1.1.1.8  christos 	 * GED register.
    285  1.1.1.8  christos 	 */
    286  1.1.1.8  christos 	Status = AcpiNsSearchOneScope (
    287  1.1.1.8  christos 		*ACPI_CAST_PTR (ACPI_NAME, METHOD_NAME__EVT),
    288  1.1.1.8  christos 		Node,
    289  1.1.1.8  christos 		ACPI_TYPE_METHOD,
    290  1.1.1.8  christos 		&EvtMethodNode
    291  1.1.1.8  christos 	);
    292  1.1.1.8  christos 	if (ACPI_FAILURE (Status))
    293  1.1.1.8  christos 	{
    294  1.1.1.8  christos 		AcpiOsPrintf ("Failed to obtain _EVT method for the GED device.\n");
    295  1.1.1.8  christos 		return Status;
    296  1.1.1.8  christos 	}
    297  1.1.1.8  christos 
    298  1.1.1.8  christos 	ReturnBuffer.Pointer = NULL;
    299  1.1.1.8  christos     ReturnBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
    300  1.1.1.8  christos 
    301  1.1.1.8  christos 	Status = AcpiGetCurrentResources (ObjHandle, &ReturnBuffer);
    302  1.1.1.8  christos 	if (ACPI_FAILURE (Status))
    303  1.1.1.8  christos 	{
    304  1.1.1.8  christos 		AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
    305  1.1.1.8  christos 			AcpiFormatException (Status));
    306  1.1.1.8  christos 		return Status;
    307  1.1.1.8  christos 	}
    308  1.1.1.8  christos 
    309  1.1.1.8  christos 	/* Traverse the _CRS resource list */
    310  1.1.1.8  christos 	ResourceList = ACPI_CAST_PTR (ACPI_RESOURCE, ReturnBuffer.Pointer);
    311  1.1.1.8  christos 	while (ResourceList->Type != ACPI_RESOURCE_TYPE_END_TAG) {
    312  1.1.1.8  christos 
    313  1.1.1.8  christos 		switch (ResourceList->Type) {
    314  1.1.1.8  christos 		 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: {
    315  1.1.1.8  christos 
    316  1.1.1.8  christos 			/*
    317  1.1.1.8  christos 			 * Found an Interrupt resource. Link the interrupt resource
    318  1.1.1.8  christos 			 * and the _EVT method of this GED device in the GED event handler list.
    319  1.1.1.8  christos 			 */
    320  1.1.1.8  christos 			ACPI_GED_HANDLER_INFO *GedHandler =
    321  1.1.1.8  christos 			ACPI_ALLOCATE (sizeof (ACPI_SCI_HANDLER_INFO));
    322  1.1.1.8  christos 			if (!GedHandler)
    323  1.1.1.8  christos 			{
    324  1.1.1.8  christos 				return AE_NO_MEMORY;
    325  1.1.1.8  christos 			}
    326  1.1.1.8  christos 
    327  1.1.1.8  christos 			GedHandler->Next = AcpiGbl_GedHandlerList;
    328  1.1.1.8  christos 			AcpiGbl_GedHandlerList = GedHandler;
    329  1.1.1.8  christos 
    330  1.1.1.8  christos 			extended_irq_rsc = &ResourceList->Data.ExtendedIrq;
    331  1.1.1.8  christos 
    332  1.1.1.8  christos 			GedHandler->IntId = extended_irq_rsc->Interrupts[0];
    333  1.1.1.8  christos 			GedHandler->EvtMethod = EvtMethodNode;
    334  1.1.1.8  christos 
    335  1.1.1.8  christos 			AcpiOsPrintf ("Interrupt ID %d\n", extended_irq_rsc->Interrupts[0]);
    336  1.1.1.8  christos 
    337  1.1.1.8  christos 			break;
    338  1.1.1.8  christos 		 }
    339  1.1.1.8  christos 		 default:
    340  1.1.1.8  christos 
    341  1.1.1.8  christos 			AcpiOsPrintf ("Resource type %X\n", ResourceList->Type);
    342  1.1.1.8  christos 		}
    343  1.1.1.8  christos 
    344  1.1.1.8  christos 		ResourceList = ACPI_NEXT_RESOURCE (ResourceList);
    345  1.1.1.8  christos 	}
    346  1.1.1.8  christos 
    347  1.1.1.8  christos 	return AE_OK;
    348  1.1.1.8  christos }
    349      1.1  christos 
    350      1.1  christos /*******************************************************************************
    351      1.1  christos  *
    352      1.1  christos  * FUNCTION:    AeInstallDeviceHandlers
    353      1.1  christos  *
    354      1.1  christos  * PARAMETERS:  None
    355      1.1  christos  *
    356      1.1  christos  * RETURN:      Status
    357      1.1  christos  *
    358  1.1.1.8  christos  * DESCRIPTION: Install handlers for all EC, PCI and GED devices in the namespace
    359      1.1  christos  *
    360      1.1  christos  ******************************************************************************/
    361      1.1  christos 
    362      1.1  christos ACPI_STATUS
    363      1.1  christos AeInstallDeviceHandlers (
    364      1.1  christos     void)
    365      1.1  christos {
    366      1.1  christos 
    367      1.1  christos     /* Find all Embedded Controller devices */
    368      1.1  christos 
    369      1.1  christos     AcpiGetDevices ("PNP0C09", AeInstallEcHandler, NULL, NULL);
    370      1.1  christos 
    371      1.1  christos     /* Install a PCI handler */
    372      1.1  christos 
    373      1.1  christos     AcpiGetDevices ("PNP0A08", AeInstallPciHandler, NULL, NULL);
    374  1.1.1.8  christos 
    375  1.1.1.8  christos     /* Install a GED handler */
    376  1.1.1.8  christos 
    377  1.1.1.8  christos     AcpiGetDevices ("ACPI0013", AeInstallGedHandler, NULL, NULL);
    378  1.1.1.8  christos 
    379      1.1  christos     return (AE_OK);
    380      1.1  christos }
    381      1.1  christos 
    382      1.1  christos 
    383      1.1  christos /*******************************************************************************
    384      1.1  christos  *
    385      1.1  christos  * FUNCTION:    AeInstallEcHandler
    386      1.1  christos  *
    387      1.1  christos  * PARAMETERS:  ACPI_WALK_NAMESPACE callback
    388      1.1  christos  *
    389      1.1  christos  * RETURN:      Status
    390      1.1  christos  *
    391      1.1  christos  * DESCRIPTION: Walk entire namespace, install a handler for every EC
    392      1.1  christos  *              device found.
    393      1.1  christos  *
    394      1.1  christos  ******************************************************************************/
    395      1.1  christos 
    396      1.1  christos static ACPI_STATUS
    397      1.1  christos AeInstallEcHandler (
    398      1.1  christos     ACPI_HANDLE             ObjHandle,
    399      1.1  christos     UINT32                  Level,
    400      1.1  christos     void                    *Context,
    401      1.1  christos     void                    **ReturnValue)
    402      1.1  christos {
    403      1.1  christos     ACPI_STATUS             Status;
    404      1.1  christos 
    405      1.1  christos 
    406      1.1  christos     /* Install the handler for this EC device */
    407      1.1  christos 
    408      1.1  christos     Status = AcpiInstallAddressSpaceHandler (ObjHandle,
    409      1.1  christos         ACPI_ADR_SPACE_EC, AeRegionHandler, AeRegionInit, &AeMyContext);
    410      1.1  christos     if (ACPI_FAILURE (Status))
    411      1.1  christos     {
    412      1.1  christos         ACPI_EXCEPTION ((AE_INFO, Status,
    413      1.1  christos             "Could not install an OpRegion handler for EC device (%p)",
    414      1.1  christos             ObjHandle));
    415      1.1  christos     }
    416      1.1  christos 
    417      1.1  christos     return (Status);
    418      1.1  christos }
    419      1.1  christos 
    420      1.1  christos 
    421      1.1  christos /*******************************************************************************
    422      1.1  christos  *
    423      1.1  christos  * FUNCTION:    AeInstallPciHandler
    424      1.1  christos  *
    425      1.1  christos  * PARAMETERS:  ACPI_WALK_NAMESPACE callback
    426      1.1  christos  *
    427      1.1  christos  * RETURN:      Status
    428      1.1  christos  *
    429      1.1  christos  * DESCRIPTION: Walk entire namespace, install a handler for every PCI
    430      1.1  christos  *              device found.
    431      1.1  christos  *
    432      1.1  christos  ******************************************************************************/
    433      1.1  christos 
    434      1.1  christos static ACPI_STATUS
    435      1.1  christos AeInstallPciHandler (
    436      1.1  christos     ACPI_HANDLE             ObjHandle,
    437      1.1  christos     UINT32                  Level,
    438      1.1  christos     void                    *Context,
    439      1.1  christos     void                    **ReturnValue)
    440      1.1  christos {
    441      1.1  christos     ACPI_STATUS             Status;
    442      1.1  christos 
    443      1.1  christos 
    444      1.1  christos     /* Install memory and I/O handlers for the PCI device */
    445      1.1  christos 
    446      1.1  christos     Status = AcpiInstallAddressSpaceHandler (ObjHandle,
    447      1.1  christos         ACPI_ADR_SPACE_SYSTEM_IO, AeRegionHandler, AeRegionInit,
    448      1.1  christos         &AeMyContext);
    449      1.1  christos     if (ACPI_FAILURE (Status))
    450      1.1  christos     {
    451      1.1  christos         ACPI_EXCEPTION ((AE_INFO, Status,
    452      1.1  christos             "Could not install an OpRegion handler for PCI device (%p)",
    453      1.1  christos             ObjHandle));
    454      1.1  christos     }
    455      1.1  christos 
    456      1.1  christos     Status = AcpiInstallAddressSpaceHandler (ObjHandle,
    457      1.1  christos         ACPI_ADR_SPACE_SYSTEM_MEMORY, AeRegionHandler, AeRegionInit,
    458      1.1  christos         &AeMyContext);
    459      1.1  christos     if (ACPI_FAILURE (Status))
    460      1.1  christos     {
    461      1.1  christos         ACPI_EXCEPTION ((AE_INFO, Status,
    462      1.1  christos             "Could not install an OpRegion handler for PCI device (%p)",
    463      1.1  christos             ObjHandle));
    464      1.1  christos     }
    465      1.1  christos 
    466      1.1  christos     return (AE_CTRL_TERMINATE);
    467      1.1  christos }
    468