Home | History | Annotate | Line # | Download | only in executer
exregion.c revision 1.1.1.2
      1      1.1  jruoho 
      2      1.1  jruoho /******************************************************************************
      3      1.1  jruoho  *
      4      1.1  jruoho  * Module Name: exregion - ACPI default OpRegion (address space) handlers
      5      1.1  jruoho  *
      6      1.1  jruoho  *****************************************************************************/
      7      1.1  jruoho 
      8  1.1.1.2  jruoho /*
      9  1.1.1.2  jruoho  * Copyright (C) 2000 - 2011, Intel Corp.
     10      1.1  jruoho  * All rights reserved.
     11      1.1  jruoho  *
     12  1.1.1.2  jruoho  * Redistribution and use in source and binary forms, with or without
     13  1.1.1.2  jruoho  * modification, are permitted provided that the following conditions
     14  1.1.1.2  jruoho  * are met:
     15  1.1.1.2  jruoho  * 1. Redistributions of source code must retain the above copyright
     16  1.1.1.2  jruoho  *    notice, this list of conditions, and the following disclaimer,
     17  1.1.1.2  jruoho  *    without modification.
     18  1.1.1.2  jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     19  1.1.1.2  jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
     20  1.1.1.2  jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
     21  1.1.1.2  jruoho  *    including a substantially similar Disclaimer requirement for further
     22  1.1.1.2  jruoho  *    binary redistribution.
     23  1.1.1.2  jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
     24  1.1.1.2  jruoho  *    of any contributors may be used to endorse or promote products derived
     25  1.1.1.2  jruoho  *    from this software without specific prior written permission.
     26  1.1.1.2  jruoho  *
     27  1.1.1.2  jruoho  * Alternatively, this software may be distributed under the terms of the
     28  1.1.1.2  jruoho  * GNU General Public License ("GPL") version 2 as published by the Free
     29  1.1.1.2  jruoho  * Software Foundation.
     30  1.1.1.2  jruoho  *
     31  1.1.1.2  jruoho  * NO WARRANTY
     32  1.1.1.2  jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     33  1.1.1.2  jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     34  1.1.1.2  jruoho  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     35  1.1.1.2  jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     36  1.1.1.2  jruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     37  1.1.1.2  jruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     38  1.1.1.2  jruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     39  1.1.1.2  jruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     40  1.1.1.2  jruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     41  1.1.1.2  jruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     42  1.1.1.2  jruoho  * POSSIBILITY OF SUCH DAMAGES.
     43  1.1.1.2  jruoho  */
     44      1.1  jruoho 
     45      1.1  jruoho 
     46      1.1  jruoho #define __EXREGION_C__
     47      1.1  jruoho 
     48      1.1  jruoho #include "acpi.h"
     49      1.1  jruoho #include "accommon.h"
     50      1.1  jruoho #include "acinterp.h"
     51      1.1  jruoho 
     52      1.1  jruoho 
     53      1.1  jruoho #define _COMPONENT          ACPI_EXECUTER
     54      1.1  jruoho         ACPI_MODULE_NAME    ("exregion")
     55      1.1  jruoho 
     56      1.1  jruoho 
     57      1.1  jruoho /*******************************************************************************
     58      1.1  jruoho  *
     59      1.1  jruoho  * FUNCTION:    AcpiExSystemMemorySpaceHandler
     60      1.1  jruoho  *
     61      1.1  jruoho  * PARAMETERS:  Function            - Read or Write operation
     62      1.1  jruoho  *              Address             - Where in the space to read or write
     63      1.1  jruoho  *              BitWidth            - Field width in bits (8, 16, or 32)
     64      1.1  jruoho  *              Value               - Pointer to in or out value
     65      1.1  jruoho  *              HandlerContext      - Pointer to Handler's context
     66      1.1  jruoho  *              RegionContext       - Pointer to context specific to the
     67      1.1  jruoho  *                                    accessed region
     68      1.1  jruoho  *
     69      1.1  jruoho  * RETURN:      Status
     70      1.1  jruoho  *
     71      1.1  jruoho  * DESCRIPTION: Handler for the System Memory address space (Op Region)
     72      1.1  jruoho  *
     73      1.1  jruoho  ******************************************************************************/
     74      1.1  jruoho 
     75      1.1  jruoho ACPI_STATUS
     76      1.1  jruoho AcpiExSystemMemorySpaceHandler (
     77      1.1  jruoho     UINT32                  Function,
     78      1.1  jruoho     ACPI_PHYSICAL_ADDRESS   Address,
     79      1.1  jruoho     UINT32                  BitWidth,
     80      1.1  jruoho     UINT64                  *Value,
     81      1.1  jruoho     void                    *HandlerContext,
     82      1.1  jruoho     void                    *RegionContext)
     83      1.1  jruoho {
     84      1.1  jruoho     ACPI_STATUS             Status = AE_OK;
     85      1.1  jruoho     void                    *LogicalAddrPtr = NULL;
     86      1.1  jruoho     ACPI_MEM_SPACE_CONTEXT  *MemInfo = RegionContext;
     87      1.1  jruoho     UINT32                  Length;
     88      1.1  jruoho     ACPI_SIZE               MapLength;
     89      1.1  jruoho     ACPI_SIZE               PageBoundaryMapLength;
     90      1.1  jruoho #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
     91      1.1  jruoho     UINT32                  Remainder;
     92      1.1  jruoho #endif
     93      1.1  jruoho 
     94      1.1  jruoho 
     95      1.1  jruoho     ACPI_FUNCTION_TRACE (ExSystemMemorySpaceHandler);
     96      1.1  jruoho 
     97      1.1  jruoho 
     98      1.1  jruoho     /* Validate and translate the bit width */
     99      1.1  jruoho 
    100      1.1  jruoho     switch (BitWidth)
    101      1.1  jruoho     {
    102      1.1  jruoho     case 8:
    103      1.1  jruoho         Length = 1;
    104      1.1  jruoho         break;
    105      1.1  jruoho 
    106      1.1  jruoho     case 16:
    107      1.1  jruoho         Length = 2;
    108      1.1  jruoho         break;
    109      1.1  jruoho 
    110      1.1  jruoho     case 32:
    111      1.1  jruoho         Length = 4;
    112      1.1  jruoho         break;
    113      1.1  jruoho 
    114      1.1  jruoho     case 64:
    115      1.1  jruoho         Length = 8;
    116      1.1  jruoho         break;
    117      1.1  jruoho 
    118      1.1  jruoho     default:
    119      1.1  jruoho         ACPI_ERROR ((AE_INFO, "Invalid SystemMemory width %u",
    120      1.1  jruoho             BitWidth));
    121      1.1  jruoho         return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
    122      1.1  jruoho     }
    123      1.1  jruoho 
    124      1.1  jruoho #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
    125      1.1  jruoho     /*
    126      1.1  jruoho      * Hardware does not support non-aligned data transfers, we must verify
    127      1.1  jruoho      * the request.
    128      1.1  jruoho      */
    129      1.1  jruoho     (void) AcpiUtShortDivide ((UINT64) Address, Length, NULL, &Remainder);
    130      1.1  jruoho     if (Remainder != 0)
    131      1.1  jruoho     {
    132      1.1  jruoho         return_ACPI_STATUS (AE_AML_ALIGNMENT);
    133      1.1  jruoho     }
    134      1.1  jruoho #endif
    135      1.1  jruoho 
    136      1.1  jruoho     /*
    137      1.1  jruoho      * Does the request fit into the cached memory mapping?
    138      1.1  jruoho      * Is 1) Address below the current mapping? OR
    139      1.1  jruoho      *    2) Address beyond the current mapping?
    140      1.1  jruoho      */
    141      1.1  jruoho     if ((Address < MemInfo->MappedPhysicalAddress) ||
    142      1.1  jruoho         (((UINT64) Address + Length) >
    143      1.1  jruoho             ((UINT64)
    144      1.1  jruoho             MemInfo->MappedPhysicalAddress + MemInfo->MappedLength)))
    145      1.1  jruoho     {
    146      1.1  jruoho         /*
    147      1.1  jruoho          * The request cannot be resolved by the current memory mapping;
    148      1.1  jruoho          * Delete the existing mapping and create a new one.
    149      1.1  jruoho          */
    150      1.1  jruoho         if (MemInfo->MappedLength)
    151      1.1  jruoho         {
    152      1.1  jruoho             /* Valid mapping, delete it */
    153      1.1  jruoho 
    154      1.1  jruoho             AcpiOsUnmapMemory (MemInfo->MappedLogicalAddress,
    155      1.1  jruoho                 MemInfo->MappedLength);
    156      1.1  jruoho         }
    157      1.1  jruoho 
    158      1.1  jruoho         /*
    159      1.1  jruoho          * October 2009: Attempt to map from the requested address to the
    160      1.1  jruoho          * end of the region. However, we will never map more than one
    161      1.1  jruoho          * page, nor will we cross a page boundary.
    162      1.1  jruoho          */
    163      1.1  jruoho         MapLength = (ACPI_SIZE)
    164      1.1  jruoho             ((MemInfo->Address + MemInfo->Length) - Address);
    165      1.1  jruoho 
    166      1.1  jruoho         /*
    167      1.1  jruoho          * If mapping the entire remaining portion of the region will cross
    168      1.1  jruoho          * a page boundary, just map up to the page boundary, do not cross.
    169      1.1  jruoho          * On some systems, crossing a page boundary while mapping regions
    170      1.1  jruoho          * can cause warnings if the pages have different attributes
    171      1.1  jruoho          * due to resource management.
    172      1.1  jruoho          *
    173      1.1  jruoho          * This has the added benefit of constraining a single mapping to
    174      1.1  jruoho          * one page, which is similar to the original code that used a 4k
    175      1.1  jruoho          * maximum window.
    176      1.1  jruoho          */
    177      1.1  jruoho         PageBoundaryMapLength =
    178      1.1  jruoho             ACPI_ROUND_UP (Address, ACPI_DEFAULT_PAGE_SIZE) - Address;
    179      1.1  jruoho         if (PageBoundaryMapLength == 0)
    180      1.1  jruoho         {
    181      1.1  jruoho             PageBoundaryMapLength = ACPI_DEFAULT_PAGE_SIZE;
    182      1.1  jruoho         }
    183      1.1  jruoho 
    184      1.1  jruoho         if (MapLength > PageBoundaryMapLength)
    185      1.1  jruoho         {
    186      1.1  jruoho             MapLength = PageBoundaryMapLength;
    187      1.1  jruoho         }
    188      1.1  jruoho 
    189      1.1  jruoho         /* Create a new mapping starting at the address given */
    190      1.1  jruoho 
    191      1.1  jruoho         MemInfo->MappedLogicalAddress = AcpiOsMapMemory (
    192      1.1  jruoho             (ACPI_PHYSICAL_ADDRESS) Address, MapLength);
    193      1.1  jruoho         if (!MemInfo->MappedLogicalAddress)
    194      1.1  jruoho         {
    195      1.1  jruoho             ACPI_ERROR ((AE_INFO,
    196      1.1  jruoho                 "Could not map memory at 0x%8.8X%8.8X, size %u",
    197      1.1  jruoho                 ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) MapLength));
    198      1.1  jruoho             MemInfo->MappedLength = 0;
    199      1.1  jruoho             return_ACPI_STATUS (AE_NO_MEMORY);
    200      1.1  jruoho         }
    201      1.1  jruoho 
    202      1.1  jruoho         /* Save the physical address and mapping size */
    203      1.1  jruoho 
    204      1.1  jruoho         MemInfo->MappedPhysicalAddress = Address;
    205      1.1  jruoho         MemInfo->MappedLength = MapLength;
    206      1.1  jruoho     }
    207      1.1  jruoho 
    208      1.1  jruoho     /*
    209      1.1  jruoho      * Generate a logical pointer corresponding to the address we want to
    210      1.1  jruoho      * access
    211      1.1  jruoho      */
    212      1.1  jruoho     LogicalAddrPtr = MemInfo->MappedLogicalAddress +
    213      1.1  jruoho         ((UINT64) Address - (UINT64) MemInfo->MappedPhysicalAddress);
    214      1.1  jruoho 
    215      1.1  jruoho     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
    216      1.1  jruoho         "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n",
    217      1.1  jruoho         BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address)));
    218      1.1  jruoho 
    219      1.1  jruoho     /*
    220      1.1  jruoho      * Perform the memory read or write
    221      1.1  jruoho      *
    222      1.1  jruoho      * Note: For machines that do not support non-aligned transfers, the target
    223      1.1  jruoho      * address was checked for alignment above.  We do not attempt to break the
    224      1.1  jruoho      * transfer up into smaller (byte-size) chunks because the AML specifically
    225      1.1  jruoho      * asked for a transfer width that the hardware may require.
    226      1.1  jruoho      */
    227      1.1  jruoho     switch (Function)
    228      1.1  jruoho     {
    229      1.1  jruoho     case ACPI_READ:
    230      1.1  jruoho 
    231      1.1  jruoho         *Value = 0;
    232      1.1  jruoho         switch (BitWidth)
    233      1.1  jruoho         {
    234      1.1  jruoho         case 8:
    235      1.1  jruoho             *Value = (UINT64) ACPI_GET8 (LogicalAddrPtr);
    236      1.1  jruoho             break;
    237      1.1  jruoho 
    238      1.1  jruoho         case 16:
    239      1.1  jruoho             *Value = (UINT64) ACPI_GET16 (LogicalAddrPtr);
    240      1.1  jruoho             break;
    241      1.1  jruoho 
    242      1.1  jruoho         case 32:
    243      1.1  jruoho             *Value = (UINT64) ACPI_GET32 (LogicalAddrPtr);
    244      1.1  jruoho             break;
    245      1.1  jruoho 
    246      1.1  jruoho         case 64:
    247      1.1  jruoho             *Value = (UINT64) ACPI_GET64 (LogicalAddrPtr);
    248      1.1  jruoho             break;
    249      1.1  jruoho 
    250      1.1  jruoho         default:
    251      1.1  jruoho             /* BitWidth was already validated */
    252      1.1  jruoho             break;
    253      1.1  jruoho         }
    254      1.1  jruoho         break;
    255      1.1  jruoho 
    256      1.1  jruoho     case ACPI_WRITE:
    257      1.1  jruoho 
    258      1.1  jruoho         switch (BitWidth)
    259      1.1  jruoho         {
    260      1.1  jruoho         case 8:
    261      1.1  jruoho             ACPI_SET8 (LogicalAddrPtr) = (UINT8) *Value;
    262      1.1  jruoho             break;
    263      1.1  jruoho 
    264      1.1  jruoho         case 16:
    265      1.1  jruoho             ACPI_SET16 (LogicalAddrPtr) = (UINT16) *Value;
    266      1.1  jruoho             break;
    267      1.1  jruoho 
    268      1.1  jruoho         case 32:
    269      1.1  jruoho             ACPI_SET32 ( LogicalAddrPtr) = (UINT32) *Value;
    270      1.1  jruoho             break;
    271      1.1  jruoho 
    272      1.1  jruoho         case 64:
    273      1.1  jruoho             ACPI_SET64 (LogicalAddrPtr) = (UINT64) *Value;
    274      1.1  jruoho             break;
    275      1.1  jruoho 
    276      1.1  jruoho         default:
    277      1.1  jruoho             /* BitWidth was already validated */
    278      1.1  jruoho             break;
    279      1.1  jruoho         }
    280      1.1  jruoho         break;
    281      1.1  jruoho 
    282      1.1  jruoho     default:
    283      1.1  jruoho         Status = AE_BAD_PARAMETER;
    284      1.1  jruoho         break;
    285      1.1  jruoho     }
    286      1.1  jruoho 
    287      1.1  jruoho     return_ACPI_STATUS (Status);
    288      1.1  jruoho }
    289      1.1  jruoho 
    290      1.1  jruoho 
    291      1.1  jruoho /*******************************************************************************
    292      1.1  jruoho  *
    293      1.1  jruoho  * FUNCTION:    AcpiExSystemIoSpaceHandler
    294      1.1  jruoho  *
    295      1.1  jruoho  * PARAMETERS:  Function            - Read or Write operation
    296      1.1  jruoho  *              Address             - Where in the space to read or write
    297      1.1  jruoho  *              BitWidth            - Field width in bits (8, 16, or 32)
    298      1.1  jruoho  *              Value               - Pointer to in or out value
    299      1.1  jruoho  *              HandlerContext      - Pointer to Handler's context
    300      1.1  jruoho  *              RegionContext       - Pointer to context specific to the
    301      1.1  jruoho  *                                    accessed region
    302      1.1  jruoho  *
    303      1.1  jruoho  * RETURN:      Status
    304      1.1  jruoho  *
    305      1.1  jruoho  * DESCRIPTION: Handler for the System IO address space (Op Region)
    306      1.1  jruoho  *
    307      1.1  jruoho  ******************************************************************************/
    308      1.1  jruoho 
    309      1.1  jruoho ACPI_STATUS
    310      1.1  jruoho AcpiExSystemIoSpaceHandler (
    311      1.1  jruoho     UINT32                  Function,
    312      1.1  jruoho     ACPI_PHYSICAL_ADDRESS   Address,
    313      1.1  jruoho     UINT32                  BitWidth,
    314      1.1  jruoho     UINT64                  *Value,
    315      1.1  jruoho     void                    *HandlerContext,
    316      1.1  jruoho     void                    *RegionContext)
    317      1.1  jruoho {
    318      1.1  jruoho     ACPI_STATUS             Status = AE_OK;
    319      1.1  jruoho     UINT32                  Value32;
    320      1.1  jruoho 
    321      1.1  jruoho 
    322      1.1  jruoho     ACPI_FUNCTION_TRACE (ExSystemIoSpaceHandler);
    323      1.1  jruoho 
    324      1.1  jruoho 
    325      1.1  jruoho     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
    326      1.1  jruoho         "System-IO (width %u) R/W %u Address=%8.8X%8.8X\n",
    327      1.1  jruoho         BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address)));
    328      1.1  jruoho 
    329      1.1  jruoho     /* Decode the function parameter */
    330      1.1  jruoho 
    331      1.1  jruoho     switch (Function)
    332      1.1  jruoho     {
    333      1.1  jruoho     case ACPI_READ:
    334      1.1  jruoho 
    335      1.1  jruoho         Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address,
    336      1.1  jruoho                     &Value32, BitWidth);
    337      1.1  jruoho         *Value = Value32;
    338      1.1  jruoho         break;
    339      1.1  jruoho 
    340      1.1  jruoho     case ACPI_WRITE:
    341      1.1  jruoho 
    342      1.1  jruoho         Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address,
    343      1.1  jruoho                     (UINT32) *Value, BitWidth);
    344      1.1  jruoho         break;
    345      1.1  jruoho 
    346      1.1  jruoho     default:
    347      1.1  jruoho         Status = AE_BAD_PARAMETER;
    348      1.1  jruoho         break;
    349      1.1  jruoho     }
    350      1.1  jruoho 
    351      1.1  jruoho     return_ACPI_STATUS (Status);
    352      1.1  jruoho }
    353      1.1  jruoho 
    354      1.1  jruoho 
    355      1.1  jruoho /*******************************************************************************
    356      1.1  jruoho  *
    357      1.1  jruoho  * FUNCTION:    AcpiExPciConfigSpaceHandler
    358      1.1  jruoho  *
    359      1.1  jruoho  * PARAMETERS:  Function            - Read or Write operation
    360      1.1  jruoho  *              Address             - Where in the space to read or write
    361      1.1  jruoho  *              BitWidth            - Field width in bits (8, 16, or 32)
    362      1.1  jruoho  *              Value               - Pointer to in or out value
    363      1.1  jruoho  *              HandlerContext      - Pointer to Handler's context
    364      1.1  jruoho  *              RegionContext       - Pointer to context specific to the
    365      1.1  jruoho  *                                    accessed region
    366      1.1  jruoho  *
    367      1.1  jruoho  * RETURN:      Status
    368      1.1  jruoho  *
    369      1.1  jruoho  * DESCRIPTION: Handler for the PCI Config address space (Op Region)
    370      1.1  jruoho  *
    371      1.1  jruoho  ******************************************************************************/
    372      1.1  jruoho 
    373      1.1  jruoho ACPI_STATUS
    374      1.1  jruoho AcpiExPciConfigSpaceHandler (
    375      1.1  jruoho     UINT32                  Function,
    376      1.1  jruoho     ACPI_PHYSICAL_ADDRESS   Address,
    377      1.1  jruoho     UINT32                  BitWidth,
    378      1.1  jruoho     UINT64                  *Value,
    379      1.1  jruoho     void                    *HandlerContext,
    380      1.1  jruoho     void                    *RegionContext)
    381      1.1  jruoho {
    382      1.1  jruoho     ACPI_STATUS             Status = AE_OK;
    383      1.1  jruoho     ACPI_PCI_ID             *PciId;
    384      1.1  jruoho     UINT16                  PciRegister;
    385      1.1  jruoho 
    386      1.1  jruoho 
    387      1.1  jruoho     ACPI_FUNCTION_TRACE (ExPciConfigSpaceHandler);
    388      1.1  jruoho 
    389      1.1  jruoho 
    390      1.1  jruoho     /*
    391      1.1  jruoho      *  The arguments to AcpiOs(Read|Write)PciConfiguration are:
    392      1.1  jruoho      *
    393      1.1  jruoho      *  PciSegment  is the PCI bus segment range 0-31
    394      1.1  jruoho      *  PciBus      is the PCI bus number range 0-255
    395      1.1  jruoho      *  PciDevice   is the PCI device number range 0-31
    396      1.1  jruoho      *  PciFunction is the PCI device function number
    397      1.1  jruoho      *  PciRegister is the Config space register range 0-255 bytes
    398      1.1  jruoho      *
    399      1.1  jruoho      *  Value - input value for write, output address for read
    400      1.1  jruoho      *
    401      1.1  jruoho      */
    402      1.1  jruoho     PciId       = (ACPI_PCI_ID *) RegionContext;
    403      1.1  jruoho     PciRegister = (UINT16) (UINT32) Address;
    404      1.1  jruoho 
    405      1.1  jruoho     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
    406      1.1  jruoho         "Pci-Config %u (%u) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
    407      1.1  jruoho         Function, BitWidth, PciId->Segment, PciId->Bus, PciId->Device,
    408      1.1  jruoho         PciId->Function, PciRegister));
    409      1.1  jruoho 
    410      1.1  jruoho     switch (Function)
    411      1.1  jruoho     {
    412      1.1  jruoho     case ACPI_READ:
    413      1.1  jruoho 
    414      1.1  jruoho         *Value = 0;
    415      1.1  jruoho         Status = AcpiOsReadPciConfiguration (PciId, PciRegister,
    416      1.1  jruoho                     Value, BitWidth);
    417      1.1  jruoho         break;
    418      1.1  jruoho 
    419      1.1  jruoho     case ACPI_WRITE:
    420      1.1  jruoho 
    421      1.1  jruoho         Status = AcpiOsWritePciConfiguration (PciId, PciRegister,
    422      1.1  jruoho                     *Value, BitWidth);
    423      1.1  jruoho         break;
    424      1.1  jruoho 
    425      1.1  jruoho     default:
    426      1.1  jruoho 
    427      1.1  jruoho         Status = AE_BAD_PARAMETER;
    428      1.1  jruoho         break;
    429      1.1  jruoho     }
    430      1.1  jruoho 
    431      1.1  jruoho     return_ACPI_STATUS (Status);
    432      1.1  jruoho }
    433      1.1  jruoho 
    434      1.1  jruoho 
    435      1.1  jruoho /*******************************************************************************
    436      1.1  jruoho  *
    437      1.1  jruoho  * FUNCTION:    AcpiExCmosSpaceHandler
    438      1.1  jruoho  *
    439      1.1  jruoho  * PARAMETERS:  Function            - Read or Write operation
    440      1.1  jruoho  *              Address             - Where in the space to read or write
    441      1.1  jruoho  *              BitWidth            - Field width in bits (8, 16, or 32)
    442      1.1  jruoho  *              Value               - Pointer to in or out value
    443      1.1  jruoho  *              HandlerContext      - Pointer to Handler's context
    444      1.1  jruoho  *              RegionContext       - Pointer to context specific to the
    445      1.1  jruoho  *                                    accessed region
    446      1.1  jruoho  *
    447      1.1  jruoho  * RETURN:      Status
    448      1.1  jruoho  *
    449      1.1  jruoho  * DESCRIPTION: Handler for the CMOS address space (Op Region)
    450      1.1  jruoho  *
    451      1.1  jruoho  ******************************************************************************/
    452      1.1  jruoho 
    453      1.1  jruoho ACPI_STATUS
    454      1.1  jruoho AcpiExCmosSpaceHandler (
    455      1.1  jruoho     UINT32                  Function,
    456      1.1  jruoho     ACPI_PHYSICAL_ADDRESS   Address,
    457      1.1  jruoho     UINT32                  BitWidth,
    458      1.1  jruoho     UINT64                  *Value,
    459      1.1  jruoho     void                    *HandlerContext,
    460      1.1  jruoho     void                    *RegionContext)
    461      1.1  jruoho {
    462      1.1  jruoho     ACPI_STATUS             Status = AE_OK;
    463      1.1  jruoho 
    464      1.1  jruoho 
    465      1.1  jruoho     ACPI_FUNCTION_TRACE (ExCmosSpaceHandler);
    466      1.1  jruoho 
    467      1.1  jruoho 
    468      1.1  jruoho     return_ACPI_STATUS (Status);
    469      1.1  jruoho }
    470      1.1  jruoho 
    471      1.1  jruoho 
    472      1.1  jruoho /*******************************************************************************
    473      1.1  jruoho  *
    474      1.1  jruoho  * FUNCTION:    AcpiExPciBarSpaceHandler
    475      1.1  jruoho  *
    476      1.1  jruoho  * PARAMETERS:  Function            - Read or Write operation
    477      1.1  jruoho  *              Address             - Where in the space to read or write
    478      1.1  jruoho  *              BitWidth            - Field width in bits (8, 16, or 32)
    479      1.1  jruoho  *              Value               - Pointer to in or out value
    480      1.1  jruoho  *              HandlerContext      - Pointer to Handler's context
    481      1.1  jruoho  *              RegionContext       - Pointer to context specific to the
    482      1.1  jruoho  *                                    accessed region
    483      1.1  jruoho  *
    484      1.1  jruoho  * RETURN:      Status
    485      1.1  jruoho  *
    486      1.1  jruoho  * DESCRIPTION: Handler for the PCI BarTarget address space (Op Region)
    487      1.1  jruoho  *
    488      1.1  jruoho  ******************************************************************************/
    489      1.1  jruoho 
    490      1.1  jruoho ACPI_STATUS
    491      1.1  jruoho AcpiExPciBarSpaceHandler (
    492      1.1  jruoho     UINT32                  Function,
    493      1.1  jruoho     ACPI_PHYSICAL_ADDRESS   Address,
    494      1.1  jruoho     UINT32                  BitWidth,
    495      1.1  jruoho     UINT64                  *Value,
    496      1.1  jruoho     void                    *HandlerContext,
    497      1.1  jruoho     void                    *RegionContext)
    498      1.1  jruoho {
    499      1.1  jruoho     ACPI_STATUS             Status = AE_OK;
    500      1.1  jruoho 
    501      1.1  jruoho 
    502      1.1  jruoho     ACPI_FUNCTION_TRACE (ExPciBarSpaceHandler);
    503      1.1  jruoho 
    504      1.1  jruoho 
    505      1.1  jruoho     return_ACPI_STATUS (Status);
    506      1.1  jruoho }
    507      1.1  jruoho 
    508      1.1  jruoho 
    509      1.1  jruoho /*******************************************************************************
    510      1.1  jruoho  *
    511      1.1  jruoho  * FUNCTION:    AcpiExDataTableSpaceHandler
    512      1.1  jruoho  *
    513      1.1  jruoho  * PARAMETERS:  Function            - Read or Write operation
    514      1.1  jruoho  *              Address             - Where in the space to read or write
    515      1.1  jruoho  *              BitWidth            - Field width in bits (8, 16, or 32)
    516      1.1  jruoho  *              Value               - Pointer to in or out value
    517      1.1  jruoho  *              HandlerContext      - Pointer to Handler's context
    518      1.1  jruoho  *              RegionContext       - Pointer to context specific to the
    519      1.1  jruoho  *                                    accessed region
    520      1.1  jruoho  *
    521      1.1  jruoho  * RETURN:      Status
    522      1.1  jruoho  *
    523      1.1  jruoho  * DESCRIPTION: Handler for the Data Table address space (Op Region)
    524      1.1  jruoho  *
    525      1.1  jruoho  ******************************************************************************/
    526      1.1  jruoho 
    527      1.1  jruoho ACPI_STATUS
    528      1.1  jruoho AcpiExDataTableSpaceHandler (
    529      1.1  jruoho     UINT32                  Function,
    530      1.1  jruoho     ACPI_PHYSICAL_ADDRESS   Address,
    531      1.1  jruoho     UINT32                  BitWidth,
    532      1.1  jruoho     UINT64                  *Value,
    533      1.1  jruoho     void                    *HandlerContext,
    534      1.1  jruoho     void                    *RegionContext)
    535      1.1  jruoho {
    536      1.1  jruoho     ACPI_FUNCTION_TRACE (ExDataTableSpaceHandler);
    537      1.1  jruoho 
    538      1.1  jruoho 
    539      1.1  jruoho     /*
    540      1.1  jruoho      * Perform the memory read or write. The BitWidth was already
    541      1.1  jruoho      * validated.
    542      1.1  jruoho      */
    543      1.1  jruoho     switch (Function)
    544      1.1  jruoho     {
    545      1.1  jruoho     case ACPI_READ:
    546      1.1  jruoho 
    547      1.1  jruoho         ACPI_MEMCPY (ACPI_CAST_PTR (char, Value), ACPI_PHYSADDR_TO_PTR (Address),
    548      1.1  jruoho             ACPI_DIV_8 (BitWidth));
    549      1.1  jruoho         break;
    550      1.1  jruoho 
    551      1.1  jruoho     case ACPI_WRITE:
    552      1.1  jruoho 
    553      1.1  jruoho         ACPI_MEMCPY (ACPI_PHYSADDR_TO_PTR (Address), ACPI_CAST_PTR (char, Value),
    554      1.1  jruoho             ACPI_DIV_8 (BitWidth));
    555      1.1  jruoho         break;
    556      1.1  jruoho 
    557      1.1  jruoho     default:
    558      1.1  jruoho 
    559      1.1  jruoho         return_ACPI_STATUS (AE_BAD_PARAMETER);
    560      1.1  jruoho     }
    561      1.1  jruoho 
    562      1.1  jruoho     return_ACPI_STATUS (AE_OK);
    563      1.1  jruoho }
    564      1.1  jruoho 
    565      1.1  jruoho 
    566