167754Smsmith
267754Smsmith/******************************************************************************
367754Smsmith *
477424Smsmith * Module Name: exregion - ACPI default OpRegion (address space) handlers
567754Smsmith *
667754Smsmith *****************************************************************************/
767754Smsmith
8217365Sjkim/*
9217365Sjkim * Copyright (C) 2000 - 2011, Intel Corp.
1070243Smsmith * All rights reserved.
1167754Smsmith *
12217365Sjkim * Redistribution and use in source and binary forms, with or without
13217365Sjkim * modification, are permitted provided that the following conditions
14217365Sjkim * are met:
15217365Sjkim * 1. Redistributions of source code must retain the above copyright
16217365Sjkim *    notice, this list of conditions, and the following disclaimer,
17217365Sjkim *    without modification.
18217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19217365Sjkim *    substantially similar to the "NO WARRANTY" disclaimer below
20217365Sjkim *    ("Disclaimer") and any redistribution must be conditioned upon
21217365Sjkim *    including a substantially similar Disclaimer requirement for further
22217365Sjkim *    binary redistribution.
23217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names
24217365Sjkim *    of any contributors may be used to endorse or promote products derived
25217365Sjkim *    from this software without specific prior written permission.
2667754Smsmith *
27217365Sjkim * Alternatively, this software may be distributed under the terms of the
28217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free
29217365Sjkim * Software Foundation.
3067754Smsmith *
31217365Sjkim * NO WARRANTY
32217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42217365Sjkim * POSSIBILITY OF SUCH DAMAGES.
43217365Sjkim */
4467754Smsmith
4567754Smsmith
4677424Smsmith#define __EXREGION_C__
4767754Smsmith
48193341Sjkim#include <contrib/dev/acpica/include/acpi.h>
49193341Sjkim#include <contrib/dev/acpica/include/accommon.h>
50193341Sjkim#include <contrib/dev/acpica/include/acinterp.h>
5167754Smsmith
5267754Smsmith
5377424Smsmith#define _COMPONENT          ACPI_EXECUTER
5491116Smsmith        ACPI_MODULE_NAME    ("exregion")
5567754Smsmith
5667754Smsmith
5767754Smsmith/*******************************************************************************
5867754Smsmith *
5977424Smsmith * FUNCTION:    AcpiExSystemMemorySpaceHandler
6067754Smsmith *
6167754Smsmith * PARAMETERS:  Function            - Read or Write operation
6267754Smsmith *              Address             - Where in the space to read or write
6367754Smsmith *              BitWidth            - Field width in bits (8, 16, or 32)
6467754Smsmith *              Value               - Pointer to in or out value
6567754Smsmith *              HandlerContext      - Pointer to Handler's context
6667754Smsmith *              RegionContext       - Pointer to context specific to the
6784491Smsmith *                                    accessed region
6867754Smsmith *
6967754Smsmith * RETURN:      Status
7067754Smsmith *
7167754Smsmith * DESCRIPTION: Handler for the System Memory address space (Op Region)
7267754Smsmith *
7367754Smsmith ******************************************************************************/
7467754Smsmith
7567754SmsmithACPI_STATUS
7677424SmsmithAcpiExSystemMemorySpaceHandler (
7767754Smsmith    UINT32                  Function,
7869450Smsmith    ACPI_PHYSICAL_ADDRESS   Address,
7967754Smsmith    UINT32                  BitWidth,
80202771Sjkim    UINT64                  *Value,
8167754Smsmith    void                    *HandlerContext,
8267754Smsmith    void                    *RegionContext)
8367754Smsmith{
8467754Smsmith    ACPI_STATUS             Status = AE_OK;
8567754Smsmith    void                    *LogicalAddrPtr = NULL;
8677424Smsmith    ACPI_MEM_SPACE_CONTEXT  *MemInfo = RegionContext;
8767754Smsmith    UINT32                  Length;
88199337Sjkim    ACPI_SIZE               MapLength;
89199337Sjkim    ACPI_SIZE               PageBoundaryMapLength;
90151937Sjkim#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
9199679Siwasaki    UINT32                  Remainder;
9299679Siwasaki#endif
9367754Smsmith
9467754Smsmith
95167802Sjkim    ACPI_FUNCTION_TRACE (ExSystemMemorySpaceHandler);
9667754Smsmith
97167802Sjkim
9867754Smsmith    /* Validate and translate the bit width */
9967754Smsmith
10067754Smsmith    switch (BitWidth)
10167754Smsmith    {
10267754Smsmith    case 8:
10367754Smsmith        Length = 1;
10467754Smsmith        break;
10567754Smsmith
10667754Smsmith    case 16:
10767754Smsmith        Length = 2;
10867754Smsmith        break;
10967754Smsmith
11067754Smsmith    case 32:
11167754Smsmith        Length = 4;
11267754Smsmith        break;
11367754Smsmith
11487031Smsmith    case 64:
11587031Smsmith        Length = 8;
11687031Smsmith        break;
11787031Smsmith
11867754Smsmith    default:
119204773Sjkim        ACPI_ERROR ((AE_INFO, "Invalid SystemMemory width %u",
12067754Smsmith            BitWidth));
12167754Smsmith        return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
12267754Smsmith    }
12367754Smsmith
124151937Sjkim#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
12567754Smsmith    /*
12699679Siwasaki     * Hardware does not support non-aligned data transfers, we must verify
12799679Siwasaki     * the request.
12899679Siwasaki     */
129202771Sjkim    (void) AcpiUtShortDivide ((UINT64) Address, Length, NULL, &Remainder);
13099679Siwasaki    if (Remainder != 0)
13199679Siwasaki    {
13299679Siwasaki        return_ACPI_STATUS (AE_AML_ALIGNMENT);
13399679Siwasaki    }
13499679Siwasaki#endif
13599679Siwasaki
13699679Siwasaki    /*
13767754Smsmith     * Does the request fit into the cached memory mapping?
13867754Smsmith     * Is 1) Address below the current mapping? OR
13967754Smsmith     *    2) Address beyond the current mapping?
14067754Smsmith     */
14169450Smsmith    if ((Address < MemInfo->MappedPhysicalAddress) ||
142202771Sjkim        (((UINT64) Address + Length) >
143202771Sjkim            ((UINT64)
144151937Sjkim            MemInfo->MappedPhysicalAddress + MemInfo->MappedLength)))
14567754Smsmith    {
14667754Smsmith        /*
14767754Smsmith         * The request cannot be resolved by the current memory mapping;
14867754Smsmith         * Delete the existing mapping and create a new one.
14967754Smsmith         */
15067754Smsmith        if (MemInfo->MappedLength)
15167754Smsmith        {
15267754Smsmith            /* Valid mapping, delete it */
15367754Smsmith
15467754Smsmith            AcpiOsUnmapMemory (MemInfo->MappedLogicalAddress,
155167802Sjkim                MemInfo->MappedLength);
15667754Smsmith        }
15767754Smsmith
158102550Siwasaki        /*
159199337Sjkim         * October 2009: Attempt to map from the requested address to the
160199337Sjkim         * end of the region. However, we will never map more than one
161199337Sjkim         * page, nor will we cross a page boundary.
16292388Smsmith         */
163199337Sjkim        MapLength = (ACPI_SIZE)
164151937Sjkim            ((MemInfo->Address + MemInfo->Length) - Address);
165151937Sjkim
166199337Sjkim        /*
167199337Sjkim         * If mapping the entire remaining portion of the region will cross
168199337Sjkim         * a page boundary, just map up to the page boundary, do not cross.
169199337Sjkim         * On some systems, crossing a page boundary while mapping regions
170199337Sjkim         * can cause warnings if the pages have different attributes
171199337Sjkim         * due to resource management.
172199337Sjkim         *
173199337Sjkim         * This has the added benefit of constraining a single mapping to
174199337Sjkim         * one page, which is similar to the original code that used a 4k
175199337Sjkim         * maximum window.
176199337Sjkim         */
177199337Sjkim        PageBoundaryMapLength =
178199337Sjkim            ACPI_ROUND_UP (Address, ACPI_DEFAULT_PAGE_SIZE) - Address;
179199337Sjkim        if (PageBoundaryMapLength == 0)
18092388Smsmith        {
181199337Sjkim            PageBoundaryMapLength = ACPI_DEFAULT_PAGE_SIZE;
18292388Smsmith        }
183102550Siwasaki
184199337Sjkim        if (MapLength > PageBoundaryMapLength)
185199337Sjkim        {
186199337Sjkim            MapLength = PageBoundaryMapLength;
187199337Sjkim        }
188199337Sjkim
18967754Smsmith        /* Create a new mapping starting at the address given */
19067754Smsmith
191193267Sjkim        MemInfo->MappedLogicalAddress = AcpiOsMapMemory (
192199337Sjkim            (ACPI_PHYSICAL_ADDRESS) Address, MapLength);
193167802Sjkim        if (!MemInfo->MappedLogicalAddress)
19467754Smsmith        {
195167802Sjkim            ACPI_ERROR ((AE_INFO,
196204773Sjkim                "Could not map memory at 0x%8.8X%8.8X, size %u",
197199337Sjkim                ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) MapLength));
19892388Smsmith            MemInfo->MappedLength = 0;
199167802Sjkim            return_ACPI_STATUS (AE_NO_MEMORY);
20067754Smsmith        }
20167754Smsmith
20284491Smsmith        /* Save the physical address and mapping size */
20367754Smsmith
20469450Smsmith        MemInfo->MappedPhysicalAddress = Address;
205199337Sjkim        MemInfo->MappedLength = MapLength;
20667754Smsmith    }
20767754Smsmith
20867754Smsmith    /*
20967754Smsmith     * Generate a logical pointer corresponding to the address we want to
21067754Smsmith     * access
21167754Smsmith     */
21267754Smsmith    LogicalAddrPtr = MemInfo->MappedLogicalAddress +
213202771Sjkim        ((UINT64) Address - (UINT64) MemInfo->MappedPhysicalAddress);
21467754Smsmith
21582367Smsmith    ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
216209746Sjkim        "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n",
217193267Sjkim        BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address)));
21867754Smsmith
219167802Sjkim    /*
220167802Sjkim     * Perform the memory read or write
221167802Sjkim     *
222167802Sjkim     * Note: For machines that do not support non-aligned transfers, the target
223167802Sjkim     * address was checked for alignment above.  We do not attempt to break the
224167802Sjkim     * transfer up into smaller (byte-size) chunks because the AML specifically
225167802Sjkim     * asked for a transfer width that the hardware may require.
226167802Sjkim     */
22767754Smsmith    switch (Function)
22867754Smsmith    {
22987031Smsmith    case ACPI_READ:
23067754Smsmith
23191116Smsmith        *Value = 0;
23267754Smsmith        switch (BitWidth)
23367754Smsmith        {
23467754Smsmith        case 8:
235202771Sjkim            *Value = (UINT64) ACPI_GET8 (LogicalAddrPtr);
23667754Smsmith            break;
23767754Smsmith
23867754Smsmith        case 16:
239202771Sjkim            *Value = (UINT64) ACPI_GET16 (LogicalAddrPtr);
24067754Smsmith            break;
24167754Smsmith
24267754Smsmith        case 32:
243202771Sjkim            *Value = (UINT64) ACPI_GET32 (LogicalAddrPtr);
24467754Smsmith            break;
24587031Smsmith
24687031Smsmith        case 64:
247202771Sjkim            *Value = (UINT64) ACPI_GET64 (LogicalAddrPtr);
24887031Smsmith            break;
249167802Sjkim
25099679Siwasaki        default:
25199679Siwasaki            /* BitWidth was already validated */
25299679Siwasaki            break;
25367754Smsmith        }
25467754Smsmith        break;
25567754Smsmith
25687031Smsmith    case ACPI_WRITE:
25767754Smsmith
25867754Smsmith        switch (BitWidth)
25967754Smsmith        {
26067754Smsmith        case 8:
261167802Sjkim            ACPI_SET8 (LogicalAddrPtr) = (UINT8) *Value;
26267754Smsmith            break;
26367754Smsmith
26467754Smsmith        case 16:
265167802Sjkim            ACPI_SET16 (LogicalAddrPtr) = (UINT16) *Value;
26667754Smsmith            break;
26767754Smsmith
26867754Smsmith        case 32:
269167802Sjkim            ACPI_SET32 ( LogicalAddrPtr) = (UINT32) *Value;
27067754Smsmith            break;
27187031Smsmith
27287031Smsmith        case 64:
273167802Sjkim            ACPI_SET64 (LogicalAddrPtr) = (UINT64) *Value;
27487031Smsmith            break;
275102550Siwasaki
27699679Siwasaki        default:
27799679Siwasaki            /* BitWidth was already validated */
27899679Siwasaki            break;
27967754Smsmith        }
28067754Smsmith        break;
28167754Smsmith
28267754Smsmith    default:
28367754Smsmith        Status = AE_BAD_PARAMETER;
28467754Smsmith        break;
28567754Smsmith    }
28667754Smsmith
28767754Smsmith    return_ACPI_STATUS (Status);
28867754Smsmith}
28967754Smsmith
29067754Smsmith
29167754Smsmith/*******************************************************************************
29267754Smsmith *
29377424Smsmith * FUNCTION:    AcpiExSystemIoSpaceHandler
29467754Smsmith *
29567754Smsmith * PARAMETERS:  Function            - Read or Write operation
29667754Smsmith *              Address             - Where in the space to read or write
29767754Smsmith *              BitWidth            - Field width in bits (8, 16, or 32)
29867754Smsmith *              Value               - Pointer to in or out value
29967754Smsmith *              HandlerContext      - Pointer to Handler's context
30067754Smsmith *              RegionContext       - Pointer to context specific to the
30184491Smsmith *                                    accessed region
30267754Smsmith *
30367754Smsmith * RETURN:      Status
30467754Smsmith *
30567754Smsmith * DESCRIPTION: Handler for the System IO address space (Op Region)
30667754Smsmith *
30767754Smsmith ******************************************************************************/
30867754Smsmith
30967754SmsmithACPI_STATUS
31077424SmsmithAcpiExSystemIoSpaceHandler (
31167754Smsmith    UINT32                  Function,
31269450Smsmith    ACPI_PHYSICAL_ADDRESS   Address,
31367754Smsmith    UINT32                  BitWidth,
314202771Sjkim    UINT64                  *Value,
31567754Smsmith    void                    *HandlerContext,
31667754Smsmith    void                    *RegionContext)
31767754Smsmith{
31867754Smsmith    ACPI_STATUS             Status = AE_OK;
319117521Snjl    UINT32                  Value32;
32067754Smsmith
32167754Smsmith
322167802Sjkim    ACPI_FUNCTION_TRACE (ExSystemIoSpaceHandler);
32367754Smsmith
32467754Smsmith
32582367Smsmith    ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
326209746Sjkim        "System-IO (width %u) R/W %u Address=%8.8X%8.8X\n",
327193267Sjkim        BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address)));
32880062Smsmith
32967754Smsmith    /* Decode the function parameter */
33067754Smsmith
33167754Smsmith    switch (Function)
33267754Smsmith    {
33387031Smsmith    case ACPI_READ:
33467754Smsmith
335193267Sjkim        Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address,
336151937Sjkim                    &Value32, BitWidth);
337117521Snjl        *Value = Value32;
33867754Smsmith        break;
33967754Smsmith
34087031Smsmith    case ACPI_WRITE:
34167754Smsmith
342193267Sjkim        Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address,
343151937Sjkim                    (UINT32) *Value, BitWidth);
34467754Smsmith        break;
34567754Smsmith
34667754Smsmith    default:
34767754Smsmith        Status = AE_BAD_PARAMETER;
34867754Smsmith        break;
34967754Smsmith    }
35067754Smsmith
35167754Smsmith    return_ACPI_STATUS (Status);
35267754Smsmith}
35367754Smsmith
35480062Smsmith
35567754Smsmith/*******************************************************************************
35667754Smsmith *
35777424Smsmith * FUNCTION:    AcpiExPciConfigSpaceHandler
35867754Smsmith *
35967754Smsmith * PARAMETERS:  Function            - Read or Write operation
36067754Smsmith *              Address             - Where in the space to read or write
36167754Smsmith *              BitWidth            - Field width in bits (8, 16, or 32)
36267754Smsmith *              Value               - Pointer to in or out value
36367754Smsmith *              HandlerContext      - Pointer to Handler's context
36467754Smsmith *              RegionContext       - Pointer to context specific to the
36584491Smsmith *                                    accessed region
36667754Smsmith *
36767754Smsmith * RETURN:      Status
36867754Smsmith *
36967754Smsmith * DESCRIPTION: Handler for the PCI Config address space (Op Region)
37067754Smsmith *
37167754Smsmith ******************************************************************************/
37267754Smsmith
37367754SmsmithACPI_STATUS
37477424SmsmithAcpiExPciConfigSpaceHandler (
37567754Smsmith    UINT32                  Function,
37669450Smsmith    ACPI_PHYSICAL_ADDRESS   Address,
37767754Smsmith    UINT32                  BitWidth,
378202771Sjkim    UINT64                  *Value,
37967754Smsmith    void                    *HandlerContext,
38067754Smsmith    void                    *RegionContext)
38167754Smsmith{
38267754Smsmith    ACPI_STATUS             Status = AE_OK;
38380062Smsmith    ACPI_PCI_ID             *PciId;
38480062Smsmith    UINT16                  PciRegister;
38567754Smsmith
38667754Smsmith
387167802Sjkim    ACPI_FUNCTION_TRACE (ExPciConfigSpaceHandler);
38867754Smsmith
38980062Smsmith
39067754Smsmith    /*
39187031Smsmith     *  The arguments to AcpiOs(Read|Write)PciConfiguration are:
39267754Smsmith     *
39380062Smsmith     *  PciSegment  is the PCI bus segment range 0-31
39480062Smsmith     *  PciBus      is the PCI bus number range 0-255
39580062Smsmith     *  PciDevice   is the PCI device number range 0-31
39680062Smsmith     *  PciFunction is the PCI device function number
39780062Smsmith     *  PciRegister is the Config space register range 0-255 bytes
39867754Smsmith     *
39980062Smsmith     *  Value - input value for write, output address for read
40067754Smsmith     *
40167754Smsmith     */
40280062Smsmith    PciId       = (ACPI_PCI_ID *) RegionContext;
40399679Siwasaki    PciRegister = (UINT16) (UINT32) Address;
40467754Smsmith
40582367Smsmith    ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
406209746Sjkim        "Pci-Config %u (%u) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
40783174Smsmith        Function, BitWidth, PciId->Segment, PciId->Bus, PciId->Device,
40880062Smsmith        PciId->Function, PciRegister));
40967754Smsmith
41067754Smsmith    switch (Function)
41167754Smsmith    {
41287031Smsmith    case ACPI_READ:
41367754Smsmith
41480062Smsmith        *Value = 0;
415151937Sjkim        Status = AcpiOsReadPciConfiguration (PciId, PciRegister,
416151937Sjkim                    Value, BitWidth);
41767754Smsmith        break;
41867754Smsmith
41987031Smsmith    case ACPI_WRITE:
42067754Smsmith
421151937Sjkim        Status = AcpiOsWritePciConfiguration (PciId, PciRegister,
422151937Sjkim                    *Value, BitWidth);
42367754Smsmith        break;
42467754Smsmith
42567754Smsmith    default:
42667754Smsmith
42767754Smsmith        Status = AE_BAD_PARAMETER;
42867754Smsmith        break;
42967754Smsmith    }
43067754Smsmith
43167754Smsmith    return_ACPI_STATUS (Status);
43267754Smsmith}
43367754Smsmith
43484491Smsmith
43584491Smsmith/*******************************************************************************
43684491Smsmith *
43784491Smsmith * FUNCTION:    AcpiExCmosSpaceHandler
43884491Smsmith *
43984491Smsmith * PARAMETERS:  Function            - Read or Write operation
44084491Smsmith *              Address             - Where in the space to read or write
44184491Smsmith *              BitWidth            - Field width in bits (8, 16, or 32)
44284491Smsmith *              Value               - Pointer to in or out value
44384491Smsmith *              HandlerContext      - Pointer to Handler's context
44484491Smsmith *              RegionContext       - Pointer to context specific to the
44584491Smsmith *                                    accessed region
44684491Smsmith *
44784491Smsmith * RETURN:      Status
44884491Smsmith *
44984491Smsmith * DESCRIPTION: Handler for the CMOS address space (Op Region)
45084491Smsmith *
45184491Smsmith ******************************************************************************/
45284491Smsmith
45384491SmsmithACPI_STATUS
45484491SmsmithAcpiExCmosSpaceHandler (
45584491Smsmith    UINT32                  Function,
45684491Smsmith    ACPI_PHYSICAL_ADDRESS   Address,
45784491Smsmith    UINT32                  BitWidth,
458202771Sjkim    UINT64                  *Value,
45984491Smsmith    void                    *HandlerContext,
46084491Smsmith    void                    *RegionContext)
46184491Smsmith{
46284491Smsmith    ACPI_STATUS             Status = AE_OK;
46384491Smsmith
46484491Smsmith
465167802Sjkim    ACPI_FUNCTION_TRACE (ExCmosSpaceHandler);
46684491Smsmith
46784491Smsmith
46884491Smsmith    return_ACPI_STATUS (Status);
46984491Smsmith}
47084491Smsmith
47184491Smsmith
47284491Smsmith/*******************************************************************************
47384491Smsmith *
47484491Smsmith * FUNCTION:    AcpiExPciBarSpaceHandler
47584491Smsmith *
47684491Smsmith * PARAMETERS:  Function            - Read or Write operation
47784491Smsmith *              Address             - Where in the space to read or write
47884491Smsmith *              BitWidth            - Field width in bits (8, 16, or 32)
47984491Smsmith *              Value               - Pointer to in or out value
48084491Smsmith *              HandlerContext      - Pointer to Handler's context
48184491Smsmith *              RegionContext       - Pointer to context specific to the
48284491Smsmith *                                    accessed region
48384491Smsmith *
48484491Smsmith * RETURN:      Status
48584491Smsmith *
48684491Smsmith * DESCRIPTION: Handler for the PCI BarTarget address space (Op Region)
48784491Smsmith *
48884491Smsmith ******************************************************************************/
48984491Smsmith
49084491SmsmithACPI_STATUS
49184491SmsmithAcpiExPciBarSpaceHandler (
49284491Smsmith    UINT32                  Function,
49384491Smsmith    ACPI_PHYSICAL_ADDRESS   Address,
49484491Smsmith    UINT32                  BitWidth,
495202771Sjkim    UINT64                  *Value,
49684491Smsmith    void                    *HandlerContext,
49784491Smsmith    void                    *RegionContext)
49884491Smsmith{
49984491Smsmith    ACPI_STATUS             Status = AE_OK;
50084491Smsmith
50184491Smsmith
502167802Sjkim    ACPI_FUNCTION_TRACE (ExPciBarSpaceHandler);
50384491Smsmith
50484491Smsmith
50584491Smsmith    return_ACPI_STATUS (Status);
50684491Smsmith}
50784491Smsmith
50891116Smsmith
50991116Smsmith/*******************************************************************************
51091116Smsmith *
51191116Smsmith * FUNCTION:    AcpiExDataTableSpaceHandler
51291116Smsmith *
51391116Smsmith * PARAMETERS:  Function            - Read or Write operation
51491116Smsmith *              Address             - Where in the space to read or write
51591116Smsmith *              BitWidth            - Field width in bits (8, 16, or 32)
51691116Smsmith *              Value               - Pointer to in or out value
51791116Smsmith *              HandlerContext      - Pointer to Handler's context
51891116Smsmith *              RegionContext       - Pointer to context specific to the
51991116Smsmith *                                    accessed region
52091116Smsmith *
52191116Smsmith * RETURN:      Status
52291116Smsmith *
52391116Smsmith * DESCRIPTION: Handler for the Data Table address space (Op Region)
52491116Smsmith *
52591116Smsmith ******************************************************************************/
52691116Smsmith
52791116SmsmithACPI_STATUS
52891116SmsmithAcpiExDataTableSpaceHandler (
52991116Smsmith    UINT32                  Function,
53091116Smsmith    ACPI_PHYSICAL_ADDRESS   Address,
53191116Smsmith    UINT32                  BitWidth,
532202771Sjkim    UINT64                  *Value,
53391116Smsmith    void                    *HandlerContext,
53491116Smsmith    void                    *RegionContext)
53591116Smsmith{
536167802Sjkim    ACPI_FUNCTION_TRACE (ExDataTableSpaceHandler);
53791116Smsmith
53891116Smsmith
539206117Sjkim    /*
540206117Sjkim     * Perform the memory read or write. The BitWidth was already
541206117Sjkim     * validated.
542206117Sjkim     */
54391116Smsmith    switch (Function)
54491116Smsmith    {
54591116Smsmith    case ACPI_READ:
54691116Smsmith
547167802Sjkim        ACPI_MEMCPY (ACPI_CAST_PTR (char, Value), ACPI_PHYSADDR_TO_PTR (Address),
548167802Sjkim            ACPI_DIV_8 (BitWidth));
54991116Smsmith        break;
55091116Smsmith
55191116Smsmith    case ACPI_WRITE:
552206117Sjkim
553206117Sjkim        ACPI_MEMCPY (ACPI_PHYSADDR_TO_PTR (Address), ACPI_CAST_PTR (char, Value),
554206117Sjkim            ACPI_DIV_8 (BitWidth));
555206117Sjkim        break;
556206117Sjkim
55799679Siwasaki    default:
55891116Smsmith
559206117Sjkim        return_ACPI_STATUS (AE_BAD_PARAMETER);
56091116Smsmith    }
56191116Smsmith
562167802Sjkim    return_ACPI_STATUS (AE_OK);
56391116Smsmith}
56491116Smsmith
56591116Smsmith
566