2005-04-17 05:20:36 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: rsmisc - Miscellaneous resource descriptors
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2015-02-05 14:20:45 +07:00
|
|
|
* Copyright (C) 2000 - 2015, Intel Corp.
|
2005-04-17 05:20:36 +07:00
|
|
|
* 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/acpi.h>
|
2009-01-09 12:30:03 +07:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "acresrc.h"
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_RESOURCES
|
2005-08-05 11:44:28 +07:00
|
|
|
ACPI_MODULE_NAME("rsmisc")
|
2005-10-21 11:00:00 +07:00
|
|
|
#define INIT_RESOURCE_TYPE(i) i->resource_offset
|
|
|
|
#define INIT_RESOURCE_LENGTH(i) i->aml_offset
|
|
|
|
#define INIT_TABLE_LENGTH(i) i->value
|
|
|
|
#define COMPARE_OPCODE(i) i->resource_offset
|
|
|
|
#define COMPARE_TARGET(i) i->aml_offset
|
|
|
|
#define COMPARE_VALUE(i) i->value
|
2005-09-17 03:51:15 +07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
2005-10-21 11:00:00 +07:00
|
|
|
* FUNCTION: acpi_rs_convert_aml_to_resource
|
2005-09-17 03:51:15 +07:00
|
|
|
*
|
2012-07-12 08:40:10 +07:00
|
|
|
* PARAMETERS: resource - Pointer to the resource descriptor
|
|
|
|
* aml - Where the AML descriptor is returned
|
|
|
|
* info - Pointer to appropriate conversion table
|
2005-09-17 03:51:15 +07:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2005-10-21 11:00:00 +07:00
|
|
|
* DESCRIPTION: Convert an external AML resource descriptor to the corresponding
|
|
|
|
* internal resource descriptor
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
acpi_status
|
2005-10-21 11:00:00 +07:00
|
|
|
acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
|
|
|
|
union aml_resource *aml,
|
|
|
|
struct acpi_rsconvert_info *info)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-10-21 11:00:00 +07:00
|
|
|
acpi_rs_length aml_resource_length;
|
|
|
|
void *source;
|
|
|
|
void *destination;
|
|
|
|
char *target;
|
|
|
|
u8 count;
|
|
|
|
u8 flags_mode = FALSE;
|
|
|
|
u16 item_count = 0;
|
|
|
|
u16 temp16 = 0;
|
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(rs_convert_aml_to_resource);
|
2005-10-21 11:00:00 +07:00
|
|
|
|
2011-11-16 13:38:13 +07:00
|
|
|
if (!info) {
|
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
|
|
}
|
|
|
|
|
2008-06-10 12:42:13 +07:00
|
|
|
if (((acpi_size) resource) & 0x3) {
|
2006-10-02 11:00:00 +07:00
|
|
|
|
2006-01-28 04:43:00 +07:00
|
|
|
/* Each internal resource struct is expected to be 32-bit aligned */
|
|
|
|
|
|
|
|
ACPI_WARNING((AE_INFO,
|
2010-03-05 16:56:40 +07:00
|
|
|
"Misaligned resource pointer (get): %p Type 0x%2.2X Length %u",
|
2006-01-28 04:43:00 +07:00
|
|
|
resource, resource->type, resource->length));
|
2005-10-21 11:00:00 +07:00
|
|
|
}
|
2005-04-19 09:49:35 +07:00
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
/* Extract the resource Length field (does not include header length) */
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
aml_resource_length = acpi_ut_get_resource_length(aml);
|
2005-04-19 09:49:35 +07:00
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
/*
|
|
|
|
* First table entry must be ACPI_RSC_INITxxx and must contain the
|
|
|
|
* table length (# of table entries)
|
|
|
|
*/
|
|
|
|
count = INIT_TABLE_LENGTH(info);
|
|
|
|
while (count) {
|
|
|
|
/*
|
|
|
|
* Source is the external AML byte stream buffer,
|
|
|
|
* destination is the internal resource descriptor
|
|
|
|
*/
|
2005-11-18 01:07:00 +07:00
|
|
|
source = ACPI_ADD_PTR(void, aml, info->aml_offset);
|
|
|
|
destination =
|
|
|
|
ACPI_ADD_PTR(void, resource, info->resource_offset);
|
2005-10-21 11:00:00 +07:00
|
|
|
|
|
|
|
switch (info->opcode) {
|
|
|
|
case ACPI_RSC_INITGET:
|
|
|
|
/*
|
|
|
|
* Get the resource type and the initial (minimum) length
|
|
|
|
*/
|
2015-07-01 13:45:11 +07:00
|
|
|
memset(resource, 0, INIT_RESOURCE_LENGTH(info));
|
2005-10-21 11:00:00 +07:00
|
|
|
resource->type = INIT_RESOURCE_TYPE(info);
|
|
|
|
resource->length = INIT_RESOURCE_LENGTH(info);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_INITSET:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_FLAGINIT:
|
|
|
|
|
|
|
|
flags_mode = TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_1BITFLAG:
|
|
|
|
/*
|
|
|
|
* Mask and shift the flag bit
|
|
|
|
*/
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET8(destination,
|
|
|
|
((ACPI_GET8(source) >> info->value) & 0x01));
|
2005-10-21 11:00:00 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_2BITFLAG:
|
|
|
|
/*
|
|
|
|
* Mask and shift the flag bits
|
|
|
|
*/
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET8(destination,
|
|
|
|
((ACPI_GET8(source) >> info->value) & 0x03));
|
2005-10-21 11:00:00 +07:00
|
|
|
break;
|
|
|
|
|
2011-11-16 13:38:13 +07:00
|
|
|
case ACPI_RSC_3BITFLAG:
|
|
|
|
/*
|
|
|
|
* Mask and shift the flag bits
|
|
|
|
*/
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET8(destination,
|
|
|
|
((ACPI_GET8(source) >> info->value) & 0x07));
|
2011-11-16 13:38:13 +07:00
|
|
|
break;
|
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
case ACPI_RSC_COUNT:
|
|
|
|
|
2005-11-18 01:07:00 +07:00
|
|
|
item_count = ACPI_GET8(source);
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET8(destination, item_count);
|
2005-10-21 11:00:00 +07:00
|
|
|
|
|
|
|
resource->length = resource->length +
|
|
|
|
(info->value * (item_count - 1));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_COUNT16:
|
|
|
|
|
|
|
|
item_count = aml_resource_length;
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET16(destination, item_count);
|
2005-10-21 11:00:00 +07:00
|
|
|
|
|
|
|
resource->length = resource->length +
|
|
|
|
(info->value * (item_count - 1));
|
|
|
|
break;
|
|
|
|
|
2011-11-16 13:38:13 +07:00
|
|
|
case ACPI_RSC_COUNT_GPIO_PIN:
|
|
|
|
|
|
|
|
target = ACPI_ADD_PTR(void, aml, info->value);
|
|
|
|
item_count = ACPI_GET16(target) - ACPI_GET16(source);
|
|
|
|
|
|
|
|
resource->length = resource->length + item_count;
|
|
|
|
item_count = item_count / 2;
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET16(destination, item_count);
|
2011-11-16 13:38:13 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_COUNT_GPIO_VEN:
|
|
|
|
|
|
|
|
item_count = ACPI_GET8(source);
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET8(destination, item_count);
|
2011-11-16 13:38:13 +07:00
|
|
|
|
|
|
|
resource->length = resource->length +
|
|
|
|
(info->value * item_count);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_COUNT_GPIO_RES:
|
|
|
|
/*
|
|
|
|
* Vendor data is optional (length/offset may both be zero)
|
|
|
|
* Examine vendor data length field first
|
|
|
|
*/
|
|
|
|
target = ACPI_ADD_PTR(void, aml, (info->value + 2));
|
|
|
|
if (ACPI_GET16(target)) {
|
|
|
|
|
|
|
|
/* Use vendor offset to get resource source length */
|
|
|
|
|
|
|
|
target = ACPI_ADD_PTR(void, aml, info->value);
|
|
|
|
item_count =
|
|
|
|
ACPI_GET16(target) - ACPI_GET16(source);
|
|
|
|
} else {
|
|
|
|
/* No vendor data to worry about */
|
|
|
|
|
|
|
|
item_count = aml->large_header.resource_length +
|
|
|
|
sizeof(struct aml_resource_large_header) -
|
|
|
|
ACPI_GET16(source);
|
|
|
|
}
|
|
|
|
|
|
|
|
resource->length = resource->length + item_count;
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET16(destination, item_count);
|
2011-11-16 13:38:13 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_COUNT_SERIAL_VEN:
|
|
|
|
|
|
|
|
item_count = ACPI_GET16(source) - info->value;
|
|
|
|
|
|
|
|
resource->length = resource->length + item_count;
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET16(destination, item_count);
|
2011-11-16 13:38:13 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_COUNT_SERIAL_RES:
|
|
|
|
|
|
|
|
item_count = (aml_resource_length +
|
|
|
|
sizeof(struct aml_resource_large_header))
|
|
|
|
- ACPI_GET16(source) - info->value;
|
|
|
|
|
|
|
|
resource->length = resource->length + item_count;
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET16(destination, item_count);
|
2011-11-16 13:38:13 +07:00
|
|
|
break;
|
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
case ACPI_RSC_LENGTH:
|
|
|
|
|
|
|
|
resource->length = resource->length + info->value;
|
|
|
|
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 item_count has
|
|
|
|
* been previously initialized via a COUNT opcode
|
|
|
|
*/
|
|
|
|
if (info->value) {
|
|
|
|
item_count = info->value;
|
|
|
|
}
|
|
|
|
acpi_rs_move_data(destination, source, item_count,
|
|
|
|
info->opcode);
|
|
|
|
break;
|
|
|
|
|
2011-11-16 13:38:13 +07:00
|
|
|
case ACPI_RSC_MOVE_GPIO_PIN:
|
|
|
|
|
|
|
|
/* Generate and set the PIN data pointer */
|
|
|
|
|
|
|
|
target = (char *)ACPI_ADD_PTR(void, resource,
|
|
|
|
(resource->length -
|
|
|
|
item_count * 2));
|
|
|
|
*(u16 **)destination = ACPI_CAST_PTR(u16, target);
|
|
|
|
|
|
|
|
/* Copy the PIN data */
|
|
|
|
|
|
|
|
source = ACPI_ADD_PTR(void, aml, ACPI_GET16(source));
|
|
|
|
acpi_rs_move_data(target, source, item_count,
|
|
|
|
info->opcode);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_MOVE_GPIO_RES:
|
|
|
|
|
|
|
|
/* Generate and set the resource_source string pointer */
|
|
|
|
|
|
|
|
target = (char *)ACPI_ADD_PTR(void, resource,
|
|
|
|
(resource->length -
|
|
|
|
item_count));
|
|
|
|
*(u8 **)destination = ACPI_CAST_PTR(u8, target);
|
|
|
|
|
|
|
|
/* Copy the resource_source string */
|
|
|
|
|
|
|
|
source = ACPI_ADD_PTR(void, aml, ACPI_GET16(source));
|
|
|
|
acpi_rs_move_data(target, source, item_count,
|
|
|
|
info->opcode);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_MOVE_SERIAL_VEN:
|
|
|
|
|
|
|
|
/* Generate and set the Vendor Data pointer */
|
|
|
|
|
|
|
|
target = (char *)ACPI_ADD_PTR(void, resource,
|
|
|
|
(resource->length -
|
|
|
|
item_count));
|
|
|
|
*(u8 **)destination = ACPI_CAST_PTR(u8, target);
|
|
|
|
|
|
|
|
/* Copy the Vendor Data */
|
|
|
|
|
|
|
|
source = ACPI_ADD_PTR(void, aml, info->value);
|
|
|
|
acpi_rs_move_data(target, source, item_count,
|
|
|
|
info->opcode);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_MOVE_SERIAL_RES:
|
|
|
|
|
|
|
|
/* Generate and set the resource_source string pointer */
|
|
|
|
|
|
|
|
target = (char *)ACPI_ADD_PTR(void, resource,
|
|
|
|
(resource->length -
|
|
|
|
item_count));
|
|
|
|
*(u8 **)destination = ACPI_CAST_PTR(u8, target);
|
|
|
|
|
|
|
|
/* Copy the resource_source string */
|
|
|
|
|
|
|
|
source =
|
|
|
|
ACPI_ADD_PTR(void, aml,
|
|
|
|
(ACPI_GET16(source) + info->value));
|
|
|
|
acpi_rs_move_data(target, source, item_count,
|
|
|
|
info->opcode);
|
|
|
|
break;
|
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
case ACPI_RSC_SET8:
|
|
|
|
|
2015-07-01 13:45:11 +07:00
|
|
|
memset(destination, info->aml_offset, info->value);
|
2005-10-21 11:00:00 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_DATA8:
|
|
|
|
|
2005-11-18 01:07:00 +07:00
|
|
|
target = ACPI_ADD_PTR(char, resource, info->value);
|
2015-07-01 13:45:11 +07:00
|
|
|
memcpy(destination, source, ACPI_GET16(target));
|
2005-10-21 11:00:00 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_ADDRESS:
|
|
|
|
/*
|
|
|
|
* Common handler for address descriptor flags
|
|
|
|
*/
|
|
|
|
if (!acpi_rs_get_address_common(resource, aml)) {
|
|
|
|
return_ACPI_STATUS
|
|
|
|
(AE_AML_INVALID_RESOURCE_TYPE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_SOURCE:
|
|
|
|
/*
|
|
|
|
* Optional resource_source (Index and String)
|
|
|
|
*/
|
|
|
|
resource->length +=
|
|
|
|
acpi_rs_get_resource_source(aml_resource_length,
|
|
|
|
info->value,
|
|
|
|
destination, aml, NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_SOURCEX:
|
|
|
|
/*
|
|
|
|
* Optional resource_source (Index and String). This is the more
|
|
|
|
* complicated case used by the Interrupt() macro
|
|
|
|
*/
|
2011-11-16 13:38:13 +07:00
|
|
|
target = ACPI_ADD_PTR(char, resource,
|
|
|
|
info->aml_offset +
|
|
|
|
(item_count * 4));
|
2005-10-21 11:00:00 +07:00
|
|
|
|
|
|
|
resource->length +=
|
|
|
|
acpi_rs_get_resource_source(aml_resource_length,
|
2011-11-16 13:38:13 +07:00
|
|
|
(acpi_rs_length)
|
|
|
|
(((item_count -
|
|
|
|
1) * sizeof(u32)) +
|
|
|
|
info->value),
|
|
|
|
destination, aml,
|
|
|
|
target);
|
2005-10-21 11:00:00 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_BITMASK:
|
|
|
|
/*
|
|
|
|
* 8-bit encoded bitmask (DMA macro)
|
|
|
|
*/
|
|
|
|
item_count =
|
2005-11-18 01:07:00 +07:00
|
|
|
acpi_rs_decode_bitmask(ACPI_GET8(source),
|
2005-10-21 11:00:00 +07:00
|
|
|
destination);
|
|
|
|
if (item_count) {
|
2005-11-18 01:07:00 +07:00
|
|
|
resource->length += (item_count - 1);
|
2005-10-21 11:00:00 +07:00
|
|
|
}
|
|
|
|
|
2005-11-18 01:07:00 +07:00
|
|
|
target = ACPI_ADD_PTR(char, resource, info->value);
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET8(target, item_count);
|
2005-10-21 11:00:00 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_BITMASK16:
|
|
|
|
/*
|
|
|
|
* 16-bit encoded bitmask (IRQ macro)
|
|
|
|
*/
|
|
|
|
ACPI_MOVE_16_TO_16(&temp16, source);
|
|
|
|
|
|
|
|
item_count =
|
|
|
|
acpi_rs_decode_bitmask(temp16, destination);
|
|
|
|
if (item_count) {
|
2005-11-18 01:07:00 +07:00
|
|
|
resource->length += (item_count - 1);
|
2005-10-21 11:00:00 +07:00
|
|
|
}
|
|
|
|
|
2005-11-18 01:07:00 +07:00
|
|
|
target = ACPI_ADD_PTR(char, resource, info->value);
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET8(target, item_count);
|
2005-10-21 11:00:00 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_EXIT_NE:
|
|
|
|
/*
|
2012-07-12 08:40:10 +07:00
|
|
|
* control - Exit conversion if not equal
|
2005-10-21 11:00:00 +07:00
|
|
|
*/
|
|
|
|
switch (info->resource_offset) {
|
|
|
|
case ACPI_RSC_COMPARE_AML_LENGTH:
|
2013-06-08 07:58:14 +07:00
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
if (aml_resource_length != info->value) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_COMPARE_VALUE:
|
2013-06-08 07:58:14 +07:00
|
|
|
|
2005-11-18 01:07:00 +07:00
|
|
|
if (ACPI_GET8(source) != info->value) {
|
2005-10-21 11:00:00 +07:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2006-01-28 04:43:00 +07:00
|
|
|
|
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Invalid conversion sub-opcode"));
|
2005-10-21 11:00:00 +07:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
2006-01-28 04:43:00 +07:00
|
|
|
ACPI_ERROR((AE_INFO, "Invalid conversion opcode"));
|
2005-10-21 11:00:00 +07:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
count--;
|
|
|
|
info++;
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-10-01 06:03:00 +07:00
|
|
|
}
|
2005-04-19 09:49:35 +07:00
|
|
|
|
2013-10-29 08:30:02 +07:00
|
|
|
exit:
|
2005-10-21 11:00:00 +07:00
|
|
|
if (!flags_mode) {
|
2006-10-02 11:00:00 +07:00
|
|
|
|
2006-02-17 12:00:00 +07:00
|
|
|
/* Round the resource struct length up to the next boundary (32 or 64) */
|
2005-04-19 09:49:35 +07:00
|
|
|
|
2006-10-02 11:00:00 +07:00
|
|
|
resource->length =
|
2006-02-17 12:00:00 +07:00
|
|
|
(u32) ACPI_ROUND_UP_TO_NATIVE_WORD(resource->length);
|
2005-10-21 11:00:00 +07:00
|
|
|
}
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
2005-10-21 11:00:00 +07:00
|
|
|
* FUNCTION: acpi_rs_convert_resource_to_aml
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
2012-07-12 08:40:10 +07:00
|
|
|
* PARAMETERS: resource - Pointer to the resource descriptor
|
|
|
|
* aml - Where the AML descriptor is returned
|
|
|
|
* info - Pointer to appropriate conversion table
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-10-01 06:03:00 +07:00
|
|
|
* DESCRIPTION: Convert an internal resource descriptor to the corresponding
|
|
|
|
* external AML resource descriptor.
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-10-21 11:00:00 +07:00
|
|
|
acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
|
|
|
|
union aml_resource *aml,
|
|
|
|
struct acpi_rsconvert_info *info)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-10-21 11:00:00 +07:00
|
|
|
void *source = NULL;
|
|
|
|
void *destination;
|
2011-11-16 13:38:13 +07:00
|
|
|
char *target;
|
2005-10-21 11:00:00 +07:00
|
|
|
acpi_rsdesc_size aml_length = 0;
|
|
|
|
u8 count;
|
|
|
|
u16 temp16 = 0;
|
|
|
|
u16 item_count = 0;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 04:15:00 +07:00
|
|
|
ACPI_FUNCTION_TRACE(rs_convert_resource_to_aml);
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-10-01 06:03:00 +07:00
|
|
|
|
2011-11-16 13:38:13 +07:00
|
|
|
if (!info) {
|
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
|
|
}
|
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
/*
|
|
|
|
* First table entry must be ACPI_RSC_INITxxx and must contain the
|
|
|
|
* table length (# of table entries)
|
|
|
|
*/
|
|
|
|
count = INIT_TABLE_LENGTH(info);
|
|
|
|
|
|
|
|
while (count) {
|
|
|
|
/*
|
|
|
|
* Source is the internal resource descriptor,
|
|
|
|
* destination is the external AML byte stream buffer
|
|
|
|
*/
|
2005-11-18 01:07:00 +07:00
|
|
|
source = ACPI_ADD_PTR(void, resource, info->resource_offset);
|
|
|
|
destination = ACPI_ADD_PTR(void, aml, info->aml_offset);
|
2005-10-21 11:00:00 +07:00
|
|
|
|
|
|
|
switch (info->opcode) {
|
|
|
|
case ACPI_RSC_INITSET:
|
|
|
|
|
2015-07-01 13:45:11 +07:00
|
|
|
memset(aml, 0, INIT_RESOURCE_LENGTH(info));
|
2005-10-21 11:00:00 +07:00
|
|
|
aml_length = INIT_RESOURCE_LENGTH(info);
|
|
|
|
acpi_rs_set_resource_header(INIT_RESOURCE_TYPE(info),
|
|
|
|
aml_length, aml);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_INITGET:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_FLAGINIT:
|
|
|
|
/*
|
|
|
|
* Clear the flag byte
|
|
|
|
*/
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET8(destination, 0);
|
2005-10-21 11:00:00 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_1BITFLAG:
|
|
|
|
/*
|
|
|
|
* Mask and shift the flag bit
|
|
|
|
*/
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
|
|
|
|
((ACPI_GET8(source) & 0x01) << info->
|
|
|
|
value));
|
2005-10-21 11:00:00 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_2BITFLAG:
|
|
|
|
/*
|
|
|
|
* Mask and shift the flag bits
|
|
|
|
*/
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
|
|
|
|
((ACPI_GET8(source) & 0x03) << info->
|
|
|
|
value));
|
2005-10-21 11:00:00 +07:00
|
|
|
break;
|
|
|
|
|
2011-11-16 13:38:13 +07:00
|
|
|
case ACPI_RSC_3BITFLAG:
|
|
|
|
/*
|
|
|
|
* Mask and shift the flag bits
|
|
|
|
*/
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
|
|
|
|
((ACPI_GET8(source) & 0x07) << info->
|
|
|
|
value));
|
2011-11-16 13:38:13 +07:00
|
|
|
break;
|
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
case ACPI_RSC_COUNT:
|
|
|
|
|
2005-11-18 01:07:00 +07:00
|
|
|
item_count = ACPI_GET8(source);
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET8(destination, item_count);
|
2005-10-21 11:00:00 +07:00
|
|
|
|
2005-11-18 01:07:00 +07:00
|
|
|
aml_length =
|
|
|
|
(u16) (aml_length +
|
|
|
|
(info->value * (item_count - 1)));
|
2005-10-21 11:00:00 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_COUNT16:
|
|
|
|
|
2005-11-18 01:07:00 +07:00
|
|
|
item_count = ACPI_GET16(source);
|
2005-10-21 11:00:00 +07:00
|
|
|
aml_length = (u16) (aml_length + item_count);
|
|
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
|
|
break;
|
|
|
|
|
2011-11-16 13:38:13 +07:00
|
|
|
case ACPI_RSC_COUNT_GPIO_PIN:
|
|
|
|
|
|
|
|
item_count = ACPI_GET16(source);
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET16(destination, aml_length);
|
2011-11-16 13:38:13 +07:00
|
|
|
|
|
|
|
aml_length = (u16)(aml_length + item_count * 2);
|
|
|
|
target = ACPI_ADD_PTR(void, aml, info->value);
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET16(target, aml_length);
|
2011-11-16 13:38:13 +07:00
|
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_COUNT_GPIO_VEN:
|
|
|
|
|
|
|
|
item_count = ACPI_GET16(source);
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET16(destination, item_count);
|
2011-11-16 13:38:13 +07:00
|
|
|
|
|
|
|
aml_length =
|
|
|
|
(u16)(aml_length + (info->value * item_count));
|
|
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_COUNT_GPIO_RES:
|
|
|
|
|
|
|
|
/* Set resource source string length */
|
|
|
|
|
|
|
|
item_count = ACPI_GET16(source);
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET16(destination, aml_length);
|
2011-11-16 13:38:13 +07:00
|
|
|
|
|
|
|
/* Compute offset for the Vendor Data */
|
|
|
|
|
|
|
|
aml_length = (u16)(aml_length + item_count);
|
|
|
|
target = ACPI_ADD_PTR(void, aml, info->value);
|
|
|
|
|
|
|
|
/* Set vendor offset only if there is vendor data */
|
|
|
|
|
|
|
|
if (resource->data.gpio.vendor_length) {
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET16(target, aml_length);
|
2011-11-16 13:38:13 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_COUNT_SERIAL_VEN:
|
|
|
|
|
|
|
|
item_count = ACPI_GET16(source);
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET16(destination, item_count + info->value);
|
2011-11-16 13:38:13 +07:00
|
|
|
aml_length = (u16)(aml_length + item_count);
|
|
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_COUNT_SERIAL_RES:
|
|
|
|
|
|
|
|
item_count = ACPI_GET16(source);
|
|
|
|
aml_length = (u16)(aml_length + item_count);
|
|
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
|
|
break;
|
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
case ACPI_RSC_LENGTH:
|
|
|
|
|
|
|
|
acpi_rs_set_resource_length(info->value, aml);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_MOVE8:
|
|
|
|
case ACPI_RSC_MOVE16:
|
|
|
|
case ACPI_RSC_MOVE32:
|
|
|
|
case ACPI_RSC_MOVE64:
|
|
|
|
|
|
|
|
if (info->value) {
|
|
|
|
item_count = info->value;
|
|
|
|
}
|
|
|
|
acpi_rs_move_data(destination, source, item_count,
|
|
|
|
info->opcode);
|
|
|
|
break;
|
|
|
|
|
2011-11-16 13:38:13 +07:00
|
|
|
case ACPI_RSC_MOVE_GPIO_PIN:
|
|
|
|
|
|
|
|
destination = (char *)ACPI_ADD_PTR(void, aml,
|
|
|
|
ACPI_GET16
|
|
|
|
(destination));
|
|
|
|
source = *(u16 **)source;
|
|
|
|
acpi_rs_move_data(destination, source, item_count,
|
|
|
|
info->opcode);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_MOVE_GPIO_RES:
|
|
|
|
|
|
|
|
/* Used for both resource_source string and vendor_data */
|
|
|
|
|
|
|
|
destination = (char *)ACPI_ADD_PTR(void, aml,
|
|
|
|
ACPI_GET16
|
|
|
|
(destination));
|
|
|
|
source = *(u8 **)source;
|
|
|
|
acpi_rs_move_data(destination, source, item_count,
|
|
|
|
info->opcode);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_MOVE_SERIAL_VEN:
|
|
|
|
|
|
|
|
destination = (char *)ACPI_ADD_PTR(void, aml,
|
|
|
|
(aml_length -
|
|
|
|
item_count));
|
|
|
|
source = *(u8 **)source;
|
|
|
|
acpi_rs_move_data(destination, source, item_count,
|
|
|
|
info->opcode);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_MOVE_SERIAL_RES:
|
|
|
|
|
|
|
|
destination = (char *)ACPI_ADD_PTR(void, aml,
|
|
|
|
(aml_length -
|
|
|
|
item_count));
|
|
|
|
source = *(u8 **)source;
|
|
|
|
acpi_rs_move_data(destination, source, item_count,
|
|
|
|
info->opcode);
|
|
|
|
break;
|
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
case ACPI_RSC_ADDRESS:
|
|
|
|
|
|
|
|
/* Set the Resource Type, General Flags, and Type-Specific Flags */
|
|
|
|
|
|
|
|
acpi_rs_set_address_common(aml, resource);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_SOURCEX:
|
|
|
|
/*
|
|
|
|
* Optional resource_source (Index and String)
|
|
|
|
*/
|
|
|
|
aml_length =
|
2012-12-19 12:37:15 +07:00
|
|
|
acpi_rs_set_resource_source(aml,
|
|
|
|
(acpi_rs_length)
|
2005-10-21 11:00:00 +07:00
|
|
|
aml_length, source);
|
|
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_SOURCE:
|
|
|
|
/*
|
|
|
|
* Optional resource_source (Index and String). This is the more
|
|
|
|
* complicated case used by the Interrupt() macro
|
|
|
|
*/
|
|
|
|
aml_length =
|
|
|
|
acpi_rs_set_resource_source(aml, info->value,
|
|
|
|
source);
|
|
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_BITMASK:
|
|
|
|
/*
|
|
|
|
* 8-bit encoded bitmask (DMA macro)
|
|
|
|
*/
|
2012-12-19 12:38:24 +07:00
|
|
|
ACPI_SET8(destination,
|
|
|
|
acpi_rs_encode_bitmask(source,
|
|
|
|
*ACPI_ADD_PTR(u8,
|
|
|
|
resource,
|
|
|
|
info->
|
|
|
|
value)));
|
2005-10-21 11:00:00 +07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_BITMASK16:
|
|
|
|
/*
|
|
|
|
* 16-bit encoded bitmask (IRQ macro)
|
|
|
|
*/
|
2005-11-18 01:07:00 +07:00
|
|
|
temp16 = acpi_rs_encode_bitmask(source,
|
|
|
|
*ACPI_ADD_PTR(u8,
|
|
|
|
resource,
|
|
|
|
info->
|
|
|
|
value));
|
2005-10-21 11:00:00 +07:00
|
|
|
ACPI_MOVE_16_TO_16(destination, &temp16);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_EXIT_LE:
|
|
|
|
/*
|
2012-07-12 08:40:10 +07:00
|
|
|
* control - Exit conversion if less than or equal
|
2005-10-21 11:00:00 +07:00
|
|
|
*/
|
|
|
|
if (item_count <= info->value) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_RSC_EXIT_NE:
|
|
|
|
/*
|
2012-07-12 08:40:10 +07:00
|
|
|
* control - Exit conversion if not equal
|
2005-10-21 11:00:00 +07:00
|
|
|
*/
|
|
|
|
switch (COMPARE_OPCODE(info)) {
|
|
|
|
case ACPI_RSC_COMPARE_VALUE:
|
2005-11-18 01:07:00 +07:00
|
|
|
|
|
|
|
if (*ACPI_ADD_PTR(u8, resource,
|
|
|
|
COMPARE_TARGET(info)) !=
|
2005-10-21 11:00:00 +07:00
|
|
|
COMPARE_VALUE(info)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2006-01-28 04:43:00 +07:00
|
|
|
|
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Invalid conversion sub-opcode"));
|
2005-10-21 11:00:00 +07:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-04-10 22:06:43 +07:00
|
|
|
case ACPI_RSC_EXIT_EQ:
|
|
|
|
/*
|
2012-07-12 08:40:10 +07:00
|
|
|
* control - Exit conversion if equal
|
2008-04-10 22:06:43 +07:00
|
|
|
*/
|
|
|
|
if (*ACPI_ADD_PTR(u8, resource,
|
|
|
|
COMPARE_TARGET(info)) ==
|
|
|
|
COMPARE_VALUE(info)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
default:
|
|
|
|
|
2006-01-28 04:43:00 +07:00
|
|
|
ACPI_ERROR((AE_INFO, "Invalid conversion opcode"));
|
2005-10-21 11:00:00 +07:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-10-01 06:03:00 +07:00
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
count--;
|
|
|
|
info++;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2013-10-29 08:30:02 +07:00
|
|
|
exit:
|
2005-08-05 11:44:28 +07:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
#if 0
|
|
|
|
/* Previous resource validations */
|
2005-04-19 09:49:35 +07:00
|
|
|
|
2012-07-12 08:40:10 +07:00
|
|
|
if (aml->ext_address64.revision_ID != AML_RESOURCE_EXTENDED_ADDRESS_REVISION) {
|
2005-10-21 11:00:00 +07:00
|
|
|
return_ACPI_STATUS(AE_SUPPORT);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
if (resource->data.start_dpf.performance_robustness >= 3) {
|
|
|
|
return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) {
|
|
|
|
/*
|
|
|
|
* Only [active_high, edge_sensitive] or [active_low, level_sensitive]
|
|
|
|
* polarity/trigger interrupts are allowed (ACPI spec, section
|
|
|
|
* "IRQ Format"), so 0x00 and 0x09 are illegal.
|
|
|
|
*/
|
2006-01-28 04:43:00 +07:00
|
|
|
ACPI_ERROR((AE_INFO,
|
2010-03-05 16:56:40 +07:00
|
|
|
"Invalid interrupt polarity/trigger in resource list, 0x%X",
|
2006-01-28 04:43:00 +07:00
|
|
|
aml->irq.flags));
|
2005-10-21 11:00:00 +07:00
|
|
|
return_ACPI_STATUS(AE_BAD_DATA);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
resource->data.extended_irq.interrupt_count = temp8;
|
|
|
|
if (temp8 < 1) {
|
2006-10-02 11:00:00 +07:00
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
/* Must have at least one IRQ */
|
2005-04-19 09:49:35 +07:00
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-10-21 11:00:00 +07:00
|
|
|
if (resource->data.dma.transfer == 0x03) {
|
2006-01-28 04:43:00 +07:00
|
|
|
ACPI_ERROR((AE_INFO, "Invalid DMA.Transfer preference (3)"));
|
2005-10-21 11:00:00 +07:00
|
|
|
return_ACPI_STATUS(AE_BAD_DATA);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
2005-10-21 11:00:00 +07:00
|
|
|
#endif
|