diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2001-01-31 22:22:27 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2001-01-31 22:22:27 +0000 |
commit | 825423e4c4f18289df2393951cfd2a7a31fc0464 (patch) | |
tree | 4ad80e981c3d9effa910d2247d118d254f9a5d09 /drivers/acpi | |
parent | c4693dc4856ab907a5c02187a8d398861bebfc7e (diff) |
Merge with Linux 2.4.1.
Diffstat (limited to 'drivers/acpi')
130 files changed, 3291 insertions, 1980 deletions
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 307cb08ad..e1e0745a4 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -4,7 +4,7 @@ O_TARGET := acpi.o -export-objs := ksyms.o +export-objs := acpi_ksyms.o export ACPI_CFLAGS ACPI_CFLAGS := -D_LINUX @@ -20,18 +20,26 @@ EXTRA_CFLAGS += -I./include EXTRA_CFLAGS += $(ACPI_CFLAGS) +# genksyms only reads $(CFLAGS), it should really read $(EXTRA_CFLAGS) as well. +# Without EXTRA_CFLAGS the gcc pass for genksyms fails, resulting in an empty +# include/linux/modules/acpi_ksyms.ver. Changing genkyms to use EXTRA_CFLAGS +# will hit everything, too risky in 2.4.0-prerelease. Bandaid by tweaking +# CFLAGS only for .ver targets. Review after 2.4.0 release. KAO + +$(MODINCL)/%.ver: CFLAGS := -I./include $(CFLAGS) + acpi-subdirs := common dispatcher events hardware \ interpreter namespace parser resources tables subdir-$(CONFIG_ACPI) += $(acpi-subdirs) obj-$(CONFIG_ACPI) := $(patsubst %,%.o,$(acpi-subdirs)) -obj-$(CONFIG_ACPI) += os.o ksyms.o +obj-$(CONFIG_ACPI) += os.o acpi_ksyms.o ifdef CONFIG_ACPI_KERNEL_CONFIG obj-$(CONFIG_ACPI) += acpiconf.o osconf.o else - obj-$(CONFIG_ACPI) += driver.o cmbatt.o cpu.o ec.o ksyms.o sys.o table.o power.o + obj-$(CONFIG_ACPI) += driver.o cmbatt.o cpu.o ec.o acpi_ksyms.o sys.o table.o power.o endif include $(TOPDIR)/Rules.make diff --git a/drivers/acpi/acpi_ksyms.c b/drivers/acpi/acpi_ksyms.c new file mode 100644 index 000000000..8e1774c9a --- /dev/null +++ b/drivers/acpi/acpi_ksyms.c @@ -0,0 +1,83 @@ +/* + * ksyms.c - ACPI exported symbols + * + * Copyright (C) 2000 Andrew Grover + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <linux/module.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/types.h> +#include <linux/acpi.h> +#include "acpi.h" +#include "acdebug.h" + +extern int acpi_in_debugger; + +#define _COMPONENT OS_DEPENDENT + MODULE_NAME ("symbols") + +#ifdef ENABLE_DEBUGGER +EXPORT_SYMBOL(acpi_in_debugger); +EXPORT_SYMBOL(acpi_db_user_commands); +#endif + +EXPORT_SYMBOL(acpi_os_free); +EXPORT_SYMBOL(acpi_os_breakpoint); +EXPORT_SYMBOL(acpi_os_printf); +EXPORT_SYMBOL(acpi_os_callocate); +EXPORT_SYMBOL(acpi_os_sleep); +EXPORT_SYMBOL(acpi_os_sleep_usec); +EXPORT_SYMBOL(acpi_os_in8); +EXPORT_SYMBOL(acpi_os_out8); +EXPORT_SYMBOL(acpi_os_queue_for_execution); + +EXPORT_SYMBOL(acpi_dbg_layer); +EXPORT_SYMBOL(acpi_dbg_level); +EXPORT_SYMBOL(function_exit); +EXPORT_SYMBOL(function_trace); +EXPORT_SYMBOL(function_status_exit); +EXPORT_SYMBOL(function_value_exit); +EXPORT_SYMBOL(debug_print_raw); +EXPORT_SYMBOL(debug_print_prefix); + +EXPORT_SYMBOL(acpi_cm_strncmp); +EXPORT_SYMBOL(acpi_cm_memcpy); +EXPORT_SYMBOL(acpi_cm_memset); + +EXPORT_SYMBOL(acpi_get_handle); +EXPORT_SYMBOL(acpi_get_parent); +EXPORT_SYMBOL(acpi_get_type); +EXPORT_SYMBOL(acpi_get_name); +EXPORT_SYMBOL(acpi_get_object_info); +EXPORT_SYMBOL(acpi_get_next_object); +EXPORT_SYMBOL(acpi_evaluate_object); + +EXPORT_SYMBOL(acpi_install_notify_handler); +EXPORT_SYMBOL(acpi_remove_notify_handler); +EXPORT_SYMBOL(acpi_install_gpe_handler); +EXPORT_SYMBOL(acpi_remove_gpe_handler); +EXPORT_SYMBOL(acpi_install_address_space_handler); +EXPORT_SYMBOL(acpi_remove_address_space_handler); + +EXPORT_SYMBOL(acpi_get_current_resources); +EXPORT_SYMBOL(acpi_get_possible_resources); +EXPORT_SYMBOL(acpi_set_current_resources); + +EXPORT_SYMBOL(acpi_enable_event); +EXPORT_SYMBOL(acpi_disable_event); +EXPORT_SYMBOL(acpi_clear_event); diff --git a/drivers/acpi/cmbatt.c b/drivers/acpi/cmbatt.c index c45aa810c..d5dc5977a 100644 --- a/drivers/acpi/cmbatt.c +++ b/drivers/acpi/cmbatt.c @@ -113,10 +113,10 @@ acpi_get_battery_status(ACPI_HANDLE handle, struct cmbatt_status *result) obj = (ACPI_OBJECT *) buf.pointer; objs = obj->package.elements; - result->state = objs[0].number.value; - result->present_rate = objs[1].number.value; - result->remaining_capacity = objs[2].number.value; - result->present_voltage = objs[3].number.value; + result->state = objs[0].integer.value; + result->present_rate = objs[1].integer.value; + result->remaining_capacity = objs[2].integer.value; + result->present_voltage = objs[3].integer.value; kfree(buf.pointer); @@ -153,15 +153,15 @@ acpi_get_battery_info(ACPI_HANDLE handle, struct cmbatt_info *result) obj = (ACPI_OBJECT *) buf.pointer; objs = obj->package.elements; - result->power_unit=objs[0].number.value; - result->design_capacity=objs[1].number.value; - result->last_full_capacity=objs[2].number.value; - result->battery_technology=objs[3].number.value; - result->design_voltage=objs[4].number.value; - result->design_capacity_warning=objs[5].number.value; - result->design_capacity_low=objs[6].number.value; - result->battery_capacity_granularity_1=objs[7].number.value; - result->battery_capacity_granularity_2=objs[8].number.value; + result->power_unit=objs[0].integer.value; + result->design_capacity=objs[1].integer.value; + result->last_full_capacity=objs[2].integer.value; + result->battery_technology=objs[3].integer.value; + result->design_voltage=objs[4].integer.value; + result->design_capacity_warning=objs[5].integer.value; + result->design_capacity_low=objs[6].integer.value; + result->battery_capacity_granularity_1=objs[7].integer.value; + result->battery_capacity_granularity_2=objs[8].integer.value; /* BUG: trailing NULL issue */ strncpy(result->model_number, objs[9].string.pointer, MAX_BATT_STRLEN-1); diff --git a/drivers/acpi/common/cmalloc.c b/drivers/acpi/common/cmalloc.c index b7a64e5b6..d8514698f 100644 --- a/drivers/acpi/common/cmalloc.c +++ b/drivers/acpi/common/cmalloc.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: cmalloc - local memory allocation routines - * $Revision: 79 $ + * $Revision: 84 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,8 +57,6 @@ _cm_allocate ( u32 line) { void *address = NULL; - DEBUG_ONLY_MEMBERS (\ - ACPI_STATUS status) /* Check for an inadvertent size of zero bytes */ @@ -107,8 +105,6 @@ _cm_callocate ( u32 line) { void *address = NULL; - DEBUG_ONLY_MEMBERS (\ - ACPI_STATUS status) /* Check for an inadvertent size of zero bytes */ diff --git a/drivers/acpi/common/cmclib.c b/drivers/acpi/common/cmclib.c index 5146b09c5..88e92d17f 100644 --- a/drivers/acpi/common/cmclib.c +++ b/drivers/acpi/common/cmclib.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: cmclib - Local implementation of C library functions - * $Revision: 28 $ + * $Revision: 32 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -347,7 +347,7 @@ acpi_cm_memcpy ( void * acpi_cm_memset ( void *dest, - u32 value, + NATIVE_UINT value, NATIVE_UINT count) { NATIVE_CHAR *new = (NATIVE_CHAR *) dest; @@ -522,6 +522,7 @@ static const u8 _acpi_ctype[257] = { #define IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) #define IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI)) #define IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP)) +#define IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) /******************************************************************************* @@ -658,7 +659,7 @@ u32 acpi_cm_strtoul ( const NATIVE_CHAR *string, NATIVE_CHAR **terminator, - u32 base) + NATIVE_UINT base) { u32 converted = 0; u32 index; diff --git a/drivers/acpi/common/cmcopy.c b/drivers/acpi/common/cmcopy.c index 68b7bda01..da3851c17 100644 --- a/drivers/acpi/common/cmcopy.c +++ b/drivers/acpi/common/cmcopy.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: cmcopy - Internal to external object translation utilities - * $Revision: 61 $ + * $Revision: 62 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -118,9 +118,9 @@ acpi_cm_build_external_simple_object ( break; - case ACPI_TYPE_NUMBER: + case ACPI_TYPE_INTEGER: - external_obj->number.value= internal_obj->number.value; + external_obj->integer.value= internal_obj->integer.value; break; @@ -469,11 +469,11 @@ acpi_cm_build_internal_simple_object ( break; - case ACPI_TYPE_NUMBER: + case ACPI_TYPE_INTEGER: /* * Number is included in the object itself */ - internal_obj->number.value = external_obj->number.value; + internal_obj->integer.value = external_obj->integer.value; break; diff --git a/drivers/acpi/common/cmdebug.c b/drivers/acpi/common/cmdebug.c index a55372d5c..2d0022ac3 100644 --- a/drivers/acpi/common/cmdebug.c +++ b/drivers/acpi/common/cmdebug.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: cmdebug - Debug print routines - * $Revision: 61 $ + * $Revision: 64 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -281,7 +281,7 @@ function_value_exit ( u32 line_number, u32 component_id, NATIVE_CHAR *function_name, - NATIVE_UINT value) + ACPI_INTEGER value) { debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS, diff --git a/drivers/acpi/common/cmdelete.c b/drivers/acpi/common/cmdelete.c index a6e74c12f..b516b691c 100644 --- a/drivers/acpi/common/cmdelete.c +++ b/drivers/acpi/common/cmdelete.c @@ -1,12 +1,12 @@ /******************************************************************************* * * Module Name: cmdelete - object deletion and reference count utilities - * $Revision: 60 $ + * $Revision: 62 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/common/cmeval.c b/drivers/acpi/common/cmeval.c index 29a5cefa6..653e26a47 100644 --- a/drivers/acpi/common/cmeval.c +++ b/drivers/acpi/common/cmeval.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: cmeval - Object evaluation - * $Revision: 19 $ + * $Revision: 21 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +77,7 @@ acpi_cm_evaluate_numeric_object ( /* Is the return object of the correct type? */ - if (obj_desc->common.type != ACPI_TYPE_NUMBER) { + if (obj_desc->common.type != ACPI_TYPE_INTEGER) { status = AE_TYPE; } else { @@ -85,7 +85,7 @@ acpi_cm_evaluate_numeric_object ( * Since the structure is a union, setting any field will set all * of the variables in the union */ - *address = obj_desc->number.value; + *address = obj_desc->integer.value; } /* On exit, we must delete the return object */ @@ -142,17 +142,17 @@ acpi_cm_execute_HID ( * a string */ - if ((obj_desc->common.type != ACPI_TYPE_NUMBER) && + if ((obj_desc->common.type != ACPI_TYPE_INTEGER) && (obj_desc->common.type != ACPI_TYPE_STRING)) { status = AE_TYPE; } else { - if (obj_desc->common.type == ACPI_TYPE_NUMBER) { + if (obj_desc->common.type == ACPI_TYPE_INTEGER) { /* Convert the Numeric HID to string */ - acpi_aml_eisa_id_to_string ((u32) obj_desc->number.value, hid->buffer); + acpi_aml_eisa_id_to_string ((u32) obj_desc->integer.value, hid->buffer); } else { @@ -217,17 +217,17 @@ acpi_cm_execute_UID ( * a string */ - if ((obj_desc->common.type != ACPI_TYPE_NUMBER) && + if ((obj_desc->common.type != ACPI_TYPE_INTEGER) && (obj_desc->common.type != ACPI_TYPE_STRING)) { status = AE_TYPE; } else { - if (obj_desc->common.type == ACPI_TYPE_NUMBER) { + if (obj_desc->common.type == ACPI_TYPE_INTEGER) { /* Convert the Numeric UID to string */ - acpi_aml_unsigned_integer_to_string (obj_desc->number.value, uid->buffer); + acpi_aml_unsigned_integer_to_string (obj_desc->integer.value, uid->buffer); } else { @@ -289,14 +289,14 @@ acpi_cm_execute_STA ( /* Is the return object of the correct type? */ - if (obj_desc->common.type != ACPI_TYPE_NUMBER) { + if (obj_desc->common.type != ACPI_TYPE_INTEGER) { status = AE_TYPE; } else { /* Extract the status flags */ - *flags = (u32) obj_desc->number.value; + *flags = (u32) obj_desc->integer.value; } /* On exit, we must delete the return object */ diff --git a/drivers/acpi/common/cmglobal.c b/drivers/acpi/common/cmglobal.c index 4b4460f46..a388907f3 100644 --- a/drivers/acpi/common/cmglobal.c +++ b/drivers/acpi/common/cmglobal.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: cmglobal - Global variables for the ACPI subsystem - * $Revision: 112 $ + * $Revision: 116 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -95,7 +95,7 @@ PREDEFINED_NAMES acpi_gbl_pre_defined_names[] = {"_SB_", INTERNAL_TYPE_DEF_ANY}, {"_SI_", INTERNAL_TYPE_DEF_ANY}, {"_TZ_", INTERNAL_TYPE_DEF_ANY}, - {"_REV", ACPI_TYPE_NUMBER, "2"}, + {"_REV", ACPI_TYPE_INTEGER, "2"}, {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, {"_GL_", ACPI_TYPE_MUTEX, "0"}, @@ -152,6 +152,13 @@ u8 acpi_gbl_ns_properties[] = }; +/* Hex to ASCII conversion table */ + +NATIVE_CHAR acpi_gbl_hex_to_ascii[] = + {'0','1','2','3','4','5','6','7', + '8','9','A','B','C','D','E','F'}; + + /****************************************************************************** * * Table globals diff --git a/drivers/acpi/common/cminit.c b/drivers/acpi/common/cminit.c index e6cfb7655..0952720f1 100644 --- a/drivers/acpi/common/cminit.c +++ b/drivers/acpi/common/cminit.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: cminit - Common ACPI subsystem initialization - * $Revision: 91 $ + * $Revision: 93 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,6 +35,9 @@ MODULE_NAME ("cminit") +#define ACPI_OFFSET(d,o) ((u32) &(((d *)0)->o)) +#define ACPI_FADT_OFFSET(o) ACPI_OFFSET (FADT_DESCRIPTOR, o) + /******************************************************************************* * * FUNCTION: Acpi_cm_fadt_register_error @@ -53,12 +56,13 @@ static ACPI_STATUS acpi_cm_fadt_register_error ( NATIVE_CHAR *register_name, - u32 value) + u32 value, + u32 offset) { REPORT_ERROR ( - ("Invalid FADT register value, %s=%X (FADT=%p)\n", - register_name, value, acpi_gbl_FADT)); + ("Invalid FADT value %s=%lX at offset %lX FADT=%p\n", + register_name, value, offset, acpi_gbl_FADT)); return (AE_BAD_VALUE); @@ -91,39 +95,42 @@ acpi_cm_validate_fadt ( if (acpi_gbl_FADT->pm1_evt_len < 4) { status = acpi_cm_fadt_register_error ("PM1_EVT_LEN", - (u32) acpi_gbl_FADT->pm1_evt_len); + (u32) acpi_gbl_FADT->pm1_evt_len, + ACPI_FADT_OFFSET (pm1_evt_len)); } if (!acpi_gbl_FADT->pm1_cnt_len) { - status = acpi_cm_fadt_register_error ("PM1_CNT_LEN", - 0); + status = acpi_cm_fadt_register_error ("PM1_CNT_LEN", 0, + ACPI_FADT_OFFSET (pm1_cnt_len)); } if (!ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm1a_evt_blk.address)) { - status = acpi_cm_fadt_register_error ("PM1a_EVT_BLK", - 0); + status = acpi_cm_fadt_register_error ("X_PM1a_EVT_BLK", 0, + ACPI_FADT_OFFSET (Xpm1a_evt_blk.address)); } if (!ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm1a_cnt_blk.address)) { - status = acpi_cm_fadt_register_error ("PM1a_CNT_BLK", - 0); + status = acpi_cm_fadt_register_error ("X_PM1a_CNT_BLK", 0, + ACPI_FADT_OFFSET (Xpm1a_cnt_blk.address)); } if (!ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm_tmr_blk.address)) { - status = acpi_cm_fadt_register_error ("PM_TMR_BLK", - 0); + status = acpi_cm_fadt_register_error ("X_PM_TMR_BLK", 0, + ACPI_FADT_OFFSET (Xpm_tmr_blk.address)); } if ((ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm2_cnt_blk.address) && !acpi_gbl_FADT->pm2_cnt_len)) { status = acpi_cm_fadt_register_error ("PM2_CNT_LEN", - (u32) acpi_gbl_FADT->pm2_cnt_len); + (u32) acpi_gbl_FADT->pm2_cnt_len, + ACPI_FADT_OFFSET (pm2_cnt_len)); } if (acpi_gbl_FADT->pm_tm_len < 4) { status = acpi_cm_fadt_register_error ("PM_TM_LEN", - (u32) acpi_gbl_FADT->pm_tm_len); + (u32) acpi_gbl_FADT->pm_tm_len, + ACPI_FADT_OFFSET (pm_tm_len)); } /* length of GPE blocks must be a multiple of 2 */ @@ -132,15 +139,17 @@ acpi_cm_validate_fadt ( if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xgpe0blk.address) && (acpi_gbl_FADT->gpe0blk_len & 1)) { - status = acpi_cm_fadt_register_error ("GPE0_BLK_LEN", - (u32) acpi_gbl_FADT->gpe0blk_len); + status = acpi_cm_fadt_register_error ("(x)GPE0_BLK_LEN", + (u32) acpi_gbl_FADT->gpe0blk_len, + ACPI_FADT_OFFSET (gpe0blk_len)); } if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address) && (acpi_gbl_FADT->gpe1_blk_len & 1)) { - status = acpi_cm_fadt_register_error ("GPE1_BLK_LEN", - (u32) acpi_gbl_FADT->gpe1_blk_len); + status = acpi_cm_fadt_register_error ("(x)GPE1_BLK_LEN", + (u32) acpi_gbl_FADT->gpe1_blk_len, + ACPI_FADT_OFFSET (gpe1_blk_len)); } return (status); diff --git a/drivers/acpi/common/cmobject.c b/drivers/acpi/common/cmobject.c index 95e70fb14..5f73abaaf 100644 --- a/drivers/acpi/common/cmobject.c +++ b/drivers/acpi/common/cmobject.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: cmobject - ACPI object create/delete/size/cache routines - * $Revision: 34 $ + * $Revision: 35 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -434,7 +434,7 @@ acpi_cm_get_simple_object_size ( break; - case ACPI_TYPE_NUMBER: + case ACPI_TYPE_INTEGER: case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_POWER: diff --git a/drivers/acpi/common/cmutils.c b/drivers/acpi/common/cmutils.c index cb3d959c8..b0ee8b4d9 100644 --- a/drivers/acpi/common/cmutils.c +++ b/drivers/acpi/common/cmutils.c @@ -1,12 +1,12 @@ /******************************************************************************* * * Module Name: cmutils - common utility procedures - * $Revision: 21 $ + * $Revision: 23 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -647,16 +647,16 @@ acpi_cm_resolve_package_references ( if (sub_object->common.type == INTERNAL_TYPE_REFERENCE) { if (sub_object->reference.op_code == AML_ZERO_OP) { - sub_object->common.type = ACPI_TYPE_NUMBER; - sub_object->number.value = 0; + sub_object->common.type = ACPI_TYPE_INTEGER; + sub_object->integer.value = 0; } else if (sub_object->reference.op_code == AML_ONE_OP) { - sub_object->common.type = ACPI_TYPE_NUMBER; - sub_object->number.value = 1; + sub_object->common.type = ACPI_TYPE_INTEGER; + sub_object->integer.value = 1; } else if (sub_object->reference.op_code == AML_ONES_OP) { - sub_object->common.type = ACPI_TYPE_NUMBER; - sub_object->number.value = ACPI_INTEGER_MAX; + sub_object->common.type = ACPI_TYPE_INTEGER; + sub_object->integer.value = ACPI_INTEGER_MAX; } } } diff --git a/drivers/acpi/common/cmxface.c b/drivers/acpi/common/cmxface.c index fc063850c..ce87b50d2 100644 --- a/drivers/acpi/common/cmxface.c +++ b/drivers/acpi/common/cmxface.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: cmxface - External interfaces for "global" ACPI functions - * $Revision: 55 $ + * $Revision: 62 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -304,16 +304,22 @@ acpi_get_system_info ( out_buffer->length = sizeof (ACPI_SYSTEM_INFO); info_ptr = (ACPI_SYSTEM_INFO *) out_buffer->pointer; - /* TBD [Future]: need a version number, or use the version string */ - info_ptr->acpi_ca_version = 0x1234; + info_ptr->acpi_ca_version = ACPI_CA_VERSION; /* System flags (ACPI capabilities) */ info_ptr->flags = acpi_gbl_system_flags; /* Timer resolution - 24 or 32 bits */ - - info_ptr->timer_resolution = acpi_hw_pmt_resolution (); + if (!acpi_gbl_FADT) { + info_ptr->timer_resolution = 0; + } + else if (acpi_gbl_FADT->tmr_val_ext == 0) { + info_ptr->timer_resolution = 24; + } + else { + info_ptr->timer_resolution = 32; + } /* Clear the reserved fields */ diff --git a/drivers/acpi/cpu.c b/drivers/acpi/cpu.c index 00ec59da5..3e4adcee2 100644 --- a/drivers/acpi/cpu.c +++ b/drivers/acpi/cpu.c @@ -39,6 +39,9 @@ static int acpi_c3_tested = 0; static int acpi_max_c_state = 1; static int acpi_pm_tmr_len; +#define MAX_C2_LATENCY 100 +#define MAX_C3_LATENCY 1000 + /* * Clear busmaster activity flag */ @@ -251,10 +254,7 @@ static ACPI_STATUS acpi_found_cpu(ACPI_HANDLE handle, u32 level, void *ctx, void **value) { ACPI_OBJECT obj; - ACPI_CX_STATE lat[4]; - ACPI_CPU_THROTTLING_STATE throttle[ACPI_MAX_THROTTLE]; ACPI_BUFFER buf; - int i, count; buf.length = sizeof(obj); buf.pointer = &obj; @@ -273,41 +273,28 @@ acpi_found_cpu(ACPI_HANDLE handle, u32 level, void *ctx, void **value) acpi_pblk = obj.processor.pblk_address; - buf.length = sizeof(lat); - buf.pointer = lat; - if (!ACPI_SUCCESS(acpi_get_processor_cx_info(handle, &buf))) - return AE_OK; + if (acpi_fadt.plvl2_lat + && acpi_fadt.plvl2_lat <= MAX_C2_LATENCY) { + acpi_c2_exit_latency + = ACPI_MICROSEC_TO_TMR_TICKS(acpi_fadt.plvl2_lat); + acpi_c2_enter_latency + = ACPI_MICROSEC_TO_TMR_TICKS(ACPI_TMR_HZ / 1000); + acpi_max_c_state = 2; - if (lat[2].latency < MAX_CX_STATE_LATENCY) { printk(KERN_INFO "ACPI: System firmware supports: C2"); - acpi_c2_exit_latency = lat[2].latency; - acpi_max_c_state = 2; - if (lat[3].latency < MAX_CX_STATE_LATENCY) { - printk(" C3"); - acpi_c3_exit_latency = lat[3].latency; + if (acpi_fadt.plvl3_lat + && acpi_fadt.plvl3_lat <= MAX_C3_LATENCY) { + acpi_c3_exit_latency + = ACPI_MICROSEC_TO_TMR_TICKS(acpi_fadt.plvl3_lat); + acpi_c3_enter_latency + = ACPI_MICROSEC_TO_TMR_TICKS(acpi_fadt.plvl3_lat * 5); acpi_max_c_state = 3; - } - printk("\n"); - } - memset(throttle, 0, sizeof(throttle)); - buf.length = sizeof(throttle); - buf.pointer = throttle; - - if (!ACPI_SUCCESS(acpi_get_processor_throttling_info(handle, &buf))) - return AE_OK; - - for (i = 0, count = 0; i < ACPI_MAX_THROTTLE; i++) { - if (throttle[i].percent_of_clock) - count++; - } - - /* 0% throttled really doesn't count */ - count--; + printk(" C3"); + } - if (count > 0) { - DEBUG_PRINT(ACPI_INFO, ("%d throttling states\n", count)); + printk("\n"); } return AE_OK; diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c index 1ce75dbdb..897324547 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/dispatcher/dsfield.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: dsfield - Dispatcher field routines - * $Revision: 29 $ + * $Revision: 31 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index d9d73ccea..4834f47ec 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: dsmethod - Parser/Interpreter interface - control method parsing - * $Revision: 53 $ + * $Revision: 56 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index e6913fabf..dfaa2a103 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c @@ -1,12 +1,12 @@ /******************************************************************************* * * Module Name: dsmthdat - control method arguments and local variables - * $Revision: 36 $ + * $Revision: 39 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,7 +40,7 @@ * * FUNCTION: Acpi_ds_method_data_init * - * PARAMETERS: *Obj_desc + * PARAMETERS: Walk_state - Current walk state object * * RETURN: Status * @@ -97,7 +97,7 @@ acpi_ds_method_data_init ( * * FUNCTION: Acpi_ds_method_data_delete_all * - * PARAMETERS: None + * PARAMETERS: Walk_state - Current walk state object * * RETURN: Status * @@ -153,7 +153,9 @@ acpi_ds_method_data_delete_all ( * * FUNCTION: Acpi_ds_method_data_init_args * - * PARAMETERS: None + * PARAMETERS: *Params - Pointer to a parameter list for the method + * Max_param_count - The arg count for this method + * Walk_state - Current walk state object * * RETURN: Status * @@ -214,6 +216,7 @@ acpi_ds_method_data_init_args ( * Index - Which local_var or argument to get * Entry - Pointer to where a pointer to the stack * entry is returned. + * Walk_state - Current walk state object * * RETURN: Status * @@ -276,6 +279,7 @@ acpi_ds_method_data_get_entry ( * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG * Index - Which local_var or argument to get * Object - Object to be inserted into the stack entry + * Walk_state - Current walk state object * * RETURN: Status * @@ -320,6 +324,7 @@ acpi_ds_method_data_set_entry ( * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG * Index - Which local_var or argument whose type * to get + * Walk_state - Current walk state object * * RETURN: Data type of selected Arg or Local * Used only in Exec_monadic2()/Type_op. @@ -366,6 +371,7 @@ acpi_ds_method_data_get_type ( * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG * Index - Which local_var or argument whose type * to get + * Walk_state - Current walk state object * * RETURN: Get the Node associated with a local or arg. * @@ -418,7 +424,8 @@ acpi_ds_method_data_get_nte ( * * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG * Index - Which local_var or argument to get - * *Dest_desc - Descriptor into which selected Arg + * Walk_state - Current walk state object + * *Dest_desc - Ptr to Descriptor into which selected Arg * or Local value should be copied * * RETURN: Status @@ -474,10 +481,12 @@ acpi_ds_method_data_get_value ( switch (type) { case MTH_TYPE_ARG: + return (AE_AML_UNINITIALIZED_ARG); break; case MTH_TYPE_LOCAL: + return (AE_AML_UNINITIALIZED_LOCAL); break; } @@ -502,6 +511,7 @@ acpi_ds_method_data_get_value ( * * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG * Index - Which local_var or argument to delete + * Walk_state - Current walk state object * * RETURN: Status * @@ -548,7 +558,6 @@ acpi_ds_method_data_delete_value ( * Decrement the reference count by one to balance the * increment when the object was stored in the slot. */ - acpi_cm_remove_reference (object); } @@ -563,18 +572,14 @@ acpi_ds_method_data_delete_value ( * * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG * Index - Which local_var or argument to set - * *Src_desc - Value to be stored - * *Dest_desc - Descriptor into which *Src_desc - * can be copied, or NULL if one must - * be allocated for the purpose. If - * provided, this descriptor will be - * used for the new value. + * Src_desc - Value to be stored + * Walk_state - Current walk state * * RETURN: Status * * DESCRIPTION: Store a value in an Arg or Local. The Src_desc is installed * as the new value for the Arg or Local and the reference count - * is incremented. + * for Src_desc is incremented. * ******************************************************************************/ @@ -644,7 +649,6 @@ acpi_ds_method_data_set_value ( * Store this object into the Node * (do the indirect store) */ - status = acpi_ns_attach_object ((ACPI_NAMESPACE_NODE *) *entry, src_desc, src_desc->common.type); return (status); @@ -652,10 +656,18 @@ acpi_ds_method_data_set_value ( /* - * Otherwise, just delete the existing object - * before storing the new one + * Perform "Implicit conversion" of the new object to the type of the + * existing object */ + status = acpi_aml_convert_to_target_type ((*entry)->common.type, &src_desc, walk_state); + if (ACPI_FAILURE (status)) { + goto cleanup; + } + /* + * Delete the existing object + * before storing the new one + */ acpi_ds_method_data_delete_value (type, index, walk_state); } @@ -666,7 +678,6 @@ acpi_ds_method_data_set_value ( * Install the new object in the stack entry * (increments the object reference count by one) */ - status = acpi_ds_method_data_set_entry (type, index, src_desc, walk_state); if (ACPI_FAILURE (status)) { goto cleanup; diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 042cc4a80..0a6c88b4d 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: dsobject - Dispatcher object management routines - * $Revision: 53 $ + * $Revision: 56 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -241,14 +241,14 @@ acpi_ds_init_object_from_op ( /* We are expecting a number */ - if (arg_desc->common.type != ACPI_TYPE_NUMBER) { + if (arg_desc->common.type != ACPI_TYPE_INTEGER) { acpi_cm_remove_reference (arg_desc); return (AE_TYPE); } /* Get the value, delete the internal object */ - (*obj_desc)->buffer.length = (u32) arg_desc->number.value; + (*obj_desc)->buffer.length = (u32) arg_desc->integer.value; acpi_cm_remove_reference (arg_desc); /* Allocate the buffer */ @@ -304,8 +304,8 @@ acpi_ds_init_object_from_op ( status = acpi_ds_build_internal_object (walk_state, op, obj_desc); break; - case ACPI_TYPE_NUMBER: - (*obj_desc)->number.value = op->value.integer; + case ACPI_TYPE_INTEGER: + (*obj_desc)->integer.value = op->value.integer; break; @@ -411,18 +411,20 @@ acpi_ds_build_internal_simple_obj ( acpi_ns_externalize_name (ACPI_UINT32_MAX, op->value.string, &length, &name); if (name) { - REPORT_WARNING (("Reference %s AML %X not found\n", + REPORT_WARNING (("Reference %s at AML %X not found\n", name, op->aml_offset)); acpi_cm_free (name); } else { - REPORT_WARNING (("Reference %s AML %X not found\n", + REPORT_WARNING (("Reference %s at AML %X not found\n", op->value.string, op->aml_offset)); } *obj_desc_ptr = NULL; } - return (status); + else { + return (status); + } } } diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 21e15bc26..ba06cf4db 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c @@ -2,12 +2,12 @@ * * Module Name: dsopcode - Dispatcher Op Region support and handling of * "control" opcodes - * $Revision: 28 $ + * $Revision: 30 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -355,7 +355,7 @@ acpi_ds_eval_field_unit_operands ( } - offset = (u32) off_desc->number.value; + offset = (u32) off_desc->integer.value; /* @@ -427,7 +427,7 @@ acpi_ds_eval_field_unit_operands ( /* Offset is in bits, count is in bits */ bit_offset = offset; - bit_count = (u16) cnt_desc->number.value; + bit_count = (u16) cnt_desc->integer.value; break; @@ -586,7 +586,7 @@ acpi_ds_eval_region_operands ( */ operand_desc = walk_state->operands[walk_state->num_operands - 1]; - obj_desc->region.length = (u32) operand_desc->number.value; + obj_desc->region.length = (u32) operand_desc->integer.value; acpi_cm_remove_reference (operand_desc); /* @@ -595,7 +595,7 @@ acpi_ds_eval_region_operands ( */ operand_desc = walk_state->operands[walk_state->num_operands - 2]; - obj_desc->region.address = (ACPI_PHYSICAL_ADDRESS) operand_desc->number.value; + obj_desc->region.address = (ACPI_PHYSICAL_ADDRESS) operand_desc->integer.value; acpi_cm_remove_reference (operand_desc); diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 2efa43e51..d31464840 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c @@ -1,12 +1,12 @@ /******************************************************************************* * * Module Name: dsutils - Dispatcher utilities - * $Revision: 50 $ + * $Revision: 52 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -566,7 +566,7 @@ acpi_ds_map_opcode_to_data_type ( case AML_WORD_OP: case AML_DWORD_OP: - data_type = ACPI_TYPE_NUMBER; + data_type = ACPI_TYPE_INTEGER; break; diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index 1f7e329ad..a2e1b73d3 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c @@ -2,12 +2,12 @@ * * Module Name: dswexec - Dispatcher method execution callbacks; * dispatch to interpreter. - * $Revision: 50 $ + * $Revision: 55 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +46,7 @@ * * RETURN: Status * - * DESCRIPTION: + * DESCRIPTION: Get the result of a predicate evaluation * ****************************************************************************/ @@ -93,22 +93,22 @@ acpi_ds_get_predicate_value ( * be a number */ - if (obj_desc->common.type != ACPI_TYPE_NUMBER) { + if (obj_desc->common.type != ACPI_TYPE_INTEGER) { status = AE_AML_OPERAND_TYPE; goto cleanup; } - /* TBD: 64/32-bit */ + /* Truncate the predicate to 32-bits if necessary */ - obj_desc->number.value &= (UINT64) 0x00000000FFFFFFFF; + acpi_aml_truncate_for32bit_table (obj_desc, walk_state); /* * Save the result of the predicate evaluation on * the control stack */ - if (obj_desc->number.value) { + if (obj_desc->integer.value) { walk_state->control_state->common.value = TRUE; } @@ -330,6 +330,8 @@ acpi_ds_exec_end_op ( walk_state->num_operands = 0; walk_state->return_desc = NULL; + walk_state->op_info = op_info; + walk_state->opcode = opcode; /* Call debugger for single step support (DEBUG build only) */ diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index b3f1dc062..300d02b7f 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: dswload - Dispatcher namespace load callbacks - * $Revision: 24 $ + * $Revision: 26 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c index 11b6a6cb9..332ab4ffd 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/dispatcher/dswscope.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: dswscope - Scope stack manipulation - * $Revision: 40 $ + * $Revision: 42 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index a15a6f5f7..a436945df 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: dswstate - Dispatcher parse tree walk management routines - * $Revision: 36 $ + * $Revision: 38 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,31 +37,6 @@ /******************************************************************************* * - * FUNCTION: Acpi_ds_result_stack_clear - * - * PARAMETERS: Walk_state - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Reset this walk's result stack pointers to zero, thus setting - * the stack to zero. - * - ******************************************************************************/ - -ACPI_STATUS -xxx_acpi_ds_result_stack_clear ( - ACPI_WALK_STATE *walk_state) -{ -/* - Walk_state->Num_results = 0; - Walk_state->Current_result = 0; -*/ - return (AE_OK); -} - - -/******************************************************************************* - * * FUNCTION: Acpi_ds_result_insert * * PARAMETERS: Object - Object to push @@ -135,7 +110,7 @@ acpi_ds_result_remove ( /* Check for a valid result object */ if (!state->results.obj_desc [index]) { - return (AE_AML_NO_OPERAND); + return (AE_AML_NO_RETURN_VALUE); } /* Remove the object */ @@ -179,7 +154,7 @@ acpi_ds_result_pop ( if (!state->results.num_results) { - return (AE_STACK_UNDERFLOW); + return (AE_AML_NO_RETURN_VALUE); } /* Remove top element */ @@ -198,12 +173,12 @@ acpi_ds_result_pop ( } - return (AE_STACK_UNDERFLOW); + return (AE_AML_NO_RETURN_VALUE); } /******************************************************************************* * - * FUNCTION: Acpi_ds_result_pop + * FUNCTION: Acpi_ds_result_pop_from_bottom * * PARAMETERS: Object - Where to return the popped object * Walk_state - Current Walk state @@ -231,7 +206,7 @@ acpi_ds_result_pop_from_bottom ( if (!state->results.num_results) { - return (AE_STACK_UNDERFLOW); + return (AE_AML_NO_RETURN_VALUE); } /* Remove Bottom element */ @@ -250,7 +225,7 @@ acpi_ds_result_pop_from_bottom ( /* Check for a valid result object */ if (!*object) { - return (AE_AML_NO_OPERAND); + return (AE_AML_NO_RETURN_VALUE); } @@ -260,15 +235,14 @@ acpi_ds_result_pop_from_bottom ( /******************************************************************************* * - * FUNCTION: Acpi_ds_result_pop + * FUNCTION: Acpi_ds_result_push * * PARAMETERS: Object - Where to return the popped object * Walk_state - Current Walk state * * RETURN: Status * - * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In - * other words, this is a FIFO. + * DESCRIPTION: Push an object onto the current result stack * ******************************************************************************/ @@ -282,7 +256,7 @@ acpi_ds_result_push ( state = walk_state->results; if (!state) { - return (AE_OK); + return (AE_AML_INTERNAL); } if (state->results.num_results == OBJ_NUM_OPERANDS) { @@ -719,6 +693,7 @@ acpi_ds_create_walk_state ( ACPI_WALK_LIST *walk_list) { ACPI_WALK_STATE *walk_state; + ACPI_STATUS status; acpi_cm_acquire_mutex (ACPI_MTX_CACHES); @@ -736,7 +711,7 @@ acpi_ds_create_walk_state ( acpi_gbl_walk_state_cache_depth--; acpi_cm_release_mutex (ACPI_MTX_CACHES); - } + } else { /* The cache is empty, create a new object */ @@ -762,6 +737,14 @@ acpi_ds_create_walk_state ( acpi_ds_method_data_init (walk_state); #endif + /* Create an initial result stack entry */ + + status = acpi_ds_result_stack_push (walk_state); + if (ACPI_FAILURE (status)) { + return (NULL); + } + + /* Put the new state at the head of the walk list */ acpi_ds_push_walk_state (walk_state, walk_list); diff --git a/drivers/acpi/driver.c b/drivers/acpi/driver.c index 222598120..241528fc6 100644 --- a/drivers/acpi/driver.c +++ b/drivers/acpi/driver.c @@ -55,7 +55,7 @@ struct acpi_run_entry static spinlock_t acpi_event_lock = SPIN_LOCK_UNLOCKED; static volatile u32 acpi_event_status = 0; -static volatile acpi_sstate_t acpi_event_state = ACPI_S0; +static volatile acpi_sstate_t acpi_event_state = ACPI_STATE_S0; static DECLARE_WAIT_QUEUE_HEAD(acpi_event_wait); static volatile int acpi_thread_pid = -1; @@ -243,7 +243,7 @@ acpi_do_event(ctl_table * ctl, /* * Enter system sleep state */ -static int +/*static int acpi_do_sleep(ctl_table * ctl, int write, struct file *file, @@ -257,13 +257,13 @@ acpi_do_sleep(ctl_table * ctl, } } else { - int status = acpi_enter_sx(ACPI_S1); + int status = acpi_enter_sx(ACPI_STATE_S1); if (status) return status; } file->f_pos += *len; return 0; -} +}*/ /* @@ -382,7 +382,8 @@ static struct ctl_table acpi_table[] = &acpi_c3_enter_latency, sizeof(acpi_c3_enter_latency), 0644, NULL, &acpi_do_ulong}, - {ACPI_SLEEP, "sleep", NULL, 0, 0600, NULL, &acpi_do_sleep}, +/* until it actually works */ +/* {ACPI_SLEEP, "sleep", NULL, 0, 0600, NULL, &acpi_do_sleep},*/ {ACPI_EVENT, "event", NULL, 0, 0400, NULL, &acpi_do_event}, @@ -415,7 +416,9 @@ static struct ctl_table acpi_dir_table[] = static int acpi_thread(void *context) { - ACPI_PHYSICAL_ADDRESS rsdp_phys; + ACPI_PHYSICAL_ADDRESS rsdp_phys; + ACPI_BUFFER buffer; + ACPI_SYSTEM_INFO sys_info; /* * initialize @@ -437,8 +440,6 @@ acpi_thread(void *context) rsdp_phys = efi.acpi; #endif - printk(KERN_ERR "ACPI: System description tables found\n"); - if (!ACPI_SUCCESS(acpi_find_and_load_tables(rsdp_phys))) return -ENODEV; @@ -448,6 +449,17 @@ acpi_thread(void *context) return -ENODEV; } + buffer.length = sizeof(sys_info); + buffer.pointer = &sys_info; + + if (!ACPI_SUCCESS (acpi_get_system_info(&buffer))) { + printk(KERN_ERR "ACPI: Could not get system info\n"); + acpi_terminate(); + return -ENODEV; + } + + printk(KERN_INFO "ACPI: Core Subsystem version [%x]\n", sys_info.acpi_ca_version); + if (!ACPI_SUCCESS(acpi_enable_subsystem(ACPI_FULL_INITIALIZATION))) { printk(KERN_ERR "ACPI: Subsystem enable failed\n"); acpi_terminate(); diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 8f6f61e36..5e42683c6 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -270,25 +270,6 @@ ec_transaction ( return_ACPI_STATUS(status); } -static ACPI_STATUS -ec_space_setup ( - ACPI_HANDLE region_handle, - UINT32 function, - void *handler_context, - void **return_context) -{ - // TODO: What is this function for? - /* - * The ec object is in the handler context and is needed - * when calling the ec_space_handler. - */ - *return_context = handler_context; - - return AE_OK; -} - - - static void ec_query_handler ( @@ -419,8 +400,6 @@ ec_region_setup ( { FUNCTION_TRACE("acpi_ec_region_setup"); - printk("acpi_ec_region_setup\n"); - if (function == ACPI_REGION_DEACTIVATE) { if (*region_context) @@ -556,10 +535,10 @@ found_ec( buf.length = sizeof(obj); buf.pointer = &obj; if (!ACPI_SUCCESS(acpi_evaluate_object(handle, "_GPE", NULL, &buf)) - || obj.type != ACPI_TYPE_NUMBER) + || obj.type != ACPI_TYPE_INTEGER) return AE_OK; - ec_cxt->gpe_bit = obj.number.value; + ec_cxt->gpe_bit = obj.integer.value; /* determine if we need the Global Lock when accessing */ buf.length = sizeof(obj); @@ -568,12 +547,12 @@ found_ec( status = acpi_evaluate_object(handle, "_GLK", NULL, &buf); if (status == AE_NOT_FOUND) ec_cxt->need_global_lock = 0; - else if (!ACPI_SUCCESS(status) || obj.type != ACPI_TYPE_NUMBER) { + else if (!ACPI_SUCCESS(status) || obj.type != ACPI_TYPE_INTEGER) { DEBUG_PRINT(ACPI_ERROR, ("_GLK failed\n")); return AE_OK; } - ec_cxt->need_global_lock = obj.number.value; + ec_cxt->need_global_lock = obj.integer.value; printk(KERN_INFO "ACPI: found EC @ (0x%02x,0x%02x,gpe %d GL %d)\n", ec_cxt->data_port, ec_cxt->status_port, ec_cxt->gpe_bit, diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c index d5ce143a8..afdd477db 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/events/evevent.c @@ -2,12 +2,12 @@ * * Module Name: evevent - Fixed and General Purpose Acpi_event * handling and dispatch - * $Revision: 32 $ + * $Revision: 33 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index a52f2dc3d..cae4a44b2 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c @@ -2,12 +2,12 @@ * * Module Name: evmisc - ACPI device notification handler dispatch * and ACPI Global Lock support - * $Revision: 20 $ + * $Revision: 22 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 53cae6392..071639a27 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: evregion - ACPI Address_space (Op_region) handler dispatch - * $Revision: 93 $ + * $Revision: 94 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -122,8 +122,8 @@ acpi_ev_execute_reg_method ( u32 function) { ACPI_OPERAND_OBJECT *params[3]; - ACPI_OPERAND_OBJECT space_iD_obj; - ACPI_OPERAND_OBJECT function_obj; + ACPI_OPERAND_OBJECT space_id_desc; + ACPI_OPERAND_OBJECT function_desc; ACPI_STATUS status; @@ -141,24 +141,24 @@ acpi_ev_execute_reg_method ( * Passed as a parameter */ - acpi_cm_init_static_object (&space_iD_obj); - acpi_cm_init_static_object (&function_obj); + acpi_cm_init_static_object (&space_id_desc); + acpi_cm_init_static_object (&function_desc); /* * Method requires two parameters. */ - params [0] = &space_iD_obj; - params [1] = &function_obj; + params [0] = &space_id_desc; + params [1] = &function_desc; params [2] = NULL; /* * Set up the parameter objects */ - space_iD_obj.common.type = ACPI_TYPE_NUMBER; - space_iD_obj.number.value = region_obj->region.space_id; + space_id_desc.common.type = ACPI_TYPE_INTEGER; + space_id_desc.integer.value = region_obj->region.space_id; - function_obj.common.type = ACPI_TYPE_NUMBER; - function_obj.number.value = function; + function_desc.common.type = ACPI_TYPE_INTEGER; + function_desc.integer.value = function; /* * Execute the method, no return value diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index 92e5f198f..eb5e2033e 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: evrgnini- ACPI Address_space (Op_region) init - * $Revision: 31 $ + * $Revision: 33 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c index 02320e93c..369d2f184 100644 --- a/drivers/acpi/events/evsci.c +++ b/drivers/acpi/events/evsci.c @@ -2,12 +2,12 @@ * * Module Name: evsci - System Control Interrupt configuration and * legacy to ACPI mode state transition functions - * $Revision: 67 $ + * $Revision: 69 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index c3bbad0ff..f0e62934f 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: evxface - External interfaces for ACPI events - * $Revision: 97 $ + * $Revision: 101 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -187,26 +187,25 @@ acpi_install_notify_handler ( return (AE_BAD_PARAMETER); } - /* Convert and validate the device handle */ - acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); + /* Convert and validate the device handle */ + device_node = acpi_ns_convert_handle_to_entry (device); if (!device_node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } - /* - * Support for global notify handlers. These handlers are invoked for - * every notifiy of the type specifiec + * Root Object: + * ------------ + * Registering a notify handler on the root object indicates that the + * caller wishes to receive notifications for all objects. Note that + * only one <external> global handler can be regsitered (per notify type). */ - if (device == ACPI_ROOT_OBJECT) { - /* - * Make sure the handler is not already installed. - */ + /* Make sure the handler is not already installed */ if (((handler_type == ACPI_SYSTEM_NOTIFY) && acpi_gbl_sys_notify.handler) || @@ -222,94 +221,89 @@ acpi_install_notify_handler ( acpi_gbl_sys_notify.handler = handler; acpi_gbl_sys_notify.context = context; } - - else { + else /* ACPI_DEVICE_NOTIFY */ { acpi_gbl_drv_notify.node = device_node; acpi_gbl_drv_notify.handler = handler; acpi_gbl_drv_notify.context = context; } - /* Global notify handler installed */ - - goto unlock_and_exit; } - /* - * These are the ONLY objects that can receive ACPI notifications + * Other Objects: + * -------------- + * Caller will only receive notifications specific to the target object. + * Note that only certain object types can receive notifications. */ - - if ((device_node->type != ACPI_TYPE_DEVICE) && - (device_node->type != ACPI_TYPE_PROCESSOR) && - (device_node->type != ACPI_TYPE_POWER) && - (device_node->type != ACPI_TYPE_THERMAL)) - { - status = AE_BAD_PARAMETER; - goto unlock_and_exit; - } - - /* Check for an existing internal object */ - - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) device_node); - if (obj_desc) { + else { /* - * The object exists. - * Make sure the handler is not already installed. + * These are the ONLY objects that can receive ACPI notifications */ - - if (((handler_type == ACPI_SYSTEM_NOTIFY) && - obj_desc->device.sys_handler) || - ((handler_type == ACPI_DEVICE_NOTIFY) && - obj_desc->device.drv_handler)) + if ((device_node->type != ACPI_TYPE_DEVICE) && + (device_node->type != ACPI_TYPE_PROCESSOR) && + (device_node->type != ACPI_TYPE_POWER) && + (device_node->type != ACPI_TYPE_THERMAL)) { - status = AE_EXIST; + status = AE_BAD_PARAMETER; goto unlock_and_exit; } - } - else { - /* Create a new object */ + /* Check for an existing internal object */ - obj_desc = acpi_cm_create_internal_object (device_node->type); - if (!obj_desc) { - status = AE_NO_MEMORY; - goto unlock_and_exit; + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) device_node); + if (obj_desc) { + + /* Object exists - make sure there's no handler */ + + if (((handler_type == ACPI_SYSTEM_NOTIFY) && + obj_desc->device.sys_handler) || + ((handler_type == ACPI_DEVICE_NOTIFY) && + obj_desc->device.drv_handler)) + { + status = AE_EXIST; + goto unlock_and_exit; + } } - /* Attach new object to the Node */ + else { + /* Create a new object */ - status = acpi_ns_attach_object (device, obj_desc, (u8) device_node->type); + obj_desc = acpi_cm_create_internal_object (device_node->type); + if (!obj_desc) { + status = AE_NO_MEMORY; + goto unlock_and_exit; + } - if (ACPI_FAILURE (status)) { - goto unlock_and_exit; - } - } + /* Attach new object to the Node */ + status = acpi_ns_attach_object (device, obj_desc, (u8) device_node->type); - /* - * If we get here, we know that there is no handler installed - * so let's party - */ - notify_obj = acpi_cm_create_internal_object (INTERNAL_TYPE_NOTIFY); - if (!notify_obj) { - status = AE_NO_MEMORY; - goto unlock_and_exit; - } + if (ACPI_FAILURE (status)) { + goto unlock_and_exit; + } + } - notify_obj->notify_handler.node = device_node; - notify_obj->notify_handler.handler = handler; - notify_obj->notify_handler.context = context; + /* Install the handler */ + notify_obj = acpi_cm_create_internal_object (INTERNAL_TYPE_NOTIFY); + if (!notify_obj) { + status = AE_NO_MEMORY; + goto unlock_and_exit; + } - if (handler_type == ACPI_SYSTEM_NOTIFY) { - obj_desc->device.sys_handler = notify_obj; - } + notify_obj->notify_handler.node = device_node; + notify_obj->notify_handler.handler = handler; + notify_obj->notify_handler.context = context; - else { - obj_desc->device.drv_handler = notify_obj; - } + if (handler_type == ACPI_SYSTEM_NOTIFY) { + obj_desc->device.sys_handler = notify_obj; + } + else /* ACPI_DEVICE_NOTIFY */ { + obj_desc->device.drv_handler = notify_obj; + } + } unlock_and_exit: acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); @@ -343,7 +337,6 @@ acpi_remove_notify_handler ( ACPI_NAMESPACE_NODE *device_node; ACPI_STATUS status = AE_OK; - /* Parameter validation */ if ((!handler) || @@ -363,63 +356,92 @@ acpi_remove_notify_handler ( } /* - * These are the ONLY objects that can receive ACPI notifications + * Root Object: + * ------------ */ + if (device == ACPI_ROOT_OBJECT) { - if ((device_node->type != ACPI_TYPE_DEVICE) && - (device_node->type != ACPI_TYPE_PROCESSOR) && - (device_node->type != ACPI_TYPE_POWER) && - (device_node->type != ACPI_TYPE_THERMAL)) - { - status = AE_BAD_PARAMETER; - goto unlock_and_exit; - } - - /* Check for an existing internal object */ + if (((handler_type == ACPI_SYSTEM_NOTIFY) && + !acpi_gbl_sys_notify.handler) || + ((handler_type == ACPI_DEVICE_NOTIFY) && + !acpi_gbl_drv_notify.handler)) + { + status = AE_NOT_EXIST; + goto unlock_and_exit; + } - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) device_node); - if (!obj_desc) { - status = AE_NOT_EXIST; - goto unlock_and_exit; + if (handler_type == ACPI_SYSTEM_NOTIFY) { + acpi_gbl_sys_notify.node = NULL; + acpi_gbl_sys_notify.handler = NULL; + acpi_gbl_sys_notify.context = NULL; + } + else { + acpi_gbl_drv_notify.node = NULL; + acpi_gbl_drv_notify.handler = NULL; + acpi_gbl_drv_notify.context = NULL; + } } /* - * The object exists. - * - * Make sure the handler is installed. + * Other Objects: + * -------------- */ - - if (handler_type == ACPI_SYSTEM_NOTIFY) { - notify_obj = obj_desc->device.sys_handler; - } else { - notify_obj = obj_desc->device.drv_handler; - } + /* + * These are the ONLY objects that can receive ACPI notifications + */ + if ((device_node->type != ACPI_TYPE_DEVICE) && + (device_node->type != ACPI_TYPE_PROCESSOR) && + (device_node->type != ACPI_TYPE_POWER) && + (device_node->type != ACPI_TYPE_THERMAL)) + { + status = AE_BAD_PARAMETER; + goto unlock_and_exit; + } - if ((!notify_obj) || - (notify_obj->notify_handler.handler != handler)) - { - status = AE_BAD_PARAMETER; - goto unlock_and_exit; - } + /* Check for an existing internal object */ - /* - * Now we can remove the handler - */ - if (handler_type == ACPI_SYSTEM_NOTIFY) { - obj_desc->device.sys_handler = NULL; - } - else { - obj_desc->device.drv_handler = NULL; + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) device_node); + if (!obj_desc) { + status = AE_NOT_EXIST; + goto unlock_and_exit; + } + + /* Object exists - make sure there's an existing handler */ + + if (handler_type == ACPI_SYSTEM_NOTIFY) { + notify_obj = obj_desc->device.sys_handler; + } + else { + notify_obj = obj_desc->device.drv_handler; + } + + if ((!notify_obj) || + (notify_obj->notify_handler.handler != handler)) + { + status = AE_BAD_PARAMETER; + goto unlock_and_exit; + } + + /* Remove the handler */ + + if (handler_type == ACPI_SYSTEM_NOTIFY) { + obj_desc->device.sys_handler = NULL; + } + else { + obj_desc->device.drv_handler = NULL; + } + + acpi_cm_remove_reference (notify_obj); } - acpi_cm_remove_reference (notify_obj); unlock_and_exit: acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); return (status); } + /****************************************************************************** * * FUNCTION: Acpi_install_gpe_handler diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index 5b7652e52..9864301a3 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable - * $Revision: 26 $ + * $Revision: 28 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c index 71116cfc8..e54bbab24 100644 --- a/drivers/acpi/events/evxfregn.c +++ b/drivers/acpi/events/evxfregn.c @@ -2,12 +2,12 @@ * * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and * Address Spaces. - * $Revision: 26 $ + * $Revision: 27 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index d2154a1a2..304d3dec6 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c @@ -1,12 +1,13 @@ + /****************************************************************************** * - * Module Name: hwacpi - ACPI hardware functions - mode and timer - * $Revision: 34 $ + * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface + * $Revision: 36 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -304,48 +305,3 @@ acpi_hw_get_mode_capabilities (void) } -/****************************************************************************** - * - * FUNCTION: Acpi_hw_pmt_ticks - * - * PARAMETERS: none - * - * RETURN: Current value of the ACPI PMT (timer) - * - * DESCRIPTION: Obtains current value of ACPI PMT - * - ******************************************************************************/ - -u32 -acpi_hw_pmt_ticks (void) -{ - u32 ticks; - - ticks = acpi_os_in32 ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm_tmr_blk.address)); - - return (ticks); -} - - -/****************************************************************************** - * - * FUNCTION: Acpi_hw_pmt_resolution - * - * PARAMETERS: none - * - * RETURN: Number of bits of resolution in the PMT (either 24 or 32) - * - * DESCRIPTION: Obtains resolution of the ACPI PMT (either 24bit or 32bit) - * - ******************************************************************************/ - -u32 -acpi_hw_pmt_resolution (void) -{ - if (0 == acpi_gbl_FADT->tmr_val_ext) { - return (24); - } - - return (32); -} - diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c index 2b413fac8..b7b777df6 100644 --- a/drivers/acpi/hardware/hwgpe.c +++ b/drivers/acpi/hardware/hwgpe.c @@ -1,12 +1,13 @@ + /****************************************************************************** * * Module Name: hwgpe - Low level GPE enable/disable/clear functions - * $Revision: 25 $ + * $Revision: 28 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index 77b6a1c8c..fc96c51fb 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c @@ -3,12 +3,12 @@ * * Module Name: hwregs - Read/write access functions for the various ACPI * control and status registers. - * $Revision: 86 $ + * $Revision: 88 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ /* This matches the #defines in actypes.h. */ NATIVE_CHAR *sleep_state_table[] = {"\\_S0_","\\_S1_","\\_S2_","\\_S3_", - "\\_S4_","\\_S4_b","\\_S5_"}; + "\\_S4_","\\_S5_","\\_S4_b"}; /******************************************************************************* @@ -53,7 +53,7 @@ NATIVE_CHAR *sleep_state_table[] = {"\\_S0_","\\_S1_","\\_S2_"," * ******************************************************************************/ -static u32 +u32 acpi_hw_get_bit_shift ( u32 mask) { @@ -185,9 +185,9 @@ acpi_hw_obtain_sleep_type_register_data ( } else if (((obj_desc->package.elements[0])->common.type != - ACPI_TYPE_NUMBER) || + ACPI_TYPE_INTEGER) || ((obj_desc->package.elements[1])->common.type != - ACPI_TYPE_NUMBER)) + ACPI_TYPE_INTEGER)) { /* Must have two */ @@ -199,9 +199,9 @@ acpi_hw_obtain_sleep_type_register_data ( /* * Valid _Sx_ package size, type, and value */ - *slp_typ_a = (u8) (obj_desc->package.elements[0])->number.value; + *slp_typ_a = (u8) (obj_desc->package.elements[0])->integer.value; - *slp_typ_b = (u8) (obj_desc->package.elements[1])->number.value; + *slp_typ_b = (u8) (obj_desc->package.elements[1])->integer.value; } @@ -581,13 +581,8 @@ acpi_hw_register_read ( case PM1_CONTROL: /* 16-bit access */ - if (register_id != SLP_TYPE_B) { - value |= acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0); - } - - if (register_id != SLP_TYPE_A) { - value |= acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0); - } + value = acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0); + value |= acpi_hw_low_level_read (16, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0); break; @@ -696,30 +691,20 @@ acpi_hw_register_write ( case PM1_CONTROL: /* 16-bit access */ - /* - * If SLP_TYP_A or SLP_TYP_B, only write to one reg block. - * Otherwise, write to both. - */ - if (register_id == SLP_TYPE_A) { - acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0); - } - else if (register_id == SLP_TYPE_B) { - acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0); - } - else { - /* disable/re-enable interrupts if sleeping */ - if (register_id == SLP_EN) { - disable(); - } + acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0); + acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0); + break; - acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0); - acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0); - if (register_id == SLP_EN) { - enable(); - } - } + case PM1_a_CONTROL: /* 16-bit access */ + + acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1a_cnt_blk, 0); + break; + + + case PM1_b_CONTROL: /* 16-bit access */ + acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0); break; diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c new file mode 100644 index 000000000..892c721c6 --- /dev/null +++ b/drivers/acpi/hardware/hwsleep.c @@ -0,0 +1,189 @@ + +/****************************************************************************** + * + * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface + * $Revision: 5 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000, 2001 R. Byron Moore + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "acpi.h" +#include "acnamesp.h" +#include "achware.h" + +#define _COMPONENT HARDWARE + MODULE_NAME ("hwsleep") + + +/****************************************************************************** + * + * FUNCTION: Acpi_set_firmware_waking_vector + * + * PARAMETERS: Physical_address - Physical address of ACPI real mode + * entry point. + * + * RETURN: AE_OK or AE_ERROR + * + * DESCRIPTION: Access function for d_firmware_waking_vector field in FACS + * + ******************************************************************************/ + +ACPI_STATUS +acpi_set_firmware_waking_vector ( + ACPI_PHYSICAL_ADDRESS physical_address) +{ + + + /* Make sure that we have an FACS */ + + if (!acpi_gbl_FACS) { + return (AE_NO_ACPI_TABLES); + } + + /* Set the vector */ + + if (acpi_gbl_FACS->vector_width == 32) { + * (u32 *) acpi_gbl_FACS->firmware_waking_vector = (u32) physical_address; + } + else { + *acpi_gbl_FACS->firmware_waking_vector = physical_address; + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: Acpi_get_firmware_waking_vector + * + * PARAMETERS: *Physical_address - Output buffer where contents of + * the Firmware_waking_vector field of + * the FACS will be stored. + * + * RETURN: Status + * + * DESCRIPTION: Access function for d_firmware_waking_vector field in FACS + * + ******************************************************************************/ + +ACPI_STATUS +acpi_get_firmware_waking_vector ( + ACPI_PHYSICAL_ADDRESS *physical_address) +{ + + + if (!physical_address) { + return (AE_BAD_PARAMETER); + } + + /* Make sure that we have an FACS */ + + if (!acpi_gbl_FACS) { + return (AE_NO_ACPI_TABLES); + } + + /* Get the vector */ + + if (acpi_gbl_FACS->vector_width == 32) { + *physical_address = * (u32 *) acpi_gbl_FACS->firmware_waking_vector; + } + else { + *physical_address = *acpi_gbl_FACS->firmware_waking_vector; + } + + return (AE_OK); +} + +/****************************************************************************** + * + * FUNCTION: Acpi_enter_sleep_state + * + * PARAMETERS: Sleep_state - Which sleep state to enter + * + * RETURN: Status + * + * DESCRIPTION: Enter a system sleep state (see ACPI 2.0 spec p 231) + * + ******************************************************************************/ + +ACPI_STATUS +acpi_enter_sleep_state ( + u8 sleep_state) +{ + ACPI_STATUS status; + ACPI_OBJECT_LIST arg_list; + ACPI_OBJECT arg; + u8 type_a; + u8 type_b; + u16 PM1_acontrol; + u16 PM1_bcontrol; + + /* + * _PSW methods could be run here to enable wake-on keyboard, LAN, etc. + */ + + status = acpi_hw_obtain_sleep_type_register_data(sleep_state, &type_a, &type_b); + + if (!ACPI_SUCCESS(status)) { + return status; + } + + /* run the _PTS and _GTS methods */ + MEMSET(&arg_list, 0, sizeof(arg_list)); + arg_list.count = 1; + arg_list.pointer = &arg; + + MEMSET(&arg, 0, sizeof(arg)); + arg.type = ACPI_TYPE_INTEGER; + arg.integer.value = sleep_state; + + acpi_evaluate_object(NULL, "\\_PTS", &arg_list, NULL); + acpi_evaluate_object(NULL, "\\_GTS", &arg_list, NULL); + + /* clear wake status */ + acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, WAK_STS, 1); + + PM1_acontrol = (u16) acpi_hw_register_read(ACPI_MTX_LOCK, PM1_CONTROL); + + /* mask off SLP_EN and SLP_TYP fields */ + PM1_acontrol &= 0xC3FF; + + /* mask in SLP_EN */ + PM1_acontrol |= (1 << acpi_hw_get_bit_shift (SLP_EN_MASK)); + + PM1_bcontrol = PM1_acontrol; + + /* mask in SLP_TYP */ + PM1_acontrol |= (type_a << acpi_hw_get_bit_shift (SLP_TYPE_X_MASK)); + PM1_bcontrol |= (type_b << acpi_hw_get_bit_shift (SLP_TYPE_X_MASK)); + + /* the old version was disabling interrupts. let's try it without + * and see how that works + */ + /*disable();*/ + + acpi_hw_register_write(ACPI_MTX_LOCK, PM1_a_CONTROL, PM1_acontrol); + acpi_hw_register_write(ACPI_MTX_LOCK, PM1_b_CONTROL, PM1_bcontrol); + + /*enable();*/ + + return (AE_OK); +} diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c new file mode 100644 index 000000000..b7f529ccf --- /dev/null +++ b/drivers/acpi/hardware/hwtimer.c @@ -0,0 +1,196 @@ + +/****************************************************************************** + * + * Name: hwtimer.c - ACPI Power Management Timer Interface + * $Revision: 4 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000, 2001 R. Byron Moore + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "acpi.h" +#include "achware.h" + +#define _COMPONENT HARDWARE + MODULE_NAME ("hwtimer") + + +/****************************************************************************** + * + * FUNCTION: Acpi_get_timer_resolution + * + * PARAMETERS: none + * + * RETURN: Number of bits of resolution in the PM Timer (24 or 32). + * + * DESCRIPTION: Obtains resolution of the ACPI PM Timer. + * + ******************************************************************************/ + +ACPI_STATUS +acpi_get_timer_resolution ( + u32 *resolution) +{ + if (!resolution) { + return (AE_BAD_PARAMETER); + } + + if (0 == acpi_gbl_FADT->tmr_val_ext) { + *resolution = 24; + } + else { + *resolution = 32; + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: Acpi_get_timer + * + * PARAMETERS: none + * + * RETURN: Current value of the ACPI PM Timer (in ticks). + * + * DESCRIPTION: Obtains current value of ACPI PM Timer. + * + ******************************************************************************/ + +ACPI_STATUS +acpi_get_timer ( + u32 *ticks) +{ + if (!ticks) { + return (AE_BAD_PARAMETER); + } + + *ticks = acpi_os_in32 ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm_tmr_blk.address)); + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: Acpi_get_timer_duration + * + * PARAMETERS: Start_ticks + * End_ticks + * Time_elapsed + * + * RETURN: Time_elapsed + * + * DESCRIPTION: Computes the time elapsed (in microseconds) between two + * PM Timer time stamps, taking into account the possibility of + * rollovers, the timer resolution, and timer frequency. + * + * The PM Timer's clock ticks at roughly 3.6 times per + * _microsecond_, and its clock continues through Cx state + * transitions (unlike many CPU timestamp counters) -- making it + * a versatile and accurate timer. + * + * Note that this function accomodates only a single timer + * rollover. Thus for 24-bit timers, this function should only + * be used for calculating durations less than ~4.6 seconds + * (~20 hours for 32-bit timers). + * + ******************************************************************************/ + +ACPI_STATUS +acpi_get_timer_duration ( + u32 start_ticks, + u32 end_ticks, + u32 *time_elapsed) +{ + u32 delta_ticks = 0; + u32 seconds = 0; + u32 milliseconds = 0; + u32 microseconds = 0; + u32 remainder = 0; + + if (!time_elapsed) { + return (AE_BAD_PARAMETER); + } + + /* + * Compute Tick Delta: + * ------------------- + * Handle timer rollovers on 24- versus 32-bit timers. + */ + if (start_ticks < end_ticks) { + delta_ticks = end_ticks - start_ticks; + } + else if (start_ticks > end_ticks) { + /* 24-bit Timer */ + if (0 == acpi_gbl_FADT->tmr_val_ext) { + delta_ticks = (0x00FFFFFF - start_ticks) + end_ticks; + } + /* 32-bit Timer */ + else { + delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks; + } + } + + /* + * Compute Duration: + * ----------------- + * Since certain compilers (gcc/Linux, argh!) don't support 64-bit + * divides in kernel-space we have to do some trickery to preserve + * accuracy while using 32-bit math. + * + * TODO: Change to use 64-bit math when supported. + * + * The process is as follows: + * 1. Compute the number of seconds by dividing Delta Ticks by + * the timer frequency. + * 2. Compute the number of milliseconds in the remainder from step #1 + * by multiplying by 1000 and then dividing by the timer frequency. + * 3. Compute the number of microseconds in the remainder from step #2 + * by multiplying by 1000 and then dividing by the timer frequency. + * 4. Add the results from steps 1, 2, and 3 to get the total duration. + * + * Example: The time elapsed for Delta_ticks = 0xFFFFFFFF should be + * 1199864031 microseconds. This is computed as follows: + * Step #1: Seconds = 1199; Remainder = 3092840 + * Step #2: Milliseconds = 864; Remainder = 113120 + * Step #3: Microseconds = 31; Remainder = <don't care!> + */ + + /* Step #1 */ + seconds = delta_ticks / PM_TIMER_FREQUENCY; + remainder = delta_ticks % PM_TIMER_FREQUENCY; + + /* Step #2 */ + milliseconds = (remainder * 1000) / PM_TIMER_FREQUENCY; + remainder = (remainder * 1000) % PM_TIMER_FREQUENCY; + + /* Step #3 */ + microseconds = (remainder * 1000) / PM_TIMER_FREQUENCY; + + /* Step #4 */ + *time_elapsed = seconds * 1000000; + *time_elapsed += milliseconds * 1000; + *time_elapsed += microseconds; + + return (AE_OK); +} + + diff --git a/drivers/acpi/include/accommon.h b/drivers/acpi/include/accommon.h index 37e13b228..61d54a220 100644 --- a/drivers/acpi/include/accommon.h +++ b/drivers/acpi/include/accommon.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: accommon.h -- prototypes for the common (subsystem-wide) procedures - * $Revision: 82 $ + * $Revision: 87 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -100,6 +100,8 @@ acpi_cm_allocate_owner_id ( * Cm_clib - Local implementations of C library functions */ +#ifndef ACPI_USE_SYSTEM_CLIBRARY + NATIVE_UINT acpi_cm_strlen ( const NATIVE_CHAR *string); @@ -141,7 +143,7 @@ u32 acpi_cm_strtoul ( const NATIVE_CHAR *string, NATIVE_CHAR **terminator, - u32 base); + NATIVE_UINT base); NATIVE_CHAR * acpi_cm_strstr ( @@ -161,7 +163,7 @@ acpi_cm_memcpy ( void * acpi_cm_memset ( void *dest, - u32 value, + NATIVE_UINT value, NATIVE_UINT count); u32 @@ -172,6 +174,7 @@ u32 acpi_cm_to_lower ( u32 c); +#endif /* ACPI_USE_SYSTEM_CLIBRARY */ /* * Cm_copy - Object construction and conversion interfaces @@ -297,7 +300,7 @@ function_value_exit ( u32 line_number, u32 component_id, NATIVE_CHAR *function_name, - NATIVE_UINT value); + ACPI_INTEGER value); void function_ptr_exit ( @@ -596,7 +599,7 @@ acpi_cm_init_static_object ( #define acpi_cm_callocate(a) _cm_callocate(a, _COMPONENT,_THIS_MODULE,__LINE__) #define acpi_cm_free(a) _cm_free(a,_COMPONENT,_THIS_MODULE,__LINE__) -#ifndef ACPI_DEBUG +#ifndef ACPI_DEBUG_TRACK_ALLOCATIONS #define acpi_cm_add_element_to_alloc_list(a,b,c,d,e,f) #define acpi_cm_delete_element_from_alloc_list(a,b,c,d) diff --git a/drivers/acpi/include/acconfig.h b/drivers/acpi/include/acconfig.h index 2b210339b..ea9be649d 100644 --- a/drivers/acpi/include/acconfig.h +++ b/drivers/acpi/include/acconfig.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: acconfig.h - Global configuration constants - * $Revision: 48 $ + * $Revision: 53 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ /* Version string */ -#define ACPI_CA_VERSION __DATE__ +#define ACPI_CA_VERSION 0x20010125 /* Maximum objects in the various object caches */ @@ -122,6 +122,10 @@ #define MTH_NUM_ARGS 7 #define MTH_MAX_ARG 6 +/* Maximum length of resulting string when converting from a buffer */ + +#define ACPI_MAX_STRING_CONVERSION 200 + /* * Operand Stack (in WALK_STATE), Must be large enough to contain MTH_MAX_ARG */ diff --git a/drivers/acpi/include/acdebug.h b/drivers/acpi/include/acdebug.h index 2bc9e7165..f1fa7094e 100644 --- a/drivers/acpi/include/acdebug.h +++ b/drivers/acpi/include/acdebug.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: acdebug.h - ACPI/AML debugger - * $Revision: 37 $ + * $Revision: 39 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/include/acdispat.h b/drivers/acpi/include/acdispat.h index 599e46c36..f5d52cc41 100644 --- a/drivers/acpi/include/acdispat.h +++ b/drivers/acpi/include/acdispat.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: acdispat.h - dispatcher (parser to interpreter interface) - * $Revision: 33 $ + * $Revision: 35 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/include/acenv.h b/drivers/acpi/include/acenv.h index f867a348f..9e4e62339 100644 --- a/drivers/acpi/include/acenv.h +++ b/drivers/acpi/include/acenv.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: acenv.h - Generation environment specific items - * $Revision: 65 $ + * $Revision: 70 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ /* - * Configuration for ACPI Utilities + * Configuration for ACPI tools and utilities */ #ifdef _ACPI_DUMP_APP @@ -55,6 +55,16 @@ #define ACPI_USE_SYSTEM_CLIBRARY #endif +/* + * Memory allocation tracking. Used only if + * 1) This is the debug version + * 2) This is NOT a 16-bit version of the code (not enough real-mode memory) + */ +#ifdef ACPI_DEBUG +#ifndef _IA16 +#define ACPI_DEBUG_TRACK_ALLOCATIONS +#endif +#endif /* * Environment configuration. The purpose of this file is to interface to the @@ -154,17 +164,17 @@ #define STRUPR(s) strupr((s)) #define STRLEN(s) strlen((s)) #define STRCPY(d,s) strcpy((d), (s)) -#define STRNCPY(d,s,n) strncpy((d), (s), (n)) -#define STRNCMP(d,s,n) strncmp((d), (s), (n)) +#define STRNCPY(d,s,n) strncpy((d), (s), (NATIVE_INT)(n)) +#define STRNCMP(d,s,n) strncmp((d), (s), (NATIVE_INT)(n)) #define STRCMP(d,s) strcmp((d), (s)) #define STRCAT(d,s) strcat((d), (s)) -#define STRNCAT(d,s,n) strncat((d), (s), (n)) -#define STRTOUL(d,s,n) strtoul((d), (s), (n)) -#define MEMCPY(d,s,n) memcpy((d), (s), (n)) -#define MEMSET(d,s,n) memset((d), (s), (n)) +#define STRNCAT(d,s,n) strncat((d), (s), (NATIVE_INT)(n)) +#define STRTOUL(d,s,n) strtoul((d), (s), (NATIVE_INT)(n)) +#define MEMCPY(d,s,n) memcpy((d), (s), (NATIVE_INT)(n)) +#define MEMSET(d,s,n) memset((d), (s), (NATIVE_INT)(n)) #define TOUPPER toupper #define TOLOWER tolower - +#define IS_XDIGIT isxdigit /****************************************************************************** * diff --git a/drivers/acpi/include/acevents.h b/drivers/acpi/include/acevents.h index 3e76370bf..b7d335451 100644 --- a/drivers/acpi/include/acevents.h +++ b/drivers/acpi/include/acevents.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: acevents.h - Event subcomponent prototypes and defines - * $Revision: 62 $ + * $Revision: 63 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/include/acexcep.h b/drivers/acpi/include/acexcep.h index 1629a0934..8fb267585 100644 --- a/drivers/acpi/include/acexcep.h +++ b/drivers/acpi/include/acexcep.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: acexcep.h - Exception codes returned by the ACPI subsystem - * $Revision: 37 $ + * $Revision: 41 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -116,8 +116,10 @@ #define AE_AML_NAME_NOT_FOUND (ACPI_STATUS) (0x0010 | AE_CODE_AML) #define AE_AML_INTERNAL (ACPI_STATUS) (0x0011 | AE_CODE_AML) #define AE_AML_INVALID_SPACE_ID (ACPI_STATUS) (0x0012 | AE_CODE_AML) +#define AE_AML_STRING_LIMIT (ACPI_STATUS) (0x0013 | AE_CODE_AML) +#define AE_AML_NO_RETURN_VALUE (ACPI_STATUS) (0x0014 | AE_CODE_AML) -#define AE_CODE_AML_MAX 0x0012 +#define AE_CODE_AML_MAX 0x0014 /* * Internal exceptions used for control @@ -202,6 +204,8 @@ static NATIVE_CHAR *acpi_gbl_exception_names_aml[] = "AE_AML_NAME_NOT_FOUND", "AE_AML_INTERNAL", "AE_AML_INVALID_SPACE_ID", + "AE_AML_STRING_LIMIT", + "AE_AML_NO_RETURN_VALUE", }; static NATIVE_CHAR *acpi_gbl_exception_names_ctrl[] = diff --git a/drivers/acpi/include/acgcc.h b/drivers/acpi/include/acgcc.h index 5992f493d..82b1e5139 100644 --- a/drivers/acpi/include/acgcc.h +++ b/drivers/acpi/include/acgcc.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: acgcc.h - GCC specific defines, etc. - * $Revision: 2 $ + * $Revision: 4 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/include/acglobal.h b/drivers/acpi/include/acglobal.h index 248f72c9d..36444038c 100644 --- a/drivers/acpi/include/acglobal.h +++ b/drivers/acpi/include/acglobal.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: acglobal.h - Declarations for global variables - * $Revision: 92 $ + * $Revision: 96 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -154,7 +154,6 @@ ACPI_EXTERN u8 acpi_gbl_global_lock_set; /* TBD: [Restr ACPI_EXTERN u8 acpi_gbl_step_to_next_call; ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; - ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER acpi_gbl_drv_notify; ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER acpi_gbl_sys_notify; @@ -162,7 +161,8 @@ ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER acpi_gbl_sys_notify; extern u8 acpi_gbl_shutdown; extern u32 acpi_gbl_system_flags; extern u32 acpi_gbl_startup_flags; -extern u8 acpi_gbl_decode_to8bit[]; +extern u8 acpi_gbl_decode_to8bit[8]; +extern NATIVE_CHAR acpi_gbl_hex_to_ascii[]; /***************************************************************************** diff --git a/drivers/acpi/include/achware.h b/drivers/acpi/include/achware.h index 1a206e8d2..efb97bd2f 100644 --- a/drivers/acpi/include/achware.h +++ b/drivers/acpi/include/achware.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: achware.h -- hardware specific interfaces - * $Revision: 48 $ + * $Revision: 53 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,10 @@ #define __ACHWARE_H__ +/* PM Timer ticks per second (HZ) */ +#define PM_TIMER_FREQUENCY 3579545 + + /* Prototypes */ @@ -92,6 +96,10 @@ void acpi_hw_clear_acpi_status ( void); +u32 +acpi_hw_get_bit_shift ( + u32 mask); + /* GPE support */ @@ -121,89 +129,21 @@ acpi_hw_obtain_sleep_type_register_data ( u8 *slp_typ_b); -/* Cx State Prototypes */ - -ACPI_STATUS -acpi_hw_enter_c1( - ACPI_IO_ADDRESS pblk_address, - u32 *pm_timer_ticks); - -ACPI_STATUS -acpi_hw_enter_c2( - ACPI_IO_ADDRESS pblk_address, - u32 *pm_timer_ticks); - -ACPI_STATUS -acpi_hw_enter_c3( - ACPI_IO_ADDRESS pblk_address, - u32 *pm_timer_ticks); - -ACPI_STATUS -acpi_hw_enter_cx ( - ACPI_IO_ADDRESS pblk_address, - u32 *pm_timer_ticks); - -ACPI_STATUS -acpi_hw_set_cx ( - u32 cx_state); - -ACPI_STATUS -acpi_hw_get_cx_info ( - u32 cx_states[]); +/* ACPI Timer prototypes */ ACPI_STATUS -acpi_hw_get_cx_handler ( - u32 cx_state, - ACPI_C_STATE_HANDLER *handler); +acpi_get_timer_resolution ( + u32 *resolution); ACPI_STATUS -acpi_hw_set_cx_handler ( - u32 cx_state, - ACPI_C_STATE_HANDLER handler); - - -/* Throttling Prototypes */ - -void -acpi_hw_enable_throttling ( - ACPI_IO_ADDRESS pblk_address); - -void -acpi_hw_disable_throttling ( - ACPI_IO_ADDRESS pblk_address); - -u32 -acpi_hw_get_duty_cycle ( - u8 duty_offset, - ACPI_IO_ADDRESS pblk_address, - u32 num_throttle_states); - -void -acpi_hw_program_duty_cycle ( - u8 duty_offset, - u32 duty_cycle, - ACPI_IO_ADDRESS pblk_address, - u32 num_throttle_states); - -NATIVE_UINT -acpi_hw_local_pow ( - NATIVE_UINT x, - NATIVE_UINT y); - - -/* ACPI Timer prototypes */ - -u32 -acpi_hw_pmt_ticks ( - void); - -u32 -acpi_hw_pmt_resolution ( - void); +acpi_get_timer ( + u32 *ticks); ACPI_STATUS -acpi_get_timer ( - u32 *out_ticks); +acpi_get_timer_duration ( + u32 start_ticks, + u32 end_ticks, + u32 *time_elapsed); #endif /* __ACHWARE_H__ */ diff --git a/drivers/acpi/include/acinterp.h b/drivers/acpi/include/acinterp.h index c8c967492..6eb571e5f 100644 --- a/drivers/acpi/include/acinterp.h +++ b/drivers/acpi/include/acinterp.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: acinterp.h - Interpreter subcomponent prototypes and defines - * $Revision: 86 $ + * $Revision: 91 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -70,9 +70,34 @@ acpi_aml_execute_method ( /* - * amfield - ACPI AML (p-code) execution - field manipulation + * amconvrt - object conversion */ +ACPI_STATUS +acpi_aml_convert_to_integer ( + ACPI_OPERAND_OBJECT **obj_desc, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_convert_to_buffer ( + ACPI_OPERAND_OBJECT **obj_desc, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_convert_to_string ( + ACPI_OPERAND_OBJECT **obj_desc, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_convert_to_target_type ( + OBJECT_TYPE_INTERNAL destination_type, + ACPI_OPERAND_OBJECT **obj_desc, + ACPI_WALK_STATE *walk_state); + + +/* + * amfield - ACPI AML (p-code) execution - field manipulation + */ ACPI_STATUS acpi_aml_read_field ( @@ -419,17 +444,75 @@ acpi_aml_exec_store ( ACPI_WALK_STATE *walk_state); ACPI_STATUS -acpi_aml_store_object_to_object ( +acpi_aml_store_object_to_index ( ACPI_OPERAND_OBJECT *val_desc, ACPI_OPERAND_OBJECT *dest_desc, ACPI_WALK_STATE *walk_state); ACPI_STATUS acpi_aml_store_object_to_node ( - ACPI_OPERAND_OBJECT *val_desc, + ACPI_OPERAND_OBJECT *source_desc, ACPI_NAMESPACE_NODE *node, ACPI_WALK_STATE *walk_state); +ACPI_STATUS +acpi_aml_store_object_to_object ( + ACPI_OPERAND_OBJECT *source_desc, + ACPI_OPERAND_OBJECT *dest_desc, + ACPI_WALK_STATE *walk_state); + + +/* + * + */ + +ACPI_STATUS +acpi_aml_resolve_object ( + ACPI_OPERAND_OBJECT **source_desc_ptr, + OBJECT_TYPE_INTERNAL target_type, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_store_object ( + ACPI_OPERAND_OBJECT *source_desc, + OBJECT_TYPE_INTERNAL target_type, + ACPI_OPERAND_OBJECT **target_desc_ptr, + ACPI_WALK_STATE *walk_state); + + +/* + * amcopy - object copy + */ + +ACPI_STATUS +acpi_aml_copy_buffer_to_buffer ( + ACPI_OPERAND_OBJECT *source_desc, + ACPI_OPERAND_OBJECT *target_desc); + +ACPI_STATUS +acpi_aml_copy_string_to_string ( + ACPI_OPERAND_OBJECT *source_desc, + ACPI_OPERAND_OBJECT *target_desc); + +ACPI_STATUS +acpi_aml_copy_integer_to_index_field ( + ACPI_OPERAND_OBJECT *source_desc, + ACPI_OPERAND_OBJECT *target_desc); + +ACPI_STATUS +acpi_aml_copy_integer_to_bank_field ( + ACPI_OPERAND_OBJECT *source_desc, + ACPI_OPERAND_OBJECT *target_desc); + +ACPI_STATUS +acpi_aml_copy_data_to_named_field ( + ACPI_OPERAND_OBJECT *source_desc, + ACPI_NAMESPACE_NODE *node); + +ACPI_STATUS +acpi_aml_copy_integer_to_field_unit ( + ACPI_OPERAND_OBJECT *source_desc, + ACPI_OPERAND_OBJECT *target_desc); /* * amutils - interpreter/scanner utilities diff --git a/drivers/acpi/include/aclinux.h b/drivers/acpi/include/aclinux.h index 673d5f96b..0cf0e2845 100644 --- a/drivers/acpi/include/aclinux.h +++ b/drivers/acpi/include/aclinux.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: aclinux.h - OS specific defines, etc. - * $Revision: 6 $ + * $Revision: 7 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/include/aclocal.h b/drivers/acpi/include/aclocal.h index a647026f1..2d931387e 100644 --- a/drivers/acpi/include/aclocal.h +++ b/drivers/acpi/include/aclocal.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: aclocal.h - Internal data types used across the ACPI subsystem - * $Revision: 95 $ + * $Revision: 100 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -74,7 +74,7 @@ typedef u32 ACPI_MUTEX_HANDLE; #define NUM_MTX MAX_MTX+1 -#ifdef ACPI_DEBUG +#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER) #ifdef DEFINE_ACPI_GLOBALS /* Names for the mutexes used in the subsystem */ @@ -476,7 +476,9 @@ typedef struct acpi_opcode_info u32 parse_args; /* Grammar/Parse time arguments */ u32 runtime_args; /* Interpret time arguments */ - DEBUG_ONLY_MEMBERS (NATIVE_CHAR *name) /* op name (debug only) */ +#ifdef _OPCODE_NAMES + NATIVE_CHAR *name; /* op name (debug only) */ +#endif } ACPI_OPCODE_INFO; @@ -591,6 +593,7 @@ typedef struct acpi_walk_state ACPI_GENERIC_STATE *scope_info; /* Stack of nested scopes */ ACPI_PARSE_STATE *parser_state; /* Current state of parser */ u8 *aml_last_while; + ACPI_OPCODE_INFO *op_info; /* Info on current opcode */ ACPI_PARSE_DOWNWARDS descending_callback; ACPI_PARSE_UPWARDS ascending_callback; @@ -605,6 +608,7 @@ typedef struct acpi_walk_state u32 parse_flags; u8 walk_type; u8 return_used; + u16 opcode; /* Current AML opcode */ u32 prev_arg_types; /* Debug support */ @@ -728,14 +732,16 @@ typedef struct acpi_get_devices_info #define PM1_STS 0x0100 #define PM1_EN 0x0200 #define PM1_CONTROL 0x0300 -#define PM2_CONTROL 0x0400 -#define PM_TIMER 0x0500 -#define PROCESSOR_BLOCK 0x0600 -#define GPE0_STS_BLOCK 0x0700 -#define GPE0_EN_BLOCK 0x0800 -#define GPE1_STS_BLOCK 0x0900 -#define GPE1_EN_BLOCK 0x0A00 -#define SMI_CMD_BLOCK 0x0B00 +#define PM1_a_CONTROL 0x0400 +#define PM1_b_CONTROL 0x0500 +#define PM2_CONTROL 0x0600 +#define PM_TIMER 0x0700 +#define PROCESSOR_BLOCK 0x0800 +#define GPE0_STS_BLOCK 0x0900 +#define GPE0_EN_BLOCK 0x0A00 +#define GPE1_STS_BLOCK 0x0B00 +#define GPE1_EN_BLOCK 0x0C00 +#define SMI_CMD_BLOCK 0x0D00 /* * Address space bitmasks for mmio or io spaces @@ -751,66 +757,66 @@ typedef struct acpi_get_devices_info /* * Control bit definitions */ -#define TMR_STS (PM1_STS | 0x01) -#define BM_STS (PM1_STS | 0x02) -#define GBL_STS (PM1_STS | 0x03) -#define PWRBTN_STS (PM1_STS | 0x04) -#define SLPBTN_STS (PM1_STS | 0x05) -#define RTC_STS (PM1_STS | 0x06) -#define WAK_STS (PM1_STS | 0x07) - -#define TMR_EN (PM1_EN | 0x01) +#define TMR_STS (PM1_STS | 0x01) +#define BM_STS (PM1_STS | 0x02) +#define GBL_STS (PM1_STS | 0x03) +#define PWRBTN_STS (PM1_STS | 0x04) +#define SLPBTN_STS (PM1_STS | 0x05) +#define RTC_STS (PM1_STS | 0x06) +#define WAK_STS (PM1_STS | 0x07) + +#define TMR_EN (PM1_EN | 0x01) /* no BM_EN */ -#define GBL_EN (PM1_EN | 0x03) -#define PWRBTN_EN (PM1_EN | 0x04) -#define SLPBTN_EN (PM1_EN | 0x05) -#define RTC_EN (PM1_EN | 0x06) -#define WAK_EN (PM1_EN | 0x07) +#define GBL_EN (PM1_EN | 0x03) +#define PWRBTN_EN (PM1_EN | 0x04) +#define SLPBTN_EN (PM1_EN | 0x05) +#define RTC_EN (PM1_EN | 0x06) +#define WAK_EN (PM1_EN | 0x07) -#define SCI_EN (PM1_CONTROL | 0x01) -#define BM_RLD (PM1_CONTROL | 0x02) -#define GBL_RLS (PM1_CONTROL | 0x03) -#define SLP_TYPE_A (PM1_CONTROL | 0x04) -#define SLP_TYPE_B (PM1_CONTROL | 0x05) -#define SLP_EN (PM1_CONTROL | 0x06) +#define SCI_EN (PM1_CONTROL | 0x01) +#define BM_RLD (PM1_CONTROL | 0x02) +#define GBL_RLS (PM1_CONTROL | 0x03) +#define SLP_TYPE_A (PM1_CONTROL | 0x04) +#define SLP_TYPE_B (PM1_CONTROL | 0x05) +#define SLP_EN (PM1_CONTROL | 0x06) -#define ARB_DIS (PM2_CONTROL | 0x01) +#define ARB_DIS (PM2_CONTROL | 0x01) -#define TMR_VAL (PM_TIMER | 0x01) +#define TMR_VAL (PM_TIMER | 0x01) -#define GPE0_STS (GPE0_STS_BLOCK | 0x01) -#define GPE0_EN (GPE0_EN_BLOCK | 0x01) +#define GPE0_STS (GPE0_STS_BLOCK | 0x01) +#define GPE0_EN (GPE0_EN_BLOCK | 0x01) -#define GPE1_STS (GPE1_STS_BLOCK | 0x01) -#define GPE1_EN (GPE1_EN_BLOCK | 0x01) +#define GPE1_STS (GPE1_STS_BLOCK | 0x01) +#define GPE1_EN (GPE1_EN_BLOCK | 0x01) -#define TMR_STS_MASK 0x0001 -#define BM_STS_MASK 0x0010 -#define GBL_STS_MASK 0x0020 -#define PWRBTN_STS_MASK 0x0100 -#define SLPBTN_STS_MASK 0x0200 -#define RTC_STS_MASK 0x0400 -#define WAK_STS_MASK 0x8000 +#define TMR_STS_MASK 0x0001 +#define BM_STS_MASK 0x0010 +#define GBL_STS_MASK 0x0020 +#define PWRBTN_STS_MASK 0x0100 +#define SLPBTN_STS_MASK 0x0200 +#define RTC_STS_MASK 0x0400 +#define WAK_STS_MASK 0x8000 -#define ALL_FIXED_STS_BITS (TMR_STS_MASK | BM_STS_MASK | GBL_STS_MASK \ - | PWRBTN_STS_MASK | SLPBTN_STS_MASK \ - | RTC_STS_MASK | WAK_STS_MASK) +#define ALL_FIXED_STS_BITS (TMR_STS_MASK | BM_STS_MASK | GBL_STS_MASK \ + | PWRBTN_STS_MASK | SLPBTN_STS_MASK \ + | RTC_STS_MASK | WAK_STS_MASK) -#define TMR_EN_MASK 0x0001 -#define GBL_EN_MASK 0x0020 -#define PWRBTN_EN_MASK 0x0100 -#define SLPBTN_EN_MASK 0x0200 -#define RTC_EN_MASK 0x0400 +#define TMR_EN_MASK 0x0001 +#define GBL_EN_MASK 0x0020 +#define PWRBTN_EN_MASK 0x0100 +#define SLPBTN_EN_MASK 0x0200 +#define RTC_EN_MASK 0x0400 -#define SCI_EN_MASK 0x0001 -#define BM_RLD_MASK 0x0002 -#define GBL_RLS_MASK 0x0004 -#define SLP_TYPE_X_MASK 0x1C00 -#define SLP_EN_MASK 0x2000 +#define SCI_EN_MASK 0x0001 +#define BM_RLD_MASK 0x0002 +#define GBL_RLS_MASK 0x0004 +#define SLP_TYPE_X_MASK 0x1C00 +#define SLP_EN_MASK 0x2000 -#define ARB_DIS_MASK 0x0001 -#define TMR_VAL_MASK 0xFFFFFFFF +#define ARB_DIS_MASK 0x0001 +#define TMR_VAL_MASK 0xFFFFFFFF #define GPE0_STS_MASK #define GPE0_EN_MASK @@ -819,8 +825,8 @@ typedef struct acpi_get_devices_info #define GPE1_EN_MASK -#define ACPI_READ 1 -#define ACPI_WRITE 2 +#define ACPI_READ 1 +#define ACPI_WRITE 2 /* Plug and play */ diff --git a/drivers/acpi/include/acmacros.h b/drivers/acpi/include/acmacros.h index 19cfa0591..7bed83ddd 100644 --- a/drivers/acpi/include/acmacros.h +++ b/drivers/acpi/include/acmacros.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: acmacros.h - C macros for the entire subsystem. - * $Revision: 59 $ + * $Revision: 62 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,6 +30,14 @@ * Data manipulation macros */ +#ifndef LODWORD +#define LODWORD(l) ((u32)(UINT64)(l)) +#endif + +#ifndef HIDWORD +#define HIDWORD(l) ((u32)((((UINT64)(l)) >> 32) & 0xFFFFFFFF)) +#endif + #ifndef LOWORD #define LOWORD(l) ((u16)(NATIVE_UINT)(l)) #endif @@ -64,10 +72,18 @@ #ifdef _IA16 +/* + * For 16-bit addresses, we have to assume that the upper 32 bits + * are zero. + */ #define ACPI_GET_ADDRESS(a) ((a).lo) #define ACPI_STORE_ADDRESS(a,b) {(a).hi=0;(a).lo=(b);} -#define ACPI_VALID_ADDRESS(a) ((a).hi && (a).lo) +#define ACPI_VALID_ADDRESS(a) ((a).hi | (a).lo) + #else +/* + * Full 64-bit address on 32-bit and 64-bit platforms + */ #define ACPI_GET_ADDRESS(a) (a) #define ACPI_STORE_ADDRESS(a,b) ((a)=(b)) #define ACPI_VALID_ADDRESS(a) (a) @@ -335,7 +351,7 @@ */ #define return_VOID {function_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name);return;} #define return_ACPI_STATUS(s) {function_status_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,s);return(s);} -#define return_VALUE(s) {function_value_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,(NATIVE_UINT)s);return(s);} +#define return_VALUE(s) {function_value_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,(ACPI_INTEGER)s);return(s);} #define return_PTR(s) {function_ptr_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,(u8 *)s);return(s);} @@ -346,6 +362,8 @@ #define DEBUG_DEFINE(a) a; #define DEBUG_ONLY_MEMBERS(a) a; +#define _OPCODE_NAMES +#define _VERBOSE_STRUCTURES /* Stack and buffer dumping */ @@ -458,9 +476,8 @@ */ #ifdef _IA16 #undef DEBUG_ONLY_MEMBERS +#undef _VERBOSE_STRUCTURES #define DEBUG_ONLY_MEMBERS(a) -#undef OP_INFO_ENTRY -#define OP_INFO_ENTRY(flags,name,Pargs,Iargs) {flags,Pargs,Iargs} #endif diff --git a/drivers/acpi/include/acnamesp.h b/drivers/acpi/include/acnamesp.h index e010a8118..d6acb8444 100644 --- a/drivers/acpi/include/acnamesp.h +++ b/drivers/acpi/include/acnamesp.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: acnamesp.h - Namespace subcomponent prototypes and defines - * $Revision: 100 $ + * $Revision: 101 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/include/acobject.h b/drivers/acpi/include/acobject.h index c801ff117..9394b470a 100644 --- a/drivers/acpi/include/acobject.h +++ b/drivers/acpi/include/acobject.h @@ -2,12 +2,12 @@ /****************************************************************************** * * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only) - * $Revision: 75 $ + * $Revision: 78 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -113,10 +113,10 @@ typedef struct /* NUMBER - has value */ ACPI_INTEGER value; -} ACPI_OBJECT_NUMBER; +} ACPI_OBJECT_INTEGER; -typedef struct /* STRING - has length and pointer */ +typedef struct /* STRING - has length and pointer - Null terminated, ASCII characters only */ { ACPI_OBJECT_COMMON_HEADER @@ -126,13 +126,11 @@ typedef struct /* STRING - has length and pointer */ } ACPI_OBJECT_STRING; -typedef struct /* BUFFER - has length, sequence, and pointer */ +typedef struct /* BUFFER - has length and pointer - not null terminated */ { ACPI_OBJECT_COMMON_HEADER u32 length; - u32 sequence; /* Sequential count of buffers created */ - u8 *pointer; /* points to the buffer in allocated space */ } ACPI_OBJECT_BUFFER; @@ -398,7 +396,7 @@ typedef union acpi_operand_obj { ACPI_OBJECT_COMMON common; ACPI_OBJECT_CACHE_LIST cache; - ACPI_OBJECT_NUMBER number; + ACPI_OBJECT_INTEGER integer; ACPI_OBJECT_STRING string; ACPI_OBJECT_BUFFER buffer; ACPI_OBJECT_PACKAGE package; diff --git a/drivers/acpi/include/acoutput.h b/drivers/acpi/include/acoutput.h index 664a5f8a8..5c20943cb 100644 --- a/drivers/acpi/include/acoutput.h +++ b/drivers/acpi/include/acoutput.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: acoutput.h -- debug output - * $Revision: 66 $ + * $Revision: 69 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -58,6 +58,7 @@ #define BATTERY 0x00040000 #define DEBUGGER 0x00100000 +#define COMPILER 0x00200000 #define ALL_COMPONENTS 0x001FFFFF #define COMPONENT_DEFAULT (ALL_COMPONENTS) diff --git a/drivers/acpi/include/acparser.h b/drivers/acpi/include/acparser.h index d657749da..9b4bfabea 100644 --- a/drivers/acpi/include/acparser.h +++ b/drivers/acpi/include/acparser.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: acparser.h - AML Parser subcomponent prototypes and defines - * $Revision: 47 $ + * $Revision: 49 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/include/acpi.h b/drivers/acpi/include/acpi.h index 4896c4a7f..344b01a77 100644 --- a/drivers/acpi/include/acpi.h +++ b/drivers/acpi/include/acpi.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: acpi.h - Master include file, Publics and external data. - * $Revision: 48 $ + * $Revision: 50 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/include/acpiosxf.h b/drivers/acpi/include/acpiosxf.h index 2f9eb4c13..ee289f33e 100644 --- a/drivers/acpi/include/acpiosxf.h +++ b/drivers/acpi/include/acpiosxf.h @@ -9,7 +9,7 @@ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -121,6 +121,10 @@ acpi_os_unmap_memory ( void *logical_address, u32 length); +ACPI_STATUS +acpi_os_get_physical_address ( + void *logical_address, + ACPI_PHYSICAL_ADDRESS *physical_address); /* * Interrupt handlers diff --git a/drivers/acpi/include/acpixf.h b/drivers/acpi/include/acpixf.h index d70fa75a7..8d293818f 100644 --- a/drivers/acpi/include/acpixf.h +++ b/drivers/acpi/include/acpixf.h @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -285,6 +285,10 @@ acpi_get_firmware_waking_vector ( ACPI_PHYSICAL_ADDRESS *physical_address); ACPI_STATUS +acpi_enter_sleep_state ( + u8 sleep_state); + +ACPI_STATUS acpi_get_processor_throttling_info ( ACPI_HANDLE processor_handle, ACPI_BUFFER *user_buffer); diff --git a/drivers/acpi/include/acresrc.h b/drivers/acpi/include/acresrc.h index 3bb19490d..0852367d2 100644 --- a/drivers/acpi/include/acresrc.h +++ b/drivers/acpi/include/acresrc.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: acresrc.h - Resource Manager function prototypes - * $Revision: 20 $ + * $Revision: 22 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/include/actables.h b/drivers/acpi/include/actables.h index 4dd724517..be8b5e3b0 100644 --- a/drivers/acpi/include/actables.h +++ b/drivers/acpi/include/actables.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: actables.h - ACPI table management - * $Revision: 27 $ + * $Revision: 29 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/include/actbl.h b/drivers/acpi/include/actbl.h index 34631e820..7a41842d2 100644 --- a/drivers/acpi/include/actbl.h +++ b/drivers/acpi/include/actbl.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: actbl.h - Table data structures defined in ACPI specification - * $Revision: 43 $ + * $Revision: 45 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/include/actbl1.h b/drivers/acpi/include/actbl1.h index 019ba1680..5c68ca050 100644 --- a/drivers/acpi/include/actbl1.h +++ b/drivers/acpi/include/actbl1.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: actbl1.h - ACPI 1.0 tables - * $Revision: 15 $ + * $Revision: 17 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/include/actbl2.h b/drivers/acpi/include/actbl2.h index e3ccf2188..0a05efa1c 100644 --- a/drivers/acpi/include/actbl2.h +++ b/drivers/acpi/include/actbl2.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: actbl2.h - ACPI Specification Revision 2.0 Tables - * $Revision: 19 $ + * $Revision: 21 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -142,8 +142,8 @@ typedef struct u16 plvl3_lat; /* worst case HW latency to enter/exit C3 state */ u16 flush_size; /* number of flush strides that need to be read */ u16 flush_stride; /* Processor's memory cache line width, in bytes */ - u8 duty_offset; /* Processor’s duty cycle index in processor's P_CNT reg*/ - u8 duty_width; /* Processor’s duty cycle value bit width in P_CNT register.*/ + u8 duty_offset; /* Processor_’s duty cycle index in processor's P_CNT reg*/ + u8 duty_width; /* Processor_’s duty cycle value bit width in P_CNT register.*/ u8 day_alrm; /* index to day-of-month alarm in RTC CMOS RAM */ u8 mon_alrm; /* index to month-of-year alarm in RTC CMOS RAM */ u8 century; /* index to century in RTC CMOS RAM */ diff --git a/drivers/acpi/include/actbl71.h b/drivers/acpi/include/actbl71.h index 408ec402e..095806ccb 100644 --- a/drivers/acpi/include/actbl71.h +++ b/drivers/acpi/include/actbl71.h @@ -3,12 +3,12 @@ * Name: actbl71.h - IA-64 Extensions to the ACPI Spec Rev. 0.71 * This file includes tables specific to this * specification revision. - * $Revision: 7 $ + * $Revision: 9 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/include/actypes.h b/drivers/acpi/include/actypes.h index dfa28a9d9..826fc8901 100644 --- a/drivers/acpi/include/actypes.h +++ b/drivers/acpi/include/actypes.h @@ -1,12 +1,12 @@ /****************************************************************************** * * Name: actypes.h - Common data types for the entire ACPI subsystem - * $Revision: 159 $ + * $Revision: 163 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -97,7 +97,7 @@ typedef INT16 NATIVE_INT; typedef UINT32 ACPI_TBLPTR; typedef UINT32 ACPI_IO_ADDRESS; -typedef void *ACPI_PHYSICAL_ADDRESS; +typedef char *ACPI_PHYSICAL_ADDRESS; #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 #define _HW_ALIGNMENT_SUPPORT @@ -249,8 +249,9 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_STATE_S2 (u8) 2 #define ACPI_STATE_S3 (u8) 3 #define ACPI_STATE_S4 (u8) 4 -#define ACPI_STATE_S4_bIOS (u8) 5 -#define ACPI_STATE_S5 (u8) 6 +#define ACPI_STATE_S5 (u8) 5 +/* let's pretend S4_bIOS didn't exist for now. ASG */ +#define ACPI_STATE_S4_bIOS (u8) 6 #define ACPI_S_STATES_MAX ACPI_STATE_S5 @@ -284,8 +285,37 @@ typedef u32 ACPI_TABLE_TYPE; typedef u32 ACPI_OBJECT_TYPE; typedef u8 OBJECT_TYPE_INTERNAL; +#define ACPI_BTYPE_ANY 0x00000000 +#define ACPI_BTYPE_INTEGER 0x00000001 +#define ACPI_BTYPE_STRING 0x00000002 +#define ACPI_BTYPE_BUFFER 0x00000004 +#define ACPI_BTYPE_PACKAGE 0x00000008 +#define ACPI_BTYPE_FIELD_UNIT 0x00000010 +#define ACPI_BTYPE_DEVICE 0x00000020 +#define ACPI_BTYPE_EVENT 0x00000040 +#define ACPI_BTYPE_METHOD 0x00000080 +#define ACPI_BTYPE_MUTEX 0x00000100 +#define ACPI_BTYPE_REGION 0x00000200 +#define ACPI_BTYPE_POWER 0x00000400 +#define ACPI_BTYPE_PROCESSOR 0x00000800 +#define ACPI_BTYPE_THERMAL 0x00001000 +#define ACPI_BTYPE_BUFFER_FIELD 0x00002000 +#define ACPI_BTYPE_DDB_HANDLE 0x00004000 +#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 +#define ACPI_BTYPE_REFERENCE 0x00010000 +#define ACPI_BTYPE_RESOURCE 0x00020000 + +#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) + +#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) +#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) +#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) +#define ACPI_BTYPE_OBJECTS_AND_REFS 0x00017FFF /* ARG or LOCAL */ +#define ACPI_BTYPE_ALL_OBJECTS 0x00007FFF + + #define ACPI_TYPE_ANY 0 /* 0x00 */ -#define ACPI_TYPE_NUMBER 1 /* 0x01 Byte/Word/Dword/Zero/One/Ones */ +#define ACPI_TYPE_INTEGER 1 /* 0x01 Byte/Word/Dword/Zero/One/Ones */ #define ACPI_TYPE_STRING 2 /* 0x02 */ #define ACPI_TYPE_BUFFER 3 /* 0x03 */ #define ACPI_TYPE_PACKAGE 4 /* 0x04 Byte_const, multiple Data_term/Constant/Super_name */ @@ -432,7 +462,7 @@ typedef union acpi_obj { ACPI_OBJECT_TYPE type; ACPI_INTEGER value; /* The actual number */ - } number; + } integer; struct { diff --git a/drivers/acpi/include/amlcode.h b/drivers/acpi/include/amlcode.h index 9a5cb2c52..707e7535d 100644 --- a/drivers/acpi/include/amlcode.h +++ b/drivers/acpi/include/amlcode.h @@ -3,12 +3,12 @@ * Name: amlcode.h - Definitions for AML, as included in "definition blocks" * Declarations and definitions contained herein are derived * directly from the ACPI specification. - * $Revision: 42 $ + * $Revision: 46 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -211,27 +211,42 @@ #define ARGP_TERMARG 0x0E #define ARGP_TERMLIST 0x0F #define ARGP_WORDDATA 0x10 +#define ARGP_QWORDDATA 0x11 +#define ARGP_SIMPLENAME 0x12 /* * Resolved argument types for the AML Interpreter * Each field in the Arg_types u32 is 5 bits, allowing for a maximum of 6 arguments. - * There can be up to 31 unique argument types + * There can be up to 31 unique argument types (0 is end-of-arg-list indicator) */ -#define ARGI_ANYTYPE 0x01 -#define ARGI_TARGETREF 0x02 -#define ARGI_REFERENCE 0x03 -#define ARGI_IF 0x04 -#define ARGI_NUMBER 0x05 -#define ARGI_STRING 0x06 -#define ARGI_BUFFER 0x07 -#define ARGI_PACKAGE 0x08 -#define ARGI_DATAOBJECT 0x09 /* Buffer, string, package or reference to a Node - Used only by Size_of operator*/ -#define ARGI_COMPLEXOBJ 0x0A /* Buffer or package */ -#define ARGI_MUTEX 0x0B -#define ARGI_EVENT 0x0C -#define ARGI_REGION 0x0D -#define ARGI_DDBHANDLE 0x0E +/* "Standard" ACPI types are 1-15 (0x0F) */ + +#define ARGI_INTEGER ACPI_TYPE_INTEGER /* 1 */ +#define ARGI_STRING ACPI_TYPE_STRING /* 2 */ +#define ARGI_BUFFER ACPI_TYPE_BUFFER /* 3 */ +#define ARGI_PACKAGE ACPI_TYPE_PACKAGE /* 4 */ +#define ARGI_EVENT ACPI_TYPE_EVENT +#define ARGI_MUTEX ACPI_TYPE_MUTEX +#define ARGI_REGION ACPI_TYPE_REGION +#define ARGI_DDBHANDLE ACPI_TYPE_DDB_HANDLE + +/* Custom types are 0x10 through 0x1F */ + +#define ARGI_IF 0x10 +#define ARGI_ANYOBJECT 0x11 +#define ARGI_ANYTYPE 0x12 +#define ARGI_COMPUTEDATA 0x13 /* Buffer, String, or Integer */ +#define ARGI_DATAOBJECT 0x14 /* Buffer, string, package or reference to a Node - Used only by Size_of operator*/ +#define ARGI_COMPLEXOBJ 0x15 /* Buffer or package */ +#define ARGI_INTEGER_REF 0x16 +#define ARGI_OBJECT_REF 0x17 +#define ARGI_DEVICE_REF 0x18 +#define ARGI_REFERENCE 0x19 +#define ARGI_TARGETREF 0x1A /* Target, subject to implicit conversion */ +#define ARGI_FIXED_TARGET 0x1B /* Target, no implicit conversion */ +#define ARGI_SIMPLE_TARGET 0x1C /* Name, Local, Arg -- no implicit conversion */ +#define ARGI_BUFFERSTRING 0x1D #define ARGI_INVALID_OPCODE 0xFFFFFFFF diff --git a/drivers/acpi/interpreter/amconfig.c b/drivers/acpi/interpreter/amconfig.c index 55e5b0510..497f35375 100644 --- a/drivers/acpi/interpreter/amconfig.c +++ b/drivers/acpi/interpreter/amconfig.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: amconfig - Namespace reconfiguration (Load/Unload opcodes) - * $Revision: 26 $ + * $Revision: 29 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -73,7 +73,8 @@ acpi_aml_exec_load_table ( table_header.length = 0; for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++) { status = acpi_ev_address_space_dispatch (rgn_desc, ADDRESS_SPACE_READ, - i, 8, (u32 *) ((u8 *) &table_header + i)); + (ACPI_PHYSICAL_ADDRESS) i, 8, + (u32 *) ((u8 *) &table_header + i)); if (ACPI_FAILURE (status)) { return (status); } @@ -96,7 +97,8 @@ acpi_aml_exec_load_table ( for (i = 0; i < table_header.length; i++) { status = acpi_ev_address_space_dispatch (rgn_desc, ADDRESS_SPACE_READ, - i, 8, (u32 *) (table_data_ptr + i)); + (ACPI_PHYSICAL_ADDRESS)i, 8, + (u32 *) (table_data_ptr + i)); if (ACPI_FAILURE (status)) { goto cleanup; } diff --git a/drivers/acpi/interpreter/amconvrt.c b/drivers/acpi/interpreter/amconvrt.c new file mode 100644 index 000000000..4c895c7ed --- /dev/null +++ b/drivers/acpi/interpreter/amconvrt.c @@ -0,0 +1,525 @@ +/****************************************************************************** + * + * Module Name: amconvrt - Object conversion routines + * $Revision: 3 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000, 2001 R. Byron Moore + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#include "acpi.h" +#include "acparser.h" +#include "acnamesp.h" +#include "acinterp.h" +#include "acevents.h" +#include "amlcode.h" +#include "acdispat.h" + + +#define _COMPONENT INTERPRETER + MODULE_NAME ("amconvrt") + + +/******************************************************************************* + * + * FUNCTION: Acpi_aml_convert_to_target_type + * + * PARAMETERS: *Obj_desc - Object to be converted. + * Walk_state - Current method state + * + * RETURN: Status + * + * DESCRIPTION: + * + ******************************************************************************/ + +ACPI_STATUS +acpi_aml_convert_to_target_type ( + OBJECT_TYPE_INTERNAL destination_type, + ACPI_OPERAND_OBJECT **obj_desc, + ACPI_WALK_STATE *walk_state) +{ + ACPI_STATUS status = AE_OK; + + + /* + * If required by the target, + * perform implicit conversion on the source before we store it. + */ + + switch (GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args)) + { + case ARGI_SIMPLE_TARGET: + case ARGI_FIXED_TARGET: + case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */ + + switch (destination_type) + { + case INTERNAL_TYPE_DEF_FIELD: + /* + * Named field can always handle conversions + */ + break; + + default: + /* No conversion allowed for these types */ + + if (destination_type != (*obj_desc)->common.type) { + status = AE_TYPE; + } + } + break; + + + case ARGI_TARGETREF: + + switch (destination_type) + { + case ACPI_TYPE_INTEGER: + case ACPI_TYPE_FIELD_UNIT: + case INTERNAL_TYPE_BANK_FIELD: + case INTERNAL_TYPE_INDEX_FIELD: + /* + * These types require an Integer operand. We can convert + * a Buffer or a String to an Integer if necessary. + */ + status = acpi_aml_convert_to_integer (obj_desc, walk_state); + break; + + + case ACPI_TYPE_STRING: + + /* + * The operand must be a String. We can convert an + * Integer or Buffer if necessary + */ + status = acpi_aml_convert_to_string (obj_desc, walk_state); + break; + + + case ACPI_TYPE_BUFFER: + + /* + * The operand must be a String. We can convert an + * Integer or Buffer if necessary + */ + status = acpi_aml_convert_to_buffer (obj_desc, walk_state); + break; + } + break; + + + case ARGI_REFERENCE: + /* + * Create_xxxx_field cases - we are storing the field object into the name + */ + break; + + + default: + status = AE_AML_INTERNAL; + } + + + /* + * Source-to-Target conversion semantics: + * + * If conversion to the target type cannot be performed, then simply + * overwrite the target with the new object and type. + */ + if (status == AE_TYPE) { + status = AE_OK; + } + + return (status); +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_aml_convert_to_integer + * + * PARAMETERS: *Obj_desc - Object to be converted. Must be an + * Integer, Buffer, or String + * Walk_state - Current method state + * + * RETURN: Status + * + * DESCRIPTION: Convert an ACPI Object to an integer. + * + ******************************************************************************/ + +ACPI_STATUS +acpi_aml_convert_to_integer ( + ACPI_OPERAND_OBJECT **obj_desc, + ACPI_WALK_STATE *walk_state) +{ + u32 i; + ACPI_OPERAND_OBJECT *ret_desc; + u32 count; + char *pointer; + ACPI_INTEGER result; + u32 integer_size = sizeof (ACPI_INTEGER); + + + switch ((*obj_desc)->common.type) + { + case ACPI_TYPE_INTEGER: + return (AE_OK); + + case ACPI_TYPE_STRING: + pointer = (*obj_desc)->string.pointer; + count = (*obj_desc)->string.length; + break; + + case ACPI_TYPE_BUFFER: + pointer = (char *) (*obj_desc)->buffer.pointer; + count = (*obj_desc)->buffer.length; + break; + + default: + return (AE_TYPE); + } + + /* + * Create a new integer + */ + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER); + if (!ret_desc) { + return (AE_NO_MEMORY); + } + + + /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */ + + if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) { + /* + * We are running a method that exists in a 32-bit ACPI table. + * Truncate the value to 32 bits by zeroing out the upper 32-bit field + */ + integer_size = sizeof (u32); + } + + + /* + * Convert the buffer/string to an integer. Note that both buffers and + * strings are treated as raw data - we don't convert ascii to hex for + * strings. + * + * There are two terminating conditions for the loop: + * 1) The size of an integer has been reached, or + * 2) The end of the buffer or string has been reached + */ + result = 0; + + /* Transfer no more than an integer's worth of data */ + + if (count > integer_size) { + count = integer_size; + } + + /* + * String conversion is different than Buffer conversion + */ + switch ((*obj_desc)->common.type) + { + case ACPI_TYPE_STRING: + + /* TBD: Need to use 64-bit STRTOUL */ + + /* + * Convert string to an integer + * String must be hexadecimal as per the ACPI specification + */ + + result = STRTOUL (pointer, NULL, 16); + break; + + + case ACPI_TYPE_BUFFER: + + /* + * Buffer conversion - we simply grab enough raw data from the + * buffer to fill an integer + */ + for (i = 0; i < count; i++) { + /* + * Get next byte and shift it into the Result. + * Little endian is used, meaning that the first byte of the buffer + * is the LSB of the integer + */ + result |= (((ACPI_INTEGER) pointer[i]) << (i * 8)); + } + + break; + } + + /* Save the Result, delete original descriptor, store new descriptor */ + + ret_desc->integer.value = result; + + if (walk_state->opcode != AML_STORE_OP) { + acpi_cm_remove_reference (*obj_desc); + } + + *obj_desc = ret_desc; + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_aml_convert_to_buffer + * + * PARAMETERS: *Obj_desc - Object to be converted. Must be an + * Integer, Buffer, or String + * Walk_state - Current method state + * + * RETURN: Status + * + * DESCRIPTION: Convert an ACPI Object to an Buffer + * + ******************************************************************************/ + +ACPI_STATUS +acpi_aml_convert_to_buffer ( + ACPI_OPERAND_OBJECT **obj_desc, + ACPI_WALK_STATE *walk_state) +{ + ACPI_OPERAND_OBJECT *ret_desc; + u32 i; + u32 integer_size = sizeof (ACPI_INTEGER); + u8 *new_buf; + + + switch ((*obj_desc)->common.type) + { + case ACPI_TYPE_INTEGER: + + /* + * Create a new Buffer + */ + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_BUFFER); + if (!ret_desc) { + return (AE_NO_MEMORY); + } + + /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */ + + if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) { + /* + * We are running a method that exists in a 32-bit ACPI table. + * Truncate the value to 32 bits by zeroing out the upper + * 32-bit field + */ + integer_size = sizeof (u32); + } + + /* Need enough space for one integers */ + + ret_desc->buffer.length = integer_size; + new_buf = acpi_cm_callocate (integer_size); + if (!new_buf) { + REPORT_ERROR + (("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure\n")); + acpi_cm_remove_reference (ret_desc); + return (AE_NO_MEMORY); + } + + /* Copy the integer to the buffer */ + + for (i = 0; i < integer_size; i++) { + new_buf[i] = (u8) ((*obj_desc)->integer.value >> (i * 8)); + } + ret_desc->buffer.pointer = new_buf; + + /* Return the new buffer descriptor */ + + if (walk_state->opcode != AML_STORE_OP) { + acpi_cm_remove_reference (*obj_desc); + } + *obj_desc = ret_desc; + break; + + + case ACPI_TYPE_STRING: + break; + + + case ACPI_TYPE_BUFFER: + break; + + + default: + return (AE_TYPE); + break; + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_aml_convert_to_string + * + * PARAMETERS: *Obj_desc - Object to be converted. Must be an + * Integer, Buffer, or String + * Walk_state - Current method state + * + * RETURN: Status + * + * DESCRIPTION: Convert an ACPI Object to a string + * + ******************************************************************************/ + +ACPI_STATUS +acpi_aml_convert_to_string ( + ACPI_OPERAND_OBJECT **obj_desc, + ACPI_WALK_STATE *walk_state) +{ + ACPI_OPERAND_OBJECT *ret_desc; + u32 i; + u32 index; + u32 integer_size = sizeof (ACPI_INTEGER); + u8 *new_buf; + u8 *pointer; + + + switch ((*obj_desc)->common.type) + { + case ACPI_TYPE_INTEGER: + + /* + * Create a new String + */ + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_STRING); + if (!ret_desc) { + return (AE_NO_MEMORY); + } + + /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */ + + if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) { + /* + * We are running a method that exists in a 32-bit ACPI table. + * Truncate the value to 32 bits by zeroing out the upper + * 32-bit field + */ + integer_size = sizeof (u32); + } + + /* Need enough space for one ASCII integer plus null terminator */ + + ret_desc->string.length = (integer_size * 2) + 1; + new_buf = acpi_cm_callocate (ret_desc->string.length); + if (!new_buf) { + REPORT_ERROR + (("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure\n")); + acpi_cm_remove_reference (ret_desc); + return (AE_NO_MEMORY); + } + + /* Copy the integer to the buffer */ + + for (i = 0; i < (integer_size * 2); i++) { + new_buf[i] = acpi_gbl_hex_to_ascii [((*obj_desc)->integer.value >> (i * 4)) & 0xF]; + } + + /* Null terminate */ + + new_buf [i] = 0; + ret_desc->buffer.pointer = new_buf; + + /* Return the new buffer descriptor */ + + if (walk_state->opcode != AML_STORE_OP) { + acpi_cm_remove_reference (*obj_desc); + } + *obj_desc = ret_desc; + + return (AE_OK); + + + case ACPI_TYPE_BUFFER: + + if (((*obj_desc)->buffer.length * 3) > ACPI_MAX_STRING_CONVERSION) { + return (AE_AML_STRING_LIMIT); + } + + /* + * Create a new String + */ + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_STRING); + if (!ret_desc) { + return (AE_NO_MEMORY); + } + + /* Need enough space for one ASCII integer plus null terminator */ + + ret_desc->string.length = (*obj_desc)->buffer.length * 3; + new_buf = acpi_cm_callocate (ret_desc->string.length + 1); + if (!new_buf) { + REPORT_ERROR + (("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure\n")); + acpi_cm_remove_reference (ret_desc); + return (AE_NO_MEMORY); + } + + /* + * Convert each byte of the buffer to two ASCII characters plus a space. + */ + pointer = (*obj_desc)->buffer.pointer; + index = 0; + for (i = 0; i < (*obj_desc)->buffer.length; i++) { + new_buf[index + 0] = acpi_gbl_hex_to_ascii [pointer[i] & 0x0F]; + new_buf[index + 1] = acpi_gbl_hex_to_ascii [(pointer[i] >> 4) & 0x0F]; + new_buf[index + 2] = ' '; + index += 3; + } + + /* Null terminate */ + + new_buf [index] = 0; + ret_desc->buffer.pointer = new_buf; + + /* Return the new buffer descriptor */ + + if (walk_state->opcode != AML_STORE_OP) { + acpi_cm_remove_reference (*obj_desc); + } + *obj_desc = ret_desc; + break; + + + case ACPI_TYPE_STRING: + break; + + + default: + return (AE_TYPE); + break; + } + + return (AE_OK); +} + + diff --git a/drivers/acpi/interpreter/amcreate.c b/drivers/acpi/interpreter/amcreate.c index 02d7933e1..f19c422ce 100644 --- a/drivers/acpi/interpreter/amcreate.c +++ b/drivers/acpi/interpreter/amcreate.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: amcreate - Named object creation - * $Revision: 51 $ + * $Revision: 53 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -353,7 +353,7 @@ acpi_aml_exec_create_mutex ( goto cleanup; } - obj_desc->mutex.sync_level = (u8) sync_desc->number.value; + obj_desc->mutex.sync_level = (u8) sync_desc->integer.value; /* Obj_desc was on the stack top, and the name is below it */ diff --git a/drivers/acpi/interpreter/amdyadic.c b/drivers/acpi/interpreter/amdyadic.c index ba67b062a..a02173f29 100644 --- a/drivers/acpi/interpreter/amdyadic.c +++ b/drivers/acpi/interpreter/amdyadic.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: amdyadic - ACPI AML (p-code) execution for dyadic operators - * $Revision: 68 $ + * $Revision: 71 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,7 +37,174 @@ MODULE_NAME ("amdyadic") -/***************************************************************************** +/******************************************************************************* + * + * FUNCTION: Acpi_aml_do_concatenate + * + * PARAMETERS: *Obj_desc - Object to be converted. Must be an + * Integer, Buffer, or String + * + * RETURN: Status + * + * DESCRIPTION: Concatenate two objects OF THE SAME TYPE. + * + ******************************************************************************/ + +ACPI_STATUS +acpi_aml_do_concatenate ( + ACPI_OPERAND_OBJECT *obj_desc, + ACPI_OPERAND_OBJECT *obj_desc2, + ACPI_OPERAND_OBJECT **actual_ret_desc, + ACPI_WALK_STATE *walk_state) +{ + ACPI_STATUS status; + u32 i; + ACPI_INTEGER this_integer; + ACPI_OPERAND_OBJECT *ret_desc; + NATIVE_CHAR *new_buf; + u32 integer_size = sizeof (ACPI_INTEGER); + + + /* + * There are three cases to handle: + * 1) Two Integers concatenated to produce a buffer + * 2) Two Strings concatenated to produce a string + * 3) Two Buffers concatenated to produce a buffer + */ + switch (obj_desc->common.type) + { + case ACPI_TYPE_INTEGER: + + /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */ + + if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) { + /* + * We are running a method that exists in a 32-bit ACPI table. + * Truncate the value to 32 bits by zeroing out the upper + * 32-bit field + */ + integer_size = sizeof (u32); + } + + /* Result of two integers is a buffer */ + + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_BUFFER); + if (!ret_desc) { + return (AE_NO_MEMORY); + } + + /* Need enough space for two integers */ + + ret_desc->buffer.length = integer_size * 2; + new_buf = acpi_cm_callocate (ret_desc->buffer.length); + if (!new_buf) { + REPORT_ERROR + (("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure\n")); + status = AE_NO_MEMORY; + goto cleanup; + } + + ret_desc->buffer.pointer = (u8 *) new_buf; + + /* Convert the first integer */ + + this_integer = obj_desc->integer.value; + for (i = 0; i < integer_size; i++) { + new_buf[i] = (u8) this_integer; + this_integer >>= 8; + } + + /* Convert the second integer */ + + this_integer = obj_desc2->integer.value; + for (; i < (integer_size * 2); i++) { + new_buf[i] = (u8) this_integer; + this_integer >>= 8; + } + + break; + + + case ACPI_TYPE_STRING: + + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_STRING); + if (!ret_desc) { + return (AE_NO_MEMORY); + } + + /* Operand1 is string */ + + new_buf = acpi_cm_allocate (obj_desc->string.length + + obj_desc2->string.length + 1); + if (!new_buf) { + REPORT_ERROR + (("Aml_exec_dyadic2_r/Concat_op: String allocation failure\n")); + status = AE_NO_MEMORY; + goto cleanup; + } + + STRCPY (new_buf, obj_desc->string.pointer); + STRCPY (new_buf + obj_desc->string.length, + obj_desc2->string.pointer); + + /* Point the return object to the new string */ + + ret_desc->string.pointer = new_buf; + ret_desc->string.length = obj_desc->string.length += + obj_desc2->string.length; + break; + + + case ACPI_TYPE_BUFFER: + + /* Operand1 is a buffer */ + + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_BUFFER); + if (!ret_desc) { + return (AE_NO_MEMORY); + } + + new_buf = acpi_cm_allocate (obj_desc->buffer.length + + obj_desc2->buffer.length); + if (!new_buf) { + REPORT_ERROR + (("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure\n")); + status = AE_NO_MEMORY; + goto cleanup; + } + + MEMCPY (new_buf, obj_desc->buffer.pointer, + obj_desc->buffer.length); + MEMCPY (new_buf + obj_desc->buffer.length, obj_desc2->buffer.pointer, + obj_desc2->buffer.length); + + /* + * Point the return object to the new buffer + */ + + ret_desc->buffer.pointer = (u8 *) new_buf; + ret_desc->buffer.length = obj_desc->buffer.length + + obj_desc2->buffer.length; + break; + + default: + status = AE_AML_INTERNAL; + ret_desc = NULL; + } + + + *actual_ret_desc = ret_desc; + return (AE_OK); + + +cleanup: + + acpi_cm_remove_reference (ret_desc); + return (status); +} + + +/******************************************************************************* * * FUNCTION: Acpi_aml_exec_dyadic1 * @@ -50,7 +217,7 @@ * * ALLOCATION: Deletes both operands * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_aml_exec_dyadic1 ( @@ -106,7 +273,7 @@ acpi_aml_exec_dyadic1 ( /* Dispatch the notify to the appropriate handler */ - acpi_ev_notify_dispatch (node, (u32) val_desc->number.value); + acpi_ev_notify_dispatch (node, (u32) val_desc->integer.value); break; default: @@ -135,7 +302,7 @@ cleanup: } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_aml_exec_dyadic2_r * @@ -148,7 +315,7 @@ cleanup: * * ALLOCATION: Deletes one operand descriptor -- other remains on stack * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_aml_exec_dyadic2_r ( @@ -164,7 +331,6 @@ acpi_aml_exec_dyadic2_r ( ACPI_OPERAND_OBJECT *ret_desc2 = NULL; ACPI_STATUS status = AE_OK; u32 num_operands = 3; - NATIVE_CHAR *new_buf; /* Resolve all operands */ @@ -201,7 +367,7 @@ acpi_aml_exec_dyadic2_r ( case AML_SHIFT_RIGHT_OP: case AML_SUBTRACT_OP: - ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER); + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER); if (!ret_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -222,8 +388,8 @@ acpi_aml_exec_dyadic2_r ( case AML_ADD_OP: - ret_desc->number.value = obj_desc->number.value + - obj_desc2->number.value; + ret_desc->integer.value = obj_desc->integer.value + + obj_desc2->integer.value; break; @@ -231,8 +397,8 @@ acpi_aml_exec_dyadic2_r ( case AML_BIT_AND_OP: - ret_desc->number.value = obj_desc->number.value & - obj_desc2->number.value; + ret_desc->integer.value = obj_desc->integer.value & + obj_desc2->integer.value; break; @@ -240,8 +406,8 @@ acpi_aml_exec_dyadic2_r ( case AML_BIT_NAND_OP: - ret_desc->number.value = ~(obj_desc->number.value & - obj_desc2->number.value); + ret_desc->integer.value = ~(obj_desc->integer.value & + obj_desc2->integer.value); break; @@ -249,8 +415,8 @@ acpi_aml_exec_dyadic2_r ( case AML_BIT_OR_OP: - ret_desc->number.value = obj_desc->number.value | - obj_desc2->number.value; + ret_desc->integer.value = obj_desc->integer.value | + obj_desc2->integer.value; break; @@ -258,8 +424,8 @@ acpi_aml_exec_dyadic2_r ( case AML_BIT_NOR_OP: - ret_desc->number.value = ~(obj_desc->number.value | - obj_desc2->number.value); + ret_desc->integer.value = ~(obj_desc->integer.value | + obj_desc2->integer.value); break; @@ -267,16 +433,16 @@ acpi_aml_exec_dyadic2_r ( case AML_BIT_XOR_OP: - ret_desc->number.value = obj_desc->number.value ^ - obj_desc2->number.value; + ret_desc->integer.value = obj_desc->integer.value ^ + obj_desc2->integer.value; break; - /* Def_divide := Divide_op Dividend Divisor Remainder Quotient */ + /* Def_divide := Divide_op Dividend Divisor Remainder Quotient */ case AML_DIVIDE_OP: - if (!obj_desc2->number.value) { + if (!obj_desc2->integer.value) { REPORT_ERROR (("Aml_exec_dyadic2_r/Divide_op: Divide by zero\n")); @@ -284,7 +450,7 @@ acpi_aml_exec_dyadic2_r ( goto cleanup; } - ret_desc2 = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER); + ret_desc2 = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER); if (!ret_desc2) { status = AE_NO_MEMORY; goto cleanup; @@ -292,13 +458,13 @@ acpi_aml_exec_dyadic2_r ( /* Remainder (modulo) */ - ret_desc->number.value = ACPI_MODULO (obj_desc->number.value, - obj_desc2->number.value); + ret_desc->integer.value = ACPI_MODULO (obj_desc->integer.value, + obj_desc2->integer.value); /* Result (what we used to call the quotient) */ - ret_desc2->number.value = ACPI_DIVIDE (obj_desc->number.value, - obj_desc2->number.value); + ret_desc2->integer.value = ACPI_DIVIDE (obj_desc->integer.value, + obj_desc2->integer.value); break; @@ -306,8 +472,8 @@ acpi_aml_exec_dyadic2_r ( case AML_MULTIPLY_OP: - ret_desc->number.value = obj_desc->number.value * - obj_desc2->number.value; + ret_desc->integer.value = obj_desc->integer.value * + obj_desc2->integer.value; break; @@ -315,8 +481,8 @@ acpi_aml_exec_dyadic2_r ( case AML_SHIFT_LEFT_OP: - ret_desc->number.value = obj_desc->number.value << - obj_desc2->number.value; + ret_desc->integer.value = obj_desc->integer.value << + obj_desc2->integer.value; break; @@ -324,8 +490,8 @@ acpi_aml_exec_dyadic2_r ( case AML_SHIFT_RIGHT_OP: - ret_desc->number.value = obj_desc->number.value >> - obj_desc2->number.value; + ret_desc->integer.value = obj_desc->integer.value >> + obj_desc2->integer.value; break; @@ -333,8 +499,8 @@ acpi_aml_exec_dyadic2_r ( case AML_SUBTRACT_OP: - ret_desc->number.value = obj_desc->number.value - - obj_desc2->number.value; + ret_desc->integer.value = obj_desc->integer.value - + obj_desc2->integer.value; break; @@ -342,79 +508,54 @@ acpi_aml_exec_dyadic2_r ( case AML_CONCAT_OP: - if (obj_desc2->common.type != obj_desc->common.type) { - status = AE_AML_OPERAND_TYPE; - goto cleanup; - } - /* Both operands are now known to be the same */ - - if (ACPI_TYPE_STRING == obj_desc->common.type) { - ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_STRING); - if (!ret_desc) { - status = AE_NO_MEMORY; - goto cleanup; - } + /* + * Convert the second operand if necessary. The first operand + * determines the type of the second operand, (See the Data Types + * section of the ACPI specification.) Both object types are + * guaranteed to be either Integer/String/Buffer by the operand + * resolution mechanism above. + */ - /* Operand1 is string */ + switch (obj_desc->common.type) + { + case ACPI_TYPE_INTEGER: + status = acpi_aml_convert_to_integer (&obj_desc2, walk_state); + break; - new_buf = acpi_cm_allocate (obj_desc->string.length + - obj_desc2->string.length + 1); - if (!new_buf) { - REPORT_ERROR - (("Aml_exec_dyadic2_r/Concat_op: String allocation failure\n")); - status = AE_NO_MEMORY; - goto cleanup; - } + case ACPI_TYPE_STRING: + status = acpi_aml_convert_to_string (&obj_desc2, walk_state); + break; - STRCPY (new_buf, obj_desc->string.pointer); - STRCPY (new_buf + obj_desc->string.length, - obj_desc2->string.pointer); + case ACPI_TYPE_BUFFER: + status = acpi_aml_convert_to_buffer (&obj_desc2, walk_state); + break; - /* Point the return object to the new string */ - - ret_desc->string.pointer = new_buf; - ret_desc->string.length = obj_desc->string.length += - obj_desc2->string.length; + default: + status = AE_AML_INTERNAL; } - else { - /* Operand1 is not a string ==> must be a buffer */ - - ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_BUFFER); - if (!ret_desc) { - status = AE_NO_MEMORY; - goto cleanup; - } - - new_buf = acpi_cm_allocate (obj_desc->buffer.length + - obj_desc2->buffer.length); - if (!new_buf) { - REPORT_ERROR - (("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure\n")); - status = AE_NO_MEMORY; - goto cleanup; - } - - MEMCPY (new_buf, obj_desc->buffer.pointer, - obj_desc->buffer.length); - MEMCPY (new_buf + obj_desc->buffer.length, obj_desc2->buffer.pointer, - obj_desc2->buffer.length); + if (ACPI_FAILURE (status)) { + goto cleanup; + } - /* - * Point the return object to the new buffer - */ - ret_desc->buffer.pointer = (u8 *) new_buf; - ret_desc->buffer.length = obj_desc->buffer.length + - obj_desc2->buffer.length; + /* + * Both operands are now known to be the same object type + * (Both are Integer, String, or Buffer), and we can now perform the + * concatenation. + */ + status = acpi_aml_do_concatenate (obj_desc, obj_desc2, &ret_desc, walk_state); + if (ACPI_FAILURE (status)) { + goto cleanup; } break; default: - REPORT_ERROR (("Acpi_aml_exec_dyadic2_r: Unknown dyadic opcode %X\n", opcode)); + REPORT_ERROR (("Acpi_aml_exec_dyadic2_r: Unknown dyadic opcode %X\n", + opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -474,7 +615,7 @@ cleanup: } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_aml_exec_dyadic2_s * @@ -486,7 +627,7 @@ cleanup: * * ALLOCATION: Deletes one operand descriptor -- other remains on stack * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_aml_exec_dyadic2_s ( @@ -516,7 +657,7 @@ acpi_aml_exec_dyadic2_s ( /* Create the internal return object */ - ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER); + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER); if (!ret_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -524,7 +665,7 @@ acpi_aml_exec_dyadic2_s ( /* Default return value is FALSE, operation did not time out */ - ret_desc->number.value = 0; + ret_desc->integer.value = 0; /* Examine the opcode */ @@ -562,7 +703,7 @@ acpi_aml_exec_dyadic2_s ( */ if (status == AE_TIME) { - ret_desc->number.value = ACPI_INTEGER_MAX; /* TRUE, op timed out */ + ret_desc->integer.value = ACPI_INTEGER_MAX; /* TRUE, op timed out */ status = AE_OK; } @@ -591,7 +732,7 @@ cleanup: } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_aml_exec_dyadic2 * @@ -605,7 +746,7 @@ cleanup: * ALLOCATION: Deletes one operand descriptor -- other remains on stack * containing result value * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_aml_exec_dyadic2 ( @@ -636,7 +777,7 @@ acpi_aml_exec_dyadic2 ( /* Create the internal return object */ - ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER); + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER); if (!ret_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -654,8 +795,8 @@ acpi_aml_exec_dyadic2 ( case AML_LAND_OP: - lboolean = (u8) (obj_desc->number.value && - obj_desc2->number.value); + lboolean = (u8) (obj_desc->integer.value && + obj_desc2->integer.value); break; @@ -663,8 +804,8 @@ acpi_aml_exec_dyadic2 ( case AML_LEQUAL_OP: - lboolean = (u8) (obj_desc->number.value == - obj_desc2->number.value); + lboolean = (u8) (obj_desc->integer.value == + obj_desc2->integer.value); break; @@ -672,8 +813,8 @@ acpi_aml_exec_dyadic2 ( case AML_LGREATER_OP: - lboolean = (u8) (obj_desc->number.value > - obj_desc2->number.value); + lboolean = (u8) (obj_desc->integer.value > + obj_desc2->integer.value); break; @@ -681,8 +822,8 @@ acpi_aml_exec_dyadic2 ( case AML_LLESS_OP: - lboolean = (u8) (obj_desc->number.value < - obj_desc2->number.value); + lboolean = (u8) (obj_desc->integer.value < + obj_desc2->integer.value); break; @@ -690,8 +831,8 @@ acpi_aml_exec_dyadic2 ( case AML_LOR_OP: - lboolean = (u8) (obj_desc->number.value || - obj_desc2->number.value); + lboolean = (u8) (obj_desc->integer.value || + obj_desc2->integer.value); break; @@ -707,10 +848,10 @@ acpi_aml_exec_dyadic2 ( /* Set return value to logical TRUE (all ones) or FALSE (zero) */ if (lboolean) { - ret_desc->number.value = ACPI_INTEGER_MAX; + ret_desc->integer.value = ACPI_INTEGER_MAX; } else { - ret_desc->number.value = 0; + ret_desc->integer.value = 0; } diff --git a/drivers/acpi/interpreter/amfield.c b/drivers/acpi/interpreter/amfield.c index 356be14c2..3ed442c95 100644 --- a/drivers/acpi/interpreter/amfield.c +++ b/drivers/acpi/interpreter/amfield.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: amfield - ACPI AML (p-code) execution - field manipulation - * $Revision: 74 $ + * $Revision: 77 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -174,7 +174,8 @@ acpi_aml_access_named_field ( u32 byte_field_length; - /* Basic data checking */ + /* Parameter validation */ + if ((!named_field) || (ACPI_READ == mode && !buffer)) { return (AE_AML_INTERNAL); } @@ -227,7 +228,7 @@ acpi_aml_access_named_field ( /* TBD: should these round down to a power of 2? */ - if (DIV_8(bit_granularity) > byte_field_length) { + if (DIV_8 (bit_granularity) > byte_field_length) { bit_granularity = MUL_8(byte_field_length); } diff --git a/drivers/acpi/interpreter/amfldio.c b/drivers/acpi/interpreter/amfldio.c index ce877c982..d16cd3d9b 100644 --- a/drivers/acpi/interpreter/amfldio.c +++ b/drivers/acpi/interpreter/amfldio.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: amfldio - Aml Field I/O - * $Revision: 32 $ + * $Revision: 37 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -132,7 +132,7 @@ acpi_aml_read_field ( u32 this_field_byte_offset; u32 this_field_datum_offset; u32 previous_raw_datum; - u32 this_raw_datum; + u32 this_raw_datum = 0; u32 valid_field_bits; u32 mask; u32 merged_datum = 0; @@ -203,32 +203,46 @@ acpi_aml_read_field ( while (this_field_datum_offset < datum_length) { /* - * Get the next raw datum, it contains bits of the current - * field datum + * If the field is aligned on a byte boundary, we don't want + * to perform a final read, since this would potentially read + * past the end of the region. + * + * TBD: [Investigate] It may make more sense to just split the aligned + * and non-aligned cases since the aligned case is so very simple, */ - - status = acpi_aml_read_field_data (obj_desc, - this_field_byte_offset + byte_granularity, - bit_granularity, &this_raw_datum); - if (ACPI_FAILURE (status)) { - goto cleanup; - } - - /* Before merging the data, make sure the unused bits are clear */ - - switch (byte_granularity) + if ((obj_desc->field.bit_offset != 0) || + ((obj_desc->field.bit_offset == 0) && + (this_field_datum_offset < (datum_length -1)))) { - case 1: - this_raw_datum &= 0x000000FF; - previous_raw_datum &= 0x000000FF; - break; - - case 2: - this_raw_datum &= 0x0000FFFF; - previous_raw_datum &= 0x0000FFFF; - break; + /* + * Get the next raw datum, it contains some or all bits + * of the current field datum + */ + + status = acpi_aml_read_field_data (obj_desc, + this_field_byte_offset + byte_granularity, + bit_granularity, &this_raw_datum); + if (ACPI_FAILURE (status)) { + goto cleanup; + } + + /* Before merging the data, make sure the unused bits are clear */ + + switch (byte_granularity) + { + case 1: + this_raw_datum &= 0x000000FF; + previous_raw_datum &= 0x000000FF; + break; + + case 2: + this_raw_datum &= 0x0000FFFF; + previous_raw_datum &= 0x0000FFFF; + break; + } } + /* * Put together bits of the two raw data to make a complete * field datum @@ -391,8 +405,6 @@ acpi_aml_write_field_data_with_update_rule ( merged_value = field_value; - /* Check if update rule needs to be applied (not if mask is all ones) */ - /* Decode the update rule */ @@ -401,13 +413,17 @@ acpi_aml_write_field_data_with_update_rule ( case UPDATE_PRESERVE: - /* - * Read the current contents of the byte/word/dword containing - * the field, and merge with the new field value. - */ - status = acpi_aml_read_field_data (obj_desc, this_field_byte_offset, - bit_granularity, ¤t_value); - merged_value |= (current_value & ~mask); + /* Check if update rule needs to be applied (not if mask is all ones) */ + + if (((1 << bit_granularity) -1) & ~mask) { + /* + * Read the current contents of the byte/word/dword containing + * the field, and merge with the new field value. + */ + status = acpi_aml_read_field_data (obj_desc, this_field_byte_offset, + bit_granularity, ¤t_value); + merged_value |= (current_value & ~mask); + } break; diff --git a/drivers/acpi/interpreter/ammisc.c b/drivers/acpi/interpreter/ammisc.c index 907169dfc..3c58daeab 100644 --- a/drivers/acpi/interpreter/ammisc.c +++ b/drivers/acpi/interpreter/ammisc.c @@ -2,12 +2,12 @@ /****************************************************************************** * * Module Name: ammisc - ACPI AML (p-code) execution - specific opcodes - * $Revision: 71 $ + * $Revision: 73 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -172,7 +172,7 @@ acpi_aml_exec_index ( if (obj_desc->common.type == ACPI_TYPE_PACKAGE) { /* Object to be indexed is a Package */ - if (idx_desc->number.value >= obj_desc->package.count) { + if (idx_desc->integer.value >= obj_desc->package.count) { status = AE_AML_PACKAGE_LIMIT; goto cleanup; } @@ -195,7 +195,7 @@ acpi_aml_exec_index ( * we are after. */ - tmp_desc = obj_desc->package.elements[idx_desc->number.value]; + tmp_desc = obj_desc->package.elements[idx_desc->integer.value]; ret_desc->reference.op_code = AML_INDEX_OP; ret_desc->reference.target_type = tmp_desc->common.type; ret_desc->reference.object = tmp_desc; @@ -210,13 +210,13 @@ acpi_aml_exec_index ( */ ret_desc->reference.op_code = AML_INDEX_OP; ret_desc->reference.target_type = ACPI_TYPE_PACKAGE; - ret_desc->reference.where = &obj_desc->package.elements[idx_desc->number.value]; + ret_desc->reference.where = &obj_desc->package.elements[idx_desc->integer.value]; } else { /* Object to be indexed is a Buffer */ - if (idx_desc->number.value >= obj_desc->buffer.length) { + if (idx_desc->integer.value >= obj_desc->buffer.length) { status = AE_AML_BUFFER_LIMIT; goto cleanup; } @@ -224,7 +224,7 @@ acpi_aml_exec_index ( ret_desc->reference.op_code = AML_INDEX_OP; ret_desc->reference.target_type = ACPI_TYPE_BUFFER_FIELD; ret_desc->reference.object = obj_desc; - ret_desc->reference.offset = (u32) idx_desc->number.value; + ret_desc->reference.offset = (u32) idx_desc->integer.value; status = acpi_aml_exec_store (ret_desc, res_desc, walk_state); } @@ -314,20 +314,20 @@ acpi_aml_exec_match ( /* Validate match comparison sub-opcodes */ - if ((op1_desc->number.value > MAX_MATCH_OPERATOR) || - (op2_desc->number.value > MAX_MATCH_OPERATOR)) + if ((op1_desc->integer.value > MAX_MATCH_OPERATOR) || + (op2_desc->integer.value > MAX_MATCH_OPERATOR)) { status = AE_AML_OPERAND_VALUE; goto cleanup; } - index = (u32) start_desc->number.value; + index = (u32) start_desc->integer.value; if (index >= (u32) pkg_desc->package.count) { status = AE_AML_PACKAGE_LIMIT; goto cleanup; } - ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER); + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER); if (!ret_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -351,7 +351,7 @@ acpi_aml_exec_match ( * should we examine its value? */ if (!pkg_desc->package.elements[index] || - ACPI_TYPE_NUMBER != pkg_desc->package.elements[index]->common.type) + ACPI_TYPE_INTEGER != pkg_desc->package.elements[index]->common.type) { continue; } @@ -362,7 +362,7 @@ acpi_aml_exec_match ( * "continue" (proceed to next iteration of enclosing * "for" loop) signifies a non-match. */ - switch (op1_desc->number.value) + switch (op1_desc->integer.value) { case MATCH_MTR: /* always true */ @@ -372,8 +372,8 @@ acpi_aml_exec_match ( case MATCH_MEQ: /* true if equal */ - if (pkg_desc->package.elements[index]->number.value - != V1_desc->number.value) + if (pkg_desc->package.elements[index]->integer.value + != V1_desc->integer.value) { continue; } @@ -382,8 +382,8 @@ acpi_aml_exec_match ( case MATCH_MLE: /* true if less than or equal */ - if (pkg_desc->package.elements[index]->number.value - > V1_desc->number.value) + if (pkg_desc->package.elements[index]->integer.value + > V1_desc->integer.value) { continue; } @@ -392,8 +392,8 @@ acpi_aml_exec_match ( case MATCH_MLT: /* true if less than */ - if (pkg_desc->package.elements[index]->number.value - >= V1_desc->number.value) + if (pkg_desc->package.elements[index]->integer.value + >= V1_desc->integer.value) { continue; } @@ -402,8 +402,8 @@ acpi_aml_exec_match ( case MATCH_MGE: /* true if greater than or equal */ - if (pkg_desc->package.elements[index]->number.value - < V1_desc->number.value) + if (pkg_desc->package.elements[index]->integer.value + < V1_desc->integer.value) { continue; } @@ -412,8 +412,8 @@ acpi_aml_exec_match ( case MATCH_MGT: /* true if greater than */ - if (pkg_desc->package.elements[index]->number.value - <= V1_desc->number.value) + if (pkg_desc->package.elements[index]->integer.value + <= V1_desc->integer.value) { continue; } @@ -426,7 +426,7 @@ acpi_aml_exec_match ( } - switch(op2_desc->number.value) + switch(op2_desc->integer.value) { case MATCH_MTR: @@ -436,8 +436,8 @@ acpi_aml_exec_match ( case MATCH_MEQ: - if (pkg_desc->package.elements[index]->number.value - != V2_desc->number.value) + if (pkg_desc->package.elements[index]->integer.value + != V2_desc->integer.value) { continue; } @@ -446,8 +446,8 @@ acpi_aml_exec_match ( case MATCH_MLE: - if (pkg_desc->package.elements[index]->number.value - > V2_desc->number.value) + if (pkg_desc->package.elements[index]->integer.value + > V2_desc->integer.value) { continue; } @@ -456,8 +456,8 @@ acpi_aml_exec_match ( case MATCH_MLT: - if (pkg_desc->package.elements[index]->number.value - >= V2_desc->number.value) + if (pkg_desc->package.elements[index]->integer.value + >= V2_desc->integer.value) { continue; } @@ -466,8 +466,8 @@ acpi_aml_exec_match ( case MATCH_MGE: - if (pkg_desc->package.elements[index]->number.value - < V2_desc->number.value) + if (pkg_desc->package.elements[index]->integer.value + < V2_desc->integer.value) { continue; } @@ -476,8 +476,8 @@ acpi_aml_exec_match ( case MATCH_MGT: - if (pkg_desc->package.elements[index]->number.value - <= V2_desc->number.value) + if (pkg_desc->package.elements[index]->integer.value + <= V2_desc->integer.value) { continue; } @@ -497,7 +497,7 @@ acpi_aml_exec_match ( /* Match_value is the return value */ - ret_desc->number.value = match_value; + ret_desc->integer.value = match_value; cleanup: diff --git a/drivers/acpi/interpreter/ammonad.c b/drivers/acpi/interpreter/ammonad.c index df9671c06..ea8834a5c 100644 --- a/drivers/acpi/interpreter/ammonad.c +++ b/drivers/acpi/interpreter/ammonad.c @@ -2,12 +2,12 @@ /****************************************************************************** * * Module Name: ammonad - ACPI AML (p-code) execution for monadic operators - * $Revision: 88 $ + * $Revision: 89 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -180,7 +180,7 @@ acpi_aml_exec_monadic1 ( case AML_SLEEP_OP: - acpi_aml_system_do_suspend ((u32) obj_desc->number.value); + acpi_aml_system_do_suspend ((u32) obj_desc->integer.value); break; @@ -188,7 +188,7 @@ acpi_aml_exec_monadic1 ( case AML_STALL_OP: - acpi_aml_system_do_stall ((u32) obj_desc->number.value); + acpi_aml_system_do_stall ((u32) obj_desc->integer.value); break; @@ -267,7 +267,7 @@ acpi_aml_exec_monadic2_r ( case AML_TO_BCD_OP: case AML_COND_REF_OF_OP: - ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER); + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER); if (!ret_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -283,7 +283,7 @@ acpi_aml_exec_monadic2_r ( case AML_BIT_NOT_OP: - ret_desc->number.value = ~obj_desc->number.value; + ret_desc->integer.value = ~obj_desc->integer.value; break; @@ -291,17 +291,17 @@ acpi_aml_exec_monadic2_r ( case AML_FIND_SET_LEFT_BIT_OP: - ret_desc->number.value = obj_desc->number.value; + ret_desc->integer.value = obj_desc->integer.value; /* * Acpi specification describes Integer type as a little * endian unsigned value, so this boundry condition is valid. */ - for (res_val = 0; ret_desc->number.value && res_val < ACPI_INTEGER_BIT_SIZE; ++res_val) { - ret_desc->number.value >>= 1; + for (res_val = 0; ret_desc->integer.value && res_val < ACPI_INTEGER_BIT_SIZE; ++res_val) { + ret_desc->integer.value >>= 1; } - ret_desc->number.value = res_val; + ret_desc->integer.value = res_val; break; @@ -309,19 +309,19 @@ acpi_aml_exec_monadic2_r ( case AML_FIND_SET_RIGHT_BIT_OP: - ret_desc->number.value = obj_desc->number.value; + ret_desc->integer.value = obj_desc->integer.value; /* * Acpi specification describes Integer type as a little * endian unsigned value, so this boundry condition is valid. */ - for (res_val = 0; ret_desc->number.value && res_val < ACPI_INTEGER_BIT_SIZE; ++res_val) { - ret_desc->number.value <<= 1; + for (res_val = 0; ret_desc->integer.value && res_val < ACPI_INTEGER_BIT_SIZE; ++res_val) { + ret_desc->integer.value <<= 1; } /* Since returns must be 1-based, subtract from 33 (65) */ - ret_desc->number.value = res_val == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - res_val; + ret_desc->integer.value = res_val == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - res_val; break; @@ -332,11 +332,11 @@ acpi_aml_exec_monadic2_r ( /* * The 64-bit ACPI integer can hold 16 4-bit BCD integers */ - ret_desc->number.value = 0; + ret_desc->integer.value = 0; for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) { /* Get one BCD digit */ - digit = (ACPI_INTEGER) ((obj_desc->number.value >> (i * 4)) & 0xF); + digit = (ACPI_INTEGER) ((obj_desc->integer.value >> (i * 4)) & 0xF); /* Check the range of the digit */ @@ -352,7 +352,7 @@ acpi_aml_exec_monadic2_r ( digit *= 10; } - ret_desc->number.value += digit; + ret_desc->integer.value += digit; } } break; @@ -363,16 +363,16 @@ acpi_aml_exec_monadic2_r ( case AML_TO_BCD_OP: - if (obj_desc->number.value > ACPI_MAX_BCD_VALUE) { + if (obj_desc->integer.value > ACPI_MAX_BCD_VALUE) { status = AE_AML_NUMERIC_OVERFLOW; goto cleanup; } - ret_desc->number.value = 0; + ret_desc->integer.value = 0; for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) { /* Divide by nth factor of 10 */ - digit = obj_desc->number.value; + digit = obj_desc->integer.value; for (j = 0; j < i; j++) { digit /= 10; } @@ -380,7 +380,7 @@ acpi_aml_exec_monadic2_r ( /* Create the BCD digit */ if (digit > 0) { - ret_desc->number.value += (ACPI_MODULO (digit, 10) << (i * 4)); + ret_desc->integer.value += (ACPI_MODULO (digit, 10) << (i * 4)); } } break; @@ -402,7 +402,7 @@ acpi_aml_exec_monadic2_r ( * return FALSE */ - ret_desc->number.value = 0; + ret_desc->integer.value = 0; /* * Must delete the result descriptor since there is no reference @@ -424,7 +424,7 @@ acpi_aml_exec_monadic2_r ( /* The object exists in the namespace, return TRUE */ - ret_desc->number.value = ACPI_INTEGER_MAX; + ret_desc->integer.value = ACPI_INTEGER_MAX; goto cleanup; break; @@ -579,13 +579,13 @@ acpi_aml_exec_monadic2 ( case AML_LNOT_OP: - ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER); + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER); if (!ret_desc) { status = AE_NO_MEMORY; goto cleanup; } - ret_desc->number.value = !obj_desc->number.value; + ret_desc->integer.value = !obj_desc->integer.value; break; @@ -638,10 +638,10 @@ acpi_aml_exec_monadic2 ( /* Do the actual increment or decrement */ if (AML_INCREMENT_OP == opcode) { - ret_desc->number.value++; + ret_desc->integer.value++; } else { - ret_desc->number.value--; + ret_desc->integer.value--; } /* Store the result back in the original descriptor */ @@ -672,7 +672,7 @@ acpi_aml_exec_monadic2 ( /* Constants are of type Number */ - type = ACPI_TYPE_NUMBER; + type = ACPI_TYPE_INTEGER; break; @@ -733,13 +733,13 @@ acpi_aml_exec_monadic2 ( /* Allocate a descriptor to hold the type. */ - ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER); + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER); if (!ret_desc) { status = AE_NO_MEMORY; goto cleanup; } - ret_desc->number.value = type; + ret_desc->integer.value = type; break; @@ -793,13 +793,13 @@ acpi_aml_exec_monadic2 ( * object to hold the value */ - ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER); + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER); if (!ret_desc) { status = AE_NO_MEMORY; goto cleanup; } - ret_desc->number.value = value; + ret_desc->integer.value = value; break; @@ -910,14 +910,14 @@ acpi_aml_exec_monadic2 ( * sub-buffer of the main buffer, it is only a pointer to a * single element (byte) of the buffer! */ - ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER); + ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER); if (!ret_desc) { status = AE_NO_MEMORY; goto cleanup; } tmp_desc = obj_desc->reference.object; - ret_desc->number.value = + ret_desc->integer.value = tmp_desc->buffer.pointer[obj_desc->reference.offset]; /* TBD: [Investigate] (see below) Don't add an additional diff --git a/drivers/acpi/interpreter/amnames.c b/drivers/acpi/interpreter/amnames.c index ea4c26e08..07be1a37c 100644 --- a/drivers/acpi/interpreter/amnames.c +++ b/drivers/acpi/interpreter/amnames.c @@ -2,12 +2,12 @@ /****************************************************************************** * * Module Name: amnames - interpreter/scanner name load/execute - * $Revision: 71 $ + * $Revision: 73 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/interpreter/amprep.c b/drivers/acpi/interpreter/amprep.c index 266cb0105..2a56d4826 100644 --- a/drivers/acpi/interpreter/amprep.c +++ b/drivers/acpi/interpreter/amprep.c @@ -2,12 +2,12 @@ /****************************************************************************** * * Module Name: amprep - ACPI AML (p-code) execution - field prep utilities - * $Revision: 72 $ + * $Revision: 73 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/interpreter/amregion.c b/drivers/acpi/interpreter/amregion.c index dfe4fab85..1a2e7351d 100644 --- a/drivers/acpi/interpreter/amregion.c +++ b/drivers/acpi/interpreter/amregion.c @@ -2,12 +2,12 @@ /****************************************************************************** * * Module Name: amregion - ACPI default Op_region (address space) handlers - * $Revision: 41 $ + * $Revision: 44 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,8 +99,8 @@ acpi_aml_system_memory_space_handler ( */ if ((address < mem_info->mapped_physical_address) || - ((address + length) > - (mem_info->mapped_physical_address + mem_info->mapped_length))) + (((ACPI_INTEGER) address + length) > + ((ACPI_INTEGER) mem_info->mapped_physical_address + mem_info->mapped_length))) { /* * The request cannot be resolved by the current memory mapping; @@ -139,7 +139,7 @@ acpi_aml_system_memory_space_handler ( /* TBD: should these pointers go to 64-bit in all cases ? */ logical_addr_ptr = mem_info->mapped_logical_address + - (address - mem_info->mapped_physical_address); + ((ACPI_INTEGER) address - (ACPI_INTEGER) mem_info->mapped_physical_address); /* Perform the memory read or write */ diff --git a/drivers/acpi/interpreter/amresnte.c b/drivers/acpi/interpreter/amresnte.c index 20c6a0b11..0dc67b613 100644 --- a/drivers/acpi/interpreter/amresnte.c +++ b/drivers/acpi/interpreter/amresnte.c @@ -2,12 +2,12 @@ /****************************************************************************** * * Module Name: amresnte - AML Interpreter object resolution - * $Revision: 25 $ + * $Revision: 27 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,7 +55,7 @@ * can be either a pointer to an actual internal object or a pointer into the * AML stream itself. These types are currently: * - * ACPI_TYPE_NUMBER + * ACPI_TYPE_INTEGER * ACPI_TYPE_STRING * ACPI_TYPE_BUFFER * ACPI_TYPE_MUTEX @@ -208,14 +208,14 @@ acpi_aml_resolve_node_to_value ( break; - case ACPI_TYPE_NUMBER: + case ACPI_TYPE_INTEGER: /* * The Node has an attached internal object, make sure that it's a * number */ - if (ACPI_TYPE_NUMBER != val_desc->common.type) { + if (ACPI_TYPE_INTEGER != val_desc->common.type) { return (AE_AML_OPERAND_TYPE); } @@ -244,7 +244,7 @@ acpi_aml_resolve_node_to_value ( object_type = ACPI_TYPE_BUFFER; } else { - object_type = ACPI_TYPE_NUMBER; + object_type = ACPI_TYPE_INTEGER; } /* @@ -282,7 +282,7 @@ acpi_aml_resolve_node_to_value ( return (status); } - obj_desc->number.value = temp_val; + obj_desc->integer.value = temp_val; } @@ -330,12 +330,12 @@ acpi_aml_resolve_node_to_value ( /* Create an object for the result */ - obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER); + obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER); if (!obj_desc) { return (AE_NO_MEMORY); } - obj_desc->number.value = temp_val; + obj_desc->integer.value = temp_val; break; @@ -378,12 +378,12 @@ acpi_aml_resolve_node_to_value ( /* Create an object for the result */ - obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER); + obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER); if (!obj_desc) { return (AE_NO_MEMORY); } - obj_desc->number.value = temp_val; + obj_desc->integer.value = temp_val; break; @@ -477,12 +477,12 @@ acpi_aml_resolve_node_to_value ( /* Create object for result */ - obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER); + obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_INTEGER); if (!obj_desc) { return (AE_NO_MEMORY); } - obj_desc->number.value = temp_val; + obj_desc->integer.value = temp_val; /* Truncate value if we are executing from a 32-bit ACPI table */ diff --git a/drivers/acpi/interpreter/amresolv.c b/drivers/acpi/interpreter/amresolv.c index 2fa59e9bb..c08a4731c 100644 --- a/drivers/acpi/interpreter/amresolv.c +++ b/drivers/acpi/interpreter/amresolv.c @@ -2,12 +2,12 @@ /****************************************************************************** * * Module Name: amresolv - AML Interpreter object resolution - * $Revision: 78 $ + * $Revision: 81 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -118,19 +118,19 @@ acpi_aml_get_field_unit_value ( mask = ACPI_UINT32_MAX; } - result_desc->number.type = (u8) ACPI_TYPE_NUMBER; + result_desc->integer.type = (u8) ACPI_TYPE_INTEGER; /* Get the 32 bit value at the location */ - MOVE_UNALIGNED32_TO_32 (&result_desc->number.value, location); + MOVE_UNALIGNED32_TO_32 (&result_desc->integer.value, location); /* * Shift the 32-bit word containing the field, and mask off the * resulting value */ - result_desc->number.value = - (result_desc->number.value >> field_desc->field_unit.bit_offset) & mask; + result_desc->integer.value = + (result_desc->integer.value >> field_desc->field_unit.bit_offset) & mask; /* Release global lock if we acquired it earlier */ @@ -150,7 +150,7 @@ acpi_aml_get_field_unit_value ( * * RETURN: Status * - * DESCRIPTION: Convert Reference entries on Obj_stack to Rvalues + * DESCRIPTION: Convert Reference objects to values * ******************************************************************************/ @@ -279,7 +279,7 @@ acpi_aml_resolve_object_to_value ( acpi_cm_remove_reference (stack_desc); *stack_ptr = obj_desc; - if (ACPI_TYPE_NUMBER == obj_desc->common.type) { + if (ACPI_TYPE_INTEGER == obj_desc->common.type) { /* Value is a Number */ } @@ -311,7 +311,7 @@ acpi_aml_resolve_object_to_value ( acpi_cm_remove_reference (stack_desc); *stack_ptr = obj_desc; - if (ACPI_TYPE_NUMBER == obj_desc->common.type) { + if (ACPI_TYPE_INTEGER == obj_desc->common.type) { /* Value is a Number */ } @@ -326,22 +326,22 @@ acpi_aml_resolve_object_to_value ( case AML_ZERO_OP: - stack_desc->common.type = (u8) ACPI_TYPE_NUMBER; - stack_desc->number.value = 0; + stack_desc->common.type = (u8) ACPI_TYPE_INTEGER; + stack_desc->integer.value = 0; break; case AML_ONE_OP: - stack_desc->common.type = (u8) ACPI_TYPE_NUMBER; - stack_desc->number.value = 1; + stack_desc->common.type = (u8) ACPI_TYPE_INTEGER; + stack_desc->integer.value = 1; break; case AML_ONES_OP: - stack_desc->common.type = (u8) ACPI_TYPE_NUMBER; - stack_desc->number.value = ACPI_INTEGER_MAX; + stack_desc->common.type = (u8) ACPI_TYPE_INTEGER; + stack_desc->integer.value = ACPI_INTEGER_MAX; /* Truncate value if we are executing from a 32-bit ACPI table */ diff --git a/drivers/acpi/interpreter/amresop.c b/drivers/acpi/interpreter/amresop.c index 83fda4455..a837fd66b 100644 --- a/drivers/acpi/interpreter/amresop.c +++ b/drivers/acpi/interpreter/amresop.c @@ -2,12 +2,12 @@ /****************************************************************************** * * Module Name: amresop - AML Interpreter operand/object resolution - * $Revision: 18 $ + * $Revision: 22 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -214,8 +214,13 @@ acpi_aml_resolve_operands ( switch (this_arg_type) { - case ARGI_REFERENCE: /* Reference */ - case ARGI_TARGETREF: + case ARGI_REFERENCE: /* References */ + case ARGI_INTEGER_REF: + case ARGI_OBJECT_REF: + case ARGI_DEVICE_REF: + case ARGI_TARGETREF: /* TBD: must implement implicit conversion rules before store */ + case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ + case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ /* Need an operand of type INTERNAL_TYPE_REFERENCE */ @@ -283,20 +288,6 @@ acpi_aml_resolve_operands ( * For the simple cases, only one type of resolved object * is allowed */ - case ARGI_NUMBER: /* Number */ - - /* Need an operand of type ACPI_TYPE_NUMBER */ - - type_needed = ACPI_TYPE_NUMBER; - break; - - case ARGI_BUFFER: - - /* Need an operand of type ACPI_TYPE_BUFFER */ - - type_needed = ACPI_TYPE_BUFFER; - break; - case ARGI_MUTEX: /* Need an operand of type ACPI_TYPE_MUTEX */ @@ -344,11 +335,69 @@ acpi_aml_resolve_operands ( * The more complex cases allow multiple resolved object types */ + case ARGI_INTEGER: /* Number */ + + /* + * Need an operand of type ACPI_TYPE_INTEGER, + * But we can implicitly convert from a STRING or BUFFER + */ + status = acpi_aml_convert_to_integer (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { + if (status == AE_TYPE) { + return (AE_AML_OPERAND_TYPE); + } + + return (status); + } + + goto next_operand; + break; + + + case ARGI_BUFFER: + + /* + * Need an operand of type ACPI_TYPE_BUFFER, + * But we can implicitly convert from a STRING or INTEGER + */ + status = acpi_aml_convert_to_buffer (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { + if (status == AE_TYPE) { + return (AE_AML_OPERAND_TYPE); + } + + return (status); + } + + goto next_operand; + break; + + case ARGI_STRING: - /* Need an operand of type ACPI_TYPE_STRING or ACPI_TYPE_BUFFER */ + /* + * Need an operand of type ACPI_TYPE_STRING, + * But we can implicitly convert from a BUFFER or INTEGER + */ + status = acpi_aml_convert_to_string (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { + if (status == AE_TYPE) { + return (AE_AML_OPERAND_TYPE); + } + + return (status); + } + + goto next_operand; + break; + + + case ARGI_COMPUTEDATA: + + /* Need an operand of type INTEGER, STRING or BUFFER */ - if ((ACPI_TYPE_STRING != (*stack_ptr)->common.type) && + if ((ACPI_TYPE_INTEGER != (*stack_ptr)->common.type) && + (ACPI_TYPE_STRING != (*stack_ptr)->common.type) && (ACPI_TYPE_BUFFER != (*stack_ptr)->common.type)) { return (AE_AML_OPERAND_TYPE); diff --git a/drivers/acpi/interpreter/amstore.c b/drivers/acpi/interpreter/amstore.c index 8887e0997..9f350bb29 100644 --- a/drivers/acpi/interpreter/amstore.c +++ b/drivers/acpi/interpreter/amstore.c @@ -2,12 +2,12 @@ /****************************************************************************** * * Module Name: amstore - AML Interpreter object store support - * $Revision: 117 $ + * $Revision: 121 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,12 +64,7 @@ acpi_aml_exec_store ( ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_OK; - ACPI_OPERAND_OBJECT *delete_dest_desc = NULL; - ACPI_OPERAND_OBJECT *tmp_desc; - ACPI_NAMESPACE_NODE *node = NULL; - u8 value = 0; - u32 length; - u32 i; + ACPI_OPERAND_OBJECT *ref_desc = dest_desc; /* Validate parameters */ @@ -78,27 +73,23 @@ acpi_aml_exec_store ( return (AE_AML_NO_OPERAND); } - /* Examine the datatype of the Dest_desc */ + /* Dest_desc can be either a namespace node or an ACPI object */ if (VALID_DESCRIPTOR_TYPE (dest_desc, ACPI_DESC_TYPE_NAMED)) { - /* Dest is an ACPI_HANDLE, create a new object */ - - node = (ACPI_NAMESPACE_NODE *) dest_desc; - dest_desc = acpi_cm_create_internal_object (INTERNAL_TYPE_REFERENCE); - if (!dest_desc) { - /* Allocation failure */ - - return (AE_NO_MEMORY); - } + /* + * Dest is a namespace node, + * Storing an object into a Name "container" + */ + status = acpi_aml_store_object_to_node (val_desc, + (ACPI_NAMESPACE_NODE *) dest_desc, walk_state); - /* Build a new Reference wrapper around the handle */ + /* All done, that's it */ - dest_desc->reference.op_code = AML_NAME_OP; - dest_desc->reference.object = node; + return (status); } - /* Destination object must be of type Reference */ + /* Destination object must be an object of type Reference */ if (dest_desc->common.type != INTERNAL_TYPE_REFERENCE) { /* Destination is not an Reference */ @@ -106,36 +97,130 @@ acpi_aml_exec_store ( return (AE_AML_OPERAND_TYPE); } - /* Examine the Reference opcode */ - switch (dest_desc->reference.op_code) + /* + * Examine the Reference opcode. These cases are handled: + * + * 1) Store to Name (Change the object associated with a name) + * 2) Store to an indexed area of a Buffer or Package + * 3) Store to a Method Local or Arg + * 4) Store to the debug object + * 5) Store to a constant -- a noop + */ + + switch (ref_desc->reference.op_code) { case AML_NAME_OP: - /* - * Storing into a Name - */ - delete_dest_desc = dest_desc; - status = acpi_aml_store_object_to_node (val_desc, dest_desc->reference.object, - walk_state); + /* Storing an object into a Name "container" */ - break; /* Case Name_op */ + status = acpi_aml_store_object_to_node (val_desc, ref_desc->reference.object, + walk_state); + break; case AML_INDEX_OP: - delete_dest_desc = dest_desc; + /* Storing to an Index (pointer into a packager or buffer) */ + + status = acpi_aml_store_object_to_index (val_desc, ref_desc, walk_state); + break; + + + case AML_LOCAL_OP: + + status = acpi_ds_method_data_set_value (MTH_TYPE_LOCAL, + (ref_desc->reference.offset), val_desc, walk_state); + break; + + + case AML_ARG_OP: + + status = acpi_ds_method_data_set_value (MTH_TYPE_ARG, + (ref_desc->reference.offset), val_desc, walk_state); + break; + + + case AML_DEBUG_OP: /* - * Valid source value and destination reference pointer. + * Storing to the Debug object causes the value stored to be + * displayed and otherwise has no effect -- see ACPI Specification * - * ACPI Specification 1.0B section 15.2.3.4.2.13: - * Destination should point to either a buffer or a package + * TBD: print known object types "prettier". */ + break; + + + case AML_ZERO_OP: + case AML_ONE_OP: + case AML_ONES_OP: + /* - * Actually, storing to a package is not so simple. The source must be + * Storing to a constant is a no-op -- see ACPI Specification + * Delete the reference descriptor, however + */ + break; + + + default: + + /* TBD: [Restructure] use object dump routine !! */ + + status = AE_AML_INTERNAL; + break; + + } /* switch (Ref_desc->Reference.Op_code) */ + + + /* Always delete the reference descriptor object */ + + if (ref_desc) { + acpi_cm_remove_reference (ref_desc); + } + + return (status); +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_aml_store_object_to_index + * + * PARAMETERS: *Val_desc - Value to be stored + * *Node - Named object to recieve the value + * + * RETURN: Status + * + * DESCRIPTION: Store the object to the named object. + * + ******************************************************************************/ + +ACPI_STATUS +acpi_aml_store_object_to_index ( + ACPI_OPERAND_OBJECT *val_desc, + ACPI_OPERAND_OBJECT *dest_desc, + ACPI_WALK_STATE *walk_state) +{ + ACPI_STATUS status = AE_OK; + ACPI_OPERAND_OBJECT *obj_desc; + u32 length; + u32 i; + u8 value = 0; + + + /* + * Destination must be a reference pointer, and + * must point to either a buffer or a package + */ + + switch (dest_desc->reference.target_type) + { + case ACPI_TYPE_PACKAGE: + /* + * Storing to a package element is not simple. The source must be * evaluated and converted to the type of the destination and then the * source is copied into the destination - we can't just point to the * source object. @@ -145,8 +230,8 @@ acpi_aml_exec_store ( * The object at *(Dest_desc->Reference.Where) is the * element within the package that is to be modified. */ - tmp_desc = *(dest_desc->reference.where); - if (tmp_desc) { + obj_desc = *(dest_desc->reference.where); + if (obj_desc) { /* * If the Destination element is a package, we will delete * that object and construct a new one. @@ -155,41 +240,39 @@ acpi_aml_exec_store ( * to be packages? * && (Val_desc->Common.Type == ACPI_TYPE_PACKAGE) */ - if (tmp_desc->common.type == ACPI_TYPE_PACKAGE) { + if (obj_desc->common.type == ACPI_TYPE_PACKAGE) { /* * Take away the reference for being part of a package and * delete */ - acpi_cm_remove_reference (tmp_desc); - acpi_cm_remove_reference (tmp_desc); + acpi_cm_remove_reference (obj_desc); + acpi_cm_remove_reference (obj_desc); - tmp_desc = NULL; + obj_desc = NULL; } } - if (!tmp_desc) { + if (!obj_desc) { /* - * If the Tmp_desc is NULL, that means an uninitialized package - * has been used as a destination, therefore, we must create - * the destination element to match the type of the source - * element NOTE: Val_desc can be of any type. + * If the Obj_desc is NULL, it means that an uninitialized package + * element has been used as a destination (this is OK), therefore, + * we must create the destination element to match the type of the + * source element NOTE: Val_desc can be of any type. */ - tmp_desc = acpi_cm_create_internal_object (val_desc->common.type); - if (!tmp_desc) { - status = AE_NO_MEMORY; - goto cleanup; + obj_desc = acpi_cm_create_internal_object (val_desc->common.type); + if (!obj_desc) { + return (AE_NO_MEMORY); } /* * If the source is a package, copy the source to the new dest */ - if (ACPI_TYPE_PACKAGE == tmp_desc->common.type) { + if (ACPI_TYPE_PACKAGE == obj_desc->common.type) { status = acpi_aml_build_copy_internal_package_object ( - val_desc, tmp_desc, walk_state); + val_desc, obj_desc, walk_state); if (ACPI_FAILURE (status)) { - acpi_cm_remove_reference (tmp_desc); - tmp_desc = NULL; - goto cleanup; + acpi_cm_remove_reference (obj_desc); + return (status); } } @@ -199,38 +282,31 @@ acpi_aml_exec_store ( * part of the parent package */ - *(dest_desc->reference.where) = tmp_desc; - acpi_cm_add_reference (tmp_desc); + *(dest_desc->reference.where) = obj_desc; + acpi_cm_add_reference (obj_desc); } - if (ACPI_TYPE_PACKAGE != tmp_desc->common.type) { + if (ACPI_TYPE_PACKAGE != obj_desc->common.type) { /* * The destination element is not a package, so we need to * convert the contents of the source (Val_desc) and copy into - * the destination (Tmp_desc) + * the destination (Obj_desc) */ - status = acpi_aml_store_object_to_object (val_desc, tmp_desc, + status = acpi_aml_store_object_to_object (val_desc, obj_desc, walk_state); if (ACPI_FAILURE (status)) { /* * An error occurrered when copying the internal object * so delete the reference. */ - status = AE_AML_OPERAND_TYPE; + return (AE_AML_OPERAND_TYPE); } } - - break; } + break; - /* - * Check that the destination is a Buffer Field type - */ - if (dest_desc->reference.target_type != ACPI_TYPE_BUFFER_FIELD) { - status = AE_AML_OPERAND_TYPE; - break; - } + case ACPI_TYPE_BUFFER_FIELD: /* * Storing into a buffer at a location defined by an Index. * @@ -239,13 +315,11 @@ acpi_aml_exec_store ( */ /* - * Set the Tmp_desc to the destination object and type check. + * Set the Obj_desc to the destination object and type check. */ - tmp_desc = dest_desc->reference.object; - - if (tmp_desc->common.type != ACPI_TYPE_BUFFER) { - status = AE_AML_OPERAND_TYPE; - break; + obj_desc = dest_desc->reference.object; + if (obj_desc->common.type != ACPI_TYPE_BUFFER) { + return (AE_AML_OPERAND_TYPE); } /* @@ -256,15 +330,15 @@ acpi_aml_exec_store ( switch (val_desc->common.type) { /* - * If the type is Integer, the Length is 4. + * If the type is Integer, assign bytewise * This loop to assign each of the elements is somewhat - * backward because of the Big Endian-ness of IA-64 + * backward because of the Big Endian-ness of IA-64 */ - case ACPI_TYPE_NUMBER: - length = 4; + case ACPI_TYPE_INTEGER: + length = sizeof (ACPI_INTEGER); for (i = length; i != 0; i--) { - value = (u8)(val_desc->number.value >> (MUL_8 (i - 1))); - tmp_desc->buffer.pointer[dest_desc->reference.offset] = value; + value = (u8)(val_desc->integer.value >> (MUL_8 (i - 1))); + obj_desc->buffer.pointer[dest_desc->reference.offset] = value; } break; @@ -276,7 +350,7 @@ acpi_aml_exec_store ( length = val_desc->buffer.length; for (i = 0; i < length; i++) { value = *(val_desc->buffer.pointer + i); - tmp_desc->buffer.pointer[dest_desc->reference.offset] = value; + obj_desc->buffer.pointer[dest_desc->reference.offset] = value; } break; @@ -288,7 +362,7 @@ acpi_aml_exec_store ( length = val_desc->string.length; for (i = 0; i < length; i++) { value = *(val_desc->string.pointer + i); - tmp_desc->buffer.pointer[dest_desc->reference.offset] = value; + obj_desc->buffer.pointer[dest_desc->reference.offset] = value; } break; @@ -299,80 +373,207 @@ acpi_aml_exec_store ( status = AE_AML_OPERAND_TYPE; break; } + break; - /* - * If we had an error, break out of this case statement. - */ - if (ACPI_FAILURE (status)) { - break; - } - - /* - * Set the return pointer - */ - dest_desc = tmp_desc; + default: + status = AE_AML_OPERAND_TYPE; break; + } - case AML_ZERO_OP: - case AML_ONE_OP: - case AML_ONES_OP: - /* - * Storing to a constant is a no-op -- see ACPI Specification - * Delete the result descriptor. - */ + return (status); +} - delete_dest_desc = dest_desc; - break; + +/******************************************************************************* + * + * FUNCTION: Acpi_aml_store_object_to_node + * + * PARAMETERS: *Source_desc - Value to be stored + * *Node - Named object to recieve the value + * + * RETURN: Status + * + * DESCRIPTION: Store the object to the named object. + * + * The Assignment of an object to a named object is handled here + * The val passed in will replace the current value (if any) + * with the input value. + * + * When storing into an object the data is converted to the + * target object type then stored in the object. This means + * that the target object type (for an initialized target) will + * not be changed by a store operation. + * + * NOTE: the global lock is acquired early. This will result + * in the global lock being held a bit longer. Also, if the + * function fails during set up we may get the lock when we + * don't really need it. I don't think we care. + * + ******************************************************************************/ + +ACPI_STATUS +acpi_aml_store_object_to_node ( + ACPI_OPERAND_OBJECT *source_desc, + ACPI_NAMESPACE_NODE *node, + ACPI_WALK_STATE *walk_state) +{ + ACPI_STATUS status = AE_OK; + ACPI_OPERAND_OBJECT *target_desc; + OBJECT_TYPE_INTERNAL target_type = ACPI_TYPE_ANY; - case AML_LOCAL_OP: + /* + * Assuming the parameters were already validated + */ + ACPI_ASSERT((node) && (source_desc)); - status = acpi_ds_method_data_set_value (MTH_TYPE_LOCAL, - (dest_desc->reference.offset), val_desc, walk_state); - delete_dest_desc = dest_desc; - break; + /* + * Get current type of the node, and object attached to Node + */ + target_type = acpi_ns_get_type (node); + target_desc = acpi_ns_get_attached_object (node); - case AML_ARG_OP: - status = acpi_ds_method_data_set_value (MTH_TYPE_ARG, - (dest_desc->reference.offset), val_desc, walk_state); - delete_dest_desc = dest_desc; + /* + * Resolve the source object to an actual value + * (If it is a reference object) + */ + status = acpi_aml_resolve_object (&source_desc, target_type, walk_state); + if (ACPI_FAILURE (status)) { + return (status); + } + + + /* + * Do the actual store operation + */ + switch (target_type) + { + case INTERNAL_TYPE_DEF_FIELD: + + /* Raw data copy for target types Integer/String/Buffer */ + + status = acpi_aml_copy_data_to_named_field (source_desc, node); break; - case AML_DEBUG_OP: + case ACPI_TYPE_INTEGER: + case ACPI_TYPE_STRING: + case ACPI_TYPE_BUFFER: + case INTERNAL_TYPE_BANK_FIELD: + case INTERNAL_TYPE_INDEX_FIELD: + case ACPI_TYPE_FIELD_UNIT: /* - * Storing to the Debug object causes the value stored to be - * displayed and otherwise has no effect -- see ACPI Specification + * These target types are all of type Integer/String/Buffer, and + * therefore support implicit conversion before the store. + * + * Copy and/or convert the source object to a new target object */ + status = acpi_aml_store_object (source_desc, target_type, &target_desc, walk_state); + if (ACPI_FAILURE (status)) { + return (status); + } - delete_dest_desc = dest_desc; + /* + * Store the new Target_desc as the new value of the Name, and set + * the Name's type to that of the value being stored in it. + * Source_desc reference count is incremented by Attach_object. + */ + status = acpi_ns_attach_object (node, target_desc, target_type); break; default: - /* TBD: [Restructure] use object dump routine !! */ + /* No conversions for all other types. Just attach the source object */ - delete_dest_desc = dest_desc; - status = AE_AML_INTERNAL; + status = acpi_ns_attach_object (node, source_desc, source_desc->common.type); - } /* switch(Dest_desc->Reference.Op_code) */ + break; + } -cleanup: + return (status); +} - /* Cleanup and exit*/ - if (delete_dest_desc) { - acpi_cm_remove_reference (delete_dest_desc); +/******************************************************************************* + * + * FUNCTION: Acpi_aml_store_object_to_object + * + * PARAMETERS: *Source_desc - Value to be stored + * *Dest_desc - Object to receive the value + * + * RETURN: Status + * + * DESCRIPTION: Store an object to another object. + * + * The Assignment of an object to another (not named) object + * is handled here. + * The val passed in will replace the current value (if any) + * with the input value. + * + * When storing into an object the data is converted to the + * target object type then stored in the object. This means + * that the target object type (for an initialized target) will + * not be changed by a store operation. + * + * This module allows destination types of Number, String, + * and Buffer. + * + ******************************************************************************/ + +ACPI_STATUS +acpi_aml_store_object_to_object ( + ACPI_OPERAND_OBJECT *source_desc, + ACPI_OPERAND_OBJECT *dest_desc, + ACPI_WALK_STATE *walk_state) +{ + ACPI_STATUS status = AE_OK; + OBJECT_TYPE_INTERNAL destination_type = dest_desc->common.type; + + + /* + * Assuming the parameters are valid! + */ + ACPI_ASSERT((dest_desc) && (source_desc)); + + + /* + * From this interface, we only support Integers/Strings/Buffers + */ + switch (destination_type) + { + case ACPI_TYPE_INTEGER: + case ACPI_TYPE_STRING: + case ACPI_TYPE_BUFFER: + break; + + default: + return (AE_NOT_IMPLEMENTED); } + + /* + * Resolve the source object to an actual value + * (If it is a reference object) + */ + status = acpi_aml_resolve_object (&source_desc, destination_type, walk_state); + if (ACPI_FAILURE (status)) { + return (status); + } + + + /* + * Copy and/or convert the source object to the destination object + */ + status = acpi_aml_store_object (source_desc, destination_type, &dest_desc, walk_state); + + return (status); } - diff --git a/drivers/acpi/interpreter/amstoren.c b/drivers/acpi/interpreter/amstoren.c index 91b2095c5..eb62ed2f1 100644 --- a/drivers/acpi/interpreter/amstoren.c +++ b/drivers/acpi/interpreter/amstoren.c @@ -2,13 +2,13 @@ /****************************************************************************** * * Module Name: amstoren - AML Interpreter object store support, - * Store to Node (namespace object) - * $Revision: 24 $ + * Store to Node (namespace object) + * $Revision: 28 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,127 +41,72 @@ /******************************************************************************* * - * FUNCTION: Acpi_aml_store_object_to_node + * FUNCTION: Acpi_aml_resolve_object * - * PARAMETERS: *Val_desc - Value to be stored - * *Node - Named object to recieve the value + * PARAMETERS: Source_desc_ptr - Pointer to the source object + * Target_type - Current type of the target + * Walk_state - Current walk state * - * RETURN: Status - * - * DESCRIPTION: Store the object to the named object. - * - * The Assignment of an object to a named object is handled here - * The val passed in will replace the current value (if any) - * with the input value. + * RETURN: Status, resolved object in Source_desc_ptr. * - * When storing into an object the data is converted to the - * target object type then stored in the object. This means - * that the target object type (for an initialized target) will - * not be changed by a store operation. - * - * NOTE: the global lock is acquired early. This will result - * in the global lock being held a bit longer. Also, if the - * function fails during set up we may get the lock when we - * don't really need it. I don't think we care. + * DESCRIPTION: Resolve an object. If the object is a reference, dereference + * it and return the actual object in the Source_desc_ptr. * ******************************************************************************/ ACPI_STATUS -acpi_aml_store_object_to_node ( - ACPI_OPERAND_OBJECT *val_desc, - ACPI_NAMESPACE_NODE *node, +acpi_aml_resolve_object ( + ACPI_OPERAND_OBJECT **source_desc_ptr, + OBJECT_TYPE_INTERNAL target_type, ACPI_WALK_STATE *walk_state) { + ACPI_OPERAND_OBJECT *source_desc = *source_desc_ptr; ACPI_STATUS status = AE_OK; - u8 *buffer = NULL; - u32 length = 0; - u32 mask; - u32 new_value; - u8 locked = FALSE; - u8 *location=NULL; - ACPI_OPERAND_OBJECT *dest_desc; - OBJECT_TYPE_INTERNAL destination_type = ACPI_TYPE_ANY; /* - * Assuming the parameters are valid!!! + * Ensure we have a Source that can be stored in the target */ - ACPI_ASSERT((node) && (val_desc)); + switch (target_type) + { - destination_type = acpi_ns_get_type (node); + /* This case handles the "interchangeable" types Integer, String, and Buffer. */ /* - * First ensure we have a value that can be stored in the target + * These cases all require only Integers or values that + * can be converted to Integers (Strings or Buffers) */ - switch (destination_type) - { - /* Type of Name's existing value */ - - case INTERNAL_TYPE_ALIAS: - - /* - * Aliases are resolved by Acpi_aml_prep_operands - */ - - status = AE_AML_INTERNAL; - break; - - + case ACPI_TYPE_INTEGER: + case ACPI_TYPE_FIELD_UNIT: case INTERNAL_TYPE_BANK_FIELD: case INTERNAL_TYPE_INDEX_FIELD: - case ACPI_TYPE_FIELD_UNIT: - case ACPI_TYPE_NUMBER: - - /* - * These cases all require only number values or values that - * can be converted to numbers. - * - * If value is not a Number, try to resolve it to one. - */ - - if (val_desc->common.type != ACPI_TYPE_NUMBER) { - /* - * Initially not a number, convert - */ - status = acpi_aml_resolve_to_value (&val_desc, walk_state); - if (ACPI_SUCCESS (status) && - (val_desc->common.type != ACPI_TYPE_NUMBER)) - { - /* - * Conversion successful but still not a number - */ - status = AE_AML_OPERAND_TYPE; - } - } - - break; + /* + * Stores into a Field/Region or into a Buffer/String + * are all essentially the same. + */ case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: case INTERNAL_TYPE_DEF_FIELD: /* - * Storing into a Field in a region or into a buffer or into - * a string all is essentially the same. - * - * If value is not a valid type, try to resolve it to one. + * If Source_desc is not a valid type, try to resolve it to one. */ - - if ((val_desc->common.type != ACPI_TYPE_NUMBER) && - (val_desc->common.type != ACPI_TYPE_BUFFER) && - (val_desc->common.type != ACPI_TYPE_STRING)) + if ((source_desc->common.type != ACPI_TYPE_INTEGER) && + (source_desc->common.type != ACPI_TYPE_BUFFER) && + (source_desc->common.type != ACPI_TYPE_STRING)) { /* - * Initially not a valid type, convert + * Initially not a valid type, convert */ - status = acpi_aml_resolve_to_value (&val_desc, walk_state); + status = acpi_aml_resolve_to_value (source_desc_ptr, walk_state); if (ACPI_SUCCESS (status) && - (val_desc->common.type != ACPI_TYPE_NUMBER) && - (val_desc->common.type != ACPI_TYPE_BUFFER) && - (val_desc->common.type != ACPI_TYPE_STRING)) + (source_desc->common.type != ACPI_TYPE_INTEGER) && + (source_desc->common.type != ACPI_TYPE_BUFFER) && + (source_desc->common.type != ACPI_TYPE_STRING)) { /* - * Conversion successful but still not a valid type + * Conversion successful but still not a valid type */ status = AE_AML_OPERAND_TYPE; } @@ -169,347 +114,133 @@ acpi_aml_store_object_to_node ( break; - case ACPI_TYPE_PACKAGE: + case INTERNAL_TYPE_ALIAS: /* - * TBD: [Unhandled] Not real sure what to do here + * Aliases are resolved by Acpi_aml_prep_operands */ - status = AE_NOT_IMPLEMENTED; + status = AE_AML_INTERNAL; break; + case ACPI_TYPE_PACKAGE: default: /* - * All other types than Alias and the various Fields come here. - * Store Val_desc as the new value of the Name, and set - * the Name's type to that of the value being stored in it. - * Val_desc reference count is incremented by Attach_object. + * All other types than Alias and the various Fields come here, + * including the untyped case - ACPI_TYPE_ANY. */ - - status = acpi_ns_attach_object (node, val_desc, val_desc->common.type); - - goto clean_up_and_bail_out; break; } - /* Exit now if failure above */ + return (status); +} + - if (ACPI_FAILURE (status)) { - goto clean_up_and_bail_out; - } +/******************************************************************************* + * + * FUNCTION: Acpi_aml_store_object + * + * PARAMETERS: Source_desc - Object to store + * Target_type - Current type of the target + * Target_desc_ptr - Pointer to the target + * Walk_state - Current walk state + * + * RETURN: Status + * + * DESCRIPTION: "Store" an object to another object. This may include + * converting the source type to the target type (implicit + * conversion), and a copy of the value of the source to + * the target. + * + ******************************************************************************/ + +ACPI_STATUS +acpi_aml_store_object ( + ACPI_OPERAND_OBJECT *source_desc, + OBJECT_TYPE_INTERNAL target_type, + ACPI_OPERAND_OBJECT **target_desc_ptr, + ACPI_WALK_STATE *walk_state) +{ + ACPI_OPERAND_OBJECT *target_desc = *target_desc_ptr; + ACPI_STATUS status; - /* - * Get descriptor for object attached to Node - */ - dest_desc = acpi_ns_get_attached_object (node); - if (!dest_desc) { - /* - * There is no existing object attached to this Node - */ - status = AE_AML_INTERNAL; - goto clean_up_and_bail_out; - } /* - * Make sure the destination Object is the same as the Node + * Perform the "implicit conversion" of the source to the current type + * of the target - As per the ACPI specification. + * + * If no conversion performed, Source_desc is left alone, otherwise it + * is updated with a new object. */ - if (dest_desc->common.type != (u8) destination_type) { - status = AE_AML_INTERNAL; - goto clean_up_and_bail_out; + status = acpi_aml_convert_to_target_type (target_type, &source_desc, walk_state); + if (ACPI_FAILURE (status)) { + return (status); } + /* - * Acpi_everything is ready to execute now, We have - * a value we can handle, just perform the update + * We now have two objects of identical types, and we can perform a + * copy of the *value* of the source object. */ - - switch (destination_type) + switch (target_type) { - /* Type of Name's existing value */ - - case INTERNAL_TYPE_BANK_FIELD: + case ACPI_TYPE_ANY: + case INTERNAL_TYPE_DEF_ANY: /* - * Get the global lock if needed + * The target namespace node is uninitialized (has no target object), + * and will take on the type of the source object */ - locked = acpi_aml_acquire_global_lock (dest_desc->bank_field.lock_rule); - - /* - * Set Bank value to select proper Bank - * Perform the update (Set Bank Select) - */ - - status = acpi_aml_access_named_field (ACPI_WRITE, - dest_desc->bank_field.bank_select, - &dest_desc->bank_field.value, - sizeof (dest_desc->bank_field.value)); - if (ACPI_SUCCESS (status)) { - /* Set bank select successful, set data value */ - - status = acpi_aml_access_named_field (ACPI_WRITE, - dest_desc->bank_field.bank_select, - &val_desc->bank_field.value, - sizeof (val_desc->bank_field.value)); - } + *target_desc_ptr = source_desc; break; - case INTERNAL_TYPE_DEF_FIELD: - - /* - * Get the global lock if needed - */ - locked = acpi_aml_acquire_global_lock (val_desc->field.lock_rule); - - /* - * Perform the update - */ + case ACPI_TYPE_INTEGER: - switch (val_desc->common.type) - { - case ACPI_TYPE_NUMBER: - buffer = (u8 *) &val_desc->number.value; - length = sizeof (val_desc->number.value); - break; - - case ACPI_TYPE_BUFFER: - buffer = (u8 *) val_desc->buffer.pointer; - length = val_desc->buffer.length; - break; - - case ACPI_TYPE_STRING: - buffer = (u8 *) val_desc->string.pointer; - length = val_desc->string.length; - break; - } - - status = acpi_aml_access_named_field (ACPI_WRITE, - node, buffer, length); - - break; /* Global Lock released below */ + target_desc->integer.value = source_desc->integer.value; + /* Truncate value if we are executing from a 32-bit ACPI table */ - case ACPI_TYPE_STRING: - - /* - * Perform the update - */ - - switch (val_desc->common.type) - { - case ACPI_TYPE_NUMBER: - buffer = (u8 *) &val_desc->number.value; - length = sizeof (val_desc->number.value); - break; - - case ACPI_TYPE_BUFFER: - buffer = (u8 *) val_desc->buffer.pointer; - length = val_desc->buffer.length; - break; - - case ACPI_TYPE_STRING: - buffer = (u8 *) val_desc->string.pointer; - length = val_desc->string.length; - break; - } - - /* - * Setting a string value replaces the old string - */ - - if (length < dest_desc->string.length) { - /* - * Zero fill, not willing to do pointer arithmetic for - * archetecture independance. Just clear the whole thing - */ - MEMSET(dest_desc->string.pointer, 0, dest_desc->string.length); - MEMCPY(dest_desc->string.pointer, buffer, length); - } - else { - /* - * Free the current buffer, then allocate a buffer - * large enough to hold the value - */ - if ( dest_desc->string.pointer && - !acpi_tb_system_table_pointer (dest_desc->string.pointer)) - { - /* - * Only free if not a pointer into the DSDT - */ - - acpi_cm_free(dest_desc->string.pointer); - } + acpi_aml_truncate_for32bit_table (target_desc, walk_state); + break; - dest_desc->string.pointer = acpi_cm_allocate (length + 1); - dest_desc->string.length = length; - if (!dest_desc->string.pointer) { - status = AE_NO_MEMORY; - goto clean_up_and_bail_out; - } + case ACPI_TYPE_FIELD_UNIT: - MEMCPY(dest_desc->string.pointer, buffer, length); - } + status = acpi_aml_copy_integer_to_field_unit (source_desc, target_desc); break; - case ACPI_TYPE_BUFFER: - - /* - * Perform the update to the buffer - */ - - switch (val_desc->common.type) - { - case ACPI_TYPE_NUMBER: - buffer = (u8 *) &val_desc->number.value; - length = sizeof (val_desc->number.value); - break; - - case ACPI_TYPE_BUFFER: - buffer = (u8 *) val_desc->buffer.pointer; - length = val_desc->buffer.length; - break; - - case ACPI_TYPE_STRING: - buffer = (u8 *) val_desc->string.pointer; - length = val_desc->string.length; - break; - } + case INTERNAL_TYPE_BANK_FIELD: - /* - * Buffer is a static allocation, - * only place what will fit in the buffer. - */ - if (length <= dest_desc->buffer.length) { - /* - * Zero fill first, not willing to do pointer arithmetic for - * archetecture independence. Just clear the whole thing - */ - MEMSET(dest_desc->buffer.pointer, 0, dest_desc->buffer.length); - MEMCPY(dest_desc->buffer.pointer, buffer, length); - } - else { - /* - * truncate, copy only what will fit - */ - MEMCPY(dest_desc->buffer.pointer, buffer, dest_desc->buffer.length); - } + status = acpi_aml_copy_integer_to_bank_field (source_desc, target_desc); break; case INTERNAL_TYPE_INDEX_FIELD: - /* - * Get the global lock if needed - */ - locked = acpi_aml_acquire_global_lock (dest_desc->index_field.lock_rule); - - /* - * Set Index value to select proper Data register - * perform the update (Set index) - */ - - status = acpi_aml_access_named_field (ACPI_WRITE, - dest_desc->index_field.index, - &dest_desc->index_field.value, - sizeof (dest_desc->index_field.value)); - - if (ACPI_SUCCESS (status)) { - /* set index successful, next set Data value */ - - status = acpi_aml_access_named_field (ACPI_WRITE, - dest_desc->index_field.data, - &val_desc->number.value, - sizeof (val_desc->number.value)); - } + status = acpi_aml_copy_integer_to_index_field (source_desc, target_desc); break; - case ACPI_TYPE_FIELD_UNIT: - - - /* - * If the Field Buffer and Index have not been previously evaluated, - * evaluate them and save the results. - */ - if (!(dest_desc->common.flags & AOPOBJ_DATA_VALID)) { - status = acpi_ds_get_field_unit_arguments (dest_desc); - if (ACPI_FAILURE (status)) { - return (status); - } - } - - if ((!dest_desc->field_unit.container || - ACPI_TYPE_BUFFER != dest_desc->field_unit.container->common.type)) - { - status = AE_AML_INTERNAL; - goto clean_up_and_bail_out; - } - - /* - * Get the global lock if needed - */ - locked = acpi_aml_acquire_global_lock (dest_desc->field_unit.lock_rule); - - /* - * TBD: [Unhandled] REMOVE this limitation - * Make sure the operation is within the limits of our implementation - * this is not a Spec limitation!! - */ - if (dest_desc->field_unit.length + dest_desc->field_unit.bit_offset > 32) { - status = AE_NOT_IMPLEMENTED; - goto clean_up_and_bail_out; - } - - /* Field location is (base of buffer) + (byte offset) */ - - location = dest_desc->field_unit.container->buffer.pointer - + dest_desc->field_unit.offset; - - /* - * Construct Mask with 1 bits where the field is, - * 0 bits elsewhere - */ - mask = ((u32) 1 << dest_desc->field_unit.length) - ((u32)1 - << dest_desc->field_unit.bit_offset); - - /* Zero out the field in the buffer */ - - MOVE_UNALIGNED32_TO_32 (&new_value, location); - new_value &= ~mask; - - /* - * Shift and mask the new value into position, - * and or it into the buffer. - */ - new_value |= (val_desc->number.value << dest_desc->field_unit.bit_offset) & - mask; - - /* Store back the value */ - - MOVE_UNALIGNED32_TO_32 (location, &new_value); + case ACPI_TYPE_STRING: + status = acpi_aml_copy_string_to_string (source_desc, target_desc); break; - case ACPI_TYPE_NUMBER: - - - dest_desc->number.value = val_desc->number.value; - - /* Truncate value if we are executing from a 32-bit ACPI table */ + case ACPI_TYPE_BUFFER: - acpi_aml_truncate_for32bit_table (dest_desc, walk_state); + status = acpi_aml_copy_buffer_to_buffer (source_desc, target_desc); break; case ACPI_TYPE_PACKAGE: /* - * TBD: [Unhandled] Not real sure what to do here + * TBD: [Unhandled] Not real sure what to do here */ status = AE_NOT_IMPLEMENTED; break; @@ -518,24 +249,13 @@ acpi_aml_store_object_to_node ( default: /* - * All other types than Alias and the various Fields come here. - * Store Val_desc as the new value of the Name, and set - * the Name's type to that of the value being stored in it. - * Val_desc reference count is incremented by Attach_object. + * All other types come here. */ - status = AE_NOT_IMPLEMENTED; break; } -clean_up_and_bail_out: - - /* - * Release global lock if we acquired it earlier - */ - acpi_aml_release_global_lock (locked); - return (status); } diff --git a/drivers/acpi/interpreter/amstorob.c b/drivers/acpi/interpreter/amstorob.c index f3a098bd2..8118f08bd 100644 --- a/drivers/acpi/interpreter/amstorob.c +++ b/drivers/acpi/interpreter/amstorob.c @@ -2,12 +2,12 @@ /****************************************************************************** * * Module Name: amstorob - AML Interpreter object store support, store to object - * $Revision: 18 $ + * $Revision: 22 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,281 +40,383 @@ /******************************************************************************* * - * FUNCTION: Acpi_aml_store_object_to_object + * FUNCTION: Acpi_aml_copy_buffer_to_buffer * - * PARAMETERS: *Val_desc - Value to be stored - * *Dest_desc - Object to receive the value + * PARAMETERS: Source_desc - Source object to copy + * Target_desc - Destination object of the copy * * RETURN: Status * - * DESCRIPTION: Store an object to another object. + * DESCRIPTION: Copy a buffer object to another buffer object. * - * The Assignment of an object to another (not named) object - * is handled here. - * The val passed in will replace the current value (if any) - * with the input value. + ******************************************************************************/ + +ACPI_STATUS +acpi_aml_copy_buffer_to_buffer ( + ACPI_OPERAND_OBJECT *source_desc, + ACPI_OPERAND_OBJECT *target_desc) +{ + u32 length; + u8 *buffer; + + /* + * We know that Source_desc is a buffer by now + */ + buffer = (u8 *) source_desc->buffer.pointer; + length = source_desc->buffer.length; + + /* + * Buffer is a static allocation, + * only place what will fit in the buffer. + */ + if (length <= target_desc->buffer.length) { + /* Clear existing buffer and copy in the new one */ + + MEMSET(target_desc->buffer.pointer, 0, target_desc->buffer.length); + MEMCPY(target_desc->buffer.pointer, buffer, length); + } + + else { + /* + * Truncate the source, copy only what will fit + */ + MEMCPY(target_desc->buffer.pointer, buffer, target_desc->buffer.length); + + } + + return (AE_OK); +} + + +/******************************************************************************* * - * When storing into an object the data is converted to the - * target object type then stored in the object. This means - * that the target object type (for an initialized target) will - * not be changed by a store operation. + * FUNCTION: Acpi_aml_copy_string_to_string + * + * PARAMETERS: Source_desc - Source object to copy + * Target_desc - Destination object of the copy + * + * RETURN: Status * - * This module allows destination types of Number, String, - * and Buffer. + * DESCRIPTION: Copy a String object to another String object * ******************************************************************************/ ACPI_STATUS -acpi_aml_store_object_to_object ( - ACPI_OPERAND_OBJECT *val_desc, - ACPI_OPERAND_OBJECT *dest_desc, - ACPI_WALK_STATE *walk_state) +acpi_aml_copy_string_to_string ( + ACPI_OPERAND_OBJECT *source_desc, + ACPI_OPERAND_OBJECT *target_desc) { - ACPI_STATUS status = AE_OK; - u8 *buffer = NULL; - u32 length = 0; - OBJECT_TYPE_INTERNAL destination_type = dest_desc->common.type; + u32 length; + u8 *buffer; /* - * Assuming the parameters are valid!!! + * We know that Source_desc is a string by now. */ - ACPI_ASSERT((dest_desc) && (val_desc)); + buffer = (u8 *) source_desc->string.pointer; + length = source_desc->string.length; /* - * First ensure we have a value that can be stored in the target + * Setting a string value replaces the old string */ - switch (destination_type) - { - /* Type of Name's existing value */ + if (length < target_desc->string.length) { + /* Clear old string and copy in the new one */ - case ACPI_TYPE_NUMBER: + MEMSET(target_desc->string.pointer, 0, target_desc->string.length); + MEMCPY(target_desc->string.pointer, buffer, length); + } + else { /* - * These cases all require only number values or values that - * can be converted to numbers. - * - * If value is not a Number, try to resolve it to one. + * Free the current buffer, then allocate a buffer + * large enough to hold the value */ - - if (val_desc->common.type != ACPI_TYPE_NUMBER) { + if (target_desc->string.pointer && + !acpi_tb_system_table_pointer (target_desc->string.pointer)) + { /* - * Initially not a number, convert + * Only free if not a pointer into the DSDT */ - status = acpi_aml_resolve_to_value (&val_desc, walk_state); - if (ACPI_SUCCESS (status) && - (val_desc->common.type != ACPI_TYPE_NUMBER)) - { - /* - * Conversion successful but still not a number - */ - status = AE_AML_OPERAND_TYPE; - } + acpi_cm_free(target_desc->string.pointer); } - break; + target_desc->string.pointer = acpi_cm_allocate (length + 1); + target_desc->string.length = length; - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: + if (!target_desc->string.pointer) { + return (AE_NO_MEMORY); + } - /* - * Storing into a Field in a region or into a buffer or into - * a string all is essentially the same. - * - * If value is not a valid type, try to resolve it to one. - */ + MEMCPY(target_desc->string.pointer, buffer, length); + } - if ((val_desc->common.type != ACPI_TYPE_NUMBER) && - (val_desc->common.type != ACPI_TYPE_BUFFER) && - (val_desc->common.type != ACPI_TYPE_STRING)) - { - /* - * Initially not a valid type, convert - */ - status = acpi_aml_resolve_to_value (&val_desc, walk_state); - if (ACPI_SUCCESS (status) && - (val_desc->common.type != ACPI_TYPE_NUMBER) && - (val_desc->common.type != ACPI_TYPE_BUFFER) && - (val_desc->common.type != ACPI_TYPE_STRING)) - { - /* - * Conversion successful but still not a valid type - */ - status = AE_AML_OPERAND_TYPE; - } - } - break; + return (AE_OK); +} - default: +/******************************************************************************* + * + * FUNCTION: Acpi_aml_copy_integer_to_index_field + * + * PARAMETERS: Source_desc - Source object to copy + * Target_desc - Destination object of the copy + * + * RETURN: Status + * + * DESCRIPTION: Write an Integer to an Index Field + * + ******************************************************************************/ - /* - * TBD: [Unhandled] What other combinations must be implemented? - */ - status = AE_NOT_IMPLEMENTED; - break; - } +ACPI_STATUS +acpi_aml_copy_integer_to_index_field ( + ACPI_OPERAND_OBJECT *source_desc, + ACPI_OPERAND_OBJECT *target_desc) +{ + ACPI_STATUS status; + u8 locked; + + + /* + * Get the global lock if needed + */ + locked = acpi_aml_acquire_global_lock (target_desc->index_field.lock_rule); - /* Exit now if failure above */ + /* + * Set Index value to select proper Data register + * perform the update (Set index) + */ + status = acpi_aml_access_named_field (ACPI_WRITE, + target_desc->index_field.index, + &target_desc->index_field.value, + sizeof (target_desc->index_field.value)); + if (ACPI_SUCCESS (status)) { + /* Set_index was successful, next set Data value */ + + status = acpi_aml_access_named_field (ACPI_WRITE, + target_desc->index_field.data, + &source_desc->integer.value, + sizeof (source_desc->integer.value)); - if (ACPI_FAILURE (status)) { - goto clean_up_and_bail_out; } + + /* - * Acpi_everything is ready to execute now, We have - * a value we can handle, just perform the update + * Release global lock if we acquired it earlier */ + acpi_aml_release_global_lock (locked); - switch (destination_type) - { + return (status); +} - case ACPI_TYPE_STRING: - /* - * Perform the update - */ +/******************************************************************************* + * + * FUNCTION: Acpi_aml_copy_integer_to_bank_field + * + * PARAMETERS: Source_desc - Source object to copy + * Target_desc - Destination object of the copy + * + * RETURN: Status + * + * DESCRIPTION: Write an Integer to a Bank Field + * + ******************************************************************************/ - switch (val_desc->common.type) - { - case ACPI_TYPE_NUMBER: - buffer = (u8 *) &val_desc->number.value; - length = sizeof (val_desc->number.value); - break; - - case ACPI_TYPE_BUFFER: - buffer = (u8 *) val_desc->buffer.pointer; - length = val_desc->buffer.length; - break; - - case ACPI_TYPE_STRING: - buffer = (u8 *) val_desc->string.pointer; - length = val_desc->string.length; - break; - } +ACPI_STATUS +acpi_aml_copy_integer_to_bank_field ( + ACPI_OPERAND_OBJECT *source_desc, + ACPI_OPERAND_OBJECT *target_desc) +{ + ACPI_STATUS status; + u8 locked; - /* - * Setting a string value replaces the old string - */ - if (length < dest_desc->string.length) { - /* - * Zero fill, not willing to do pointer arithmetic for - * architecture independence. Just clear the whole thing - */ - MEMSET(dest_desc->string.pointer, 0, dest_desc->string.length); - MEMCPY(dest_desc->string.pointer, buffer, length); - } - else { - /* - * Free the current buffer, then allocate a buffer - * large enough to hold the value - */ - if ( dest_desc->string.pointer && - !acpi_tb_system_table_pointer (dest_desc->string.pointer)) - { - /* - * Only free if not a pointer into the DSDT - */ + /* + * Get the global lock if needed + */ + locked = acpi_aml_acquire_global_lock (target_desc->index_field.lock_rule); - acpi_cm_free(dest_desc->string.pointer); - } - dest_desc->string.pointer = acpi_cm_allocate (length + 1); - dest_desc->string.length = length; + /* + * Set Bank value to select proper Bank + * Perform the update (Set Bank Select) + */ - if (!dest_desc->string.pointer) { - status = AE_NO_MEMORY; - goto clean_up_and_bail_out; - } + status = acpi_aml_access_named_field (ACPI_WRITE, + target_desc->bank_field.bank_select, + &target_desc->bank_field.value, + sizeof (target_desc->bank_field.value)); + if (ACPI_SUCCESS (status)) { + /* Set bank select successful, set data value */ + + status = acpi_aml_access_named_field (ACPI_WRITE, + target_desc->bank_field.bank_select, + &source_desc->bank_field.value, + sizeof (source_desc->bank_field.value)); + } - MEMCPY(dest_desc->string.pointer, buffer, length); - } - break; - case ACPI_TYPE_BUFFER: + /* + * Release global lock if we acquired it earlier + */ + acpi_aml_release_global_lock (locked); - /* - * Perform the update to the buffer - */ + return (status); +} - switch (val_desc->common.type) - { - case ACPI_TYPE_NUMBER: - buffer = (u8 *) &val_desc->number.value; - length = sizeof (val_desc->number.value); - break; - - case ACPI_TYPE_BUFFER: - buffer = (u8 *) val_desc->buffer.pointer; - length = val_desc->buffer.length; - break; - - case ACPI_TYPE_STRING: - buffer = (u8 *) val_desc->string.pointer; - length = val_desc->string.length; - break; - } - /* - * If the buffer is uninitialized, - * memory needs to be allocated for the copy. - */ - if(0 == dest_desc->buffer.length) { - dest_desc->buffer.pointer = acpi_cm_callocate(length); - dest_desc->buffer.length = length; - - if (!dest_desc->buffer.pointer) { - status = AE_NO_MEMORY; - goto clean_up_and_bail_out; - } - } +/******************************************************************************* + * + * FUNCTION: Acpi_aml_copy_data_to_named_field + * + * PARAMETERS: Source_desc - Source object to copy + * Node - Destination Namespace node + * + * RETURN: Status + * + * DESCRIPTION: Copy raw data to a Named Field. No implicit conversion + * is performed on the source object + * + ******************************************************************************/ - /* - * Buffer is a static allocation, - * only place what will fit in the buffer. - */ - if (length <= dest_desc->buffer.length) { - /* - * Zero fill first, not willing to do pointer arithmetic for - * architecture independence. Just clear the whole thing - */ - MEMSET(dest_desc->buffer.pointer, 0, dest_desc->buffer.length); - MEMCPY(dest_desc->buffer.pointer, buffer, length); - } - else { - /* - * truncate, copy only what will fit - */ - MEMCPY(dest_desc->buffer.pointer, buffer, dest_desc->buffer.length); - } - break; +ACPI_STATUS +acpi_aml_copy_data_to_named_field ( + ACPI_OPERAND_OBJECT *source_desc, + ACPI_NAMESPACE_NODE *node) +{ + ACPI_STATUS status; + u8 locked; + u32 length; + u8 *buffer; - case ACPI_TYPE_NUMBER: - dest_desc->number.value = val_desc->number.value; + /* + * Named fields (Create_xxx_field) - We don't perform any conversions on the + * source operand, just use the raw data + */ + switch (source_desc->common.type) + { + case ACPI_TYPE_INTEGER: + buffer = (u8 *) &source_desc->integer.value; + length = sizeof (source_desc->integer.value); + break; - /* Truncate value if we are executing from a 32-bit ACPI table */ + case ACPI_TYPE_BUFFER: + buffer = (u8 *) source_desc->buffer.pointer; + length = source_desc->buffer.length; + break; - acpi_aml_truncate_for32bit_table (dest_desc, walk_state); + case ACPI_TYPE_STRING: + buffer = (u8 *) source_desc->string.pointer; + length = source_desc->string.length; break; default: + return (AE_TYPE); + } - /* - * All other types than Alias and the various Fields come here. - * Store Val_desc as the new value of the Name, and set - * the Name's type to that of the value being stored in it. - * Val_desc reference count is incremented by Attach_object. - */ + /* + * Get the global lock if needed before the update + * TBD: not needed! + */ + locked = acpi_aml_acquire_global_lock (source_desc->field.lock_rule); - status = AE_NOT_IMPLEMENTED; - break; - } + status = acpi_aml_access_named_field (ACPI_WRITE, + node, buffer, length); -clean_up_and_bail_out: + acpi_aml_release_global_lock (locked); return (status); } + +/******************************************************************************* + * + * FUNCTION: Acpi_aml_copy_integer_to_field_unit + * + * PARAMETERS: Source_desc - Source object to copy + * Target_desc - Destination object of the copy + * + * RETURN: Status + * + * DESCRIPTION: Write an Integer to a Field Unit. + * + ******************************************************************************/ + +ACPI_STATUS +acpi_aml_copy_integer_to_field_unit ( + ACPI_OPERAND_OBJECT *source_desc, + ACPI_OPERAND_OBJECT *target_desc) +{ + ACPI_STATUS status = AE_OK; + u8 *location = NULL; + u32 mask; + u32 new_value; + u8 locked = FALSE; + + + /* + * If the Field Buffer and Index have not been previously evaluated, + * evaluate them and save the results. + */ + if (!(target_desc->common.flags & AOPOBJ_DATA_VALID)) { + status = acpi_ds_get_field_unit_arguments (target_desc); + if (ACPI_FAILURE (status)) { + return (status); + } + } + + if ((!target_desc->field_unit.container || + ACPI_TYPE_BUFFER != target_desc->field_unit.container->common.type)) + { + return (AE_AML_INTERNAL); + } + + /* + * Get the global lock if needed + */ + locked = acpi_aml_acquire_global_lock (target_desc->field_unit.lock_rule); + + /* + * TBD: [Unhandled] REMOVE this limitation + * Make sure the operation is within the limits of our implementation + * this is not a Spec limitation!! + */ + if (target_desc->field_unit.length + target_desc->field_unit.bit_offset > 32) { + return (AE_NOT_IMPLEMENTED); + } + + /* Field location is (base of buffer) + (byte offset) */ + + location = target_desc->field_unit.container->buffer.pointer + + target_desc->field_unit.offset; + + /* + * Construct Mask with 1 bits where the field is, + * 0 bits elsewhere + */ + mask = ((u32) 1 << target_desc->field_unit.length) - ((u32)1 + << target_desc->field_unit.bit_offset); + + /* Zero out the field in the buffer */ + + MOVE_UNALIGNED32_TO_32 (&new_value, location); + new_value &= ~mask; + + /* + * Shift and mask the new value into position, + * and or it into the buffer. + */ + new_value |= (source_desc->integer.value << target_desc->field_unit.bit_offset) & + mask; + + /* Store back the value */ + + MOVE_UNALIGNED32_TO_32 (location, &new_value); + + return (AE_OK); +} + + diff --git a/drivers/acpi/interpreter/amsystem.c b/drivers/acpi/interpreter/amsystem.c index 9ad72c161..5e60538af 100644 --- a/drivers/acpi/interpreter/amsystem.c +++ b/drivers/acpi/interpreter/amsystem.c @@ -2,12 +2,12 @@ /****************************************************************************** * * Module Name: amsystem - Interface to OS services - * $Revision: 52 $ + * $Revision: 54 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -202,7 +202,7 @@ acpi_aml_system_acquire_mutex ( } status = acpi_aml_system_wait_semaphore (obj_desc->mutex.semaphore, - (u32) time_desc->number.value); + (u32) time_desc->integer.value); return (status); } @@ -299,7 +299,7 @@ acpi_aml_system_wait_event ( if (obj_desc) { status = acpi_aml_system_wait_semaphore (obj_desc->event.semaphore, - (u32) time_desc->number.value); + (u32) time_desc->integer.value); } diff --git a/drivers/acpi/interpreter/amutils.c b/drivers/acpi/interpreter/amutils.c index 4e1359888..e3456099c 100644 --- a/drivers/acpi/interpreter/amutils.c +++ b/drivers/acpi/interpreter/amutils.c @@ -2,12 +2,12 @@ /****************************************************************************** * * Module Name: amutils - interpreter/scanner utilities - * $Revision: 66 $ + * $Revision: 68 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,14 +46,11 @@ typedef struct internal_search_st /* Used to traverse nested packages when copying*/ +/* TBD: This must be removed! */ INTERNAL_PKG_SEARCH_INFO copy_level[MAX_PACKAGE_DEPTH]; -static NATIVE_CHAR hex[] = - {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; - - /******************************************************************************* * * FUNCTION: Acpi_aml_enter_interpreter @@ -156,7 +153,7 @@ acpi_aml_truncate_for32bit_table ( */ if ((!obj_desc) || - (obj_desc->common.type != ACPI_TYPE_NUMBER) || + (obj_desc->common.type != ACPI_TYPE_INTEGER) || (!walk_state->method_node)) { return; @@ -167,7 +164,7 @@ acpi_aml_truncate_for32bit_table ( * We are running a method that exists in a 32-bit ACPI table. * Truncate the value to 32 bits by zeroing out the upper 32-bit field */ - obj_desc->number.value &= (ACPI_INTEGER) ACPI_UINT32_MAX; + obj_desc->integer.value &= (ACPI_INTEGER) ACPI_UINT32_MAX; } } @@ -343,10 +340,10 @@ acpi_aml_eisa_id_to_string ( out_string[0] = (char) ('@' + ((id >> 26) & 0x1f)); out_string[1] = (char) ('@' + ((id >> 21) & 0x1f)); out_string[2] = (char) ('@' + ((id >> 16) & 0x1f)); - out_string[3] = hex[(id >> 12) & 0xf]; - out_string[4] = hex[(id >> 8) & 0xf]; - out_string[5] = hex[(id >> 4) & 0xf]; - out_string[6] = hex[id & 0xf]; + out_string[3] = acpi_gbl_hex_to_ascii[(id >> 12) & 0xf]; + out_string[4] = acpi_gbl_hex_to_ascii[(id >> 8) & 0xf]; + out_string[5] = acpi_gbl_hex_to_ascii[(id >> 4) & 0xf]; + out_string[6] = acpi_gbl_hex_to_ascii[id & 0xf]; out_string[7] = 0; return (AE_OK); diff --git a/drivers/acpi/interpreter/amxface.c b/drivers/acpi/interpreter/amxface.c index fd589d39b..20cf9820e 100644 --- a/drivers/acpi/interpreter/amxface.c +++ b/drivers/acpi/interpreter/amxface.c @@ -2,12 +2,12 @@ /****************************************************************************** * * Module Name: amxface - External interpreter interfaces - * $Revision: 22 $ + * $Revision: 24 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 27c02e22a..c2e6a71e0 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -1,12 +1,12 @@ /******************************************************************************* * * Module Name: nsaccess - Top-level functions for accessing ACPI namespace - * $Revision: 117 $ + * $Revision: 119 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -117,9 +117,9 @@ acpi_ns_root_initialize (void) switch (init_val->type) { - case ACPI_TYPE_NUMBER: + case ACPI_TYPE_INTEGER: - obj_desc->number.value = + obj_desc->integer.value = (ACPI_INTEGER) STRTOUL (init_val->val, NULL, 10); break; @@ -239,7 +239,7 @@ acpi_ns_lookup ( ACPI_NAMESPACE_NODE **return_node) { ACPI_STATUS status; - ACPI_NAMESPACE_NODE *prefix_node; + ACPI_NAMESPACE_NODE *prefix_node; ACPI_NAMESPACE_NODE *current_node = NULL; ACPI_NAMESPACE_NODE *scope_to_push = NULL; ACPI_NAMESPACE_NODE *this_node = NULL; @@ -248,8 +248,7 @@ acpi_ns_lookup ( u8 null_name_path = FALSE; OBJECT_TYPE_INTERNAL type_to_check_for; OBJECT_TYPE_INTERNAL this_search_type; - - DEBUG_ONLY_MEMBERS (u32 i) + u32 local_flags = flags & ~NS_ERROR_IF_FOUND; if (!return_node) { @@ -437,6 +436,7 @@ acpi_ns_lookup ( this_search_type = ACPI_TYPE_ANY; if (!num_segments) { this_search_type = type; + local_flags = flags; } /* Pluck one ACPI name from the front of the pathname */ @@ -447,7 +447,7 @@ acpi_ns_lookup ( status = acpi_ns_search_and_enter (simple_name, walk_state, current_node, interpreter_mode, - this_search_type, flags, + this_search_type, local_flags, &this_node); if (ACPI_FAILURE (status)) { diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index 9f1d5377e..5cac5d111 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c @@ -1,12 +1,12 @@ /******************************************************************************* * * Module Name: nsalloc - Namespace allocation and deletion utilities - * $Revision: 43 $ + * $Revision: 45 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index fbba7840c..6c040d22e 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c @@ -2,12 +2,12 @@ * * Module Name: nseval - Object evaluation interfaces -- includes control * method lookup and execution. - * $Revision: 79 $ + * $Revision: 81 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index ddacd7b8c..76b535205 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: nsinit - namespace initialization - * $Revision: 9 $ + * $Revision: 12 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -239,7 +239,9 @@ acpi_ns_init_one_device ( status = acpi_cm_execute_STA (node, &flags); if (ACPI_FAILURE (status)) { - return (status); + /* Ignore error and move on to next device */ + + return (AE_OK); } info->num_STA++; @@ -260,12 +262,15 @@ acpi_ns_init_one_device ( } else if (ACPI_FAILURE (status)) { - return (status); + /* Ignore error and move on to next device */ + } else { + /* Count of successfull INIs */ + info->num_INI++; } - return (status); + return (AE_OK); } diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index 28a26376d..f0eaf273b 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: nsload - namespace loading/expanding/contracting procedures - * $Revision: 33 $ + * $Revision: 35 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index faf8fe56a..c2fb49163 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c @@ -1,12 +1,12 @@ /******************************************************************************* * * Module Name: nsnames - Name manipulation and search - * $Revision: 51 $ + * $Revision: 53 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c index 6d41b91ce..493cb1317 100644 --- a/drivers/acpi/namespace/nsobject.c +++ b/drivers/acpi/namespace/nsobject.c @@ -2,12 +2,12 @@ * * Module Name: nsobject - Utilities for objects attached to namespace * table entries - * $Revision: 47 $ + * $Revision: 49 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -205,7 +205,7 @@ acpi_ns_attach_object ( case AML_ZERO_OP: case AML_ONES_OP: case AML_ONE_OP: case AML_BYTE_OP: case AML_WORD_OP: case AML_DWORD_OP: - obj_type = ACPI_TYPE_NUMBER; + obj_type = ACPI_TYPE_INTEGER; break; diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index 001f57d9d..7a29e7542 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c @@ -1,12 +1,12 @@ /******************************************************************************* * * Module Name: nssearch - Namespace search - * $Revision: 62 $ + * $Revision: 64 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -70,8 +70,6 @@ acpi_ns_search_node ( ACPI_NAMESPACE_NODE *next_node; - - /* * Search for name in this table, which is to say that we must search * for the name among the children of this object diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index 593064dbb..11457b33f 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c @@ -2,12 +2,12 @@ * * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing * parents and siblings and Scope manipulation - * $Revision: 74 $ + * $Revision: 77 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c index 3682266b3..cf84be326 100644 --- a/drivers/acpi/namespace/nswalk.c +++ b/drivers/acpi/namespace/nswalk.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: nswalk - Functions for walking the APCI namespace - * $Revision: 17 $ + * $Revision: 19 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c index 2947f7f06..957481a6d 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/namespace/nsxfname.c @@ -2,12 +2,12 @@ * * Module Name: nsxfname - Public interfaces to the ACPI subsystem * ACPI Namespace oriented interfaces - * $Revision: 73 $ + * $Revision: 75 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c index d4432ee8a..742c5da66 100644 --- a/drivers/acpi/namespace/nsxfobj.c +++ b/drivers/acpi/namespace/nsxfobj.c @@ -2,12 +2,12 @@ * * Module Name: nsxfobj - Public interfaces to the ACPI subsystem * ACPI Object oriented interfaces - * $Revision: 75 $ + * $Revision: 78 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -695,4 +695,3 @@ acpi_get_devices ( return (status); } - diff --git a/drivers/acpi/os.c b/drivers/acpi/os.c index 7bf86171b..172b6659b 100644 --- a/drivers/acpi/os.c +++ b/drivers/acpi/os.c @@ -24,8 +24,8 @@ #include <linux/mm.h> #include <linux/pci.h> #include <linux/acpi.h> +#include <linux/delay.h> #include <asm/io.h> -#include <asm/delay.h> #include "acpi.h" #include "driver.h" diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index 35d623668..da3ef9b30 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: psargs - Parse AML opcode arguments - * $Revision: 42 $ + * $Revision: 43 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index a7f061363..90a73f45b 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: psopcode - Parser opcode information table - * $Revision: 24 $ + * $Revision: 27 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #define _PFX 0x6D #define _UNKNOWN_OPCODE 0x02 /* An example unknown opcode */ -#define MAX_EXTENDED_OPCODE 0x87 +#define MAX_EXTENDED_OPCODE 0x88 #define NUM_EXTENDED_OPCODE MAX_EXTENDED_OPCODE + 1 #define MAX_INTERNAL_OPCODE #define NUM_INTERNAL_OPCODE MAX_INTERNAL_OPCODE + 1 @@ -83,9 +83,11 @@ #define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA) #define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA) #define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST) +#define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA) #define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST) #define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST) #define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST) +#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST) #define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST) #define ARGP_LOCAL0 ARG_NONE #define ARGP_LOCAL1 ARG_NONE @@ -122,6 +124,8 @@ #define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) #define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) #define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG) +#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) +#define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) #define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) #define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME) #define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) @@ -131,12 +135,21 @@ #define ARGP_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) #define ARGP_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) #define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME) +#define ARGP_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) #define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) #define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) #define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG) #define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) #define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) #define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) +#define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) +#define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) +#define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) +#define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) +#define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) +#define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME) +#define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) +#define ARGP_CONTINUE_OP ARG_NONE #define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) #define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST) #define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) @@ -149,6 +162,7 @@ #define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME) #define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) #define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) +#define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG) #define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME) #define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG) #define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG) @@ -171,6 +185,7 @@ #define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) #define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST) #define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST) +#define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAMESTRING, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG) #define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) #define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) #define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) @@ -187,7 +202,7 @@ * All AML opcodes and the runtime arguments for each. Used by the AML interpreter Each list is compressed * into a 32-bit number and stored in the master opcode table at the end of this file. * - * (Used by Acpi_aml_prep_operands procedure) + * (Used by Acpi_aml_prep_operands procedure and the ASL Compiler) */ #define ARGI_ZERO_OP ARG_NONE @@ -198,9 +213,11 @@ #define ARGI_WORD_OP ARGI_INVALID_OPCODE #define ARGI_DWORD_OP ARGI_INVALID_OPCODE #define ARGI_STRING_OP ARGI_INVALID_OPCODE +#define ARGI_QWORD_OP ARGI_INVALID_OPCODE #define ARGI_SCOPE_OP ARGI_INVALID_OPCODE #define ARGI_BUFFER_OP ARGI_INVALID_OPCODE #define ARGI_PACKAGE_OP ARGI_INVALID_OPCODE +#define ARGI_VAR_PACKAGE_OP ARGI_INVALID_OPCODE #define ARGI_METHOD_OP ARGI_INVALID_OPCODE #define ARGI_LOCAL0 ARG_NONE #define ARGI_LOCAL1 ARG_NONE @@ -218,40 +235,51 @@ #define ARGI_ARG5 ARG_NONE #define ARGI_ARG6 ARG_NONE #define ARGI_STORE_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_TARGETREF) -#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_REFERENCE) -#define ARGI_ADD_OP ARGI_LIST3 (ARGI_NUMBER, ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_TARGETREF) -#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_NUMBER, ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_REFERENCE) -#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_REFERENCE) -#define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_NUMBER, ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_NUMBER, ARGI_NUMBER, ARGI_TARGETREF, ARGI_TARGETREF) -#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_NUMBER, ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_NUMBER, ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_NUMBER, ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_NUMBER, ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_NUMBER, ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_NUMBER, ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_NUMBER, ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_NUMBER, ARGI_TARGETREF) +#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF) +#define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF) +#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) +#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) +#define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF) +#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REFERENCE) -#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_REFERENCE, ARGI_NUMBER) +#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF) +#define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER) #define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT) -#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_NUMBER, ARGI_NUMBER, ARGI_NUMBER, ARGI_NUMBER, ARGI_NUMBER) -#define ARGI_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_NUMBER, ARGI_REFERENCE) -#define ARGI_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_NUMBER, ARGI_REFERENCE) -#define ARGI_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_NUMBER, ARGI_REFERENCE) -#define ARGI_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_NUMBER, ARGI_REFERENCE) +#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) #define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE) -#define ARGI_LAND_OP ARGI_LIST2 (ARGI_NUMBER, ARGI_NUMBER) -#define ARGI_LOR_OP ARGI_LIST2 (ARGI_NUMBER, ARGI_NUMBER) -#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_NUMBER) -#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_NUMBER, ARGI_NUMBER) -#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_NUMBER, ARGI_NUMBER) -#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_NUMBER, ARGI_NUMBER) +#define ARGI_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER) +#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) +#define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) +#define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) +#define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) +#define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET) +#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET) +#define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFERSTRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE #define ARGI_IF_OP ARGI_INVALID_OPCODE #define ARGI_ELSE_OP ARGI_INVALID_OPCODE #define ARGI_WHILE_OP ARGI_INVALID_OPCODE @@ -262,23 +290,24 @@ #define ARGI_ONES_OP ARG_NONE #define ARGI_MUTEX_OP ARGI_INVALID_OPCODE #define ARGI_EVENT_OP ARGI_INVALID_OPCODE -#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_REFERENCE, ARGI_TARGETREF) -#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_NUMBER, ARGI_NUMBER, ARGI_REFERENCE) +#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF) +#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_TARGETREF) #define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION, ARGI_TARGETREF) -#define ARGI_STALL_OP ARGI_LIST1 (ARGI_NUMBER) -#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_NUMBER) -#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_NUMBER) +#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER) +#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER) +#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER) #define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT) -#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_NUMBER) +#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER) #define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT) #define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX) -#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_NUMBER, ARGI_TARGETREF) +#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) #define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE) #define ARGI_REVISION_OP ARG_NONE #define ARGI_DEBUG_OP ARG_NONE -#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_NUMBER, ARGI_NUMBER, ARGI_NUMBER) -#define ARGI_REGION_OP ARGI_LIST2 (ARGI_NUMBER, ARGI_NUMBER) +#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) #define ARGI_DEF_FIELD_OP ARGI_INVALID_OPCODE #define ARGI_DEVICE_OP ARGI_INVALID_OPCODE #define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE @@ -286,6 +315,7 @@ #define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE #define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE #define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE +#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING) #define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE #define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE #define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE @@ -307,8 +337,8 @@ static ACPI_OPCODE_INFO aml_op_info[] = { /* Index Opcode Type Class Has Arguments? Name Parser Args Interpreter Args */ -/* 00 */ /* AML_ZERO_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Zero_op", ARGP_ZERO_OP, ARGI_ZERO_OP), -/* 01 */ /* AML_ONE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "One_op", ARGP_ONE_OP, ARGI_ONE_OP), +/* 00 */ /* AML_ZERO_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Zero", ARGP_ZERO_OP, ARGI_ZERO_OP), +/* 01 */ /* AML_ONE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "One", ARGP_ONE_OP, ARGI_ONE_OP), /* 02 */ /* AML_ALIAS_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP), /* 03 */ /* AML_NAME_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Name", ARGP_NAME_OP, ARGI_NAME_OP), /* 04 */ /* AML_BYTE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "Byte_const", ARGP_BYTE_OP, ARGI_BYTE_OP), @@ -337,7 +367,7 @@ static ACPI_OPCODE_INFO aml_op_info[] = /* 1_b */ /* AML_STORE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "Store", ARGP_STORE_OP, ARGI_STORE_OP), /* 1_c */ /* AML_REF_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Ref_of", ARGP_REF_OF_OP, ARGI_REF_OF_OP), /* 1_d */ /* AML_ADD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Add", ARGP_ADD_OP, ARGI_ADD_OP), -/* 1_e */ /* AML_CONCAT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Concat", ARGP_CONCAT_OP, ARGI_CONCAT_OP), +/* 1_e */ /* AML_CONCAT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP), /* 1_f */ /* AML_SUBTRACT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP), /* 20 */ /* AML_INCREMENT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP), /* 21 */ /* AML_DECREMENT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP), @@ -376,7 +406,7 @@ static ACPI_OPCODE_INFO aml_op_info[] = /* 42 */ /* AML_RETURN_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "Return", ARGP_RETURN_OP, ARGI_RETURN_OP), /* 43 */ /* AML_BREAK_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Break", ARGP_BREAK_OP, ARGI_BREAK_OP), /* 44 */ /* AML_BREAK_POINT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Break_point", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP), -/* 45 */ /* AML_ONES_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Ones_op", ARGP_ONES_OP, ARGI_ONES_OP), +/* 45 */ /* AML_ONES_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Ones", ARGP_ONES_OP, ARGI_ONES_OP), /* Prefixed opcodes (Two-byte opcodes with a prefix op) */ @@ -402,7 +432,7 @@ static ACPI_OPCODE_INFO aml_op_info[] = /* 59 */ /* AML_DEF_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Field", ARGP_DEF_FIELD_OP, ARGI_DEF_FIELD_OP), /* 5_a */ /* AML_DEVICE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP), /* 5_b */ /* AML_PROCESSOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP), -/* 5_c */ /* AML_POWER_RES_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Power_res", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP), +/* 5_c */ /* AML_POWER_RES_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Power_resource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP), /* 5_d */ /* AML_THERMAL_ZONE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Thermal_zone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP), /* 5_e */ /* AML_INDEX_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Index_field", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP), /* 5_f */ /* AML_BANK_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Bank_field", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP), @@ -423,6 +453,26 @@ static ACPI_OPCODE_INFO aml_op_info[] = /* 6_b */ /* UNKNOWN OPCODES */ OP_INFO_ENTRY (ACPI_OP_TYPE_UNKNOWN | OPTYPE_BOGUS| AML_HAS_ARGS, "UNKNOWN_OP!", ARG_NONE, ARG_NONE), /* 6_c */ /* ASCII CHARACTERS */ OP_INFO_ENTRY (ACPI_OP_TYPE_ASCII | OPTYPE_BOGUS| AML_HAS_ARGS, "ASCII_ONLY!", ARG_NONE, ARG_NONE), /* 6_d */ /* PREFIX CHARACTERS */ OP_INFO_ENTRY (ACPI_OP_TYPE_PREFIX | OPTYPE_BOGUS| AML_HAS_ARGS, "PREFIX_ONLY!", ARG_NONE, ARG_NONE), + + +/* ACPI 2.0 (new) opcodes */ + +/* 6_e */ /* AML_QWORD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "Qword_const", ARGP_QWORD_OP, ARGI_QWORD_OP), +/* 6_f */ /* AML_VAR_PACKAGE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM| AML_HAS_ARGS, "Var_package", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP), +/* 70 */ /* AML_CONCAT_RES_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Concat_res", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP), +/* 71 */ /* AML_MOD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Mod", ARGP_MOD_OP, ARGI_MOD_OP), +/* 72 */ /* AML_QWORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "Create_qWord_field", ARGP_QWORD_FIELD_OP, ARGI_QWORD_FIELD_OP), +/* 73 */ /* AML_TO_BUFFER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "To_buffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP), +/* 74 */ /* AML_TO_DEC_STR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "To_dec_string", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP), +/* 75 */ /* AML_TO_HEX_STR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "To_hex_string", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP), +/* 76 */ /* AML_TO_INTEGER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "To_integer", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP), +/* 77 */ /* AML_TO_STRING_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "To_string", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP), +/* 78 */ /* AML_COPY_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "Copy", ARGP_COPY_OP, ARGI_COPY_OP), +/* 79 */ /* AML_MID_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "Mid", ARGP_MID_OP, ARGI_MID_OP), +/* 7_a */ /* AML_CONTINUE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP), +/* 7_b */ /* AML_LOAD_TABLE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "Load_table", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP), +/* 7_c */ /* AML_DATA_REGION_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "Data_op_region", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP), + }; /* @@ -433,9 +483,10 @@ static ACPI_OPCODE_INFO aml_op_info[] = static u8 aml_short_op_info_index[256] = { /* 0 1 2 3 4 5 6 7 */ +/* 8 9 A B C D E F */ /* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK, -/* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, _UNK, _UNK, -/* 0x10 */ 0x08, 0x09, 0x0a, _UNK, 0x0b, _UNK, _UNK, _UNK, +/* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK, +/* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK, /* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX, @@ -449,10 +500,10 @@ static u8 aml_short_op_info_index[256] = /* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK, /* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, /* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, -/* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, _UNK, _UNK, 0x2f, 0x30, -/* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, _UNK, -/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, _UNK, _UNK, -/* 0x98 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30, +/* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72, +/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74, +/* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A, /* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61, /* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, @@ -471,10 +522,11 @@ static u8 aml_short_op_info_index[256] = static u8 aml_long_op_info_index[NUM_EXTENDED_OPCODE] = { /* 0 1 2 3 4 5 6 7 */ +/* 8 9 A B C D E F */ /* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK, -/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B, /* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, /* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x30 */ 0x55, 0x56, 0x57, _UNK, _UNK, _UNK, _UNK, _UNK, @@ -488,13 +540,10 @@ static u8 aml_long_op_info_index[NUM_EXTENDED_OPCODE] = /* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, +/* 0x88 */ 0x7C, }; -/* 0 1 2 3 4 5 6 7 */ -/* 0x00 */ - - /******************************************************************************* * * FUNCTION: Acpi_ps_get_opcode_info diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 7471efdcb..7373013da 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: psparse - Parser top level AML parse routines - * $Revision: 71 $ + * $Revision: 74 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -537,6 +537,12 @@ acpi_ps_parse_loop ( */ status = acpi_ds_get_predicate_value (walk_state, NULL, TRUE); + if (ACPI_FAILURE (status) && + ((status & AE_CODE_MASK) != AE_CODE_CONTROL)) + { + return (status); + } + status = acpi_ps_next_parse_state (walk_state, op, status); } diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c index 2e8926ad1..37b5d2265 100644 --- a/drivers/acpi/parser/psscope.c +++ b/drivers/acpi/parser/psscope.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: psscope - Parser scope stack management routines - * $Revision: 22 $ + * $Revision: 24 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c index a22bb646d..dc2e6d4d7 100644 --- a/drivers/acpi/parser/pstree.c +++ b/drivers/acpi/parser/pstree.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: pstree - Parser op tree manipulation/traversal/search - * $Revision: 25 $ + * $Revision: 27 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index 3bac4a647..94518a920 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: psutils - Parser miscellaneous utilities (Parser only) - * $Revision: 30 $ + * $Revision: 32 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c index 04a75917d..48c11eff3 100644 --- a/drivers/acpi/parser/pswalk.c +++ b/drivers/acpi/parser/pswalk.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: pswalk - Parser routines to walk parsed op tree(s) - * $Revision: 50 $ + * $Revision: 52 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index a33ace051..328c755d9 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: psxface - Parser external interfaces - * $Revision: 37 $ + * $Revision: 40 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -121,6 +121,12 @@ acpi_psx_execute ( return (AE_NO_MEMORY); } + + /* Init new op with the method name and pointer back to the NS node */ + + acpi_ps_set_name (op, method_node->name); + op->node = method_node; + /* * The walk of the parse tree is where we actually execute the method */ diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 0422bf94d..d24392895 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c @@ -81,12 +81,12 @@ proc_read_ac_adapter_status(char *page, char **start, off_t off, buf.length = sizeof(obj); buf.pointer = &obj; if (!ACPI_SUCCESS(acpi_evaluate_object(ac_handle, "_PSR", NULL, &buf)) - || obj.type != ACPI_TYPE_NUMBER) { + || obj.type != ACPI_TYPE_INTEGER) { p += sprintf(p, "Could not read AC status\n"); goto end; } - if (obj.number.value) + if (obj.integer.value) p += sprintf(p, "on-line\n"); else p += sprintf(p, "off-line\n"); diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index e48666113..af91bc59f 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c @@ -4,12 +4,12 @@ * Acpi_rs_address16_stream * Acpi_rs_address32_resource * Acpi_rs_address32_stream - * $Revision: 12 $ + * $Revision: 14 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 2874aa3d0..86ff91be8 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -2,12 +2,12 @@ * * Module Name: rscalc - Acpi_rs_calculate_byte_stream_length * Acpi_rs_calculate_list_length - * $Revision: 16 $ + * $Revision: 18 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index bc95686a7..f221a41dc 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c @@ -3,12 +3,12 @@ * Module Name: rscreate - Acpi_rs_create_resource_list * Acpi_rs_create_pci_routing_table * Acpi_rs_create_byte_stream - * $Revision: 22 $ + * $Revision: 24 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -223,9 +223,9 @@ acpi_rs_create_pci_routing_table ( /* * Dereference the Address */ - if (ACPI_TYPE_NUMBER == (*sub_object_list)->common.type) { + if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) { user_prt->data.address = - (*sub_object_list)->number.value; + (*sub_object_list)->integer.value; } else { @@ -237,9 +237,9 @@ acpi_rs_create_pci_routing_table ( */ sub_object_list++; - if (ACPI_TYPE_NUMBER == (*sub_object_list)->common.type) { + if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) { user_prt->data.pin = - (u32) (*sub_object_list)->number.value; + (u32) (*sub_object_list)->integer.value; } else { @@ -267,7 +267,7 @@ acpi_rs_create_pci_routing_table ( * is NULL, since the entire buffer was zeroed * out, we can leave this alone. */ - if (ACPI_TYPE_NUMBER == (*sub_object_list)->common.type) { + if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) { /* * Add to the Length field the length of * the u32 NULL @@ -289,9 +289,9 @@ acpi_rs_create_pci_routing_table ( */ sub_object_list++; - if (ACPI_TYPE_NUMBER == (*sub_object_list)->common.type) { + if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) { user_prt->data.source_index = - (u32) (*sub_object_list)->number.value; + (u32) (*sub_object_list)->integer.value; } else { diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index 073f4ddd4..03d2da6f2 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -1,12 +1,12 @@ /******************************************************************************* * * Module Name: rsdump - Functions do dump out the resource structures. - * $Revision: 13 $ + * $Revision: 15 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index 0d6c507c0..58fcf8cd8 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c @@ -6,12 +6,12 @@ * Acpi_rs_fixed_io_stream * Acpi_rs_dma_resource * Acpi_rs_dma_stream - * $Revision: 10 $ + * $Revision: 12 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 28a3a5045..eb47669ad 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c @@ -4,12 +4,12 @@ * Acpi_rs_irq_stream * Acpi_rs_extended_irq_resource * Acpi_rs_extended_irq_stream - * $Revision: 11 $ + * $Revision: 13 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index 8e39ddded..de47563d0 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c @@ -2,12 +2,12 @@ * * Module Name: rslist - Acpi_rs_byte_stream_to_list * Acpi_list_to_byte_stream - * $Revision: 8 $ + * $Revision: 10 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index 8aa4914f4..f9437e60c 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c @@ -6,12 +6,12 @@ * Acpi_rs_fixed_memory32_resource * Acpi_rs_memory32_range_stream * Acpi_rs_fixed_memory32_stream - * $Revision: 10 $ + * $Revision: 12 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index 01bbb377e..be0a1a6a0 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c @@ -8,12 +8,12 @@ * Acpi_rs_end_dependent_functions_resource * Acpi_rs_start_dependent_functions_stream * Acpi_rs_end_dependent_functions_stream - * $Revision: 10 $ + * $Revision: 12 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 0a3f76668..2994bf0d3 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c @@ -1,12 +1,12 @@ /******************************************************************************* * * Module Name: rsutils - Utilities for the resource manager - * $Revision: 12 $ + * $Revision: 14 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 8691f8200..5c126aaa5 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c @@ -1,12 +1,12 @@ /******************************************************************************* * * Module Name: rsxface - Public interfaces to the ACPI subsystem - * $Revision: 8 $ + * $Revision: 10 $ * ******************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/sys.c b/drivers/acpi/sys.c index 13648c255..2011174a1 100644 --- a/drivers/acpi/sys.c +++ b/drivers/acpi/sys.c @@ -27,18 +27,13 @@ #define _COMPONENT OS_DEPENDENT MODULE_NAME ("sys") -#define ACPI_SLP_TYP(typa, typb) (((int)(typa) << 8) | (int)(typb)) -#define ACPI_SLP_TYPA(value) ((value) >> 8) -#define ACPI_SLP_TYPB(value) ((value) & 0xff) - struct acpi_enter_sx_ctx { wait_queue_head_t wait; unsigned int state; }; -volatile acpi_sstate_t acpi_sleep_state = ACPI_S0; -static unsigned long acpi_slptyp[ACPI_S5 + 1] = {ACPI_INVALID,}; +volatile acpi_sstate_t acpi_sleep_state = ACPI_STATE_S0; /* * Enter system sleep state @@ -50,56 +45,32 @@ acpi_enter_sx_async(void *context) ACPI_OBJECT_LIST arg_list; ACPI_OBJECT arg; - /* - * _PSW methods could be run here to enable wake-on keyboard, LAN, etc. - */ - - // run the _PTS method - memset(&arg_list, 0, sizeof(arg_list)); - arg_list.count = 1; - arg_list.pointer = &arg; - - memset(&arg, 0, sizeof(arg)); - arg.type = ACPI_TYPE_NUMBER; - arg.number.value = ctx->state; + acpi_enter_sleep_state(ctx->state); - acpi_evaluate_object(NULL, "\\_PTS", &arg_list, NULL); - - // clear wake status by writing a 1 - acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, WAK_STS, 1); - - acpi_sleep_state = ctx->state; - - // set ACPI_SLP_TYPA/b and ACPI_SLP_EN - acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, SLP_TYPE_A, - ACPI_SLP_TYPA(acpi_slptyp[ctx->state])); - acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, SLP_TYPE_B, - ACPI_SLP_TYPB(acpi_slptyp[ctx->state])); - acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_LOCK, SLP_EN, 1); - - if (ctx->state != ACPI_S1) { - /* we should have just shut off - what are we doing here? */ - printk(KERN_ERR "ACPI: S%d failed\n", ctx->state); + /* either we are in S1, or the transition failed, as the other states resume + from the waking vector */ + if (ctx->state != ACPI_STATE_S1) { + printk(KERN_ERR "Could not enter S%d\n", ctx->state); goto out; } - // wait until S1 is entered + /* wait until S1 is entered */ while (!(acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_LOCK, WAK_STS))) safe_halt(); - // run the _WAK method + /* run the _WAK method */ memset(&arg_list, 0, sizeof(arg_list)); arg_list.count = 1; arg_list.pointer = &arg; memset(&arg, 0, sizeof(arg)); - arg.type = ACPI_TYPE_NUMBER; - arg.number.value = ctx->state; + arg.type = ACPI_TYPE_INTEGER; + arg.integer.value = ctx->state; acpi_evaluate_object(NULL, "\\_WAK", &arg_list, NULL); out: - acpi_sleep_state = ACPI_S0; + acpi_sleep_state = ACPI_STATE_S0; if (waitqueue_active(&ctx->wait)) wake_up_interruptible(&ctx->wait); @@ -112,13 +83,9 @@ static void acpi_power_off(void) { struct acpi_enter_sx_ctx ctx; - - if ((STRNCMP(acpi_fadt.header.signature, ACPI_FADT_SIGNATURE, ACPI_SIG_LEN) != 0) - || acpi_slptyp[ACPI_S5] == ACPI_INVALID) - return; init_waitqueue_head(&ctx.wait); - ctx.state = ACPI_S5; + ctx.state = ACPI_STATE_S5; acpi_enter_sx_async(&ctx); } @@ -132,10 +99,6 @@ acpi_enter_sx(acpi_sstate_t state) DECLARE_WAITQUEUE(wait, current); int ret = 0; - if ((STRNCMP(acpi_fadt.header.signature, ACPI_FADT_SIGNATURE, ACPI_SIG_LEN) != 0) - || acpi_slptyp[state] == ACPI_INVALID) - return -EINVAL; - init_waitqueue_head(&ctx.wait); ctx.state = state; @@ -166,19 +129,14 @@ acpi_sys_init(void) printk(KERN_INFO "ACPI: System firmware supports:"); - for (sx = ACPI_S0; sx <= ACPI_S5; sx++) { - int ca_sx = (sx <= ACPI_S4) ? sx : (sx + 1); + for (sx = ACPI_STATE_S0; sx <= ACPI_STATE_S5; sx++) { if (ACPI_SUCCESS( - acpi_hw_obtain_sleep_type_register_data(ca_sx, + acpi_hw_obtain_sleep_type_register_data(sx, &type_a, &type_b))) { - acpi_slptyp[sx] = ACPI_SLP_TYP(type_a, type_b); printk(" S%d", sx); } - else { - acpi_slptyp[sx] = ACPI_INVALID; - } } printk("\n"); diff --git a/drivers/acpi/table.c b/drivers/acpi/table.c index 8379b4204..de0f99a27 100644 --- a/drivers/acpi/table.c +++ b/drivers/acpi/table.c @@ -47,21 +47,6 @@ acpi_fetch_fadt(void) return -ENODEV; } - if (acpi_fadt.plvl2_lat - && acpi_fadt.plvl2_lat <= ACPI_MAX_P_LVL2_LAT) { - acpi_c2_exit_latency - = ACPI_MICROSEC_TO_TMR_TICKS(acpi_fadt.plvl2_lat); - acpi_c2_enter_latency - = ACPI_MICROSEC_TO_TMR_TICKS(ACPI_TMR_HZ / 1000); - } - if (acpi_fadt.plvl3_lat - && acpi_fadt.plvl3_lat <= ACPI_MAX_P_LVL3_LAT) { - acpi_c3_exit_latency - = ACPI_MICROSEC_TO_TMR_TICKS(acpi_fadt.plvl3_lat); - acpi_c3_enter_latency - = ACPI_MICROSEC_TO_TMR_TICKS(acpi_fadt.plvl3_lat * 5); - } - return 0; } @@ -71,11 +56,7 @@ acpi_fetch_fadt(void) int acpi_find_and_load_tables(u64 rsdp) { - if (ACPI_SUCCESS(acpi_load_tables(rsdp))) - { - printk(KERN_INFO "ACPI: System description tables loaded\n"); - } - else { + if (!ACPI_SUCCESS(acpi_load_tables(rsdp))) { printk(KERN_INFO "ACPI: System description table load failed\n"); acpi_terminate(); return -1; diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index 624926d27..76d7fff15 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: tbconvrt - ACPI Table conversion utilities - * $Revision: 15 $ + * $Revision: 18 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ a.register_bit_width = (u8) MUL_8 (b);\ a.register_bit_offset = 0;\ a.reserved = 0;\ - a.address = (UINT64) c;} + ACPI_STORE_ADDRESS (a.address,c);} /* ACPI V1.0 entries -- address space is always I/O */ @@ -126,8 +126,8 @@ acpi_tb_convert_to_xsdt ( new_table->table_offset_entry[i] = ((RSDT_DESCRIPTOR_REV071 *) table_info->pointer)->table_offset_entry[i]; #else - new_table->table_offset_entry[i] = - ((RSDT_DESCRIPTOR_REV1 *) table_info->pointer)->table_offset_entry[i]; + ACPI_STORE_ADDRESS (new_table->table_offset_entry[i], + ((RSDT_DESCRIPTOR_REV1 *) table_info->pointer)->table_offset_entry[i]); #endif } else { @@ -312,11 +312,11 @@ acpi_tb_convert_table_fadt (void) /* No 0.71 equivalence. Leave pre-zeroed. */ /* FADT2->Flush_stride = 0; */ - /* Processor’s duty cycle index in processor's P_CNT reg*/ + /* Processor's duty cycle index in processor's P_CNT reg*/ /* No 0.71 equivalence. Leave pre-zeroed. */ /* FADT2->Duty_offset = 0; */ - /* Processor’s duty cycle value bit width in P_CNT register.*/ + /* Processor's duty cycle value bit width in P_CNT register.*/ /* No 0.71 equivalence. Leave pre-zeroed. */ /* FADT2->Duty_width = 0; */ @@ -384,8 +384,8 @@ acpi_tb_convert_table_fadt (void) /* Convert table pointers to 64-bit fields */ - FADT2->Xfirmware_ctrl = (UINT64) FADT1->firmware_ctrl; - FADT2->Xdsdt = (UINT64) FADT1->dsdt; + ACPI_STORE_ADDRESS (FADT2->Xfirmware_ctrl, FADT1->firmware_ctrl); + ACPI_STORE_ADDRESS (FADT2->Xdsdt, FADT1->dsdt); /* System Interrupt Model isn't used in ACPI 2.0*/ /* FADT2->Reserved1 = 0; */ @@ -448,6 +448,7 @@ acpi_tb_convert_table_fadt (void) * Global FADT pointer will point to the common V2.0 FADT */ acpi_gbl_FADT = FADT2; + acpi_gbl_FADT->header.length = sizeof (FADT_DESCRIPTOR); /* Free the original table */ @@ -464,8 +465,6 @@ acpi_tb_convert_table_fadt (void) table_desc->length = sizeof (FADT_DESCRIPTOR_REV2); - /* Dump the FADT Header */ - /* Dump the entire FADT */ diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c index 2cf8eede7..8e05e2c7d 100644 --- a/drivers/acpi/tables/tbget.c +++ b/drivers/acpi/tables/tbget.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: tbget - ACPI Table get* routines - * $Revision: 40 $ + * $Revision: 43 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -243,7 +243,7 @@ acpi_tb_get_all_tables ( /* Get the table via the XSDT */ status = acpi_tb_get_table ((ACPI_PHYSICAL_ADDRESS) - acpi_gbl_XSDT->table_offset_entry[index], + ACPI_GET_ADDRESS (acpi_gbl_XSDT->table_offset_entry[index]), table_ptr, &table_info); /* Ignore a table that failed verification */ @@ -326,7 +326,8 @@ acpi_tb_get_all_tables ( * Get the DSDT (We know that the FADT is valid now) */ - status = acpi_tb_get_table (acpi_gbl_FADT->Xdsdt, table_ptr, &table_info); + status = acpi_tb_get_table ((ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xdsdt), + table_ptr, &table_info); if (ACPI_FAILURE (status)) { return (status); } @@ -472,13 +473,14 @@ acpi_tb_get_table_rsdt ( /* 0.71 RSDP has 64bit Rsdt address field */ physical_address = ((RSDP_DESCRIPTOR_REV071 *)acpi_gbl_RSDP)->rsdt_physical_address; #else - physical_address = acpi_gbl_RSDP->rsdt_physical_address; + physical_address = (ACPI_PHYSICAL_ADDRESS) acpi_gbl_RSDP->rsdt_physical_address; #endif table_signature = RSDT_SIG; signature_length = sizeof (RSDT_SIG) -1; } else { - physical_address = (ACPI_PHYSICAL_ADDRESS) acpi_gbl_RSDP->xsdt_physical_address; + physical_address = (ACPI_PHYSICAL_ADDRESS) + ACPI_GET_ADDRESS (acpi_gbl_RSDP->xsdt_physical_address); table_signature = XSDT_SIG; signature_length = sizeof (XSDT_SIG) -1; } @@ -586,7 +588,7 @@ acpi_tb_get_table_facs ( else { /* Just map the physical memory to our address space */ - status = acpi_tb_map_acpi_table (acpi_gbl_FADT->Xfirmware_ctrl, + status = acpi_tb_map_acpi_table ((ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xfirmware_ctrl), &size, &table_ptr); if (ACPI_FAILURE(status)) { return (status); diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index b3926a0e3..e753917b7 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: tbinstal - ACPI table installation and removal - * $Revision: 34 $ + * $Revision: 36 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index baae6fb4c..d89b1508c 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: tbutils - Table manipulation utilities - * $Revision: 31 $ + * $Revision: 33 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index ee9eba62a..98c99873c 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c @@ -2,12 +2,12 @@ * * Module Name: tbxface - Public interfaces to the ACPI subsystem * ACPI table oriented interfaces - * $Revision: 32 $ + * $Revision: 34 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index 4c31f1c37..606e8ad10 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c @@ -1,12 +1,12 @@ /****************************************************************************** * * Module Name: tbxfroot - Find the root ACPI table (RSDT) - * $Revision: 33 $ + * $Revision: 35 $ * *****************************************************************************/ /* - * Copyright (C) 2000 R. Byron Moore + * Copyright (C) 2000, 2001 R. Byron Moore * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by |