Merge branch 'acpica'

* acpica: (33 commits)
  ACPICA: Update version to 20130328
  ACPICA: Add a lock to the internal object reference count mechanism
  ACPICA: Fix a format string for 64-bit generation
  ACPICA: Remove FORCE_DELETE option for global reference count mechanism
  ACPICA: Improve error message for Index() operator
  ACPICA: FADT: Remove extraneous warning for very large GPE registers
  ACPICA: Fix a typo in a function header, no functional change
  ACPICA: Fix a typo in an error message
  ACPICA: Fix for some comments/headers
  ACPICA: _OSI Support: handle any errors from acpi_os_acquire_mutex()
  ACPICA: Predefine names: Add allowed argument types to master info table
  ACPI: Set length even for TYPE_END_TAG acpi resource
  ACPICA: Update version to 20130214
  ACPICA: Object repair: Allow 0-length packages for variable-length packages
  ACPICA: Disassembler: Add warnings for unresolved control methods
  ACPICA: Return object repair: Add resource template repairs
  ACPICA: Return object repair: Add string-to-unicode conversion
  ACPICA: Split object conversion functions to a new file
  ACPICA: Add mechanism for early object repairs on a per-name basis
  ACPICA: Remove trailing comma in enum declarations
  ...
This commit is contained in:
Rafael J. Wysocki 2013-04-28 01:53:50 +02:00
commit 0ad4991cae
50 changed files with 2637 additions and 1129 deletions

View file

@ -83,6 +83,7 @@ acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o
acpi-y += \
nsaccess.o \
nsalloc.o \
nsconvert.o \
nsdump.o \
nseval.o \
nsinit.o \
@ -160,6 +161,7 @@ acpi-y += \
utobject.o \
utosi.o \
utownerid.o \
utpredef.o \
utresrc.o \
utstate.o \
utstring.o \

View file

@ -224,6 +224,7 @@ ACPI_EXTERN u8 acpi_gbl_global_lock_pending;
*/
ACPI_EXTERN acpi_spinlock acpi_gbl_gpe_lock; /* For GPE data structs and registers */
ACPI_EXTERN acpi_spinlock acpi_gbl_hardware_lock; /* For ACPI H/W except GPE registers */
ACPI_EXTERN acpi_spinlock acpi_gbl_reference_count_lock;
/* Mutex for _OSI support */
@ -413,10 +414,12 @@ ACPI_EXTERN u8 acpi_gbl_db_output_flags;
#ifdef ACPI_DISASSEMBLER
u8 ACPI_INIT_GLOBAL(acpi_gbl_ignore_noop_operator, FALSE);
ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_ignore_noop_operator, FALSE);
ACPI_EXTERN u8 acpi_gbl_db_opt_disasm;
ACPI_EXTERN u8 acpi_gbl_db_opt_verbose;
ACPI_EXTERN u8 acpi_gbl_num_external_methods;
ACPI_EXTERN u32 acpi_gbl_resolved_external_methods;
ACPI_EXTERN struct acpi_external_list *acpi_gbl_external_list;
ACPI_EXTERN struct acpi_external_file *acpi_gbl_external_file_list;
#endif

View file

@ -294,6 +294,8 @@ acpi_status(*acpi_internal_method) (struct acpi_walk_state * walk_state);
#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
#pragma pack(1)
/*
* Information structure for ACPI predefined names.
* Each entry in the table contains the following items:
@ -304,7 +306,7 @@ acpi_status(*acpi_internal_method) (struct acpi_walk_state * walk_state);
*/
struct acpi_name_info {
char name[ACPI_NAME_SIZE];
u8 param_count;
u16 argument_list;
u8 expected_btypes;
};
@ -327,7 +329,7 @@ struct acpi_package_info {
u8 count1;
u8 object_type2;
u8 count2;
u8 reserved;
u16 reserved;
};
/* Used for ACPI_PTYPE2_FIXED */
@ -336,6 +338,7 @@ struct acpi_package_info2 {
u8 type;
u8 count;
u8 object_type[4];
u8 reserved;
};
/* Used for ACPI_PTYPE1_OPTION */
@ -345,7 +348,7 @@ struct acpi_package_info3 {
u8 count;
u8 object_type[2];
u8 tail_object_type;
u8 reserved;
u16 reserved;
};
union acpi_predefined_info {
@ -355,6 +358,10 @@ union acpi_predefined_info {
struct acpi_package_info3 ret_info3;
};
/* Reset to default packing */
#pragma pack()
/* Data block used during object validation */
struct acpi_predefined_data {
@ -363,6 +370,7 @@ struct acpi_predefined_data {
union acpi_operand_object *parent_package;
struct acpi_namespace_node *node;
u32 flags;
u32 return_btype;
u8 node_flags;
};
@ -371,6 +379,20 @@ struct acpi_predefined_data {
#define ACPI_OBJECT_REPAIRED 1
#define ACPI_OBJECT_WRAPPED 2
/* Return object auto-repair info */
typedef acpi_status(*acpi_object_converter) (union acpi_operand_object
*original_object,
union acpi_operand_object
**converted_object);
struct acpi_simple_repair_info {
char name[ACPI_NAME_SIZE];
u32 unexpected_btypes;
u32 package_index;
acpi_object_converter object_converter;
};
/*
* Bitmapped return value types
* Note: the actual data types must be contiguous, a loop in nspredef.c
@ -1037,6 +1059,7 @@ struct acpi_external_list {
u16 length;
u8 type;
u8 flags;
u8 resolved;
};
/* Values for Flags field above */

View file

@ -322,10 +322,12 @@
* where a pointer to an object of type union acpi_operand_object can also
* appear. This macro is used to distinguish them.
*
* The "Descriptor" field is the first field in both structures.
* The "DescriptorType" field is the second field in both structures.
*/
#define ACPI_GET_DESCRIPTOR_PTR(d) (((union acpi_descriptor *)(void *)(d))->common.common_pointer)
#define ACPI_SET_DESCRIPTOR_PTR(d, p) (((union acpi_descriptor *)(void *)(d))->common.common_pointer = (p))
#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type)
#define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t)
#define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = (t))
/*
* Macros for the master AML opcode table

View file

@ -166,6 +166,29 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent);
int acpi_ns_compare_names(char *name1, char *name2);
/*
* nsconvert - Dynamic object conversion routines
*/
acpi_status
acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
union acpi_operand_object **return_object);
acpi_status
acpi_ns_convert_to_string(union acpi_operand_object *original_object,
union acpi_operand_object **return_object);
acpi_status
acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
union acpi_operand_object **return_object);
acpi_status
acpi_ns_convert_to_unicode(union acpi_operand_object *original_object,
union acpi_operand_object **return_object);
acpi_status
acpi_ns_convert_to_resource(union acpi_operand_object *original_object,
union acpi_operand_object **return_object);
/*
* nsdump - Namespace dump/print utilities
*/
@ -208,10 +231,6 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
acpi_status return_status,
union acpi_operand_object **return_object);
const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
acpi_namespace_node
*node);
void
acpi_ns_check_parameter_count(char *pathname,
struct acpi_namespace_node *node,
@ -289,7 +308,7 @@ acpi_ns_get_attached_data(struct acpi_namespace_node *node,
* predefined methods/objects
*/
acpi_status
acpi_ns_repair_object(struct acpi_predefined_data *data,
acpi_ns_simple_repair(struct acpi_predefined_data *data,
u32 expected_btypes,
u32 package_index,
union acpi_operand_object **return_object_ptr);

File diff suppressed because it is too large Load diff

View file

@ -113,9 +113,10 @@ struct acpi_pkg_info {
u32 num_packages;
};
/* Object reference counts */
#define REF_INCREMENT (u16) 0
#define REF_DECREMENT (u16) 1
#define REF_FORCE_DELETE (u16) 2
/* acpi_ut_dump_buffer */
@ -421,7 +422,7 @@ acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length);
*/
acpi_status acpi_ut_initialize_interfaces(void);
void acpi_ut_interface_terminate(void);
acpi_status acpi_ut_interface_terminate(void);
acpi_status acpi_ut_install_interface(acpi_string interface_name);
@ -431,6 +432,26 @@ struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name);
acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state);
/*
* utpredef - support for predefined names
*/
const union acpi_predefined_info *acpi_ut_get_next_predefined_method(const union
acpi_predefined_info
*this_name);
const union acpi_predefined_info *acpi_ut_match_predefined_method(char *name);
const union acpi_predefined_info *acpi_ut_match_resource_name(char *name);
void
acpi_ut_display_predefined_method(char *buffer,
const union acpi_predefined_info *this_name,
u8 multi_line);
void acpi_ut_get_expected_return_types(char *buffer, u32 expected_btypes);
u32 acpi_ut_get_resource_bit_width(char *buffer, u16 types);
/*
* utstate - Generic state creation/cache routines
*/
@ -483,7 +504,8 @@ acpi_ut_short_divide(u64 in_dividend,
/*
* utmisc
*/
const char *acpi_ut_validate_exception(acpi_status status);
const struct acpi_exception_info *acpi_ut_validate_exception(acpi_status
status);
u8 acpi_ut_is_pci_root_bridge(char *id);

View file

@ -178,7 +178,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
if (!op) {
ACPI_ERROR((AE_INFO, "Null Op"));
return_VALUE(TRUE);
return_UINT8(TRUE);
}
/*
@ -210,7 +210,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
"At Method level, result of [%s] not used\n",
acpi_ps_get_opcode_name(op->common.
aml_opcode)));
return_VALUE(FALSE);
return_UINT8(FALSE);
}
/* Get info on the parent. The root_op is AML_SCOPE */
@ -219,7 +219,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode);
if (parent_info->class == AML_CLASS_UNKNOWN) {
ACPI_ERROR((AE_INFO, "Unknown parent opcode Op=%p", op));
return_VALUE(FALSE);
return_UINT8(FALSE);
}
/*
@ -307,7 +307,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
acpi_ps_get_opcode_name(op->common.parent->common.
aml_opcode), op));
return_VALUE(TRUE);
return_UINT8(TRUE);
result_not_used:
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
@ -316,7 +316,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
acpi_ps_get_opcode_name(op->common.parent->common.
aml_opcode), op));
return_VALUE(FALSE);
return_UINT8(FALSE);
}
/*******************************************************************************

View file

@ -693,7 +693,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
default:
ACPI_ERROR((AE_INFO,
"Unimplemented opcode, class=0x%X type=0x%X Opcode=-0x%X Op=%p",
"Unimplemented opcode, class=0x%X type=0x%X Opcode=0x%X Op=%p",
op_class, op_type, op->common.aml_opcode,
op));

View file

@ -257,6 +257,8 @@ u32 acpi_ev_fixed_event_detect(void)
*
* DESCRIPTION: Clears the status bit for the requested event, calls the
* handler that previously registered for the event.
* NOTE: If there is no handler for the event, the event is
* disabled to prevent further interrupts.
*
******************************************************************************/
@ -271,17 +273,17 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)
status_register_id, ACPI_CLEAR_STATUS);
/*
* Make sure we've got a handler. If not, report an error. The event is
* disabled to prevent further interrupts.
* Make sure that a handler exists. If not, report an error
* and disable the event to prevent further interrupts.
*/
if (NULL == acpi_gbl_fixed_event_handlers[event].handler) {
if (!acpi_gbl_fixed_event_handlers[event].handler) {
(void)acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
enable_register_id,
ACPI_DISABLE_EVENT);
ACPI_ERROR((AE_INFO,
"No installed handler for fixed event [0x%08X]",
event));
"No installed handler for fixed event - %s (%u), disabling",
acpi_ut_get_event_name(event), event));
return (ACPI_INTERRUPT_NOT_HANDLED);
}

View file

@ -707,7 +707,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"Unable to clear GPE%02X", gpe_number));
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
}
}
@ -724,7 +724,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"Unable to disable GPE%02X", gpe_number));
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
}
/*
@ -784,7 +784,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
break;
}
return_VALUE(ACPI_INTERRUPT_HANDLED);
return_UINT32(ACPI_INTERRUPT_HANDLED);
}
#endif /* !ACPI_REDUCED_HARDWARE */

View file

@ -89,7 +89,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
*/
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
return_VALUE(interrupt_handled);
return_UINT32(interrupt_handled);
}
/*******************************************************************************
@ -120,7 +120,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
return_VALUE(interrupt_handled);
return_UINT32(interrupt_handled);
}
/******************************************************************************

View file

@ -467,9 +467,9 @@ acpi_install_fixed_event_handler(u32 event,
return_ACPI_STATUS(status);
}
/* Don't allow two handlers. */
/* Do not allow multiple handlers */
if (NULL != acpi_gbl_fixed_event_handlers[event].handler) {
if (acpi_gbl_fixed_event_handlers[event].handler) {
status = AE_ALREADY_EXISTS;
goto cleanup;
}
@ -483,8 +483,9 @@ acpi_install_fixed_event_handler(u32 event,
if (ACPI_SUCCESS(status))
status = acpi_enable_event(event, 0);
if (ACPI_FAILURE(status)) {
ACPI_WARNING((AE_INFO, "Could not enable fixed event 0x%X",
event));
ACPI_WARNING((AE_INFO,
"Could not enable fixed event - %s (%u)",
acpi_ut_get_event_name(event), event));
/* Remove the handler */
@ -492,7 +493,8 @@ acpi_install_fixed_event_handler(u32 event,
acpi_gbl_fixed_event_handlers[event].context = NULL;
} else {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Enabled fixed event %X, Handler=%p\n", event,
"Enabled fixed event %s (%X), Handler=%p\n",
acpi_ut_get_event_name(event), event,
handler));
}
@ -544,11 +546,12 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler)
if (ACPI_FAILURE(status)) {
ACPI_WARNING((AE_INFO,
"Could not write to fixed event enable register 0x%X",
event));
"Could not disable fixed event - %s (%u)",
acpi_ut_get_event_name(event), event));
} else {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X\n",
event));
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Disabled fixed event - %s (%X)\n",
acpi_ut_get_event_name(event), event));
}
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);

View file

@ -74,6 +74,12 @@ acpi_status acpi_enable(void)
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
}
/* If the Hardware Reduced flag is set, machine is always in acpi mode */
if (acpi_gbl_reduced_hardware) {
return_ACPI_STATUS(AE_OK);
}
/* Check current mode */
if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
@ -126,6 +132,12 @@ acpi_status acpi_disable(void)
ACPI_FUNCTION_TRACE(acpi_disable);
/* If the Hardware Reduced flag is set, machine is always in acpi mode */
if (acpi_gbl_reduced_hardware) {
return_ACPI_STATUS(AE_OK);
}
if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
"System is already in legacy (non-ACPI) mode\n"));

View file

@ -257,7 +257,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
union acpi_operand_object *return_desc = NULL;
u64 index;
acpi_status status = AE_OK;
acpi_size length;
acpi_size length = 0;
ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_1T_1R,
acpi_ps_get_opcode_name(walk_state->opcode));
@ -320,7 +320,6 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
* NOTE: A length of zero is ok, and will create a zero-length, null
* terminated string.
*/
length = 0;
while ((length < operand[0]->buffer.length) &&
(length < operand[1]->integer.value) &&
(operand[0]->buffer.pointer[length])) {
@ -376,6 +375,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
case ACPI_TYPE_STRING:
if (index >= operand[0]->string.length) {
length = operand[0]->string.length;
status = AE_AML_STRING_LIMIT;
}
@ -386,6 +386,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
case ACPI_TYPE_BUFFER:
if (index >= operand[0]->buffer.length) {
length = operand[0]->buffer.length;
status = AE_AML_BUFFER_LIMIT;
}
@ -396,6 +397,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
case ACPI_TYPE_PACKAGE:
if (index >= operand[0]->package.count) {
length = operand[0]->package.count;
status = AE_AML_PACKAGE_LIMIT;
}
@ -414,8 +416,9 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"Index (0x%8.8X%8.8X) is beyond end of object",
ACPI_FORMAT_UINT64(index)));
"Index (0x%X%8.8X) is beyond end of object (length 0x%X)",
ACPI_FORMAT_UINT64(index),
(u32)length));
goto cleanup;
}

View file

@ -276,7 +276,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
/* Invalid field access type */
ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access));
return_VALUE(0);
return_UINT32(0);
}
if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
@ -289,7 +289,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
}
*return_byte_alignment = byte_alignment;
return_VALUE(bit_length);
return_UINT32(bit_length);
}
/*******************************************************************************

View file

@ -340,7 +340,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base)
/* u64 is unsigned, so we don't worry about a '-' prefix */
if (value == 0) {
return_VALUE(1);
return_UINT32(1);
}
current_value = value;
@ -354,7 +354,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base)
num_digits++;
}
return_VALUE(num_digits);
return_UINT32(num_digits);
}
/*******************************************************************************

View file

@ -66,6 +66,12 @@ acpi_status acpi_hw_set_mode(u32 mode)
ACPI_FUNCTION_TRACE(hw_set_mode);
/* If the Hardware Reduced flag is set, machine is always in acpi mode */
if (acpi_gbl_reduced_hardware) {
return_ACPI_STATUS(AE_OK);
}
/*
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
* system does not support mode transition.
@ -146,23 +152,29 @@ u32 acpi_hw_get_mode(void)
ACPI_FUNCTION_TRACE(hw_get_mode);
/* If the Hardware Reduced flag is set, machine is always in acpi mode */
if (acpi_gbl_reduced_hardware) {
return_UINT32(ACPI_SYS_MODE_ACPI);
}
/*
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
* system does not support mode transition.
*/
if (!acpi_gbl_FADT.smi_command) {
return_VALUE(ACPI_SYS_MODE_ACPI);
return_UINT32(ACPI_SYS_MODE_ACPI);
}
status = acpi_read_bit_register(ACPI_BITREG_SCI_ENABLE, &value);
if (ACPI_FAILURE(status)) {
return_VALUE(ACPI_SYS_MODE_LEGACY);
return_UINT32(ACPI_SYS_MODE_LEGACY);
}
if (value) {
return_VALUE(ACPI_SYS_MODE_ACPI);
return_UINT32(ACPI_SYS_MODE_ACPI);
} else {
return_VALUE(ACPI_SYS_MODE_LEGACY);
return_UINT32(ACPI_SYS_MODE_LEGACY);
}
}

View file

@ -0,0 +1,443 @@
/******************************************************************************
*
* Module Name: nsconvert - Object conversions for objects returned by
* predefined methods
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2013, 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/acpi.h>
#include "accommon.h"
#include "acnamesp.h"
#include "acinterp.h"
#include "acpredef.h"
#include "amlresrc.h"
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsconvert")
/*******************************************************************************
*
* FUNCTION: acpi_ns_convert_to_integer
*
* PARAMETERS: original_object - Object to be converted
* return_object - Where the new converted object is returned
*
* RETURN: Status. AE_OK if conversion was successful.
*
* DESCRIPTION: Attempt to convert a String/Buffer object to an Integer.
*
******************************************************************************/
acpi_status
acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
union acpi_operand_object **return_object)
{
union acpi_operand_object *new_object;
acpi_status status;
u64 value = 0;
u32 i;
switch (original_object->common.type) {
case ACPI_TYPE_STRING:
/* String-to-Integer conversion */
status = acpi_ut_strtoul64(original_object->string.pointer,
ACPI_ANY_BASE, &value);
if (ACPI_FAILURE(status)) {
return (status);
}
break;
case ACPI_TYPE_BUFFER:
/* Buffer-to-Integer conversion. Max buffer size is 64 bits. */
if (original_object->buffer.length > 8) {
return (AE_AML_OPERAND_TYPE);
}
/* Extract each buffer byte to create the integer */
for (i = 0; i < original_object->buffer.length; i++) {
value |=
((u64)original_object->buffer.
pointer[i] << (i * 8));
}
break;
default:
return (AE_AML_OPERAND_TYPE);
}
new_object = acpi_ut_create_integer_object(value);
if (!new_object) {
return (AE_NO_MEMORY);
}
*return_object = new_object;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_convert_to_string
*
* PARAMETERS: original_object - Object to be converted
* return_object - Where the new converted object is returned
*
* RETURN: Status. AE_OK if conversion was successful.
*
* DESCRIPTION: Attempt to convert a Integer/Buffer object to a String.
*
******************************************************************************/
acpi_status
acpi_ns_convert_to_string(union acpi_operand_object *original_object,
union acpi_operand_object **return_object)
{
union acpi_operand_object *new_object;
acpi_size length;
acpi_status status;
switch (original_object->common.type) {
case ACPI_TYPE_INTEGER:
/*
* Integer-to-String conversion. Commonly, convert
* an integer of value 0 to a NULL string. The last element of
* _BIF and _BIX packages occasionally need this fix.
*/
if (original_object->integer.value == 0) {
/* Allocate a new NULL string object */
new_object = acpi_ut_create_string_object(0);
if (!new_object) {
return (AE_NO_MEMORY);
}
} else {
status =
acpi_ex_convert_to_string(original_object,
&new_object,
ACPI_IMPLICIT_CONVERT_HEX);
if (ACPI_FAILURE(status)) {
return (status);
}
}
break;
case ACPI_TYPE_BUFFER:
/*
* Buffer-to-String conversion. Use a to_string
* conversion, no transform performed on the buffer data. The best
* example of this is the _BIF method, where the string data from
* the battery is often (incorrectly) returned as buffer object(s).
*/
length = 0;
while ((length < original_object->buffer.length) &&
(original_object->buffer.pointer[length])) {
length++;
}
/* Allocate a new string object */
new_object = acpi_ut_create_string_object(length);
if (!new_object) {
return (AE_NO_MEMORY);
}
/*
* Copy the raw buffer data with no transform. String is already NULL
* terminated at Length+1.
*/
ACPI_MEMCPY(new_object->string.pointer,
original_object->buffer.pointer, length);
break;
default:
return (AE_AML_OPERAND_TYPE);
}
*return_object = new_object;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_convert_to_buffer
*
* PARAMETERS: original_object - Object to be converted
* return_object - Where the new converted object is returned
*
* RETURN: Status. AE_OK if conversion was successful.
*
* DESCRIPTION: Attempt to convert a Integer/String/Package object to a Buffer.
*
******************************************************************************/
acpi_status
acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
union acpi_operand_object **return_object)
{
union acpi_operand_object *new_object;
acpi_status status;
union acpi_operand_object **elements;
u32 *dword_buffer;
u32 count;
u32 i;
switch (original_object->common.type) {
case ACPI_TYPE_INTEGER:
/*
* Integer-to-Buffer conversion.
* Convert the Integer to a packed-byte buffer. _MAT and other
* objects need this sometimes, if a read has been performed on a
* Field object that is less than or equal to the global integer
* size (32 or 64 bits).
*/
status =
acpi_ex_convert_to_buffer(original_object, &new_object);
if (ACPI_FAILURE(status)) {
return (status);
}
break;
case ACPI_TYPE_STRING:
/* String-to-Buffer conversion. Simple data copy */
new_object =
acpi_ut_create_buffer_object(original_object->string.
length);
if (!new_object) {
return (AE_NO_MEMORY);
}
ACPI_MEMCPY(new_object->buffer.pointer,
original_object->string.pointer,
original_object->string.length);
break;
case ACPI_TYPE_PACKAGE:
/*
* This case is often seen for predefined names that must return a
* Buffer object with multiple DWORD integers within. For example,
* _FDE and _GTM. The Package can be converted to a Buffer.
*/
/* All elements of the Package must be integers */
elements = original_object->package.elements;
count = original_object->package.count;
for (i = 0; i < count; i++) {
if ((!*elements) ||
((*elements)->common.type != ACPI_TYPE_INTEGER)) {
return (AE_AML_OPERAND_TYPE);
}
elements++;
}
/* Create the new buffer object to replace the Package */
new_object = acpi_ut_create_buffer_object(ACPI_MUL_4(count));
if (!new_object) {
return (AE_NO_MEMORY);
}
/* Copy the package elements (integers) to the buffer as DWORDs */
elements = original_object->package.elements;
dword_buffer = ACPI_CAST_PTR(u32, new_object->buffer.pointer);
for (i = 0; i < count; i++) {
*dword_buffer = (u32)(*elements)->integer.value;
dword_buffer++;
elements++;
}
break;
default:
return (AE_AML_OPERAND_TYPE);
}
*return_object = new_object;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_convert_to_unicode
*
* PARAMETERS: original_object - ASCII String Object to be converted
* return_object - Where the new converted object is returned
*
* RETURN: Status. AE_OK if conversion was successful.
*
* DESCRIPTION: Attempt to convert a String object to a Unicode string Buffer.
*
******************************************************************************/
acpi_status
acpi_ns_convert_to_unicode(union acpi_operand_object *original_object,
union acpi_operand_object **return_object)
{
union acpi_operand_object *new_object;
char *ascii_string;
u16 *unicode_buffer;
u32 unicode_length;
u32 i;
if (!original_object) {
return (AE_OK);
}
/* If a Buffer was returned, it must be at least two bytes long */
if (original_object->common.type == ACPI_TYPE_BUFFER) {
if (original_object->buffer.length < 2) {
return (AE_AML_OPERAND_VALUE);
}
*return_object = NULL;
return (AE_OK);
}
/*
* The original object is an ASCII string. Convert this string to
* a unicode buffer.
*/
ascii_string = original_object->string.pointer;
unicode_length = (original_object->string.length * 2) + 2;
/* Create a new buffer object for the Unicode data */
new_object = acpi_ut_create_buffer_object(unicode_length);
if (!new_object) {
return (AE_NO_MEMORY);
}
unicode_buffer = ACPI_CAST_PTR(u16, new_object->buffer.pointer);
/* Convert ASCII to Unicode */
for (i = 0; i < original_object->string.length; i++) {
unicode_buffer[i] = (u16)ascii_string[i];
}
*return_object = new_object;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_convert_to_resource
*
* PARAMETERS: original_object - Object to be converted
* return_object - Where the new converted object is returned
*
* RETURN: Status. AE_OK if conversion was successful
*
* DESCRIPTION: Attempt to convert a Integer object to a resource_template
* Buffer.
*
******************************************************************************/
acpi_status
acpi_ns_convert_to_resource(union acpi_operand_object *original_object,
union acpi_operand_object **return_object)
{
union acpi_operand_object *new_object;
u8 *buffer;
/*
* We can fix the following cases for an expected resource template:
* 1. No return value (interpreter slack mode is disabled)
* 2. A "Return (Zero)" statement
* 3. A "Return empty buffer" statement
*
* We will return a buffer containing a single end_tag
* resource descriptor.
*/
if (original_object) {
switch (original_object->common.type) {
case ACPI_TYPE_INTEGER:
/* We can only repair an Integer==0 */
if (original_object->integer.value) {
return (AE_AML_OPERAND_TYPE);
}
break;
case ACPI_TYPE_BUFFER:
if (original_object->buffer.length) {
/* Additional checks can be added in the future */
*return_object = NULL;
return (AE_OK);
}
break;
case ACPI_TYPE_STRING:
default:
return (AE_AML_OPERAND_TYPE);
}
}
/* Create the new buffer object for the resource descriptor */
new_object = acpi_ut_create_buffer_object(2);
if (!new_object) {
return (AE_NO_MEMORY);
}
buffer = ACPI_CAST_PTR(u8, new_object->buffer.pointer);
/* Initialize the Buffer with a single end_tag descriptor */
buffer[0] = (ACPI_RESOURCE_NAME_END_TAG | ASL_RDESC_END_TAG_SIZE);
buffer[1] = 0x00;
*return_object = new_object;
return (AE_OK);
}

View file

@ -98,17 +98,21 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
info->return_object = NULL;
info->param_count = 0;
/*
* Get the actual namespace node for the target object. Handles these cases:
*
* 1) Null node, Pathname (absolute path)
* 2) Node, Pathname (path relative to Node)
* 3) Node, Null Pathname
*/
status = acpi_ns_get_node(info->prefix_node, info->pathname,
ACPI_NS_NO_UPSEARCH, &info->resolved_node);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
if (!info->resolved_node) {
/*
* Get the actual namespace node for the target object if we need to.
* Handles these cases:
*
* 1) Null node, Pathname (absolute path)
* 2) Node, Pathname (path relative to Node)
* 3) Node, Null Pathname
*/
status = acpi_ns_get_node(info->prefix_node, info->pathname,
ACPI_NS_NO_UPSEARCH,
&info->resolved_node);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
}
/*

View file

@ -76,19 +76,7 @@ static acpi_status
acpi_ns_check_reference(struct acpi_predefined_data *data,
union acpi_operand_object *return_object);
static void acpi_ns_get_expected_types(char *buffer, u32 expected_btypes);
/*
* Names for the types that can be returned by the predefined objects.
* Used for warning messages. Must be in the same order as the ACPI_RTYPEs
*/
static const char *acpi_rtype_names[] = {
"/Integer",
"/String",
"/Buffer",
"/Package",
"/Reference",
};
static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object);
/*******************************************************************************
*
@ -112,7 +100,6 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
acpi_status return_status,
union acpi_operand_object **return_object_ptr)
{
union acpi_operand_object *return_object = *return_object_ptr;
acpi_status status = AE_OK;
const union acpi_predefined_info *predefined;
char *pathname;
@ -120,7 +107,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
/* Match the name for this method/object against the predefined list */
predefined = acpi_ns_check_for_predefined_name(node);
predefined = acpi_ut_match_predefined_method(node->name.ascii);
/* Get the full pathname to the object, for use in warning messages */
@ -151,25 +138,6 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
goto cleanup;
}
/*
* If there is no return value, check if we require a return value for
* this predefined name. Either one return value is expected, or none,
* for both methods and other objects.
*
* Exit now if there is no return object. Warning if one was expected.
*/
if (!return_object) {
if ((predefined->info.expected_btypes) &&
(!(predefined->info.expected_btypes & ACPI_RTYPE_NONE))) {
ACPI_WARN_PREDEFINED((AE_INFO, pathname,
ACPI_WARN_ALWAYS,
"Missing expected return value"));
status = AE_AML_NO_RETURN_VALUE;
}
goto cleanup;
}
/*
* Return value validation and possible repair.
*
@ -310,8 +278,10 @@ acpi_ns_check_parameter_count(char *pathname,
* Validate the user-supplied parameter count.
* Allow two different legal argument counts (_SCP, etc.)
*/
required_params_current = predefined->info.param_count & 0x0F;
required_params_old = predefined->info.param_count >> 4;
required_params_current =
predefined->info.argument_list & METHOD_ARG_MASK;
required_params_old =
predefined->info.argument_list >> METHOD_ARG_BIT_WIDTH;
if (user_param_count != ACPI_UINT32_MAX) {
if ((user_param_count != required_params_current) &&
@ -338,52 +308,6 @@ acpi_ns_check_parameter_count(char *pathname,
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_check_for_predefined_name
*
* PARAMETERS: node - Namespace node for the method/object
*
* RETURN: Pointer to entry in predefined table. NULL indicates not found.
*
* DESCRIPTION: Check an object name against the predefined object list.
*
******************************************************************************/
const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
acpi_namespace_node
*node)
{
const union acpi_predefined_info *this_name;
/* Quick check for a predefined name, first character must be underscore */
if (node->name.ascii[0] != '_') {
return (NULL);
}
/* Search info table for a predefined method/object name */
this_name = predefined_names;
while (this_name->info.name[0]) {
if (ACPI_COMPARE_NAME(node->name.ascii, this_name->info.name)) {
return (this_name);
}
/*
* Skip next entry in the table if this name returns a Package
* (next entry contains the package info)
*/
if (this_name->info.expected_btypes & ACPI_RTYPE_PACKAGE) {
this_name++;
}
this_name++;
}
return (NULL); /* Not found */
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_check_object_type
@ -410,28 +334,12 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
{
union acpi_operand_object *return_object = *return_object_ptr;
acpi_status status = AE_OK;
u32 return_btype;
char type_buffer[48]; /* Room for 5 types */
/*
* If we get a NULL return_object here, it is a NULL package element.
* Since all extraneous NULL package elements were removed earlier by a
* call to acpi_ns_remove_null_elements, this is an unexpected NULL element.
* We will attempt to repair it.
*/
if (!return_object) {
status = acpi_ns_repair_null_element(data, expected_btypes,
package_index,
return_object_ptr);
if (ACPI_SUCCESS(status)) {
return (AE_OK); /* Repair was successful */
}
goto type_error_exit;
}
/* A Namespace node should not get here, but make sure */
if (ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) {
if (return_object &&
ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) {
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
"Invalid return type - Found a Namespace node [%4.4s] type %s",
return_object->node.name.ascii,
@ -448,59 +356,31 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
* from all of the predefined names (including elements of returned
* packages)
*/
switch (return_object->common.type) {
case ACPI_TYPE_INTEGER:
return_btype = ACPI_RTYPE_INTEGER;
break;
data->return_btype = acpi_ns_get_bitmapped_type(return_object);
if (data->return_btype == ACPI_RTYPE_ANY) {
case ACPI_TYPE_BUFFER:
return_btype = ACPI_RTYPE_BUFFER;
break;
case ACPI_TYPE_STRING:
return_btype = ACPI_RTYPE_STRING;
break;
case ACPI_TYPE_PACKAGE:
return_btype = ACPI_RTYPE_PACKAGE;
break;
case ACPI_TYPE_LOCAL_REFERENCE:
return_btype = ACPI_RTYPE_REFERENCE;
break;
default:
/* Not one of the supported objects, must be incorrect */
goto type_error_exit;
}
/* Is the object one of the expected types? */
if (return_btype & expected_btypes) {
/* For reference objects, check that the reference type is correct */
if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) {
status = acpi_ns_check_reference(data, return_object);
}
/* For reference objects, check that the reference type is correct */
if ((data->return_btype & expected_btypes) == ACPI_RTYPE_REFERENCE) {
status = acpi_ns_check_reference(data, return_object);
return (status);
}
/* Type mismatch -- attempt repair of the returned object */
/* Attempt simple repair of the returned object if necessary */
status = acpi_ns_repair_object(data, expected_btypes,
status = acpi_ns_simple_repair(data, expected_btypes,
package_index, return_object_ptr);
if (ACPI_SUCCESS(status)) {
return (AE_OK); /* Repair was successful */
}
return (status);
type_error_exit:
/* Create a string with all expected types for this predefined object */
acpi_ns_get_expected_types(type_buffer, expected_btypes);
acpi_ut_get_expected_return_types(type_buffer, expected_btypes);
if (package_index == ACPI_NOT_PACKAGE_ELEMENT) {
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
@ -558,36 +438,55 @@ acpi_ns_check_reference(struct acpi_predefined_data *data,
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_expected_types
* FUNCTION: acpi_ns_get_bitmapped_type
*
* PARAMETERS: buffer - Pointer to where the string is returned
* expected_btypes - Bitmap of expected return type(s)
* PARAMETERS: return_object - Object returned from method/obj evaluation
*
* RETURN: Buffer is populated with type names.
* RETURN: Object return type. ACPI_RTYPE_ANY indicates that the object
* type is not supported. ACPI_RTYPE_NONE indicates that no
* object was returned (return_object is NULL).
*
* DESCRIPTION: Translate the expected types bitmap into a string of ascii
* names of expected types, for use in warning messages.
* DESCRIPTION: Convert object type into a bitmapped object return type.
*
******************************************************************************/
static void acpi_ns_get_expected_types(char *buffer, u32 expected_btypes)
static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object)
{
u32 this_rtype;
u32 i;
u32 j;
u32 return_btype;
j = 1;
buffer[0] = 0;
this_rtype = ACPI_RTYPE_INTEGER;
for (i = 0; i < ACPI_NUM_RTYPES; i++) {
/* If one of the expected types, concatenate the name of this type */
if (expected_btypes & this_rtype) {
ACPI_STRCAT(buffer, &acpi_rtype_names[i][j]);
j = 0; /* Use name separator from now on */
}
this_rtype <<= 1; /* Next Rtype */
if (!return_object) {
return (ACPI_RTYPE_NONE);
}
/* Map acpi_object_type to internal bitmapped type */
switch (return_object->common.type) {
case ACPI_TYPE_INTEGER:
return_btype = ACPI_RTYPE_INTEGER;
break;
case ACPI_TYPE_BUFFER:
return_btype = ACPI_RTYPE_BUFFER;
break;
case ACPI_TYPE_STRING:
return_btype = ACPI_RTYPE_STRING;
break;
case ACPI_TYPE_PACKAGE:
return_btype = ACPI_RTYPE_PACKAGE;
break;
case ACPI_TYPE_LOCAL_REFERENCE:
return_btype = ACPI_RTYPE_REFERENCE;
break;
default:
/* Not one of the supported objects, must be incorrect */
return_btype = ACPI_RTYPE_ANY;
break;
}
return (return_btype);
}

View file

@ -112,9 +112,15 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
elements = return_object->package.elements;
count = return_object->package.count;
/* The package must have at least one element, else invalid */
/*
* Most packages must have at least one element. The only exception
* is the variable-length package (ACPI_PTYPE1_VAR).
*/
if (!count) {
if (package->ret_info.type == ACPI_PTYPE1_VAR) {
return (AE_OK);
}
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
"Return Package has no elements (empty)"));

View file

@ -46,6 +46,7 @@
#include "acnamesp.h"
#include "acinterp.h"
#include "acpredef.h"
#include "amlresrc.h"
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsrepair")
@ -71,6 +72,11 @@ ACPI_MODULE_NAME("nsrepair")
* Buffer -> String
* Buffer -> Package of Integers
* Package -> Package of one Package
*
* Additional conversions that are available:
* Convert a null return or zero return value to an end_tag descriptor
* Convert an ASCII string to a Unicode buffer
*
* An incorrect standalone object is wrapped with required outer package
*
* Additional possible repairs:
@ -78,21 +84,51 @@ ACPI_MODULE_NAME("nsrepair")
*
******************************************************************************/
/* Local prototypes */
static acpi_status
acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
union acpi_operand_object **return_object);
static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct
acpi_namespace_node
*node,
u32
return_btype,
u32
package_index);
static acpi_status
acpi_ns_convert_to_string(union acpi_operand_object *original_object,
union acpi_operand_object **return_object);
/*
* Special but simple repairs for some names.
*
* 2nd argument: Unexpected types that can be repaired
*/
static const struct acpi_simple_repair_info acpi_object_repair_info[] = {
/* Resource descriptor conversions */
static acpi_status
acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
union acpi_operand_object **return_object);
{"_CRS",
ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER |
ACPI_RTYPE_NONE,
ACPI_NOT_PACKAGE_ELEMENT,
acpi_ns_convert_to_resource},
{"_DMA",
ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER |
ACPI_RTYPE_NONE,
ACPI_NOT_PACKAGE_ELEMENT,
acpi_ns_convert_to_resource},
{"_PRS",
ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER |
ACPI_RTYPE_NONE,
ACPI_NOT_PACKAGE_ELEMENT,
acpi_ns_convert_to_resource},
/* Unicode conversions */
{"_MLS", ACPI_RTYPE_STRING, 1,
acpi_ns_convert_to_unicode},
{"_STR", ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER,
ACPI_NOT_PACKAGE_ELEMENT,
acpi_ns_convert_to_unicode},
{{0, 0, 0, 0}, 0, 0, NULL} /* Table terminator */
};
/*******************************************************************************
*
* FUNCTION: acpi_ns_repair_object
* FUNCTION: acpi_ns_simple_repair
*
* PARAMETERS: data - Pointer to validation data structure
* expected_btypes - Object types expected
@ -110,16 +146,54 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
******************************************************************************/
acpi_status
acpi_ns_repair_object(struct acpi_predefined_data *data,
acpi_ns_simple_repair(struct acpi_predefined_data *data,
u32 expected_btypes,
u32 package_index,
union acpi_operand_object **return_object_ptr)
{
union acpi_operand_object *return_object = *return_object_ptr;
union acpi_operand_object *new_object;
union acpi_operand_object *new_object = NULL;
acpi_status status;
const struct acpi_simple_repair_info *predefined;
ACPI_FUNCTION_NAME(ns_repair_object);
ACPI_FUNCTION_NAME(ns_simple_repair);
/*
* Special repairs for certain names that are in the repair table.
* Check if this name is in the list of repairable names.
*/
predefined = acpi_ns_match_simple_repair(data->node,
data->return_btype,
package_index);
if (predefined) {
if (!return_object) {
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
ACPI_WARN_ALWAYS,
"Missing expected return value"));
}
status =
predefined->object_converter(return_object, &new_object);
if (ACPI_FAILURE(status)) {
/* A fatal error occurred during a conversion */
ACPI_EXCEPTION((AE_INFO, status,
"During return object analysis"));
return (status);
}
if (new_object) {
goto object_repaired;
}
}
/*
* Do not perform simple object repair unless the return type is not
* expected.
*/
if (data->return_btype & expected_btypes) {
return (AE_OK);
}
/*
* At this point, we know that the type of the returned object was not
@ -127,6 +201,24 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,
* repair the object by converting it to one of the expected object
* types for this predefined name.
*/
/*
* If there is no return value, check if we require a return value for
* this predefined name. Either one return value is expected, or none,
* for both methods and other objects.
*
* Exit now if there is no return object. Warning if one was expected.
*/
if (!return_object) {
if (expected_btypes && (!(expected_btypes & ACPI_RTYPE_NONE))) {
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
ACPI_WARN_ALWAYS,
"Missing expected return value"));
return (AE_AML_NO_RETURN_VALUE);
}
}
if (expected_btypes & ACPI_RTYPE_INTEGER) {
status = acpi_ns_convert_to_integer(return_object, &new_object);
if (ACPI_SUCCESS(status)) {
@ -216,254 +308,51 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,
return (AE_OK);
}
/*******************************************************************************
/******************************************************************************
*
* FUNCTION: acpi_ns_convert_to_integer
* FUNCTION: acpi_ns_match_simple_repair
*
* PARAMETERS: original_object - Object to be converted
* return_object - Where the new converted object is returned
* PARAMETERS: node - Namespace node for the method/object
* return_btype - Object type that was returned
* package_index - Index of object within parent package (if
* applicable - ACPI_NOT_PACKAGE_ELEMENT
* otherwise)
*
* RETURN: Status. AE_OK if conversion was successful.
* RETURN: Pointer to entry in repair table. NULL indicates not found.
*
* DESCRIPTION: Attempt to convert a String/Buffer object to an Integer.
* DESCRIPTION: Check an object name against the repairable object list.
*
******************************************************************************/
*****************************************************************************/
static acpi_status
acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
union acpi_operand_object **return_object)
static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct
acpi_namespace_node
*node,
u32
return_btype,
u32
package_index)
{
union acpi_operand_object *new_object;
acpi_status status;
u64 value = 0;
u32 i;
const struct acpi_simple_repair_info *this_name;
switch (original_object->common.type) {
case ACPI_TYPE_STRING:
/* Search info table for a repairable predefined method/object name */
/* String-to-Integer conversion */
this_name = acpi_object_repair_info;
while (this_name->object_converter) {
if (ACPI_COMPARE_NAME(node->name.ascii, this_name->name)) {
status = acpi_ut_strtoul64(original_object->string.pointer,
ACPI_ANY_BASE, &value);
if (ACPI_FAILURE(status)) {
return (status);
}
break;
/* Check if we can actually repair this name/type combination */
case ACPI_TYPE_BUFFER:
/* Buffer-to-Integer conversion. Max buffer size is 64 bits. */
if (original_object->buffer.length > 8) {
return (AE_AML_OPERAND_TYPE);
}
/* Extract each buffer byte to create the integer */
for (i = 0; i < original_object->buffer.length; i++) {
value |=
((u64) original_object->buffer.
pointer[i] << (i * 8));
}
break;
default:
return (AE_AML_OPERAND_TYPE);
}
new_object = acpi_ut_create_integer_object(value);
if (!new_object) {
return (AE_NO_MEMORY);
}
*return_object = new_object;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_convert_to_string
*
* PARAMETERS: original_object - Object to be converted
* return_object - Where the new converted object is returned
*
* RETURN: Status. AE_OK if conversion was successful.
*
* DESCRIPTION: Attempt to convert a Integer/Buffer object to a String.
*
******************************************************************************/
static acpi_status
acpi_ns_convert_to_string(union acpi_operand_object *original_object,
union acpi_operand_object **return_object)
{
union acpi_operand_object *new_object;
acpi_size length;
acpi_status status;
switch (original_object->common.type) {
case ACPI_TYPE_INTEGER:
/*
* Integer-to-String conversion. Commonly, convert
* an integer of value 0 to a NULL string. The last element of
* _BIF and _BIX packages occasionally need this fix.
*/
if (original_object->integer.value == 0) {
/* Allocate a new NULL string object */
new_object = acpi_ut_create_string_object(0);
if (!new_object) {
return (AE_NO_MEMORY);
}
} else {
status =
acpi_ex_convert_to_string(original_object,
&new_object,
ACPI_IMPLICIT_CONVERT_HEX);
if (ACPI_FAILURE(status)) {
return (status);
if ((return_btype & this_name->unexpected_btypes) &&
(package_index == this_name->package_index)) {
return (this_name);
}
return (NULL);
}
break;
case ACPI_TYPE_BUFFER:
/*
* Buffer-to-String conversion. Use a to_string
* conversion, no transform performed on the buffer data. The best
* example of this is the _BIF method, where the string data from
* the battery is often (incorrectly) returned as buffer object(s).
*/
length = 0;
while ((length < original_object->buffer.length) &&
(original_object->buffer.pointer[length])) {
length++;
}
/* Allocate a new string object */
new_object = acpi_ut_create_string_object(length);
if (!new_object) {
return (AE_NO_MEMORY);
}
/*
* Copy the raw buffer data with no transform. String is already NULL
* terminated at Length+1.
*/
ACPI_MEMCPY(new_object->string.pointer,
original_object->buffer.pointer, length);
break;
default:
return (AE_AML_OPERAND_TYPE);
this_name++;
}
*return_object = new_object;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_convert_to_buffer
*
* PARAMETERS: original_object - Object to be converted
* return_object - Where the new converted object is returned
*
* RETURN: Status. AE_OK if conversion was successful.
*
* DESCRIPTION: Attempt to convert a Integer/String/Package object to a Buffer.
*
******************************************************************************/
static acpi_status
acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
union acpi_operand_object **return_object)
{
union acpi_operand_object *new_object;
acpi_status status;
union acpi_operand_object **elements;
u32 *dword_buffer;
u32 count;
u32 i;
switch (original_object->common.type) {
case ACPI_TYPE_INTEGER:
/*
* Integer-to-Buffer conversion.
* Convert the Integer to a packed-byte buffer. _MAT and other
* objects need this sometimes, if a read has been performed on a
* Field object that is less than or equal to the global integer
* size (32 or 64 bits).
*/
status =
acpi_ex_convert_to_buffer(original_object, &new_object);
if (ACPI_FAILURE(status)) {
return (status);
}
break;
case ACPI_TYPE_STRING:
/* String-to-Buffer conversion. Simple data copy */
new_object =
acpi_ut_create_buffer_object(original_object->string.
length);
if (!new_object) {
return (AE_NO_MEMORY);
}
ACPI_MEMCPY(new_object->buffer.pointer,
original_object->string.pointer,
original_object->string.length);
break;
case ACPI_TYPE_PACKAGE:
/*
* This case is often seen for predefined names that must return a
* Buffer object with multiple DWORD integers within. For example,
* _FDE and _GTM. The Package can be converted to a Buffer.
*/
/* All elements of the Package must be integers */
elements = original_object->package.elements;
count = original_object->package.count;
for (i = 0; i < count; i++) {
if ((!*elements) ||
((*elements)->common.type != ACPI_TYPE_INTEGER)) {
return (AE_AML_OPERAND_TYPE);
}
elements++;
}
/* Create the new buffer object to replace the Package */
new_object = acpi_ut_create_buffer_object(ACPI_MUL_4(count));
if (!new_object) {
return (AE_NO_MEMORY);
}
/* Copy the package elements (integers) to the buffer as DWORDs */
elements = original_object->package.elements;
dword_buffer = ACPI_CAST_PTR(u32, new_object->buffer.pointer);
for (i = 0; i < count; i++) {
*dword_buffer = (u32) (*elements)->integer.value;
dword_buffer++;
elements++;
}
break;
default:
return (AE_AML_OPERAND_TYPE);
}
*return_object = new_object;
return (AE_OK);
return (NULL); /* Name was not found in the repair table */
}
/*******************************************************************************

View file

@ -66,9 +66,9 @@ typedef struct acpi_repair_info {
/* Local prototypes */
static const struct acpi_repair_info *acpi_ns_match_repairable_name(struct
acpi_namespace_node
*node);
static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct
acpi_namespace_node
*node);
static acpi_status
acpi_ns_repair_ALR(struct acpi_predefined_data *data,
@ -175,7 +175,7 @@ acpi_ns_complex_repairs(struct acpi_predefined_data *data,
/* Check if this name is in the list of repairable names */
predefined = acpi_ns_match_repairable_name(node);
predefined = acpi_ns_match_complex_repair(node);
if (!predefined) {
return (validate_status);
}
@ -186,7 +186,7 @@ acpi_ns_complex_repairs(struct acpi_predefined_data *data,
/******************************************************************************
*
* FUNCTION: acpi_ns_match_repairable_name
* FUNCTION: acpi_ns_match_complex_repair
*
* PARAMETERS: node - Namespace node for the method/object
*
@ -196,9 +196,9 @@ acpi_ns_complex_repairs(struct acpi_predefined_data *data,
*
*****************************************************************************/
static const struct acpi_repair_info *acpi_ns_match_repairable_name(struct
acpi_namespace_node
*node)
static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct
acpi_namespace_node
*node)
{
const struct acpi_repair_info *this_name;

View file

@ -112,10 +112,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
if (!node) {
ACPI_WARNING((AE_INFO, "Null Node parameter"));
return_VALUE(ACPI_TYPE_ANY);
return_UINT8(ACPI_TYPE_ANY);
}
return_VALUE(node->type);
return_UINT8(node->type);
}
/*******************************************************************************
@ -140,10 +140,10 @@ u32 acpi_ns_local(acpi_object_type type)
/* Type code out of range */
ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type));
return_VALUE(ACPI_NS_NORMAL);
return_UINT32(ACPI_NS_NORMAL);
}
return_VALUE(acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
return_UINT32(acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
}
/*******************************************************************************

View file

@ -108,7 +108,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
/* Byte 0 is a special case, either bits [0:3] or [0:5] are used */
package_length |= (aml[0] & byte_zero_mask);
return_VALUE(package_length);
return_UINT32(package_length);
}
/*******************************************************************************

View file

@ -202,6 +202,12 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
}
/* Sanity check the length. It must not be zero, or we loop forever */
if (!resource->length) {
return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
}
/* Get the base size of the (external stream) resource descriptor */
total_size = acpi_gbl_aml_resource_sizes[resource->type];

View file

@ -385,6 +385,14 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
return;
}
/* Sanity check the length. It must not be zero, or we loop forever */
if (!resource_list->length) {
acpi_os_printf
("Invalid zero length descriptor in resource list\n");
return;
}
/* Dump the resource descriptor */
if (type == ACPI_RESOURCE_TYPE_SERIAL_BUS) {

View file

@ -178,6 +178,14 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
return_ACPI_STATUS(AE_BAD_DATA);
}
/* Sanity check the length. It must not be zero, or we loop forever */
if (!resource->length) {
ACPI_ERROR((AE_INFO,
"Invalid zero length descriptor in resource list\n"));
return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
}
/* Perform the conversion */
if (resource->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) {

View file

@ -563,13 +563,19 @@ acpi_walk_resource_buffer(struct acpi_buffer * buffer,
while (resource < resource_end) {
/* Sanity check the resource */
/* Sanity check the resource type */
if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
status = AE_AML_INVALID_RESOURCE_TYPE;
break;
}
/* Sanity check the length. It must not be zero, or we loop forever */
if (!resource->length) {
return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
}
/* Invoke the user function, abort on any error returned */
status = user_function(resource, context);

View file

@ -559,8 +559,12 @@ static void acpi_tb_validate_fadt(void)
/*
* For each extended field, check for length mismatch between the
* legacy length field and the corresponding 64-bit X length field.
* Note: If the legacy length field is > 0xFF bits, ignore this
* check. (GPE registers can be larger than the 64-bit GAS structure
* can accomodate, 0xFF bits).
*/
if (address64->address &&
(ACPI_MUL_8(length) <= ACPI_UINT8_MAX) &&
(address64->bit_width != ACPI_MUL_8(length))) {
ACPI_BIOS_WARNING((AE_INFO,
"32/64X length mismatch in FADT/%s: %u/%u",

View file

@ -1,6 +1,6 @@
/******************************************************************************
*
* Module Name: tbxface - ACPI table oriented external interfaces
* Module Name: tbxface - ACPI table-oriented external interfaces
*
*****************************************************************************/
@ -80,7 +80,7 @@ acpi_status acpi_allocate_root_table(u32 initial_table_count)
* array is dynamically allocated.
* initial_table_count - Size of initial_table_array, in number of
* struct acpi_table_desc structures
* allow_realloc - Flag to tell Table Manager if resize of
* allow_resize - Flag to tell Table Manager if resize of
* pre-allocated array is allowed. Ignored
* if initial_table_array is NULL.
*
@ -107,8 +107,8 @@ acpi_initialize_tables(struct acpi_table_desc * initial_table_array,
ACPI_FUNCTION_TRACE(acpi_initialize_tables);
/*
* Set up the Root Table Array
* Allocate the table array if requested
* Setup the Root Table Array and allocate the table array
* if requested
*/
if (!initial_table_array) {
status = acpi_allocate_root_table(initial_table_count);
@ -305,9 +305,10 @@ ACPI_EXPORT_SYMBOL(acpi_unload_table_id)
* instance - Which instance (for SSDTs)
* out_table - Where the pointer to the table is returned
*
* RETURN: Status and pointer to table
* RETURN: Status and pointer to the requested table
*
* DESCRIPTION: Finds and verifies an ACPI table.
* DESCRIPTION: Finds and verifies an ACPI table. Table must be in the
* RSDT/XSDT.
*
******************************************************************************/
acpi_status
@ -375,9 +376,10 @@ ACPI_EXPORT_SYMBOL(acpi_get_table)
* PARAMETERS: table_index - Table index
* table - Where the pointer to the table is returned
*
* RETURN: Status and pointer to the table
* RETURN: Status and pointer to the requested table
*
* DESCRIPTION: Obtain a table by an index into the global table list.
* DESCRIPTION: Obtain a table by an index into the global table list. Used
* internally also.
*
******************************************************************************/
acpi_status
@ -432,7 +434,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_table_by_index)
*
* RETURN: Status
*
* DESCRIPTION: Install table event handler
* DESCRIPTION: Install a global table event handler.
*
******************************************************************************/
acpi_status
@ -479,7 +481,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_table_handler)
*
* RETURN: Status
*
* DESCRIPTION: Remove table event handler
* DESCRIPTION: Remove a table event handler
*
******************************************************************************/
acpi_status acpi_remove_table_handler(acpi_table_handler handler)

View file

@ -214,7 +214,7 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id,
if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
(space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
return_VALUE(0);
return_UINT32(0);
}
range_info = acpi_gbl_address_range_list[space_id];
@ -256,7 +256,7 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id,
range_info = range_info->next;
}
return_VALUE(overlap_count);
return_UINT32(overlap_count);
}
/*******************************************************************************

View file

@ -85,7 +85,6 @@ acpi_os_create_cache(char *cache_name,
/* Populate the cache object and return it */
ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list));
cache->link_offset = 8;
cache->list_name = cache_name;
cache->object_size = object_size;
cache->max_depth = max_depth;
@ -108,7 +107,7 @@ acpi_os_create_cache(char *cache_name,
acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache)
{
char *next;
void *next;
acpi_status status;
ACPI_FUNCTION_ENTRY();
@ -128,10 +127,7 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache)
/* Delete and unlink one cached state object */
next = *(ACPI_CAST_INDIRECT_PTR(char,
&(((char *)cache->
list_head)[cache->
link_offset])));
next = ACPI_GET_DESCRIPTOR_PTR(cache->list_head);
ACPI_FREE(cache->list_head);
cache->list_head = next;
@ -221,10 +217,7 @@ acpi_os_release_object(struct acpi_memory_list * cache, void *object)
/* Put the object at the head of the cache list */
*(ACPI_CAST_INDIRECT_PTR(char,
&(((char *)object)[cache->
link_offset]))) =
cache->list_head;
ACPI_SET_DESCRIPTOR_PTR(object, cache->list_head);
cache->list_head = object;
cache->current_depth++;
@ -272,10 +265,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
/* There is an object available, use it */
object = cache->list_head;
cache->list_head = *(ACPI_CAST_INDIRECT_PTR(char,
&(((char *)
object)[cache->
link_offset])));
cache->list_head = ACPI_GET_DESCRIPTOR_PTR(object);
cache->current_depth--;

View file

@ -359,19 +359,20 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list)
* FUNCTION: acpi_ut_update_ref_count
*
* PARAMETERS: object - Object whose ref count is to be updated
* action - What to do
* action - What to do (REF_INCREMENT or REF_DECREMENT)
*
* RETURN: New ref count
* RETURN: None. Sets new reference count within the object
*
* DESCRIPTION: Modify the ref count and return it.
* DESCRIPTION: Modify the reference count for an internal acpi object
*
******************************************************************************/
static void
acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
{
u16 count;
u16 new_count;
u16 original_count;
u16 new_count = 0;
acpi_cpu_flags lock_flags;
ACPI_FUNCTION_NAME(ut_update_ref_count);
@ -379,76 +380,79 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
return;
}
count = object->common.reference_count;
new_count = count;
/*
* Perform the reference count action (increment, decrement, force delete)
* Always get the reference count lock. Note: Interpreter and/or
* Namespace is not always locked when this function is called.
*/
lock_flags = acpi_os_acquire_lock(acpi_gbl_reference_count_lock);
original_count = object->common.reference_count;
/* Perform the reference count action (increment, decrement) */
switch (action) {
case REF_INCREMENT:
new_count++;
new_count = original_count + 1;
object->common.reference_count = new_count;
acpi_os_release_lock(acpi_gbl_reference_count_lock, lock_flags);
/* The current reference count should never be zero here */
if (!original_count) {
ACPI_WARNING((AE_INFO,
"Obj %p, Reference Count was zero before increment\n",
object));
}
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
"Obj %p Refs=%X, [Incremented]\n",
object, new_count));
"Obj %p Type %.2X Refs %.2X [Incremented]\n",
object, object->common.type, new_count));
break;
case REF_DECREMENT:
if (count < 1) {
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
"Obj %p Refs=%X, can't decrement! (Set to 0)\n",
object, new_count));
/* The current reference count must be non-zero */
new_count = 0;
} else {
new_count--;
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
"Obj %p Refs=%X, [Decremented]\n",
object, new_count));
if (original_count) {
new_count = original_count - 1;
object->common.reference_count = new_count;
}
if (object->common.type == ACPI_TYPE_METHOD) {
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
"Method Obj %p Refs=%X, [Decremented]\n",
object, new_count));
acpi_os_release_lock(acpi_gbl_reference_count_lock, lock_flags);
if (!original_count) {
ACPI_WARNING((AE_INFO,
"Obj %p, Reference Count is already zero, cannot decrement\n",
object));
}
object->common.reference_count = new_count;
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
"Obj %p Type %.2X Refs %.2X [Decremented]\n",
object, object->common.type, new_count));
/* Actually delete the object on a reference count of zero */
if (new_count == 0) {
acpi_ut_delete_internal_obj(object);
}
break;
case REF_FORCE_DELETE:
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
"Obj %p Refs=%X, Force delete! (Set to 0)\n",
object, count));
new_count = 0;
object->common.reference_count = new_count;
acpi_ut_delete_internal_obj(object);
break;
default:
ACPI_ERROR((AE_INFO, "Unknown action (0x%X)", action));
break;
acpi_os_release_lock(acpi_gbl_reference_count_lock, lock_flags);
ACPI_ERROR((AE_INFO, "Unknown Reference Count action (0x%X)",
action));
return;
}
/*
* Sanity check the reference count, for debug purposes only.
* (A deleted object will have a huge reference count)
*/
if (count > ACPI_MAX_REFERENCE_COUNT) {
if (new_count > ACPI_MAX_REFERENCE_COUNT) {
ACPI_WARNING((AE_INFO,
"Large Reference Count (0x%X) in object %p",
count, object));
"Large Reference Count (0x%X) in object %p, Type=0x%.2X",
new_count, object, object->common.type));
}
}
@ -458,8 +462,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
*
* PARAMETERS: object - Increment ref count for this object
* and all sub-objects
* action - Either REF_INCREMENT or REF_DECREMENT or
* REF_FORCE_DELETE
* action - Either REF_INCREMENT or REF_DECREMENT
*
* RETURN: Status
*
@ -714,7 +717,6 @@ void acpi_ut_remove_reference(union acpi_operand_object *object)
/*
* Allow a NULL pointer to be passed in, just ignore it. This saves
* each caller from having to check. Also, ignore NS nodes.
*
*/
if (!object ||
(ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED)) {

View file

@ -64,7 +64,7 @@ ACPI_MODULE_NAME("utexcep")
******************************************************************************/
const char *acpi_format_exception(acpi_status status)
{
const char *exception = NULL;
const struct acpi_exception_info *exception;
ACPI_FUNCTION_ENTRY();
@ -76,10 +76,10 @@ const char *acpi_format_exception(acpi_status status)
ACPI_ERROR((AE_INFO,
"Unknown exception code: 0x%8.8X", status));
exception = "UNKNOWN_STATUS_CODE";
return ("UNKNOWN_STATUS_CODE");
}
return (ACPI_CAST_PTR(const char, exception));
return (exception->name);
}
ACPI_EXPORT_SYMBOL(acpi_format_exception)
@ -97,10 +97,10 @@ ACPI_EXPORT_SYMBOL(acpi_format_exception)
* an ASCII string.
*
******************************************************************************/
const char *acpi_ut_validate_exception(acpi_status status)
const struct acpi_exception_info *acpi_ut_validate_exception(acpi_status status)
{
u32 sub_status;
const char *exception = NULL;
const struct acpi_exception_info *exception = NULL;
ACPI_FUNCTION_ENTRY();
@ -113,35 +113,35 @@ const char *acpi_ut_validate_exception(acpi_status status)
case AE_CODE_ENVIRONMENTAL:
if (sub_status <= AE_CODE_ENV_MAX) {
exception = acpi_gbl_exception_names_env[sub_status];
exception = &acpi_gbl_exception_names_env[sub_status];
}
break;
case AE_CODE_PROGRAMMER:
if (sub_status <= AE_CODE_PGM_MAX) {
exception = acpi_gbl_exception_names_pgm[sub_status];
exception = &acpi_gbl_exception_names_pgm[sub_status];
}
break;
case AE_CODE_ACPI_TABLES:
if (sub_status <= AE_CODE_TBL_MAX) {
exception = acpi_gbl_exception_names_tbl[sub_status];
exception = &acpi_gbl_exception_names_tbl[sub_status];
}
break;
case AE_CODE_AML:
if (sub_status <= AE_CODE_AML_MAX) {
exception = acpi_gbl_exception_names_aml[sub_status];
exception = &acpi_gbl_exception_names_aml[sub_status];
}
break;
case AE_CODE_CONTROL:
if (sub_status <= AE_CODE_CTRL_MAX) {
exception = acpi_gbl_exception_names_ctrl[sub_status];
exception = &acpi_gbl_exception_names_ctrl[sub_status];
}
break;
@ -149,5 +149,9 @@ const char *acpi_ut_validate_exception(acpi_status status)
break;
}
return (ACPI_CAST_PTR(const char, exception));
if (!exception || !exception->name) {
return (NULL);
}
return (exception);
}

View file

@ -359,6 +359,8 @@ acpi_status acpi_ut_init_globals(void)
#ifdef ACPI_DISASSEMBLER
acpi_gbl_external_list = NULL;
acpi_gbl_num_external_methods = 0;
acpi_gbl_resolved_external_methods = 0;
#endif
#ifdef ACPI_DEBUG_OUTPUT

View file

@ -81,7 +81,7 @@ acpi_status acpi_ut_mutex_initialize(void)
}
}
/* Create the spinlocks for use at interrupt level */
/* Create the spinlocks for use at interrupt level or for speed */
status = acpi_os_create_lock (&acpi_gbl_gpe_lock);
if (ACPI_FAILURE (status)) {
@ -93,7 +93,13 @@ acpi_status acpi_ut_mutex_initialize(void)
return_ACPI_STATUS (status);
}
status = acpi_os_create_lock(&acpi_gbl_reference_count_lock);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Mutex for _OSI support */
status = acpi_os_create_mutex(&acpi_gbl_osi_mutex);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
@ -136,6 +142,7 @@ void acpi_ut_mutex_terminate(void)
acpi_os_delete_lock(acpi_gbl_gpe_lock);
acpi_os_delete_lock(acpi_gbl_hardware_lock);
acpi_os_delete_lock(acpi_gbl_reference_count_lock);
/* Delete the reader/writer lock */

View file

@ -108,9 +108,14 @@ static struct acpi_interface_info acpi_default_supported_interfaces[] = {
acpi_status acpi_ut_initialize_interfaces(void)
{
acpi_status status;
u32 i;
(void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
if (ACPI_FAILURE(status)) {
return (status);
}
acpi_gbl_supported_interfaces = acpi_default_supported_interfaces;
/* Link the static list of supported interfaces */
@ -132,20 +137,24 @@ acpi_status acpi_ut_initialize_interfaces(void)
*
* PARAMETERS: None
*
* RETURN: None
* RETURN: Status
*
* DESCRIPTION: Delete all interfaces in the global list. Sets
* acpi_gbl_supported_interfaces to NULL.
*
******************************************************************************/
void acpi_ut_interface_terminate(void)
acpi_status acpi_ut_interface_terminate(void)
{
acpi_status status;
struct acpi_interface_info *next_interface;
(void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
next_interface = acpi_gbl_supported_interfaces;
status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
if (ACPI_FAILURE(status)) {
return (status);
}
next_interface = acpi_gbl_supported_interfaces;
while (next_interface) {
acpi_gbl_supported_interfaces = next_interface->next;
@ -160,6 +169,7 @@ void acpi_ut_interface_terminate(void)
}
acpi_os_release_mutex(acpi_gbl_osi_mutex);
return (AE_OK);
}
/*******************************************************************************
@ -315,6 +325,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state * walk_state)
union acpi_operand_object *return_desc;
struct acpi_interface_info *interface_info;
acpi_interface_handler interface_handler;
acpi_status status;
u32 return_value;
ACPI_FUNCTION_TRACE(ut_osi_implementation);
@ -336,7 +347,10 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state * walk_state)
/* Default return value is 0, NOT SUPPORTED */
return_value = 0;
(void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
if (ACPI_FAILURE(status)) {
return (status);
}
/* Lookup the interface in the global _OSI list */

View file

@ -0,0 +1,399 @@
/******************************************************************************
*
* Module Name: utpredef - support functions for predefined names
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2013, 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/acpi.h>
#include "accommon.h"
#include "acpredef.h"
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME("utpredef")
/*
* Names for the types that can be returned by the predefined objects.
* Used for warning messages. Must be in the same order as the ACPI_RTYPEs
*/
static const char *ut_rtype_names[] = {
"/Integer",
"/String",
"/Buffer",
"/Package",
"/Reference",
};
/*******************************************************************************
*
* FUNCTION: acpi_ut_get_next_predefined_method
*
* PARAMETERS: this_name - Entry in the predefined method/name table
*
* RETURN: Pointer to next entry in predefined table.
*
* DESCRIPTION: Get the next entry in the predefine method table. Handles the
* cases where a package info entry follows a method name that
* returns a package.
*
******************************************************************************/
const union acpi_predefined_info *acpi_ut_get_next_predefined_method(const union
acpi_predefined_info
*this_name)
{
/*
* Skip next entry in the table if this name returns a Package
* (next entry contains the package info)
*/
if ((this_name->info.expected_btypes & ACPI_RTYPE_PACKAGE) &&
(this_name->info.expected_btypes != ACPI_RTYPE_ALL)) {
this_name++;
}
this_name++;
return (this_name);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_match_predefined_method
*
* PARAMETERS: name - Name to find
*
* RETURN: Pointer to entry in predefined table. NULL indicates not found.
*
* DESCRIPTION: Check an object name against the predefined object list.
*
******************************************************************************/
const union acpi_predefined_info *acpi_ut_match_predefined_method(char *name)
{
const union acpi_predefined_info *this_name;
/* Quick check for a predefined name, first character must be underscore */
if (name[0] != '_') {
return (NULL);
}
/* Search info table for a predefined method/object name */
this_name = acpi_gbl_predefined_methods;
while (this_name->info.name[0]) {
if (ACPI_COMPARE_NAME(name, this_name->info.name)) {
return (this_name);
}
this_name = acpi_ut_get_next_predefined_method(this_name);
}
return (NULL); /* Not found */
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_get_expected_return_types
*
* PARAMETERS: buffer - Where the formatted string is returned
* expected_Btypes - Bitfield of expected data types
*
* RETURN: Formatted string in Buffer.
*
* DESCRIPTION: Format the expected object types into a printable string.
*
******************************************************************************/
void acpi_ut_get_expected_return_types(char *buffer, u32 expected_btypes)
{
u32 this_rtype;
u32 i;
u32 j;
j = 1;
buffer[0] = 0;
this_rtype = ACPI_RTYPE_INTEGER;
for (i = 0; i < ACPI_NUM_RTYPES; i++) {
/* If one of the expected types, concatenate the name of this type */
if (expected_btypes & this_rtype) {
ACPI_STRCAT(buffer, &ut_rtype_names[i][j]);
j = 0; /* Use name separator from now on */
}
this_rtype <<= 1; /* Next Rtype */
}
}
/*******************************************************************************
*
* The remaining functions are used by iASL and acpi_help only
*
******************************************************************************/
#if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP)
#include <stdio.h>
#include <string.h>
/* Local prototypes */
static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types);
/* Types that can be returned externally by a predefined name */
static const char *ut_external_type_names[] = /* Indexed by ACPI_TYPE_* */
{
", UNSUPPORTED-TYPE",
", Integer",
", String",
", Buffer",
", Package"
};
/* Bit widths for resource descriptor predefined names */
static const char *ut_resource_type_names[] = {
"/1",
"/2",
"/3",
"/8",
"/16",
"/32",
"/64",
"/variable",
};
/*******************************************************************************
*
* FUNCTION: acpi_ut_match_resource_name
*
* PARAMETERS: name - Name to find
*
* RETURN: Pointer to entry in the resource table. NULL indicates not
* found.
*
* DESCRIPTION: Check an object name against the predefined resource
* descriptor object list.
*
******************************************************************************/
const union acpi_predefined_info *acpi_ut_match_resource_name(char *name)
{
const union acpi_predefined_info *this_name;
/* Quick check for a predefined name, first character must be underscore */
if (name[0] != '_') {
return (NULL);
}
/* Search info table for a predefined method/object name */
this_name = acpi_gbl_resource_names;
while (this_name->info.name[0]) {
if (ACPI_COMPARE_NAME(name, this_name->info.name)) {
return (this_name);
}
this_name++;
}
return (NULL); /* Not found */
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_display_predefined_method
*
* PARAMETERS: buffer - Scratch buffer for this function
* this_name - Entry in the predefined method/name table
* multi_line - TRUE if output should be on >1 line
*
* RETURN: None
*
* DESCRIPTION: Display information about a predefined method. Number and
* type of the input arguments, and expected type(s) for the
* return value, if any.
*
******************************************************************************/
void
acpi_ut_display_predefined_method(char *buffer,
const union acpi_predefined_info *this_name,
u8 multi_line)
{
u32 arg_count;
/*
* Get the argument count and the string buffer
* containing all argument types
*/
arg_count = acpi_ut_get_argument_types(buffer,
this_name->info.argument_list);
if (multi_line) {
printf(" ");
}
printf("%4.4s Requires %s%u argument%s",
this_name->info.name,
(this_name->info.argument_list & ARG_COUNT_IS_MINIMUM) ?
"(at least) " : "", arg_count, arg_count != 1 ? "s" : "");
/* Display the types for any arguments */
if (arg_count > 0) {
printf(" (%s)", buffer);
}
if (multi_line) {
printf("\n ");
}
/* Get the return value type(s) allowed */
if (this_name->info.expected_btypes) {
acpi_ut_get_expected_return_types(buffer,
this_name->info.
expected_btypes);
printf(" Return value types: %s\n", buffer);
} else {
printf(" No return value\n");
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_get_argument_types
*
* PARAMETERS: buffer - Where to return the formatted types
* argument_types - Types field for this method
*
* RETURN: count - the number of arguments required for this method
*
* DESCRIPTION: Format the required data types for this method (Integer,
* String, Buffer, or Package) and return the required argument
* count.
*
******************************************************************************/
static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types)
{
u16 this_argument_type;
u16 sub_index;
u16 arg_count;
u32 i;
*buffer = 0;
sub_index = 2;
/* First field in the types list is the count of args to follow */
arg_count = (argument_types & METHOD_ARG_MASK);
argument_types >>= METHOD_ARG_BIT_WIDTH;
if (arg_count > METHOD_PREDEF_ARGS_MAX) {
printf("**** Invalid argument count (%u) "
"in predefined info structure\n", arg_count);
return (arg_count);
}
/* Get each argument from the list, convert to ascii, store to buffer */
for (i = 0; i < arg_count; i++) {
this_argument_type = (argument_types & METHOD_ARG_MASK);
if (!this_argument_type
|| (this_argument_type > METHOD_MAX_ARG_TYPE)) {
printf("**** Invalid argument type (%u) "
"in predefined info structure\n",
this_argument_type);
return (arg_count);
}
strcat(buffer,
ut_external_type_names[this_argument_type] + sub_index);
/* Shift to next argument type field */
argument_types >>= METHOD_ARG_BIT_WIDTH;
sub_index = 0;
}
return (arg_count);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_get_resource_bit_width
*
* PARAMETERS: buffer - Where the formatted string is returned
* types - Bitfield of expected data types
*
* RETURN: Count of return types. Formatted string in Buffer.
*
* DESCRIPTION: Format the resource bit widths into a printable string.
*
******************************************************************************/
u32 acpi_ut_get_resource_bit_width(char *buffer, u16 types)
{
u32 i;
u16 sub_index;
u32 found;
*buffer = 0;
sub_index = 1;
found = 0;
for (i = 0; i < NUM_RESOURCE_WIDTHS; i++) {
if (types & 1) {
strcat(buffer, &(ut_resource_type_names[i][sub_index]));
sub_index = 0;
found++;
}
types >>= 1;
}
return (found);
}
#endif

View file

@ -287,7 +287,10 @@ acpi_status acpi_install_interface(acpi_string interface_name)
return (AE_BAD_PARAMETER);
}
(void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
if (ACPI_FAILURE(status)) {
return (status);
}
/* Check if the interface name is already in the global list */
@ -336,7 +339,10 @@ acpi_status acpi_remove_interface(acpi_string interface_name)
return (AE_BAD_PARAMETER);
}
(void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
if (ACPI_FAILURE(status)) {
return (status);
}
status = acpi_ut_remove_interface(interface_name);
@ -362,9 +368,12 @@ ACPI_EXPORT_SYMBOL(acpi_remove_interface)
****************************************************************************/
acpi_status acpi_install_interface_handler(acpi_interface_handler handler)
{
acpi_status status = AE_OK;
acpi_status status;
(void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
if (ACPI_FAILURE(status)) {
return (status);
}
if (handler && acpi_gbl_interface_handler) {
status = AE_ALREADY_EXISTS;

View file

@ -354,6 +354,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
}
resource->end.type = ACPI_RESOURCE_TYPE_END_TAG;
resource->end.length = sizeof(struct acpi_resource);
/* Attempt to set the resource */
status = acpi_set_current_resources(link->device->handle, &buffer);

View file

@ -4121,7 +4121,7 @@ static int sony_pic_enable(struct acpi_device *device,
resource->res3.data.irq.sharable = ACPI_SHARED;
resource->res4.type = ACPI_RESOURCE_TYPE_END_TAG;
resource->res4.length = sizeof(struct acpi_resource);
}
/* setup Type 2/3 resources */
else {
@ -4140,6 +4140,7 @@ static int sony_pic_enable(struct acpi_device *device,
resource->res2.data.irq.sharable = ACPI_SHARED;
resource->res3.type = ACPI_RESOURCE_TYPE_END_TAG;
resource->res3.length = sizeof(struct acpi_resource);
}
/* Attempt to set the resource */

View file

@ -634,6 +634,7 @@ int pnpacpi_build_resource_template(struct pnp_dev *dev,
}
/* resource will pointer the end resource now */
resource->type = ACPI_RESOURCE_TYPE_END_TAG;
resource->length = sizeof(struct acpi_resource);
return 0;
}

View file

@ -44,17 +44,50 @@
#ifndef __ACEXCEP_H__
#define __ACEXCEP_H__
/* This module contains all possible exception codes for acpi_status */
/*
* Exceptions returned by external ACPI interfaces
* Exception code classes
*/
#define AE_CODE_ENVIRONMENTAL 0x0000
#define AE_CODE_PROGRAMMER 0x1000
#define AE_CODE_ACPI_TABLES 0x2000
#define AE_CODE_AML 0x3000
#define AE_CODE_CONTROL 0x4000
#define AE_CODE_ENVIRONMENTAL 0x0000 /* General ACPICA environment */
#define AE_CODE_PROGRAMMER 0x1000 /* External ACPICA interface caller */
#define AE_CODE_ACPI_TABLES 0x2000 /* ACPI tables */
#define AE_CODE_AML 0x3000 /* From executing AML code */
#define AE_CODE_CONTROL 0x4000 /* Internal control codes */
#define AE_CODE_MAX 0x4000
#define AE_CODE_MASK 0xF000
/*
* Macros to insert the exception code classes
*/
#define EXCEP_ENV(code) ((acpi_status) (code | AE_CODE_ENVIRONMENTAL))
#define EXCEP_PGM(code) ((acpi_status) (code | AE_CODE_PROGRAMMER))
#define EXCEP_TBL(code) ((acpi_status) (code | AE_CODE_ACPI_TABLES))
#define EXCEP_AML(code) ((acpi_status) (code | AE_CODE_AML))
#define EXCEP_CTL(code) ((acpi_status) (code | AE_CODE_CONTROL))
/*
* Exception info table. The "Description" field is used only by the
* ACPICA help application (acpihelp).
*/
struct acpi_exception_info {
char *name;
#ifdef ACPI_HELP_APP
char *description;
#endif
};
#ifdef ACPI_HELP_APP
#define EXCEP_TXT(name,description) {name, description}
#else
#define EXCEP_TXT(name,description) {name}
#endif
/*
* Success is always zero, failure is non-zero
*/
#define ACPI_SUCCESS(a) (!(a))
#define ACPI_FAILURE(a) (a)
@ -64,60 +97,60 @@
/*
* Environmental exceptions
*/
#define AE_ERROR (acpi_status) (0x0001 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_ACPI_TABLES (acpi_status) (0x0002 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_NAMESPACE (acpi_status) (0x0003 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_MEMORY (acpi_status) (0x0004 | AE_CODE_ENVIRONMENTAL)
#define AE_NOT_FOUND (acpi_status) (0x0005 | AE_CODE_ENVIRONMENTAL)
#define AE_NOT_EXIST (acpi_status) (0x0006 | AE_CODE_ENVIRONMENTAL)
#define AE_ALREADY_EXISTS (acpi_status) (0x0007 | AE_CODE_ENVIRONMENTAL)
#define AE_TYPE (acpi_status) (0x0008 | AE_CODE_ENVIRONMENTAL)
#define AE_NULL_OBJECT (acpi_status) (0x0009 | AE_CODE_ENVIRONMENTAL)
#define AE_NULL_ENTRY (acpi_status) (0x000A | AE_CODE_ENVIRONMENTAL)
#define AE_BUFFER_OVERFLOW (acpi_status) (0x000B | AE_CODE_ENVIRONMENTAL)
#define AE_STACK_OVERFLOW (acpi_status) (0x000C | AE_CODE_ENVIRONMENTAL)
#define AE_STACK_UNDERFLOW (acpi_status) (0x000D | AE_CODE_ENVIRONMENTAL)
#define AE_NOT_IMPLEMENTED (acpi_status) (0x000E | AE_CODE_ENVIRONMENTAL)
#define AE_SUPPORT (acpi_status) (0x000F | AE_CODE_ENVIRONMENTAL)
#define AE_LIMIT (acpi_status) (0x0010 | AE_CODE_ENVIRONMENTAL)
#define AE_TIME (acpi_status) (0x0011 | AE_CODE_ENVIRONMENTAL)
#define AE_ACQUIRE_DEADLOCK (acpi_status) (0x0012 | AE_CODE_ENVIRONMENTAL)
#define AE_RELEASE_DEADLOCK (acpi_status) (0x0013 | AE_CODE_ENVIRONMENTAL)
#define AE_NOT_ACQUIRED (acpi_status) (0x0014 | AE_CODE_ENVIRONMENTAL)
#define AE_ALREADY_ACQUIRED (acpi_status) (0x0015 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_HARDWARE_RESPONSE (acpi_status) (0x0016 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_GLOBAL_LOCK (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL)
#define AE_ABORT_METHOD (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL)
#define AE_SAME_HANDLER (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_HANDLER (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
#define AE_OWNER_ID_LIMIT (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL)
#define AE_NOT_CONFIGURED (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL)
#define AE_ERROR EXCEP_ENV (0x0001)
#define AE_NO_ACPI_TABLES EXCEP_ENV (0x0002)
#define AE_NO_NAMESPACE EXCEP_ENV (0x0003)
#define AE_NO_MEMORY EXCEP_ENV (0x0004)
#define AE_NOT_FOUND EXCEP_ENV (0x0005)
#define AE_NOT_EXIST EXCEP_ENV (0x0006)
#define AE_ALREADY_EXISTS EXCEP_ENV (0x0007)
#define AE_TYPE EXCEP_ENV (0x0008)
#define AE_NULL_OBJECT EXCEP_ENV (0x0009)
#define AE_NULL_ENTRY EXCEP_ENV (0x000A)
#define AE_BUFFER_OVERFLOW EXCEP_ENV (0x000B)
#define AE_STACK_OVERFLOW EXCEP_ENV (0x000C)
#define AE_STACK_UNDERFLOW EXCEP_ENV (0x000D)
#define AE_NOT_IMPLEMENTED EXCEP_ENV (0x000E)
#define AE_SUPPORT EXCEP_ENV (0x000F)
#define AE_LIMIT EXCEP_ENV (0x0010)
#define AE_TIME EXCEP_ENV (0x0011)
#define AE_ACQUIRE_DEADLOCK EXCEP_ENV (0x0012)
#define AE_RELEASE_DEADLOCK EXCEP_ENV (0x0013)
#define AE_NOT_ACQUIRED EXCEP_ENV (0x0014)
#define AE_ALREADY_ACQUIRED EXCEP_ENV (0x0015)
#define AE_NO_HARDWARE_RESPONSE EXCEP_ENV (0x0016)
#define AE_NO_GLOBAL_LOCK EXCEP_ENV (0x0017)
#define AE_ABORT_METHOD EXCEP_ENV (0x0018)
#define AE_SAME_HANDLER EXCEP_ENV (0x0019)
#define AE_NO_HANDLER EXCEP_ENV (0x001A)
#define AE_OWNER_ID_LIMIT EXCEP_ENV (0x001B)
#define AE_NOT_CONFIGURED EXCEP_ENV (0x001C)
#define AE_CODE_ENV_MAX 0x001C
/*
* Programmer exceptions
*/
#define AE_BAD_PARAMETER (acpi_status) (0x0001 | AE_CODE_PROGRAMMER)
#define AE_BAD_CHARACTER (acpi_status) (0x0002 | AE_CODE_PROGRAMMER)
#define AE_BAD_PATHNAME (acpi_status) (0x0003 | AE_CODE_PROGRAMMER)
#define AE_BAD_DATA (acpi_status) (0x0004 | AE_CODE_PROGRAMMER)
#define AE_BAD_HEX_CONSTANT (acpi_status) (0x0005 | AE_CODE_PROGRAMMER)
#define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER)
#define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER)
#define AE_MISSING_ARGUMENTS (acpi_status) (0x0008 | AE_CODE_PROGRAMMER)
#define AE_BAD_ADDRESS (acpi_status) (0x0009 | AE_CODE_PROGRAMMER)
#define AE_BAD_PARAMETER EXCEP_PGM (0x0001)
#define AE_BAD_CHARACTER EXCEP_PGM (0x0002)
#define AE_BAD_PATHNAME EXCEP_PGM (0x0003)
#define AE_BAD_DATA EXCEP_PGM (0x0004)
#define AE_BAD_HEX_CONSTANT EXCEP_PGM (0x0005)
#define AE_BAD_OCTAL_CONSTANT EXCEP_PGM (0x0006)
#define AE_BAD_DECIMAL_CONSTANT EXCEP_PGM (0x0007)
#define AE_MISSING_ARGUMENTS EXCEP_PGM (0x0008)
#define AE_BAD_ADDRESS EXCEP_PGM (0x0009)
#define AE_CODE_PGM_MAX 0x0009
/*
* Acpi table exceptions
*/
#define AE_BAD_SIGNATURE (acpi_status) (0x0001 | AE_CODE_ACPI_TABLES)
#define AE_BAD_HEADER (acpi_status) (0x0002 | AE_CODE_ACPI_TABLES)
#define AE_BAD_CHECKSUM (acpi_status) (0x0003 | AE_CODE_ACPI_TABLES)
#define AE_BAD_VALUE (acpi_status) (0x0004 | AE_CODE_ACPI_TABLES)
#define AE_INVALID_TABLE_LENGTH (acpi_status) (0x0005 | AE_CODE_ACPI_TABLES)
#define AE_BAD_SIGNATURE EXCEP_TBL (0x0001)
#define AE_BAD_HEADER EXCEP_TBL (0x0002)
#define AE_BAD_CHECKSUM EXCEP_TBL (0x0003)
#define AE_BAD_VALUE EXCEP_TBL (0x0004)
#define AE_INVALID_TABLE_LENGTH EXCEP_TBL (0x0005)
#define AE_CODE_TBL_MAX 0x0005
@ -125,58 +158,58 @@
* AML exceptions. These are caused by problems with
* the actual AML byte stream
*/
#define AE_AML_BAD_OPCODE (acpi_status) (0x0001 | AE_CODE_AML)
#define AE_AML_NO_OPERAND (acpi_status) (0x0002 | AE_CODE_AML)
#define AE_AML_OPERAND_TYPE (acpi_status) (0x0003 | AE_CODE_AML)
#define AE_AML_OPERAND_VALUE (acpi_status) (0x0004 | AE_CODE_AML)
#define AE_AML_UNINITIALIZED_LOCAL (acpi_status) (0x0005 | AE_CODE_AML)
#define AE_AML_UNINITIALIZED_ARG (acpi_status) (0x0006 | AE_CODE_AML)
#define AE_AML_UNINITIALIZED_ELEMENT (acpi_status) (0x0007 | AE_CODE_AML)
#define AE_AML_NUMERIC_OVERFLOW (acpi_status) (0x0008 | AE_CODE_AML)
#define AE_AML_REGION_LIMIT (acpi_status) (0x0009 | AE_CODE_AML)
#define AE_AML_BUFFER_LIMIT (acpi_status) (0x000A | AE_CODE_AML)
#define AE_AML_PACKAGE_LIMIT (acpi_status) (0x000B | AE_CODE_AML)
#define AE_AML_DIVIDE_BY_ZERO (acpi_status) (0x000C | AE_CODE_AML)
#define AE_AML_BAD_NAME (acpi_status) (0x000D | AE_CODE_AML)
#define AE_AML_NAME_NOT_FOUND (acpi_status) (0x000E | AE_CODE_AML)
#define AE_AML_INTERNAL (acpi_status) (0x000F | AE_CODE_AML)
#define AE_AML_INVALID_SPACE_ID (acpi_status) (0x0010 | AE_CODE_AML)
#define AE_AML_STRING_LIMIT (acpi_status) (0x0011 | AE_CODE_AML)
#define AE_AML_NO_RETURN_VALUE (acpi_status) (0x0012 | AE_CODE_AML)
#define AE_AML_METHOD_LIMIT (acpi_status) (0x0013 | AE_CODE_AML)
#define AE_AML_NOT_OWNER (acpi_status) (0x0014 | AE_CODE_AML)
#define AE_AML_MUTEX_ORDER (acpi_status) (0x0015 | AE_CODE_AML)
#define AE_AML_MUTEX_NOT_ACQUIRED (acpi_status) (0x0016 | AE_CODE_AML)
#define AE_AML_INVALID_RESOURCE_TYPE (acpi_status) (0x0017 | AE_CODE_AML)
#define AE_AML_INVALID_INDEX (acpi_status) (0x0018 | AE_CODE_AML)
#define AE_AML_REGISTER_LIMIT (acpi_status) (0x0019 | AE_CODE_AML)
#define AE_AML_NO_WHILE (acpi_status) (0x001A | AE_CODE_AML)
#define AE_AML_ALIGNMENT (acpi_status) (0x001B | AE_CODE_AML)
#define AE_AML_NO_RESOURCE_END_TAG (acpi_status) (0x001C | AE_CODE_AML)
#define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001D | AE_CODE_AML)
#define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x001E | AE_CODE_AML)
#define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x001F | AE_CODE_AML)
#define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0020 | AE_CODE_AML)
#define AE_AML_INFINITE_LOOP (acpi_status) (0x0021 | AE_CODE_AML)
#define AE_AML_BAD_OPCODE EXCEP_AML (0x0001)
#define AE_AML_NO_OPERAND EXCEP_AML (0x0002)
#define AE_AML_OPERAND_TYPE EXCEP_AML (0x0003)
#define AE_AML_OPERAND_VALUE EXCEP_AML (0x0004)
#define AE_AML_UNINITIALIZED_LOCAL EXCEP_AML (0x0005)
#define AE_AML_UNINITIALIZED_ARG EXCEP_AML (0x0006)
#define AE_AML_UNINITIALIZED_ELEMENT EXCEP_AML (0x0007)
#define AE_AML_NUMERIC_OVERFLOW EXCEP_AML (0x0008)
#define AE_AML_REGION_LIMIT EXCEP_AML (0x0009)
#define AE_AML_BUFFER_LIMIT EXCEP_AML (0x000A)
#define AE_AML_PACKAGE_LIMIT EXCEP_AML (0x000B)
#define AE_AML_DIVIDE_BY_ZERO EXCEP_AML (0x000C)
#define AE_AML_BAD_NAME EXCEP_AML (0x000D)
#define AE_AML_NAME_NOT_FOUND EXCEP_AML (0x000E)
#define AE_AML_INTERNAL EXCEP_AML (0x000F)
#define AE_AML_INVALID_SPACE_ID EXCEP_AML (0x0010)
#define AE_AML_STRING_LIMIT EXCEP_AML (0x0011)
#define AE_AML_NO_RETURN_VALUE EXCEP_AML (0x0012)
#define AE_AML_METHOD_LIMIT EXCEP_AML (0x0013)
#define AE_AML_NOT_OWNER EXCEP_AML (0x0014)
#define AE_AML_MUTEX_ORDER EXCEP_AML (0x0015)
#define AE_AML_MUTEX_NOT_ACQUIRED EXCEP_AML (0x0016)
#define AE_AML_INVALID_RESOURCE_TYPE EXCEP_AML (0x0017)
#define AE_AML_INVALID_INDEX EXCEP_AML (0x0018)
#define AE_AML_REGISTER_LIMIT EXCEP_AML (0x0019)
#define AE_AML_NO_WHILE EXCEP_AML (0x001A)
#define AE_AML_ALIGNMENT EXCEP_AML (0x001B)
#define AE_AML_NO_RESOURCE_END_TAG EXCEP_AML (0x001C)
#define AE_AML_BAD_RESOURCE_VALUE EXCEP_AML (0x001D)
#define AE_AML_CIRCULAR_REFERENCE EXCEP_AML (0x001E)
#define AE_AML_BAD_RESOURCE_LENGTH EXCEP_AML (0x001F)
#define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020)
#define AE_AML_INFINITE_LOOP EXCEP_AML (0x0021)
#define AE_CODE_AML_MAX 0x0021
/*
* Internal exceptions used for control
*/
#define AE_CTRL_RETURN_VALUE (acpi_status) (0x0001 | AE_CODE_CONTROL)
#define AE_CTRL_PENDING (acpi_status) (0x0002 | AE_CODE_CONTROL)
#define AE_CTRL_TERMINATE (acpi_status) (0x0003 | AE_CODE_CONTROL)
#define AE_CTRL_TRUE (acpi_status) (0x0004 | AE_CODE_CONTROL)
#define AE_CTRL_FALSE (acpi_status) (0x0005 | AE_CODE_CONTROL)
#define AE_CTRL_DEPTH (acpi_status) (0x0006 | AE_CODE_CONTROL)
#define AE_CTRL_END (acpi_status) (0x0007 | AE_CODE_CONTROL)
#define AE_CTRL_TRANSFER (acpi_status) (0x0008 | AE_CODE_CONTROL)
#define AE_CTRL_BREAK (acpi_status) (0x0009 | AE_CODE_CONTROL)
#define AE_CTRL_CONTINUE (acpi_status) (0x000A | AE_CODE_CONTROL)
#define AE_CTRL_SKIP (acpi_status) (0x000B | AE_CODE_CONTROL)
#define AE_CTRL_PARSE_CONTINUE (acpi_status) (0x000C | AE_CODE_CONTROL)
#define AE_CTRL_PARSE_PENDING (acpi_status) (0x000D | AE_CODE_CONTROL)
#define AE_CTRL_RETURN_VALUE EXCEP_CTL (0x0001)
#define AE_CTRL_PENDING EXCEP_CTL (0x0002)
#define AE_CTRL_TERMINATE EXCEP_CTL (0x0003)
#define AE_CTRL_TRUE EXCEP_CTL (0x0004)
#define AE_CTRL_FALSE EXCEP_CTL (0x0005)
#define AE_CTRL_DEPTH EXCEP_CTL (0x0006)
#define AE_CTRL_END EXCEP_CTL (0x0007)
#define AE_CTRL_TRANSFER EXCEP_CTL (0x0008)
#define AE_CTRL_BREAK EXCEP_CTL (0x0009)
#define AE_CTRL_CONTINUE EXCEP_CTL (0x000A)
#define AE_CTRL_SKIP EXCEP_CTL (0x000B)
#define AE_CTRL_PARSE_CONTINUE EXCEP_CTL (0x000C)
#define AE_CTRL_PARSE_PENDING EXCEP_CTL (0x000D)
#define AE_CODE_CTRL_MAX 0x000D
@ -188,112 +221,156 @@
* String versions of the exception codes above
* These strings must match the corresponding defines exactly
*/
char const *acpi_gbl_exception_names_env[] = {
"AE_OK",
"AE_ERROR",
"AE_NO_ACPI_TABLES",
"AE_NO_NAMESPACE",
"AE_NO_MEMORY",
"AE_NOT_FOUND",
"AE_NOT_EXIST",
"AE_ALREADY_EXISTS",
"AE_TYPE",
"AE_NULL_OBJECT",
"AE_NULL_ENTRY",
"AE_BUFFER_OVERFLOW",
"AE_STACK_OVERFLOW",
"AE_STACK_UNDERFLOW",
"AE_NOT_IMPLEMENTED",
"AE_SUPPORT",
"AE_LIMIT",
"AE_TIME",
"AE_ACQUIRE_DEADLOCK",
"AE_RELEASE_DEADLOCK",
"AE_NOT_ACQUIRED",
"AE_ALREADY_ACQUIRED",
"AE_NO_HARDWARE_RESPONSE",
"AE_NO_GLOBAL_LOCK",
"AE_ABORT_METHOD",
"AE_SAME_HANDLER",
"AE_NO_HANDLER",
"AE_OWNER_ID_LIMIT",
"AE_NOT_CONFIGURED"
static const struct acpi_exception_info acpi_gbl_exception_names_env[] = {
EXCEP_TXT("AE_OK", "No error"),
EXCEP_TXT("AE_ERROR", "Unspecified error"),
EXCEP_TXT("AE_NO_ACPI_TABLES", "ACPI tables could not be found"),
EXCEP_TXT("AE_NO_NAMESPACE", "A namespace has not been loaded"),
EXCEP_TXT("AE_NO_MEMORY", "Insufficient dynamic memory"),
EXCEP_TXT("AE_NOT_FOUND", "The name was not found in the namespace"),
EXCEP_TXT("AE_NOT_EXIST", "A required entity does not exist"),
EXCEP_TXT("AE_ALREADY_EXISTS", "An entity already exists"),
EXCEP_TXT("AE_TYPE", "The object type is incorrect"),
EXCEP_TXT("AE_NULL_OBJECT", "A required object was missing"),
EXCEP_TXT("AE_NULL_ENTRY", "The requested object does not exist"),
EXCEP_TXT("AE_BUFFER_OVERFLOW", "The buffer provided is too small"),
EXCEP_TXT("AE_STACK_OVERFLOW", "An internal stack overflowed"),
EXCEP_TXT("AE_STACK_UNDERFLOW", "An internal stack underflowed"),
EXCEP_TXT("AE_NOT_IMPLEMENTED", "The feature is not implemented"),
EXCEP_TXT("AE_SUPPORT", "The feature is not supported"),
EXCEP_TXT("AE_LIMIT", "A predefined limit was exceeded"),
EXCEP_TXT("AE_TIME", "A time limit or timeout expired"),
EXCEP_TXT("AE_ACQUIRE_DEADLOCK",
"Internal error, attempt was made to acquire a mutex in improper order"),
EXCEP_TXT("AE_RELEASE_DEADLOCK",
"Internal error, attempt was made to release a mutex in improper order"),
EXCEP_TXT("AE_NOT_ACQUIRED",
"An attempt to release a mutex or Global Lock without a previous acquire"),
EXCEP_TXT("AE_ALREADY_ACQUIRED",
"Internal error, attempt was made to acquire a mutex twice"),
EXCEP_TXT("AE_NO_HARDWARE_RESPONSE",
"Hardware did not respond after an I/O operation"),
EXCEP_TXT("AE_NO_GLOBAL_LOCK", "There is no FACS Global Lock"),
EXCEP_TXT("AE_ABORT_METHOD", "A control method was aborted"),
EXCEP_TXT("AE_SAME_HANDLER",
"Attempt was made to install the same handler that is already installed"),
EXCEP_TXT("AE_NO_HANDLER",
"A handler for the operation is not installed"),
EXCEP_TXT("AE_OWNER_ID_LIMIT",
"There are no more Owner IDs available for ACPI tables or control methods"),
EXCEP_TXT("AE_NOT_CONFIGURED",
"The interface is not part of the current subsystem configuration")
};
char const *acpi_gbl_exception_names_pgm[] = {
NULL,
"AE_BAD_PARAMETER",
"AE_BAD_CHARACTER",
"AE_BAD_PATHNAME",
"AE_BAD_DATA",
"AE_BAD_HEX_CONSTANT",
"AE_BAD_OCTAL_CONSTANT",
"AE_BAD_DECIMAL_CONSTANT",
"AE_MISSING_ARGUMENTS",
"AE_BAD_ADDRESS"
static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = {
EXCEP_TXT(NULL, NULL),
EXCEP_TXT("AE_BAD_PARAMETER", "A parameter is out of range or invalid"),
EXCEP_TXT("AE_BAD_CHARACTER",
"An invalid character was found in a name"),
EXCEP_TXT("AE_BAD_PATHNAME",
"An invalid character was found in a pathname"),
EXCEP_TXT("AE_BAD_DATA",
"A package or buffer contained incorrect data"),
EXCEP_TXT("AE_BAD_HEX_CONSTANT", "Invalid character in a Hex constant"),
EXCEP_TXT("AE_BAD_OCTAL_CONSTANT",
"Invalid character in an Octal constant"),
EXCEP_TXT("AE_BAD_DECIMAL_CONSTANT",
"Invalid character in a Decimal constant"),
EXCEP_TXT("AE_MISSING_ARGUMENTS",
"Too few arguments were passed to a control method"),
EXCEP_TXT("AE_BAD_ADDRESS", "An illegal null I/O address")
};
char const *acpi_gbl_exception_names_tbl[] = {
NULL,
"AE_BAD_SIGNATURE",
"AE_BAD_HEADER",
"AE_BAD_CHECKSUM",
"AE_BAD_VALUE",
"AE_INVALID_TABLE_LENGTH"
static const struct acpi_exception_info acpi_gbl_exception_names_tbl[] = {
EXCEP_TXT(NULL, NULL),
EXCEP_TXT("AE_BAD_SIGNATURE", "An ACPI table has an invalid signature"),
EXCEP_TXT("AE_BAD_HEADER", "Invalid field in an ACPI table header"),
EXCEP_TXT("AE_BAD_CHECKSUM", "An ACPI table checksum is not correct"),
EXCEP_TXT("AE_BAD_VALUE", "An invalid value was found in a table"),
EXCEP_TXT("AE_INVALID_TABLE_LENGTH",
"The FADT or FACS has improper length")
};
char const *acpi_gbl_exception_names_aml[] = {
NULL,
"AE_AML_BAD_OPCODE",
"AE_AML_NO_OPERAND",
"AE_AML_OPERAND_TYPE",
"AE_AML_OPERAND_VALUE",
"AE_AML_UNINITIALIZED_LOCAL",
"AE_AML_UNINITIALIZED_ARG",
"AE_AML_UNINITIALIZED_ELEMENT",
"AE_AML_NUMERIC_OVERFLOW",
"AE_AML_REGION_LIMIT",
"AE_AML_BUFFER_LIMIT",
"AE_AML_PACKAGE_LIMIT",
"AE_AML_DIVIDE_BY_ZERO",
"AE_AML_BAD_NAME",
"AE_AML_NAME_NOT_FOUND",
"AE_AML_INTERNAL",
"AE_AML_INVALID_SPACE_ID",
"AE_AML_STRING_LIMIT",
"AE_AML_NO_RETURN_VALUE",
"AE_AML_METHOD_LIMIT",
"AE_AML_NOT_OWNER",
"AE_AML_MUTEX_ORDER",
"AE_AML_MUTEX_NOT_ACQUIRED",
"AE_AML_INVALID_RESOURCE_TYPE",
"AE_AML_INVALID_INDEX",
"AE_AML_REGISTER_LIMIT",
"AE_AML_NO_WHILE",
"AE_AML_ALIGNMENT",
"AE_AML_NO_RESOURCE_END_TAG",
"AE_AML_BAD_RESOURCE_VALUE",
"AE_AML_CIRCULAR_REFERENCE",
"AE_AML_BAD_RESOURCE_LENGTH",
"AE_AML_ILLEGAL_ADDRESS",
"AE_AML_INFINITE_LOOP"
static const struct acpi_exception_info acpi_gbl_exception_names_aml[] = {
EXCEP_TXT(NULL, NULL),
EXCEP_TXT("AE_AML_BAD_OPCODE", "Invalid AML opcode encountered"),
EXCEP_TXT("AE_AML_NO_OPERAND", "A required operand is missing"),
EXCEP_TXT("AE_AML_OPERAND_TYPE",
"An operand of an incorrect type was encountered"),
EXCEP_TXT("AE_AML_OPERAND_VALUE",
"The operand had an inappropriate or invalid value"),
EXCEP_TXT("AE_AML_UNINITIALIZED_LOCAL",
"Method tried to use an uninitialized local variable"),
EXCEP_TXT("AE_AML_UNINITIALIZED_ARG",
"Method tried to use an uninitialized argument"),
EXCEP_TXT("AE_AML_UNINITIALIZED_ELEMENT",
"Method tried to use an empty package element"),
EXCEP_TXT("AE_AML_NUMERIC_OVERFLOW",
"Overflow during BCD conversion or other"),
EXCEP_TXT("AE_AML_REGION_LIMIT",
"Tried to access beyond the end of an Operation Region"),
EXCEP_TXT("AE_AML_BUFFER_LIMIT",
"Tried to access beyond the end of a buffer"),
EXCEP_TXT("AE_AML_PACKAGE_LIMIT",
"Tried to access beyond the end of a package"),
EXCEP_TXT("AE_AML_DIVIDE_BY_ZERO",
"During execution of AML Divide operator"),
EXCEP_TXT("AE_AML_BAD_NAME",
"An ACPI name contains invalid character(s)"),
EXCEP_TXT("AE_AML_NAME_NOT_FOUND",
"Could not resolve a named reference"),
EXCEP_TXT("AE_AML_INTERNAL", "An internal error within the interprete"),
EXCEP_TXT("AE_AML_INVALID_SPACE_ID",
"An Operation Region SpaceID is invalid"),
EXCEP_TXT("AE_AML_STRING_LIMIT",
"String is longer than 200 characters"),
EXCEP_TXT("AE_AML_NO_RETURN_VALUE",
"A method did not return a required value"),
EXCEP_TXT("AE_AML_METHOD_LIMIT",
"A control method reached the maximum reentrancy limit of 255"),
EXCEP_TXT("AE_AML_NOT_OWNER",
"A thread tried to release a mutex that it does not own"),
EXCEP_TXT("AE_AML_MUTEX_ORDER", "Mutex SyncLevel release mismatch"),
EXCEP_TXT("AE_AML_MUTEX_NOT_ACQUIRED",
"Attempt to release a mutex that was not previously acquired"),
EXCEP_TXT("AE_AML_INVALID_RESOURCE_TYPE",
"Invalid resource type in resource list"),
EXCEP_TXT("AE_AML_INVALID_INDEX",
"Invalid Argx or Localx (x too large)"),
EXCEP_TXT("AE_AML_REGISTER_LIMIT",
"Bank value or Index value beyond range of register"),
EXCEP_TXT("AE_AML_NO_WHILE", "Break or Continue without a While"),
EXCEP_TXT("AE_AML_ALIGNMENT",
"Non-aligned memory transfer on platform that does not support this"),
EXCEP_TXT("AE_AML_NO_RESOURCE_END_TAG",
"No End Tag in a resource list"),
EXCEP_TXT("AE_AML_BAD_RESOURCE_VALUE",
"Invalid value of a resource element"),
EXCEP_TXT("AE_AML_CIRCULAR_REFERENCE",
"Two references refer to each other"),
EXCEP_TXT("AE_AML_BAD_RESOURCE_LENGTH",
"The length of a Resource Descriptor in the AML is incorrect"),
EXCEP_TXT("AE_AML_ILLEGAL_ADDRESS",
"A memory, I/O, or PCI configuration address is invalid"),
EXCEP_TXT("AE_AML_INFINITE_LOOP",
"An apparent infinite AML While loop, method was aborted")
};
char const *acpi_gbl_exception_names_ctrl[] = {
NULL,
"AE_CTRL_RETURN_VALUE",
"AE_CTRL_PENDING",
"AE_CTRL_TERMINATE",
"AE_CTRL_TRUE",
"AE_CTRL_FALSE",
"AE_CTRL_DEPTH",
"AE_CTRL_END",
"AE_CTRL_TRANSFER",
"AE_CTRL_BREAK",
"AE_CTRL_CONTINUE",
"AE_CTRL_SKIP",
"AE_CTRL_PARSE_CONTINUE",
"AE_CTRL_PARSE_PENDING"
static const struct acpi_exception_info acpi_gbl_exception_names_ctrl[] = {
EXCEP_TXT(NULL, NULL),
EXCEP_TXT("AE_CTRL_RETURN_VALUE", "A Method returned a value"),
EXCEP_TXT("AE_CTRL_PENDING", "Method is calling another method"),
EXCEP_TXT("AE_CTRL_TERMINATE", "Terminate the executing method"),
EXCEP_TXT("AE_CTRL_TRUE", "An If or While predicate result"),
EXCEP_TXT("AE_CTRL_FALSE", "An If or While predicate result"),
EXCEP_TXT("AE_CTRL_DEPTH", "Maximum search depth has been reached"),
EXCEP_TXT("AE_CTRL_END", "An If or While predicate is false"),
EXCEP_TXT("AE_CTRL_TRANSFER", "Transfer control to called method"),
EXCEP_TXT("AE_CTRL_BREAK", "A Break has been executed"),
EXCEP_TXT("AE_CTRL_CONTINUE", "A Continue has been executed"),
EXCEP_TXT("AE_CTRL_SKIP", "Not currently used"),
EXCEP_TXT("AE_CTRL_PARSE_CONTINUE", "Used to skip over bad opcodes"),
EXCEP_TXT("AE_CTRL_PARSE_PENDING", "Used to implement AML While loops")
};
#endif /* EXCEPTION_TABLE */

View file

@ -324,9 +324,9 @@
/* Helper macro */
#define ACPI_TRACE_ENTRY(name, function, cast, param) \
#define ACPI_TRACE_ENTRY(name, function, type, param) \
ACPI_FUNCTION_NAME (name) \
function (ACPI_DEBUG_PARAMETERS, cast (param))
function (ACPI_DEBUG_PARAMETERS, (type) (param))
/* The actual entry trace macros */
@ -335,13 +335,13 @@
acpi_ut_trace (ACPI_DEBUG_PARAMETERS)
#define ACPI_FUNCTION_TRACE_PTR(name, pointer) \
ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, (void *), pointer)
ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, void *, pointer)
#define ACPI_FUNCTION_TRACE_U32(name, value) \
ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, (u32), value)
ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, u32, value)
#define ACPI_FUNCTION_TRACE_STR(name, string) \
ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, (char *), string)
ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, char *, string)
#define ACPI_FUNCTION_ENTRY() \
acpi_ut_track_stack_ptr()
@ -355,16 +355,37 @@
*
* One of the FUNCTION_TRACE macros above must be used in conjunction
* with these macros so that "_AcpiFunctionName" is defined.
*
* There are two versions of most of the return macros. The default version is
* safer, since it avoids side-effects by guaranteeing that the argument will
* not be evaluated twice.
*
* A less-safe version of the macros is provided for optional use if the
* compiler uses excessive CPU stack (for example, this may happen in the
* debug case if code optimzation is disabled.)
*/
/* Exit trace helper macro */
#define ACPI_TRACE_EXIT(function, cast, param) \
#ifndef ACPI_SIMPLE_RETURN_MACROS
#define ACPI_TRACE_EXIT(function, type, param) \
ACPI_DO_WHILE0 ({ \
function (ACPI_DEBUG_PARAMETERS, cast (param)); \
return ((param)); \
register type _param = (type) (param); \
function (ACPI_DEBUG_PARAMETERS, _param); \
return (_param); \
})
#else /* Use original less-safe macros */
#define ACPI_TRACE_EXIT(function, type, param) \
ACPI_DO_WHILE0 ({ \
function (ACPI_DEBUG_PARAMETERS, (type) (param)); \
return (param); \
})
#endif /* ACPI_SIMPLE_RETURN_MACROS */
/* The actual exit macros */
#define return_VOID \
@ -374,13 +395,19 @@
})
#define return_ACPI_STATUS(status) \
ACPI_TRACE_EXIT (acpi_ut_status_exit, (acpi_status), status)
ACPI_TRACE_EXIT (acpi_ut_status_exit, acpi_status, status)
#define return_PTR(pointer) \
ACPI_TRACE_EXIT (acpi_ut_ptr_exit, (u8 *), pointer)
ACPI_TRACE_EXIT (acpi_ut_ptr_exit, void *, pointer)
#define return_VALUE(value) \
ACPI_TRACE_EXIT (acpi_ut_value_exit, (u64), value)
ACPI_TRACE_EXIT (acpi_ut_value_exit, u64, value)
#define return_UINT32(value) \
ACPI_TRACE_EXIT (acpi_ut_value_exit, u32, value)
#define return_UINT8(value) \
ACPI_TRACE_EXIT (acpi_ut_value_exit, u8, value)
/* Conditional execution */
@ -428,8 +455,10 @@
#define return_VOID return
#define return_ACPI_STATUS(s) return(s)
#define return_VALUE(s) return(s)
#define return_PTR(s) return(s)
#define return_VALUE(s) return(s)
#define return_UINT8(s) return(s)
#define return_UINT32(s) return(s)
#endif /* ACPI_DEBUG_OUTPUT */

View file

@ -46,7 +46,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20130117
#define ACPI_CA_VERSION 0x20130328
#include <acpi/acconfig.h>
#include <acpi/actypes.h>

View file

@ -72,11 +72,13 @@
#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */
#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */
#define ACPI_SIG_MTMR "MTMR" /* MID Timer table */
#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */
#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */
#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */
#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */
#define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */
#define ACPI_SIG_VRTC "VRTC" /* Virtual Real Time Clock Table */
#define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */
#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */
#define ACPI_SIG_WDDT "WDDT" /* Watchdog Timer Description Table */
@ -850,6 +852,29 @@ struct acpi_table_mchi {
u8 pci_function;
};
/*******************************************************************************
*
* MTMR - MID Timer Table
* Version 1
*
* Conforms to "Simple Firmware Interface Specification",
* Draft 0.8.2, Oct 19, 2010
* NOTE: The ACPI MTMR is equivalent to the SFI MTMR table.
*
******************************************************************************/
struct acpi_table_mtmr {
struct acpi_table_header header; /* Common ACPI table header */
};
/* MTMR entry */
struct acpi_mtmr_entry {
struct acpi_generic_address physical_address;
u32 frequency;
u32 irq;
};
/*******************************************************************************
*
* SLIC - Software Licensing Description Table
@ -1023,6 +1048,28 @@ struct acpi_table_uefi {
u16 data_offset; /* Offset of remaining data in table */
};
/*******************************************************************************
*
* VRTC - Virtual Real Time Clock Table
* Version 1
*
* Conforms to "Simple Firmware Interface Specification",
* Draft 0.8.2, Oct 19, 2010
* NOTE: The ACPI VRTC is equivalent to The SFI MRTC table.
*
******************************************************************************/
struct acpi_table_vrtc {
struct acpi_table_header header; /* Common ACPI table header */
};
/* VRTC entry */
struct acpi_vrtc_entry {
struct acpi_generic_address physical_address;
u32 irq;
};
/*******************************************************************************
*
* WAET - Windows ACPI Emulated devices Table

View file

@ -174,7 +174,7 @@ struct acpi_fpdt_header {
enum acpi_fpdt_type {
ACPI_FPDT_TYPE_BOOT = 0,
ACPI_FPDT_TYPE_S3PERF = 1,
ACPI_FPDT_TYPE_S3PERF = 1
};
/*
@ -223,7 +223,7 @@ struct acpi_s3pt_header {
enum acpi_s3pt_type {
ACPI_S3PT_TYPE_RESUME = 0,
ACPI_S3PT_TYPE_SUSPEND = 1,
ACPI_S3PT_TYPE_SUSPEND = 1
};
struct acpi_s3pt_resume {
@ -505,26 +505,59 @@ struct acpi_rasf_shared_memory {
u32 signature;
u16 command;
u16 status;
u64 requested_address;
u64 requested_length;
u64 actual_address;
u64 actual_length;
u16 version;
u8 capabilities[16];
u8 set_capabilities[16];
u16 num_parameter_blocks;
u32 set_capabilities_status;
};
/* RASF Parameter Block Structure Header */
struct acpi_rasf_parameter_block {
u16 type;
u16 version;
u16 length;
};
/* RASF Parameter Block Structure for PATROL_SCRUB */
struct acpi_rasf_patrol_scrub_parameter {
struct acpi_rasf_parameter_block header;
u16 patrol_scrub_command;
u64 requested_address_range[2];
u64 actual_address_range[2];
u16 flags;
u8 speed;
u8 requested_speed;
};
/* Masks for Flags and Speed fields above */
#define ACPI_RASF_SCRUBBER_RUNNING 1
#define ACPI_RASF_SPEED (7<<1)
#define ACPI_RASF_SPEED_SLOW (0<<1)
#define ACPI_RASF_SPEED_MEDIUM (4<<1)
#define ACPI_RASF_SPEED_FAST (7<<1)
/* Channel Commands */
enum acpi_rasf_commands {
ACPI_RASF_GET_RAS_CAPABILITIES = 1,
ACPI_RASF_GET_PATROL_PARAMETERS = 2,
ACPI_RASF_START_PATROL_SCRUBBER = 3,
ACPI_RASF_STOP_PATROL_SCRUBBER = 4
ACPI_RASF_EXECUTE_RASF_COMMAND = 1
};
/* Platform RAS Capabilities */
enum acpi_rasf_capabiliities {
ACPI_HW_PATROL_SCRUB_SUPPORTED = 0,
ACPI_SW_PATROL_SCRUB_EXPOSED = 1
};
/* Patrol Scrub Commands */
enum acpi_rasf_patrol_scrub_commands {
ACPI_RASF_GET_PATROL_PARAMETERS = 1,
ACPI_RASF_START_PATROL_SCRUBBER = 2,
ACPI_RASF_STOP_PATROL_SCRUBBER = 3
};
/* Channel Command flags */

View file

@ -1128,7 +1128,6 @@ struct acpi_memory_list {
u16 object_size;
u16 max_depth;
u16 current_depth;
u16 link_offset;
#ifdef ACPI_DBG_TRACK_ALLOCATIONS