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