/*******************************************************************************
*
* Module Name: rsmisc - Miscellaneous resource descriptors
*
******************************************************************************/
/*
* 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 "acresrc.h"
ACPI_MODULE_NAME ("rsmisc")
/*******************************************************************************
*
* FUNCTION: AcpiRsConvertAmlToResource
*
* PARAMETERS: Resource - Pointer to the resource descriptor
* Aml - Where the AML descriptor is returned
* Info - Pointer to appropriate conversion table
*
* RETURN: Status
*
* DESCRIPTION: Convert an external AML resource descriptor to the corresponding
* internal resource descriptor
*
******************************************************************************/
{
void *Source;
void *Destination;
char *Target;
if (!Info)
{
}
{
/* Each internal resource struct is expected to be 32-bit aligned */
"Misaligned resource pointer (get): %p Type 0x%2.2X Length %u",
}
/* Extract the resource Length field (does not include header length) */
/*
* First table entry must be ACPI_RSC_INITxxx and must contain the
* table length (# of table entries)
*/
while (Count)
{
/*
* Source is the external AML byte stream buffer,
* destination is the internal resource descriptor
*/
{
case ACPI_RSC_INITGET:
/*
* Get the resource type and the initial (minimum) length
*/
break;
case ACPI_RSC_INITSET:
break;
case ACPI_RSC_FLAGINIT:
break;
case ACPI_RSC_1BITFLAG:
/*
* Mask and shift the flag bit
*/
break;
case ACPI_RSC_2BITFLAG:
/*
* Mask and shift the flag bits
*/
break;
case ACPI_RSC_3BITFLAG:
/*
* Mask and shift the flag bits
*/
break;
case ACPI_RSC_COUNT:
break;
case ACPI_RSC_COUNT16:
break;
case ACPI_RSC_COUNT_GPIO_PIN:
break;
case ACPI_RSC_COUNT_GPIO_VEN:
break;
case ACPI_RSC_COUNT_GPIO_RES:
/*
* Examine vendor data length field first
*/
if (ACPI_GET16 (Target))
{
/* Use vendor offset to get resource source length */
}
else
{
/* No vendor data to worry about */
sizeof (AML_RESOURCE_LARGE_HEADER) -
ACPI_GET16 (Source);
}
break;
break;
sizeof (AML_RESOURCE_LARGE_HEADER)) -
break;
case ACPI_RSC_LENGTH:
break;
case ACPI_RSC_MOVE8:
case ACPI_RSC_MOVE16:
case ACPI_RSC_MOVE32:
case ACPI_RSC_MOVE64:
/*
* Raw data move. Use the Info value field unless ItemCount has
* been previously initialized via a COUNT opcode
*/
{
}
break;
case ACPI_RSC_MOVE_GPIO_PIN:
/* Generate and set the PIN data pointer */
/* Copy the PIN data */
break;
case ACPI_RSC_MOVE_GPIO_RES:
/* Generate and set the ResourceSource string pointer */
/* Copy the ResourceSource string */
break;
case ACPI_RSC_MOVE_SERIAL_VEN:
/* Generate and set the Vendor Data pointer */
/* Copy the Vendor Data */
break;
case ACPI_RSC_MOVE_SERIAL_RES:
/* Generate and set the ResourceSource string pointer */
/* Copy the ResourceSource string */
Source = ACPI_ADD_PTR (
break;
case ACPI_RSC_SET8:
break;
case ACPI_RSC_DATA8:
break;
case ACPI_RSC_ADDRESS:
/*
* Common handler for address descriptor flags
*/
{
}
break;
case ACPI_RSC_SOURCE:
/*
* Optional ResourceSource (Index and String)
*/
break;
case ACPI_RSC_SOURCEX:
/*
* Optional ResourceSource (Index and String). This is the more
* complicated case used by the Interrupt() macro
*/
break;
case ACPI_RSC_BITMASK:
/*
* 8-bit encoded bitmask (DMA macro)
*/
if (ItemCount)
{
}
break;
case ACPI_RSC_BITMASK16:
/*
* 16-bit encoded bitmask (IRQ macro)
*/
if (ItemCount)
{
}
break;
case ACPI_RSC_EXIT_NE:
/*
* Control - Exit conversion if not equal
*/
switch (Info->ResourceOffset)
{
{
goto Exit;
}
break;
case ACPI_RSC_COMPARE_VALUE:
{
goto Exit;
}
break;
default:
}
break;
default:
}
Count--;
Info++;
}
Exit:
if (!FlagsMode)
{
/* Round the resource struct length up to the next boundary (32 or 64) */
}
}
/*******************************************************************************
*
* FUNCTION: AcpiRsConvertResourceToAml
*
* PARAMETERS: Resource - Pointer to the resource descriptor
* Aml - Where the AML descriptor is returned
* Info - Pointer to appropriate conversion table
*
* RETURN: Status
*
* DESCRIPTION: Convert an internal resource descriptor to the corresponding
* external AML resource descriptor.
*
******************************************************************************/
{
void *Destination;
char *Target;
if (!Info)
{
}
/*
* First table entry must be ACPI_RSC_INITxxx and must contain the
* table length (# of table entries)
*/
while (Count)
{
/*
* Source is the internal resource descriptor,
* destination is the external AML byte stream buffer
*/
{
case ACPI_RSC_INITSET:
break;
case ACPI_RSC_INITGET:
break;
case ACPI_RSC_FLAGINIT:
/*
* Clear the flag byte
*/
ACPI_SET8 (Destination, 0);
break;
case ACPI_RSC_1BITFLAG:
/*
* Mask and shift the flag bit
*/
break;
case ACPI_RSC_2BITFLAG:
/*
* Mask and shift the flag bits
*/
break;
case ACPI_RSC_3BITFLAG:
/*
* Mask and shift the flag bits
*/
break;
case ACPI_RSC_COUNT:
break;
case ACPI_RSC_COUNT16:
break;
case ACPI_RSC_COUNT_GPIO_PIN:
break;
case ACPI_RSC_COUNT_GPIO_VEN:
break;
case ACPI_RSC_COUNT_GPIO_RES:
/* Set resource source string length */
/* Compute offset for the Vendor Data */
/* Set vendor offset only if there is vendor data */
{
}
break;
break;
break;
case ACPI_RSC_LENGTH:
break;
case ACPI_RSC_MOVE8:
case ACPI_RSC_MOVE16:
case ACPI_RSC_MOVE32:
case ACPI_RSC_MOVE64:
{
}
break;
case ACPI_RSC_MOVE_GPIO_PIN:
break;
case ACPI_RSC_MOVE_GPIO_RES:
/* Used for both ResourceSource string and VendorData */
break;
case ACPI_RSC_MOVE_SERIAL_VEN:
break;
case ACPI_RSC_MOVE_SERIAL_RES:
break;
case ACPI_RSC_ADDRESS:
/* Set the Resource Type, General Flags, and Type-Specific Flags */
break;
case ACPI_RSC_SOURCEX:
/*
* Optional ResourceSource (Index and String)
*/
break;
case ACPI_RSC_SOURCE:
/*
* Optional ResourceSource (Index and String). This is the more
* complicated case used by the Interrupt() macro
*/
break;
case ACPI_RSC_BITMASK:
/*
* 8-bit encoded bitmask (DMA macro)
*/
break;
case ACPI_RSC_BITMASK16:
/*
* 16-bit encoded bitmask (IRQ macro)
*/
break;
case ACPI_RSC_EXIT_LE:
/*
* Control - Exit conversion if less than or equal
*/
{
goto Exit;
}
break;
case ACPI_RSC_EXIT_NE:
/*
* Control - Exit conversion if not equal
*/
switch (COMPARE_OPCODE (Info))
{
case ACPI_RSC_COMPARE_VALUE:
{
goto Exit;
}
break;
default:
}
break;
case ACPI_RSC_EXIT_EQ:
/*
* Control - Exit conversion if equal
*/
{
goto Exit;
}
break;
default:
}
Count--;
Info++;
}
Exit:
}
#if 0
/* Previous resource validations */
{
}
{
}
{
/*
* Only [ActiveHigh, EdgeSensitive] or [ActiveLow, LevelSensitive]
* "IRQ Format"), so 0x00 and 0x09 are illegal.
*/
}
if (Temp8 < 1)
{
/* Must have at least one IRQ */
}
{
"Invalid DMA.Transfer preference (3)"));
}
#endif