/******************************************************************************
*
* Module Name: exregion - ACPI default OpRegion (address space) handlers
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
ACPI_MODULE_NAME ("exregion")
/*******************************************************************************
*
* FUNCTION: AcpiExSystemMemorySpaceHandler
*
* PARAMETERS: Function - Read or Write operation
* Address - Where in the space to read or write
* BitWidth - Field width in bits (8, 16, or 32)
* Value - Pointer to in or out value
* HandlerContext - Pointer to Handler's context
* RegionContext - Pointer to context specific to the
* accessed region
*
* RETURN: Status
*
* DESCRIPTION: Handler for the System Memory address space (Op Region)
*
******************************************************************************/
void *HandlerContext,
void *RegionContext)
{
#endif
/* Validate and translate the bit width */
switch (BitWidth)
{
case 8:
Length = 1;
break;
case 16:
Length = 2;
break;
case 32:
Length = 4;
break;
case 64:
Length = 8;
break;
default:
BitWidth));
}
/*
* Hardware does not support non-aligned data transfers, we must verify
* the request.
*/
if (Remainder != 0)
{
}
#endif
/*
* Does the request fit into the cached memory mapping?
* Is 1) Address below the current mapping? OR
* 2) Address beyond the current mapping?
*/
((UINT64)
{
/*
* The request cannot be resolved by the current memory mapping;
* Delete the existing mapping and create a new one.
*/
if (MemInfo->MappedLength)
{
/* Valid mapping, delete it */
}
/*
* October 2009: Attempt to map from the requested address to the
* end of the region. However, we will never map more than one
* page, nor will we cross a page boundary.
*/
/*
* If mapping the entire remaining portion of the region will cross
* a page boundary, just map up to the page boundary, do not cross.
* On some systems, crossing a page boundary while mapping regions
* can cause warnings if the pages have different attributes
* due to resource management.
*
* This has the added benefit of constraining a single mapping to
* one page, which is similar to the original code that used a 4k
* maximum window.
*/
if (PageBoundaryMapLength == 0)
{
}
if (MapLength > PageBoundaryMapLength)
{
}
/* Create a new mapping starting at the address given */
if (!MemInfo->MappedLogicalAddress)
{
"Could not map memory at 0x%8.8X%8.8X, size %u",
MemInfo->MappedLength = 0;
}
/* Save the physical address and mapping size */
}
/*
* Generate a logical pointer corresponding to the address we want to
* access
*/
"System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n",
/*
* Perform the memory read or write
*
* Note: For machines that do not support non-aligned transfers, the target
* address was checked for alignment above. We do not attempt to break the
* transfer up into smaller (byte-size) chunks because the AML specifically
* asked for a transfer width that the hardware may require.
*/
switch (Function)
{
case ACPI_READ:
*Value = 0;
switch (BitWidth)
{
case 8:
break;
case 16:
break;
case 32:
break;
case 64:
break;
default:
/* BitWidth was already validated */
break;
}
break;
case ACPI_WRITE:
switch (BitWidth)
{
case 8:
break;
case 16:
break;
case 32:
break;
case 64:
break;
default:
/* BitWidth was already validated */
break;
}
break;
default:
break;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiExSystemIoSpaceHandler
*
* PARAMETERS: Function - Read or Write operation
* Address - Where in the space to read or write
* BitWidth - Field width in bits (8, 16, or 32)
* Value - Pointer to in or out value
* HandlerContext - Pointer to Handler's context
* RegionContext - Pointer to context specific to the
* accessed region
*
* RETURN: Status
*
* DESCRIPTION: Handler for the System IO address space (Op Region)
*
******************************************************************************/
void *HandlerContext,
void *RegionContext)
{
"System-IO (width %u) R/W %u Address=%8.8X%8.8X\n",
/* Decode the function parameter */
switch (Function)
{
case ACPI_READ:
break;
case ACPI_WRITE:
break;
default:
break;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiExPciConfigSpaceHandler
*
* PARAMETERS: Function - Read or Write operation
* Address - Where in the space to read or write
* BitWidth - Field width in bits (8, 16, or 32)
* Value - Pointer to in or out value
* HandlerContext - Pointer to Handler's context
* RegionContext - Pointer to context specific to the
* accessed region
*
* RETURN: Status
*
* DESCRIPTION: Handler for the PCI Config address space (Op Region)
*
******************************************************************************/
void *HandlerContext,
void *RegionContext)
{
/*
* The arguments to AcpiOs(Read|Write)PciConfiguration are:
*
* PciSegment is the PCI bus segment range 0-31
* PciBus is the PCI bus number range 0-255
* PciDevice is the PCI device number range 0-31
* PciFunction is the PCI device function number
* PciRegister is the Config space register range 0-255 bytes
*
* Value - input value for write, output address for read
*
*/
"Pci-Config %u (%u) Seg(%04x) Bus(%04x) "
"Dev(%04x) Func(%04x) Reg(%04x)\n",
switch (Function)
{
case ACPI_READ:
*Value = 0;
break;
case ACPI_WRITE:
break;
default:
break;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiExCmosSpaceHandler
*
* PARAMETERS: Function - Read or Write operation
* Address - Where in the space to read or write
* BitWidth - Field width in bits (8, 16, or 32)
* Value - Pointer to in or out value
* HandlerContext - Pointer to Handler's context
* RegionContext - Pointer to context specific to the
* accessed region
*
* RETURN: Status
*
* DESCRIPTION: Handler for the CMOS address space (Op Region)
*
******************************************************************************/
void *HandlerContext,
void *RegionContext)
{
}
/*******************************************************************************
*
* FUNCTION: AcpiExPciBarSpaceHandler
*
* PARAMETERS: Function - Read or Write operation
* Address - Where in the space to read or write
* BitWidth - Field width in bits (8, 16, or 32)
* Value - Pointer to in or out value
* HandlerContext - Pointer to Handler's context
* RegionContext - Pointer to context specific to the
* accessed region
*
* RETURN: Status
*
* DESCRIPTION: Handler for the PCI BarTarget address space (Op Region)
*
******************************************************************************/
void *HandlerContext,
void *RegionContext)
{
}
/*******************************************************************************
*
* FUNCTION: AcpiExDataTableSpaceHandler
*
* PARAMETERS: Function - Read or Write operation
* Address - Where in the space to read or write
* BitWidth - Field width in bits (8, 16, or 32)
* Value - Pointer to in or out value
* HandlerContext - Pointer to Handler's context
* RegionContext - Pointer to context specific to the
* accessed region
*
* RETURN: Status
*
* DESCRIPTION: Handler for the Data Table address space (Op Region)
*
******************************************************************************/
void *HandlerContext,
void *RegionContext)
{
/*
* Perform the memory read or write. The BitWidth was already
* validated.
*/
switch (Function)
{
case ACPI_READ:
ACPI_DIV_8 (BitWidth));
break;
case ACPI_WRITE:
ACPI_DIV_8 (BitWidth));
break;
default:
}
}