have a high-level driver for the type of device that you want to
support.
+Shuttle EPAT c7/c8 extension
+CONFIG_PARIDE_EPATC8
+ This option enables support for the newer Shuttle EP1284 (aka c7 and
+ c8) chip. You need this if you are using any recent Imation SuperDisk
+ (LS-120) drive.
+
Shuttle EPIA protocol
CONFIG_PARIDE_EPIA
This option enables support for the (obsolete) EPIA parallel port
HTML := $(patsubst %.sgml, %, $(BOOKS))
IMG-parportbook := parport-share.fig parport-multi.fig parport-structure.fig
EPS-parportbook := $(patsubst %.fig, %.eps, $(IMG-parportbook))
-JPG-parportbook := $(patsubst %.fig, %.jpeg, $(IMG-parportbook))
+PNG-parportbook := $(patsubst %.fig, %.png, $(IMG-parportbook))
C-procfs-example = procfs_example.sgml
books: $(BOOKS)
%.eps: %.fig
fig2dev -Leps $< $@
-%.jpeg: %.fig
- fig2dev -Ljpeg $< $@
+%.png: %.fig
+ fig2dev -Lpng $< $@
%.sgml: %.c
echo "<programlisting>" > $@
$(TOPDIR)/scripts/kernel-doc -man $^ | \
$(PERL) $(TOPDIR)/scripts/split-man $(TOPDIR)/Documentation/man
-parportbook: $(JPG-parportbook)
-parportbook.ps parportbook.pdf: $(EPS-parportbook)
+parportbook parportbook.pdf: $(PNG-parportbook)
+parportbook.ps: $(EPS-parportbook)
parportbook.sgml: parportbook.tmpl $(TOPDIR)/drivers/parport/init.c
$(TOPDIR)/scripts/docgen $(TOPDIR)/drivers/parport/init.c <$< >$@
<!-- -*- sgml -*- -->
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN"[]>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[]>
<book id="ParportGuide">
<bookinfo>
<mediaobject>
<imageobject>
- <imagedata fileref="parport-share.eps" format=ps>
+ <imagedata fileref="parport-share" format="eps">
</imageobject>
<imageobject>
- <imagedata fileref="parport-share.jpeg" format=jpeg>
+ <imagedata fileref="parport-share.png" format="png">
</imageobject>
</mediaobject>
<mediaobject>
<imageobject>
- <imagedata format=eps fileref="parport-structure.eps">
+ <imagedata fileref="parport-structure" format="eps">
</imageobject>
<imageobject>
- <imagedata format=jpeg fileref="parport-structure.jpeg">
+ <imagedata fileref="parport-structure.png" format="png">
</imageobject>
</mediaobject>
<mediaobject>
<imageobject>
- <imagedata format=eps fileref="parport-multi.eps">
+ <imagedata fileref="parport-multi" format="eps">
</imageobject>
<imageobject>
- <imagedata format=jpeg fileref="parport-multi.jpeg">
+ <imagedata fileref="parport-multi.png" format="png">
</imageobject>
</mediaobject>
Release Notes For Linux Kernel 2.2 and higher.
These notes are for the drivers which have already been integrated into the
-kernel and have been tested on Linux kernels 2.0, 2.2, and 2.3.
+kernel and have been tested on Linux kernels 2.0, 2.2, 2.3, and 2.4.
-Version: 1.2.9
-Date: 04/12/2000
-Author: Andrew Manison <amanison@america.net>
+Version: 1.2.12
+Date: 10/24/2001
+Historical Author: Andrew Manison <amanison@america.net>
+Primary Author: Doug McNash <dougm@computone.com>
Testing: larryg@computone.com
Support: support@computone.com
-Fixes and Updates: Doug McNash <dougm@computone.com>
-Proc Filesystem and Kernel Integration: Mike Warfield <mhw@wittsend.com>
-
+Fixes and Updates: Mike Warfield <mhw@wittsend.com>
This file assumes that you are using the Computone drivers which are
integrated into the kernel sources. For updating the drivers or installing
before or after drivers installation.
Note the hardware address from the Computone ISA cards installed into
- the system. These are required for editing ip2.h or editing
+ the system. These are required for editing ip2.c or editing
/etc/modules.conf, or for specification on the modprobe
command line.
Select (m) module for CONFIG_COMPUTONE under character
devices. CONFIG_PCI and CONFIG_MODULES also may need to be set.
c) Set address on ISA cards then:
- edit /usr/src/linux/drivers/char/ip2/ip2.h if needed
+ edit /usr/src/linux/drivers/char/ip2.c if needed
or
edit /etc/modules.conf if needed (module).
or both to match this setting.
Select (y) kernel for CONFIG_COMPUTONE under character
devices. CONFIG_PCI may need to be set if you have PCI bus.
c) Set address on ISA cards then:
- edit /usr/src/linux/drivers/char/ip2/ip2.h
+ edit /usr/src/linux/drivers/char/ip2.c
+ (Optional - may be specified on kernel command line now)
d) Run "make dep"
e) Run "make zImage" or whatever target you prefer.
f) mv /usr/src/linux/arch/i386/boot/zImage to /boot.
h) Reboot using this kernel
i) run ip2mkdev (either the script below or the binary version)
+Kernel command line options:
+
+When compiling the driver into the kernel, io and irq may be
+compiled into the driver by editing ip2.c and setting the values for
+io and irq in the appropriate array. An alternative is to specify
+a command line parameter to the kernel at boot up.
+
+ ip2=io0,irq0,io1,irq1,io2,irq2,io3,irq3
+
+Note that this order is very different from the specifications for the
+modload parameters which have separate IRQ and IO specifiers.
+
+The io port also selects PCI (1) and EISA (2) boards.
+
+ io=0 No board
+ io=1 PCI board
+ io=2 EISA board
+ else ISA board io address
+
+You only need to specify the boards which are present.
+
+ Examples:
+
+ 2 PCI boards:
+
+ ip2=1,0,1,0
+
+ 1 ISA board at 0x310 irq 5:
+
+ ip2=0x310,5
+
+This can be added to and "append" option in lilo.conf similar to this:
+
+ append="ip2=1,0,1,0"
+
3. INSTALLATION
The driver can be installed as a module (recommended) or built into the
kernel. This is selected as for other drivers through the `make config`
command from the root of the Linux source tree. If the driver is built
-into the kernel you will need to edit the file ip2.h to match the boards
+into the kernel you will need to edit the file ip2.c to match the boards
you are installing. See that file for instructions. If the driver is
installed as a module the configuration can also be specified on the
modprobe command line as follows:
where irqnum is one of the valid Intelliport II interrupts (3,4,5,7,10,11,
12,15) and addr1-4 are the base addresses for up to four controllers. If
-the irqs are not specified the driver uses the default in ip2/ip2.h (which
+the irqs are not specified the driver uses the default in ip2.c (which
selects polled mode). If no base addresses are specified the defaults in
-ip2.h are used. If you are autoloading the driver module with kerneld or
-kmod the base addresses and interrupt number must also be set in ip2/ip2.h
+ip2.c are used. If you are autoloading the driver module with kerneld or
+kmod the base addresses and interrupt number must also be set in ip2.c
and recompile or just insert and options line in /etc/modules.conf or both.
The options line is equivalent to the command line and takes precidence over
-what is in ip2.h.
+what is in ip2.c.
/etc/modules.conf sample:
options ip2 io=1,0x328 irq=1,10
alias char-major-72 ip2
alias char-major-73 ip2
-equivelant ip2.h:
-static ip2config_t ip2config =
-{
- {1,10,0,0},
- {
- 0x0001, // Board 0, ttyF0 - ttyF63 /* PCI card */
- 0x0328, // Board 1, ttyF64 - ttyF127 /* ISA card */
- 0x0000, // Board 2, ttyF128 - ttyF191 /* empty */
- 0x0000 // Board 3, ttyF192 - ttyF255 /* empty */
- }
-};
+The equivalent in ip2.c:
+
+static int io[IP2_MAX_BOARDS]= { 1, 0x328, 0, 0 };
+static int irq[IP2_MAX_BOARDS] = { 1, 10, -1, -1 };
+
+The equivalent for the kernel command line (in lilo.conf):
+
+ append="ip2=1,1,0x328,10"
Note: Both io and irq should be updated to reflect YOUR system. An "io"
- address of "1/2" indicates a PCI/EISA card in the board table. The
- PCI or EISA irq will be assigned automatically.
+ address of 1 or 2 indicates a PCI or EISA card in the board table. The PCI or EISA irq will be assigned automatically.
Specifying an invalid or in-use irq will default the driver into
running in polled mode for that card. If all irq entries are 0 then
S: Supported
COMPUTONE INTELLIPORT MULTIPORT CARD
-P: Doug McNash
P: Michael H. Warfield
-M: Doug McNash <dougm@computone.com>
M: Michael H. Warfield <mhw@wittsend.com>
W: http://www.computone.com/
W: http://www.wittsend.com/computone.html
VERSION = 2
PATCHLEVEL = 4
-SUBLEVEL = 13
-EXTRAVERSION =
+SUBLEVEL = 14
+EXTRAVERSION =-pre1
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
subdir-$(CONFIG_ACPI) += $(acpi-subdirs)
subdir-$(CONFIG_ACPI_BUSMGR) += ospm
-obj-$(CONFIG_ACPI) += os.o acpi_ksyms.o
+obj-$(CONFIG_ACPI) += driver.o os.o acpi_ksyms.o
obj-$(CONFIG_ACPI) += $(foreach dir,$(acpi-subdirs),$(dir)/$(dir).o)
ifdef CONFIG_ACPI_KERNEL_CONFIG
obj-$(CONFIG_ACPI) += acpiconf.o osconf.o
endif
-obj-$(CONFIG_ACPI) += driver.o
ifeq ($(CONFIG_ACPI_BUSMGR),y)
obj-y += ospm/ospm.o
EXPORT_SYMBOL(acpi_db_user_commands);
#endif
+#ifdef ACPI_DEBUG
+EXPORT_SYMBOL(acpi_ut_debug_print_raw);
+EXPORT_SYMBOL(acpi_ut_debug_print);
+EXPORT_SYMBOL(acpi_ut_status_exit);
+EXPORT_SYMBOL(acpi_ut_exit);
+EXPORT_SYMBOL(acpi_ut_trace);
+#endif
+
EXPORT_SYMBOL(acpi_gbl_FADT);
EXPORT_SYMBOL(acpi_os_free);
EXPORT_SYMBOL(acpi_set_firmware_waking_vector);
EXPORT_SYMBOL(acpi_subsystem_status);
-
EXPORT_SYMBOL(acpi_os_signal);
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
- * $Revision: 65 $
+ * $Revision: 66 $
*
******************************************************************************/
/* Display the subtree */
acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT);
- acpi_ns_dump_objects (ACPI_TYPE_ANY, max_depth, ACPI_UINT32_MAX, subtree_entry);
+ acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, max_depth, ACPI_UINT32_MAX, subtree_entry);
acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
}
/* Display the subtree */
acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT);
- acpi_ns_dump_objects (ACPI_TYPE_ANY, max_depth, owner_id, subtree_entry);
+ acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, max_depth, owner_id, subtree_entry);
acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);
}
/*******************************************************************************
*
* Module Name: dbdisasm - parser op tree display routines
- * $Revision: 48 $
+ * $Revision: 50 $
*
******************************************************************************/
acpi_status
acpi_ps_display_object_pathname (
+ acpi_walk_state *walk_state,
acpi_parse_object *op)
{
acpi_parse_object *target_op;
acpi_status
acpi_ps_display_object_pathname (
+ acpi_walk_state *walk_state,
acpi_parse_object *op)
{
acpi_status status;
acpi_namespace_node *node;
NATIVE_CHAR buffer[MAX_SHOW_ENTRY];
u32 buffer_size = MAX_SHOW_ENTRY;
+ u32 debug_level;
+
+ /* Save current debug level so we don't get extraneous debug output */
- acpi_os_printf (" (Path ");
+ debug_level = acpi_dbg_level;
+ acpi_dbg_level = 0;
/* Just get the Node out of the Op object */
node = op->node;
if (!node) {
- /*
- * No Named obj, so we can't get the pathname since the object
- * is not in the namespace. This can happen during single
- * stepping where a dynamic named object is *about* to be created.
- */
- return (AE_OK);
+ /* Node not defined in this scope, look it up */
+
+ status = acpi_ns_lookup (walk_state->scope_info, op->value.string, ACPI_TYPE_ANY,
+ IMODE_EXECUTE, NS_SEARCH_PARENT, walk_state, &(node));
+
+ if (ACPI_FAILURE (status)) {
+ /*
+ * We can't get the pathname since the object
+ * is not in the namespace. This can happen during single
+ * stepping where a dynamic named object is *about* to be created.
+ */
+ acpi_os_printf (" [Path not found]");
+ goto exit;
+ }
+
+ /* Save it for next time. */
+
+ op->node = node;
}
/* Convert Named_desc/handle to a full pathname */
status = acpi_ns_handle_to_pathname (node, &buffer_size, buffer);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("****Could not get pathname****)");
- return (status);
+ goto exit;
}
- acpi_os_printf ("%s)", buffer);
- return (AE_OK);
+ acpi_os_printf (" (Path %s)", buffer);
+
+
+exit:
+ /* Restore the debug level */
+
+ acpi_dbg_level = debug_level;
+ return (status);
}
#endif
if ((op->opcode == AML_INT_NAMEPATH_OP && op->value.name) &&
(op->parent) &&
(acpi_gbl_db_opt_verbose)) {
- acpi_ps_display_object_pathname (op);
+ acpi_ps_display_object_pathname (walk_state, op);
}
acpi_os_printf ("\n");
case AML_QWORD_OP:
if (acpi_gbl_db_opt_verbose) {
- acpi_os_printf ("(UINT64) 0x%8.8X%8.8X", op->value.integer64.hi,
+ acpi_os_printf ("(u64) 0x%8.8X%8.8X", op->value.integer64.hi,
op->value.integer64.lo);
}
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
- * $Revision: 52 $
+ * $Revision: 57 $
*
******************************************************************************/
}
else {
- acpi_os_printf ("Object Pathname: %s\n", ret_buf.pointer);
+ acpi_os_printf ("Object (%p) Pathname: %s\n", node, ret_buf.pointer);
}
if (!acpi_os_readable (node, sizeof (acpi_namespace_node))) {
return;
}
- acpi_ut_dump_buffer (node->object, sizeof (acpi_operand_object), display, ACPI_UINT32_MAX);
+ acpi_ut_dump_buffer ((void *) node->object, sizeof (acpi_operand_object), display, ACPI_UINT32_MAX);
acpi_ex_dump_object_descriptor (node->object, 1);
}
}
break;
case AML_REVISION_OP:
- acpi_os_printf ("[Const] Revision (%X)", ACPI_CA_VERSION);
+ acpi_os_printf ("[Const] Revision (%X)", ACPI_CA_SUPPORT_LEVEL);
break;
case AML_LOCAL_OP:
num_remaining_ops++;
}
- op_info = acpi_ps_get_opcode_info (op->opcode);
- if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
- /* Bad opcode or ASCII character */
-
- continue;
- }
-
-
/* Decode the opcode */
- switch (ACPI_GET_OP_CLASS (op_info)) {
- case OPTYPE_CONSTANT: /* argument type only */
- case OPTYPE_LITERAL: /* argument type only */
- case OPTYPE_DATA_TERM: /* argument type only */
- case OPTYPE_LOCAL_VARIABLE: /* argument type only */
- case OPTYPE_METHOD_ARGUMENT: /* argument type only */
+ op_info = acpi_ps_get_opcode_info (op->opcode);
+ switch (op_info->class) {
+ case AML_CLASS_ARGUMENT:
if (count_remaining) {
num_remaining_operands++;
}
num_operands++;
break;
+ case AML_CLASS_UNKNOWN:
+ /* Bad opcode or ASCII character */
+
+ continue;
+
default:
if (count_remaining) {
num_remaining_operators++;
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
- * $Revision: 48 $
+ * $Revision: 53 $
*
******************************************************************************/
MODULE_NAME ("dbfileio")
+/*
+ * NOTE: this is here for lack of a better place. It is used in all
+ * flavors of the debugger, need LCD file
+ */
#ifdef ACPI_APPLICATION
#include <stdio.h>
FILE *acpi_gbl_debug_file = NULL;
#endif
-/*
- * NOTE: this is here for lack of a better place. It is used in all
- * flavors of the debugger, need LCD file
- */
+acpi_table_header *acpi_gbl_db_table_ptr = NULL;
+
/*******************************************************************************
*
u32 *table_length)
{
acpi_table_header table_header;
- u8 *aml_ptr;
+ u8 *aml_start;
u32 aml_length;
u32 actual;
acpi_status status;
/* Allocate a buffer for the table */
*table_length = table_header.length;
- *table_ptr = ACPI_MEM_ALLOCATE ((size_t) *table_length);
+ *table_ptr = acpi_os_allocate ((size_t) *table_length);
if (!*table_ptr) {
acpi_os_printf ("Could not allocate memory for ACPI table %4.4s (size=%X)\n",
table_header.signature, table_header.length);
}
- aml_ptr = (u8 *) *table_ptr + sizeof (table_header);
- aml_length = *table_length - sizeof (table_header);
+ aml_start = (u8 *) *table_ptr + sizeof (table_header);
+ aml_length = *table_length - sizeof (table_header);
/* Copy the header to the buffer */
/* Get the rest of the table */
- actual = fread (aml_ptr, 1, (size_t) aml_length, fp);
+ actual = fread (aml_start, 1, (size_t) aml_length, fp);
if (actual == aml_length) {
return (AE_OK);
}
if (actual > 0) {
acpi_os_printf ("Warning - reading table, asked for %X got %X\n", aml_length, actual);
- return (AE_OK);
+ return (AE_OK);
}
acpi_os_printf ("Error - could not read the table file\n");
- ACPI_MEM_FREE (*table_ptr);
+ acpi_os_free (*table_ptr);
*table_ptr = NULL;
*table_length = 0;
#ifdef ACPI_APPLICATION
FILE *fp;
acpi_status status;
- acpi_table_header *table_ptr;
u32 table_length;
/* Get the entire file */
acpi_os_printf ("Loading Acpi table from file %s\n", filename);
- status = acpi_db_load_table (fp, &table_ptr, &table_length);
+ status = acpi_db_load_table (fp, &acpi_gbl_db_table_ptr, &table_length);
fclose(fp);
if (ACPI_FAILURE (status)) {
return (status);
}
-
/* Attempt to recognize and install the table */
- status = ae_local_load_table (table_ptr);
+ status = ae_local_load_table (acpi_gbl_db_table_ptr);
if (ACPI_FAILURE (status)) {
if (status == AE_EXIST) {
acpi_os_printf ("Table %4.4s is already installed\n",
- &table_ptr->signature);
+ &acpi_gbl_db_table_ptr->signature);
}
-
else {
acpi_os_printf ("Could not install table, %s\n",
acpi_format_exception (status));
}
- ACPI_MEM_FREE (table_ptr);
+ acpi_os_free (acpi_gbl_db_table_ptr);
return (status);
}
acpi_os_printf ("%4.4s at %p successfully installed and loaded\n",
- &table_ptr->signature, table_ptr);
+ &acpi_gbl_db_table_ptr->signature, acpi_gbl_db_table_ptr);
acpi_gbl_acpi_hardware_present = FALSE;
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
- * $Revision: 68 $
+ * $Revision: 72 $
*
******************************************************************************/
NATIVE_CHAR acpi_gbl_db_scope_buf[40];
NATIVE_CHAR acpi_gbl_db_debug_filename[40];
NATIVE_CHAR *acpi_gbl_db_args[DB_MAX_ARGS];
-NATIVE_CHAR *acpi_gbl_db_buffer;
+NATIVE_CHAR *acpi_gbl_db_buffer = NULL;
NATIVE_CHAR *acpi_gbl_db_filename = NULL;
u8 acpi_gbl_db_output_to_file = FALSE;
-
u32 acpi_gbl_db_debug_level = ACPI_LV_VERBOSITY2;
u32 acpi_gbl_db_console_debug_level = NORMAL_DEFAULT | ACPI_LV_TABLES;
u8 acpi_gbl_db_output_flags = DB_CONSOLE_OUTPUT;
case CMD_ALLOCATIONS:
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- acpi_ut_dump_current_allocations ((u32) -1, NULL);
+ acpi_ut_dump_allocations ((u32) -1, NULL);
#endif
break;
* because all the semaphores are deleted during termination
*/
acpi_terminate ();
-
return (status);
}
if (acpi_gbl_memory_lists[i].object_size)
{
- size = ROUND_UP_TO_1_k (outstanding * acpi_gbl_memory_lists[i].object_size);
+ size = ROUND_UP_TO_1K (outstanding * acpi_gbl_memory_lists[i].object_size);
}
else
{
- size = ROUND_UP_TO_1_k (acpi_gbl_memory_lists[i].current_total_size);
+ size = ROUND_UP_TO_1K (acpi_gbl_memory_lists[i].current_total_size);
}
acpi_os_printf (" Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n",
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
- * $Revision: 43 $
+ * $Revision: 45 $
*
******************************************************************************/
case ACPI_TYPE_INTEGER:
- acpi_os_printf ("[Integer] = %X%8.8X\n", HIDWORD (obj_desc->integer.value),
+ acpi_os_printf ("[Integer] = %8.8X%8.8X\n", HIDWORD (obj_desc->integer.value),
LODWORD (obj_desc->integer.value));
break;
acpi_parse_object *start_op;
acpi_status status = AE_OK;
u32 base_aml_offset;
+ acpi_walk_state *walk_state;
+
+
+ FUNCTION_ENTRY ();
acpi_os_printf ("Pass two parse ....\n");
+
while (op) {
if (op->opcode == AML_METHOD_OP) {
method = (acpi_parse2_object *) op;
- status = acpi_ps_parse_aml (op, method->data, method->length, 0,
- NULL, NULL, NULL, acpi_ds_load1_begin_op, acpi_ds_load1_end_op);
+
+ walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
+ NULL, NULL, NULL);
+ if (!walk_state) {
+ return (AE_NO_MEMORY);
+ }
+
+
+ walk_state->parser_state.aml =
+ walk_state->parser_state.aml_start = method->data;
+ walk_state->parser_state.aml_end =
+ walk_state->parser_state.pkg_end = method->data + method->length;
+ walk_state->parser_state.start_scope = op;
+
+ walk_state->descending_callback = acpi_ds_load1_begin_op;
+ walk_state->ascending_callback = acpi_ds_load1_end_op;
+
+
+ status = acpi_ps_parse_aml (walk_state);
base_aml_offset = (method->value.arg)->aml_offset + 1;
}
if (ACPI_FAILURE (status)) {
- return (status);
+ break;
}
op = acpi_ps_get_depth_next (root, op);
/*******************************************************************************
*
* Module Name: dbxface - AML Debugger external interfaces
- * $Revision: 41 $
+ * $Revision: 45 $
*
******************************************************************************/
*
* PARAMETERS: Walk_state - Current walk
* Op - Current executing op
- * Op_type - Type of the current AML Opcode
+ * Opcode_class - Class of the current AML Opcode
*
* RETURN: Status
*
acpi_db_single_step (
acpi_walk_state *walk_state,
acpi_parse_object *op,
- u8 op_type)
+ u32 opcode_class)
{
acpi_parse_object *next;
acpi_status status = AE_OK;
return (AE_OK);
}
- switch (op_type) {
- case OPTYPE_UNDEFINED:
- case OPTYPE_CONSTANT: /* argument type only */
- case OPTYPE_LITERAL: /* argument type only */
- case OPTYPE_DATA_TERM: /* argument type only */
- case OPTYPE_LOCAL_VARIABLE: /* argument type only */
- case OPTYPE_METHOD_ARGUMENT: /* argument type only */
+ switch (opcode_class) {
+ case AML_CLASS_UNKNOWN:
+ case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */
return (AE_OK);
break;
-
- case OPTYPE_NAMED_OBJECT:
- switch (op->opcode) {
- case AML_INT_NAMEPATH_OP:
- return (AE_OK);
- break;
- }
}
/*
/* Init globals */
- acpi_gbl_db_buffer = acpi_os_allocate (ACPI_DEBUG_BUFFER_SIZE);
+ acpi_gbl_db_buffer = acpi_os_callocate (ACPI_DEBUG_BUFFER_SIZE);
/* Initial scope is the root */
}
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_db_terminate
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Stop debugger
+ *
+ ******************************************************************************/
+
+void
+acpi_db_terminate (void)
+{
+
+ if (acpi_gbl_db_table_ptr) {
+ acpi_os_free (acpi_gbl_db_table_ptr);
+ }
+ if (acpi_gbl_db_buffer) {
+ acpi_os_free (acpi_gbl_db_buffer);
+ }
+}
+
+
#endif /* ENABLE_DEBUGGER */
/******************************************************************************
*
* Module Name: dsfield - Dispatcher field routines
- * $Revision: 44 $
+ * $Revision: 46 $
*
*****************************************************************************/
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
+#include "acparser.h"
#define _COMPONENT ACPI_DISPATCHER
MODULE_NAME ("dsfield")
-/*
- * Field flags: Bits 00 - 03 : Access_type (Any_acc, Byte_acc, etc.)
- * 04 : Lock_rule (1 == Lock)
- * 05 - 06 : Update_rule
- */
-
-#define FIELD_ACCESS_TYPE_MASK 0x0F
-#define FIELD_LOCK_RULE_MASK 0x10
-#define FIELD_UPDATE_RULE_MASK 0x60
-
-
/*******************************************************************************
*
- * FUNCTION: Acpi_ds_create_field
+ * FUNCTION: Acpi_ds_create_buffer_field
*
- * PARAMETERS: Op - Op containing the Field definition and args
- * Region_node - Object for the containing Operation Region
- * ` Walk_state - Current method state
+ * PARAMETERS: Opcode - The opcode to be executed
+ * Operands - List of operands for the opcode
+ * Walk_state - Current state
*
* RETURN: Status
*
- * DESCRIPTION: Create a new field in the specified operation region
+ * DESCRIPTION: Execute the Create_field operators:
+ * Create_bit_field_op,
+ * Create_byte_field_op,
+ * Create_word_field_op,
+ * Create_dWord_field_op,
+ * Create_qWord_field_op,
+ * Create_field_op (all of which define fields in buffers)
*
******************************************************************************/
acpi_status
-acpi_ds_create_field (
+acpi_ds_create_buffer_field (
acpi_parse_object *op,
- acpi_namespace_node *region_node,
acpi_walk_state *walk_state)
{
- acpi_status status = AE_AML_ERROR;
acpi_parse_object *arg;
acpi_namespace_node *node;
- u8 field_flags;
- u32 field_bit_position = 0;
+ acpi_status status;
+ acpi_operand_object *obj_desc;
- FUNCTION_TRACE_PTR ("Ds_create_field", op);
+ FUNCTION_TRACE ("Ds_create_buffer_field");
- /* First arg is the name of the parent Op_region */
+ /* Get the Name_string argument */
- arg = op->value.arg;
- if (!region_node) {
- status = acpi_ns_lookup (walk_state->scope_info, arg->value.name,
- ACPI_TYPE_REGION, IMODE_EXECUTE,
- NS_SEARCH_PARENT, walk_state, ®ion_node);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
+ if (op->opcode == AML_CREATE_FIELD_OP) {
+ arg = acpi_ps_get_arg (op, 3);
}
+ else {
+ /* Create Bit/Byte/Word/Dword field */
- /* Second arg is the field flags */
+ arg = acpi_ps_get_arg (op, 2);
+ }
- arg = arg->next;
- field_flags = (u8) arg->value.integer;
+ if (!arg) {
+ return_ACPI_STATUS (AE_AML_NO_OPERAND);
+ }
- /* Each remaining arg is a Named Field */
+ /*
+ * Enter the Name_string into the namespace
+ */
+ status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
+ INTERNAL_TYPE_DEF_ANY, IMODE_LOAD_PASS1,
+ NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
+ walk_state, &(node));
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ /* We could put the returned object (Node) on the object stack for later, but
+ * for now, we will put it in the "op" object that the parser uses, so we
+ * can get it again at the end of this scope
+ */
+ op->node = node;
+
+ /*
+ * If there is no object attached to the node, this node was just created and
+ * we need to create the field object. Otherwise, this was a lookup of an
+ * existing node and we don't want to create the field object again.
+ */
+ if (node->object) {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * The Field definition is not fully parsed at this time.
+ * (We must save the address of the AML for the buffer and index operands)
+ */
+
+ /* Create the buffer field object */
+
+ obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER_FIELD);
+ if (!obj_desc) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ /*
+ * Allocate a method object for this field unit
+ */
+ obj_desc->buffer_field.extra = acpi_ut_create_internal_object (
+ INTERNAL_TYPE_EXTRA);
+ if (!obj_desc->buffer_field.extra) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ /*
+ * Remember location in AML stream of the field unit
+ * opcode and operands -- since the buffer and index
+ * operands must be evaluated.
+ */
+ obj_desc->buffer_field.extra->extra.aml_start = ((acpi_parse2_object *) op)->data;
+ obj_desc->buffer_field.extra->extra.aml_length = ((acpi_parse2_object *) op)->length;
+ obj_desc->buffer_field.node = node;
+
+ /* Attach constructed field descriptor to parent node */
+
+ status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_BUFFER_FIELD);
+
+
+cleanup:
+
+ /* Remove local reference to the object */
+
+ acpi_ut_remove_reference (obj_desc);
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ds_get_field_names
+ *
+ * PARAMETERS: Info - Create_field info structure
+ * ` Walk_state - Current method state
+ * Arg - First parser arg for the field name list
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Process all named fields in a field declaration. Names are
+ * entered into the namespace.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ds_get_field_names (
+ ACPI_CREATE_FIELD_INFO *info,
+ acpi_walk_state *walk_state,
+ acpi_parse_object *arg)
+{
+ acpi_status status;
+
+
+ FUNCTION_TRACE_U32 ("Ds_get_field_names", info);
+
+
+ /* First field starts at bit zero */
+
+ info->field_bit_position = 0;
+
+ /* Process all elements in the field list (of parse nodes) */
- arg = arg->next;
while (arg) {
+ /*
+ * Three types of field elements are handled:
+ * 1) Offset - specifies a bit offset
+ * 2) Access_as - changes the access mode
+ * 3) Name - Enters a new named field into the namespace
+ */
switch (arg->opcode) {
case AML_INT_RESERVEDFIELD_OP:
- field_bit_position += arg->value.size;
+ info->field_bit_position += arg->value.size;
break;
* Get a new Access_type and Access_attribute for all
* entries (until end or another Access_as keyword)
*/
- field_flags = (u8) ((field_flags & FIELD_ACCESS_TYPE_MASK) ||
- ((u8) (arg->value.integer >> 8)));
+ info->field_flags = (u8) ((info->field_flags & FIELD_ACCESS_TYPE_MASK) ||
+ ((u8) (arg->value.integer >> 8)));
break;
case AML_INT_NAMEDFIELD_OP:
+ /* Enter a new field name into the namespace */
+
status = acpi_ns_lookup (walk_state->scope_info,
(NATIVE_CHAR *) &((acpi_parse2_object *)arg)->name,
- INTERNAL_TYPE_REGION_FIELD, IMODE_LOAD_PASS1,
+ info->field_type, IMODE_LOAD_PASS1,
NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- NULL, &node);
+ NULL, &info->field_node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
- /*
- * Initialize an object for the new Node that is on
- * the object stack
- */
- status = acpi_ex_prep_region_field_value (node, region_node, field_flags,
- field_bit_position, arg->value.size);
+ /* Create and initialize an object for the new Field Node */
+
+ info->field_bit_length = arg->value.size;
+
+ status = acpi_ex_prep_field_value (info);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
- /* Keep track of bit position for *next* field */
+ /* Keep track of bit position for the next field */
+
+ info->field_bit_position += info->field_bit_length;
+ break;
+
+
+ default:
- field_bit_position += arg->value.size;
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n",
+ arg->opcode));
+ return_ACPI_STATUS (AE_AML_ERROR);
break;
}
arg = arg->next;
}
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: Acpi_ds_create_bank_field
+ * FUNCTION: Acpi_ds_create_field
*
* PARAMETERS: Op - Op containing the Field definition and args
* Region_node - Object for the containing Operation Region
*
* RETURN: Status
*
- * DESCRIPTION: Create a new bank field in the specified operation region
+ * DESCRIPTION: Create a new field in the specified operation region
*
******************************************************************************/
acpi_status
-acpi_ds_create_bank_field (
+acpi_ds_create_field (
acpi_parse_object *op,
acpi_namespace_node *region_node,
acpi_walk_state *walk_state)
{
acpi_status status = AE_AML_ERROR;
acpi_parse_object *arg;
- acpi_namespace_node *register_node;
- acpi_namespace_node *node;
- u32 bank_value;
- u8 field_flags;
- u32 field_bit_position = 0;
+ ACPI_CREATE_FIELD_INFO info;
- FUNCTION_TRACE_PTR ("Ds_create_bank_field", op);
+ FUNCTION_TRACE_PTR ("Ds_create_field", op);
- /* First arg is the name of the parent Op_region */
+ /* First arg is the name of the parent Op_region (must already exist) */
arg = op->value.arg;
if (!region_node) {
}
}
- /* Second arg is the Bank Register */
+ /* Second arg is the field flags */
arg = arg->next;
+ info.field_flags = arg->value.integer8;
- status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
- INTERNAL_TYPE_BANK_FIELD_DEFN, IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- NULL, ®ister_node);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
+ /* Each remaining arg is a Named Field */
- /* Third arg is the Bank_value */
+ info.field_type = INTERNAL_TYPE_REGION_FIELD;
+ info.region_node = region_node;
- arg = arg->next;
- bank_value = arg->value.integer32;
+ status = acpi_ds_get_field_names (&info, walk_state, arg->next);
+ return_ACPI_STATUS (status);
+}
- /* Next arg is the field flags */
- arg = arg->next;
- field_flags = arg->value.integer8;
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ds_create_bank_field
+ *
+ * PARAMETERS: Op - Op containing the Field definition and args
+ * Region_node - Object for the containing Operation Region
+ * ` Walk_state - Current method state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a new bank field in the specified operation region
+ *
+ ******************************************************************************/
- /* Each remaining arg is a Named Field */
+acpi_status
+acpi_ds_create_bank_field (
+ acpi_parse_object *op,
+ acpi_namespace_node *region_node,
+ acpi_walk_state *walk_state)
+{
+ acpi_status status = AE_AML_ERROR;
+ acpi_parse_object *arg;
+ ACPI_CREATE_FIELD_INFO info;
- arg = arg->next;
- while (arg) {
- switch (arg->opcode) {
- case AML_INT_RESERVEDFIELD_OP:
- field_bit_position += arg->value.size;
- break;
+ FUNCTION_TRACE_PTR ("Ds_create_bank_field", op);
- case AML_INT_ACCESSFIELD_OP:
+ /* First arg is the name of the parent Op_region (must already exist) */
- /*
- * Get a new Access_type and Access_attribute for
- * all entries (until end or another Access_as keyword)
- */
- field_flags = (u8) ((field_flags & FIELD_ACCESS_TYPE_MASK) ||
- ((u8) (arg->value.integer >> 8)));
- break;
+ arg = op->value.arg;
+ if (!region_node) {
+ status = acpi_ns_lookup (walk_state->scope_info, arg->value.name,
+ ACPI_TYPE_REGION, IMODE_EXECUTE,
+ NS_SEARCH_PARENT, walk_state, ®ion_node);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+ }
+ /* Second arg is the Bank Register (must already exist) */
- case AML_INT_NAMEDFIELD_OP:
+ arg = arg->next;
+ status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
+ INTERNAL_TYPE_BANK_FIELD_DEFN, IMODE_EXECUTE,
+ NS_SEARCH_PARENT, walk_state, &info.register_node);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
- status = acpi_ns_lookup (walk_state->scope_info,
- (NATIVE_CHAR *) &((acpi_parse2_object *)arg)->name,
- INTERNAL_TYPE_REGION_FIELD, IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- NULL, &node);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
+ /* Third arg is the Bank_value */
- /*
- * Initialize an object for the new Node that is on
- * the object stack
- */
- status = acpi_ex_prep_bank_field_value (node, region_node, register_node,
- bank_value, field_flags, field_bit_position,
- arg->value.size);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
+ arg = arg->next;
+ info.bank_value = arg->value.integer32;
- /* Keep track of bit position for the *next* field */
+ /* Fourth arg is the field flags */
- field_bit_position += arg->value.size;
- break;
+ arg = arg->next;
+ info.field_flags = arg->value.integer8;
- }
+ /* Each remaining arg is a Named Field */
- arg = arg->next;
- }
+ info.field_type = INTERNAL_TYPE_BANK_FIELD;
+ info.region_node = region_node;
+
+ status = acpi_ds_get_field_names (&info, walk_state, arg->next);
return_ACPI_STATUS (status);
}
{
acpi_status status;
acpi_parse_object *arg;
- acpi_namespace_node *node;
- acpi_namespace_node *index_register_node;
- acpi_namespace_node *data_register_node;
- u8 field_flags;
- u32 field_bit_position = 0;
+ ACPI_CREATE_FIELD_INFO info;
FUNCTION_TRACE_PTR ("Ds_create_index_field", op);
- arg = op->value.arg;
-
- /* First arg is the name of the Index register */
+ /* First arg is the name of the Index register (must already exist) */
+ arg = op->value.arg;
status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
- ACPI_TYPE_ANY, IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- NULL, &index_register_node);
+ ACPI_TYPE_ANY, IMODE_EXECUTE,
+ NS_SEARCH_PARENT, walk_state, &info.register_node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
- /* Second arg is the data register */
+ /* Second arg is the data register (must already exist) */
arg = arg->next;
-
status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
- INTERNAL_TYPE_INDEX_FIELD_DEFN, IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- NULL, &data_register_node);
+ INTERNAL_TYPE_INDEX_FIELD_DEFN, IMODE_EXECUTE,
+ NS_SEARCH_PARENT, walk_state, &info.data_register_node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
-
/* Next arg is the field flags */
arg = arg->next;
- field_flags = (u8) arg->value.integer;
+ info.field_flags = arg->value.integer8;
/* Each remaining arg is a Named Field */
- arg = arg->next;
- while (arg) {
- switch (arg->opcode) {
- case AML_INT_RESERVEDFIELD_OP:
-
- field_bit_position += arg->value.size;
- break;
-
-
- case AML_INT_ACCESSFIELD_OP:
-
- /*
- * Get a new Access_type and Access_attribute for all
- * entries (until end or another Access_as keyword)
- */
- field_flags = (u8) ((field_flags & FIELD_ACCESS_TYPE_MASK) ||
- ((u8) (arg->value.integer >> 8)));
- break;
-
+ info.field_type = INTERNAL_TYPE_INDEX_FIELD;
+ info.region_node = region_node;
- case AML_INT_NAMEDFIELD_OP:
-
- status = acpi_ns_lookup (walk_state->scope_info,
- (NATIVE_CHAR *) &((acpi_parse2_object *)arg)->name,
- INTERNAL_TYPE_INDEX_FIELD, IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- NULL, &node);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
- /*
- * Initialize an object for the new Node that is on
- * the object stack
- */
- status = acpi_ex_prep_index_field_value (node, index_register_node,
- data_register_node, field_flags,
- field_bit_position, arg->value.size);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
- /* Keep track of bit position for the *next* field */
-
- field_bit_position += arg->value.size;
- break;
-
-
- default:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n",
- arg->opcode));
- status = AE_AML_ERROR;
- break;
- }
-
- arg = arg->next;
- }
+ status = acpi_ds_get_field_names (&info, walk_state, arg->next);
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
- * $Revision: 65 $
+ * $Revision: 69 $
*
*****************************************************************************/
acpi_parse_object *op;
acpi_namespace_node *node;
acpi_owner_id owner_id;
+ acpi_walk_state *walk_state;
FUNCTION_TRACE_PTR ("Ds_parse_method", obj_handle);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Parsing [%4.4s] **** Named_obj=%p\n",
- &((acpi_namespace_node *)obj_handle)->name, obj_handle));
+ (char*)&((acpi_namespace_node *)obj_handle)->name, obj_handle));
/* Extract the method object from the method Node */
return_ACPI_STATUS (AE_NULL_OBJECT);
}
- /* Create a mutex for the method if there is a concurrency limit */
+ /* Create a mutex for the method if there is a concurrency limit */
if ((obj_desc->method.concurrency != INFINITE_CONCURRENCY) &&
(!obj_desc->method.semaphore)) {
acpi_ps_set_name (op, node->name);
op->node = node;
+ /* Create and initialize a new walk state */
+
+ walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
+ NULL, NULL, NULL);
+ if (!walk_state) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ status = acpi_ds_init_aml_walk (walk_state, op, node, obj_desc->method.aml_start,
+ obj_desc->method.aml_length, NULL, NULL, 1);
+ if (ACPI_FAILURE (status)) {
+ /* TBD: delete walk state */
+ return_ACPI_STATUS (status);
+ }
/*
* Parse the method, first pass
* method so that operands to the named objects can
* take on dynamic run-time values.
*/
- status = acpi_ps_parse_aml (op, obj_desc->method.pcode,
- obj_desc->method.pcode_length,
- ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
- node, NULL, NULL,
- acpi_ds_load1_begin_op, acpi_ds_load1_end_op);
-
+ status = acpi_ps_parse_aml (walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
obj_desc->method.owning_id = owner_id;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** [%4.4s] Parsed **** Named_obj=%p Op=%p\n",
- &((acpi_namespace_node *)obj_handle)->name, obj_handle, op));
-
- /* Install the parsed tree in the method object */
- /* TBD: [Restructure] Obsolete field? */
+ (char*)&((acpi_namespace_node *)obj_handle)->name, obj_handle, op));
acpi_ps_delete_parse_tree (op);
acpi_ds_call_control_method (
acpi_walk_list *walk_list,
acpi_walk_state *this_walk_state,
- acpi_parse_object *op)
+ acpi_parse_object *op) /* TBD: This operand is obsolete */
{
acpi_status status;
acpi_namespace_node *method_node;
acpi_operand_object *obj_desc;
acpi_walk_state *next_walk_state;
- acpi_parse_state *parser_state;
u32 i;
return_ACPI_STATUS (AE_NULL_OBJECT);
}
-
/* Init for new method, wait on concurrency semaphore */
status = acpi_ds_begin_method_execution (method_node, obj_desc,
return_ACPI_STATUS (status);
}
- /* Create and initialize a new parser state */
- parser_state = acpi_ps_create_state (obj_desc->method.pcode,
- obj_desc->method.pcode_length);
- if (!parser_state) {
+ /* 1) Parse: Create a new walk state for the preempting walk */
+
+ next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
+ op, obj_desc, NULL);
+ if (!next_walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
+ goto cleanup;
}
- acpi_ps_init_scope (parser_state, NULL);
- parser_state->start_node = method_node;
-
-
- /* Create a new state for the preempting walk */
+ /* Create and init a Root Node */
- next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
- NULL, obj_desc, walk_list);
- if (!next_walk_state) {
- /* TBD: delete parser state */
+ op = acpi_ps_alloc_op (AML_SCOPE_OP);
+ if (!op) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
- return_ACPI_STATUS (AE_NO_MEMORY);
+ status = acpi_ds_init_aml_walk (next_walk_state, op, method_node,
+ obj_desc->method.aml_start, obj_desc->method.aml_length,
+ NULL, NULL, 1);
+ if (ACPI_FAILURE (status)) {
+ /* TBD: delete walk state */
+ goto cleanup;
}
- next_walk_state->walk_type = WALK_METHOD;
- next_walk_state->method_node = method_node;
- next_walk_state->parser_state = parser_state;
- next_walk_state->parse_flags = this_walk_state->parse_flags;
- next_walk_state->descending_callback = this_walk_state->descending_callback;
- next_walk_state->ascending_callback = this_walk_state->ascending_callback;
+ /* Begin AML parse */
- /* The Next_op of the Next_walk will be the beginning of the method */
- /* TBD: [Restructure] -- obsolete? */
+ status = acpi_ps_parse_aml (next_walk_state);
+ acpi_ps_delete_parse_tree (op);
- next_walk_state->next_op = NULL;
- /* Open a new scope */
+ /* 2) Execute: Create a new state for the preempting walk */
- status = acpi_ds_scope_stack_push (method_node,
- ACPI_TYPE_METHOD, next_walk_state);
- if (ACPI_FAILURE (status)) {
+ next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
+ NULL, obj_desc, walk_list);
+ if (!next_walk_state) {
+ status = AE_NO_MEMORY;
goto cleanup;
}
-
/*
- * Initialize the arguments for the method. The resolved
- * arguments were put on the previous walk state's operand
+ * The resolved arguments were put on the previous walk state's operand
* stack. Operands on the previous walk state stack always
* start at index 0.
+ * Null terminate the list of arguments
*/
- status = acpi_ds_method_data_init_args (&this_walk_state->operands[0],
- this_walk_state->num_operands,
- next_walk_state);
+ this_walk_state->operands [this_walk_state->num_operands] = NULL;
+
+ status = acpi_ds_init_aml_walk (next_walk_state, NULL, method_node,
+ obj_desc->method.aml_start, obj_desc->method.aml_length,
+ &this_walk_state->operands[0], NULL, 3);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
-
- /* Create and init a Root Node */
-
- op = acpi_ps_alloc_op (AML_SCOPE_OP);
- if (!op) {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- status = acpi_ps_parse_aml (op, obj_desc->method.pcode,
- obj_desc->method.pcode_length,
- ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
- method_node, NULL, NULL,
- acpi_ds_load1_begin_op, acpi_ds_load1_end_op);
- acpi_ps_delete_parse_tree (op);
-
-
/*
* Delete the operands on the previous walkstate operand stack
* (they were copied to new objects)
this_walk_state->num_operands = 0;
-
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Starting nested execution, newstate=%p\n",
next_walk_state));
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
- * $Revision: 75 $
+ * $Revision: 81 $
*
*****************************************************************************/
{
acpi_object_type8 type;
acpi_status status;
- ACPI_INIT_WALK_INFO *info = (ACPI_INIT_WALK_INFO *) context;
+ acpi_init_walk_info *info = (acpi_init_walk_info *) context;
u8 table_revision;
* Always parse methods to detect errors, we may delete
* the parse tree below
*/
-
status = acpi_ds_parse_method (obj_handle);
-
- /* TBD: [Errors] what do we do with an error? */
-
if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] parse failed! %s\n",
- obj_handle, &((acpi_namespace_node *)obj_handle)->name,
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n",
+ obj_handle, (char*)&((acpi_namespace_node *)obj_handle)->name,
acpi_format_exception (status)));
+
+ /* This parse failed, but we will continue parsing more methods */
+
break;
}
acpi_namespace_node *start_node)
{
acpi_status status;
- ACPI_INIT_WALK_INFO info;
+ acpi_init_walk_info info;
FUNCTION_TRACE ("Ds_initialize_objects");
obj_desc = *ret_obj_desc;
op_info = acpi_ps_get_opcode_info (opcode);
- if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
+ if (op_info->class == AML_CLASS_UNKNOWN) {
/* Unknown opcode */
return (AE_TYPE);
byte_list = (acpi_parse2_object *) arg->next;
if (byte_list) {
if (byte_list->opcode != AML_INT_BYTELIST_OP) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Expecting bytelist, got: %x\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Expecting bytelist, got: %p\n",
byte_list));
return (AE_TYPE);
}
case INTERNAL_TYPE_REFERENCE:
- switch (ACPI_GET_OP_CLASS (op_info)) {
- case OPTYPE_LOCAL_VARIABLE:
+ switch (op_info->type) {
+ case AML_TYPE_LOCAL_VARIABLE:
/* Split the opcode into a base opcode + offset */
break;
- case OPTYPE_METHOD_ARGUMENT:
+ case AML_TYPE_METHOD_ARGUMENT:
/* Split the opcode into a base opcode + offset */
FUNCTION_TRACE_PTR ("Ds_create_node", op);
+ /*
+ * Because of the execution pass through the non-control-method
+ * parts of the table, we can arrive here twice. Only init
+ * the named object node the first time through
+ */
+ if (node->object) {
+ return_ACPI_STATUS (AE_OK);
+ }
+
if (!op->value.arg) {
/* No arguments, there is nothing to do */
/* Init obj */
status = acpi_ns_attach_object (node, obj_desc, (u8) node->type);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
-
- return_ACPI_STATUS (status);
-
-cleanup:
+ /* Remove local reference to the object */
acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
- * $Revision: 52 $
+ * $Revision: 56 $
*
*****************************************************************************/
acpi_parse_object *field_op;
acpi_status status;
acpi_table_desc *table_desc;
+ acpi_walk_state *walk_state;
FUNCTION_TRACE_PTR ("Ds_get_buffer_field_arguments", obj_desc);
DEBUG_EXEC(acpi_ut_display_init_pathname (node, " [Field]"));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] Buffer_field JIT Init\n",
- &node->name));
+ (char*)&node->name));
/*
return_ACPI_STATUS (status);
}
+ /* Create and initialize a new parser state */
+
+ walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
+ NULL, NULL, NULL);
+ if (!walk_state) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ status = acpi_ds_init_aml_walk (walk_state, op, NULL, extra_desc->extra.aml_start,
+ extra_desc->extra.aml_length, NULL, NULL, 1);
+ if (ACPI_FAILURE (status)) {
+ /* TBD: delete walk state */
+ return_ACPI_STATUS (status);
+ }
+
+ /* TBD: No Walk flags?? */
+
+ walk_state->parse_flags = 0;
+
/* Pass1: Parse the entire Buffer_field declaration */
- status = acpi_ps_parse_aml (op, extra_desc->extra.pcode,
- extra_desc->extra.pcode_length, 0,
- NULL, NULL, NULL, acpi_ds_load1_begin_op, acpi_ds_load1_end_op);
+ status = acpi_ps_parse_aml (walk_state);
if (ACPI_FAILURE (status)) {
acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
}
- /* Get and init the actual Fiel_unit_op created above */
+ /* Get and init the actual Field_unit Op created above */
field_op = op->value.arg;
op->node = node;
field_op->node = node;
acpi_ps_delete_parse_tree (op);
- /* Acpi_evaluate the address and length arguments for the Op_region */
+ /* Evaluate the address and length arguments for the Op_region */
op = acpi_ps_alloc_op (AML_SCOPE_OP);
if (!op) {
op->node = acpi_ns_get_parent_object (node);
- status = acpi_ps_parse_aml (op, extra_desc->extra.pcode,
- extra_desc->extra.pcode_length,
- ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE,
- NULL /*Method_desc*/, NULL, NULL,
- acpi_ds_exec_begin_op, acpi_ds_exec_end_op);
- /* All done with the parse tree, delete it */
+ /* Create and initialize a new parser state */
- acpi_ps_delete_parse_tree (op);
+ walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
+ NULL, NULL, NULL);
+ if (!walk_state) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+ status = acpi_ds_init_aml_walk (walk_state, op, NULL, extra_desc->extra.aml_start,
+ extra_desc->extra.aml_length, NULL, NULL, 3);
+ if (ACPI_FAILURE (status)) {
+ /* TBD: delete walk state */
+ return_ACPI_STATUS (status);
+ }
+
+ status = acpi_ps_parse_aml (walk_state);
+ acpi_ps_delete_parse_tree (op);
/*
* The pseudo-method object is no longer needed since the region is
acpi_parse_object *region_op;
acpi_status status;
acpi_table_desc *table_desc;
+ acpi_walk_state *walk_state;
FUNCTION_TRACE_PTR ("Ds_get_region_arguments", obj_desc);
DEBUG_EXEC(acpi_ut_display_init_pathname (node, " [Operation Region]"));
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] Op_region Init at AML %p[%x]\n",
- &node->name, extra_desc->extra.pcode,
- *(u32*) extra_desc->extra.pcode));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] Op_region Init at AML %p\n",
+ (char*)&node->name, extra_desc->extra.aml_start));
/*
* Allocate a new parser op to be the root of the parsed
return_ACPI_STATUS (status);
}
+ /* Create and initialize a new parser state */
+
+ walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
+ op, NULL, NULL);
+ if (!walk_state) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ status = acpi_ds_init_aml_walk (walk_state, op, NULL, extra_desc->extra.aml_start,
+ extra_desc->extra.aml_length, NULL, NULL, 1);
+ if (ACPI_FAILURE (status)) {
+ /* TBD: delete walk state */
+ return_ACPI_STATUS (status);
+ }
+
+ /* TBD: No Walk flags?? */
+
+ walk_state->parse_flags = 0;
+
/* Parse the entire Op_region declaration, creating a parse tree */
- status = acpi_ps_parse_aml (op, extra_desc->extra.pcode,
- extra_desc->extra.pcode_length, 0,
- NULL, NULL, NULL, acpi_ds_load1_begin_op, acpi_ds_load1_end_op);
+ status = acpi_ps_parse_aml (walk_state);
if (ACPI_FAILURE (status)) {
acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
op->node = acpi_ns_get_parent_object (node);
- status = acpi_ps_parse_aml (op, extra_desc->extra.pcode,
- extra_desc->extra.pcode_length,
- ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE,
- NULL /*Method_desc*/, NULL, NULL,
- acpi_ds_exec_begin_op, acpi_ds_exec_end_op);
+ /* Create and initialize a new parser state */
+
+ walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
+ op, NULL, NULL);
+ if (!walk_state) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
- /* All done with the parse tree, delete it */
+ status = acpi_ds_init_aml_walk (walk_state, op, NULL, extra_desc->extra.aml_start,
+ extra_desc->extra.aml_length, NULL, NULL, 3);
+ if (ACPI_FAILURE (status)) {
+ /* TBD: delete walk state */
+ return_ACPI_STATUS (status);
+ }
+ status = acpi_ps_parse_aml (walk_state);
acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
acpi_ut_remove_reference (operand_desc);
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Rgn_obj %p Addr %8.8lX%8.8lX Len %X\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Rgn_obj %p Addr %8.8X%8.8X Len %X\n",
obj_desc, HIDWORD(obj_desc->region.address), LODWORD(obj_desc->region.address),
obj_desc->region.length));
* of a loop
*/
walk_state->control_state->control.aml_predicate_start =
- walk_state->parser_state->aml - 1;
+ walk_state->parser_state.aml - 1;
/* TBD: can this be removed? */
/*Acpi_ps_pkg_length_encoding_size (GET8 (Walk_state->Parser_state->Aml));*/
break;
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
- * $Revision: 72 $
+ * $Revision: 80 $
*
******************************************************************************/
*/
parent_info = acpi_ps_get_opcode_info (op->parent->opcode);
- if (ACPI_GET_OP_TYPE (parent_info) != ACPI_OP_TYPE_OPCODE) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%X\n", op));
+ if (parent_info->class == AML_CLASS_UNKNOWN) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", op));
return_VALUE (FALSE);
}
* Otherwise leave it as is, it will be deleted when it is used
* as an operand later.
*/
- switch (ACPI_GET_OP_CLASS (parent_info)) {
+ switch (parent_info->class) {
/*
* In these cases, the parent will never use the return object
*/
- case OPTYPE_CONTROL: /* IF, ELSE, WHILE only */
+ case AML_CLASS_CONTROL: /* IF, ELSE, WHILE only */
switch (op->parent->opcode) {
case AML_RETURN_OP:
/* Never delete the return value associated with a return opcode */
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Result used, [RETURN] opcode=%X Op=%X\n", op->opcode, op));
+ "Result used, [RETURN] opcode=%X Op=%p\n", op->opcode, op));
return_VALUE (TRUE);
break;
if ((walk_state->control_state->common.state == CONTROL_PREDICATE_EXECUTING) &&
(walk_state->control_state->control.predicate_op == op)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Result used as a predicate, [IF/WHILE] opcode=%X Op=%X\n",
+ "Result used as a predicate, [IF/WHILE] opcode=%X Op=%p\n",
op->opcode, op));
return_VALUE (TRUE);
}
/* Fall through to not used case below */
- case OPTYPE_NAMED_OBJECT: /* Scope, method, etc. */
+ case AML_CLASS_NAMED_OBJECT: /* Scope, method, etc. */
+ case AML_CLASS_CREATE:
/*
* These opcodes allow Term_arg(s) as operands and therefore
(op->parent->opcode == AML_CREATE_DWORD_FIELD_OP) ||
(op->parent->opcode == AML_CREATE_QWORD_FIELD_OP)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Result used, [Region or Create_field] opcode=%X Op=%X\n",
+ "Result used, [Region or Create_field] opcode=%X Op=%p\n",
op->opcode, op));
return_VALUE (TRUE);
}
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Result not used, Parent opcode=%X Op=%X\n", op->opcode, op));
+ "Result not used, Parent opcode=%X Op=%p\n", op->opcode, op));
return_VALUE (FALSE);
break;
* very serious error at this point
*/
status = AE_AML_NAME_NOT_FOUND;
+
+ /* TBD: Externalize Name_string and print */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Object name was not found in namespace\n"));
}
}
op_info = acpi_ps_get_opcode_info (opcode);
- if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
+ if (op_info->class == AML_CLASS_UNKNOWN) {
/* Unknown opcode */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode: %x\n", opcode));
return (data_type);
}
- switch (ACPI_GET_OP_CLASS (op_info)) {
- case OPTYPE_LITERAL:
+/*
+ * TBD: Use op class
+ */
+
+ switch (op_info->type) {
+
+ case AML_TYPE_LITERAL:
switch (opcode) {
case AML_BYTE_OP:
break;
- case OPTYPE_DATA_TERM:
+ case AML_TYPE_DATA_TERM:
switch (opcode) {
case AML_BUFFER_OP:
break;
- case OPTYPE_CONSTANT:
- case OPTYPE_METHOD_ARGUMENT:
- case OPTYPE_LOCAL_VARIABLE:
+ case AML_TYPE_CONSTANT:
+ case AML_TYPE_METHOD_ARGUMENT:
+ case AML_TYPE_LOCAL_VARIABLE:
data_type = INTERNAL_TYPE_REFERENCE;
break;
- case OPTYPE_MONADIC2:
- case OPTYPE_MONADIC2_r:
- case OPTYPE_DYADIC2:
- case OPTYPE_DYADIC2_r:
- case OPTYPE_DYADIC2_s:
- case OPTYPE_TRIADIC:
- case OPTYPE_QUADRADIC:
- case OPTYPE_HEXADIC:
- case OPTYPE_RETURN:
+ case AML_TYPE_EXEC_1A_0T_1R:
+ case AML_TYPE_EXEC_1A_1T_1R:
+ case AML_TYPE_EXEC_2A_0T_1R:
+ case AML_TYPE_EXEC_2A_1T_1R:
+ case AML_TYPE_EXEC_2A_2T_1R:
+ case AML_TYPE_EXEC_3A_1T_1R:
+ case AML_TYPE_EXEC_6A_0T_1R:
+ case AML_TYPE_RETURN:
flags = OP_HAS_RETURN_VALUE;
data_type = ACPI_TYPE_ANY;
break;
- case OPTYPE_METHOD_CALL:
+ case AML_TYPE_METHOD_CALL:
flags = OP_HAS_RETURN_VALUE;
data_type = ACPI_TYPE_METHOD;
break;
- case OPTYPE_NAMED_OBJECT:
+ case AML_TYPE_NAMED_FIELD:
+ case AML_TYPE_NAMED_SIMPLE:
+ case AML_TYPE_NAMED_COMPLEX:
+ case AML_TYPE_NAMED_NO_OBJ:
data_type = acpi_ds_map_named_opcode_to_data_type (opcode);
break;
- case OPTYPE_DYADIC1:
- case OPTYPE_CONTROL:
+ case AML_TYPE_EXEC_1A_0T_0R:
+ case AML_TYPE_EXEC_2A_0T_0R:
+ case AML_TYPE_EXEC_3A_0T_0R:
+ case AML_TYPE_EXEC_1A_1T_0R:
+ case AML_TYPE_CONTROL:
/* No mapping needed at this time */
data_type = ACPI_TYPE_EVENT;
break;
+ case AML_DATA_REGION_OP:
case AML_REGION_OP:
data_type = ACPI_TYPE_REGION;
break;
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
- * $Revision: 70 $
+ * $Revision: 79 $
*
*****************************************************************************/
#define _COMPONENT ACPI_DISPATCHER
MODULE_NAME ("dswexec")
+/*
+ * Dispatch tables for opcode classes
+ */
+ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
+ acpi_ex_opcode_1A_0T_0R,
+ acpi_ex_opcode_1A_0T_1R,
+ acpi_ex_opcode_1A_1T_0R,
+ acpi_ex_opcode_1A_1T_1R,
+ acpi_ex_opcode_2A_0T_0R,
+ acpi_ex_opcode_2A_0T_1R,
+ acpi_ex_opcode_2A_1T_1R,
+ acpi_ex_opcode_2A_2T_1R,
+ acpi_ex_opcode_3A_0T_0R,
+ acpi_ex_opcode_3A_1T_1R,
+ acpi_ex_opcode_6A_0T_1R};
/*****************************************************************************
*
acpi_status
acpi_ds_get_predicate_value (
acpi_walk_state *walk_state,
- acpi_parse_object *op,
- u32 has_result_obj)
-{
+ u32 has_result_obj) {
acpi_status status = AE_OK;
acpi_operand_object *obj_desc;
}
else {
- status = acpi_ds_create_operand (walk_state, op, 0);
+ status = acpi_ds_create_operand (walk_state, walk_state->op, 0);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
}
if (!obj_desc) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No predicate Obj_desc=%X State=%X\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No predicate Obj_desc=%p State=%p\n",
obj_desc, walk_state));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
*/
if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Bad predicate (not a number) Obj_desc=%X State=%X Type=%X\n",
+ "Bad predicate (not a number) Obj_desc=%p State=%p Type=%X\n",
obj_desc, walk_state, obj_desc->common.type));
status = AE_AML_OPERAND_TYPE;
cleanup:
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%X\n",
- walk_state->control_state->common.value, op));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%pn",
+ walk_state->control_state->common.value, walk_state->op));
/* Break to debugger to display result */
* FUNCTION: Acpi_ds_exec_begin_op
*
* PARAMETERS: Walk_state - Current state of the parse tree walk
- * Op - Op that has been just been reached in the
- * walk; Arguments have not been evaluated yet.
+ * Out_op - Return op if a new one is created
*
* RETURN: Status
*
acpi_status
acpi_ds_exec_begin_op (
- u16 opcode,
- acpi_parse_object *op,
acpi_walk_state *walk_state,
acpi_parse_object **out_op)
{
- const acpi_opcode_info *op_info;
+ acpi_parse_object *op;
acpi_status status = AE_OK;
- u8 opcode_class;
+ u32 opcode_class;
- FUNCTION_TRACE_PTR ("Ds_exec_begin_op", op);
+ FUNCTION_TRACE_PTR ("Ds_exec_begin_op", walk_state);
+ op = walk_state->op;
if (!op) {
- status = acpi_ds_load2_begin_op (opcode, NULL, walk_state, out_op);
+ status = acpi_ds_load2_begin_op (walk_state, out_op);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
op = *out_op;
+ walk_state->op = op;
+ walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
+ walk_state->opcode = op->opcode;
}
if (op == walk_state->origin) {
if ((walk_state->control_state) &&
(walk_state->control_state->common.state ==
CONTROL_CONDITIONAL_EXECUTING)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%X State=%X\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n",
op, walk_state));
walk_state->control_state->common.state = CONTROL_PREDICATE_EXECUTING;
}
- op_info = acpi_ps_get_opcode_info (op->opcode);
- opcode_class = (u8) ACPI_GET_OP_CLASS (op_info);
+ opcode_class = walk_state->op_info->class;
/* We want to send namepaths to the load code */
if (op->opcode == AML_INT_NAMEPATH_OP) {
- opcode_class = OPTYPE_NAMED_OBJECT;
+ opcode_class = AML_CLASS_NAMED_OBJECT;
}
/*
* Handle the opcode based upon the opcode type
*/
switch (opcode_class) {
- case OPTYPE_CONTROL:
+ case AML_CLASS_CONTROL:
status = acpi_ds_result_stack_push (walk_state);
if (ACPI_FAILURE (status)) {
break;
- case OPTYPE_NAMED_OBJECT:
+ case AML_CLASS_NAMED_OBJECT:
if (walk_state->walk_type == WALK_METHOD) {
/*
* will be deleted upon completion of the execution
* of this method.
*/
- status = acpi_ds_load2_begin_op (op->opcode, op, walk_state, NULL);
+ status = acpi_ds_load2_begin_op (walk_state, NULL);
}
/* most operators with arguments */
- case OPTYPE_MONADIC1:
- case OPTYPE_DYADIC1:
- case OPTYPE_MONADIC2:
- case OPTYPE_MONADIC2_r:
- case OPTYPE_DYADIC2:
- case OPTYPE_DYADIC2_r:
- case OPTYPE_DYADIC2_s:
- case OPTYPE_RECONFIGURATION:
- case OPTYPE_TRIADIC:
- case OPTYPE_QUADRADIC:
- case OPTYPE_HEXADIC:
- case OPTYPE_CREATE_FIELD:
+ case AML_CLASS_EXECUTE:
+ case AML_CLASS_CREATE:
/* Start a new result/operand state */
acpi_status
acpi_ds_exec_end_op (
- acpi_walk_state *walk_state,
- acpi_parse_object *op)
+ acpi_walk_state *walk_state)
{
+ acpi_parse_object *op;
acpi_status status = AE_OK;
- u16 opcode;
- u8 optype;
+ u32 op_type;
+ u32 op_class;
acpi_parse_object *next_op;
acpi_parse_object *first_arg;
- acpi_operand_object *result_obj = NULL;
- const acpi_opcode_info *op_info;
u32 i;
- FUNCTION_TRACE_PTR ("Ds_exec_end_op", op);
-
+ FUNCTION_TRACE_PTR ("Ds_exec_end_op", walk_state);
- opcode = (u16) op->opcode;
+ op = walk_state->op;
+ op_type = walk_state->op_info->type;
+ op_class = walk_state->op_info->class;
- op_info = acpi_ps_get_opcode_info (op->opcode);
- if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
+ if (op_class == AML_CLASS_UNKNOWN) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", op->opcode));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
- optype = (u8) ACPI_GET_OP_CLASS (op_info);
first_arg = op->value.arg;
/* Init the walk state */
walk_state->num_operands = 0;
walk_state->return_desc = NULL;
- walk_state->op_info = op_info;
- walk_state->opcode = opcode;
+ walk_state->result_obj = NULL;
/* Call debugger for single step support (DEBUG build only) */
- DEBUGGER_EXEC (status = acpi_db_single_step (walk_state, op, optype));
+ DEBUGGER_EXEC (status = acpi_db_single_step (walk_state, op, op_class));
DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status);});
- /* Decode the opcode */
-
- switch (optype) {
- case OPTYPE_UNDEFINED:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%X\n", op));
- return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
- break;
-
-
- case OPTYPE_BOGUS:
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Internal opcode=%X type Op=%X\n",
- opcode, op));
- break;
+ switch (op_class) {
+ /* Decode the Opcode Class */
- case OPTYPE_CONSTANT: /* argument type only */
- case OPTYPE_LITERAL: /* argument type only */
- case OPTYPE_DATA_TERM: /* argument type only */
- case OPTYPE_LOCAL_VARIABLE: /* argument type only */
- case OPTYPE_METHOD_ARGUMENT: /* argument type only */
+ case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */
break;
-
/* most operators with arguments */
- case OPTYPE_MONADIC1:
- case OPTYPE_DYADIC1:
- case OPTYPE_MONADIC2:
- case OPTYPE_MONADIC2_r:
- case OPTYPE_DYADIC2:
- case OPTYPE_DYADIC2_r:
- case OPTYPE_DYADIC2_s:
- case OPTYPE_RECONFIGURATION:
- case OPTYPE_TRIADIC:
- case OPTYPE_QUADRADIC:
- case OPTYPE_HEXADIC:
-
+ case AML_CLASS_EXECUTE:
/* Build resolved operand stack */
/* Resolve all operands */
- status = acpi_ex_resolve_operands (opcode,
+ status = acpi_ex_resolve_operands (walk_state->opcode,
&(walk_state->operands [walk_state->num_operands -1]),
walk_state);
if (ACPI_FAILURE (status)) {
/* TBD: must pop and delete operands */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "[%s]: Could not resolve operands, %s\n",
- acpi_ps_get_opcode_name (opcode), acpi_format_exception (status)));
+ acpi_ps_get_opcode_name (walk_state->opcode), acpi_format_exception (status)));
/*
* On error, we must delete all the operands and clear the
}
walk_state->num_operands = 0;
-
goto cleanup;
}
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, acpi_ps_get_opcode_name (opcode),
+ DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, acpi_ps_get_opcode_name (walk_state->opcode),
walk_state->num_operands, "after Ex_resolve_operands");
- switch (optype) {
- case OPTYPE_MONADIC1:
-
- /* 1 Operand, 0 External_result, 0 Internal_result */
-
- status = acpi_ex_monadic1 (opcode, walk_state);
- break;
-
-
- case OPTYPE_MONADIC2:
-
- /* 1 Operand, 0 External_result, 1 Internal_result */
-
- status = acpi_ex_monadic2 (opcode, walk_state, &result_obj);
- break;
-
-
- case OPTYPE_MONADIC2_r:
-
- /* 1 Operand, 1 External_result, 1 Internal_result */
-
- status = acpi_ex_monadic2_r (opcode, walk_state, &result_obj);
- break;
-
-
- case OPTYPE_DYADIC1:
-
- /* 2 Operands, 0 External_result, 0 Internal_result */
-
- status = acpi_ex_dyadic1 (opcode, walk_state);
- break;
-
-
- case OPTYPE_DYADIC2:
-
- /* 2 Operands, 0 External_result, 1 Internal_result */
-
- status = acpi_ex_dyadic2 (opcode, walk_state, &result_obj);
- break;
-
-
- case OPTYPE_DYADIC2_r:
-
- /* 2 Operands, 1 or 2 External_results, 1 Internal_result */
-
- status = acpi_ex_dyadic2_r (opcode, walk_state, &result_obj);
- break;
-
-
- case OPTYPE_DYADIC2_s: /* Synchronization Operator */
-
- /* 2 Operands, 0 External_result, 1 Internal_result */
-
- status = acpi_ex_dyadic2_s (opcode, walk_state, &result_obj);
- break;
-
-
- case OPTYPE_TRIADIC: /* Opcode with 3 operands */
-
- /* 3 Operands, 1 External_result, 1 Internal_result */
-
- status = acpi_ex_triadic (opcode, walk_state, &result_obj);
- break;
-
-
- case OPTYPE_QUADRADIC: /* Opcode with 4 operands */
- break;
-
-
- case OPTYPE_HEXADIC: /* Opcode with 6 operands */
-
- /* 6 Operands, 0 External_result, 1 Internal_result */
-
- status = acpi_ex_hexadic (opcode, walk_state, &result_obj);
- break;
-
-
- case OPTYPE_RECONFIGURATION:
-
- /* 1 or 2 operands, 0 Internal Result */
+ /*
+ * Dispatch the request to the appropriate interpreter handler
+ * routine. There is one routine per opcode "type" based upon the
+ * number of opcode arguments and return type.
+ */
+ status = acpi_gbl_op_type_dispatch [op_type] (walk_state);
- status = acpi_ex_reconfiguration (opcode, walk_state);
- break;
- }
- /* Clear the operand stack */
+ /* Delete argument objects and clear the operand stack */
for (i = 0; i < walk_state->num_operands; i++) {
+ /*
+ * Remove a reference to all operands, including both
+ * "Arguments" and "Targets".
+ */
+ acpi_ut_remove_reference (walk_state->operands[i]);
walk_state->operands[i] = NULL;
}
+
walk_state->num_operands = 0;
/*
* current result stack
*/
if (ACPI_SUCCESS (status) &&
- result_obj) {
- status = acpi_ds_result_push (result_obj, walk_state);
+ walk_state->result_obj) {
+ status = acpi_ds_result_push (walk_state->result_obj, walk_state);
}
break;
- case OPTYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
+ default:
- /* 1 Operand, 0 External_result, 0 Internal_result */
+ switch (op_type) {
+ case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
- status = acpi_ds_exec_end_control_op (walk_state, op);
+ /* 1 Operand, 0 External_result, 0 Internal_result */
- acpi_ds_result_stack_pop (walk_state);
- break;
+ status = acpi_ds_exec_end_control_op (walk_state, op);
+ acpi_ds_result_stack_pop (walk_state);
+ break;
- case OPTYPE_METHOD_CALL:
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%X\n", op));
+ case AML_TYPE_METHOD_CALL:
- /*
- * (AML_METHODCALL) Op->Value->Arg->Node contains
- * the method Node pointer
- */
- /* Next_op points to the op that holds the method name */
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", op));
- next_op = first_arg;
+ /*
+ * (AML_METHODCALL) Op->Value->Arg->Node contains
+ * the method Node pointer
+ */
+ /* Next_op points to the op that holds the method name */
- /* Next_op points to first argument op */
+ next_op = first_arg;
- next_op = next_op->next;
+ /* Next_op points to first argument op */
- /*
- * Get the method's arguments and put them on the operand stack
- */
- status = acpi_ds_create_operands (walk_state, next_op);
- if (ACPI_FAILURE (status)) {
- break;
- }
-
- /*
- * Since the operands will be passed to another
- * control method, we must resolve all local
- * references here (Local variables, arguments
- * to *this* method, etc.)
- */
- status = acpi_ds_resolve_operands (walk_state);
- if (ACPI_FAILURE (status)) {
- break;
- }
-
- /*
- * Tell the walk loop to preempt this running method and
- * execute the new method
- */
- status = AE_CTRL_TRANSFER;
-
- /*
- * Return now; we don't want to disturb anything,
- * especially the operand count!
- */
- return_ACPI_STATUS (status);
- break;
+ next_op = next_op->next;
+ /*
+ * Get the method's arguments and put them on the operand stack
+ */
+ status = acpi_ds_create_operands (walk_state, next_op);
+ if (ACPI_FAILURE (status)) {
+ break;
+ }
- case OPTYPE_CREATE_FIELD:
+ /*
+ * Since the operands will be passed to another
+ * control method, we must resolve all local
+ * references here (Local variables, arguments
+ * to *this* method, etc.)
+ */
+ status = acpi_ds_resolve_operands (walk_state);
+ if (ACPI_FAILURE (status)) {
+ break;
+ }
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Executing Create_field Buffer/Index Op=%X\n", op));
+ /*
+ * Tell the walk loop to preempt this running method and
+ * execute the new method
+ */
+ status = AE_CTRL_TRANSFER;
- status = acpi_ds_load2_end_op (walk_state, op);
- if (ACPI_FAILURE (status)) {
+ /*
+ * Return now; we don't want to disturb anything,
+ * especially the operand count!
+ */
+ return_ACPI_STATUS (status);
break;
- }
- status = acpi_ds_eval_buffer_field_operands (walk_state, op);
- break;
+ case AML_TYPE_CREATE_FIELD:
- case OPTYPE_NAMED_OBJECT:
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Executing Create_field Buffer/Index Op=%p\n", op));
- status = acpi_ds_load2_end_op (walk_state, op);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ds_load2_end_op (walk_state);
+ if (ACPI_FAILURE (status)) {
+ break;
+ }
+
+ status = acpi_ds_eval_buffer_field_operands (walk_state, op);
break;
- }
- switch (op->opcode) {
- case AML_REGION_OP:
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Executing Op_region Address/Length Op=%X\n", op));
+ case AML_TYPE_NAMED_FIELD:
+ case AML_TYPE_NAMED_COMPLEX:
+ case AML_TYPE_NAMED_SIMPLE:
- status = acpi_ds_eval_region_operands (walk_state, op);
+ status = acpi_ds_load2_end_op (walk_state);
if (ACPI_FAILURE (status)) {
break;
}
- status = acpi_ds_result_stack_pop (walk_state);
- break;
+ if (op->opcode == AML_REGION_OP) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Executing Op_region Address/Length Op=%p\n", op));
+ status = acpi_ds_eval_region_operands (walk_state, op);
+ if (ACPI_FAILURE (status)) {
+ break;
+ }
- case AML_METHOD_OP:
- break;
+ status = acpi_ds_result_stack_pop (walk_state);
+ }
+ break;
- case AML_ALIAS_OP:
+ case AML_TYPE_UNDEFINED:
- /* Alias creation was already handled by call
- to psxload above */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%p\n", op));
+ return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
break;
- default:
- /* Nothing needs to be done */
-
- status = AE_OK;
+ case AML_TYPE_BOGUS:
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Internal opcode=%X type Op=%p\n",
+ walk_state->opcode, op));
break;
- }
-
- break;
- default:
+ default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unimplemented opcode, type=%X Opcode=%X Op=%X\n",
- optype, op->opcode, op));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
+ op_class, op_type, op->opcode, op));
- status = AE_NOT_IMPLEMENTED;
- break;
+ status = AE_NOT_IMPLEMENTED;
+ break;
+ }
}
-
/*
* ACPI 2.0 support for 64-bit integers:
* Truncate numeric result value if we are executing from a 32-bit ACPI table
*/
- acpi_ex_truncate_for32bit_table (result_obj, walk_state);
+ acpi_ex_truncate_for32bit_table (walk_state->result_obj, walk_state);
/*
* Check if we just completed the evaluation of a
(walk_state->control_state->common.state ==
CONTROL_PREDICATE_EXECUTING) &&
(walk_state->control_state->control.predicate_op == op)) {
- status = acpi_ds_get_predicate_value (walk_state, op, (u32) result_obj);
- result_obj = NULL;
+ status = acpi_ds_get_predicate_value (walk_state, (u32) walk_state->result_obj);
+ walk_state->result_obj = NULL;
}
cleanup:
- if (result_obj) {
+ if (walk_state->result_obj) {
/* Break to debugger to display result */
- DEBUGGER_EXEC (acpi_db_display_result_object (result_obj, walk_state));
+ DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, walk_state));
/*
* Delete the result op if and only if:
* Parent will not use the result -- such as any
* non-nested type2 op in a method (parent will be method)
*/
- acpi_ds_delete_result_if_not_used (op, result_obj, walk_state);
+ acpi_ds_delete_result_if_not_used (op, walk_state->result_obj, walk_state);
}
/* Always clear the object stack */
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
- * $Revision: 44 $
+ * $Revision: 50 $
*
*****************************************************************************/
MODULE_NAME ("dswload")
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ds_init_callbacks
+ *
+ * PARAMETERS: Walk_state - Current state of the parse tree walk
+ * Pass_number - 1, 2, or 3
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Init walk state callbacks
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ds_init_callbacks (
+ acpi_walk_state *walk_state,
+ u32 pass_number)
+{
+
+ switch (pass_number) {
+ case 1:
+ walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE;
+ walk_state->descending_callback = acpi_ds_load1_begin_op;
+ walk_state->ascending_callback = acpi_ds_load1_end_op;
+ break;
+
+ case 2:
+ walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE;
+ walk_state->descending_callback = acpi_ds_load2_begin_op;
+ walk_state->ascending_callback = acpi_ds_load2_end_op;
+ break;
+
+ case 3:
+ walk_state->parse_flags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE;
+ walk_state->descending_callback = acpi_ds_exec_begin_op;
+ walk_state->ascending_callback = acpi_ds_exec_end_op;
+ break;
+
+ default:
+ return (AE_BAD_PARAMETER);
+ break;
+ }
+
+ return (AE_OK);
+}
+
+
/*******************************************************************************
*
* FUNCTION: Acpi_ds_load1_begin_op
acpi_status
acpi_ds_load1_begin_op (
- u16 opcode,
- acpi_parse_object *op,
acpi_walk_state *walk_state,
acpi_parse_object **out_op)
{
+ acpi_parse_object *op;
acpi_namespace_node *node;
acpi_status status;
acpi_object_type8 data_type;
NATIVE_CHAR *path;
- const acpi_opcode_info *op_info;
PROC_NAME ("Ds_load1_begin_op");
+
+ op = walk_state->op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
/* We are only interested in opcodes that have an associated name */
- op_info = acpi_ps_get_opcode_info (opcode);
- if (!(op_info->flags & AML_NAMED)) {
- *out_op = op;
- return (AE_OK);
- }
+ if (walk_state->op) {
+ if (!(walk_state->op_info->flags & AML_NAMED)) {
+ *out_op = op;
+ return (AE_OK);
+ }
- /* Check if this object has already been installed in the namespace */
+ /* Check if this object has already been installed in the namespace */
- if (op && op->node) {
- *out_op = op;
- return (AE_OK);
+ if (op->node) {
+ *out_op = op;
+ return (AE_OK);
+ }
}
- path = acpi_ps_get_next_namestring (walk_state->parser_state);
+ path = acpi_ps_get_next_namestring (&walk_state->parser_state);
/* Map the raw opcode into an internal object type */
- data_type = acpi_ds_map_named_opcode_to_data_type (opcode);
+ data_type = acpi_ds_map_named_opcode_to_data_type (walk_state->opcode);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"State=%p Op=%p Type=%x\n", walk_state, op, data_type));
- if (opcode == AML_SCOPE_OP) {
+ if (walk_state->opcode == AML_SCOPE_OP) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"State=%p Op=%p Type=%x\n", walk_state, op, data_type));
}
if (!op) {
/* Create a new op */
- op = acpi_ps_alloc_op (opcode);
+ op = acpi_ps_alloc_op (walk_state->opcode);
if (!op) {
return (AE_NO_MEMORY);
}
* can get it again quickly when this scope is closed
*/
op->node = node;
- acpi_ps_append_arg (acpi_ps_get_parent_scope (walk_state->parser_state), op);
+ acpi_ps_append_arg (acpi_ps_get_parent_scope (&walk_state->parser_state), op);
*out_op = op;
return (status);
acpi_status
acpi_ds_load1_end_op (
- acpi_walk_state *walk_state,
- acpi_parse_object *op)
+ acpi_walk_state *walk_state)
{
+ acpi_parse_object *op;
acpi_object_type8 data_type;
- const acpi_opcode_info *op_info;
PROC_NAME ("Ds_load1_end_op");
+
+ op = walk_state->op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
/* We are only interested in opcodes that have an associated name */
- op_info = acpi_ps_get_opcode_info (op->opcode);
- if (!(op_info->flags & AML_NAMED)) {
+ if (!(walk_state->op_info->flags & AML_NAMED)) {
return (AE_OK);
}
acpi_status
acpi_ds_load2_begin_op (
- u16 opcode,
- acpi_parse_object *op,
acpi_walk_state *walk_state,
acpi_parse_object **out_op)
{
+ acpi_parse_object *op;
acpi_namespace_node *node;
acpi_status status;
acpi_object_type8 data_type;
NATIVE_CHAR *buffer_ptr;
void *original = NULL;
- const acpi_opcode_info *op_info;
PROC_NAME ("Ds_load2_begin_op");
+
+ op = walk_state->op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
- /* We only care about Namespace opcodes here */
+ if (op) {
+ /* We only care about Namespace opcodes here */
- op_info = acpi_ps_get_opcode_info (opcode);
- if (!(op_info->flags & AML_NSOPCODE) &&
- opcode != AML_INT_NAMEPATH_OP) {
- return (AE_OK);
- }
+ if (!(walk_state->op_info->flags & AML_NSOPCODE) &&
+ walk_state->opcode != AML_INT_NAMEPATH_OP) {
+ return (AE_OK);
+ }
- /* TBD: [Restructure] Temp! same code as in psparse */
+ /* TBD: [Restructure] Temp! same code as in psparse */
- if (!(op_info->flags & AML_NAMED)) {
- return (AE_OK);
- }
+ if (!(walk_state->op_info->flags & AML_NAMED)) {
+ return (AE_OK);
+ }
- if (op) {
/*
* Get the name we are going to enter or lookup in the namespace
*/
- if (opcode == AML_INT_NAMEPATH_OP) {
+ if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
/* For Namepath op, get the path string */
buffer_ptr = op->value.string;
return (AE_OK);
}
}
-
else {
/* Get name from the op */
buffer_ptr = (NATIVE_CHAR *) &((acpi_parse2_object *)op)->name;
}
}
-
else {
- buffer_ptr = acpi_ps_get_next_namestring (walk_state->parser_state);
+ buffer_ptr = acpi_ps_get_next_namestring (&walk_state->parser_state);
}
/* Map the raw opcode into an internal object type */
- data_type = acpi_ds_map_named_opcode_to_data_type (opcode);
+ data_type = acpi_ds_map_named_opcode_to_data_type (walk_state->opcode);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"State=%p Op=%p Type=%x\n", walk_state, op, data_type));
- if (opcode == AML_FIELD_OP ||
- opcode == AML_BANK_FIELD_OP ||
- opcode == AML_INDEX_FIELD_OP) {
+ if (walk_state->opcode == AML_FIELD_OP ||
+ walk_state->opcode == AML_BANK_FIELD_OP ||
+ walk_state->opcode == AML_INDEX_FIELD_OP) {
node = NULL;
status = AE_OK;
}
- else if (opcode == AML_INT_NAMEPATH_OP) {
+ else if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
/*
* The Name_path is an object reference to an existing object. Don't enter the
* name into the namespace, but look it up for use later
if (!op) {
/* Create a new op */
- op = acpi_ps_alloc_op (opcode);
+ op = acpi_ps_alloc_op (walk_state->opcode);
if (!op) {
return (AE_NO_MEMORY);
}
acpi_status
acpi_ds_load2_end_op (
- acpi_walk_state *walk_state,
- acpi_parse_object *op)
+ acpi_walk_state *walk_state)
{
+ acpi_parse_object *op;
acpi_status status = AE_OK;
acpi_object_type8 data_type;
acpi_namespace_node *node;
acpi_parse_object *arg;
acpi_namespace_node *new_node;
- const acpi_opcode_info *op_info;
+ u32 i;
PROC_NAME ("Ds_load2_end_op");
+
+ op = walk_state->op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
/* Only interested in opcodes that have namespace objects */
- op_info = acpi_ps_get_opcode_info (op->opcode);
- if (!(op_info->flags & AML_NSOBJECT)) {
+ if (!(walk_state->op_info->flags & AML_NSOBJECT)) {
return (AE_OK);
}
/*
* Named operations are as follows:
*
- * AML_SCOPE
- * AML_DEVICE
- * AML_THERMALZONE
- * AML_METHOD
- * AML_POWERRES
- * AML_PROCESSOR
- * AML_FIELD
- * AML_INDEXFIELD
- * AML_BANKFIELD
- * AML_NAMEDFIELD
- * AML_NAME
* AML_ALIAS
- * AML_MUTEX
- * AML_EVENT
- * AML_OPREGION
- * AML_CREATEFIELD
+ * AML_BANKFIELD
* AML_CREATEBITFIELD
* AML_CREATEBYTEFIELD
- * AML_CREATEWORDFIELD
* AML_CREATEDWORDFIELD
+ * AML_CREATEFIELD
* AML_CREATEQWORDFIELD
+ * AML_CREATEWORDFIELD
+ * AML_DATA_REGION
+ * AML_DEVICE
+ * AML_EVENT
+ * AML_FIELD
+ * AML_INDEXFIELD
+ * AML_METHOD
* AML_METHODCALL
+ * AML_MUTEX
+ * AML_NAME
+ * AML_NAMEDFIELD
+ * AML_OPREGION
+ * AML_POWERRES
+ * AML_PROCESSOR
+ * AML_SCOPE
+ * AML_THERMALZONE
*/
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Create-Load [%s] State=%p Op=%p Named_obj=%p\n",
+ acpi_ps_get_opcode_name (op->opcode), walk_state, op, node));
/* Decode the opcode */
arg = op->value.arg;
- switch (op->opcode) {
-
- case AML_CREATE_FIELD_OP:
- case AML_CREATE_BIT_FIELD_OP:
- case AML_CREATE_BYTE_FIELD_OP:
- case AML_CREATE_WORD_FIELD_OP:
- case AML_CREATE_DWORD_FIELD_OP:
- case AML_CREATE_QWORD_FIELD_OP:
+ switch (walk_state->op_info->type) {
+ case AML_TYPE_CREATE_FIELD:
/*
* Create the field object, but the field buffer and index must
* be evaluated later during the execution phase
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Create_xxx_field: State=%p Op=%p Named_obj=%p\n",
- walk_state, op, node));
-
- /* Get the Name_string argument */
-
- if (op->opcode == AML_CREATE_FIELD_OP) {
- arg = acpi_ps_get_arg (op, 3);
- }
- else {
- /* Create Bit/Byte/Word/Dword field */
-
- arg = acpi_ps_get_arg (op, 2);
- }
-
- if (!arg) {
- status = AE_AML_NO_OPERAND;
- goto cleanup;
- }
-
- /*
- * Enter the Name_string into the namespace
- */
- status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
- INTERNAL_TYPE_DEF_ANY, IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- walk_state, &(new_node));
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
-
- /* We could put the returned object (Node) on the object stack for later, but
- * for now, we will put it in the "op" object that the parser uses, so we
- * can get it again at the end of this scope
- */
- op->node = new_node;
-
- /*
- * If there is no object attached to the node, this node was just created and
- * we need to create the field object. Otherwise, this was a lookup of an
- * existing node and we don't want to create the field object again.
- */
- if (!new_node->object) {
- /*
- * The Field definition is not fully parsed at this time.
- * (We must save the address of the AML for the buffer and index operands)
- */
- status = acpi_ex_create_buffer_field (((acpi_parse2_object *) op)->data,
- ((acpi_parse2_object *) op)->length,
- new_node, walk_state);
- }
+ status = acpi_ds_create_buffer_field (op, walk_state);
break;
- case AML_INT_METHODCALL_OP:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "RESOLVING-Method_call: State=%p Op=%p Named_obj=%p\n",
- walk_state, op, node));
-
- /*
- * Lookup the method name and save the Node
- */
- status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
- ACPI_TYPE_ANY, IMODE_LOAD_PASS2,
- NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
- walk_state, &(new_node));
- if (ACPI_SUCCESS (status)) {
- /* TBD: has name already been resolved by here ??*/
-
- /* TBD: [Restructure] Make sure that what we found is indeed a method! */
- /* We didn't search for a method on purpose, to see if the name would resolve! */
+ case AML_TYPE_NAMED_FIELD:
- /* We could put the returned object (Node) on the object stack for later, but
- * for now, we will put it in the "op" object that the parser uses, so we
- * can get it again at the end of this scope
- */
- op->node = new_node;
- }
+ arg = op->value.arg;
+ switch (op->opcode) {
+ case AML_INDEX_FIELD_OP:
+ status = acpi_ds_create_index_field (op, (acpi_handle) arg->node,
+ walk_state);
+ break;
- break;
+ case AML_BANK_FIELD_OP:
- case AML_PROCESSOR_OP:
+ status = acpi_ds_create_bank_field (op, arg->node, walk_state);
+ break;
- /* Nothing to do other than enter object into namespace */
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "LOADING-Processor: State=%p Op=%p Named_obj=%p\n",
- walk_state, op, node));
+ case AML_FIELD_OP:
- status = acpi_ex_create_processor (op, node);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
+ status = acpi_ds_create_field (op, arg->node, walk_state);
+ break;
}
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Completed Processor Init, Op=%p State=%p entry=%p\n",
- op, walk_state, node));
break;
- case AML_POWER_RES_OP:
+ case AML_TYPE_NAMED_SIMPLE:
- /* Nothing to do other than enter object into namespace */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "LOADING-Power_resource: State=%p Op=%p Named_obj=%p\n",
- walk_state, op, node));
-
- status = acpi_ex_create_power_resource (op, node);
+ status = acpi_ds_create_operands (walk_state, arg);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Completed Power_resource Init, Op=%p State=%p entry=%p\n",
- op, walk_state, node));
- break;
-
-
- case AML_THERMAL_ZONE_OP:
-
- /* Nothing to do other than enter object into namespace */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "LOADING-Thermal_zone: State=%p Op=%p Named_obj=%p\n",
- walk_state, op, node));
- break;
+ switch (op->opcode) {
+ case AML_PROCESSOR_OP:
+ status = acpi_ex_create_processor (walk_state);
+ break;
- case AML_FIELD_OP:
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "LOADING-Field: State=%p Op=%p Named_obj=%p\n",
- walk_state, op, node));
+ case AML_POWER_RES_OP:
- arg = op->value.arg;
+ status = acpi_ex_create_power_resource (walk_state);
+ break;
- status = acpi_ds_create_field (op, arg->node, walk_state);
- break;
+ case AML_MUTEX_OP:
- case AML_INDEX_FIELD_OP:
+ status = acpi_ex_create_mutex (walk_state);
+ break;
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "LOADING-Index_field: State=%p Op=%p Named_obj=%p\n",
- walk_state, op, node));
- arg = op->value.arg;
-
- status = acpi_ds_create_index_field (op, (acpi_handle) arg->node,
- walk_state);
- break;
+ case AML_EVENT_OP:
+ status = acpi_ex_create_event (walk_state);
+ break;
- case AML_BANK_FIELD_OP:
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "LOADING-Bank_field: State=%p Op=%p Named_obj=%p\n",
- walk_state, op, node));
+ case AML_DATA_REGION_OP:
- arg = op->value.arg;
- status = acpi_ds_create_bank_field (op, arg->node, walk_state);
- break;
+ status = acpi_ex_create_table_region (walk_state);
+ break;
+ case AML_ALIAS_OP:
- /*
- * Method_op Pkg_length Names_string Method_flags Term_list
- */
- case AML_METHOD_OP:
+ status = acpi_ex_create_alias (walk_state);
+ break;
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "LOADING-Method: State=%p Op=%p Named_obj=%p\n",
- walk_state, op, node));
+ default:
+ /* Unknown opcode */
- if (!node->object) {
- status = acpi_ex_create_method (((acpi_parse2_object *) op)->data,
- ((acpi_parse2_object *) op)->length,
- arg->value.integer32, node);
+ status = AE_OK;
+ goto cleanup;
+ break;
}
- break;
-
- case AML_MUTEX_OP:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "LOADING-Mutex: Op=%p State=%p\n", op, walk_state));
+ /* Delete operands */
- status = acpi_ds_create_operands (walk_state, arg);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
+ for (i = 1; i < walk_state->num_operands; i++) {
+ acpi_ut_remove_reference (walk_state->operands[i]);
+ walk_state->operands[i] = NULL;
}
- status = acpi_ex_create_mutex (walk_state);
break;
- case AML_EVENT_OP:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "LOADING-Event: Op=%p State=%p\n", op, walk_state));
+ case AML_TYPE_NAMED_COMPLEX:
- status = acpi_ds_create_operands (walk_state, arg);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
+ switch (op->opcode) {
+ case AML_METHOD_OP:
+ /*
+ * Method_op Pkg_length Names_string Method_flags Term_list
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "LOADING-Method: State=%p Op=%p Named_obj=%p\n",
+ walk_state, op, node));
- status = acpi_ex_create_event (walk_state);
- break;
+ if (!node->object) {
+ status = acpi_ds_create_operands (walk_state, arg);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
+ status = acpi_ex_create_method (((acpi_parse2_object *) op)->data,
+ ((acpi_parse2_object *) op)->length,
+ walk_state);
+ }
+ break;
- case AML_REGION_OP:
- if (node->object) {
+ case AML_REGION_OP:
+ /*
+ * The Op_region is not fully parsed at this time. Only valid argument is the Space_id.
+ * (We must save the address of the AML of the address and length operands)
+ */
+ status = acpi_ex_create_region (((acpi_parse2_object *) op)->data,
+ ((acpi_parse2_object *) op)->length,
+ (ACPI_ADR_SPACE_TYPE) arg->value.integer, walk_state);
break;
- }
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "LOADING-Opregion: Op=%p State=%p Named_obj=%p\n",
- op, walk_state, node));
- /*
- * The Op_region is not fully parsed at this time. Only valid argument is the Space_id.
- * (We must save the address of the AML of the address and length operands)
- */
- status = acpi_ex_create_region (((acpi_parse2_object *) op)->data,
- ((acpi_parse2_object *) op)->length,
- (ACPI_ADR_SPACE_TYPE) arg->value.integer, walk_state);
+ case AML_NAME_OP:
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Completed Op_region Init, Op=%p State=%p entry=%p\n",
- op, walk_state, node));
+ status = acpi_ds_create_node (walk_state, node, op);
+ break;
+ }
break;
- /* Namespace Modifier Opcodes */
+ case AML_CLASS_INTERNAL:
- case AML_ALIAS_OP:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "LOADING-Alias: Op=%p State=%p\n", op, walk_state));
-
- status = acpi_ds_create_operands (walk_state, arg);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
-
- status = acpi_ex_create_alias (walk_state);
+ /* case AML_INT_NAMEPATH_OP: */
break;
- case AML_NAME_OP:
+ case AML_CLASS_METHOD_CALL:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "LOADING-Name: Op=%p State=%p\n", op, walk_state));
+ "RESOLVING-Method_call: State=%p Op=%p Named_obj=%p\n",
+ walk_state, op, node));
/*
- * Because of the execution pass through the non-control-method
- * parts of the table, we can arrive here twice. Only init
- * the named object node the first time through
+ * Lookup the method name and save the Node
*/
- if (!node->object) {
- status = acpi_ds_create_node (walk_state, node, op);
- }
-
- break;
+ status = acpi_ns_lookup (walk_state->scope_info, arg->value.string,
+ ACPI_TYPE_ANY, IMODE_LOAD_PASS2,
+ NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
+ walk_state, &(new_node));
+ if (ACPI_SUCCESS (status)) {
+ /* TBD: has name already been resolved by here ??*/
+ /* TBD: [Restructure] Make sure that what we found is indeed a method! */
+ /* We didn't search for a method on purpose, to see if the name would resolve! */
- case AML_INT_NAMEPATH_OP:
+ /* We could put the returned object (Node) on the object stack for later, but
+ * for now, we will put it in the "op" object that the parser uses, so we
+ * can get it again at the end of this scope
+ */
+ op->node = new_node;
+ }
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "LOADING-Name_path object: State=%p Op=%p Named_obj=%p\n",
- walk_state, op, node));
break;
/* Remove the Node pushed at the very beginning */
- acpi_ds_obj_stack_pop (1, walk_state);
+ walk_state->operands[0] = NULL;
+ walk_state->num_operands = 0;
return (status);
}
/******************************************************************************
*
* Module Name: dswscope - Scope stack manipulation
- * $Revision: 48 $
+ * $Revision: 49 $
*
*****************************************************************************/
/* Init new scope object */
- scope_info->scope.node = node;
- scope_info->common.value = (u16) type;
+ scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE;
+ scope_info->scope.node = node;
+ scope_info->common.value = (u16) type;
/* Push new scope object onto stack */
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
- * $Revision: 51 $
+ * $Revision: 54 $
*
*****************************************************************************/
return (AE_NO_MEMORY);
}
+ state->common.data_type = ACPI_DESC_TYPE_STATE_RESULT;
acpi_ut_push_generic_state (&walk_state->results, state);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n",
*
******************************************************************************/
-static void
+void
acpi_ds_push_walk_state (
acpi_walk_state *walk_state,
acpi_walk_list *walk_list)
/* Put the new state at the head of the walk list */
- acpi_ds_push_walk_state (walk_state, walk_list);
+ if (walk_list) {
+ acpi_ds_push_walk_state (walk_state, walk_list);
+ }
return_PTR (walk_state);
}
+#ifndef _ACPI_ASL_COMPILER
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ds_init_aml_walk
+ *
+ * PARAMETERS: Walk_state - New state to be initialized
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Initialize a walk state for a pass 1 or 2 parse tree walk
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ds_init_aml_walk (
+ acpi_walk_state *walk_state,
+ acpi_parse_object *op,
+ acpi_namespace_node *method_node,
+ u8 *aml_start,
+ u32 aml_length,
+ acpi_operand_object **params,
+ acpi_operand_object **return_obj_desc,
+ u32 pass_number)
+{
+ acpi_status status;
+ acpi_parse_state *parser_state = &walk_state->parser_state;
+
+
+ FUNCTION_TRACE ("Ds_init_aml_walk");
+
+
+ walk_state->parser_state.aml =
+ walk_state->parser_state.aml_start = aml_start;
+ walk_state->parser_state.aml_end =
+ walk_state->parser_state.pkg_end = aml_start + aml_length;
+
+ /* The Next_op of the Next_walk will be the beginning of the method */
+ /* TBD: [Restructure] -- obsolete? */
+
+ walk_state->next_op = NULL;
+ walk_state->params = params;
+ walk_state->caller_return_desc = return_obj_desc;
+
+ status = acpi_ps_init_scope (&walk_state->parser_state, op);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ if (method_node) {
+ walk_state->parser_state.start_node = method_node;
+ walk_state->walk_type = WALK_METHOD;
+ walk_state->method_node = method_node;
+ walk_state->method_desc = acpi_ns_get_attached_object (method_node);
+
+
+ /* Push start scope on scope stack and make it current */
+
+ status = acpi_ds_scope_stack_push (method_node, ACPI_TYPE_METHOD, walk_state);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ /* Init the method arguments */
+
+ acpi_ds_method_data_init_args (params, MTH_NUM_ARGS, walk_state);
+ }
+
+ else {
+ /* Setup the current scope */
+
+ parser_state->start_node = parser_state->start_op->node;
+ if (parser_state->start_node) {
+ /* Push start scope on scope stack and make it current */
+
+ status = acpi_ds_scope_stack_push (parser_state->start_node,
+ parser_state->start_node->type, walk_state);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+ }
+ }
+
+ acpi_ds_init_callbacks (walk_state, pass_number);
+
+ return_ACPI_STATUS (AE_OK);
+}
+#endif
+
+
/*******************************************************************************
*
* FUNCTION: Acpi_ds_delete_walk_state
}
- /* Always must free any linked control states */
+ if (walk_state->parser_state.scope) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", walk_state));
+ }
+
+ /* Always must free any linked control states */
while (walk_state->control_state) {
state = walk_state->control_state;
#include <linux/acpi.h>
#include <asm/uaccess.h>
#include "acpi.h"
-#include "driver.h"
#define _COMPONENT OS_DEPENDENT
static int acpi_disabled = 0;
+enum acpi_blacklist_predicates
+{
+ all_versions,
+ less_than_or_equal,
+ equal,
+ greater_than_or_equal,
+};
+
+struct acpi_blacklist_item
+{
+ char oem_id[7];
+ char oem_table_id[9];
+ u32 oem_revision;
+ enum acpi_blacklist_predicates oem_revision_predicate;
+};
+
+/*
+ * Currently, this blacklists based on items in the FADT. We may want to
+ * expand this to using other ACPI tables in the future, too.
+ */
+static struct acpi_blacklist_item acpi_blacklist[] __initdata =
+{
+ {"TOSHIB", "750 ", 0x970814, less_than_or_equal}, /* Portege 7020, BIOS 8.10 */
+ {""}
+};
+
+int
+acpi_blacklisted(FADT_DESCRIPTOR *fadt)
+{
+ int i = 0;
+
+ while (acpi_blacklist[i].oem_id[0] != '\0')
+ {
+ if (strncmp(acpi_blacklist[i].oem_id, fadt->header.oem_id, 6)) {
+ i++;
+ continue;
+ }
+
+ if (strncmp(acpi_blacklist[i].oem_table_id, fadt->header.oem_table_id, 8)) {
+ i++;
+ continue;
+ }
+
+ if (acpi_blacklist[i].oem_revision_predicate == all_versions)
+ return TRUE;
+
+ if (acpi_blacklist[i].oem_revision_predicate == less_than_or_equal
+ && fadt->header.oem_revision <= acpi_blacklist[i].oem_revision)
+ return TRUE;
+
+ if (acpi_blacklist[i].oem_revision_predicate == greater_than_or_equal
+ && fadt->header.oem_revision >= acpi_blacklist[i].oem_revision)
+ return TRUE;
+
+ if (acpi_blacklist[i].oem_revision_predicate == equal
+ && fadt->header.oem_revision == acpi_blacklist[i].oem_revision)
+ return TRUE;
+
+ i++;
+ }
+
+ return FALSE;
+}
+
/*
* Start the interpreter
*/
return -ENODEV;
}
-
if (acpi_disabled) {
printk(KERN_NOTICE "ACPI: disabled by cmdline, exiting\n");
return -ENODEV;
return -ENODEV;
}
+ if (acpi_blacklisted(&acpi_fadt)) {
+ printk(KERN_ERR "ACPI: On blacklist -- BIOS not fully ACPI compliant\n");
+ acpi_terminate();
+ return -ENODEV;
+ }
+
buffer.length = sizeof(sys_info);
buffer.pointer = &sys_info;
+++ /dev/null
-/*
- * driver.h - ACPI driver
- *
- * Copyright (C) 2000 Andrew Henroid
- *
- * 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
- */
-
-#ifndef __DRIVER_H
-#define __DRIVER_H
-
-#include <linux/tqueue.h>
-#include <linux/wait.h>
-#include <linux/pm.h>
-#include <linux/acpi.h>
-#include <asm/io.h>
-
-#define ACPI_MAX_THROTTLE 10
-#define ACPI_INVALID ~0UL
-#define ACPI_INFINITE ~0UL
-
-/*
- * cpu.c
- */
-int acpi_cpu_init(void);
-u32 acpi_read_pm_timer(void);
-
-extern u32 acpi_c2_exit_latency;
-extern u32 acpi_c3_exit_latency;
-extern u32 acpi_c2_enter_latency;
-extern u32 acpi_c3_enter_latency;
-extern u32 acpi_use_idle;
-extern u32 acpi_c1_count;
-extern u32 acpi_c2_count;
-extern u32 acpi_c3_count;
-
-/*
- * driver.c
- */
-int acpi_run(void (*callback)(void*), void *context);
-
-/*
- * ec.c
- */
-int acpi_ec_init(void);
-
-/*
- * power.c
- */
-int acpi_power_init(void);
-
-/*
- * sys.c
- */
-int acpi_sys_init(void);
-int acpi_enter_sx(acpi_sstate_t state);
-
-extern volatile acpi_sstate_t acpi_sleep_state;
-
-#endif /* __DRIVER_H */
*
* Module Name: evevent - Fixed and General Purpose Acpi_event
* handling and dispatch
- * $Revision: 50 $
+ * $Revision: 51 $
*
*****************************************************************************/
* Allocate the Gpe information block
*/
acpi_gbl_gpe_registers = ACPI_MEM_CALLOCATE (acpi_gbl_gpe_register_count *
- sizeof (ACPI_GPE_REGISTERS));
+ sizeof (acpi_gpe_registers));
if (!acpi_gbl_gpe_registers) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not allocate the Gpe_registers block\n"));
register_index++;
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE registers: %X@%p (Blk0) %X@%p (Blk1)\n",
- gpe0register_count, acpi_gbl_FADT->Xgpe0blk.address, gpe1_register_count,
- acpi_gbl_FADT->Xgpe1_blk.address));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE registers: %X@%8.8X%8.8X (Blk0) %X@%8.8X%8.8X (Blk1)\n",
+ gpe0register_count, HIDWORD(acpi_gbl_FADT->Xgpe0blk.address), LODWORD(acpi_gbl_FADT->Xgpe0blk.address),
+ gpe1_register_count, HIDWORD(acpi_gbl_FADT->Xgpe1_blk.address), LODWORD(acpi_gbl_FADT->Xgpe1_blk.address)));
return_ACPI_STATUS (AE_OK);
}
*
* Module Name: evmisc - ACPI device notification handler dispatch
* and ACPI Global Lock support
- * $Revision: 33 $
+ * $Revision: 35 $
*
*****************************************************************************/
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unknown Notify Value: %lx \n", notify_value));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unknown Notify Value: %X \n", notify_value));
break;
}
return (AE_NO_MEMORY);
}
+ notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY;
notify_info->notify.node = node;
notify_info->notify.value = (u16) notify_value;
notify_info->notify.handler_obj = handler_obj;
void *context)
{
acpi_generic_state *notify_info = (acpi_generic_state *) context;
- ACPI_NOTIFY_HANDLER global_handler = NULL;
+ acpi_notify_handler global_handler = NULL;
void *global_context = NULL;
acpi_operand_object *handler_obj;
/******************************************************************************
*
* Module Name: evregion - ACPI Address_space (Op_region) handler dispatch
- * $Revision: 110 $
+ * $Revision: 113 $
*
*****************************************************************************/
params[1] = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
if (!params[1]) {
- acpi_ut_remove_reference (params[0]);
- return_ACPI_STATUS (AE_NO_MEMORY);
+ status = AE_NO_MEMORY;
+ goto cleanup;
}
- params[2] = NULL;
-
/*
* Set up the parameter objects
*/
params[0]->integer.value = region_obj->region.space_id;
params[1]->integer.value = function;
+ params[2] = NULL;
/*
* Execute the method, no return value
DEBUG_EXEC(acpi_ut_display_init_pathname (region_obj->region.extra->extra.method_REG, " [Method]"));
status = acpi_ns_evaluate_by_handle (region_obj->region.extra->extra.method_REG, params, NULL);
+ acpi_ut_remove_reference (params[1]);
+cleanup:
acpi_ut_remove_reference (params[0]);
- acpi_ut_remove_reference (params[1]);
return_ACPI_STATUS (status);
}
u32 *value)
{
acpi_status status;
- ACPI_ADR_SPACE_HANDLER handler;
- ACPI_ADR_SPACE_SETUP region_setup;
+ acpi_adr_space_handler handler;
+ acpi_adr_space_setup region_setup;
acpi_operand_object *handler_desc;
void *region_context = NULL;
handler = handler_desc->addr_handler.handler;
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
- "Addrhandler %p (%p), Address %8.8lX%8.8lX\n",
+ "Addrhandler %p (%p), Address %8.8X%8.8X\n",
®ion_obj->region.addr_handler->addr_handler, handler, HIDWORD(address),
LODWORD(address)));
acpi_operand_object *handler_obj;
acpi_operand_object *obj_desc;
acpi_operand_object **last_obj_ptr;
- ACPI_ADR_SPACE_SETUP region_setup;
+ acpi_adr_space_setup region_setup;
void *region_context;
acpi_status status;
/* Convert and validate the device handle */
- node = acpi_ns_convert_handle_to_entry (obj_handle);
+ node = acpi_ns_map_handle_to_node (obj_handle);
if (!node) {
return (AE_BAD_PARAMETER);
}
/******************************************************************************
*
* Module Name: evrgnini- ACPI Address_space (Op_region) init
- * $Revision: 46 $
+ * $Revision: 48 $
*
*****************************************************************************/
acpi_operand_object *handler_obj;
acpi_namespace_node *node;
acpi_operand_object *region_obj = (acpi_operand_object *) handle;
- ACPI_DEVICE_ID object_hID;
+ acpi_device_id object_hID;
FUNCTION_TRACE ("Ev_pci_config_region_setup");
* routine checks before we get here, but we check again just in case.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
- "Attempting to init a region %X, with no handler\n", region_obj));
+ "Attempting to init a region %p, with no handler\n", region_obj));
return_ACPI_STATUS (AE_NOT_EXIST);
}
}
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ev_pci_bar_region_setup
+ *
+ * PARAMETERS: Region_obj - region we are interested in
+ * Function - start or stop
+ * Handler_context - Address space handler context
+ * Region_context - Region specific context
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Do any prep work for region handling
+ *
+ * MUTEX: Assumes namespace is not locked
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ev_pci_bar_region_setup (
+ acpi_handle handle,
+ u32 function,
+ void *handler_context,
+ void **region_context)
+{
+
+ FUNCTION_TRACE ("Ev_pci_bar_region_setup");
+
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ev_cmos_region_setup
+ *
+ * PARAMETERS: Region_obj - region we are interested in
+ * Function - start or stop
+ * Handler_context - Address space handler context
+ * Region_context - Region specific context
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Do any prep work for region handling
+ *
+ * MUTEX: Assumes namespace is not locked
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ev_cmos_region_setup (
+ acpi_handle handle,
+ u32 function,
+ void *handler_context,
+ void **region_context)
+{
+
+ FUNCTION_TRACE ("Ev_cmos_region_setup");
+
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
/*******************************************************************************
*
* FUNCTION: Acpi_ev_default_region_setup
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
- * $Revision: 112 $
+ * $Revision: 116 $
*
*****************************************************************************/
acpi_status
acpi_install_fixed_event_handler (
u32 event,
- ACPI_EVENT_HANDLER handler,
+ acpi_event_handler handler,
void *context)
{
acpi_status status;
FUNCTION_TRACE ("Acpi_install_fixed_event_handler");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* Parameter validation */
if (event > ACPI_EVENT_MAX) {
}
- /* Install the handler before enabling the event - just in case... */
+ /* Install the handler before enabling the event */
acpi_gbl_fixed_event_handlers[event].handler = handler;
acpi_gbl_fixed_event_handlers[event].context = context;
- status = acpi_enable_event (event, ACPI_EVENT_FIXED);
+ status = acpi_enable_event (event, ACPI_EVENT_FIXED, 0);
if (!ACPI_SUCCESS (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n"));
acpi_status
acpi_remove_fixed_event_handler (
u32 event,
- ACPI_EVENT_HANDLER handler)
+ acpi_event_handler handler)
{
acpi_status status = AE_OK;
FUNCTION_TRACE ("Acpi_remove_fixed_event_handler");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* Parameter validation */
if (event > ACPI_EVENT_MAX) {
acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
- /* Disable the event before removing the handler - just in case... */
+ /* Disable the event before removing the handler */
- status = acpi_disable_event(event, ACPI_EVENT_FIXED);
+ status = acpi_disable_event(event, ACPI_EVENT_FIXED, 0);
/* Always Remove the handler */
acpi_gbl_fixed_event_handlers[event].handler = NULL;
acpi_gbl_fixed_event_handlers[event].context = NULL;
-
- if (!ACPI_SUCCESS(status)) {
+ if (!ACPI_SUCCESS (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
"Could not write to fixed event enable register.\n"));
}
-
else {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X.\n", event));
}
acpi_install_notify_handler (
acpi_handle device,
u32 handler_type,
- ACPI_NOTIFY_HANDLER handler,
+ acpi_notify_handler handler,
void *context)
{
acpi_operand_object *obj_desc;
FUNCTION_TRACE ("Acpi_install_notify_handler");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* Parameter validation */
if ((!handler) ||
/* Convert and validate the device handle */
- device_node = acpi_ns_convert_handle_to_entry (device);
+ device_node = acpi_ns_map_handle_to_node (device);
if (!device_node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
/*
* 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).
}
/*
- * Other Objects:
- * --------------
+ * All Other Objects:
* Caller will only receive notifications specific to the target object.
* Note that only certain object types can receive notifications.
*/
}
}
+
unlock_and_exit:
acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (status);
acpi_remove_notify_handler (
acpi_handle device,
u32 handler_type,
- ACPI_NOTIFY_HANDLER handler)
+ acpi_notify_handler handler)
{
acpi_operand_object *notify_obj;
acpi_operand_object *obj_desc;
FUNCTION_TRACE ("Acpi_remove_notify_handler");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* Parameter validation */
if ((!handler) ||
/* Convert and validate the device handle */
- device_node = acpi_ns_convert_handle_to_entry (device);
+ device_node = acpi_ns_map_handle_to_node (device);
if (!device_node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
/*
- * Root Object:
- * ------------
+ * Root Object
*/
if (device == ACPI_ROOT_OBJECT) {
-
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n"));
if (((handler_type == ACPI_SYSTEM_NOTIFY) &&
}
if (handler_type == ACPI_SYSTEM_NOTIFY) {
- acpi_gbl_sys_notify.node = NULL;
+ 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.node = NULL;
acpi_gbl_drv_notify.handler = NULL;
acpi_gbl_drv_notify.context = NULL;
}
}
/*
- * Other Objects:
- * --------------
+ * All Other Objects
*/
else {
/*
acpi_install_gpe_handler (
u32 gpe_number,
u32 type,
- ACPI_GPE_HANDLER handler,
+ acpi_gpe_handler handler,
void *context)
{
acpi_status status = AE_OK;
FUNCTION_TRACE ("Acpi_install_gpe_handler");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* Parameter validation */
if (!handler || (gpe_number > ACPI_GPE_MAX)) {
acpi_hw_clear_gpe (gpe_number);
acpi_hw_enable_gpe (gpe_number);
+
cleanup:
acpi_ut_release_mutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (status);
acpi_status
acpi_remove_gpe_handler (
u32 gpe_number,
- ACPI_GPE_HANDLER handler)
+ acpi_gpe_handler handler)
{
acpi_status status = AE_OK;
FUNCTION_TRACE ("Acpi_remove_gpe_handler");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* Parameter validation */
if (!handler || (gpe_number > ACPI_GPE_MAX)) {
acpi_gbl_gpe_info[gpe_number].handler = NULL;
acpi_gbl_gpe_info[gpe_number].context = NULL;
+
cleanup:
acpi_ut_release_mutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (status);
* DESCRIPTION: Acquire the ACPI Global Lock
*
******************************************************************************/
+
acpi_status
acpi_acquire_global_lock (
void)
acpi_status status;
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
status = acpi_ex_enter_interpreter ();
if (ACPI_FAILURE (status)) {
return (status);
acpi_release_global_lock (
void)
{
- acpi_status status;
-
-
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return (status);
- }
acpi_ev_release_global_lock ();
return (AE_OK);
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
- * $Revision: 36 $
+ * $Revision: 38 $
*
*****************************************************************************/
FUNCTION_TRACE ("Acpi_disable");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* Restore original mode */
status = acpi_hw_set_mode (acpi_gbl_original_mode);
*
* PARAMETERS: Event - The fixed event or GPE to be enabled
* Type - The type of event
+ * Flags - Just enable, or also wake enable?
*
* RETURN: Status
*
acpi_status
acpi_enable_event (
u32 event,
- u32 type)
+ u32 type,
+ u32 flags)
{
acpi_status status = AE_OK;
u32 register_id;
FUNCTION_TRACE ("Acpi_enable_event");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* The Type must be either Fixed Acpi_event or GPE */
switch (type) {
/* Enable the requested GPE number */
- acpi_hw_enable_gpe (event);
+ if (flags & ACPI_EVENT_ENABLE) {
+ acpi_hw_enable_gpe (event);
+ }
+ if (flags & ACPI_EVENT_WAKE_ENABLE) {
+ acpi_hw_enable_gpe_for_wakeup (event);
+ }
+
break;
* FUNCTION: Acpi_disable_event
*
* PARAMETERS: Event - The fixed event or GPE to be enabled
- * Type - The type of event
+ * Type - The type of event, fixed or general purpose
+ * Flags - Wake disable vs. non-wake disable
*
* RETURN: Status
*
acpi_status
acpi_disable_event (
u32 event,
- u32 type)
+ u32 type,
+ u32 flags)
{
acpi_status status = AE_OK;
u32 register_id;
FUNCTION_TRACE ("Acpi_disable_event");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* The Type must be either Fixed Acpi_event or GPE */
switch (type) {
/* Disable the requested GPE number */
- acpi_hw_disable_gpe (event);
+ if (flags & ACPI_EVENT_DISABLE) {
+ acpi_hw_disable_gpe (event);
+ }
+ if (flags & ACPI_EVENT_WAKE_DISABLE) {
+ acpi_hw_disable_gpe_for_wakeup (event);
+ }
+
break;
FUNCTION_TRACE ("Acpi_clear_event");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* The Type must be either Fixed Acpi_event or GPE */
switch (type) {
FUNCTION_TRACE ("Acpi_get_event_status");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
if (!event_status) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
*
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
* Address Spaces.
- * $Revision: 36 $
+ * $Revision: 40 $
*
*****************************************************************************/
acpi_install_address_space_handler (
acpi_handle device,
ACPI_ADR_SPACE_TYPE space_id,
- ACPI_ADR_SPACE_HANDLER handler,
- ACPI_ADR_SPACE_SETUP setup,
+ acpi_adr_space_handler handler,
+ acpi_adr_space_setup setup,
void *context)
{
acpi_operand_object *obj_desc;
FUNCTION_TRACE ("Acpi_install_address_space_handler");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* Parameter validation */
if ((!device) ||
/* Convert and validate the device handle */
- node = acpi_ns_convert_handle_to_entry (device);
+ node = acpi_ns_map_handle_to_node (device);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
/*
- * This registration is valid for only the types below
- * and the root. This is where the default handlers
- * get placed.
+ * This registration is valid for only the types below
+ * and the root. This is where the default handlers
+ * get placed.
*/
if ((node->type != ACPI_TYPE_DEVICE) &&
(node->type != ACPI_TYPE_PROCESSOR) &&
switch (space_id) {
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
handler = acpi_ex_system_memory_space_handler;
- setup = acpi_ev_system_memory_region_setup;
+ setup = acpi_ev_system_memory_region_setup;
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
handler = acpi_ex_system_io_space_handler;
- setup = acpi_ev_io_space_region_setup;
+ setup = acpi_ev_io_space_region_setup;
break;
case ACPI_ADR_SPACE_PCI_CONFIG:
handler = acpi_ex_pci_config_space_handler;
- setup = acpi_ev_pci_config_region_setup;
+ setup = acpi_ev_pci_config_region_setup;
+ break;
+
+ case ACPI_ADR_SPACE_CMOS:
+ handler = acpi_ex_cmos_space_handler;
+ setup = acpi_ev_cmos_region_setup;
+ break;
+
+ case ACPI_ADR_SPACE_PCI_BAR_TARGET:
+ handler = acpi_ex_pci_bar_space_handler;
+ setup = acpi_ev_pci_bar_region_setup;
break;
default:
}
/*
- * If the caller hasn't specified a setup routine, use the default
+ * If the caller hasn't specified a setup routine, use the default
*/
if (!setup) {
setup = acpi_ev_default_region_setup;
}
/*
- * Check for an existing internal object
+ * Check for an existing internal object
*/
obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) {
/*
- * The object exists.
- * Make sure the handler is not already installed.
+ * The object exists.
+ * Make sure the handler is not already installed.
*/
/* check the address handler the user requested */
handler_obj = obj_desc->device.addr_handler;
while (handler_obj) {
/*
- * We have an Address handler, see if user requested this
- * address space.
+ * We have an Address handler, see if user requested this
+ * address space.
*/
if(handler_obj->addr_handler.space_id == space_id) {
status = AE_EXIST;
}
/*
- * Move through the linked list of handlers
+ * Move through the linked list of handlers
*/
handler_obj = handler_obj->addr_handler.next;
}
if (node->type == ACPI_TYPE_ANY) {
type = ACPI_TYPE_DEVICE;
}
-
else {
type = node->type;
}
acpi_ut_get_region_name (space_id), space_id, node, obj_desc));
/*
- * Now we can install the handler
+ * Now we can install the handler
*
- * At this point we know that there is no existing handler.
- * So, we just allocate the object for the handler and link it
- * into the list.
+ * At this point we know that there is no existing handler.
+ * So, we just allocate the object for the handler and link it
+ * into the list.
*/
handler_obj = acpi_ut_create_internal_object (INTERNAL_TYPE_ADDRESS_HANDLER);
if (!handler_obj) {
handler_obj->addr_handler.setup = setup;
/*
- * Now walk the namespace finding all of the regions this
- * handler will manage.
+ * Now walk the namespace finding all of the regions this
+ * handler will manage.
*
- * We start at the device and search the branch toward
- * the leaf nodes until either the leaf is encountered or
- * a device is detected that has an address handler of the
- * same type.
+ * We start at the device and search the branch toward
+ * the leaf nodes until either the leaf is encountered or
+ * a device is detected that has an address handler of the
+ * same type.
*
- * In either case we back up and search down the remainder
- * of the branch
+ * In either case we back up and search down the remainder
+ * of the branch
*/
status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, device,
ACPI_UINT32_MAX, NS_WALK_UNLOCK,
handler_obj, NULL);
/*
- * Place this handler 1st on the list
+ * Place this handler 1st on the list
*/
handler_obj->common.reference_count =
(u16) (handler_obj->common.reference_count +
acpi_remove_address_space_handler (
acpi_handle device,
ACPI_ADR_SPACE_TYPE space_id,
- ACPI_ADR_SPACE_HANDLER handler)
+ acpi_adr_space_handler handler)
{
acpi_operand_object *obj_desc;
acpi_operand_object *handler_obj;
FUNCTION_TRACE ("Acpi_remove_address_space_handler");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* Parameter validation */
if ((!device) ||
/* Convert and validate the device handle */
- node = acpi_ns_convert_handle_to_entry (device);
+ node = acpi_ns_map_handle_to_node (device);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
obj_desc = acpi_ns_get_attached_object (node);
if (!obj_desc) {
- /*
- * The object DNE.
- */
status = AE_NOT_EXIST;
goto unlock_and_exit;
}
/*
- * find the address handler the user requested
+ * find the address handler the user requested
*/
handler_obj = obj_desc->device.addr_handler;
last_obj_ptr = &obj_desc->device.addr_handler;
while (handler_obj) {
/*
- * We have a handler, see if user requested this one
+ * We have a handler, see if user requested this one
*/
- if(handler_obj->addr_handler.space_id == space_id) {
+ if (handler_obj->addr_handler.space_id == space_id) {
/*
- * Got it, first dereference this in the Regions
+ * Got it, first dereference this in the Regions
*/
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Removing address handler %p(%p) for region %s on Device %p(%p)\n",
while (region_obj) {
/*
- * First disassociate the handler from the region.
+ * First disassociate the handler from the region.
*
- * NOTE: this doesn't mean that the region goes away
- * The region is just inaccessible as indicated to
- * the _REG method
+ * NOTE: this doesn't mean that the region goes away
+ * The region is just inaccessible as indicated to
+ * the _REG method
*/
acpi_ev_disassociate_region_from_handler(region_obj, TRUE);
/*
- * Walk the list, since we took the first region and it
- * was removed from the list by the dissassociate call
- * we just get the first item on the list again
+ * Walk the list, since we took the first region and it
+ * was removed from the list by the dissassociate call
+ * we just get the first item on the list again
*/
region_obj = handler_obj->addr_handler.region_list;
}
/*
- * Remove this Handler object from the list
+ * Remove this Handler object from the list
*/
*last_obj_ptr = handler_obj->addr_handler.next;
/*
- * Now we can delete the handler object
+ * Now we can delete the handler object
*/
acpi_ut_remove_reference (handler_obj);
acpi_ut_remove_reference (handler_obj);
}
/*
- * Move through the linked list of handlers
+ * Move through the linked list of handlers
*/
last_obj_ptr = &handler_obj->addr_handler.next;
handler_obj = handler_obj->addr_handler.next;
/*
- * The handler does not exist
+ * The handler does not exist
*/
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Unable to remove address handler %p for %s(%X), Dev_node %p, obj %p\n",
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
- * $Revision: 41 $
+ * $Revision: 44 $
*
*****************************************************************************/
*
****************************************************************************/
-static acpi_status
-acpi_ex_load_table_op (
+acpi_status
+acpi_ex_load_op (
acpi_operand_object *rgn_desc,
- acpi_operand_object **ddb_handle)
+ acpi_operand_object *ddb_handle)
{
acpi_status status;
acpi_operand_object *table_desc = NULL;
u32 i;
- FUNCTION_TRACE ("Ex_load_table");
+ FUNCTION_TRACE ("Ex_load_op");
/* TBD: [Unhandled] Object can be either a field or an opregion */
acpi_gbl_acpi_table_data[ACPI_TABLE_SSDT].sig_length))) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
- table_header.signature));
+ (char*)table_header.signature));
status = AE_BAD_SIGNATURE;
goto cleanup;
}
table_desc->reference.opcode = AML_LOAD_OP;
table_desc->reference.object = table_info.installed_desc;
- *ddb_handle = table_desc;
+ /* TBD: store the tabledesc into the Ddb_handle target */
+ /* Ddb_handle = Table_desc; */
return_ACPI_STATUS (status);
ACPI_MEM_FREE (table_desc);
ACPI_MEM_FREE (table_ptr);
return_ACPI_STATUS (status);
-
}
*
****************************************************************************/
-static acpi_status
+acpi_status
acpi_ex_unload_table (
acpi_operand_object *ddb_handle)
{
return_ACPI_STATUS (status);
}
-
-/*****************************************************************************
- *
- * FUNCTION: Acpi_ex_reconfiguration
- *
- * PARAMETERS: Opcode - The opcode to be executed
- * Walk_state - Current state of the parse tree walk
- *
- * RETURN: Status
- *
- * DESCRIPTION: Reconfiguration opcodes such as LOAD and UNLOAD
- *
- ****************************************************************************/
-
-acpi_status
-acpi_ex_reconfiguration (
- u16 opcode,
- acpi_walk_state *walk_state)
-{
- acpi_operand_object **operand = &walk_state->operands[0];
- acpi_status status;
-
-
- FUNCTION_TRACE ("Ex_reconfiguration");
-
-#define ddb_handle operand[0]
-#define region_desc operand[1]
-
-
- switch (opcode) {
-
- case AML_LOAD_OP:
-
- status = acpi_ex_load_table_op (region_desc, &ddb_handle);
- break;
-
-
- case AML_UNLOAD_OP:
-
- status = acpi_ex_unload_table (ddb_handle);
- break;
-
-
- default:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "bad opcode=%X\n", opcode));
- status = AE_AML_BAD_OPCODE;
- break;
- }
-
-
- return_ACPI_STATUS (status);
-}
-
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
- * $Revision: 22 $
+ * $Revision: 24 $
*
*****************************************************************************/
new_buf = ACPI_MEM_CALLOCATE (integer_size);
if (!new_buf) {
REPORT_ERROR
- (("Ex_dyadic2_r/Concat_op: Buffer allocation failure\n"));
+ (("Ex_convert_to_buffer: Buffer allocation failure\n"));
acpi_ut_remove_reference (ret_desc);
return (AE_NO_MEMORY);
}
u32 k = 0;
u8 hex_digit;
acpi_integer digit;
- u8 leading_zero = TRUE;
+ u32 remainder;
u32 length = sizeof (acpi_integer);
+ u8 leading_zero = TRUE;
FUNCTION_ENTRY ();
switch (base) {
case 10:
+ remainder = 0;
for (i = ACPI_MAX_DECIMAL_DIGITS; i > 0 ; i--) {
/* Divide by nth factor of 10 */
digit = integer;
for (j = 1; j < i; j++) {
- digit = ACPI_DIVIDE (digit, 10);
+ acpi_ut_short_divide (&digit, 10, &digit, &remainder);
}
/* Create the decimal digit */
}
if (!leading_zero) {
- string[k] = (u8) (ASCII_ZERO + ACPI_MODULO (digit, 10));
+ string[k] = (u8) (ASCII_ZERO + remainder);
k++;
}
}
/******************************************************************************
*
* Module Name: excreate - Named object creation
- * $Revision: 66 $
+ * $Revision: 71 $
*
*****************************************************************************/
MODULE_NAME ("excreate")
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_create_buffer_field
- *
- * PARAMETERS: Opcode - The opcode to be executed
- * Operands - List of operands for the opcode
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Create_field operators: Create_bit_field_op,
- * Create_byte_field_op, Create_word_field_op, Create_dWord_field_op,
- * Create_field_op (which define fields in buffers)
- *
- * ALLOCATION: Deletes Create_field_op's count operand descriptor
- *
- *
- * ACPI SPECIFICATION REFERENCES:
- * Def_create_bit_field := Create_bit_field_op Src_buf Bit_idx Name_string
- * Def_create_byte_field := Create_byte_field_op Src_buf Byte_idx Name_string
- * Def_create_dWord_field := Create_dWord_field_op Src_buf Byte_idx Name_string
- * Def_create_field := Create_field_op Src_buf Bit_idx Num_bits Name_string
- * Def_create_word_field := Create_word_field_op Src_buf Byte_idx Name_string
- * Bit_index := Term_arg=>Integer
- * Byte_index := Term_arg=>Integer
- * Num_bits := Term_arg=>Integer
- * Source_buff := Term_arg=>Buffer
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_create_buffer_field (
- u8 *aml_ptr,
- u32 aml_length,
- acpi_namespace_node *node,
- acpi_walk_state *walk_state)
-{
- acpi_status status;
- acpi_operand_object *obj_desc;
- acpi_operand_object *tmp_desc;
-
-
- FUNCTION_TRACE ("Ex_create_buffer_field");
-
-
- /* Create the descriptor */
-
- obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER_FIELD);
- if (!obj_desc) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
-
- /*
- * Allocate a method object for this field unit
- */
- obj_desc->buffer_field.extra = acpi_ut_create_internal_object (
- INTERNAL_TYPE_EXTRA);
- if (!obj_desc->buffer_field.extra) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
- /*
- * Remember location in AML stream of the field unit
- * opcode and operands -- since the buffer and index
- * operands must be evaluated.
- */
- obj_desc->buffer_field.extra->extra.pcode = aml_ptr;
- obj_desc->buffer_field.extra->extra.pcode_length = aml_length;
- obj_desc->buffer_field.node = node;
-
-
- /*
- * This operation is supposed to cause the destination Name to refer
- * to the defined Buffer_field -- it must not store the constructed
- * Buffer_field object (or its current value) in some location that the
- * Name may already be pointing to. So, if the Name currently contains
- * a reference which would cause Acpi_ex_store() to perform an indirect
- * store rather than setting the value of the Name itself, clobber that
- * reference before calling Acpi_ex_store().
- */
-
- /* Type of Name's existing value */
-
- switch (acpi_ns_get_type (node)) {
-
- case ACPI_TYPE_BUFFER_FIELD:
- case INTERNAL_TYPE_ALIAS:
- case INTERNAL_TYPE_REGION_FIELD:
- case INTERNAL_TYPE_BANK_FIELD:
- case INTERNAL_TYPE_INDEX_FIELD:
-
- tmp_desc = acpi_ns_get_attached_object (node);
- if (tmp_desc) {
- /*
- * There is an existing object here; delete it and zero out the
- * object field within the Node
- */
- DUMP_PATHNAME (node,
- "Ex_create_buffer_field: Removing Current Reference",
- ACPI_LV_BFIELD, _COMPONENT);
-
- DUMP_ENTRY (node, ACPI_LV_BFIELD);
- DUMP_STACK_ENTRY (tmp_desc);
-
- acpi_ut_remove_reference (tmp_desc);
- acpi_ns_attach_object ((acpi_namespace_node *) node, NULL,
- ACPI_TYPE_ANY);
- }
-
- /* Set the type to ANY (or the store below will fail) */
-
- ((acpi_namespace_node *) node)->type = ACPI_TYPE_ANY;
-
- break;
-
-
- default:
-
- break;
- }
-
-
- /* Store constructed field descriptor in result location */
-
- status = acpi_ex_store (obj_desc, (acpi_operand_object *) node,
- walk_state);
-
- /*
- * If the field descriptor was not physically stored (or if a failure
- * above), we must delete it
- */
- if (obj_desc->common.reference_count <= 1) {
- acpi_ut_remove_reference (obj_desc);
- }
-
-
- return_ACPI_STATUS (AE_OK);
-
-
-cleanup:
-
- /* Delete region object and method subobject */
-
- if (obj_desc) {
- /* Remove deletes both objects! */
-
- acpi_ut_remove_reference (obj_desc);
- obj_desc = NULL;
- }
-
- return_ACPI_STATUS (status);
-}
-
-
/*****************************************************************************
*
* FUNCTION: Acpi_ex_create_alias
acpi_walk_state *walk_state)
{
acpi_namespace_node *source_node;
- acpi_namespace_node *alias_node;
acpi_status status;
/* Get the source/alias operands (both namespace nodes) */
- source_node = (acpi_namespace_node *) walk_state->operands[walk_state->num_operands -1];
- walk_state->num_operands--;
-
- /*
- * Don't pop it, it gets removed in the calling routine
- */
- alias_node = acpi_ds_obj_stack_get_value (0, walk_state);
+ source_node = (acpi_namespace_node *) walk_state->operands[1];
- /* Add an additional reference to the object */
- acpi_ut_add_reference (source_node->object);
+ /* Attach the original source object to the new Alias Node */
- /*
- * Attach the original source Node to the new Alias Node.
- */
- status = acpi_ns_attach_object (alias_node, source_node->object,
+ status = acpi_ns_attach_object ((acpi_namespace_node *) walk_state->operands[0],
+ source_node->object,
source_node->type);
-
/*
* The new alias assumes the type of the source, but it points
- * to the same object. The reference count of the object has two
- * additional references to prevent deletion out from under either the
+ * to the same object. The reference count of the object has an
+ * additional reference to prevent deletion out from under either the
* source or the alias Node
*/
*
* FUNCTION: Acpi_ex_create_event
*
- * PARAMETERS: None
+ * PARAMETERS: Walk_state - Current state
*
* RETURN: Status
*
status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 1,
&obj_desc->event.semaphore);
if (ACPI_FAILURE (status)) {
- acpi_ut_remove_reference (obj_desc);
goto cleanup;
}
/* Attach object to the Node */
- status = acpi_ns_attach_object (acpi_ds_obj_stack_get_value (0, walk_state),
+ status = acpi_ns_attach_object ((acpi_namespace_node *) walk_state->operands[0],
obj_desc, (u8) ACPI_TYPE_EVENT);
- if (ACPI_FAILURE (status)) {
- acpi_os_delete_semaphore (obj_desc->event.semaphore);
- acpi_ut_remove_reference (obj_desc);
- goto cleanup;
- }
-
cleanup:
-
+ /*
+ * Remove local reference to the object (on error, will cause deletion
+ * of both object and semaphore if present.)
+ */
+ acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
}
*
* FUNCTION: Acpi_ex_create_mutex
*
- * PARAMETERS: Interpreter_mode - Current running mode (load1/Load2/Exec)
- * Operands - List of operands for the opcode
+ * PARAMETERS: Walk_state - Current state
*
* RETURN: Status
*
* DESCRIPTION: Create a new mutex object
*
+ * Mutex (Name[0], Sync_level[1])
+ *
****************************************************************************/
acpi_status
acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
- acpi_operand_object *sync_desc;
acpi_operand_object *obj_desc;
FUNCTION_TRACE_PTR ("Ex_create_mutex", WALK_OPERANDS);
- /* Get the operand */
-
- sync_desc = walk_state->operands[walk_state->num_operands -1];
- walk_state->num_operands--;
-
- /* Attempt to allocate a new object */
+ /* Create the new mutex object */
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_MUTEX);
if (!obj_desc) {
status = acpi_os_create_semaphore (1, 1, &obj_desc->mutex.semaphore);
if (ACPI_FAILURE (status)) {
- acpi_ut_remove_reference (obj_desc);
goto cleanup;
}
- obj_desc->mutex.sync_level = (u8) sync_desc->integer.value;
+ /* Init object and attach to NS node */
- /* Obj_desc was on the stack top, and the name is below it */
+ obj_desc->mutex.sync_level = (u8) walk_state->operands[1]->integer.value;
- status = acpi_ns_attach_object (acpi_ds_obj_stack_get_value (0, walk_state),
+ status = acpi_ns_attach_object ((acpi_namespace_node *) walk_state->operands[0],
obj_desc, (u8) ACPI_TYPE_MUTEX);
- if (ACPI_FAILURE (status)) {
- acpi_os_delete_semaphore (obj_desc->mutex.semaphore);
- acpi_ut_remove_reference (obj_desc);
- goto cleanup;
- }
cleanup:
-
- /* Always delete the operand */
-
- acpi_ut_remove_reference (sync_desc);
-
+ /*
+ * Remove local reference to the object (on error, will cause deletion
+ * of both object and semaphore if present.)
+ */
+ acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
}
*
* FUNCTION: Acpi_ex_create_region
*
- * PARAMETERS: Aml_ptr - Pointer to the region declaration AML
+ * PARAMETERS: Aml_start - Pointer to the region declaration AML
* Aml_length - Max length of the declaration AML
* Operands - List of operands for the opcode
- * Interpreter_mode - Load1/Load2/Execute
+ * Walk_state - Current state
*
* RETURN: Status
*
acpi_status
acpi_ex_create_region (
- u8 *aml_ptr,
+ u8 *aml_start,
u32 aml_length,
u8 region_space,
acpi_walk_state *walk_state)
FUNCTION_TRACE ("Ex_create_region");
+ /* Get the Node from the object stack */
+
+ node = (acpi_namespace_node *) walk_state->operands[0];
+
+ /*
+ * If the region object is already attached to this node,
+ * just return
+ */
+ if (node->object) {
+ return_ACPI_STATUS (AE_OK);
+ }
+
/*
* Space ID must be one of the predefined IDs, or in the user-defined
* range
acpi_ut_get_region_name (region_space), region_space));
- /* Get the Node from the object stack */
-
- node = (acpi_namespace_node *) acpi_ds_obj_stack_get_value (0, walk_state);
-
/* Create the region descriptor */
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION);
goto cleanup;
}
- /*
- * Allocate a method object for this region.
- */
+ /* Allocate a method object for this region */
+
obj_desc->region.extra = acpi_ut_create_internal_object (
INTERNAL_TYPE_EXTRA);
if (!obj_desc->region.extra) {
* Remember location in AML stream of address & length
* operands since they need to be evaluated at run time.
*/
- obj_desc->region.extra->extra.pcode = aml_ptr;
- obj_desc->region.extra->extra.pcode_length = aml_length;
+ obj_desc->region.extra->extra.aml_start = aml_start;
+ obj_desc->region.extra->extra.aml_length = aml_length;
/* Init the region from the operands */
- obj_desc->region.space_id = region_space;
- obj_desc->region.address = 0;
- obj_desc->region.length = 0;
-
+ obj_desc->region.space_id = region_space;
+ obj_desc->region.address = 0;
+ obj_desc->region.length = 0;
+ obj_desc->region.node = node;
/* Install the new region object in the parent Node */
- obj_desc->region.node = node;
-
status = acpi_ns_attach_object (node, obj_desc,
(u8) ACPI_TYPE_REGION);
-
if (ACPI_FAILURE (status)) {
goto cleanup;
}
* Namespace is NOT locked at this point.
*/
status = acpi_ev_initialize_region (obj_desc, FALSE);
-
if (ACPI_FAILURE (status)) {
/*
* If AE_NOT_EXIST is returned, it is not fatal
cleanup:
- if (ACPI_FAILURE (status)) {
- /* Delete region object and method subobject */
+ /* Remove local reference to the object */
- if (obj_desc) {
- /* Remove deletes both objects! */
+ acpi_ut_remove_reference (obj_desc);
- acpi_ut_remove_reference (obj_desc);
- obj_desc = NULL;
- }
+ return_ACPI_STATUS (status);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: Acpi_ex_create_table_region
+ *
+ * PARAMETERS: Walk_state - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a new Data_table_region object
+ *
+ ****************************************************************************/
+
+acpi_status
+acpi_ex_create_table_region (
+ acpi_walk_state *walk_state)
+{
+ acpi_status status = AE_OK;
+
+
+ FUNCTION_TRACE ("Ex_create_table_region");
+
+/*
+ acpi_operand_object *Obj_desc;
+ Obj_desc = Acpi_ut_create_internal_object (ACPI_TYPE_REGION);
+ if (!Obj_desc)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
}
+
+Cleanup:
+*/
+
return_ACPI_STATUS (status);
}
*
* DESCRIPTION: Create a new processor object and populate the fields
*
+ * Processor (Name[0], Cpu_iD[1], Pblock_addr[2], Pblock_length[3])
+ *
****************************************************************************/
acpi_status
acpi_ex_create_processor (
- acpi_parse_object *op,
- acpi_namespace_node *processor_node)
+ acpi_walk_state *walk_state)
{
- acpi_status status;
- acpi_parse_object *arg;
+ acpi_operand_object **operand = &walk_state->operands[0];
acpi_operand_object *obj_desc;
+ acpi_status status;
- FUNCTION_TRACE_PTR ("Ex_create_processor", op);
+ FUNCTION_TRACE_PTR ("Ex_create_processor", walk_state);
+ /* Create the processor object */
+
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PROCESSOR);
if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
- /* Install the new processor object in the parent Node */
-
- status = acpi_ns_attach_object (processor_node, obj_desc,
- (u8) ACPI_TYPE_PROCESSOR);
- if (ACPI_FAILURE (status)) {
- acpi_ut_delete_object_desc (obj_desc);
- return_ACPI_STATUS (status);
- }
-
- /* Get first arg and verify existence */
-
- arg = op->value.arg;
- if (!arg) {
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
-
- /* First arg is the Processor ID */
-
- obj_desc->processor.proc_id = (u8) arg->value.integer;
-
- /* Get second arg and verify existence */
-
- arg = arg->next;
- if (!arg) {
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
+ /*
+ * Initialize the processor object from the operands
+ */
+ obj_desc->processor.proc_id = (u8) operand[1]->integer.value;
+ obj_desc->processor.address = (ACPI_IO_ADDRESS) operand[2]->integer.value;
+ obj_desc->processor.length = (u8) operand[3]->integer.value;
- /* Second arg is the PBlock Address */
+ /* Install the processor object in the parent Node */
- obj_desc->processor.address = (ACPI_IO_ADDRESS) arg->value.integer;
+ status = acpi_ns_attach_object ((acpi_namespace_node *) operand[0],
+ obj_desc, (u8) ACPI_TYPE_PROCESSOR);
- /* Get third arg and verify existence */
- arg = arg->next;
- if (!arg) {
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
+ /* Remove local reference to the object */
- /* Third arg is the PBlock Length */
-
- obj_desc->processor.length = (u8) arg->value.integer;
- return_ACPI_STATUS (AE_OK);
+ acpi_ut_remove_reference (obj_desc);
+ return_ACPI_STATUS (status);
}
*
* DESCRIPTION: Create a new Power_resource object and populate the fields
*
+ * Power_resource (Name[0], System_level[1], Resource_order[2])
+ *
****************************************************************************/
acpi_status
acpi_ex_create_power_resource (
- acpi_parse_object *op,
- acpi_namespace_node *power_node)
+ acpi_walk_state *walk_state)
{
+ acpi_operand_object **operand = &walk_state->operands[0];
acpi_status status;
- acpi_parse_object *arg;
acpi_operand_object *obj_desc;
- FUNCTION_TRACE_PTR ("Ex_create_power_resource", op);
+ FUNCTION_TRACE_PTR ("Ex_create_power_resource", walk_state);
+
+ /* Create the power resource object */
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_POWER);
if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
- /* Install the new power resource object in the parent Node */
-
- status = acpi_ns_attach_object (power_node, obj_desc,
- (u8) ACPI_TYPE_POWER);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS(status);
- }
-
-
- /* Get first arg and verify existence */
-
- arg = op->value.arg;
- if (!arg) {
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
-
- /* First arg is the System_level */
+ /* Initialize the power object from the operands */
- obj_desc->power_resource.system_level = (u8) arg->value.integer;
+ obj_desc->power_resource.system_level = (u8) operand[1]->integer.value;
+ obj_desc->power_resource.resource_order = (u16) operand[2]->integer.value;
- /* Get second arg and check existence */
+ /* Install the power resource object in the parent Node */
- arg = arg->next;
- if (!arg) {
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
+ status = acpi_ns_attach_object ((acpi_namespace_node *) operand[0],
+ obj_desc, (u8) ACPI_TYPE_POWER);
- /* Second arg is the PBlock Address */
- obj_desc->power_resource.resource_order = (u16) arg->value.integer;
+ /* Remove local reference to the object */
- return_ACPI_STATUS (AE_OK);
+ acpi_ut_remove_reference (obj_desc);
+ return_ACPI_STATUS (status);
}
*
* FUNCTION: Acpi_ex_create_method
*
- * PARAMETERS: Aml_ptr - First byte of the method's AML
+ * PARAMETERS: Aml_start - First byte of the method's AML
* Aml_length - AML byte count for this method
* Method_flags - AML method flag byte
* Method - Method Node
acpi_status
acpi_ex_create_method (
- u8 *aml_ptr,
+ u8 *aml_start,
u32 aml_length,
- u32 method_flags,
- acpi_namespace_node *method)
+ acpi_walk_state *walk_state)
{
+ acpi_operand_object **operand = &walk_state->operands[0];
acpi_operand_object *obj_desc;
acpi_status status;
+ u8 method_flags;
- FUNCTION_TRACE_PTR ("Ex_create_method", method);
+ FUNCTION_TRACE_PTR ("Ex_create_method", walk_state);
/* Create a new method object */
return_ACPI_STATUS (AE_NO_MEMORY);
}
- /* Get the method's AML pointer/length from the Op */
+ /* Save the method's AML pointer and length */
- obj_desc->method.pcode = aml_ptr;
- obj_desc->method.pcode_length = aml_length;
+ obj_desc->method.aml_start = aml_start;
+ obj_desc->method.aml_length = aml_length;
- /*
- * First argument is the Method Flags (contains parameter count for the
- * method)
- */
- obj_desc->method.method_flags = (u8) method_flags;
- obj_desc->method.param_count = (u8) (method_flags &
- METHOD_FLAGS_ARG_COUNT);
+ /* disassemble the method flags */
+
+ method_flags = (u8) operand[1]->integer.value;
+
+ obj_desc->method.method_flags = method_flags;
+ obj_desc->method.param_count = (u8) (method_flags & METHOD_FLAGS_ARG_COUNT);
/*
* Get the concurrency count. If required, a semaphore will be
/* Attach the new object to the method Node */
- status = acpi_ns_attach_object (method, obj_desc, (u8) ACPI_TYPE_METHOD);
- if (ACPI_FAILURE (status)) {
- acpi_ut_delete_object_desc (obj_desc);
- }
+ status = acpi_ns_attach_object ((acpi_namespace_node *) operand[0],
+ obj_desc, (u8) ACPI_TYPE_METHOD);
+
+ /* Remove local reference to the object */
+
+ acpi_ut_remove_reference (obj_desc);
+
+ /* Remove a reference to the operand */
+ acpi_ut_remove_reference (operand[1]);
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
- * $Revision: 123 $
+ * $Revision: 126 $
*
*****************************************************************************/
* FUNCTION: Acpi_ex_show_hex_value
*
* PARAMETERS: Byte_count - Number of bytes to print (1, 2, or 4)
- * *Aml_ptr - Address in AML stream of bytes to print
+ * *Aml_start - Address in AML stream of bytes to print
* Interpreter_mode - Current running mode (load1/Load2/Exec)
* Lead_space - # of spaces to print ahead of value
* 0 => none ahead but one behind
*
- * DESCRIPTION: Print Byte_count byte(s) starting at Aml_ptr as a single
+ * DESCRIPTION: Print Byte_count byte(s) starting at Aml_start as a single
* value, in hex. If Byte_count > 1 or the value printed is > 9, also
* print in decimal.
*
void
acpi_ex_show_hex_value (
u32 byte_count,
- u8 *aml_ptr,
+ u8 *aml_start,
u32 lead_space)
{
u32 value; /* Value retrieved from AML stream */
FUNCTION_TRACE ("Ex_show_hex_value");
- if (!aml_ptr) {
+ if (!aml_start) {
REPORT_ERROR (("Ex_show_hex_value: null pointer\n"));
}
* AML numbers are always stored little-endian,
* even if the processor is big-endian.
*/
- for (current_aml_ptr = aml_ptr + byte_count,
+ for (current_aml_ptr = aml_start + byte_count,
value = 0;
- current_aml_ptr > aml_ptr; ) {
+ current_aml_ptr > aml_start; ) {
value = (value << 8) + (u32)* --current_aml_ptr;
}
length += 3 + acpi_ex_digits_needed (value, 10);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, ""));
-
for (length = lead_space; length; --length ) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " "));
}
while (byte_count--) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, "%02x", *aml_ptr++));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, "%02x", *aml_start++));
if (byte_count) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " "));
}
if (show_decimal_value) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " [%ld]", value));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " [%d]", value));
}
if (0 == lead_space) {
return (AE_OK);
}
- if (acpi_tb_system_table_pointer (entry_desc)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p is an AML pointer\n",
- entry_desc));
- return (AE_OK);
- }
-
if (!VALID_DESCRIPTOR_TYPE (entry_desc, ACPI_DESC_TYPE_INTERNAL)) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p Is not a local object \n", entry_desc));
DUMP_BUFFER (entry_desc, sizeof (acpi_operand_object));
if (ACPI_TYPE_INTEGER == entry_desc->common.type) {
/* Value is a Number */
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " value is [%ld]",
- entry_desc->integer.value));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " value is [%8.8X%8.8x]",
+ HIDWORD(entry_desc->integer.value),
+ LODWORD(entry_desc->integer.value)));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
/* Value is a Number */
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " value is [%ld]",
- entry_desc->integer.value));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " value is [%8.8X%8.8x]",
+ HIDWORD(entry_desc->integer.value),
+ LODWORD(entry_desc->integer.value)));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
case AML_INT_NAMEPATH_OP:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference.Node->Name %x\n",
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference.Node->Name %X\n",
entry_desc->reference.node->name));
break;
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Buffer Contents: "));
for (buf = entry_desc->buffer.pointer; length--; ++buf) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
- length ? " %02x" : " %02x", *buf));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " %02x", *buf));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,"\n"));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
}
else {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " base %p Length %X\n",
- entry_desc->region.address, entry_desc->region.length));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " base %8.8X%8.8X Length %X\n",
+ HIDWORD(entry_desc->region.address),
+ LODWORD(entry_desc->region.address),
+ entry_desc->region.length));
}
break;
case INTERNAL_TYPE_REGION_FIELD:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
- "Region_field: bits=%X bitaccwidth=%X lock=%X update=%X at byte=%lX bit=%X of below:\n",
+ "Region_field: bits=%X bitaccwidth=%X lock=%X update=%X at byte=%X bit=%X of below:\n",
entry_desc->field.bit_length, entry_desc->field.access_bit_width,
entry_desc->field.lock_rule, entry_desc->field.update_rule,
entry_desc->field.base_byte_offset, entry_desc->field.start_field_bit_offset));
case ACPI_TYPE_BUFFER_FIELD:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
- "Buffer_field: %X bits at byte %lX bit %X of \n",
+ "Buffer_field: %X bits at byte %X bit %X of \n",
entry_desc->buffer_field.bit_length, entry_desc->buffer_field.base_byte_offset,
entry_desc->buffer_field.start_field_bit_offset));
case ACPI_TYPE_METHOD:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
- "Method(%X) @ %p:%lX\n",
+ "Method(%X) @ %p:%X\n",
entry_desc->method.param_count,
- entry_desc->method.pcode, entry_desc->method.pcode_length));
+ entry_desc->method.aml_start, entry_desc->method.aml_length));
break;
}
- acpi_os_printf ("%20s : %4.4s\n", "Name", &node->name);
+ acpi_os_printf ("%20s : %4.4s\n", "Name", (char*)&node->name);
acpi_os_printf ("%20s : %s\n", "Type", acpi_ut_get_type_name (node->type));
acpi_os_printf ("%20s : %X\n", "Flags", node->flags);
acpi_os_printf ("%20s : %X\n", "Owner Id", node->owner_id);
acpi_os_printf ("%20s : %X\n", "Param_count", obj_desc->method.param_count);
acpi_os_printf ("%20s : %X\n", "Concurrency", obj_desc->method.concurrency);
acpi_os_printf ("%20s : %p\n", "Semaphore", obj_desc->method.semaphore);
- acpi_os_printf ("%20s : %X\n", "Pcode_length", obj_desc->method.pcode_length);
- acpi_os_printf ("%20s : %X\n", "Pcode", obj_desc->method.pcode);
+ acpi_os_printf ("%20s : %X\n", "Aml_length", obj_desc->method.aml_length);
+ acpi_os_printf ("%20s : %X\n", "Aml_start", obj_desc->method.aml_start);
break;
+++ /dev/null
-/******************************************************************************
- *
- * Module Name: exdyadic - ACPI AML execution for dyadic (2-operand) operators
- * $Revision: 88 $
- *
- *****************************************************************************/
-
-/*
- * 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 ACPI_EXECUTER
- MODULE_NAME ("exdyadic")
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_do_concatenate
- *
- * PARAMETERS: *Obj_desc - Object to be converted. Must be an
- * Integer, Buffer, or String
- * Walk_state - Current walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_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);
-
-
- FUNCTION_ENTRY ();
-
-
- /*
- * 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_ut_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_MEM_CALLOCATE (ret_desc->buffer.length);
- if (!new_buf) {
- REPORT_ERROR
- (("Ex_do_concatenate: 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_ut_create_internal_object (ACPI_TYPE_STRING);
- if (!ret_desc) {
- return (AE_NO_MEMORY);
- }
-
- /* Operand1 is string */
-
- new_buf = ACPI_MEM_ALLOCATE (obj_desc->string.length +
- obj_desc2->string.length + 1);
- if (!new_buf) {
- REPORT_ERROR
- (("Ex_do_concatenate: 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_ut_create_internal_object (ACPI_TYPE_BUFFER);
- if (!ret_desc) {
- return (AE_NO_MEMORY);
- }
-
- new_buf = ACPI_MEM_ALLOCATE (obj_desc->buffer.length +
- obj_desc2->buffer.length);
- if (!new_buf) {
- REPORT_ERROR
- (("Ex_do_concatenate: 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_ut_remove_reference (ret_desc);
- return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_dyadic1
- *
- * PARAMETERS: Opcode - The opcode to be executed
- * Walk_state - Current walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Type 1 dyadic operator with numeric operands:
- * Notify_op
- *
- * ALLOCATION: Deletes both operands
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_dyadic1 (
- u16 opcode,
- acpi_walk_state *walk_state)
-{
- acpi_operand_object **operand = &walk_state->operands[0];
- acpi_namespace_node *node;
- acpi_status status = AE_OK;
-
-
- FUNCTION_TRACE_PTR ("Ex_dyadic1", WALK_OPERANDS);
-
-
- /* Examine the opcode */
-
- switch (opcode) {
-
- /* Def_notify := Notify_op (0)Notify_object (1)Notify_value */
-
- case AML_NOTIFY_OP:
-
- /* The Obj_desc is actually an Node */
-
- node = (acpi_namespace_node *) operand[0];
- operand[0] = NULL;
-
- /* Object must be a device or thermal zone */
-
- if (node && operand[1]) {
- switch (node->type) {
- case ACPI_TYPE_DEVICE:
- case ACPI_TYPE_THERMAL:
-
- /*
- * Dispatch the notify to the appropriate handler
- * NOTE: the request is queued for execution after this method
- * completes. The notify handlers are NOT invoked synchronously
- * from this thread -- because handlers may in turn run other
- * control methods.
- */
- status = acpi_ev_queue_notify_request (node,
- (u32) operand[1]->integer.value);
- break;
-
- default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unexpected notify object type %X\n",
- operand[0]->common.type));
-
- status = AE_AML_OPERAND_TYPE;
- break;
- }
- }
- break;
-
- default:
-
- REPORT_ERROR (("Acpi_ex_dyadic1: Unknown dyadic opcode %X\n", opcode));
- status = AE_AML_BAD_OPCODE;
- }
-
-
- /* Always delete both operands */
-
- acpi_ut_remove_reference (operand[1]);
- acpi_ut_remove_reference (operand[0]);
-
-
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_dyadic2_r
- *
- * PARAMETERS: Opcode - The opcode to be executed
- * Walk_state - Current walk state
- * Return_desc - Where to store the return object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Type 2 dyadic operator with numeric operands and
- * one or two result operands.
- *
- * ALLOCATION: Deletes one operand descriptor -- other remains on stack
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_dyadic2_r (
- u16 opcode,
- acpi_walk_state *walk_state,
- acpi_operand_object **return_desc)
-{
- acpi_operand_object **operand = &walk_state->operands[0];
- acpi_operand_object *ret_desc = NULL;
- acpi_operand_object *ret_desc2 = NULL;
- acpi_status status = AE_OK;
-
-
- FUNCTION_TRACE_U32 ("Ex_dyadic2_r", opcode);
-
-
- /* Create an internal return object if necessary */
-
- switch (opcode) {
- case AML_ADD_OP:
- case AML_BIT_AND_OP:
- case AML_BIT_NAND_OP:
- case AML_BIT_OR_OP:
- case AML_BIT_NOR_OP:
- case AML_BIT_XOR_OP:
- case AML_DIVIDE_OP:
- case AML_MOD_OP:
- case AML_MULTIPLY_OP:
- case AML_SHIFT_LEFT_OP:
- case AML_SHIFT_RIGHT_OP:
- case AML_SUBTRACT_OP:
-
- ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
- if (!ret_desc) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
- break;
- }
-
-
- /*
- * Execute the opcode
- */
- switch (opcode) {
-
- /* Def_add := Add_op Operand1 Operand2 Result */
-
- case AML_ADD_OP:
-
- ret_desc->integer.value = operand[0]->integer.value +
- operand[1]->integer.value;
- break;
-
-
- /* Def_and := And_op Operand1 Operand2 Result */
-
- case AML_BIT_AND_OP:
-
- ret_desc->integer.value = operand[0]->integer.value &
- operand[1]->integer.value;
- break;
-
-
- /* Def_nAnd := NAnd_op Operand1 Operand2 Result */
-
- case AML_BIT_NAND_OP:
-
- ret_desc->integer.value = ~(operand[0]->integer.value &
- operand[1]->integer.value);
- break;
-
-
- /* Def_or := Or_op Operand1 Operand2 Result */
-
- case AML_BIT_OR_OP:
-
- ret_desc->integer.value = operand[0]->integer.value |
- operand[1]->integer.value;
- break;
-
-
- /* Def_nOr := NOr_op Operand1 Operand2 Result */
-
- case AML_BIT_NOR_OP:
-
- ret_desc->integer.value = ~(operand[0]->integer.value |
- operand[1]->integer.value);
- break;
-
-
- /* Def_xOr := XOr_op Operand1 Operand2 Result */
-
- case AML_BIT_XOR_OP:
-
- ret_desc->integer.value = operand[0]->integer.value ^
- operand[1]->integer.value;
- break;
-
-
- /* Def_divide := Divide_op Dividend Divisor Remainder Quotient */
-
- case AML_DIVIDE_OP:
-
- if (!operand[1]->integer.value) {
- REPORT_ERROR
- (("Divide_op: Divide by zero\n"));
-
- status = AE_AML_DIVIDE_BY_ZERO;
- goto cleanup;
- }
-
- ret_desc2 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
- if (!ret_desc2) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
- /* Remainder (modulo) */
-
- ret_desc->integer.value = ACPI_MODULO (operand[0]->integer.value,
- operand[1]->integer.value);
-
- /* Result (what we used to call the quotient) */
-
- ret_desc2->integer.value = ACPI_DIVIDE (operand[0]->integer.value,
- operand[1]->integer.value);
- break;
-
-
- /* Def_mod := Mod_op Dividend Divisor Remainder */
-
- case AML_MOD_OP: /* ACPI 2.0 */
-
- if (!operand[1]->integer.value) {
- REPORT_ERROR
- (("Mod_op: Divide by zero\n"));
-
- status = AE_AML_DIVIDE_BY_ZERO;
- goto cleanup;
- }
-
- /* Remainder (modulo) */
-
- ret_desc->integer.value = ACPI_MODULO (operand[0]->integer.value,
- operand[1]->integer.value);
- break;
-
-
- /* Def_multiply := Multiply_op Operand1 Operand2 Result */
-
- case AML_MULTIPLY_OP:
-
- ret_desc->integer.value = operand[0]->integer.value *
- operand[1]->integer.value;
- break;
-
-
- /* Def_shift_left := Shift_left_op Operand Shift_count Result */
-
- case AML_SHIFT_LEFT_OP:
-
- ret_desc->integer.value = operand[0]->integer.value <<
- operand[1]->integer.value;
- break;
-
-
- /* Def_shift_right := Shift_right_op Operand Shift_count Result */
-
- case AML_SHIFT_RIGHT_OP:
-
- ret_desc->integer.value = operand[0]->integer.value >>
- operand[1]->integer.value;
- break;
-
-
- /* Def_subtract := Subtract_op Operand1 Operand2 Result */
-
- case AML_SUBTRACT_OP:
-
- ret_desc->integer.value = operand[0]->integer.value -
- operand[1]->integer.value;
- break;
-
-
- /* Def_concat := Concat_op Data1 Data2 Result */
-
- case AML_CONCAT_OP:
-
- /*
- * 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.
- */
- switch (operand[0]->common.type) {
- case ACPI_TYPE_INTEGER:
- status = acpi_ex_convert_to_integer (operand[1], &operand[1], walk_state);
- break;
-
- case ACPI_TYPE_STRING:
- status = acpi_ex_convert_to_string (operand[1], &operand[1], 16, ACPI_UINT32_MAX, walk_state);
- break;
-
- case ACPI_TYPE_BUFFER:
- status = acpi_ex_convert_to_buffer (operand[1], &operand[1], walk_state);
- break;
-
- default:
- status = AE_AML_INTERNAL;
- }
-
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
-
-
- /*
- * 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_ex_do_concatenate (operand[0], operand[1], &ret_desc, walk_state);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
- break;
-
-
- /* Def_to_string := Buffer, Length, Result */
-
- case AML_TO_STRING_OP: /* ACPI 2.0 */
-
- status = acpi_ex_convert_to_string (operand[0], &ret_desc, 16,
- (u32) operand[1]->integer.value, walk_state);
- break;
-
-
- /* Def_concat_res := Buffer, Buffer, Result */
-
- case AML_CONCAT_RES_OP: /* ACPI 2.0 */
-
- status = AE_NOT_IMPLEMENTED;
- goto cleanup;
- break;
-
-
- default:
-
- REPORT_ERROR (("Acpi_ex_dyadic2_r: Unknown dyadic opcode %X\n",
- opcode));
- status = AE_AML_BAD_OPCODE;
- goto cleanup;
- }
-
-
- /*
- * Store the result of the operation (which is now in Operand[0]) into
- * the result descriptor, or the location pointed to by the result
- * descriptor (Operand[2]).
- */
- status = acpi_ex_store (ret_desc, operand[2], walk_state);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
-
- if (AML_DIVIDE_OP == opcode) {
- status = acpi_ex_store (ret_desc2, operand[3], walk_state);
-
- /*
- * Since the remainder is not returned, remove a reference to
- * the object we created earlier
- */
- acpi_ut_remove_reference (ret_desc);
- *return_desc = ret_desc2;
- }
-
- else {
- *return_desc = ret_desc;
- }
-
-
-cleanup:
-
- /* Always delete the operands */
-
- acpi_ut_remove_reference (operand[0]);
- acpi_ut_remove_reference (operand[1]);
-
-
- /* Delete return object on error */
-
- if (ACPI_FAILURE (status)) {
- /* On failure, delete the result ops */
-
- acpi_ut_remove_reference (operand[2]);
- acpi_ut_remove_reference (operand[3]);
-
- if (ret_desc) {
- /* And delete the internal return object */
-
- acpi_ut_remove_reference (ret_desc);
- ret_desc = NULL;
- }
- }
-
- /* Set the return object and exit */
-
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_dyadic2_s
- *
- * PARAMETERS: Opcode - The opcode to be executed
- * Walk_state - Current walk state
- * Return_desc - Where to store the return object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Type 2 dyadic synchronization operator
- *
- * ALLOCATION: Deletes one operand descriptor -- other remains on stack
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_dyadic2_s (
- u16 opcode,
- acpi_walk_state *walk_state,
- acpi_operand_object **return_desc)
-{
- acpi_operand_object **operand = &walk_state->operands[0];
- acpi_operand_object *ret_desc = NULL;
- acpi_status status;
-
-
- FUNCTION_TRACE_PTR ("Ex_dyadic2_s", WALK_OPERANDS);
-
-
- /* Create the internal return object */
-
- ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
- if (!ret_desc) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
- /* Default return value is FALSE, operation did not time out */
-
- ret_desc->integer.value = 0;
-
-
- /* Examine the opcode */
-
- switch (opcode) {
-
- /* Def_acquire := Acquire_op Mutex_object Timeout */
-
- case AML_ACQUIRE_OP:
-
- status = acpi_ex_acquire_mutex (operand[1], operand[0], walk_state);
- break;
-
-
- /* Def_wait := Wait_op Acpi_event_object Timeout */
-
- case AML_WAIT_OP:
-
- status = acpi_ex_system_wait_event (operand[1], operand[0]);
- break;
-
-
- default:
-
- REPORT_ERROR (("Acpi_ex_dyadic2_s: Unknown dyadic synchronization opcode %X\n", opcode));
- status = AE_AML_BAD_OPCODE;
- goto cleanup;
- }
-
-
- /*
- * Return a boolean indicating if operation timed out
- * (TRUE) or not (FALSE)
- */
- if (status == AE_TIME) {
- ret_desc->integer.value = ACPI_INTEGER_MAX; /* TRUE, op timed out */
- status = AE_OK;
- }
-
-
-cleanup:
-
- /* Delete params */
-
- acpi_ut_remove_reference (operand[1]);
- acpi_ut_remove_reference (operand[0]);
-
- /* Delete return object on error */
-
- if (ACPI_FAILURE (status) &&
- (ret_desc)) {
- acpi_ut_remove_reference (ret_desc);
- ret_desc = NULL;
- }
-
-
- /* Set the return object and exit */
-
- *return_desc = ret_desc;
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_dyadic2
- *
- * PARAMETERS: Opcode - The opcode to be executed
- * Walk_state - Current walk state
- * Return_desc - Where to store the return object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Type 2 dyadic operator with numeric operands and
- * no result operands
- *
- * ALLOCATION: Deletes one operand descriptor -- other remains on stack
- * containing result value
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_dyadic2 (
- u16 opcode,
- acpi_walk_state *walk_state,
- acpi_operand_object **return_desc)
-{
- acpi_operand_object **operand = &walk_state->operands[0];
- acpi_operand_object *ret_desc = NULL;
- acpi_status status = AE_OK;
- u8 lboolean;
-
-
- FUNCTION_TRACE_PTR ("Ex_dyadic2", WALK_OPERANDS);
-
-
- /* Create the internal return object */
-
- ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
- if (!ret_desc) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
- /*
- * Execute the Opcode
- */
- lboolean = FALSE;
- switch (opcode) {
-
- /* Def_lAnd := LAnd_op Operand1 Operand2 */
-
- case AML_LAND_OP:
-
- lboolean = (u8) (operand[0]->integer.value &&
- operand[1]->integer.value);
- break;
-
-
- /* Def_lEqual := LEqual_op Operand1 Operand2 */
-
- case AML_LEQUAL_OP:
-
- lboolean = (u8) (operand[0]->integer.value ==
- operand[1]->integer.value);
- break;
-
-
- /* Def_lGreater := LGreater_op Operand1 Operand2 */
-
- case AML_LGREATER_OP:
-
- lboolean = (u8) (operand[0]->integer.value >
- operand[1]->integer.value);
- break;
-
-
- /* Def_lLess := LLess_op Operand1 Operand2 */
-
- case AML_LLESS_OP:
-
- lboolean = (u8) (operand[0]->integer.value <
- operand[1]->integer.value);
- break;
-
-
- /* Def_lOr := LOr_op Operand1 Operand2 */
-
- case AML_LOR_OP:
-
- lboolean = (u8) (operand[0]->integer.value ||
- operand[1]->integer.value);
- break;
-
-
- /* Def_copy := Source, Destination */
-
- case AML_COPY_OP: /* ACPI 2.0 */
-
- status = AE_NOT_IMPLEMENTED;
- goto cleanup;
- break;
-
-
- default:
-
- REPORT_ERROR (("Acpi_ex_dyadic2: Unknown dyadic opcode %X\n", opcode));
- status = AE_AML_BAD_OPCODE;
- goto cleanup;
- break;
- }
-
-
- /* Set return value to logical TRUE (all ones) or FALSE (zero) */
-
- if (lboolean) {
- ret_desc->integer.value = ACPI_INTEGER_MAX;
- }
- else {
- ret_desc->integer.value = 0;
- }
-
-
-cleanup:
-
- /* Always delete operands */
-
- acpi_ut_remove_reference (operand[0]);
- acpi_ut_remove_reference (operand[1]);
-
-
- /* Delete return object on error */
-
- if (ACPI_FAILURE (status) &&
- (ret_desc)) {
- acpi_ut_remove_reference (ret_desc);
- ret_desc = NULL;
- }
-
-
- /* Set the return object and exit */
-
- *return_desc = ret_desc;
- return_ACPI_STATUS (status);
-}
-
-
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
- * $Revision: 64 $
+ * $Revision: 66 $
*
*****************************************************************************/
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
-
/*
* If the Region Address and Length have not been previously evaluated,
* evaluate them now and save the results.
}
}
-
/*
* Validate the request. The entire request from the byte offset for a
* length of one field datum (access width) must fit within the region.
*value = 0;
-
/*
* Buffer_fields - Read from a Buffer
* Other Fields - Read from a Operation Region.
return_ACPI_STATUS (status);
}
-
/*
* The physical address of this field datum is:
*
address = rgn_desc->region.address + obj_desc->common_field.base_byte_offset +
field_datum_byte_offset;
- ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Region %s(%X) width %X base:off %X:%X at %8.8lX%8.8lX\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Region %s(%X) width %X base:off %X:%X at %8.8X%8.8X\n",
acpi_ut_get_region_name (rgn_desc->region.space_id),
rgn_desc->region.space_id, obj_desc->common_field.access_bit_width,
obj_desc->common_field.base_byte_offset, field_datum_byte_offset,
HIDWORD(address), LODWORD(address)));
-
/* Invoke the appropriate Address_space/Op_region handler */
status = acpi_ev_address_space_dispatch (rgn_desc, ACPI_READ_ADR_SPACE,
}
- ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Returned value=%08lX \n", *value));
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Returned value=%08X \n", *value));
return_ACPI_STATUS (status);
}
byte_field_length, datum_count, obj_desc->common_field.access_bit_width,
obj_desc->common_field.access_byte_width));
-
/*
* Clear the caller's buffer (the whole buffer length as given)
* This is very important, especially in the cases where a byte is read,
}
}
-
/*
* Store the merged field datum in the caller's buffer, according to
* the granularity of the field (size of each datum).
datum_offset++;
}
-
return_ACPI_STATUS (AE_OK);
}
field_datum_byte_offset;
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
- "Store %X in Region %s(%X) at %8.8lX%8.8lX width %X\n",
+ "Store %X in Region %s(%X) at %8.8X%8.8X width %X\n",
value, acpi_ut_get_region_name (rgn_desc->region.space_id),
rgn_desc->region.space_id, HIDWORD(address), LODWORD(address),
obj_desc->common_field.access_bit_width));
}
- ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value written=%08lX \n", value));
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value written=%08X \n", value));
return_ACPI_STATUS (status);
}
merged_value = field_value;
-
/* If the mask is all ones, we don't need to worry about the update rule */
if (mask != ACPI_UINT32_MAX) {
/* Decode the update rule */
switch (obj_desc->common_field.update_rule) {
-
case UPDATE_PRESERVE:
-
/*
* Check if update rule needs to be applied (not if mask is all
* ones) The left shift drops the bits we want to ignore.
byte_field_length, datum_count, obj_desc->common_field.access_bit_width,
obj_desc->common_field.access_byte_width));
-
/*
* Break the request into up to three parts (similar to an I/O request):
* 1) non-aligned part at start
merged_datum = this_raw_datum;
}
-
/*
* Special handling for the last datum if the field does NOT end on
* a datum boundary. Update Rule must be applied to the bits outside
* the field.
*/
- if ((datum_offset == datum_count) &&
- obj_desc->common_field.end_field_valid_bits) {
+ if (datum_offset == datum_count) {
/*
- * Part3:
- * This is the last datum and the field does not end on a datum boundary.
- * Build the partial datum and write with the update rule.
+ * If there are dangling non-aligned bits, perform one more merged write
+ * Else - field is aligned at the end, no need for any more writes
*/
+ if (obj_desc->common_field.end_field_valid_bits) {
+ /*
+ * Part3:
+ * This is the last datum and the field does not end on a datum boundary.
+ * Build the partial datum and write with the update rule.
+ *
+ * Mask off the unused bits above (after) the end-of-field
+ */
+ mask = MASK_BITS_ABOVE (obj_desc->common_field.end_field_valid_bits);
+ merged_datum &= mask;
- /* Mask off the unused bits above (after) the end-of-field */
-
- mask = MASK_BITS_ABOVE (obj_desc->common_field.end_field_valid_bits);
- merged_datum &= mask;
-
- /* Write the last datum with the update rule */
+ /* Write the last datum with the update rule */
- status = acpi_ex_write_field_datum_with_update_rule (obj_desc, mask,
- merged_datum, field_datum_byte_offset);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ex_write_field_datum_with_update_rule (obj_desc, mask,
+ merged_datum, field_datum_byte_offset);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
}
}
previous_raw_datum = this_raw_datum;
}
-
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
- * $Revision: 83 $
+ * $Revision: 92 $
*
*****************************************************************************/
/*******************************************************************************
*
- * FUNCTION: Acpi_ex_triadic
+ * FUNCTION: Acpi_ex_get_object_reference
*
- * PARAMETERS: Opcode - The opcode to be executed
- * Walk_state - Current walk state
- * Return_desc - Where to store the return object
+ * PARAMETERS: Obj_desc - Create a reference to this object
+ * Return_desc - Where to store the reference
*
* RETURN: Status
*
- * DESCRIPTION: Execute Triadic operator (3 operands)
- *
- * ALLOCATION: Deletes one operand descriptor -- other remains on stack
+ * DESCRIPTION: Obtain and return a "reference" to the target object
+ * Common code for the Ref_of_op and the Cond_ref_of_op.
*
******************************************************************************/
acpi_status
-acpi_ex_triadic (
- u16 opcode,
- acpi_walk_state *walk_state,
- acpi_operand_object **return_desc)
+acpi_ex_get_object_reference (
+ acpi_operand_object *obj_desc,
+ acpi_operand_object **return_desc,
+ acpi_walk_state *walk_state)
{
- acpi_operand_object **operand = &walk_state->operands[0];
- acpi_operand_object *ret_desc = NULL;
- acpi_operand_object *tmp_desc;
- ACPI_SIGNAL_FATAL_INFO *fatal;
acpi_status status = AE_OK;
- FUNCTION_TRACE ("Ex_triadic");
-
-
-#define obj_desc1 operand[0]
-#define obj_desc2 operand[1]
-#define res_desc operand[2]
+ FUNCTION_TRACE_PTR ("Ex_get_object_reference", obj_desc);
- switch (opcode) {
-
- case AML_FATAL_OP:
+ if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
+ if (obj_desc->common.type != INTERNAL_TYPE_REFERENCE) {
+ *return_desc = NULL;
+ status = AE_TYPE;
+ goto cleanup;
+ }
- /* Def_fatal := Fatal_op Fatal_type Fatal_code Fatal_arg */
+ /*
+ * Not a Name -- an indirect name pointer would have
+ * been converted to a direct name pointer in Acpi_ex_resolve_operands
+ */
+ switch (obj_desc->reference.opcode) {
+ case AML_LOCAL_OP:
+ case AML_ARG_OP:
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Fatal_op: Type %x Code %x Arg %x <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
- (u32) obj_desc1->integer.value, (u32) obj_desc2->integer.value,
- (u32) res_desc->integer.value));
+ *return_desc = (void *) acpi_ds_method_data_get_node (obj_desc->reference.opcode,
+ obj_desc->reference.offset, walk_state);
+ break;
+ default:
- fatal = ACPI_MEM_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO));
- if (fatal) {
- fatal->type = (u32) obj_desc1->integer.value;
- fatal->code = (u32) obj_desc2->integer.value;
- fatal->argument = (u32) res_desc->integer.value;
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(Internal) Unknown Ref subtype %02x\n",
+ obj_desc->reference.opcode));
+ *return_desc = NULL;
+ status = AE_AML_INTERNAL;
+ goto cleanup;
}
- /*
- * Signal the OS
- */
- acpi_os_signal (ACPI_SIGNAL_FATAL, fatal);
+ }
- /* Might return while OS is shutting down */
+ else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
+ /* Must be a named object; Just return the Node */
- ACPI_MEM_FREE (fatal);
- break;
+ *return_desc = obj_desc;
+ }
+ else {
+ *return_desc = NULL;
+ status = AE_TYPE;
+ }
- case AML_MID_OP:
- /* Def_mid := Mid_op Source Index Length Result */
+cleanup:
- /* Create the internal return object (string or buffer) */
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p Ref=%p\n", obj_desc, *return_desc));
+ return_ACPI_STATUS (status);
+}
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_do_concatenate
+ *
+ * PARAMETERS: *Obj_desc - Object to be converted. Must be an
+ * Integer, Buffer, or String
+ * Walk_state - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
+ *
+ ******************************************************************************/
- case AML_INDEX_OP:
+acpi_status
+acpi_ex_do_concatenate (
+ acpi_operand_object *obj_desc,
+ acpi_operand_object *obj_desc2,
+ acpi_operand_object **actual_return_desc,
+ acpi_walk_state *walk_state)
+{
+ acpi_status status;
+ u32 i;
+ acpi_integer this_integer;
+ acpi_operand_object *return_desc;
+ NATIVE_CHAR *new_buf;
+ u32 integer_size = sizeof (acpi_integer);
- /* Def_index := Index_op Source Index Destination */
- /* Create the internal return object */
+ FUNCTION_ENTRY ();
- ret_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
- if (!ret_desc) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
- /*
- * At this point, the Obj_desc1 operand is either a Package or a Buffer
- */
- if (obj_desc1->common.type == ACPI_TYPE_PACKAGE) {
- /* Object to be indexed is a Package */
-
- if (obj_desc2->integer.value >= obj_desc1->package.count) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value beyond package end\n"));
- status = AE_AML_PACKAGE_LIMIT;
- goto cleanup;
- }
-
- if ((res_desc->common.type == INTERNAL_TYPE_REFERENCE) &&
- (res_desc->reference.opcode == AML_ZERO_OP)) {
- /*
- * There is no actual result descriptor (the Zero_op Result
- * descriptor is a placeholder), so just delete the placeholder and
- * return a reference to the package element
- */
- acpi_ut_remove_reference (res_desc);
- }
-
- else {
- /*
- * Each element of the package is an internal object. Get the one
- * we are after.
- */
- tmp_desc = obj_desc1->package.elements[obj_desc2->integer.value];
- ret_desc->reference.opcode = AML_INDEX_OP;
- ret_desc->reference.target_type = tmp_desc->common.type;
- ret_desc->reference.object = tmp_desc;
-
- status = acpi_ex_store (ret_desc, res_desc, walk_state);
- ret_desc->reference.object = NULL;
- }
+ /*
+ * 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) {
/*
- * The local return object must always be a reference to the package element,
- * not the element itself.
+ * 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
*/
- ret_desc->reference.opcode = AML_INDEX_OP;
- ret_desc->reference.target_type = ACPI_TYPE_PACKAGE;
- ret_desc->reference.where = &obj_desc1->package.elements[obj_desc2->integer.value];
+ integer_size = sizeof (u32);
}
- else {
- /* Object to be indexed is a Buffer */
-
- if (obj_desc2->integer.value >= obj_desc1->buffer.length) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value beyond end of buffer\n"));
- status = AE_AML_BUFFER_LIMIT;
- goto cleanup;
- }
+ /* Result of two integers is a buffer */
- ret_desc->reference.opcode = AML_INDEX_OP;
- ret_desc->reference.target_type = ACPI_TYPE_BUFFER_FIELD;
- ret_desc->reference.object = obj_desc1;
- ret_desc->reference.offset = (u32) obj_desc2->integer.value;
-
- status = acpi_ex_store (ret_desc, res_desc, walk_state);
+ return_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
+ if (!return_desc) {
+ return (AE_NO_MEMORY);
}
- break;
- }
+ /* Need enough space for two integers */
-cleanup:
+ return_desc->buffer.length = integer_size * 2;
+ new_buf = ACPI_MEM_CALLOCATE (return_desc->buffer.length);
+ if (!new_buf) {
+ REPORT_ERROR
+ (("Ex_do_concatenate: Buffer allocation failure\n"));
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
- /* Always delete operands */
+ return_desc->buffer.pointer = (u8 *) new_buf;
- acpi_ut_remove_reference (obj_desc1);
- acpi_ut_remove_reference (obj_desc2);
+ /* Convert the first integer */
- /* Delete return object on error */
+ this_integer = obj_desc->integer.value;
+ for (i = 0; i < integer_size; i++) {
+ new_buf[i] = (u8) this_integer;
+ this_integer >>= 8;
+ }
- if (ACPI_FAILURE (status)) {
- acpi_ut_remove_reference (res_desc);
+ /* Convert the second integer */
- if (ret_desc) {
- acpi_ut_remove_reference (ret_desc);
- ret_desc = NULL;
+ this_integer = obj_desc2->integer.value;
+ for (; i < (integer_size * 2); i++) {
+ new_buf[i] = (u8) this_integer;
+ this_integer >>= 8;
}
- }
-
- /* Set the return object and exit */
- *return_desc = ret_desc;
- return_ACPI_STATUS (status);
-}
+ break;
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_hexadic
- *
- * PARAMETERS: Opcode - The opcode to be executed
- * Walk_state - Current walk state
- * Return_desc - Where to store the return object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Match operator
- *
- ******************************************************************************/
+ case ACPI_TYPE_STRING:
-acpi_status
-acpi_ex_hexadic (
- u16 opcode,
- acpi_walk_state *walk_state,
- acpi_operand_object **return_desc)
-{
- acpi_operand_object **operand = &walk_state->operands[0];
- acpi_operand_object *ret_desc = NULL;
- acpi_status status = AE_OK;
- u32 index;
- u32 match_value = (u32) -1;
+ return_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
+ if (!return_desc) {
+ return (AE_NO_MEMORY);
+ }
+ /* Operand0 is string */
- FUNCTION_TRACE ("Ex_hexadic");
+ new_buf = ACPI_MEM_ALLOCATE (obj_desc->string.length +
+ obj_desc2->string.length + 1);
+ if (!new_buf) {
+ REPORT_ERROR
+ (("Ex_do_concatenate: String allocation failure\n"));
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
-#define pkg_desc operand[0]
-#define op1_desc operand[1]
-#define V1_desc operand[2]
-#define op2_desc operand[3]
-#define V2_desc operand[4]
-#define start_desc operand[5]
+ 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 */
- switch (opcode) {
+ return_desc->string.pointer = new_buf;
+ return_desc->string.length = obj_desc->string.length +=
+ obj_desc2->string.length;
+ break;
- case AML_MATCH_OP:
- /* Validate match comparison sub-opcodes */
+ case ACPI_TYPE_BUFFER:
- if ((op1_desc->integer.value > MAX_MATCH_OPERATOR) ||
- (op2_desc->integer.value > MAX_MATCH_OPERATOR)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "operation encoding out of range\n"));
- status = AE_AML_OPERAND_VALUE;
- goto cleanup;
- }
+ /* Operand0 is a buffer */
- index = (u32) start_desc->integer.value;
- if (index >= (u32) pkg_desc->package.count) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Start position value out of range\n"));
- status = AE_AML_PACKAGE_LIMIT;
- goto cleanup;
+ return_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
+ if (!return_desc) {
+ return (AE_NO_MEMORY);
}
- ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
- if (!ret_desc) {
+ new_buf = ACPI_MEM_ALLOCATE (obj_desc->buffer.length +
+ obj_desc2->buffer.length);
+ if (!new_buf) {
+ REPORT_ERROR
+ (("Ex_do_concatenate: 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);
+
/*
- * Examine each element until a match is found. Within the loop,
- * "continue" signifies that the current element does not match
- * and the next should be examined.
- * Upon finding a match, the loop will terminate via "break" at
- * the bottom. If it terminates "normally", Match_value will be -1
- * (its initial value) indicating that no match was found. When
- * returned as a Number, this will produce the Ones value as specified.
+ * Point the return object to the new buffer
*/
- for ( ; index < pkg_desc->package.count; ++index) {
- /*
- * Treat any NULL or non-numeric elements as non-matching.
- * TBD [Unhandled] - if an element is a Name,
- * should we examine its value?
- */
- if (!pkg_desc->package.elements[index] ||
- ACPI_TYPE_INTEGER != pkg_desc->package.elements[index]->common.type) {
- continue;
- }
- /*
- * Within these switch statements:
- * "break" (exit from the switch) signifies a match;
- * "continue" (proceed to next iteration of enclosing
- * "for" loop) signifies a non-match.
- */
- switch (op1_desc->integer.value) {
+ return_desc->buffer.pointer = (u8 *) new_buf;
+ return_desc->buffer.length = obj_desc->buffer.length +
+ obj_desc2->buffer.length;
+ break;
- case MATCH_MTR: /* always true */
- break;
+ default:
+ status = AE_AML_INTERNAL;
+ return_desc = NULL;
+ }
- case MATCH_MEQ: /* true if equal */
+ *actual_return_desc = return_desc;
+ return (AE_OK);
- if (pkg_desc->package.elements[index]->integer.value
- != V1_desc->integer.value) {
- continue;
- }
- break;
+cleanup:
- case MATCH_MLE: /* true if less than or equal */
+ acpi_ut_remove_reference (return_desc);
+ return (status);
+}
- if (pkg_desc->package.elements[index]->integer.value
- > V1_desc->integer.value) {
- continue;
- }
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_do_math_op
+ *
+ * PARAMETERS: Opcode - AML opcode
+ * Operand0 - Integer operand #0
+ * Operand0 - Integer operand #1
+ *
+ * RETURN: Integer result of the operation
+ *
+ * DESCRIPTION: Execute a math AML opcode. The purpose of having all of the
+ * math functions here is to prevent a lot of pointer dereferencing
+ * to obtain the operands.
+ *
+ ******************************************************************************/
- case MATCH_MLT: /* true if less than */
+acpi_integer
+acpi_ex_do_math_op (
+ u16 opcode,
+ acpi_integer operand0,
+ acpi_integer operand1)
+{
- if (pkg_desc->package.elements[index]->integer.value
- >= V1_desc->integer.value) {
- continue;
- }
- break;
+ switch (opcode) {
+ case AML_ADD_OP: /* Add (Operand0, Operand1, Result) */
- case MATCH_MGE: /* true if greater than or equal */
+ return (operand0 + operand1);
- if (pkg_desc->package.elements[index]->integer.value
- < V1_desc->integer.value) {
- continue;
- }
- break;
+ case AML_BIT_AND_OP: /* And (Operand0, Operand1, Result) */
- case MATCH_MGT: /* true if greater than */
+ return (operand0 & operand1);
- if (pkg_desc->package.elements[index]->integer.value
- <= V1_desc->integer.value) {
- continue;
- }
- break;
+ case AML_BIT_NAND_OP: /* NAnd (Operand0, Operand1, Result) */
- default: /* undefined */
+ return (~(operand0 & operand1));
- continue;
- }
+ case AML_BIT_OR_OP: /* Or (Operand0, Operand1, Result) */
- switch(op2_desc->integer.value) {
+ return (operand0 | operand1);
- case MATCH_MTR:
- break;
+ case AML_BIT_NOR_OP: /* NOr (Operand0, Operand1, Result) */
+ return (~(operand0 | operand1));
- case MATCH_MEQ:
- if (pkg_desc->package.elements[index]->integer.value
- != V2_desc->integer.value) {
- continue;
- }
- break;
+ case AML_BIT_XOR_OP: /* XOr (Operand0, Operand1, Result) */
+ return (operand0 ^ operand1);
- case MATCH_MLE:
- if (pkg_desc->package.elements[index]->integer.value
- > V2_desc->integer.value) {
- continue;
- }
- break;
+ case AML_MULTIPLY_OP: /* Multiply (Operand0, Operand1, Result) */
+ return (operand0 * operand1);
- case MATCH_MLT:
- if (pkg_desc->package.elements[index]->integer.value
- >= V2_desc->integer.value) {
- continue;
- }
- break;
+ case AML_SHIFT_LEFT_OP: /* Shift_left (Operand, Shift_count, Result) */
+ return (operand0 << operand1);
- case MATCH_MGE:
- if (pkg_desc->package.elements[index]->integer.value
- < V2_desc->integer.value) {
- continue;
- }
- break;
+ case AML_SHIFT_RIGHT_OP: /* Shift_right (Operand, Shift_count, Result) */
+ return (operand0 >> operand1);
- case MATCH_MGT:
- if (pkg_desc->package.elements[index]->integer.value
- <= V2_desc->integer.value) {
- continue;
- }
- break;
+ case AML_SUBTRACT_OP: /* Subtract (Operand0, Operand1, Result) */
+ return (operand0 - operand1);
- default:
+ default:
- continue;
- }
+ return (0);
+ }
+}
- /* Match found: exit from loop */
- match_value = index;
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_do_logical_op
+ *
+ * PARAMETERS: Opcode - AML opcode
+ * Operand0 - Integer operand #0
+ * Operand0 - Integer operand #1
+ *
+ * RETURN: TRUE/FALSE result of the operation
+ *
+ * DESCRIPTION: Execute a logical AML opcode. The purpose of having all of the
+ * functions here is to prevent a lot of pointer dereferencing
+ * to obtain the operands and to simplify the generation of the
+ * logical value.
+ *
+ * Note: cleanest machine code seems to be produced by the code
+ * below, rather than using statements of the form:
+ * Result = (Operand0 == Operand1);
+ *
+ ******************************************************************************/
+
+u8
+acpi_ex_do_logical_op (
+ u16 opcode,
+ acpi_integer operand0,
+ acpi_integer operand1)
+{
+
+
+ switch (opcode) {
+
+ case AML_LAND_OP: /* LAnd (Operand0, Operand1) */
+
+ if (operand0 && operand1) {
+ return (TRUE);
}
+ break;
- /* Match_value is the return value */
- ret_desc->integer.value = match_value;
+ case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */
+
+ if (operand0 == operand1) {
+ return (TRUE);
+ }
break;
- }
+ case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */
-cleanup:
+ if (operand0 > operand1) {
+ return (TRUE);
+ }
+ break;
- /* Free the operands */
- acpi_ut_remove_reference (start_desc);
- acpi_ut_remove_reference (V2_desc);
- acpi_ut_remove_reference (op2_desc);
- acpi_ut_remove_reference (V1_desc);
- acpi_ut_remove_reference (op1_desc);
- acpi_ut_remove_reference (pkg_desc);
+ case AML_LLESS_OP: /* LLess (Operand0, Operand1) */
+ if (operand0 < operand1) {
+ return (TRUE);
+ }
+ break;
- /* Delete return object on error */
- if (ACPI_FAILURE (status) &&
- (ret_desc)) {
- acpi_ut_remove_reference (ret_desc);
- ret_desc = NULL;
+ case AML_LOR_OP: /* LOr (Operand0, Operand1) */
+
+ if (operand0 || operand1) {
+ return (TRUE);
+ }
+ break;
}
+ return (FALSE);
+}
- /* Set the return object and exit */
- *return_desc = ret_desc;
- return_ACPI_STATUS (status);
-}
+++ /dev/null
-
-/******************************************************************************
- *
- * Module Name: exmonad - ACPI AML execution for monadic (1 operand) operators
- * $Revision: 111 $
- *
- *****************************************************************************/
-
-/*
- * 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 "acdispat.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-
-
-#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exmonad")
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_get_object_reference
- *
- * PARAMETERS: Obj_desc - Create a reference to this object
- * Ret_desc - Where to store the reference
- *
- * RETURN: Status
- *
- * DESCRIPTION: Obtain and return a "reference" to the target object
- * Common code for the Ref_of_op and the Cond_ref_of_op.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ex_get_object_reference (
- acpi_operand_object *obj_desc,
- acpi_operand_object **ret_desc,
- acpi_walk_state *walk_state)
-{
- acpi_status status = AE_OK;
-
-
- FUNCTION_TRACE_PTR ("Ex_get_object_reference", obj_desc);
-
-
- if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
- if (obj_desc->common.type != INTERNAL_TYPE_REFERENCE) {
- *ret_desc = NULL;
- status = AE_TYPE;
- goto cleanup;
- }
-
- /*
- * Not a Name -- an indirect name pointer would have
- * been converted to a direct name pointer in Acpi_ex_resolve_operands
- */
- switch (obj_desc->reference.opcode) {
- case AML_LOCAL_OP:
- case AML_ARG_OP:
-
- *ret_desc = (void *) acpi_ds_method_data_get_node (obj_desc->reference.opcode,
- obj_desc->reference.offset, walk_state);
- break;
-
- default:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(Internal) Unknown Ref subtype %02x\n",
- obj_desc->reference.opcode));
- *ret_desc = NULL;
- status = AE_AML_INTERNAL;
- goto cleanup;
- }
-
- }
-
- else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
- /* Must be a named object; Just return the Node */
-
- *ret_desc = obj_desc;
- }
-
- else {
- *ret_desc = NULL;
- status = AE_TYPE;
- }
-
-
-cleanup:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p Ref=%p\n", obj_desc, *ret_desc));
- return_ACPI_STATUS (status);
-}
-
-#define obj_desc operand[0]
-#define res_desc operand[1]
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_monadic1
- *
- * PARAMETERS: Opcode - The opcode to be executed
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Type 1 monadic operator with numeric operand on
- * object stack
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_monadic1 (
- u16 opcode,
- acpi_walk_state *walk_state)
-{
- acpi_operand_object **operand = &walk_state->operands[0];
- acpi_status status;
-
-
- FUNCTION_TRACE_PTR ("Ex_monadic1", WALK_OPERANDS);
-
-
- /* Examine the opcode */
-
- switch (opcode) {
-
- /* Def_release := Release_op Mutex_object */
-
- case AML_RELEASE_OP:
-
- status = acpi_ex_release_mutex (obj_desc, walk_state);
- break;
-
-
- /* Def_reset := Reset_op Acpi_event_object */
-
- case AML_RESET_OP:
-
- status = acpi_ex_system_reset_event (obj_desc);
- break;
-
-
- /* Def_signal := Signal_op Acpi_event_object */
-
- case AML_SIGNAL_OP:
-
- status = acpi_ex_system_signal_event (obj_desc);
- break;
-
-
- /* Def_sleep := Sleep_op Msec_time */
-
- case AML_SLEEP_OP:
-
- acpi_ex_system_do_suspend ((u32) obj_desc->integer.value);
- break;
-
-
- /* Def_stall := Stall_op Usec_time */
-
- case AML_STALL_OP:
-
- acpi_ex_system_do_stall ((u32) obj_desc->integer.value);
- break;
-
-
- /* Unknown opcode */
-
- default:
-
- REPORT_ERROR (("Acpi_ex_monadic1: Unknown monadic opcode %X\n",
- opcode));
- status = AE_AML_BAD_OPCODE;
- break;
-
- } /* switch */
-
-
- /* Always delete the operand */
-
- acpi_ut_remove_reference (obj_desc);
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_monadic2_r
- *
- * PARAMETERS: Opcode - The opcode to be executed
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Type 2 monadic operator with numeric operand and
- * result operand on operand stack
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_monadic2_r (
- u16 opcode,
- acpi_walk_state *walk_state,
- acpi_operand_object **return_desc)
-{
- acpi_operand_object **operand = &walk_state->operands[0];
- acpi_operand_object *ret_desc = NULL;
- acpi_operand_object *ret_desc2 = NULL;
- u32 res_val;
- acpi_status status = AE_OK;
- u32 i;
- u32 j;
- acpi_integer digit;
-
-
- FUNCTION_TRACE_PTR ("Ex_monadic2_r", WALK_OPERANDS);
-
-
- /* Create a return object of type NUMBER for most opcodes */
-
- switch (opcode) {
- case AML_BIT_NOT_OP:
- case AML_FIND_SET_LEFT_BIT_OP:
- case AML_FIND_SET_RIGHT_BIT_OP:
- case AML_FROM_BCD_OP:
- case AML_TO_BCD_OP:
- case AML_COND_REF_OF_OP:
-
- ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
- if (!ret_desc) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
- break;
- }
-
-
- switch (opcode) {
- /* Def_not := Not_op Operand Result */
-
- case AML_BIT_NOT_OP:
-
- ret_desc->integer.value = ~obj_desc->integer.value;
- break;
-
-
- /* Def_find_set_left_bit := Find_set_left_bit_op Operand Result */
-
- case AML_FIND_SET_LEFT_BIT_OP:
-
- ret_desc->integer.value = obj_desc->integer.value;
-
- /*
- * Acpi specification describes Integer type as a little
- * endian unsigned value, so this boundary condition is valid.
- */
- for (res_val = 0; ret_desc->integer.value && res_val < ACPI_INTEGER_BIT_SIZE; ++res_val) {
- ret_desc->integer.value >>= 1;
- }
-
- ret_desc->integer.value = res_val;
- break;
-
-
- /* Def_find_set_right_bit := Find_set_right_bit_op Operand Result */
-
- case AML_FIND_SET_RIGHT_BIT_OP:
-
- ret_desc->integer.value = obj_desc->integer.value;
-
- /*
- * Acpi specification describes Integer type as a little
- * endian unsigned value, so this boundary condition is valid.
- */
- 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->integer.value = res_val == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - res_val;
- break;
-
-
- /* Def_from_bDC := From_bCDOp BCDValue Result */
-
- case AML_FROM_BCD_OP:
-
- /*
- * The 64-bit ACPI integer can hold 16 4-bit BCD integers
- */
- ret_desc->integer.value = 0;
- for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) {
- /* Get one BCD digit */
-
- digit = (acpi_integer) ((obj_desc->integer.value >> (i * 4)) & 0xF);
-
- /* Check the range of the digit */
-
- if (digit > 9) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD digit too large: \n",
- digit));
- status = AE_AML_NUMERIC_OVERFLOW;
- goto cleanup;
- }
-
- if (digit > 0) {
- /* Sum into the result with the appropriate power of 10 */
-
- for (j = 0; j < i; j++) {
- digit *= 10;
- }
-
- ret_desc->integer.value += digit;
- }
- }
- break;
-
-
- /* Def_to_bDC := To_bCDOp Operand Result */
-
- case AML_TO_BCD_OP:
-
-
- if (obj_desc->integer.value > ACPI_MAX_BCD_VALUE) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %d\n",
- obj_desc->integer.value));
- status = AE_AML_NUMERIC_OVERFLOW;
- goto cleanup;
- }
-
- ret_desc->integer.value = 0;
- for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) {
- /* Divide by nth factor of 10 */
-
- digit = obj_desc->integer.value;
- for (j = 0; j < i; j++) {
- digit = ACPI_DIVIDE (digit, 10);
- }
-
- /* Create the BCD digit */
-
- if (digit > 0) {
- ret_desc->integer.value += (ACPI_MODULO (digit, 10) << (i * 4));
- }
- }
- break;
-
-
- /* Def_cond_ref_of := Cond_ref_of_op Source_object Result */
-
- case AML_COND_REF_OF_OP:
-
- /*
- * This op is a little strange because the internal return value is
- * different than the return value stored in the result descriptor
- * (There are really two return values)
- */
- if ((acpi_namespace_node *) obj_desc == acpi_gbl_root_node) {
- /*
- * This means that the object does not exist in the namespace,
- * return FALSE
- */
- ret_desc->integer.value = 0;
-
- /*
- * Must delete the result descriptor since there is no reference
- * being returned
- */
- acpi_ut_remove_reference (res_desc);
- goto cleanup;
- }
-
- /* Get the object reference and store it */
-
- status = acpi_ex_get_object_reference (obj_desc, &ret_desc2, walk_state);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
-
- status = acpi_ex_store (ret_desc2, res_desc, walk_state);
-
- /* The object exists in the namespace, return TRUE */
-
- ret_desc->integer.value = ACPI_INTEGER_MAX;
- goto cleanup;
- break;
-
-
- case AML_STORE_OP:
-
- /*
- * A store operand is typically a number, string, buffer or lvalue
- * TBD: [Unhandled] What about a store to a package?
- */
-
- /*
- * Do the store, and be careful about deleting the source object,
- * since the object itself may have been stored.
- */
- status = acpi_ex_store (obj_desc, res_desc, walk_state);
- if (ACPI_FAILURE (status)) {
- /* On failure, just delete the Obj_desc */
-
- acpi_ut_remove_reference (obj_desc);
- return_ACPI_STATUS (status);
- }
-
- /*
- * Normally, we would remove a reference on the Obj_desc parameter;
- * But since it is being used as the internal return object
- * (meaning we would normally increment it), the two cancel out,
- * and we simply don't do anything.
- */
- *return_desc = obj_desc;
- return_ACPI_STATUS (status);
- break;
-
-
- case AML_DEBUG_OP:
-
- /* Reference, returning an Reference */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Debug_op should never get here!\n"));
- return_ACPI_STATUS (AE_OK);
- break;
-
-
- /*
- * ACPI 2.0 Opcodes
- */
- case AML_TO_DECSTRING_OP:
- status = acpi_ex_convert_to_string (obj_desc, &ret_desc, 10, ACPI_UINT32_MAX, walk_state);
- break;
-
-
- case AML_TO_HEXSTRING_OP:
- status = acpi_ex_convert_to_string (obj_desc, &ret_desc, 16, ACPI_UINT32_MAX, walk_state);
- break;
-
- case AML_TO_BUFFER_OP:
- status = acpi_ex_convert_to_buffer (obj_desc, &ret_desc, walk_state);
- break;
-
- case AML_TO_INTEGER_OP:
- status = acpi_ex_convert_to_integer (obj_desc, &ret_desc, walk_state);
- break;
-
-
- /*
- * These are obsolete opcodes
- */
-
- /* Def_shift_left_bit := Shift_left_bit_op Source Bit_num */
- /* Def_shift_right_bit := Shift_right_bit_op Source Bit_num */
-
- case AML_SHIFT_LEFT_BIT_OP:
- case AML_SHIFT_RIGHT_BIT_OP:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s is unimplemented\n",
- acpi_ps_get_opcode_name (opcode)));
- status = AE_SUPPORT;
- goto cleanup;
- break;
-
-
- default:
-
- REPORT_ERROR (("Acpi_ex_monadic2_r: Unknown monadic opcode %X\n",
- opcode));
- status = AE_AML_BAD_OPCODE;
- goto cleanup;
- }
-
-
- status = acpi_ex_store (ret_desc, res_desc, walk_state);
-
-
-cleanup:
- /* Always delete the operand object */
-
- acpi_ut_remove_reference (obj_desc);
-
- /* Delete return object(s) on error */
-
- if (ACPI_FAILURE (status)) {
- acpi_ut_remove_reference (res_desc); /* Result descriptor */
- if (ret_desc) {
- acpi_ut_remove_reference (ret_desc);
- ret_desc = NULL;
- }
- }
-
- /* Set the return object and exit */
-
- *return_desc = ret_desc;
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_monadic2
- *
- * PARAMETERS: Opcode - The opcode to be executed
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Type 2 monadic operator with numeric operand:
- * Deref_of_op, Ref_of_op, Size_of_op, Type_op, Increment_op,
- * Decrement_op, LNot_op,
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_monadic2 (
- u16 opcode,
- acpi_walk_state *walk_state,
- acpi_operand_object **return_desc)
-{
- acpi_operand_object **operand = &walk_state->operands[0];
- acpi_operand_object *tmp_desc;
- acpi_operand_object *ret_desc = NULL;
- acpi_status status = AE_OK;
- u32 type;
- acpi_integer value;
-
-
- FUNCTION_TRACE_PTR ("Ex_monadic2", WALK_OPERANDS);
-
-
- /* Get the operand and decode the opcode */
-
- switch (opcode) {
-
- /* Def_lNot := LNot_op Operand */
-
- case AML_LNOT_OP:
-
- ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
- if (!ret_desc) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
- ret_desc->integer.value = !obj_desc->integer.value;
- break;
-
-
- /* Def_decrement := Decrement_op Target */
- /* Def_increment := Increment_op Target */
-
- case AML_DECREMENT_OP:
- case AML_INCREMENT_OP:
-
- /*
- * Since we are expecting an Reference on the top of the stack, it
- * can be either an Node or an internal object.
- *
- * TBD: [Future] This may be the prototype code for all cases where
- * a Reference is expected!! 10/99
- */
- if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
- ret_desc = obj_desc;
- }
-
- else {
- /*
- * Duplicate the Reference in a new object so that we can resolve it
- * without destroying the original Reference object
- */
- ret_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
- if (!ret_desc) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
- ret_desc->reference.opcode = obj_desc->reference.opcode;
- ret_desc->reference.offset = obj_desc->reference.offset;
- ret_desc->reference.object = obj_desc->reference.object;
- }
-
-
- /*
- * Convert the Ret_desc Reference to a Number
- * (This deletes the original Ret_desc)
- */
- status = acpi_ex_resolve_operands (AML_LNOT_OP, &ret_desc, walk_state);
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n",
- acpi_ps_get_opcode_name (opcode), acpi_format_exception(status)));
-
- goto cleanup;
- }
-
- /* Do the actual increment or decrement */
-
- if (AML_INCREMENT_OP == opcode) {
- ret_desc->integer.value++;
- }
- else {
- ret_desc->integer.value--;
- }
-
- /* Store the result back in the original descriptor */
-
- status = acpi_ex_store (ret_desc, obj_desc, walk_state);
-
- /* Objdesc was just deleted (because it is an Reference) */
-
- obj_desc = NULL;
-
- break;
-
-
- /* Def_object_type := Object_type_op Source_object */
-
- case AML_TYPE_OP:
-
- if (INTERNAL_TYPE_REFERENCE == obj_desc->common.type) {
- /*
- * Not a Name -- an indirect name pointer would have
- * been converted to a direct name pointer in Resolve_operands
- */
- switch (obj_desc->reference.opcode) {
- case AML_ZERO_OP:
- case AML_ONE_OP:
- case AML_ONES_OP:
- case AML_REVISION_OP:
-
- /* Constants are of type Number */
-
- type = ACPI_TYPE_INTEGER;
- break;
-
-
- case AML_DEBUG_OP:
-
- /* Per 1.0b spec, Debug object is of type Debug_object */
-
- type = ACPI_TYPE_DEBUG_OBJECT;
- break;
-
-
- case AML_INDEX_OP:
-
- /* Get the type of this reference (index into another object) */
-
- type = obj_desc->reference.target_type;
- if (type == ACPI_TYPE_PACKAGE) {
- /*
- * The main object is a package, we want to get the type
- * of the individual package element that is referenced by
- * the index.
- */
- type = (*(obj_desc->reference.where))->common.type;
- }
-
- break;
-
-
- case AML_LOCAL_OP:
- case AML_ARG_OP:
-
- type = acpi_ds_method_data_get_type (obj_desc->reference.opcode,
- obj_desc->reference.offset, walk_state);
- break;
-
-
- default:
-
- REPORT_ERROR (("Acpi_ex_monadic2/Type_op: Internal error - Unknown Reference subtype %X\n",
- obj_desc->reference.opcode));
- status = AE_AML_INTERNAL;
- goto cleanup;
- }
- }
-
- else {
- /*
- * It's not a Reference, so it must be a direct name pointer.
- */
- type = acpi_ns_get_type ((acpi_namespace_node *) obj_desc);
-
- /* Convert internal types to external types */
-
- switch (type) {
- case INTERNAL_TYPE_REGION_FIELD:
- case INTERNAL_TYPE_BANK_FIELD:
- case INTERNAL_TYPE_INDEX_FIELD:
-
- type = ACPI_TYPE_FIELD_UNIT;
- }
-
- }
-
- /* Allocate a descriptor to hold the type. */
-
- ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
- if (!ret_desc) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
- ret_desc->integer.value = type;
- break;
-
-
- /* Def_size_of := Size_of_op Source_object */
-
- case AML_SIZE_OF_OP:
-
- if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
- obj_desc = acpi_ns_get_attached_object ((acpi_namespace_node *) obj_desc);
- }
-
- if (!obj_desc) {
- value = 0;
- }
-
- else {
- switch (obj_desc->common.type) {
-
- case ACPI_TYPE_BUFFER:
-
- value = obj_desc->buffer.length;
- break;
-
-
- case ACPI_TYPE_STRING:
-
- value = obj_desc->string.length;
- break;
-
-
- case ACPI_TYPE_PACKAGE:
-
- value = obj_desc->package.count;
- break;
-
- case INTERNAL_TYPE_REFERENCE:
-
- value = 4;
- break;
-
- default:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Not Buf/Str/Pkg - found type %X\n",
- obj_desc->common.type));
- status = AE_AML_OPERAND_TYPE;
- goto cleanup;
- }
- }
-
- /*
- * Now that we have the size of the object, create a result
- * object to hold the value
- */
- ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
- if (!ret_desc) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
- ret_desc->integer.value = value;
- break;
-
-
- /* Def_ref_of := Ref_of_op Source_object */
-
- case AML_REF_OF_OP:
-
- status = acpi_ex_get_object_reference (obj_desc, &ret_desc, walk_state);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
- break;
-
-
- /* Def_deref_of := Deref_of_op Obj_reference */
-
- case AML_DEREF_OF_OP:
-
-
- /* Check for a method local or argument */
-
- if (!VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
- /*
- * Must resolve/dereference the local/arg reference first
- */
- switch (obj_desc->reference.opcode) {
- /* Set Obj_desc to the value of the local/arg */
-
- case AML_LOCAL_OP:
- case AML_ARG_OP:
-
- acpi_ds_method_data_get_value (obj_desc->reference.opcode,
- obj_desc->reference.offset, walk_state, &tmp_desc);
-
- /*
- * Delete our reference to the input object and
- * point to the object just retrieved
- */
- acpi_ut_remove_reference (obj_desc);
- obj_desc = tmp_desc;
- break;
-
- default:
-
- /* Index op - handled below */
- break;
- }
- }
-
-
- /* Obj_desc may have changed from the code above */
-
- if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
- /* Get the actual object from the Node (This is the dereference) */
-
- ret_desc = ((acpi_namespace_node *) obj_desc)->object;
-
- /* Returning a pointer to the object, add another reference! */
-
- acpi_ut_add_reference (ret_desc);
- }
-
- else {
- /*
- * This must be a reference object produced by the Index
- * ASL operation -- check internal opcode
- */
- if ((obj_desc->reference.opcode != AML_INDEX_OP) &&
- (obj_desc->reference.opcode != AML_REF_OF_OP)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode in ref(%p) - %X\n",
- obj_desc, obj_desc->reference.opcode));
-
- status = AE_TYPE;
- goto cleanup;
- }
-
-
- switch (obj_desc->reference.opcode) {
- case AML_INDEX_OP:
-
- /*
- * Supported target types for the Index operator are
- * 1) A Buffer
- * 2) A Package
- */
- if (obj_desc->reference.target_type == ACPI_TYPE_BUFFER_FIELD) {
- /*
- * The target is a buffer, we must create a new object that
- * contains one element of the buffer, the element pointed
- * to by the index.
- *
- * NOTE: index into a buffer is NOT a pointer to a
- * sub-buffer of the main buffer, it is only a pointer to a
- * single element (byte) of the buffer!
- */
- ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
- if (!ret_desc) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
- tmp_desc = obj_desc->reference.object;
- ret_desc->integer.value =
- tmp_desc->buffer.pointer[obj_desc->reference.offset];
-
- /* TBD: [Investigate] (see below) Don't add an additional
- * ref!
- */
- }
-
- else if (obj_desc->reference.target_type == ACPI_TYPE_PACKAGE) {
- /*
- * The target is a package, we want to return the referenced
- * element of the package. We must add another reference to
- * this object, however.
- */
- ret_desc = *(obj_desc->reference.where);
- if (!ret_desc) {
- /*
- * We can't return a NULL dereferenced value. This is
- * an uninitialized package element and is thus a
- * severe error.
- */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "NULL package element obj %p\n",
- obj_desc));
- status = AE_AML_UNINITIALIZED_ELEMENT;
- goto cleanup;
- }
-
- acpi_ut_add_reference (ret_desc);
- }
-
- else {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Target_type %X in obj %p\n",
- obj_desc->reference.target_type, obj_desc));
- status = AE_AML_OPERAND_TYPE;
- goto cleanup;
- }
-
- break;
-
-
- case AML_REF_OF_OP:
-
- ret_desc = obj_desc->reference.object;
-
- /* Add another reference to the object! */
-
- acpi_ut_add_reference (ret_desc);
- break;
- }
- }
-
- break;
-
-
- default:
-
- REPORT_ERROR (("Acpi_ex_monadic2: Unknown monadic opcode %X\n",
- opcode));
- status = AE_AML_BAD_OPCODE;
- goto cleanup;
- }
-
-
-cleanup:
-
- if (obj_desc) {
- acpi_ut_remove_reference (obj_desc);
- }
-
- /* Delete return object on error */
-
- if (ACPI_FAILURE (status) &&
- (ret_desc)) {
- acpi_ut_remove_reference (ret_desc);
- ret_desc = NULL;
- }
-
- *return_desc = ret_desc;
- return_ACPI_STATUS (status);
-}
-
--- /dev/null
+
+/******************************************************************************
+ *
+ * Module Name: exoparg1 - AML execution - opcodes with 1 argument
+ * $Revision: 120 $
+ *
+ *****************************************************************************/
+
+/*
+ * 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 "acdispat.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ MODULE_NAME ("exoparg1")
+
+
+/*!
+ * Naming convention for AML interpreter execution routines.
+ *
+ * The routines that begin execution of AML opcodes are named with a common
+ * convention based upon the number of arguments, the number of target operands,
+ * and whether or not a value is returned:
+ *
+ * AcpiExOpcode_xA_yT_zR
+ *
+ * Where:
+ *
+ * xA - ARGUMENTS: The number of arguments (input operands) that are
+ * required for this opcode type (1 through 6 args).
+ * yT - TARGETS: The number of targets (output operands) that are required
+ * for this opcode type (0, 1, or 2 targets).
+ * zR - RETURN VALUE: Indicates whether this opcode type returns a value
+ * as the function return (0 or 1).
+ *
+ * The AcpiExOpcode* functions are called via the Dispatcher component with
+ * fully resolved operands.
+!*/
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_opcode_1A_0T_0R
+ *
+ * PARAMETERS: Walk_state - Current state (contains AML opcode)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute Type 1 monadic operator with numeric operand on
+ * object stack
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_opcode_1A_0T_0R (
+ acpi_walk_state *walk_state)
+{
+ acpi_operand_object **operand = &walk_state->operands[0];
+ acpi_status status = AE_OK;
+
+
+ FUNCTION_TRACE_STR ("Ex_opcode_1A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
+
+
+ /* Examine the opcode */
+
+ switch (walk_state->opcode) {
+ case AML_RELEASE_OP: /* Release (Mutex_object) */
+
+ status = acpi_ex_release_mutex (operand[0], walk_state);
+ break;
+
+
+ case AML_RESET_OP: /* Reset (Event_object) */
+
+ status = acpi_ex_system_reset_event (operand[0]);
+ break;
+
+
+ case AML_SIGNAL_OP: /* Signal (Event_object) */
+
+ status = acpi_ex_system_signal_event (operand[0]);
+ break;
+
+
+ case AML_SLEEP_OP: /* Sleep (Msec_time) */
+
+ acpi_ex_system_do_suspend ((u32) operand[0]->integer.value);
+ break;
+
+
+ case AML_STALL_OP: /* Stall (Usec_time) */
+
+ acpi_ex_system_do_stall ((u32) operand[0]->integer.value);
+ break;
+
+
+ case AML_UNLOAD_OP: /* Unload (Handle) */
+
+ status = acpi_ex_unload_table (operand[0]);
+ break;
+
+
+ default: /* Unknown opcode */
+
+ REPORT_ERROR (("Acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n",
+ walk_state->opcode));
+ status = AE_AML_BAD_OPCODE;
+ break;
+ }
+
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_opcode_1A_1T_0R
+ *
+ * PARAMETERS: Walk_state - Current state (contains AML opcode)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute opcode with one argument, one target, and no
+ * return value.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_opcode_1A_1T_0R (
+ acpi_walk_state *walk_state)
+{
+ acpi_status status = AE_OK;
+ acpi_operand_object **operand = &walk_state->operands[0];
+
+
+ FUNCTION_TRACE_STR ("Ex_opcode_1A_1T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
+
+
+ switch (walk_state->opcode) {
+
+ case AML_LOAD_OP:
+
+ status = acpi_ex_load_op (operand[0], operand[1]);
+ break;
+
+ default: /* Unknown opcode */
+
+ REPORT_ERROR (("Acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n",
+ walk_state->opcode));
+ status = AE_AML_BAD_OPCODE;
+ goto cleanup;
+ }
+
+
+cleanup:
+
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_opcode_1A_1T_1R
+ *
+ * PARAMETERS: Walk_state - Current state (contains AML opcode)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute opcode with one argument, one target, and a
+ * return value.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_opcode_1A_1T_1R (
+ acpi_walk_state *walk_state)
+{
+ acpi_status status = AE_OK;
+ acpi_operand_object **operand = &walk_state->operands[0];
+ acpi_operand_object *return_desc = NULL;
+ acpi_operand_object *return_desc2 = NULL;
+ u32 temp32;
+ u32 i;
+ u32 j;
+ acpi_integer digit;
+
+
+ FUNCTION_TRACE_STR ("Ex_opcode_1A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
+
+
+ /* Create a return object of type Integer for most opcodes */
+
+ switch (walk_state->opcode) {
+ case AML_BIT_NOT_OP:
+ case AML_FIND_SET_LEFT_BIT_OP:
+ case AML_FIND_SET_RIGHT_BIT_OP:
+ case AML_FROM_BCD_OP:
+ case AML_TO_BCD_OP:
+ case AML_COND_REF_OF_OP:
+
+ return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+ if (!return_desc) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ break;
+ }
+
+
+ switch (walk_state->opcode) {
+
+ case AML_BIT_NOT_OP: /* Not (Operand, Result) */
+
+ return_desc->integer.value = ~operand[0]->integer.value;
+ break;
+
+
+ case AML_FIND_SET_LEFT_BIT_OP: /* Find_set_left_bit (Operand, Result) */
+
+
+ return_desc->integer.value = operand[0]->integer.value;
+
+ /*
+ * Acpi specification describes Integer type as a little
+ * endian unsigned value, so this boundary condition is valid.
+ */
+ for (temp32 = 0; return_desc->integer.value && temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) {
+ return_desc->integer.value >>= 1;
+ }
+
+ return_desc->integer.value = temp32;
+ break;
+
+
+ case AML_FIND_SET_RIGHT_BIT_OP: /* Find_set_right_bit (Operand, Result) */
+
+
+ return_desc->integer.value = operand[0]->integer.value;
+
+ /*
+ * The Acpi specification describes Integer type as a little
+ * endian unsigned value, so this boundary condition is valid.
+ */
+ for (temp32 = 0; return_desc->integer.value && temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) {
+ return_desc->integer.value <<= 1;
+ }
+
+ /* Since the bit position is one-based, subtract from 33 (65) */
+
+ return_desc->integer.value = temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
+ break;
+
+
+ case AML_FROM_BCD_OP: /* From_bcd (BCDValue, Result) */
+
+ /*
+ * The 64-bit ACPI integer can hold 16 4-bit BCD integers
+ */
+ return_desc->integer.value = 0;
+ for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) {
+ /* Get one BCD digit */
+
+ digit = (acpi_integer) ((operand[0]->integer.value >> (i * 4)) & 0xF);
+
+ /* Check the range of the digit */
+
+ if (digit > 9) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD digit too large: %d\n",
+ (u32) digit));
+ status = AE_AML_NUMERIC_OVERFLOW;
+ goto cleanup;
+ }
+
+ if (digit > 0) {
+ /* Sum into the result with the appropriate power of 10 */
+
+ for (j = 0; j < i; j++) {
+ digit *= 10;
+ }
+
+ return_desc->integer.value += digit;
+ }
+ }
+ break;
+
+
+ case AML_TO_BCD_OP: /* To_bcd (Operand, Result) */
+
+ if (operand[0]->integer.value > ACPI_MAX_BCD_VALUE) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %8.8X%8.8X\n",
+ HIDWORD(operand[0]->integer.value), LODWORD(operand[0]->integer.value)));
+ status = AE_AML_NUMERIC_OVERFLOW;
+ goto cleanup;
+ }
+
+ return_desc->integer.value = 0;
+ for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) {
+ /* Divide by nth factor of 10 */
+
+ temp32 = 0;
+ digit = operand[0]->integer.value;
+ for (j = 0; j < i; j++) {
+ acpi_ut_short_divide (&digit, 10, &digit, &temp32);
+ }
+
+ /* Create the BCD digit from the remainder above */
+
+ if (digit > 0) {
+ return_desc->integer.value += (temp32 << (i * 4));
+ }
+ }
+ break;
+
+
+ case AML_COND_REF_OF_OP: /* Cond_ref_of (Source_object, Result) */
+
+ /*
+ * This op is a little strange because the internal return value is
+ * different than the return value stored in the result descriptor
+ * (There are really two return values)
+ */
+ if ((acpi_namespace_node *) operand[0] == acpi_gbl_root_node) {
+ /*
+ * This means that the object does not exist in the namespace,
+ * return FALSE
+ */
+ return_desc->integer.value = 0;
+
+ /*
+ * Must delete the result descriptor since there is no reference
+ * being returned
+ */
+ acpi_ut_remove_reference (operand[1]);
+ goto cleanup;
+ }
+
+ /* Get the object reference and store it */
+
+ status = acpi_ex_get_object_reference (operand[0], &return_desc2, walk_state);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
+
+ status = acpi_ex_store (return_desc2, operand[1], walk_state);
+
+ /* The object exists in the namespace, return TRUE */
+
+ return_desc->integer.value = ACPI_INTEGER_MAX;
+ goto cleanup;
+ break;
+
+
+ case AML_STORE_OP: /* Store (Source, Target) */
+
+ /*
+ * A store operand is typically a number, string, buffer or lvalue
+ * Be careful about deleting the source object,
+ * since the object itself may have been stored.
+ */
+ status = acpi_ex_store (operand[0], operand[1], walk_state);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ /*
+ * Normally, we would remove a reference on the Operand[0] parameter;
+ * But since it is being used as the internal return object
+ * (meaning we would normally increment it), the two cancel out,
+ * and we simply don't do anything.
+ */
+ walk_state->result_obj = operand[0];
+ walk_state->operands[0] = NULL; /* Prevent deletion */
+ return_ACPI_STATUS (status);
+ break;
+
+
+ /*
+ * ACPI 2.0 Opcodes
+ */
+ case AML_COPY_OP: /* Copy (Source, Target) */
+
+ status = AE_NOT_IMPLEMENTED;
+ goto cleanup;
+ break;
+
+
+ case AML_TO_DECSTRING_OP: /* To_decimal_string (Data, Result) */
+
+ status = acpi_ex_convert_to_string (operand[0], &return_desc, 10, ACPI_UINT32_MAX, walk_state);
+ break;
+
+
+ case AML_TO_HEXSTRING_OP: /* To_hex_string (Data, Result) */
+
+ status = acpi_ex_convert_to_string (operand[0], &return_desc, 16, ACPI_UINT32_MAX, walk_state);
+ break;
+
+
+ case AML_TO_BUFFER_OP: /* To_buffer (Data, Result) */
+
+ status = acpi_ex_convert_to_buffer (operand[0], &return_desc, walk_state);
+ break;
+
+
+ case AML_TO_INTEGER_OP: /* To_integer (Data, Result) */
+
+ status = acpi_ex_convert_to_integer (operand[0], &return_desc, walk_state);
+ break;
+
+
+ /*
+ * These are two obsolete opcodes
+ */
+ case AML_SHIFT_LEFT_BIT_OP: /* Shift_left_bit (Source, Bit_num) */
+ case AML_SHIFT_RIGHT_BIT_OP: /* Shift_right_bit (Source, Bit_num) */
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s is obsolete and not implemented\n",
+ acpi_ps_get_opcode_name (walk_state->opcode)));
+ status = AE_SUPPORT;
+ goto cleanup;
+ break;
+
+
+ default: /* Unknown opcode */
+
+ REPORT_ERROR (("Acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n",
+ walk_state->opcode));
+ status = AE_AML_BAD_OPCODE;
+ goto cleanup;
+ }
+
+
+ /*
+ * Store the return value computed above into the target object
+ */
+ status = acpi_ex_store (return_desc, operand[1], walk_state);
+
+
+cleanup:
+
+ walk_state->result_obj = return_desc;
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (status)) {
+ acpi_ut_remove_reference (return_desc);
+ }
+
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_opcode_1A_0T_1R
+ *
+ * PARAMETERS: Walk_state - Current state (contains AML opcode)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute opcode with one argument, no target, and a return value
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_opcode_1A_0T_1R (
+ acpi_walk_state *walk_state)
+{
+ acpi_operand_object **operand = &walk_state->operands[0];
+ acpi_operand_object *temp_desc;
+ acpi_operand_object *return_desc = NULL;
+ acpi_status status = AE_OK;
+ u32 type;
+ acpi_integer value;
+
+
+ FUNCTION_TRACE_STR ("Ex_opcode_1A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
+
+
+ /* Get the operand and decode the opcode */
+
+ switch (walk_state->opcode) {
+
+ case AML_LNOT_OP: /* LNot (Operand) */
+
+ return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+ if (!return_desc) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ return_desc->integer.value = !operand[0]->integer.value;
+ break;
+
+
+ case AML_DECREMENT_OP: /* Decrement (Operand) */
+ case AML_INCREMENT_OP: /* Increment (Operand) */
+
+ /*
+ * Since we are expecting a Reference operand, it
+ * can be either a Node or an internal object.
+ */
+ return_desc = operand[0];
+ if (VALID_DESCRIPTOR_TYPE (operand[0], ACPI_DESC_TYPE_INTERNAL)) {
+ /* Internal reference object - prevent deletion */
+
+ acpi_ut_add_reference (return_desc);
+ }
+
+ /*
+ * Convert the Return_desc Reference to a Number
+ * (This removes a reference on the Return_desc object)
+ */
+ status = acpi_ex_resolve_operands (AML_LNOT_OP, &return_desc, walk_state);
+ if (ACPI_FAILURE (status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n",
+ acpi_ps_get_opcode_name (walk_state->opcode), acpi_format_exception(status)));
+
+ goto cleanup;
+ }
+
+ /*
+ * Return_desc is now guaranteed to be an Integer object
+ * Do the actual increment or decrement
+ */
+ if (AML_INCREMENT_OP == walk_state->opcode) {
+ return_desc->integer.value++;
+ }
+ else {
+ return_desc->integer.value--;
+ }
+
+ /* Store the result back in the original descriptor */
+
+ status = acpi_ex_store (return_desc, operand[0], walk_state);
+ break;
+
+
+ case AML_TYPE_OP: /* Object_type (Source_object) */
+
+ if (INTERNAL_TYPE_REFERENCE == operand[0]->common.type) {
+ /*
+ * Not a Name -- an indirect name pointer would have
+ * been converted to a direct name pointer in Resolve_operands
+ */
+ switch (operand[0]->reference.opcode) {
+ case AML_ZERO_OP:
+ case AML_ONE_OP:
+ case AML_ONES_OP:
+ case AML_REVISION_OP:
+
+ /* Constants are of type Integer */
+
+ type = ACPI_TYPE_INTEGER;
+ break;
+
+
+ case AML_DEBUG_OP:
+
+ /* Per 1.0b spec, Debug object is of type "Debug_object" */
+
+ type = ACPI_TYPE_DEBUG_OBJECT;
+ break;
+
+
+ case AML_INDEX_OP:
+
+ /* Get the type of this reference (index into another object) */
+
+ type = operand[0]->reference.target_type;
+ if (type == ACPI_TYPE_PACKAGE) {
+ /*
+ * The main object is a package, we want to get the type
+ * of the individual package element that is referenced by
+ * the index.
+ */
+ type = (*(operand[0]->reference.where))->common.type;
+ }
+
+ break;
+
+
+ case AML_LOCAL_OP:
+ case AML_ARG_OP:
+
+ type = acpi_ds_method_data_get_type (operand[0]->reference.opcode,
+ operand[0]->reference.offset, walk_state);
+ break;
+
+
+ default:
+
+ REPORT_ERROR (("Acpi_ex_opcode_1A_0T_1R/Type_op: Internal error - Unknown Reference subtype %X\n",
+ operand[0]->reference.opcode));
+ status = AE_AML_INTERNAL;
+ goto cleanup;
+ }
+ }
+
+ else {
+ /*
+ * It's not a Reference, so it must be a direct name pointer.
+ */
+ type = acpi_ns_get_type ((acpi_namespace_node *) operand[0]);
+
+ /* Convert internal types to external types */
+
+ switch (type) {
+ case INTERNAL_TYPE_REGION_FIELD:
+ case INTERNAL_TYPE_BANK_FIELD:
+ case INTERNAL_TYPE_INDEX_FIELD:
+
+ type = ACPI_TYPE_FIELD_UNIT;
+ }
+
+ }
+
+ /* Allocate a descriptor to hold the type. */
+
+ return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+ if (!return_desc) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ return_desc->integer.value = type;
+ break;
+
+
+ case AML_SIZE_OF_OP: /* Size_of (Source_object) */
+
+ temp_desc = operand[0];
+ if (VALID_DESCRIPTOR_TYPE (operand[0], ACPI_DESC_TYPE_NAMED)) {
+ temp_desc = acpi_ns_get_attached_object ((acpi_namespace_node *) operand[0]);
+ }
+
+ if (!temp_desc) {
+ value = 0;
+ }
+
+ else {
+ switch (temp_desc->common.type) {
+ case ACPI_TYPE_BUFFER:
+ value = temp_desc->buffer.length;
+ break;
+
+ case ACPI_TYPE_STRING:
+ value = temp_desc->string.length;
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+ value = temp_desc->package.count;
+ break;
+
+ case INTERNAL_TYPE_REFERENCE:
+
+ /* TBD: this must be a reference to a buf/str/pkg?? */
+
+ value = 4;
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Not Buf/Str/Pkg - found type %X\n",
+ temp_desc->common.type));
+ status = AE_AML_OPERAND_TYPE;
+ goto cleanup;
+ }
+ }
+
+ /*
+ * Now that we have the size of the object, create a result
+ * object to hold the value
+ */
+ return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+ if (!return_desc) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ return_desc->integer.value = value;
+ break;
+
+
+ case AML_REF_OF_OP: /* Ref_of (Source_object) */
+
+ status = acpi_ex_get_object_reference (operand[0], &return_desc, walk_state);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
+ break;
+
+
+ case AML_DEREF_OF_OP: /* Deref_of (Obj_reference) */
+
+ /* Check for a method local or argument */
+
+ if (!VALID_DESCRIPTOR_TYPE (operand[0], ACPI_DESC_TYPE_NAMED)) {
+ /*
+ * Must resolve/dereference the local/arg reference first
+ */
+ switch (operand[0]->reference.opcode) {
+ /* Set Operand[0] to the value of the local/arg */
+
+ case AML_LOCAL_OP:
+ case AML_ARG_OP:
+
+ acpi_ds_method_data_get_value (operand[0]->reference.opcode,
+ operand[0]->reference.offset, walk_state, &temp_desc);
+
+ /*
+ * Delete our reference to the input object and
+ * point to the object just retrieved
+ */
+ acpi_ut_remove_reference (operand[0]);
+ operand[0] = temp_desc;
+ break;
+
+ default:
+
+ /* Index op - handled below */
+ break;
+ }
+ }
+
+
+ /* Operand[0] may have changed from the code above */
+
+ if (VALID_DESCRIPTOR_TYPE (operand[0], ACPI_DESC_TYPE_NAMED)) {
+ /* Get the actual object from the Node (This is the dereference) */
+
+ return_desc = ((acpi_namespace_node *) operand[0])->object;
+
+ /* Returning a pointer to the object, add another reference! */
+
+ acpi_ut_add_reference (return_desc);
+ }
+
+ else {
+ /*
+ * This must be a reference object produced by the Index
+ * ASL operation -- check internal opcode
+ */
+ if ((operand[0]->reference.opcode != AML_INDEX_OP) &&
+ (operand[0]->reference.opcode != AML_REF_OF_OP)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode in ref(%p) - %X\n",
+ operand[0], operand[0]->reference.opcode));
+
+ status = AE_TYPE;
+ goto cleanup;
+ }
+
+
+ switch (operand[0]->reference.opcode) {
+ case AML_INDEX_OP:
+
+ /*
+ * Supported target types for the Index operator are
+ * 1) A Buffer
+ * 2) A Package
+ */
+ if (operand[0]->reference.target_type == ACPI_TYPE_BUFFER_FIELD) {
+ /*
+ * The target is a buffer, we must create a new object that
+ * contains one element of the buffer, the element pointed
+ * to by the index.
+ *
+ * NOTE: index into a buffer is NOT a pointer to a
+ * sub-buffer of the main buffer, it is only a pointer to a
+ * single element (byte) of the buffer!
+ */
+ return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+ if (!return_desc) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ temp_desc = operand[0]->reference.object;
+ return_desc->integer.value =
+ temp_desc->buffer.pointer[operand[0]->reference.offset];
+
+ /* TBD: [Investigate] (see below) Don't add an additional
+ * ref!
+ */
+ }
+
+ else if (operand[0]->reference.target_type == ACPI_TYPE_PACKAGE) {
+ /*
+ * The target is a package, we want to return the referenced
+ * element of the package. We must add another reference to
+ * this object, however.
+ */
+ return_desc = *(operand[0]->reference.where);
+ if (!return_desc) {
+ /*
+ * We can't return a NULL dereferenced value. This is
+ * an uninitialized package element and is thus a
+ * severe error.
+ */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "NULL package element obj %p\n",
+ operand[0]));
+ status = AE_AML_UNINITIALIZED_ELEMENT;
+ goto cleanup;
+ }
+
+ acpi_ut_add_reference (return_desc);
+ }
+
+ else {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Target_type %X in obj %p\n",
+ operand[0]->reference.target_type, operand[0]));
+ status = AE_AML_OPERAND_TYPE;
+ goto cleanup;
+ }
+
+ break;
+
+
+ case AML_REF_OF_OP:
+
+ return_desc = operand[0]->reference.object;
+
+ /* Add another reference to the object! */
+
+ acpi_ut_add_reference (return_desc);
+ break;
+ }
+ }
+
+ break;
+
+
+ default:
+
+ REPORT_ERROR (("Acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n",
+ walk_state->opcode));
+ status = AE_AML_BAD_OPCODE;
+ goto cleanup;
+ }
+
+
+cleanup:
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (status)) {
+ acpi_ut_remove_reference (return_desc);
+ }
+
+ walk_state->result_obj = return_desc;
+ return_ACPI_STATUS (status);
+}
+
--- /dev/null
+/******************************************************************************
+ *
+ * Module Name: exoparg2 - AML execution - opcodes with 2 arguments
+ * $Revision: 97 $
+ *
+ *****************************************************************************/
+
+/*
+ * 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 ACPI_EXECUTER
+ MODULE_NAME ("exoparg2")
+
+
+/*!
+ * Naming convention for AML interpreter execution routines.
+ *
+ * The routines that begin execution of AML opcodes are named with a common
+ * convention based upon the number of arguments, the number of target operands,
+ * and whether or not a value is returned:
+ *
+ * AcpiExOpcode_xA_yT_zR
+ *
+ * Where:
+ *
+ * xA - ARGUMENTS: The number of arguments (input operands) that are
+ * required for this opcode type (1 through 6 args).
+ * yT - TARGETS: The number of targets (output operands) that are required
+ * for this opcode type (0, 1, or 2 targets).
+ * zR - RETURN VALUE: Indicates whether this opcode type returns a value
+ * as the function return (0 or 1).
+ *
+ * The AcpiExOpcode* functions are called via the Dispatcher component with
+ * fully resolved operands.
+!*/
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_opcode_2A_0T_0R
+ *
+ * PARAMETERS: Walk_state - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute opcode with two arguments, no target, and no return
+ * value.
+ *
+ * ALLOCATION: Deletes both operands
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_opcode_2A_0T_0R (
+ acpi_walk_state *walk_state)
+{
+ acpi_operand_object **operand = &walk_state->operands[0];
+ acpi_namespace_node *node;
+ acpi_status status = AE_OK;
+
+
+ FUNCTION_TRACE_STR ("Ex_opcode_2A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
+
+
+ /* Examine the opcode */
+
+ switch (walk_state->opcode) {
+
+ case AML_NOTIFY_OP: /* Notify (Notify_object, Notify_value) */
+
+ /* The first operand is a namespace node */
+
+ node = (acpi_namespace_node *) operand[0];
+
+ /* The node must refer to a device or thermal zone */
+
+ if (node && operand[1]) /* TBD: is this check necessary? */ {
+ switch (node->type) {
+ case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_THERMAL:
+
+ /*
+ * Dispatch the notify to the appropriate handler
+ * NOTE: the request is queued for execution after this method
+ * completes. The notify handlers are NOT invoked synchronously
+ * from this thread -- because handlers may in turn run other
+ * control methods.
+ */
+ status = acpi_ev_queue_notify_request (node,
+ (u32) operand[1]->integer.value);
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unexpected notify object type %X\n",
+ node->type));
+
+ status = AE_AML_OPERAND_TYPE;
+ break;
+ }
+ }
+ break;
+
+ default:
+
+ REPORT_ERROR (("Acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
+ status = AE_AML_BAD_OPCODE;
+ }
+
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_opcode_2A_2T_1R
+ *
+ * PARAMETERS: Walk_state - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute a dyadic operator (2 operands) with 2 output targets
+ * and one implicit return value.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_opcode_2A_2T_1R (
+ acpi_walk_state *walk_state)
+{
+ acpi_operand_object **operand = &walk_state->operands[0];
+ acpi_operand_object *return_desc1 = NULL;
+ acpi_operand_object *return_desc2 = NULL;
+ acpi_status status;
+
+
+ FUNCTION_TRACE_STR ("Ex_opcode_2A_2T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
+
+
+ /*
+ * Execute the opcode
+ */
+ switch (walk_state->opcode) {
+ case AML_DIVIDE_OP: /* Divide (Dividend, Divisor, Remainder_result Quotient_result) */
+
+ return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+ if (!return_desc1) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ return_desc2 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+ if (!return_desc2) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ /* Quotient to Return_desc1, remainder to Return_desc2 */
+
+ status = acpi_ut_divide (&operand[0]->integer.value, &operand[1]->integer.value,
+ &return_desc1->integer.value, &return_desc2->integer.value);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
+ break;
+
+
+ default:
+
+ REPORT_ERROR (("Acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n",
+ walk_state->opcode));
+ status = AE_AML_BAD_OPCODE;
+ goto cleanup;
+ break;
+ }
+
+
+ /* Store the results to the target reference operands */
+
+ status = acpi_ex_store (return_desc2, operand[2], walk_state);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
+
+ status = acpi_ex_store (return_desc1, operand[3], walk_state);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
+
+ /* Return the remainder */
+
+ walk_state->result_obj = return_desc1;
+
+
+cleanup:
+ /*
+ * Since the remainder is not returned indirectly, remove a reference to
+ * it. Only the quotient is returned indirectly.
+ */
+ acpi_ut_remove_reference (return_desc2);
+
+ if (ACPI_FAILURE (status)) {
+ /* Delete the return object */
+
+ acpi_ut_remove_reference (return_desc1);
+ }
+
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_opcode_2A_1T_1R
+ *
+ * PARAMETERS: Walk_state - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute opcode with two arguments, one target, and a return
+ * value.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_opcode_2A_1T_1R (
+ acpi_walk_state *walk_state)
+{
+ acpi_operand_object **operand = &walk_state->operands[0];
+ acpi_operand_object *return_desc = NULL;
+ acpi_operand_object *temp_desc;
+ u32 index;
+ acpi_status status = AE_OK;
+
+
+ FUNCTION_TRACE_STR ("Ex_opcode_2A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
+
+
+ /*
+ * Execute the opcode
+ */
+ if (walk_state->op_info->flags & AML_MATH) {
+ /* All simple math opcodes (add, etc.) */
+
+ return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+ if (!return_desc) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ return_desc->integer.value = acpi_ex_do_math_op (walk_state->opcode,
+ operand[0]->integer.value,
+ operand[1]->integer.value);
+ goto store_result_to_target;
+ }
+
+
+ switch (walk_state->opcode) {
+ case AML_MOD_OP: /* Mod (Dividend, Divisor, Remainder_result (ACPI 2.0) */
+
+ return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+ if (!return_desc) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ /* Return_desc will contain the remainder */
+
+ status = acpi_ut_divide (&operand[0]->integer.value, &operand[1]->integer.value,
+ NULL, &return_desc->integer.value);
+
+ break;
+
+
+ case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
+
+ /*
+ * 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.
+ */
+ switch (operand[0]->common.type) {
+ case ACPI_TYPE_INTEGER:
+ status = acpi_ex_convert_to_integer (operand[1], &operand[1], walk_state);
+ break;
+
+ case ACPI_TYPE_STRING:
+ status = acpi_ex_convert_to_string (operand[1], &operand[1], 16, ACPI_UINT32_MAX, walk_state);
+ break;
+
+ case ACPI_TYPE_BUFFER:
+ status = acpi_ex_convert_to_buffer (operand[1], &operand[1], walk_state);
+ break;
+
+ default:
+ status = AE_AML_INTERNAL;
+ }
+
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
+
+ /*
+ * 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_ex_do_concatenate (operand[0], operand[1], &return_desc, walk_state);
+ break;
+
+
+ case AML_TO_STRING_OP: /* To_string (Buffer, Length, Result) (ACPI 2.0) */
+
+ status = acpi_ex_convert_to_string (operand[0], &return_desc, 16,
+ (u32) operand[1]->integer.value, walk_state);
+ break;
+
+
+ case AML_CONCAT_RES_OP: /* Concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */
+
+ status = AE_NOT_IMPLEMENTED;
+ break;
+
+
+ case AML_INDEX_OP: /* Index (Source Index Result) */
+
+ /* Create the internal return object */
+
+ return_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
+ if (!return_desc) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ index = (u32) operand[1]->integer.value;
+
+ /*
+ * At this point, the Source operand is either a Package or a Buffer
+ */
+ if (operand[0]->common.type == ACPI_TYPE_PACKAGE) {
+ /* Object to be indexed is a Package */
+
+ if (index >= operand[0]->package.count) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value beyond package end\n"));
+ status = AE_AML_PACKAGE_LIMIT;
+ goto cleanup;
+ }
+
+ if ((operand[2]->common.type == INTERNAL_TYPE_REFERENCE) &&
+ (operand[2]->reference.opcode == AML_ZERO_OP)) {
+ /*
+ * There is no actual result descriptor (the Zero_op Result
+ * descriptor is a placeholder), so just delete the placeholder and
+ * return a reference to the package element
+ */
+ acpi_ut_remove_reference (operand[2]);
+ }
+
+ else {
+ /*
+ * Each element of the package is an internal object. Get the one
+ * we are after.
+ */
+ temp_desc = operand[0]->package.elements [index];
+ return_desc->reference.opcode = AML_INDEX_OP;
+ return_desc->reference.target_type = temp_desc->common.type;
+ return_desc->reference.object = temp_desc;
+
+ status = acpi_ex_store (return_desc, operand[2], walk_state);
+ return_desc->reference.object = NULL;
+ }
+
+ /*
+ * The local return object must always be a reference to the package element,
+ * not the element itself.
+ */
+ return_desc->reference.opcode = AML_INDEX_OP;
+ return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
+ return_desc->reference.where = &operand[0]->package.elements [index];
+ }
+
+ else {
+ /* Object to be indexed is a Buffer */
+
+ if (index >= operand[0]->buffer.length) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value beyond end of buffer\n"));
+ status = AE_AML_BUFFER_LIMIT;
+ goto cleanup;
+ }
+
+ return_desc->reference.opcode = AML_INDEX_OP;
+ return_desc->reference.target_type = ACPI_TYPE_BUFFER_FIELD;
+ return_desc->reference.object = operand[0];
+ return_desc->reference.offset = index;
+
+ status = acpi_ex_store (return_desc, operand[2], walk_state);
+ }
+
+ walk_state->result_obj = return_desc;
+ goto cleanup;
+ break;
+
+
+ default:
+
+ REPORT_ERROR (("Acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n",
+ walk_state->opcode));
+ status = AE_AML_BAD_OPCODE;
+ break;
+ }
+
+
+store_result_to_target:
+
+ if (ACPI_SUCCESS (status)) {
+ /*
+ * Store the result of the operation (which is now in Return_desc) into
+ * the Target descriptor.
+ */
+ status = acpi_ex_store (return_desc, operand[2], walk_state);
+ if (ACPI_FAILURE (status)) {
+ goto cleanup;
+ }
+
+ walk_state->result_obj = return_desc;
+ }
+
+
+cleanup:
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (status)) {
+ acpi_ut_remove_reference (return_desc);
+ }
+
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_opcode_2A_0T_1R
+ *
+ * PARAMETERS: Walk_state - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute opcode with 2 arguments, no target, and a return value
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_opcode_2A_0T_1R (
+ acpi_walk_state *walk_state)
+{
+ acpi_operand_object **operand = &walk_state->operands[0];
+ acpi_operand_object *return_desc = NULL;
+ acpi_status status = AE_OK;
+ u8 logical_result = FALSE;
+
+
+ FUNCTION_TRACE_STR ("Ex_opcode_2A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
+
+
+ /* Create the internal return object */
+
+ return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+ if (!return_desc) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ /*
+ * Execute the Opcode
+ */
+ if (walk_state->op_info->flags & AML_LOGICAL) /* Logical_op (Operand0, Operand1) */ {
+ logical_result = acpi_ex_do_logical_op (walk_state->opcode,
+ operand[0]->integer.value,
+ operand[1]->integer.value);
+ goto store_logical_result;
+ }
+
+
+ switch (walk_state->opcode) {
+ case AML_ACQUIRE_OP: /* Acquire (Mutex_object, Timeout) */
+
+ status = acpi_ex_acquire_mutex (operand[1], operand[0], walk_state);
+ if (status == AE_TIME) {
+ logical_result = TRUE; /* TRUE = Acquire timed out */
+ status = AE_OK;
+ }
+ break;
+
+
+ case AML_WAIT_OP: /* Wait (Event_object, Timeout) */
+
+ status = acpi_ex_system_wait_event (operand[1], operand[0]);
+ if (status == AE_TIME) {
+ logical_result = TRUE; /* TRUE, Wait timed out */
+ status = AE_OK;
+ }
+ break;
+
+
+ default:
+
+ REPORT_ERROR (("Acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
+ status = AE_AML_BAD_OPCODE;
+ goto cleanup;
+ break;
+ }
+
+
+store_logical_result:
+ /*
+ * Set return value to according to Logical_result. logical TRUE (all ones)
+ * Default is FALSE (zero)
+ */
+ if (logical_result) {
+ return_desc->integer.value = ACPI_INTEGER_MAX;
+ }
+
+ walk_state->result_obj = return_desc;
+
+
+cleanup:
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (status)) {
+ acpi_ut_remove_reference (return_desc);
+ }
+
+ return_ACPI_STATUS (status);
+}
+
+
--- /dev/null
+
+/******************************************************************************
+ *
+ * Module Name: exoparg3 - AML execution - opcodes with 3 arguments
+ * $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 "acinterp.h"
+#include "acparser.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ MODULE_NAME ("exoparg3")
+
+
+/*!
+ * Naming convention for AML interpreter execution routines.
+ *
+ * The routines that begin execution of AML opcodes are named with a common
+ * convention based upon the number of arguments, the number of target operands,
+ * and whether or not a value is returned:
+ *
+ * AcpiExOpcode_xA_yT_zR
+ *
+ * Where:
+ *
+ * xA - ARGUMENTS: The number of arguments (input operands) that are
+ * required for this opcode type (1 through 6 args).
+ * yT - TARGETS: The number of targets (output operands) that are required
+ * for this opcode type (0, 1, or 2 targets).
+ * zR - RETURN VALUE: Indicates whether this opcode type returns a value
+ * as the function return (0 or 1).
+ *
+ * The AcpiExOpcode* functions are called via the Dispatcher component with
+ * fully resolved operands.
+!*/
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_opcode_3A_0T_0R
+ *
+ * PARAMETERS: Walk_state - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute Triadic operator (3 operands)
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_opcode_3A_0T_0R (
+ acpi_walk_state *walk_state)
+{
+ acpi_operand_object **operand = &walk_state->operands[0];
+ ACPI_SIGNAL_FATAL_INFO *fatal;
+ acpi_status status = AE_OK;
+
+
+ FUNCTION_TRACE_STR ("Ex_opcode_3A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
+
+
+ switch (walk_state->opcode) {
+
+ case AML_FATAL_OP: /* Fatal (Fatal_type Fatal_code Fatal_arg) */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Fatal_op: Type %x Code %x Arg %x <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
+ (u32) operand[0]->integer.value, (u32) operand[1]->integer.value,
+ (u32) operand[2]->integer.value));
+
+
+ fatal = ACPI_MEM_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO));
+ if (fatal) {
+ fatal->type = (u32) operand[0]->integer.value;
+ fatal->code = (u32) operand[1]->integer.value;
+ fatal->argument = (u32) operand[2]->integer.value;
+ }
+
+ /*
+ * Always signal the OS!
+ */
+ acpi_os_signal (ACPI_SIGNAL_FATAL, fatal);
+
+ /* Might return while OS is shutting down, just continue */
+
+ ACPI_MEM_FREE (fatal);
+ break;
+
+
+ default:
+
+ REPORT_ERROR (("Acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
+ walk_state->opcode));
+ status = AE_AML_BAD_OPCODE;
+ goto cleanup;
+ break;
+ }
+
+
+cleanup:
+
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_opcode_3A_1T_1R
+ *
+ * PARAMETERS: Walk_state - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute Triadic operator (3 operands)
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_opcode_3A_1T_1R (
+ acpi_walk_state *walk_state)
+{
+ acpi_operand_object **operand = &walk_state->operands[0];
+ acpi_operand_object *return_desc = NULL;
+ char *buffer;
+ acpi_status status = AE_OK;
+ u32 index;
+ u32 length;
+
+
+ FUNCTION_TRACE_STR ("Ex_opcode_3A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
+
+
+ switch (walk_state->opcode) {
+ case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
+
+ /*
+ * Create the return object. The Source operand is guaranteed to be
+ * either a String or a Buffer, so just use its type.
+ */
+ return_desc = acpi_ut_create_internal_object (operand[0]->common.type);
+ if (!return_desc) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ /* Get the Integer values from the objects */
+
+ index = (u32) operand[1]->integer.value;
+ length = (u32) operand[2]->integer.value;
+
+ /*
+ * If the index is beyond the length of the String/Buffer, or if the
+ * requested length is zero, return a zero-length String/Buffer
+ */
+ if ((index < operand[0]->string.length) &&
+ (length > 0)) {
+ /* Truncate request if larger than the actual String/Buffer */
+
+ if ((index + length) >
+ operand[0]->string.length) {
+ length = operand[0]->string.length - index;
+ }
+
+ /* Allocate a new buffer for the String/Buffer */
+
+ buffer = ACPI_MEM_CALLOCATE (length + 1);
+ if (!buffer) {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Copy the portion requested */
+
+ MEMCPY (buffer, operand[0]->string.pointer + index,
+ length);
+
+ /* Set the length of the new String/Buffer */
+
+ return_desc->string.pointer = buffer;
+ return_desc->string.length = length;
+ }
+
+ break;
+
+
+ default:
+
+ REPORT_ERROR (("Acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
+ walk_state->opcode));
+ status = AE_AML_BAD_OPCODE;
+ goto cleanup;
+ break;
+ }
+
+ /* Store the result in the target */
+
+ status = acpi_ex_store (return_desc, operand[3], walk_state);
+
+cleanup:
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (status)) {
+ acpi_ut_remove_reference (return_desc);
+ }
+
+ /* Set the return object and exit */
+
+ walk_state->result_obj = return_desc;
+ return_ACPI_STATUS (status);
+}
+
+
--- /dev/null
+
+/******************************************************************************
+ *
+ * Module Name: exoparg6 - AML execution - opcodes with 6 arguments
+ * $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 "acinterp.h"
+#include "acparser.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT ACPI_EXECUTER
+ MODULE_NAME ("exoparg6")
+
+
+/*!
+ * Naming convention for AML interpreter execution routines.
+ *
+ * The routines that begin execution of AML opcodes are named with a common
+ * convention based upon the number of arguments, the number of target operands,
+ * and whether or not a value is returned:
+ *
+ * AcpiExOpcode_xA_yT_zR
+ *
+ * Where:
+ *
+ * xA - ARGUMENTS: The number of arguments (input operands) that are
+ * required for this opcode type (1 through 6 args).
+ * yT - TARGETS: The number of targets (output operands) that are required
+ * for this opcode type (0, 1, or 2 targets).
+ * zR - RETURN VALUE: Indicates whether this opcode type returns a value
+ * as the function return (0 or 1).
+ *
+ * The AcpiExOpcode* functions are called via the Dispatcher component with
+ * fully resolved operands.
+!*/
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_do_match
+ *
+ * PARAMETERS: Match_op - The AML match operand
+ * Package_value - Value from the target package
+ * Match_value - Value to be matched
+ *
+ * RETURN: TRUE if the match is successful, FALSE otherwise
+ *
+ * DESCRIPTION: Implements the low-level match for the ASL Match operator
+ *
+ ******************************************************************************/
+
+u8
+acpi_ex_do_match (
+ u32 match_op,
+ acpi_integer package_value,
+ acpi_integer match_value)
+{
+
+ switch (match_op) {
+ case MATCH_MTR: /* always true */
+
+ break;
+
+
+ case MATCH_MEQ: /* true if equal */
+
+ if (package_value != match_value) {
+ return (FALSE);
+ }
+ break;
+
+
+ case MATCH_MLE: /* true if less than or equal */
+
+ if (package_value > match_value) {
+ return (FALSE);
+ }
+ break;
+
+
+ case MATCH_MLT: /* true if less than */
+
+ if (package_value >= match_value) {
+ return (FALSE);
+ }
+ break;
+
+
+ case MATCH_MGE: /* true if greater than or equal */
+
+ if (package_value < match_value) {
+ return (FALSE);
+ }
+ break;
+
+
+ case MATCH_MGT: /* true if greater than */
+
+ if (package_value <= match_value) {
+ return (FALSE);
+ }
+ break;
+
+
+ default: /* undefined */
+
+ return (FALSE);
+ }
+
+
+ return TRUE;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_opcode_6A_0T_1R
+ *
+ * PARAMETERS: Walk_state - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute opcode with 6 arguments, no target, and a return value
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_opcode_6A_0T_1R (
+ acpi_walk_state *walk_state)
+{
+ acpi_operand_object **operand = &walk_state->operands[0];
+ acpi_operand_object *return_desc = NULL;
+ acpi_status status = AE_OK;
+ u32 index;
+ acpi_operand_object *this_element;
+
+
+ FUNCTION_TRACE_STR ("Ex_opcode_6A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
+
+
+ switch (walk_state->opcode) {
+ case AML_MATCH_OP:
+ /*
+ * Match (Search_package[0], Match_op1[1], Match_object1[2],
+ * Match_op2[3], Match_object2[4], Start_index[5])
+ */
+
+ /* Validate match comparison sub-opcodes */
+
+ if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) ||
+ (operand[3]->integer.value > MAX_MATCH_OPERATOR)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "operation encoding out of range\n"));
+ status = AE_AML_OPERAND_VALUE;
+ goto cleanup;
+ }
+
+ index = (u32) operand[5]->integer.value;
+ if (index >= (u32) operand[0]->package.count) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index beyond package end\n"));
+ status = AE_AML_PACKAGE_LIMIT;
+ goto cleanup;
+ }
+
+ return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+ if (!return_desc) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+
+ }
+
+ /* Default return value if no match found */
+
+ return_desc->integer.value = ACPI_INTEGER_MAX;
+
+ /*
+ * Examine each element until a match is found. Within the loop,
+ * "continue" signifies that the current element does not match
+ * and the next should be examined.
+ * Upon finding a match, the loop will terminate via "break" at
+ * the bottom. If it terminates "normally", Match_value will be -1
+ * (its initial value) indicating that no match was found. When
+ * returned as a Number, this will produce the Ones value as specified.
+ */
+ for ( ; index < operand[0]->package.count; index++) {
+ this_element = operand[0]->package.elements[index];
+
+ /*
+ * Treat any NULL or non-numeric elements as non-matching.
+ * TBD [Unhandled] - if an element is a Name,
+ * should we examine its value?
+ */
+ if (!this_element ||
+ this_element->common.type != ACPI_TYPE_INTEGER) {
+ continue;
+ }
+
+
+ /*
+ * Within these switch statements:
+ * "break" (exit from the switch) signifies a match;
+ * "continue" (proceed to next iteration of enclosing
+ * "for" loop) signifies a non-match.
+ */
+ if (!acpi_ex_do_match ((u32) operand[1]->integer.value,
+ this_element->integer.value, operand[2]->integer.value)) {
+ continue;
+ }
+
+
+ if (!acpi_ex_do_match ((u32) operand[3]->integer.value,
+ this_element->integer.value, operand[4]->integer.value)) {
+ continue;
+ }
+
+ /* Match found: Index is the return value */
+
+ return_desc->integer.value = index;
+ break;
+ }
+
+ break;
+
+
+ case AML_LOAD_TABLE_OP:
+
+ status = AE_NOT_IMPLEMENTED;
+ goto cleanup;
+ break;
+
+
+ default:
+
+ REPORT_ERROR (("Acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
+ walk_state->opcode));
+ status = AE_AML_BAD_OPCODE;
+ goto cleanup;
+ break;
+ }
+
+
+ walk_state->result_obj = return_desc;
+
+
+cleanup:
+
+ /* Delete return object on error */
+
+ if (ACPI_FAILURE (status)) {
+ acpi_ut_remove_reference (return_desc);
+ }
+
+ return_ACPI_STATUS (status);
+}
/******************************************************************************
*
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
- * $Revision: 95 $
+ * $Revision: 99 $
*
*****************************************************************************/
/*******************************************************************************
*
- * FUNCTION: Acpi_ex_prep_region_field_value
+ * FUNCTION: Acpi_ex_prep_field_value
*
* PARAMETERS: Node - Owning Node
* Region_node - Region in which field is being defined
*
* RETURN: Status
*
- * DESCRIPTION: Construct an acpi_operand_object of type Def_field and
+ * DESCRIPTION: Construct an acpi_operand_object of type Def_field and
* connect it to the parent Node.
*
******************************************************************************/
acpi_status
-acpi_ex_prep_region_field_value (
- acpi_namespace_node *node,
- acpi_handle region_node,
- u8 field_flags,
- u32 field_bit_position,
- u32 field_bit_length)
+acpi_ex_prep_field_value (
+ ACPI_CREATE_FIELD_INFO *info)
{
acpi_operand_object *obj_desc;
u32 type;
acpi_status status;
- FUNCTION_TRACE ("Ex_prep_region_field_value");
+ FUNCTION_TRACE ("Ex_prep_field_value");
/* Parameter validation */
- if (!region_node) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Region_node\n"));
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
+ if (info->field_type != INTERNAL_TYPE_INDEX_FIELD) {
+ if (!info->region_node) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Region_node\n"));
+ return_ACPI_STATUS (AE_AML_NO_OPERAND);
+ }
+
+ type = acpi_ns_get_type (info->region_node);
+ if (type != ACPI_TYPE_REGION) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X %s\n",
+ type, acpi_ut_get_type_name (type)));
- type = acpi_ns_get_type (region_node);
- if (type != ACPI_TYPE_REGION) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X %s\n",
- type, acpi_ut_get_type_name (type)));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
}
- /* Allocate a new object */
+ /* Allocate a new region object */
- obj_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REGION_FIELD);
+ obj_desc = acpi_ut_create_internal_object (info->field_type);
if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
-
- /* Obj_desc and Region valid */
-
- DUMP_OPERANDS ((acpi_operand_object **) &node, IMODE_EXECUTE,
- "Ex_prep_region_field_value", 1, "case Region_field");
- DUMP_OPERANDS ((acpi_operand_object **) ®ion_node, IMODE_EXECUTE,
- "Ex_prep_region_field_value", 1, "case Region_field");
-
/* Initialize areas of the object that are common to all fields */
- status = acpi_ex_prep_common_field_object (obj_desc, field_flags,
- field_bit_position, field_bit_length);
+ status = acpi_ex_prep_common_field_object (obj_desc, info->field_flags,
+ info->field_bit_position, info->field_bit_length);
if (ACPI_FAILURE (status)) {
+ acpi_ut_delete_object_desc (obj_desc);
return_ACPI_STATUS (status);
}
- /* Initialize areas of the object that are specific to this field type */
-
- obj_desc->field.region_obj = acpi_ns_get_attached_object (region_node);
-
- /* An additional reference for the container */
+ /* Initialize areas of the object that are specific to the field type */
- acpi_ut_add_reference (obj_desc->field.region_obj);
+ switch (info->field_type) {
+ case INTERNAL_TYPE_REGION_FIELD:
+ obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node);
- /* Debug info */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Bitoff=%X Off=%X Gran=%X Region %p\n",
- obj_desc->field.start_field_bit_offset, obj_desc->field.base_byte_offset,
- obj_desc->field.access_bit_width, obj_desc->field.region_obj));
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "set Named_obj %p (%4.4s) val = %p\n",
- node, &(node->name), obj_desc));
+ /* An additional reference for the container */
+ acpi_ut_add_reference (obj_desc->field.region_obj);
- /*
- * Store the constructed descriptor (Obj_desc) into the parent Node,
- * preserving the current type of that Named_obj.
- */
- status = acpi_ns_attach_object (node, obj_desc, (u8) acpi_ns_get_type (node));
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_prep_bank_field_value
- *
- * PARAMETERS: Node - Owning Node
- * Region_node - Region in which field is being defined
- * Bank_register_node - Bank selection register node
- * Bank_val - Value to store in selection register
- * Field_flags - Access, Lock_rule, and Update_rule
- * Field_bit_position - Field start position
- * Field_bit_length - Field length in number of bits
- *
- * RETURN: Status
- *
- * DESCRIPTION: Construct an object of type Bank_field and attach it to the
- * parent Node.
- *
- ******************************************************************************/
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Region_field: Bitoff=%X Off=%X Gran=%X Region %p\n",
+ obj_desc->field.start_field_bit_offset, obj_desc->field.base_byte_offset,
+ obj_desc->field.access_bit_width, obj_desc->field.region_obj));
+ break;
-acpi_status
-acpi_ex_prep_bank_field_value (
- acpi_namespace_node *node,
- acpi_namespace_node *region_node,
- acpi_namespace_node *bank_register_node,
- u32 bank_val,
- u8 field_flags,
- u32 field_bit_position,
- u32 field_bit_length)
-{
- acpi_operand_object *obj_desc;
- u32 type;
- acpi_status status;
+ case INTERNAL_TYPE_BANK_FIELD:
- FUNCTION_TRACE ("Ex_prep_bank_field_value");
+ obj_desc->bank_field.value = info->bank_value;
+ obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (info->region_node);
+ obj_desc->bank_field.bank_register_obj = acpi_ns_get_attached_object (info->register_node);
+ /* An additional reference for the attached objects */
- /* Parameter validation */
+ acpi_ut_add_reference (obj_desc->bank_field.region_obj);
+ acpi_ut_add_reference (obj_desc->bank_field.bank_register_obj);
- if (!region_node) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Region_node\n"));
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Bank Field: Bit_off=%X Off=%X Gran=%X Region %p Bank_reg %p\n",
+ obj_desc->bank_field.start_field_bit_offset, obj_desc->bank_field.base_byte_offset,
+ obj_desc->field.access_bit_width, obj_desc->bank_field.region_obj,
+ obj_desc->bank_field.bank_register_obj));
+ break;
- type = acpi_ns_get_type (region_node);
- if (type != ACPI_TYPE_REGION) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X %s\n",
- type, acpi_ut_get_type_name (type)));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
- /* Allocate a new object */
+ case INTERNAL_TYPE_INDEX_FIELD:
- obj_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_BANK_FIELD);
- if (!obj_desc) {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
+ obj_desc->index_field.index_obj = acpi_ns_get_attached_object (info->register_node);
+ obj_desc->index_field.data_obj = acpi_ns_get_attached_object (info->data_register_node);
+ obj_desc->index_field.value = (u32) (info->field_bit_position /
+ obj_desc->field.access_bit_width);
- /* Obj_desc and Region valid */
+ if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Index Object\n"));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
- DUMP_OPERANDS ((acpi_operand_object **) &node, IMODE_EXECUTE,
- "Ex_prep_bank_field_value", 1, "case Bank_field");
- DUMP_OPERANDS ((acpi_operand_object **) ®ion_node, IMODE_EXECUTE,
- "Ex_prep_bank_field_value", 1, "case Bank_field");
+ /* An additional reference for the attached objects */
- /* Initialize areas of the object that are common to all fields */
+ acpi_ut_add_reference (obj_desc->index_field.data_obj);
+ acpi_ut_add_reference (obj_desc->index_field.index_obj);
- status = acpi_ex_prep_common_field_object (obj_desc, field_flags,
- field_bit_position, field_bit_length);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Index_field: bitoff=%X off=%X gran=%X Index %p Data %p\n",
+ obj_desc->index_field.start_field_bit_offset, obj_desc->index_field.base_byte_offset,
+ obj_desc->field.access_bit_width, obj_desc->index_field.index_obj,
+ obj_desc->index_field.data_obj));
+ break;
}
- /* Initialize areas of the object that are specific to this field type */
-
- obj_desc->bank_field.value = bank_val;
- obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (region_node);
- obj_desc->bank_field.bank_register_obj = acpi_ns_get_attached_object (bank_register_node);
-
- /* An additional reference for the attached objects */
-
- acpi_ut_add_reference (obj_desc->bank_field.region_obj);
- acpi_ut_add_reference (obj_desc->bank_field.bank_register_obj);
-
- /* Debug info */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Bit_off=%X Off=%X Gran=%X Region %p Bank_reg %p\n",
- obj_desc->bank_field.start_field_bit_offset, obj_desc->bank_field.base_byte_offset,
- obj_desc->field.access_bit_width, obj_desc->bank_field.region_obj,
- obj_desc->bank_field.bank_register_obj));
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Set Named_obj %p (%4.4s) val=%p\n",
- node, &(node->name), obj_desc));
-
-
/*
* Store the constructed descriptor (Obj_desc) into the parent Node,
* preserving the current type of that Named_obj.
*/
- status = acpi_ns_attach_object (node, obj_desc, (u8) acpi_ns_get_type (node));
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_prep_index_field_value
- *
- * PARAMETERS: Node - Owning Node
- * Index_reg - Index register
- * Data_reg - Data register
- * Field_flags - Access, Lock_rule, and Update_rule
- * Field_bit_position - Field start position
- * Field_bit_length - Field length in number of bits
- *
- * RETURN: Status
- *
- * DESCRIPTION: Construct an acpi_operand_object of type Index_field and
- * connect it to the parent Node.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_prep_index_field_value (
- acpi_namespace_node *node,
- acpi_namespace_node *index_reg,
- acpi_namespace_node *data_reg,
- u8 field_flags,
- u32 field_bit_position,
- u32 field_bit_length)
-{
- acpi_operand_object *obj_desc;
- acpi_status status;
-
-
- FUNCTION_TRACE ("Ex_prep_index_field_value");
-
-
- /* Parameter validation */
-
- if (!index_reg || !data_reg) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null handle\n"));
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
-
- /* Allocate a new object descriptor */
-
- obj_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_INDEX_FIELD);
- if (!obj_desc) {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Initialize areas of the object that are common to all fields */
-
- status = acpi_ex_prep_common_field_object (obj_desc, field_flags,
- field_bit_position, field_bit_length);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
- /* Initialize areas of the object that are specific to this field type */
-
- obj_desc->index_field.data_obj = acpi_ns_get_attached_object (data_reg);
- obj_desc->index_field.index_obj = acpi_ns_get_attached_object (index_reg);
- obj_desc->index_field.value = (u32) (field_bit_position /
- obj_desc->field.access_bit_width);
-
- /* An additional reference for the attached objects */
-
- acpi_ut_add_reference (obj_desc->index_field.data_obj);
- acpi_ut_add_reference (obj_desc->index_field.index_obj);
-
- /* Debug info */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "bitoff=%X off=%X gran=%X Index %p Data %p\n",
- obj_desc->index_field.start_field_bit_offset, obj_desc->index_field.base_byte_offset,
- obj_desc->field.access_bit_width, obj_desc->index_field.index_obj,
- obj_desc->index_field.data_obj));
+ status = acpi_ns_attach_object (info->field_node, obj_desc,
+ (u8) acpi_ns_get_type (info->field_node));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "set Named_obj %p (%4.4s) val = %p\n",
- node, &(node->name), obj_desc));
+ info->field_node, (char*)&(info->field_node->name), obj_desc));
+ /* Remove local reference to the object */
- /*
- * Store the constructed descriptor (Obj_desc) into the parent Node,
- * preserving the current type of that Named_obj.
- */
- status = acpi_ns_attach_object (node, obj_desc, (u8) acpi_ns_get_type (node));
+ acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: exregion - ACPI default Op_region (address space) handlers
- * $Revision: 58 $
+ * $Revision: 61 $
*
*****************************************************************************/
* Value - Pointer to in or out value
* Handler_context - Pointer to Handler's context
* Region_context - Pointer to context specific to the
- * accessed region
+ * accessed region
*
* RETURN: Status
*
((acpi_integer) address - (acpi_integer) mem_info->mapped_physical_address);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "IO %d (%d width) Address=%8.8lX%8.8lX\n", function, bit_width,
+ "System_memory %d (%d width) Address=%8.8X%8.8X\n", function, bit_width,
HIDWORD (address), LODWORD (address)));
/* Perform the memory read or write */
* Value - Pointer to in or out value
* Handler_context - Pointer to Handler's context
* Region_context - Pointer to context specific to the
- * accessed region
+ * accessed region
*
* RETURN: Status
*
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "IO %d (%d width) Address=%8.8lX%8.8lX\n", function, bit_width,
+ "System_iO %d (%d width) Address=%8.8X%8.8X\n", function, bit_width,
HIDWORD (address), LODWORD (address)));
/* Decode the function parameter */
* Value - Pointer to in or out value
* Handler_context - Pointer to Handler's context
* Region_context - Pointer to context specific to the
- * accessed region
+ * accessed region
*
* RETURN: Status
*
pci_register = (u16) address;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "IO %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
+ "Pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
function, bit_width, pci_id->segment, pci_id->bus, pci_id->device,
pci_id->function, pci_register));
return_ACPI_STATUS (status);
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_cmos_space_handler
+ *
+ * PARAMETERS: Function - Read or Write operation
+ * Address - Where in the space to read or write
+ * Bit_width - Field width in bits (8, 16, or 32)
+ * Value - Pointer to in or out value
+ * Handler_context - Pointer to Handler's context
+ * Region_context - Pointer to context specific to the
+ * accessed region
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Handler for the CMOS address space (Op Region)
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_cmos_space_handler (
+ u32 function,
+ ACPI_PHYSICAL_ADDRESS address,
+ u32 bit_width,
+ u32 *value,
+ void *handler_context,
+ void *region_context)
+{
+ acpi_status status = AE_OK;
+
+
+ FUNCTION_TRACE ("Ex_cmos_space_handler");
+
+
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ex_pci_bar_space_handler
+ *
+ * PARAMETERS: Function - Read or Write operation
+ * Address - Where in the space to read or write
+ * Bit_width - Field width in bits (8, 16, or 32)
+ * Value - Pointer to in or out value
+ * Handler_context - Pointer to Handler's context
+ * Region_context - Pointer to context specific to the
+ * accessed region
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Handler for the PCI Bar_target address space (Op Region)
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_pci_bar_space_handler (
+ u32 function,
+ ACPI_PHYSICAL_ADDRESS address,
+ u32 bit_width,
+ u32 *value,
+ void *handler_context,
+ void *region_context)
+{
+ acpi_status status = AE_OK;
+
+
+ FUNCTION_TRACE ("Ex_pci_bar_space_handler");
+
+
+ return_ACPI_STATUS (status);
+}
+
/******************************************************************************
*
* Module Name: exresnte - AML Interpreter object resolution
- * $Revision: 41 $
+ * $Revision: 43 $
*
*****************************************************************************/
*
* FUNCTION: Acpi_ex_resolve_node_to_value
*
- * PARAMETERS: Stack_ptr - Pointer to a location on a stack that contains
- * a pointer to a Node
- * Walk_state - Current state
+ * PARAMETERS: Object_ptr - Pointer to a location that contains
+ * a pointer to a NS node, and will recieve a
+ * pointer to the resolved object.
+ * Walk_state - Current state. Valid only if executing AML
+ * code. NULL if simply resolving an object
*
* RETURN: Status
*
- * DESCRIPTION: Resolve a Namespace node (AKA a "direct name pointer") to
- * a valued object
+ * DESCRIPTION: Resolve a Namespace node to a valued object
*
* Note: for some of the data types, the pointer attached to the Node
* can be either a pointer to an actual internal object or a pointer into the
acpi_status
acpi_ex_resolve_node_to_value (
- acpi_namespace_node **stack_ptr,
+ acpi_namespace_node **object_ptr,
acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
- acpi_operand_object *val_desc;
+ acpi_operand_object *source_desc;
acpi_operand_object *obj_desc = NULL;
acpi_namespace_node *node;
acpi_object_type8 entry_type;
* The stack pointer points to a acpi_namespace_node (Node). Get the
* object that is attached to the Node.
*/
- node = *stack_ptr;
- val_desc = acpi_ns_get_attached_object (node);
+ node = *object_ptr;
+ source_desc = acpi_ns_get_attached_object (node);
entry_type = acpi_ns_get_type ((acpi_handle) node);
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p Val_desc=%p Type=%X\n",
- node, val_desc, entry_type));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p Source_desc=%p Type=%X\n",
+ node, source_desc, entry_type));
/*
return_ACPI_STATUS (AE_OK);
}
- if (!val_desc) {
+ if (!source_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object attached to node %p\n",
node));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
case ACPI_TYPE_PACKAGE:
- if (ACPI_TYPE_PACKAGE != val_desc->common.type) {
+ if (ACPI_TYPE_PACKAGE != source_desc->common.type) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n",
- acpi_ut_get_type_name (val_desc->common.type)));
+ acpi_ut_get_type_name (source_desc->common.type)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Return an additional reference to the object */
- obj_desc = val_desc;
+ obj_desc = source_desc;
acpi_ut_add_reference (obj_desc);
break;
case ACPI_TYPE_BUFFER:
- if (ACPI_TYPE_BUFFER != val_desc->common.type) {
+ if (ACPI_TYPE_BUFFER != source_desc->common.type) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n",
- acpi_ut_get_type_name (val_desc->common.type)));
+ acpi_ut_get_type_name (source_desc->common.type)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Return an additional reference to the object */
- obj_desc = val_desc;
+ obj_desc = source_desc;
acpi_ut_add_reference (obj_desc);
break;
case ACPI_TYPE_STRING:
- if (ACPI_TYPE_STRING != val_desc->common.type) {
+ if (ACPI_TYPE_STRING != source_desc->common.type) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n",
- acpi_ut_get_type_name (val_desc->common.type)));
+ acpi_ut_get_type_name (source_desc->common.type)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Return an additional reference to the object */
- obj_desc = val_desc;
+ obj_desc = source_desc;
acpi_ut_add_reference (obj_desc);
break;
case ACPI_TYPE_INTEGER:
- if (ACPI_TYPE_INTEGER != val_desc->common.type) {
+ if (ACPI_TYPE_INTEGER != source_desc->common.type) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n",
- acpi_ut_get_type_name (val_desc->common.type)));
+ acpi_ut_get_type_name (source_desc->common.type)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Return an additional reference to the object */
- obj_desc = val_desc;
+ obj_desc = source_desc;
acpi_ut_add_reference (obj_desc);
break;
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Field_read Node=%p Val_desc=%p Type=%X\n",
- node, val_desc, entry_type));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Field_read Node=%p Source_desc=%p Type=%X\n",
+ node, source_desc, entry_type));
- status = acpi_ex_read_data_from_field (val_desc, &obj_desc);
+ status = acpi_ex_read_data_from_field (source_desc, &obj_desc);
break;
/* Return an additional reference to the object */
- obj_desc = val_desc;
+ obj_desc = source_desc;
acpi_ut_add_reference (obj_desc);
break;
*/
case INTERNAL_TYPE_REFERENCE:
- switch (val_desc->reference.opcode) {
+ switch (source_desc->reference.opcode) {
case AML_ZERO_OP:
case AML_REVISION_OP:
- temp_val = ACPI_CA_VERSION;
+ temp_val = ACPI_CA_SUPPORT_LEVEL;
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported reference opcode %X\n",
- val_desc->reference.opcode));
+ source_desc->reference.opcode));
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
obj_desc->integer.value = temp_val;
- /* Truncate value if we are executing from a 32-bit ACPI table */
-
- acpi_ex_truncate_for32bit_table (obj_desc, walk_state);
+ /*
+ * Truncate value if we are executing from a 32-bit ACPI table
+ * AND actually executing AML code. If we are resolving
+ * an object in the namespace via an external call to the
+ * subsystem, we will have a null Walk_state
+ */
+ if (walk_state) {
+ acpi_ex_truncate_for32bit_table (obj_desc, walk_state);
+ }
break;
/* Put the object descriptor on the stack */
- *stack_ptr = (void *) obj_desc;
+ *object_ptr = (void *) obj_desc;
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: exresolv - AML Interpreter object resolution
- * $Revision: 99 $
+ * $Revision: 101 $
*
*****************************************************************************/
(result_desc->integer.value >> obj_desc->buffer_field.start_field_bit_offset) & mask;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "** Read from buffer %p byte %ld bit %d width %d addr %p mask %08lx val %08lx\n",
+ "** Read from buffer %p byte %d bit %d width %d addr %p mask %08X val %8.8X%8.8X\n",
obj_desc->buffer_field.buffer_obj->buffer.pointer,
obj_desc->buffer_field.base_byte_offset,
obj_desc->buffer_field.start_field_bit_offset,
obj_desc->buffer_field.bit_length,
- location, mask, result_desc->integer.value));
+ location, mask,
+ HIDWORD(result_desc->integer.value),
+ LODWORD(result_desc->integer.value)));
return_ACPI_STATUS (AE_OK);
}
break;
case AML_REVISION_OP:
- obj_desc->integer.value = ACPI_CA_VERSION;
+ obj_desc->integer.value = ACPI_CA_SUPPORT_LEVEL;
break;
}
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
- * $Revision: 38 $
+ * $Revision: 41 $
*
*****************************************************************************/
op_info = acpi_ps_get_opcode_info (opcode);
- if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
+ if (op_info->class == AML_CLASS_UNKNOWN) {
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
*/
while (GET_CURRENT_ARG_TYPE (arg_types)) {
if (!stack_ptr || !*stack_ptr) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null stack entry at %X\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null stack entry at %p\n",
stack_ptr));
return_ACPI_STATUS (AE_AML_INTERNAL);
* Decode the Reference
*/
op_info = acpi_ps_get_opcode_info (opcode);
- if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
+ if (op_info->class == AML_CLASS_UNKNOWN) {
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
- * $Revision: 148 $
+ * $Revision: 150 $
*
*****************************************************************************/
*
* FUNCTION: Acpi_ex_store
*
- * PARAMETERS: *Val_desc - Value to be stored
+ * PARAMETERS: *Source_desc - Value to be stored
* *Dest_desc - Where to store it. Must be an NS node
* or an acpi_operand_object of type
- * Reference; if the latter the descriptor
- * will be either reused or deleted.
+ * Reference;
*
* RETURN: Status
*
- * DESCRIPTION: Store the value described by Val_desc into the location
+ * DESCRIPTION: Store the value described by Source_desc into the location
* described by Dest_desc. Called by various interpreter
* functions to store the result of an operation into
* the destination operand.
acpi_status
acpi_ex_store (
- acpi_operand_object *val_desc,
+ acpi_operand_object *source_desc,
acpi_operand_object *dest_desc,
acpi_walk_state *walk_state)
{
/* Validate parameters */
- if (!val_desc || !dest_desc) {
+ if (!source_desc || !dest_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
* Dest is a namespace node,
* Storing an object into a Name "container"
*/
- status = acpi_ex_store_object_to_node (val_desc,
+ status = acpi_ex_store_object_to_node (source_desc,
(acpi_namespace_node *) dest_desc, walk_state);
/* All done, that's it */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Destination is not a Reference_obj [%p]\n", dest_desc));
- DUMP_STACK_ENTRY (val_desc);
+ DUMP_STACK_ENTRY (source_desc);
DUMP_STACK_ENTRY (dest_desc);
DUMP_OPERANDS (&dest_desc, IMODE_EXECUTE, "Ex_store",
2, "Target is not a Reference_obj");
/* Storing an object into a Name "container" */
- status = acpi_ex_store_object_to_node (val_desc, ref_desc->reference.object,
+ status = acpi_ex_store_object_to_node (source_desc, ref_desc->reference.object,
walk_state);
break;
/* Storing to an Index (pointer into a packager or buffer) */
- status = acpi_ex_store_object_to_index (val_desc, ref_desc, walk_state);
+ status = acpi_ex_store_object_to_index (source_desc, ref_desc, walk_state);
break;
/* Store to a method local/arg */
status = acpi_ds_store_object_to_local (ref_desc->reference.opcode,
- ref_desc->reference.offset, val_desc, walk_state);
+ ref_desc->reference.offset, source_desc, walk_state);
break;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Write to Debug Object: ****:\n\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ",
- acpi_ut_get_type_name (val_desc->common.type)));
+ acpi_ut_get_type_name (source_desc->common.type)));
- switch (val_desc->common.type) {
+ switch (source_desc->common.type) {
case ACPI_TYPE_INTEGER:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%X (%d)\n",
- (u32) val_desc->integer.value, (u32) val_desc->integer.value));
+ (u32) source_desc->integer.value, (u32) source_desc->integer.value));
break;
case ACPI_TYPE_BUFFER:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%X\n",
- (u32) val_desc->buffer.length));
+ (u32) source_desc->buffer.length));
break;
case ACPI_TYPE_STRING:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s\n", val_desc->string.pointer));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s\n", source_desc->string.pointer));
break;
case ACPI_TYPE_PACKAGE:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Elements - 0x%X\n",
- (u32) val_desc->package.elements));
+ (u32) source_desc->package.elements));
break;
default:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "@0x%p\n", val_desc));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "@0x%p\n", source_desc));
break;
}
} /* switch (Ref_desc->Reference.Opcode) */
- /* Always delete the reference descriptor object */
-
- if (ref_desc) {
- acpi_ut_remove_reference (ref_desc);
- }
-
return_ACPI_STATUS (status);
}
*
* FUNCTION: Acpi_ex_store_object_to_index
*
- * PARAMETERS: *Val_desc - Value to be stored
+ * PARAMETERS: *Source_desc - Value to be stored
* *Node - Named object to receive the value
*
* RETURN: Status
acpi_status
acpi_ex_store_object_to_index (
- acpi_operand_object *val_desc,
+ acpi_operand_object *source_desc,
acpi_operand_object *dest_desc,
acpi_walk_state *walk_state)
{
if (dest_desc->reference.target_type == ACPI_TYPE_PACKAGE) {
/*
* The object at *(Dest_desc->Reference.Where) is the
- * element within the package that is to be modified.
+ * element within the package that is to be modified.
*/
obj_desc = *(dest_desc->reference.where);
if (obj_desc) {
*
* TBD: [Investigate] Should both the src and dest be required
* to be packages?
- * && (Val_desc->Common.Type == ACPI_TYPE_PACKAGE)
+ * && (Source_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_ut_remove_reference (obj_desc);
- acpi_ut_remove_reference (obj_desc);
+ /* Take away the reference for being part of a package */
+ acpi_ut_remove_reference (obj_desc);
obj_desc = NULL;
}
}
* 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.
+ * source element NOTE: Source_desccan be of any type.
*/
- obj_desc = acpi_ut_create_internal_object (val_desc->common.type);
+ obj_desc = acpi_ut_create_internal_object (source_desc->common.type);
if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
* If the source is a package, copy the source to the new dest
*/
if (ACPI_TYPE_PACKAGE == obj_desc->common.type) {
- status = acpi_ut_copy_ipackage_to_ipackage (val_desc, obj_desc, walk_state);
+ status = acpi_ut_copy_ipackage_to_ipackage (source_desc, obj_desc, walk_state);
if (ACPI_FAILURE (status)) {
acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
}
}
- /*
- * Install the new descriptor into the package and add a
- * reference to the newly created descriptor for now being
- * part of the parent package
- */
+ /* Install the new descriptor into the package */
+
*(dest_desc->reference.where) = obj_desc;
- acpi_ut_add_reference (obj_desc);
}
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
+ * convert the contents of the source (Source_desc) and copy into
* the destination (Obj_desc)
*/
- status = acpi_ex_store_object_to_object (val_desc, obj_desc,
+ status = acpi_ex_store_object_to_object (source_desc, obj_desc,
walk_state);
if (ACPI_FAILURE (status)) {
/*
* The assignment of the individual elements will be slightly
* different for each source type.
*/
- switch (val_desc->common.type) {
+ switch (source_desc->common.type) {
case ACPI_TYPE_INTEGER:
/*
* Type is Integer, assign bytewise
*/
length = sizeof (acpi_integer);
for (i = length; i != 0; i--) {
- value = (u8)(val_desc->integer.value >> (MUL_8 (i - 1)));
+ value = (u8)(source_desc->integer.value >> (MUL_8 (i - 1)));
obj_desc->buffer.pointer[dest_desc->reference.offset] = value;
}
break;
* Type is Buffer, the Length is in the structure.
* Just loop through the elements and assign each one in turn.
*/
- length = val_desc->buffer.length;
+ length = source_desc->buffer.length;
for (i = 0; i < length; i++) {
- value = val_desc->buffer.pointer[i];
+ value = source_desc->buffer.pointer[i];
obj_desc->buffer.pointer[dest_desc->reference.offset] = value;
}
break;
* Type is String, the Length is in the structure.
* Just loop through the elements and assign each one in turn.
*/
- length = val_desc->string.length;
+ length = source_desc->string.length;
for (i = 0; i < length; i++) {
- value = val_desc->string.pointer[i];
+ value = source_desc->string.pointer[i];
obj_desc->buffer.pointer[dest_desc->reference.offset] = value;
}
break;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Source must be Number/Buffer/String type, not %X\n",
- val_desc->common.type));
+ source_desc->common.type));
status = AE_AML_OPERAND_TYPE;
break;
}
* Source_desc reference count is incremented by Attach_object.
*/
status = acpi_ns_attach_object (node, target_desc, target_type);
+
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Store %s into %s via Convert/Attach\n",
acpi_ut_get_type_name (target_desc->common.type),
/* No conversions for all other types. Just attach the source object */
status = acpi_ns_attach_object (node, source_desc, source_desc->common.type);
-
break;
}
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
- * $Revision: 84 $
+ * $Revision: 85 $
*
*****************************************************************************/
*
* FUNCTION: Acpi_ex_digits_needed
*
- * PARAMETERS: val - Value to be represented
- * base - Base of representation
+ * PARAMETERS: Value - Value to be represented
+ * Base - Base of representation
*
- * RETURN: the number of digits needed to represent val in base
+ * RETURN: the number of digits needed to represent Value in Base
*
******************************************************************************/
u32
acpi_ex_digits_needed (
- acpi_integer val,
+ acpi_integer value,
u32 base)
{
u32 num_digits = 0;
else {
/*
- * acpi_integer is unsigned, which is why we don't worry about the '-'
+ * acpi_integer is unsigned, which is why we don't worry about a '-'
*/
- for (num_digits = 1; (val = ACPI_DIVIDE (val,base)); ++num_digits) { ; }
+ for (num_digits = 1;
+ (acpi_ut_short_divide (&value, base, &value, NULL));
+ ++num_digits) { ; }
}
return_VALUE (num_digits);
{
u32 count;
u32 digits_needed;
+ u32 remainder;
FUNCTION_ENTRY ();
digits_needed = acpi_ex_digits_needed (value, 10);
- out_string[digits_needed] = '\0';
+ out_string[digits_needed] = 0;
for (count = digits_needed; count > 0; count--) {
- out_string[count-1] = (NATIVE_CHAR) ('0' + (ACPI_MODULO (value, 10)));
- value = ACPI_DIVIDE (value, 10);
+ acpi_ut_short_divide (&value, 10, &value, &remainder);
+ out_string[count-1] = (NATIVE_CHAR) ('0' + remainder);
}
return (AE_OK);
+++ /dev/null
-
-/******************************************************************************
- *
- * Module Name: exxface - External interpreter interfaces
- * $Revision: 29 $
- *
- *****************************************************************************/
-
-/*
- * 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 "acinterp.h"
-
-
-#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exxface")
-
-#if 0
-
-/*
- * DEFINE_AML_GLOBALS is tested in amlcode.h
- * to determine whether certain global names should be "defined" or only
- * "declared" in the current compilation. This enhances maintainability
- * by enabling a single header file to embody all knowledge of the names
- * in question.
- *
- * Exactly one module of any executable should #define DEFINE_GLOBALS
- * before #including the header files which use this convention. The
- * names in question will be defined and initialized in that module,
- * and declared as extern in all other modules which #include those
- * header files.
- */
-
-#define DEFINE_AML_GLOBALS
-#include "amlcode.h"
-#include "acparser.h"
-#include "acnamesp.h"
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ex_execute_method
- *
- * PARAMETERS: Pcode - Pointer to the pcode stream
- * Pcode_length - Length of pcode that comprises the method
- * **Params - List of parameters to pass to method,
- * terminated by NULL. Params itself may be
- * NULL if no parameters are being passed.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute a control method
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_execute_method (
- acpi_namespace_node *method_node,
- acpi_operand_object **params,
- acpi_operand_object **return_obj_desc)
-{
- acpi_status status;
-
-
- FUNCTION_TRACE ("Ex_execute_method");
-
-
- /*
- * The point here is to lock the interpreter and call the low
- * level execute.
- */
- status = acpi_ex_enter_interpreter ();
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
- status = acpi_psx_execute (method_node, params, return_obj_desc);
-
- acpi_ex_exit_interpreter ();
-
- return_ACPI_STATUS (status);
-}
-
-
-#endif
/******************************************************************************
*
* Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
- * $Revision: 45 $
+ * $Revision: 46 $
*
*****************************************************************************/
/* Give the platform some time to react */
- acpi_os_stall (5000);
+ acpi_os_stall (20000);
if (acpi_hw_get_mode () == mode) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", mode));
/******************************************************************************
*
* Module Name: hwgpe - Low level GPE enable/disable/clear functions
- * $Revision: 32 $
+ * $Revision: 35 $
*
*****************************************************************************/
(in_byte | bit_mask), 8);
}
+/******************************************************************************
+ *
+ * FUNCTION: Acpi_hw_enable_gpe_for_wakeup
+ *
+ * PARAMETERS: Gpe_number - The GPE
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Keep track of which GPEs the OS has requested not be
+ * disabled when going to sleep.
+ *
+ ******************************************************************************/
+
+void
+acpi_hw_enable_gpe_for_wakeup (
+ u32 gpe_number)
+{
+ u32 register_index;
+ u32 bit_mask;
+
+
+ FUNCTION_ENTRY ();
+
+
+ /*
+ * Translate GPE number to index into global registers array.
+ */
+ register_index = acpi_gbl_gpe_valid[gpe_number];
+
+ /*
+ * Figure out the bit offset for this GPE within the target register.
+ */
+ bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
+
+ /*
+ * Set the bit so we will not disable this when sleeping
+ */
+ acpi_gbl_gpe_registers[register_index].wake_enable |= bit_mask;
+}
/******************************************************************************
*
acpi_os_read_port (acpi_gbl_gpe_registers[register_index].enable_addr, &in_byte, 8);
acpi_os_write_port (acpi_gbl_gpe_registers[register_index].enable_addr,
(in_byte & ~bit_mask), 8);
+
+ acpi_hw_disable_gpe_for_wakeup(gpe_number);
}
+/******************************************************************************
+ *
+ * FUNCTION: Acpi_hw_disable_gpe_for_wakeup
+ *
+ * PARAMETERS: Gpe_number - The GPE
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Keep track of which GPEs the OS has requested not be
+ * disabled when going to sleep.
+ *
+ ******************************************************************************/
+
+void
+acpi_hw_disable_gpe_for_wakeup (
+ u32 gpe_number)
+{
+ u32 register_index;
+ u32 bit_mask;
+
+
+ FUNCTION_ENTRY ();
+
+
+ /*
+ * Translate GPE number to index into global registers array.
+ */
+ register_index = acpi_gbl_gpe_valid[gpe_number];
+
+ /*
+ * Figure out the bit offset for this GPE within the target register.
+ */
+ bit_mask = acpi_gbl_decode_to8bit [MOD_8 (gpe_number)];
+
+ /*
+ * Clear the bit so we will disable this when sleeping
+ */
+ acpi_gbl_gpe_registers[register_index].wake_enable &= ~bit_mask;
+}
/******************************************************************************
*
(*event_status) |= ACPI_EVENT_FLAG_ENABLED;
}
+ /*
+ * Enabled for wake?:
+ */
+ if (bit_mask & acpi_gbl_gpe_registers[register_index].wake_enable) {
+ (*event_status) |= ACPI_EVENT_FLAG_WAKE_ENABLED;
+ }
+
/*
* Set?
*/
(*event_status) |= ACPI_EVENT_FLAG_SET;
}
}
+
+/******************************************************************************
+ *
+ * FUNCTION: Acpi_hw_disable_non_wakeup_gpes
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Disable all non-wakeup GPEs
+ * Call with interrupts disabled. The interrupt handler also
+ * modifies Acpi_gbl_Gpe_registers[i].Enable, so it should not be
+ * given the chance to run until after non-wake GPEs are
+ * re-enabled.
+ *
+ ******************************************************************************/
+
+void
+acpi_hw_disable_non_wakeup_gpes (
+ void)
+{
+ u32 i;
+
+ FUNCTION_ENTRY ();
+
+ for (i = 0; i < acpi_gbl_gpe_register_count; i++) {
+ /*
+ * Read the enabled status of all GPEs. We
+ * will be using it to restore all the GPEs later.
+ */
+ acpi_os_read_port (acpi_gbl_gpe_registers[i].enable_addr,
+ &acpi_gbl_gpe_registers[i].enable, 8);
+
+ /*
+ * Disable all GPEs but wakeup GPEs.
+ */
+ acpi_os_write_port(acpi_gbl_gpe_registers[i].enable_addr,
+ acpi_gbl_gpe_registers[i].wake_enable, 8);
+ }
+}
+
+/******************************************************************************
+ *
+ * FUNCTION: Acpi_hw_enable_non_wakeup_gpes
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Enable all non-wakeup GPEs we previously enabled.
+ *
+ ******************************************************************************/
+
+void
+acpi_hw_enable_non_wakeup_gpes (
+ void)
+{
+ u32 i;
+
+ FUNCTION_ENTRY ();
+
+ for (i = 0; i < acpi_gbl_gpe_register_count; i++) {
+ /*
+ * We previously stored the enabled status of all GPEs.
+ * Blast them back in.
+ */
+ acpi_os_write_port(acpi_gbl_gpe_registers[i].enable_addr,
+ acpi_gbl_gpe_registers[i].enable, 8);
+ }
+}
*
* Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers.
- * $Revision: 109 $
+ * $Revision: 110 $
*
******************************************************************************/
register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, PM2_CONTROL);
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %p\n",
- register_value, ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm2_cnt_blk.address)));
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
+ register_value, HIDWORD(acpi_gbl_FADT->Xpm2_cnt_blk.address),
+ LODWORD(acpi_gbl_FADT->Xpm2_cnt_blk.address)));
if (read_write == ACPI_WRITE) {
register_value &= ~mask;
value &= mask;
register_value |= value;
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %p\n", register_value,
- acpi_gbl_FADT->Xpm2_cnt_blk.address));
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %8.8X%8.8X\n",
+ register_value,
+ HIDWORD(acpi_gbl_FADT->Xpm2_cnt_blk.address),
+ LODWORD(acpi_gbl_FADT->Xpm2_cnt_blk.address)));
acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
PM2_CONTROL, (u8) (register_value));
mask = TMR_VAL_MASK;
register_value = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
PM_TIMER);
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM_TIMER: Read %X from %p\n",
- register_value, ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm_tmr_blk.address)));
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM_TIMER: Read %X from %8.8X%8.8X\n",
+ register_value,
+ HIDWORD(acpi_gbl_FADT->Xpm_tmr_blk.address),
+ LODWORD(acpi_gbl_FADT->Xpm_tmr_blk.address)));
break;
break;
- case PM1_a_CONTROL: /* 16-bit access */
+ case PM1A_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 */
+ case PM1B_CONTROL: /* 16-bit access */
acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->Xpm1b_cnt_blk, 0);
break;
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
- * $Revision: 21 $
+ * $Revision: 22 $
*
*****************************************************************************/
acpi_object arg;
u8 type_a;
u8 type_b;
- u16 PM1_acontrol;
- u16 PM1_bcontrol;
+ u16 PM1Acontrol;
+ u16 PM1Bcontrol;
FUNCTION_TRACE ("Acpi_enter_sleep_state");
disable ();
- /* TODO: disable all non-wake GPEs here */
+ acpi_hw_disable_non_wakeup_gpes();
- PM1_acontrol = (u16) acpi_hw_register_read (ACPI_MTX_LOCK, PM1_CONTROL);
+ PM1Acontrol = (u16) acpi_hw_register_read (ACPI_MTX_LOCK, PM1_CONTROL);
ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Entering S%d\n", sleep_state));
/* mask off SLP_EN and SLP_TYP fields */
- PM1_acontrol &= ~(SLP_TYPE_X_MASK | SLP_EN_MASK);
- PM1_bcontrol = PM1_acontrol;
+ PM1Acontrol &= ~(SLP_TYPE_X_MASK | SLP_EN_MASK);
+ PM1Bcontrol = PM1Acontrol;
/* 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));
+ PM1Acontrol |= (type_a << acpi_hw_get_bit_shift (SLP_TYPE_X_MASK));
+ PM1Bcontrol |= (type_b << acpi_hw_get_bit_shift (SLP_TYPE_X_MASK));
/* write #1: fill in SLP_TYP data */
- acpi_hw_register_write (ACPI_MTX_LOCK, PM1_a_CONTROL, PM1_acontrol);
- acpi_hw_register_write (ACPI_MTX_LOCK, PM1_b_CONTROL, PM1_bcontrol);
+ acpi_hw_register_write (ACPI_MTX_LOCK, PM1A_CONTROL, PM1Acontrol);
+ acpi_hw_register_write (ACPI_MTX_LOCK, PM1B_CONTROL, PM1Bcontrol);
/* mask in SLP_EN */
- PM1_acontrol |= (1 << acpi_hw_get_bit_shift (SLP_EN_MASK));
- PM1_bcontrol |= (1 << acpi_hw_get_bit_shift (SLP_EN_MASK));
+ PM1Acontrol |= (1 << acpi_hw_get_bit_shift (SLP_EN_MASK));
+ PM1Bcontrol |= (1 << acpi_hw_get_bit_shift (SLP_EN_MASK));
/* flush caches */
/* write #2: SLP_TYP + SLP_EN */
- acpi_hw_register_write (ACPI_MTX_LOCK, PM1_a_CONTROL, PM1_acontrol);
- acpi_hw_register_write (ACPI_MTX_LOCK, PM1_b_CONTROL, PM1_bcontrol);
+ acpi_hw_register_write (ACPI_MTX_LOCK, PM1A_CONTROL, PM1Acontrol);
+ acpi_hw_register_write (ACPI_MTX_LOCK, PM1B_CONTROL, PM1Bcontrol);
/*
* Wait a second, then try again. This is to get S4/5 to work on all machines.
}
while (!acpi_hw_register_bit_access (ACPI_READ, ACPI_MTX_LOCK, WAK_STS));
+ acpi_hw_enable_non_wakeup_gpes();
+
enable ();
return_ACPI_STATUS (AE_OK);
/* _WAK returns stuff - do we want to look at it? */
- /* Re-enable GPEs */
+ acpi_hw_enable_non_wakeup_gpes();
return_ACPI_STATUS (AE_OK);
}
/******************************************************************************
*
* Name: hwtimer.c - ACPI Power Management Timer Interface
- * $Revision: 12 $
+ * $Revision: 14 $
*
*****************************************************************************/
acpi_get_timer_resolution (
u32 *resolution)
{
- acpi_status status;
-
-
FUNCTION_TRACE ("Acpi_get_timer_resolution");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
if (!resolution) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
acpi_get_timer (
u32 *ticks)
{
- acpi_status status;
-
-
FUNCTION_TRACE ("Acpi_get_timer");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
if (!ticks) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
- * $Revision: 69 $
+ * $Revision: 74 $
*
*****************************************************************************/
/* Version string */
-#define ACPI_CA_VERSION 0x20010831
+#define ACPI_CA_VERSION 0x20011018
+
+/* Version of ACPI supported */
+
+#define ACPI_CA_SUPPORT_LEVEL 2
/* Maximum objects in the various object caches */
/* Max reference count (for debug only) */
-#define MAX_REFERENCE_COUNT 0x200
+#define MAX_REFERENCE_COUNT 0x400
/* Size of cached memory mapping for system memory operation region */
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
- * $Revision: 47 $
+ * $Revision: 50 $
*
*****************************************************************************/
extern int optind;
extern NATIVE_CHAR *optarg;
-extern u8 *aml_ptr;
+extern u8 *aml_start;
extern u32 aml_length;
extern u8 acpi_gbl_db_opt_tables;
extern u8 acpi_gbl_db_output_flags;
extern u32 acpi_gbl_db_debug_level;
extern u32 acpi_gbl_db_console_debug_level;
+extern acpi_table_header *acpi_gbl_db_table_ptr;
/*
* Statistic globals
acpi_db_initialize (
void);
+void
+acpi_db_terminate (
+ void);
+
acpi_status
acpi_db_single_step (
acpi_walk_state *walk_state,
acpi_parse_object *op,
- u8 op_type);
+ u32 op_type);
/*
/******************************************************************************
*
* Name: acdispat.h - dispatcher (parser to interpreter interface)
- * $Revision: 40 $
+ * $Revision: 45 $
*
*****************************************************************************/
acpi_status
acpi_ds_get_predicate_value (
acpi_walk_state *walk_state,
- acpi_parse_object *op,
u32 has_result_obj);
acpi_status
acpi_ds_exec_begin_op (
- u16 opcode,
- acpi_parse_object *op,
acpi_walk_state *walk_state,
acpi_parse_object **out_op);
acpi_status
acpi_ds_exec_end_op (
- acpi_walk_state *state,
- acpi_parse_object *op);
+ acpi_walk_state *state);
/* dsfield - Parser/Interpreter interface for AML fields */
-
acpi_status
acpi_ds_create_field (
acpi_parse_object *op,
acpi_namespace_node *region_node,
acpi_walk_state *walk_state);
+acpi_status
+acpi_ds_create_buffer_field (
+ acpi_parse_object *op,
+ acpi_walk_state *walk_state);
+
/* dsload - Parser/Interpreter interface, namespace load callbacks */
acpi_status
acpi_ds_load1_begin_op (
- u16 opcode,
- acpi_parse_object *op,
acpi_walk_state *walk_state,
acpi_parse_object **out_op);
acpi_status
acpi_ds_load1_end_op (
- acpi_walk_state *walk_state,
- acpi_parse_object *op);
+ acpi_walk_state *walk_state);
acpi_status
acpi_ds_load2_begin_op (
- u16 opcode,
- acpi_parse_object *op,
acpi_walk_state *walk_state,
acpi_parse_object **out_op);
acpi_status
acpi_ds_load2_end_op (
- acpi_walk_state *state,
- acpi_parse_object *op);
+ acpi_walk_state *walk_state);
acpi_status
-acpi_ds_load3_begin_op (
- u16 opcode,
- acpi_parse_object *op,
+acpi_ds_init_callbacks (
acpi_walk_state *walk_state,
- acpi_parse_object **out_op);
-
-acpi_status
-acpi_ds_load3_end_op (
- acpi_walk_state *state,
- acpi_parse_object *op);
+ u32 pass_number);
/* dsmthdat - method data (locals/args) */
acpi_walk_state *walk_state);
-/* Acpi_dswstate - parser WALK_STATE management routines */
+/* dswstate - parser WALK_STATE management routines */
acpi_walk_state *
acpi_ds_create_walk_state (
acpi_operand_object *mth_desc,
acpi_walk_list *walk_list);
+acpi_status
+acpi_ds_init_aml_walk (
+ acpi_walk_state *walk_state,
+ acpi_parse_object *op,
+ acpi_namespace_node *method_node,
+ u8 *aml_start,
+ u32 aml_length,
+ acpi_operand_object **params,
+ acpi_operand_object **return_obj_desc,
+ u32 pass_number);
+
acpi_status
acpi_ds_obj_stack_delete_all (
acpi_walk_state *walk_state);
acpi_ds_pop_walk_state (
acpi_walk_list *walk_list);
+void
+acpi_ds_push_walk_state (
+ acpi_walk_state *walk_state,
+ acpi_walk_list *walk_list);
+
acpi_status
acpi_ds_result_stack_pop (
acpi_walk_state *walk_state);
/******************************************************************************
*
* Name: acevents.h - Event subcomponent prototypes and defines
- * $Revision: 65 $
+ * $Revision: 66 $
*
*****************************************************************************/
void *handler_context,
void **region_context);
+acpi_status
+acpi_ev_cmos_region_setup (
+ acpi_handle handle,
+ u32 function,
+ void *handler_context,
+ void **region_context);
+
+acpi_status
+acpi_ev_pci_bar_region_setup (
+ acpi_handle handle,
+ u32 function,
+ void *handler_context,
+ void **region_context);
+
acpi_status
acpi_ev_default_region_setup (
acpi_handle handle,
* actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
* (The table maps local handles to the real OS handles)
*/
-ACPI_EXTERN ACPI_MUTEX_INFO acpi_gbl_acpi_mutex_info [NUM_MTX];
+ACPI_EXTERN acpi_mutex_info acpi_gbl_acpi_mutex_info [NUM_MTX];
/*****************************************************************************
/* Address Space handlers */
-ACPI_EXTERN ACPI_ADR_SPACE_INFO acpi_gbl_address_spaces[ACPI_NUM_ADDRESS_SPACES];
+ACPI_EXTERN acpi_adr_space_info acpi_gbl_address_spaces[ACPI_NUM_ADDRESS_SPACES];
/* Control method single step flag */
*
****************************************************************************/
-ACPI_EXTERN ACPI_FIXED_EVENT_INFO acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
+ACPI_EXTERN acpi_fixed_event_info acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
ACPI_EXTERN acpi_handle acpi_gbl_gpe_obj_handle;
ACPI_EXTERN u32 acpi_gbl_gpe_register_count;
-ACPI_EXTERN ACPI_GPE_REGISTERS *acpi_gbl_gpe_registers;
+ACPI_EXTERN acpi_gpe_registers *acpi_gbl_gpe_registers;
ACPI_EXTERN acpi_gpe_level_info *acpi_gbl_gpe_info;
/*
/******************************************************************************
*
* Name: achware.h -- hardware specific interfaces
- * $Revision: 55 $
+ * $Revision: 56 $
*
*****************************************************************************/
void
acpi_hw_enable_gpe (
- u32 gpe_index);
+ u32 gpe_number);
+
+void
+acpi_hw_enable_gpe_for_wakeup (
+ u32 gpe_number);
void
acpi_hw_disable_gpe (
- u32 gpe_index);
+ u32 gpe_number);
+
+void
+acpi_hw_disable_gpe_for_wakeup (
+ u32 gpe_number);
void
acpi_hw_clear_gpe (
- u32 gpe_index);
+ u32 gpe_number);
void
acpi_hw_get_gpe_status (
u32 gpe_number,
acpi_event_status *event_status);
+void
+acpi_hw_disable_non_wakeup_gpes (
+ void);
+
+void
+acpi_hw_enable_non_wakeup_gpes (
+ void);
+
+
/* Sleep Prototypes */
acpi_status
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
- * $Revision: 106 $
+ * $Revision: 116 $
*
*****************************************************************************/
*/
acpi_status
-acpi_ex_triadic (
- u16 opcode,
- acpi_walk_state *walk_state,
- acpi_operand_object **return_desc);
+acpi_ex_opcode_3A_0T_0R (
+ acpi_walk_state *walk_state);
acpi_status
-acpi_ex_hexadic (
- u16 opcode,
- acpi_walk_state *walk_state,
- acpi_operand_object **return_desc);
+acpi_ex_opcode_3A_1T_1R (
+ acpi_walk_state *walk_state);
acpi_status
-acpi_ex_create_buffer_field (
- u8 *aml_ptr,
- u32 aml_length,
- acpi_namespace_node *node,
+acpi_ex_opcode_6A_0T_1R (
acpi_walk_state *walk_state);
acpi_status
-acpi_ex_reconfiguration (
- u16 opcode,
+acpi_ex_get_object_reference (
+ acpi_operand_object *obj_desc,
+ acpi_operand_object **return_desc,
acpi_walk_state *walk_state);
+acpi_status
+acpi_ex_do_concatenate (
+ acpi_operand_object *obj_desc,
+ acpi_operand_object *obj_desc2,
+ acpi_operand_object **actual_return_desc,
+ acpi_walk_state *walk_state);
+
+u8
+acpi_ex_do_logical_op (
+ u16 opcode,
+ acpi_integer operand0,
+ acpi_integer operand1);
+
+acpi_integer
+acpi_ex_do_math_op (
+ u16 opcode,
+ acpi_integer operand0,
+ acpi_integer operand1);
+
+acpi_status
+acpi_ex_load_op (
+ acpi_operand_object *rgn_desc,
+ acpi_operand_object *ddb_handle);
+
+acpi_status
+acpi_ex_unload_table (
+ acpi_operand_object *ddb_handle);
+
acpi_status
acpi_ex_create_mutex (
acpi_walk_state *walk_state);
acpi_status
acpi_ex_create_processor (
- acpi_parse_object *op,
- acpi_namespace_node *processor_node);
+ acpi_walk_state *walk_state);
acpi_status
acpi_ex_create_power_resource (
- acpi_parse_object *op,
- acpi_namespace_node *power_node);
+ acpi_walk_state *walk_state);
acpi_status
acpi_ex_create_region (
- u8 *aml_ptr,
+ u8 *aml_start,
u32 aml_length,
u8 region_space,
acpi_walk_state *walk_state);
+acpi_status
+acpi_ex_create_table_region (
+ acpi_walk_state *walk_state);
+
acpi_status
acpi_ex_create_event (
acpi_walk_state *walk_state);
acpi_status
acpi_ex_create_method (
- u8 *aml_ptr,
+ u8 *aml_start,
u32 aml_length,
- u32 method_flags,
- acpi_namespace_node *method);
+ acpi_walk_state *walk_state);
/*
u32 field_position,
u32 field_length);
+acpi_status
+acpi_ex_prep_field_value (
+ ACPI_CREATE_FIELD_INFO *info);
/*
* amsystem - Interface to OS services
*/
acpi_status
-acpi_ex_monadic1 (
- u16 opcode,
+acpi_ex_opcode_1A_0T_0R (
acpi_walk_state *walk_state);
acpi_status
-acpi_ex_monadic2 (
- u16 opcode,
- acpi_walk_state *walk_state,
- acpi_operand_object **return_desc);
+acpi_ex_opcode_1A_0T_1R (
+ acpi_walk_state *walk_state);
acpi_status
-acpi_ex_monadic2_r (
- u16 opcode,
- acpi_walk_state *walk_state,
- acpi_operand_object **return_desc);
+acpi_ex_opcode_1A_1T_1R (
+ acpi_walk_state *walk_state);
+acpi_status
+acpi_ex_opcode_1A_1T_0R (
+ acpi_walk_state *walk_state);
/*
* amdyadic - ACPI AML (p-code) execution, dyadic operators
*/
acpi_status
-acpi_ex_dyadic1 (
- u16 opcode,
+acpi_ex_opcode_2A_0T_0R (
acpi_walk_state *walk_state);
acpi_status
-acpi_ex_dyadic2 (
- u16 opcode,
- acpi_walk_state *walk_state,
- acpi_operand_object **return_desc);
+acpi_ex_opcode_2A_0T_1R (
+ acpi_walk_state *walk_state);
acpi_status
-acpi_ex_dyadic2_r (
- u16 opcode,
- acpi_walk_state *walk_state,
- acpi_operand_object **return_desc);
+acpi_ex_opcode_2A_1T_1R (
+ acpi_walk_state *walk_state);
acpi_status
-acpi_ex_dyadic2_s (
- u16 opcode,
- acpi_walk_state *walk_state,
- acpi_operand_object **return_desc);
+acpi_ex_opcode_2A_2T_1R (
+ acpi_walk_state *walk_state);
/*
void
acpi_ex_show_hex_value (
u32 byte_count,
- u8 *aml_ptr,
+ u8 *aml_start,
u32 lead_space);
void *handler_context,
void *region_context);
+acpi_status
+acpi_ex_cmos_space_handler (
+ u32 function,
+ ACPI_PHYSICAL_ADDRESS address,
+ u32 bit_width,
+ u32 *value,
+ void *handler_context,
+ void *region_context);
+
+acpi_status
+acpi_ex_pci_bar_space_handler (
+ u32 function,
+ ACPI_PHYSICAL_ADDRESS address,
+ u32 bit_width,
+ u32 *value,
+ void *handler_context,
+ void *region_context);
+
acpi_status
acpi_ex_embedded_controller_space_handler (
u32 function,
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
- * $Revision: 130 $
+ * $Revision: 138 $
*
*****************************************************************************/
#define WAIT_FOREVER ((u32) -1)
-typedef void* ACPI_MUTEX;
+typedef void* acpi_mutex;
typedef u32 ACPI_MUTEX_HANDLE;
/* Object descriptor types */
#define ACPI_CACHED_OBJECT 0x11 /* ORed in when object is cached */
-#define ACPI_DESC_TYPE_STATE 0x22
+#define ACPI_DESC_TYPE_STATE 0x20
+#define ACPI_DESC_TYPE_STATE_UPDATE 0x21
+#define ACPI_DESC_TYPE_STATE_PACKAGE 0x22
+#define ACPI_DESC_TYPE_STATE_CONTROL 0x23
+#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x24
+#define ACPI_DESC_TYPE_STATE_PSCOPE 0x25
+#define ACPI_DESC_TYPE_STATE_WSCOPE 0x26
+#define ACPI_DESC_TYPE_STATE_RESULT 0x27
+#define ACPI_DESC_TYPE_STATE_NOTIFY 0x28
#define ACPI_DESC_TYPE_WALK 0x44
#define ACPI_DESC_TYPE_PARSER 0x66
#define ACPI_DESC_TYPE_INTERNAL 0x88
typedef struct acpi_mutex_info
{
- ACPI_MUTEX mutex;
+ acpi_mutex mutex;
u32 use_count;
u32 owner_id;
-} ACPI_MUTEX_INFO;
+} acpi_mutex_info;
/* This owner ID means that the mutex is not in use (unlocked) */
u32 name; /* ACPI Name, always 4 chars per ACPI spec */
- void *object; /* Pointer to attached ACPI object (optional) */
+ union acpi_operand_obj *object; /* Pointer to attached ACPI object (optional) */
struct acpi_node *child; /* first child */
struct acpi_node *peer; /* Next peer*/
u16 reference_count; /* Current count of references and children */
struct acpi_table_desc *installed_desc;
acpi_table_header *pointer;
void *base_pointer;
- u8 *aml_pointer;
- UINT64 physical_address;
+ u8 *aml_start;
+ u64 physical_address;
u32 aml_length;
u32 length;
u32 count;
acpi_handle *list;
u32 *count;
-} FIND_CONTEXT;
+} find_context;
typedef struct
{
acpi_namespace_node *node;
-} NS_SEARCH_DATA;
+} ns_search_data;
/*
u32 num_carats;
u8 fully_qualified;
-} ACPI_NAMESTRING_INFO;
+} acpi_namestring_info;
+
+
+/* Field creation info */
+
+typedef struct
+{
+ acpi_namespace_node *region_node;
+ acpi_namespace_node *field_node;
+ acpi_namespace_node *register_node;
+ acpi_namespace_node *data_register_node;
+ u32 bank_value;
+ u32 field_bit_position;
+ u32 field_bit_length;
+ u8 field_flags;
+ u8 field_type;
+
+} ACPI_CREATE_FIELD_INFO;
+
+/*
+ * Field flags: Bits 00 - 03 : Access_type (Any_acc, Byte_acc, etc.)
+ * 04 : Lock_rule (1 == Lock)
+ * 05 - 06 : Update_rule
+ */
+
+#define FIELD_ACCESS_TYPE_MASK 0x0F
+#define FIELD_LOCK_RULE_MASK 0x10
+#define FIELD_UPDATE_RULE_MASK 0x60
/*****************************************************************************
typedef struct
{
- ACPI_ADR_SPACE_HANDLER handler;
+ acpi_adr_space_handler handler;
void *context;
-} ACPI_ADR_SPACE_INFO;
+} acpi_adr_space_info;
/* Values and addresses of the GPE registers (both banks) */
typedef struct
{
- u8 status; /* Current value of status reg */
- u8 enable; /* Current value of enable reg */
u16 status_addr; /* Address of status reg */
u16 enable_addr; /* Address of enable reg */
+ u8 status; /* Current value of status reg */
+ u8 enable; /* Current value of enable reg */
+ u8 wake_enable; /* Mask of bits to keep enabled when sleeping */
u8 gpe_base; /* Base GPE number */
-} ACPI_GPE_REGISTERS;
+} acpi_gpe_registers;
#define ACPI_GPE_LEVEL_TRIGGERED 1
u8 type; /* Level or Edge */
acpi_handle method_handle; /* Method handle for direct (fast) execution */
- ACPI_GPE_HANDLER handler; /* Address of handler, if any */
+ acpi_gpe_handler handler; /* Address of handler, if any */
void *context; /* Context to be passed to handler */
} acpi_gpe_level_info;
typedef struct
{
- ACPI_EVENT_HANDLER handler; /* Address of handler. */
+ acpi_event_handler handler; /* Address of handler. */
void *context; /* Context to be passed to handler */
-} ACPI_FIXED_EVENT_INFO;
+} acpi_fixed_event_info;
/* Information used during field processing */
u8 field_flag;
u32 pkg_length;
-} ACPI_FIELD_INFO;
+} acpi_field_info;
/*****************************************************************************
typedef struct acpi_common_state
{
ACPI_STATE_COMMON
-} ACPI_COMMON_STATE;
+} acpi_common_state;
/*
ACPI_STATE_COMMON
union acpi_operand_obj *object;
-} ACPI_UPDATE_STATE;
+} acpi_update_state;
/*
u32 num_packages;
u16 index;
-} ACPI_PKG_STATE;
+} acpi_pkg_state;
/*
struct acpi_parse_obj *predicate_op;
u8 *aml_predicate_start; /* Start of if/while predicate */
-} ACPI_CONTROL_STATE;
+} acpi_control_state;
/*
ACPI_STATE_COMMON
acpi_namespace_node *node;
-} ACPI_SCOPE_STATE;
+} acpi_scope_state;
typedef struct acpi_pscope_state
u32 arg_list; /* next argument to parse */
u32 arg_count; /* Number of fixed arguments */
-} ACPI_PSCOPE_STATE;
+} acpi_pscope_state;
/*
u8 num_results;
u8 last_insert;
-} ACPI_RESULT_VALUES;
+} acpi_result_values;
+
+
+typedef
+acpi_status (*acpi_parse_downwards) (
+ struct acpi_walk_state *walk_state,
+ struct acpi_parse_obj **out_op);
+
+typedef
+acpi_status (*acpi_parse_upwards) (
+ struct acpi_walk_state *walk_state);
/*
acpi_namespace_node *node;
union acpi_operand_obj *handler_obj;
-} ACPI_NOTIFY_INFO;
+} acpi_notify_info;
/* Generic state is union of structs above */
typedef union acpi_gen_state
{
- ACPI_COMMON_STATE common;
- ACPI_CONTROL_STATE control;
- ACPI_UPDATE_STATE update;
- ACPI_SCOPE_STATE scope;
- ACPI_PSCOPE_STATE parse_scope;
- ACPI_PKG_STATE pkg;
- ACPI_RESULT_VALUES results;
- ACPI_NOTIFY_INFO notify;
+ acpi_common_state common;
+ acpi_control_state control;
+ acpi_update_state update;
+ acpi_scope_state scope;
+ acpi_pscope_state parse_scope;
+ acpi_pkg_state pkg;
+ acpi_result_values results;
+ acpi_notify_info notify;
} acpi_generic_state;
-typedef
-acpi_status (*acpi_parse_downwards) (
- u16 opcode,
- struct acpi_parse_obj *op,
- struct acpi_walk_state *walk_state,
- struct acpi_parse_obj **out_op);
+/*****************************************************************************
+ *
+ * Interpreter typedefs and structs
+ *
+ ****************************************************************************/
typedef
-acpi_status (*acpi_parse_upwards) (
- struct acpi_walk_state *walk_state,
- struct acpi_parse_obj *op);
+acpi_status (*ACPI_EXECUTE_OP) (
+ struct acpi_walk_state *walk_state);
/*****************************************************************************
*
****************************************************************************/
-#define ACPI_OP_CLASS_MASK 0x1F
-#define ACPI_OP_ARGS_MASK 0x20
-#define ACPI_OP_TYPE_MASK 0xC0
-
-#define ACPI_OP_TYPE_OPCODE 0x00
-#define ACPI_OP_TYPE_ASCII 0x40
-#define ACPI_OP_TYPE_PREFIX 0x80
-#define ACPI_OP_TYPE_UNKNOWN 0xC0
-
-#define ACPI_GET_OP_CLASS(a) ((a)->flags & ACPI_OP_CLASS_MASK)
-#define ACPI_GET_OP_ARGS(a) ((a)->flags & ACPI_OP_ARGS_MASK)
-#define ACPI_GET_OP_TYPE(a) ((a)->flags & ACPI_OP_TYPE_MASK)
-
-/*
- * Flags byte: 0-4 (5 bits) = Opcode Class (0x001F
- * 5 (1 bit) = Has arguments flag
- * 6-7 (2 bits) = Reserved
- */
-#define AML_NO_ARGS 0
-#define AML_HAS_ARGS 0x0020
-#define AML_NSOBJECT 0x0100
-#define AML_NSOPCODE 0x0200
-#define AML_NSNODE 0x0400
-#define AML_NAMED 0x0800
-#define AML_DEFER 0x1000
-#define AML_FIELD 0x2000
-#define AML_CREATE 0x4000
-
-
/*
* AML opcode, name, and argument layout
*/
{
u32 parse_args; /* Grammar/Parse time arguments */
u32 runtime_args; /* Interpret time arguments */
- u16 flags; /* Opcode type, Has_args flag */
+ u16 flags; /* Misc flags */
+ u8 class; /* Opcode class */
+ u8 type; /* Opcode type */
#ifdef _OPCODE_NAMES
NATIVE_CHAR *name; /* op name (debug only) */
NATIVE_CHAR *name; /* NULL terminated string */
struct acpi_parse_obj *arg; /* arguments and contained ops */
-} ACPI_PARSE_VALUE;
+} acpi_parse_value;
#define ACPI_PARSE_COMMON \
NATIVE_CHAR op_name[16]) /* op name (debug only) */\
/* NON-DEBUG members below: */\
acpi_namespace_node *node; /* for use by interpreter */\
- ACPI_PARSE_VALUE value; /* Value or args associated with the opcode */\
+ acpi_parse_value value; /* Value or args associated with the opcode */\
/*
* Parse state - one state per parser invocation and each control
* method.
*/
-
typedef struct acpi_parse_state
{
+ u32 aml_size;
u8 *aml_start; /* first AML byte */
u8 *aml; /* next AML byte */
u8 *aml_end; /* (last + 1) AML byte */
u8 *pkg_start; /* current package begin */
u8 *pkg_end; /* current package end */
- acpi_parse_object *start_op; /* root of parse tree */
+
+ struct acpi_parse_obj *start_op; /* root of parse tree */
struct acpi_node *start_node;
- acpi_generic_state *scope; /* current scope */
- struct acpi_parse_state *next;
+ union acpi_gen_state *scope; /* current scope */
+
+
+ struct acpi_parse_obj *start_scope;
+
} acpi_parse_state;
#define PM1_STS 0x0100
#define PM1_EN 0x0200
#define PM1_CONTROL 0x0300
-#define PM1_a_CONTROL 0x0400
-#define PM1_b_CONTROL 0x0500
+#define PM1A_CONTROL 0x0400
+#define PM1B_CONTROL 0x0500
#define PM2_CONTROL 0x0600
#define PM_TIMER 0x0700
#define PROCESSOR_BLOCK 0x0800
{
char buffer[ACPI_DEVICE_ID_LENGTH];
-} ACPI_DEVICE_ID;
+} acpi_device_id;
/*****************************************************************************
NATIVE_CHAR *proc_name;
NATIVE_CHAR *module_name;
-} ACPI_DEBUG_PRINT_INFO;
+} acpi_debug_print_info;
/* Entry for a memory allocation (debug only) */
{
ACPI_COMMON_DEBUG_MEM_HEADER
-} ACPI_DEBUG_MEM_HEADER;
+} acpi_debug_mem_header;
typedef struct acpi_debug_mem_block
{
ACPI_COMMON_DEBUG_MEM_HEADER
- UINT64 user_space;
+ u64 user_space;
-} ACPI_DEBUG_MEM_BLOCK;
+} acpi_debug_mem_block;
#define ACPI_MEM_LIST_GLOBAL 0
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
- * $Revision: 94 $
+ * $Revision: 97 $
*
*****************************************************************************/
* Full 64-bit address/integer on both 32-bit and 64-bit platforms
*/
#ifndef LODWORD
-#define LODWORD(l) ((u32)(UINT64)(l))
+#define LODWORD(l) ((u32)(u64)(l))
#endif
#ifndef HIDWORD
#define MOVE_UNALIGNED16_TO_16(d,s) *(u16*)(d) = *(u16*)(s)
#define MOVE_UNALIGNED32_TO_32(d,s) *(u32*)(d) = *(u32*)(s)
#define MOVE_UNALIGNED16_TO_32(d,s) *(u32*)(d) = *(u16*)(s)
-#define MOVE_UNALIGNED64_TO_64(d,s) *(UINT64*)(d) = *(UINT64*)(s)
+#define MOVE_UNALIGNED64_TO_64(d,s) *(u64*)(d) = *(u64*)(s)
#else
/*
#define MUL_16(a) _MUL(a,4)
#define MOD_16(a) _MOD(a,16)
-/*
- * Divide and Modulo
- */
-#define ACPI_DIVIDE(n,d) ((n) / (d))
-#define ACPI_MODULO(n,d) ((n) % (d))
/*
* Rounding macros (Power of two boundaries only)
#define ROUND_BITS_UP_TO_BYTES(a) DIV_8((a) + 7)
#define ROUND_BITS_DOWN_TO_BYTES(a) DIV_8((a))
-#define ROUND_UP_TO_1_k(a) (((a) + 1023) >> 10)
+#define ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
/* Generic (non-power-of-two) rounding */
#ifndef _IA16
-#define ACPI_PCI_DEVICE_MASK (UINT64) 0x0000FFFF00000000
-#define ACPI_PCI_FUNCTION_MASK (UINT64) 0x00000000FFFF0000
-#define ACPI_PCI_REGISTER_MASK (UINT64) 0x000000000000FFFF
+#define ACPI_PCI_DEVICE_MASK (u64) 0x0000FFFF00000000
+#define ACPI_PCI_FUNCTION_MASK (u64) 0x00000000FFFF0000
+#define ACPI_PCI_REGISTER_MASK (u64) 0x000000000000FFFF
#define ACPI_PCI_FUNCTION(a) (u16) ((((a) & ACPI_PCI_FUNCTION_MASK) >> 16))
#define ACPI_PCI_DEVICE(a) (u16) ((((a) & ACPI_PCI_DEVICE_MASK) >> 32))
#define IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0)
-/* Check if ACPI has been initialized properly */
-
-#define ACPI_IS_INITIALIZATION_COMPLETE(s) {if (acpi_gbl_root_node) s = AE_OK; else s=AE_NO_NAMESPACE;}
-
/*
* Macro to check if a pointer is within an ACPI table.
* Parameter (a) is the pointer to check. Parameter (b) must be defined
* Macros for the master AML opcode table
*/
#ifdef ACPI_DEBUG
-#define ACPI_OP(name,Pargs,Iargs,flags) {Pargs,Iargs,flags,name}
+#define ACPI_OP(name,Pargs,Iargs,class,type,flags) {Pargs,Iargs,flags,class,type,name}
#else
-#define ACPI_OP(name,Pargs,Iargs,flags) {Pargs,Iargs,flags}
+#define ACPI_OP(name,Pargs,Iargs,class,type,flags) {Pargs,Iargs,flags,class,type}
#endif
#define ARG_TYPE_WIDTH 5
* as a local string ("_Proc_name) so that it can be also used by the function exit macros below.
*/
-#define PROC_NAME(a) ACPI_DEBUG_PRINT_INFO _dbg; \
+#define PROC_NAME(a) acpi_debug_print_info _dbg; \
_dbg.component_id = _COMPONENT; \
_dbg.proc_name = a; \
_dbg.module_name = _THIS_MODULE;
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
- * $Revision: 107 $
+ * $Revision: 110 $
*
*****************************************************************************/
acpi_handle start_object,
u32 max_depth,
u8 unlock_before_callback,
- ACPI_WALK_CALLBACK user_function,
+ acpi_walk_callback user_function,
void *context,
void **return_value);
-
acpi_namespace_node *
-acpi_ns_get_next_object (
+acpi_ns_get_next_node (
acpi_object_type8 type,
acpi_namespace_node *parent,
acpi_namespace_node *child);
-
acpi_status
acpi_ns_delete_namespace_by_owner (
u16 table_id);
void
acpi_ns_dump_objects (
acpi_object_type8 type,
+ u8 display_type,
u32 max_depth,
u32 ownder_id,
acpi_handle start_handle);
acpi_namespace_node *obj_node,
NATIVE_CHAR *search_for);
-
acpi_status
acpi_ns_get_node (
NATIVE_CHAR *pathname,
acpi_status
acpi_ns_build_internal_name (
- ACPI_NAMESTRING_INFO *info);
+ acpi_namestring_info *info);
acpi_status
acpi_ns_get_internal_name_length (
- ACPI_NAMESTRING_INFO *info);
+ acpi_namestring_info *info);
acpi_status
acpi_ns_internalize_name (
NATIVE_CHAR **converted_name);
acpi_namespace_node *
-acpi_ns_convert_handle_to_entry (
+acpi_ns_map_handle_to_node (
acpi_handle handle);
acpi_handle
acpi_namespace_node *
-acpi_ns_get_next_valid_object (
+acpi_ns_get_next_valid_node (
acpi_namespace_node *node);
/******************************************************************************
*
* Name: acobject.h - Definition of acpi_operand_object (Internal object only)
- * $Revision: 90 $
+ * $Revision: 93 $
*
*****************************************************************************/
#define AFIELD_SINGLE_DATUM 0x1
+/*
+ * Fields common to both Strings and Buffers
+ */
+#define ACPI_COMMON_BUFFER_INFO \
+ u32 length;
+
+
/******************************************************************************
*
* Individual Object Descriptors
typedef struct /* STRING - has length and pointer - Null terminated, ASCII characters only */
{
ACPI_OBJECT_COMMON_HEADER
-
- u32 length;
+ ACPI_COMMON_BUFFER_INFO
NATIVE_CHAR *pointer; /* String value in AML stream or in allocated space */
} ACPI_OBJECT_STRING;
typedef struct /* BUFFER - has length and pointer - not null terminated */
{
ACPI_OBJECT_COMMON_HEADER
-
- u32 length;
- u8 *pointer; /* points to the buffer in allocated space */
+ ACPI_COMMON_BUFFER_INFO
+ u8 *pointer; /* Buffer value in AML stream or in allocated space */
} ACPI_OBJECT_BUFFER;
ACPI_OBJECT_COMMON_HEADER
u32 count; /* # of elements in package */
-
union acpi_operand_obj **elements; /* Array of pointers to Acpi_objects */
union acpi_operand_obj **next_element; /* used only while initializing */
u8 method_flags;
u8 param_count;
- u32 pcode_length;
+ u32 aml_length;
void *semaphore;
- u8 *pcode;
+ u8 *aml_start;
u8 concurrency;
u8 thread_count;
ACPI_OBJECT_COMMON_HEADER
acpi_namespace_node *node; /* Parent device */
- ACPI_NOTIFY_HANDLER handler;
+ acpi_notify_handler handler;
void *context;
} ACPI_OBJECT_NOTIFY_HANDLER;
u8 space_id;
u16 hflags;
- ACPI_ADR_SPACE_HANDLER handler;
+ acpi_adr_space_handler handler;
acpi_namespace_node *node; /* Parent device */
void *context;
- ACPI_ADR_SPACE_SETUP setup;
+ acpi_adr_space_setup setup;
union acpi_operand_obj *region_list; /* regions using this handler */
union acpi_operand_obj *next;
ACPI_OBJECT_COMMON_HEADER
u8 byte_fill1;
u16 word_fill1;
- u32 pcode_length;
- u8 *pcode;
+ u32 aml_length;
+ u8 *aml_start;
acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
void *region_context; /* Region-specific data */
/******************************************************************************
*
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
- * $Revision: 51 $
+ * $Revision: 54 $
*
*****************************************************************************/
acpi_status
acpi_ps_find_object (
- u16 opcode,
- acpi_parse_object *op,
acpi_walk_state *walk_state,
acpi_parse_object **out_op);
acpi_status
acpi_ps_parse_aml (
- acpi_parse_object *start_scope,
- u8 *aml,
- u32 aml_size,
- u32 parse_flags,
- acpi_namespace_node *method_node,
- acpi_operand_object **params,
- acpi_operand_object **caller_return_desc,
- acpi_parse_downwards descending_callback,
- acpi_parse_upwards ascending_callback);
+ acpi_walk_state *walk_state);
acpi_status
acpi_ps_parse_table (
/* psutils - parser utilities */
-
-acpi_parse_state *
-acpi_ps_create_state (
- u8 *aml,
- u32 aml_size);
-
void
acpi_ps_init_op (
acpi_parse_object *op,
acpi_object_type type,
acpi_handle start_object,
u32 max_depth,
- ACPI_WALK_CALLBACK user_function,
+ acpi_walk_callback user_function,
void *context,
void * *return_value);
acpi_status
acpi_get_devices (
NATIVE_CHAR *HID,
- ACPI_WALK_CALLBACK user_function,
+ acpi_walk_callback user_function,
void *context,
void **return_value);
acpi_status
acpi_install_fixed_event_handler (
u32 acpi_event,
- ACPI_EVENT_HANDLER handler,
+ acpi_event_handler handler,
void *context);
acpi_status
acpi_remove_fixed_event_handler (
u32 acpi_event,
- ACPI_EVENT_HANDLER handler);
+ acpi_event_handler handler);
acpi_status
acpi_install_notify_handler (
acpi_handle device,
u32 handler_type,
- ACPI_NOTIFY_HANDLER handler,
+ acpi_notify_handler handler,
void *context);
acpi_status
acpi_remove_notify_handler (
acpi_handle device,
u32 handler_type,
- ACPI_NOTIFY_HANDLER handler);
+ acpi_notify_handler handler);
acpi_status
acpi_install_address_space_handler (
acpi_handle device,
ACPI_ADR_SPACE_TYPE space_id,
- ACPI_ADR_SPACE_HANDLER handler,
- ACPI_ADR_SPACE_SETUP setup,
+ acpi_adr_space_handler handler,
+ acpi_adr_space_setup setup,
void *context);
acpi_status
acpi_remove_address_space_handler (
acpi_handle device,
ACPI_ADR_SPACE_TYPE space_id,
- ACPI_ADR_SPACE_HANDLER handler);
+ acpi_adr_space_handler handler);
acpi_status
acpi_install_gpe_handler (
u32 gpe_number,
u32 type,
- ACPI_GPE_HANDLER handler,
+ acpi_gpe_handler handler,
void *context);
acpi_status
acpi_status
acpi_remove_gpe_handler (
u32 gpe_number,
- ACPI_GPE_HANDLER handler);
+ acpi_gpe_handler handler);
acpi_status
acpi_enable_event (
u32 acpi_event,
- u32 type);
+ u32 type,
+ u32 flags);
acpi_status
acpi_disable_event (
u32 acpi_event,
- u32 type);
+ u32 type,
+ u32 flags);
acpi_status
acpi_clear_event (
/******************************************************************************
*
* Name: acstruct.h - Internal structs
- * $Revision: 5 $
+ * $Revision: 10 $
*
*****************************************************************************/
u8 data_type; /* To differentiate various internal objs MUST BE FIRST!*/\
acpi_owner_id owner_id; /* Owner of objects created during the walk */
u8 last_predicate; /* Result of last predicate */
+ u8 current_result; /* */
u8 next_op_info; /* Info about Next_op */
u8 num_operands; /* Stack pointer for Operands[] array */
- u8 current_result; /* */
+ u8 return_used;
+ u8 walk_type;
+ u16 current_sync_level; /* Mutex Sync (nested acquire) level */
+ u16 opcode; /* Current AML opcode */
+ u32 arg_count; /* push for fixed or var args */
+ u32 aml_offset;
+ u32 arg_types;
+ u32 method_breakpoint; /* For single stepping */
+ u32 parse_flags;
+ u32 prev_arg_types;
- struct acpi_walk_state *next; /* Next Walk_state in list */
+
+ u8 *aml_last_while;
+ struct acpi_node arguments[MTH_NUM_ARGS]; /* Control method arguments */
+ union acpi_operand_obj **caller_return_desc;
+ acpi_generic_state *control_state; /* List of control states (nested IFs) */
+ struct acpi_node local_variables[MTH_NUM_LOCALS]; /* Control method locals */
+ struct acpi_node *method_call_node; /* Called method Node*/
+ acpi_parse_object *method_call_op; /* Method_call Op if running a method */
+ union acpi_operand_obj *method_desc; /* Method descriptor if running a method */
+ struct acpi_node *method_node; /* Method Node if running a method */
+ acpi_parse_object *op; /* Current parser op */
+ union acpi_operand_obj *operands[OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
+ const acpi_opcode_info *op_info; /* Info on current opcode */
acpi_parse_object *origin; /* Start of walk [Obsolete] */
+ union acpi_operand_obj **params;
+ acpi_parse_state parser_state; /* Current state of parser */
+ union acpi_operand_obj *result_obj;
+ acpi_generic_state *results; /* Stack of accumulated results */
+ union acpi_operand_obj *return_desc; /* Return object, if any */
+ acpi_generic_state *scope_info; /* Stack of nested scopes */
/* TBD: Obsolete with removal of WALK procedure ? */
acpi_parse_object *prev_op; /* Last op that was processed */
acpi_parse_object *next_op; /* next op to be processed */
- acpi_generic_state *results; /* Stack of accumulated results */
- acpi_generic_state *control_state; /* List of control states (nested IFs) */
- acpi_generic_state *scope_info; /* Stack of nested scopes */
- acpi_parse_state *parser_state; /* Current state of parser */
- u8 *aml_last_while;
- const acpi_opcode_info *op_info; /* Info on current opcode */
acpi_parse_downwards descending_callback;
acpi_parse_upwards ascending_callback;
-
- union acpi_operand_obj *return_desc; /* Return object, if any */
- union acpi_operand_obj *method_desc; /* Method descriptor if running a method */
- struct acpi_node *method_node; /* Method Node if running a method */
- acpi_parse_object *method_call_op; /* Method_call Op if running a method */
- struct acpi_node *method_call_node; /* Called method Node*/
- union acpi_operand_obj *operands[OBJ_NUM_OPERANDS]; /* Operands passed to the interpreter */
- struct acpi_node arguments[MTH_NUM_ARGS]; /* Control method arguments */
- struct acpi_node local_variables[MTH_NUM_LOCALS]; /* Control method locals */
struct acpi_walk_list *walk_list;
- u32 parse_flags;
- u8 walk_type;
- u8 return_used;
- u16 opcode; /* Current AML opcode */
- u32 prev_arg_types;
- u16 current_sync_level; /* Mutex Sync (nested acquire) level */
-
- /* Debug support */
-
- u32 method_breakpoint;
+ struct acpi_walk_state *next; /* Next Walk_state in list */
} acpi_walk_state;
u16 object_count;
acpi_table_desc *table_desc;
-} ACPI_INIT_WALK_INFO;
+} acpi_init_walk_info;
/* Info used by TBD */
u16 num_INI;
acpi_table_desc *table_desc;
-} ACPI_DEVICE_WALK_INFO;
+} acpi_device_walk_info;
/* TBD: [Restructure] Merge with struct above */
{
u32 debug_level;
u32 owner_id;
+ u8 display_type;
+
+} acpi_walk_info;
+
+/* Display Types */
-} ACPI_WALK_INFO;
+#define ACPI_DISPLAY_SUMMARY 0
+#define ACPI_DISPLAY_OBJECTS 1
typedef struct acpi_get_devices_info
{
- ACPI_WALK_CALLBACK user_function;
+ acpi_walk_callback user_function;
void *context;
NATIVE_CHAR *hid;
-} ACPI_GET_DEVICES_INFO;
+} acpi_get_devices_info;
+
+
+typedef union acpi_aml_operands
+{
+ acpi_operand_object *operands[7];
+
+ struct
+ {
+ ACPI_OBJECT_INTEGER *type;
+ ACPI_OBJECT_INTEGER *code;
+ ACPI_OBJECT_INTEGER *argument;
+
+ } fatal;
+
+ struct
+ {
+ acpi_operand_object *source;
+ ACPI_OBJECT_INTEGER *index;
+ acpi_operand_object *target;
+
+ } index;
+
+ struct
+ {
+ acpi_operand_object *source;
+ ACPI_OBJECT_INTEGER *index;
+ ACPI_OBJECT_INTEGER *length;
+ acpi_operand_object *target;
+
+ } mid;
+
+} ACPI_AML_OPERANDS;
#endif
/******************************************************************************
*
* Name: actables.h - ACPI table management
- * $Revision: 31 $
+ * $Revision: 32 $
*
*****************************************************************************/
* tbutils - common table utilities
*/
-u8
-acpi_tb_system_table_pointer (
- void *where);
-
acpi_status
acpi_tb_map_acpi_table (
ACPI_PHYSICAL_ADDRESS physical_address,
u8 revision; /* Must be 0 for 1.0, 2 for 2.0 */
u32 rsdt_physical_address; /* 32-bit physical address of RSDT */
u32 length; /* XSDT Length in bytes including hdr */
- UINT64 xsdt_physical_address; /* 64-bit physical address of XSDT */
+ u64 xsdt_physical_address; /* 64-bit physical address of XSDT */
u8 extended_checksum; /* Checksum of entire table */
NATIVE_CHAR reserved [3]; /* reserved field must be 0 */
typedef struct /* Common FACS for internal use */
{
u32 *global_lock;
- UINT64 *firmware_waking_vector;
+ u64 *firmware_waking_vector;
u8 vector_width;
} acpi_common_facs;
u32 hardware_signature; /* hardware configuration signature */
u32 firmware_waking_vector; /* ACPI OS waking vector */
u32 global_lock; /* Global Lock */
- u32 S4_bios_f : 1; /* Indicates if S4_bIOS support is present */
+ u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */
u32 reserved1 : 31; /* must be 0 */
u8 resverved3 [40]; /* reserved - must be zero */
u32 smi_cmd; /* Port address of SMI command port */
u8 acpi_enable; /* value to write to smi_cmd to enable ACPI */
u8 acpi_disable; /* value to write to smi_cmd to disable ACPI */
- u8 S4_bios_req; /* Value to write to SMI CMD to enter S4_bIOS state */
+ u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */
u8 reserved2; /* reserved - must be zero */
u32 pm1a_evt_blk; /* Port address of Power Mgt 1a Acpi_event Reg Blk */
u32 pm1b_evt_blk; /* Port address of Power Mgt 1b Acpi_event Reg Blk */
typedef struct
{
acpi_table_header header; /* Table header */
- UINT64 table_offset_entry [1]; /* Array of pointers to */
+ u64 table_offset_entry [1]; /* Array of pointers to */
/* other tables' headers */
} XSDT_DESCRIPTOR_REV2;
u32 hardware_signature; /* hardware configuration signature */
u32 firmware_waking_vector; /* 32bit physical address of the Firmware Waking Vector. */
u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */
- u32 S4_bios_f : 1; /* Indicates if S4_bIOS support is present */
+ u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */
u32 reserved1 : 31; /* must be 0 */
- UINT64 Xfirmware_waking_vector; /* 64bit physical address of the Firmware Waking Vector. */
+ u64 Xfirmware_waking_vector; /* 64bit physical address of the Firmware Waking Vector. */
u8 version; /* Version of this table */
u8 reserved3 [31]; /* reserved - must be zero */
u8 register_bit_width; /* Size in bits of given register */
u8 register_bit_offset; /* Bit offset within the register */
u8 reserved; /* Must be 0 */
- UINT64 address; /* 64-bit address of struct or register */
+ u64 address; /* 64-bit address of struct or register */
} acpi_generic_address;
u32 smi_cmd; /* Port address of SMI command port */
u8 acpi_enable; /* value to write to smi_cmd to enable ACPI */
u8 acpi_disable; /* value to write to smi_cmd to disable ACPI */
- u8 S4_bios_req; /* Value to write to SMI CMD to enter S4_bIOS state */
+ u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */
u8 pstate_cnt; /* processor performance state control*/
u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a Acpi_event Reg Blk */
u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b Acpi_event Reg Blk */
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\92s duty cycle index in processor's P_CNT reg*/
- u8 duty_width; /* Processor\92s duty cycle value bit width in P_CNT register.*/
+ u8 duty_offset; /* Processor_\92s duty cycle index in processor's P_CNT reg*/
+ u8 duty_width; /* Processor_\92s 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 */
acpi_generic_address reset_register; /* Reset register address in GAS format */
u8 reset_value; /* Value to write to the Reset_register port to reset the system. */
u8 reserved7[3]; /* These three bytes must be zero */
- UINT64 Xfirmware_ctrl; /* 64-bit physical address of FACS */
- UINT64 Xdsdt; /* 64-bit physical address of DSDT */
+ u64 Xfirmware_ctrl; /* 64-bit physical address of FACS */
+ u64 Xdsdt; /* 64-bit physical address of DSDT */
acpi_generic_address Xpm1a_evt_blk; /* Extended Power Mgt 1a Acpi_event Reg Blk address */
acpi_generic_address Xpm1b_evt_blk; /* Extended Power Mgt 1b Acpi_event Reg Blk address */
acpi_generic_address Xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */
/* Only for clarity in declarations */
-typedef UINT64 IO_ADDRESS;
+typedef u64 IO_ADDRESS;
#pragma pack(1)
u8 checksum; /* to make sum of struct == 0 */
NATIVE_CHAR oem_id [6]; /* OEM identification */
u8 reserved; /* Must be 0 for 1.0, 2 for 2.0 */
- UINT64 rsdt_physical_address; /* 64-bit physical address of RSDT */
+ u64 rsdt_physical_address; /* 64-bit physical address of RSDT */
} RSDP_DESCRIPTOR_REV071;
{
acpi_table_header header; /* Table header */
u32 reserved_pad; /* IA64 alignment, must be 0 */
- UINT64 table_offset_entry [1]; /* Array of pointers to other */
+ u64 table_offset_entry [1]; /* Array of pointers to other */
/* tables' headers */
} RSDT_DESCRIPTOR_REV071;
u32 length; /* length of structure, in bytes */
u32 hardware_signature; /* hardware configuration signature */
u32 reserved4; /* must be 0 */
- UINT64 firmware_waking_vector; /* ACPI OS waking vector */
- UINT64 global_lock; /* Global Lock */
- u32 S4_bios_f : 1; /* Indicates if S4_bIOS support is present */
+ u64 firmware_waking_vector; /* ACPI OS waking vector */
+ u64 global_lock; /* Global Lock */
+ u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */
u32 reserved1 : 31; /* must be 0 */
u8 reserved3 [28]; /* reserved - must be zero */
{
acpi_table_header header; /* table header */
u32 reserved_pad; /* IA64 alignment, must be 0 */
- UINT64 firmware_ctrl; /* 64-bit Physical address of FACS */
- UINT64 dsdt; /* 64-bit Physical address of DSDT */
+ u64 firmware_ctrl; /* 64-bit Physical address of FACS */
+ u64 dsdt; /* 64-bit Physical address of DSDT */
u8 model; /* System Interrupt Model */
u8 address_space; /* Address Space Bitmask */
u16 sci_int; /* System vector of SCI interrupt */
u8 acpi_enable; /* value to write to smi_cmd to enable ACPI */
u8 acpi_disable; /* value to write to smi_cmd to disable ACPI */
- u8 S4_bios_req; /* Value to write to SMI CMD to enter S4_bIOS state */
+ u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */
u8 reserved2; /* reserved - must be zero */
- UINT64 smi_cmd; /* Port address of SMI command port */
- UINT64 pm1a_evt_blk; /* Port address of Power Mgt 1a Acpi_event Reg Blk */
- UINT64 pm1b_evt_blk; /* Port address of Power Mgt 1b Acpi_event Reg Blk */
- UINT64 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */
- UINT64 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */
- UINT64 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */
- UINT64 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */
- UINT64 gpe0blk; /* Port addr of General Purpose Acpi_event 0 Reg Blk */
- UINT64 gpe1_blk; /* Port addr of General Purpose Acpi_event 1 Reg Blk */
+ u64 smi_cmd; /* Port address of SMI command port */
+ u64 pm1a_evt_blk; /* Port address of Power Mgt 1a Acpi_event Reg Blk */
+ u64 pm1b_evt_blk; /* Port address of Power Mgt 1b Acpi_event Reg Blk */
+ u64 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */
+ u64 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */
+ u64 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */
+ u64 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */
+ u64 gpe0blk; /* Port addr of General Purpose Acpi_event 0 Reg Blk */
+ u64 gpe1_blk; /* Port addr of General Purpose Acpi_event 1 Reg Blk */
u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */
u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */
u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
- * $Revision: 188 $
+ * $Revision: 193 $
*
*****************************************************************************/
typedef UINT64 ACPI_IO_ADDRESS;
typedef UINT64 ACPI_PHYSICAL_ADDRESS;
-#define ALIGNED_ADDRESS_BOUNDARY 0x00000008
-
-/* (No hardware alignment support in IA64) */
+#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */
+#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */
#elif _IA16
#define ALIGNED_ADDRESS_BOUNDARY 0x00000002
#define _HW_ALIGNMENT_SUPPORT
+#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
/*
* (16-bit only) internal integers must be 32-bits, so
typedef struct
{
- u32 lo;
- u32 hi;
+ u32 lo;
+ u32 hi;
} uint64_struct;
+typedef union
+{
+ u64 full;
+ uint64_struct part;
+
+} uint64_overlay;
+
/*
* Acpi integer width. In ACPI version 1, integers are
#define ACPI_MAX_BCD_DIGITS 8
#define ACPI_MAX_DECIMAL_DIGITS 10
+#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */
+
+
#else
/* 64-bit integers */
-typedef UINT64 acpi_integer;
+typedef u64 acpi_integer;
#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
#define ACPI_INTEGER_BIT_SIZE 64
#define ACPI_MAX_BCD_VALUE 9999999999999999
#define ACPI_MAX_BCD_DIGITS 16
#define ACPI_MAX_DECIMAL_DIGITS 19
+#ifdef _IA64
+#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */
+#endif
#endif
#define ACPI_EVENT_LEVEL_TRIGGERED (acpi_event_type) 1
#define ACPI_EVENT_EDGE_TRIGGERED (acpi_event_type) 2
+/*
+ * GPEs
+ */
+#define ACPI_EVENT_ENABLE 0x1
+#define ACPI_EVENT_WAKE_ENABLE 0x2
+
+#define ACPI_EVENT_DISABLE 0x1
+#define ACPI_EVENT_WAKE_DISABLE 0x2
+
+
/*
* Acpi_event Status:
* -------------
* The encoding of acpi_event_status is illustrated below.
* Note that a set bit (1) indicates the property is TRUE
* (e.g. if bit 0 is set then the event is enabled).
- * +---------------+-+-+
- * | Bits 31:2 |1|0|
- * +---------------+-+-+
- * | | |
- * | | +- Enabled?
- * | +--- Set?
+ * +-------------+-+-+-+
+ * | Bits 31:3 |2|1|0|
+ * +-------------+-+-+-+
+ * | | | |
+ * | | | +- Enabled?
+ * | | +--- Enabled for wake?
+ * | +----- Set?
* +----------- <Reserved>
*/
typedef u32 acpi_event_status;
#define ACPI_EVENT_FLAG_DISABLED (acpi_event_status) 0x00
#define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01
-#define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x02
+#define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02
+#define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04
/* Notify types */
{
u32 count;
-} ACPI_TABLE_INFO;
+} acpi_table_info;
/*
u32 debug_level;
u32 debug_layer;
u32 num_table_types;
- ACPI_TABLE_INFO table_info [NUM_ACPI_TABLES];
+ acpi_table_info table_info [NUM_ACPI_TABLES];
} acpi_system_info;
*/
typedef
-u32 (*ACPI_EVENT_HANDLER) (
+u32 (*acpi_event_handler) (
void *context);
typedef
-void (*ACPI_GPE_HANDLER) (
+void (*acpi_gpe_handler) (
void *context);
typedef
-void (*ACPI_NOTIFY_HANDLER) (
+void (*acpi_notify_handler) (
acpi_handle device,
u32 value,
void *context);
#define ACPI_WRITE_ADR_SPACE 2
typedef
-acpi_status (*ACPI_ADR_SPACE_HANDLER) (
+acpi_status (*acpi_adr_space_handler) (
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
void *handler_context,
void *region_context);
-#define ACPI_DEFAULT_HANDLER ((ACPI_ADR_SPACE_HANDLER) NULL)
+#define ACPI_DEFAULT_HANDLER ((acpi_adr_space_handler) NULL)
typedef
-acpi_status (*ACPI_ADR_SPACE_SETUP) (
+acpi_status (*acpi_adr_space_setup) (
acpi_handle region_handle,
u32 function,
void *handler_context,
#define ACPI_REGION_DEACTIVATE 1
typedef
-acpi_status (*ACPI_WALK_CALLBACK) (
+acpi_status (*acpi_walk_callback) (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
/*
* IO Attributes
- * The ISA IO ranges are: n000-n0FFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
+ * The ISA IO ranges are: n000-n0FFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
* The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cD0-n_fFFh.
*/
#define NON_ISA_ONLY_RANGES (u8) 0x01
u32 min_address_fixed;
u32 max_address_fixed;
acpi_resource_attribute attribute;
- UINT64 granularity;
- UINT64 min_address_range;
- UINT64 max_address_range;
- UINT64 address_translation_offset;
- UINT64 address_length;
+ u64 granularity;
+ u64 min_address_range;
+ u64 max_address_range;
+ u64 address_translation_offset;
+ u64 address_length;
acpi_resource_source resource_source;
} acpi_resource_address64;
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
- * $Revision: 113 $
+ * $Revision: 117 $
*
*****************************************************************************/
void
acpi_ut_trace (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info);
+ acpi_debug_print_info *dbg_info);
void
acpi_ut_trace_ptr (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
void *pointer);
void
acpi_ut_trace_u32 (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
u32 integer);
void
acpi_ut_trace_str (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
NATIVE_CHAR *string);
void
acpi_ut_exit (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info);
+ acpi_debug_print_info *dbg_info);
void
acpi_ut_status_exit (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
acpi_status status);
void
acpi_ut_value_exit (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
acpi_integer value);
void
acpi_ut_ptr_exit (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
u8 *ptr);
void
acpi_ut_debug_print (
u32 requested_debug_level,
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
char *format,
- ...);
+ ...) ACPI_PRINTF_LIKE_FUNC;
void
acpi_ut_debug_print_raw (
u32 requested_debug_level,
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
char *format,
- ...);
+ ...) ACPI_PRINTF_LIKE_FUNC;
/*
#define METHOD_NAME__REG "_REG"
#define METHOD_NAME__SEG "_SEG"
#define METHOD_NAME__BBN "_BBN"
+#define METHOD_NAME__PRT "_PRT"
acpi_status
acpi_status
acpi_ut_execute_HID (
acpi_namespace_node *device_node,
- ACPI_DEVICE_ID *hid);
+ acpi_device_id *hid);
acpi_status
acpi_ut_execute_STA (
acpi_status
acpi_ut_execute_UID (
acpi_namespace_node *device_node,
- ACPI_DEVICE_ID *uid);
+ acpi_device_id *uid);
/*
void);
/*
- * Ututils
+ * utmisc
*/
+acpi_status
+acpi_ut_divide (
+ acpi_integer *in_dividend,
+ acpi_integer *in_divisor,
+ acpi_integer *out_quotient,
+ acpi_integer *out_remainder);
+
+acpi_status
+acpi_ut_short_divide (
+ acpi_integer *in_dividend,
+ u32 divisor,
+ acpi_integer *out_quotient,
+ u32 *out_remainder);
+
u8
acpi_ut_valid_acpi_name (
u32 name);
void);
void
-acpi_ut_dump_current_allocations (
+acpi_ut_dump_allocations (
u32 component,
NATIVE_CHAR *module);
#endif
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
* Declarations and definitions contained herein are derived
* directly from the ACPI specification.
- * $Revision: 53 $
+ * $Revision: 58 $
*
*****************************************************************************/
#define OPGRP_FIELD 0x02
#define OPGRP_BYTELIST 0x04
-#define OPTYPE_UNDEFINED 0
+/*
+ * Opcode information
+ */
-#define OPTYPE_LITERAL 1
-#define OPTYPE_CONSTANT 2
-#define OPTYPE_METHOD_ARGUMENT 3
-#define OPTYPE_LOCAL_VARIABLE 4
-#define OPTYPE_DATA_TERM 5
-
-/* Type 1 opcodes */
-
-#define OPTYPE_MONADIC1 6
-#define OPTYPE_DYADIC1 7
-
-/* Type 2 opcodes */
-
-#define OPTYPE_MONADIC2 8
-#define OPTYPE_MONADIC2_r 9
-#define OPTYPE_DYADIC2 10
-#define OPTYPE_DYADIC2_r 11
-#define OPTYPE_DYADIC2_s 12
+/* Opcode flags */
+
+#define AML_HAS_ARGS 0x0800
+#define AML_HAS_TARGET 0x0400
+#define AML_HAS_RETVAL 0x0200
+#define AML_NSOBJECT 0x0100
+#define AML_NSOPCODE 0x0080
+#define AML_NSNODE 0x0040
+#define AML_NAMED 0x0020
+#define AML_DEFER 0x0010
+#define AML_FIELD 0x0008
+#define AML_CREATE 0x0004
+#define AML_MATH 0x0002
+#define AML_LOGICAL 0x0001
+
+/* Convenient flag groupings */
+
+#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */
+#define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */
+#define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET
+#define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Monadic2_r */
+#define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */
+#define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */
+#define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Dyadic2_r */
+#define AML_FLAGS_EXEC_2A_2T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
+#define AML_FLAGS_EXEC_3A_0T_0R AML_HAS_ARGS
+#define AML_FLAGS_EXEC_3A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
+#define AML_FLAGS_EXEC_6A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL
-/* Multi-operand (>=3) opcodes */
-#define OPTYPE_TRIADIC 13
-#define OPTYPE_QUADRADIC 14
-#define OPTYPE_HEXADIC 15
+/*
+ * The opcode Type is used in a dispatch table, do not change
+ * without updating the table.
+ */
+#define AML_TYPE_EXEC_1A_0T_0R 0x00 /* Monadic1 */
+#define AML_TYPE_EXEC_1A_0T_1R 0x01 /* Monadic2 */
+#define AML_TYPE_EXEC_1A_1T_0R 0x02
+#define AML_TYPE_EXEC_1A_1T_1R 0x03 /* Monadic2_r */
+#define AML_TYPE_EXEC_2A_0T_0R 0x04 /* Dyadic1 */
+#define AML_TYPE_EXEC_2A_0T_1R 0x05 /* Dyadic2 */
+#define AML_TYPE_EXEC_2A_1T_1R 0x06 /* Dyadic2_r */
+#define AML_TYPE_EXEC_2A_2T_1R 0x07
+#define AML_TYPE_EXEC_3A_0T_0R 0x08
+#define AML_TYPE_EXEC_3A_1T_1R 0x09
+#define AML_TYPE_EXEC_6A_0T_1R 0x0A
+/* End of types used in dispatch table */
+
+#define AML_TYPE_LITERAL 0x0B
+#define AML_TYPE_CONSTANT 0x0C
+#define AML_TYPE_METHOD_ARGUMENT 0x0D
+#define AML_TYPE_LOCAL_VARIABLE 0x0E
+#define AML_TYPE_DATA_TERM 0x0F
/* Generic for an op that returns a value */
-#define OPTYPE_METHOD_CALL 16
+#define AML_TYPE_METHOD_CALL 0x10
/* Misc */
-#define OPTYPE_CREATE_FIELD 17
-#define OPTYPE_CONTROL 18
-#define OPTYPE_RECONFIGURATION 19
-#define OPTYPE_NAMED_OBJECT 20
-#define OPTYPE_RETURN 21
+#define AML_TYPE_CREATE_FIELD 0x11
+#define AML_TYPE_CONTROL 0x12
+#define AML_TYPE_NAMED_NO_OBJ 0x13
+#define AML_TYPE_NAMED_FIELD 0x14
+#define AML_TYPE_NAMED_SIMPLE 0x15
+#define AML_TYPE_NAMED_COMPLEX 0x16
+#define AML_TYPE_RETURN 0x17
-#define OPTYPE_BOGUS 22
+#define AML_TYPE_UNDEFINED 0x18
+#define AML_TYPE_BOGUS 0x19
+
+
+/*
+ * Opcode classes
+ */
+#define AML_CLASS_EXECUTE 0x00
+#define AML_CLASS_CREATE 0x01
+#define AML_CLASS_ARGUMENT 0x02
+#define AML_CLASS_NAMED_OBJECT 0x03
+#define AML_CLASS_CONTROL 0x04
+#define AML_CLASS_ASCII 0x05
+#define AML_CLASS_PREFIX 0x06
+#define AML_CLASS_INTERNAL 0x07
+#define AML_CLASS_RETURN_VALUE 0x08
+#define AML_CLASS_METHOD_CALL 0x09
+#define AML_CLASS_UNKNOWN 0x0A
/* Predefined Operation Region Space_iDs */
#define USER_REGION_BEGIN 0x80
-/*
- * AML tables
- */
-
-#ifdef DEFINE_AML_GLOBALS
-
-/* External declarations for the AML tables */
-
-extern u8 acpi_gbl_aml [NUM_OPCODES];
-extern u16 acpi_gbl_pfx [NUM_OPCODES];
-
-
-#endif /* DEFINE_AML_GLOBALS */
#endif /* __AMLCODE_H__ */
/******************************************************************************
*
* Name: acenv.h - Generation environment specific items
- * $Revision: 76 $
+ * $Revision: 77 $
*
*****************************************************************************/
#define ACPI_OS_NAME "Intel ACPI/CA Core Subsystem"
+/* This macro is used to tag functions as "printf-like" because
+ * some compilers can catch printf format string problems. MSVC
+ * doesn't, so this is proprocessed away.
+ */
+#define ACPI_PRINTF_LIKE_FUNC
+
#endif
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
- * $Revision: 9 $
+ * $Revision: 14 $
*
*****************************************************************************/
#else /* DO IA32 */
+
#define COMPILER_DEPENDENT_UINT64 unsigned long long
#define ACPI_ASM_MACROS
#define causeinterrupt(level)
#define disable() __cli()
#define enable() __sti()
#define halt() __asm__ __volatile__ ("sti; hlt":::"memory")
-#define wbinvd() __asm__ __volatile__ ("wbinvd":::"memory")
/*! [Begin] no source code translation
*
:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \
} while(0)
+
+/*
+ * Math helper asm macros
+ */
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+ asm("divl %2;" \
+ :"=a"(q32), "=d"(r32) \
+ :"r"(d32), \
+ "0"(n_lo), "1"(n_hi))
+
+
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+ asm("shrl $1,%2;" \
+ "rcrl $1,%3;" \
+ :"=r"(n_hi), "=r"(n_lo) \
+ :"0"(n_hi), "1"(n_lo))
+
/*! [End] no source code translation !*/
#endif /* IA 32 */
+/* This macro is used to tag functions as "printf-like" because
+ * some compilers (like GCC) can catch printf format string problems.
+ */
+#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5)))
+
#endif /* __ACGCC_H__ */
/******************************************************************************
*
* Name: aclinux.h - OS specific defines, etc.
- * $Revision: 13 $
+ * $Revision: 14 $
*
*****************************************************************************/
#undef DEBUGGER_THREADING
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
-#ifndef _IA64
-/* Linux ia32 can't do int64 well */
-#define ACPI_NO_INTEGER64_SUPPORT
-/* And the ia32 kernel doesn't include 64-bit divide support */
-#define ACPI_DIV64(dividend, divisor) do_div(dividend, divisor)
-#else
-#define ACPI_DIV64(dividend, divisor) ACPI_DIVIDE(dividend, divisor)
-#endif
-
#endif /* __ACLINUX_H__ */
/*******************************************************************************
*
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
- * $Revision: 133 $
+ * $Revision: 135 $
*
******************************************************************************/
/* Store pointer to value descriptor in the Node */
acpi_ns_attach_object (new_node, obj_desc, obj_desc->common.type);
+
+ /* Remove local reference to the object */
+
+ acpi_ut_remove_reference (obj_desc);
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
for (i = 0; i < num_segments; i++) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "%4.4s/", &pathname[i * 4]));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "%4.4s/", (char*)&pathname[i * 4]));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "]\n"));
#endif
/* Name not found in ACPI namespace */
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Name [%4.4s] not found in scope %X\n",
- &simple_name, current_node));
+ "Name [%4.4s] not found in scope %p\n",
+ (char*)&simple_name, current_node));
}
return_ACPI_STATUS (status);
REPORT_WARNING (
("Ns_lookup: %4.4s, type %X, checking for type %X\n",
- &simple_name, this_node->type, type_to_check_for));
+ (char*)&simple_name, this_node->type, type_to_check_for));
}
/*
* More segments or the type implies enclosed scope,
* and the next scope has not been allocated.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Load mode=%X This_node=%X\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Load mode=%X This_node=%p\n",
interpreter_mode, this_node));
}
/*******************************************************************************
*
* Module Name: nsalloc - Namespace allocation and deletion utilities
- * $Revision: 56 $
+ * $Revision: 60 $
*
******************************************************************************/
* real definition is found later.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "[%4.4s] is a forward reference\n",
- &node->name));
+ (char*)&node->name));
}
/*
}
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s added to %p at %p\n",
- &node->name, parent_node, node));
+ (char*)&node->name, parent_node, node));
/*
* Increment the reference count(s) of all parents up to
/* Grandchildren should have all been deleted already */
if (child_node->child) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found a grandchild! P=%X C=%X\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found a grandchild! P=%p C=%p\n",
parent_node, child_node));
}
child_node, acpi_gbl_current_node_count));
/*
- * Detach an object if there is one
+ * Detach an object if there is one, then free the child node
*/
- if (child_node->object) {
- acpi_ns_detach_object (child_node);
- }
-
+ acpi_ns_detach_object (child_node);
ACPI_MEM_FREE (child_node);
/* And move on to the next child in the list */
acpi_ns_delete_namespace_subtree (
acpi_namespace_node *parent_node)
{
- acpi_namespace_node *child_node;
- acpi_operand_object *obj_desc;
- u32 level;
+ acpi_namespace_node *child_node = NULL;
+ u32 level = 1;
FUNCTION_TRACE ("Ns_delete_namespace_subtree");
return_ACPI_STATUS (AE_OK);
}
-
- child_node = 0;
- level = 1;
-
/*
* Traverse the tree of objects until we bubble back up
* to where we started.
*/
while (level > 0) {
- /*
- * Get the next typed object in this scope.
- * Null returned if not found
- */
- child_node = acpi_ns_get_next_object (ACPI_TYPE_ANY, parent_node,
+ /* Get the next node in this scope (NULL if none) */
+
+ child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node,
child_node);
if (child_node) {
- /*
- * Found an object - delete the object within
- * the Value field
- */
- obj_desc = acpi_ns_get_attached_object (child_node);
- if (obj_desc) {
- acpi_ns_detach_object (child_node);
- acpi_ut_remove_reference (obj_desc);
- }
+ /* Found a child node - detach any attached object */
+ acpi_ns_detach_object (child_node);
- /* Check if this object has any children */
+ /* Check if this node has any children */
- if (acpi_ns_get_next_object (ACPI_TYPE_ANY, child_node, 0)) {
+ if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, 0)) {
/*
- * There is at least one child of this object,
- * visit the object
+ * There is at least one child of this node,
+ * visit the node
*/
level++;
parent_node = child_node;
else {
/*
- * No more children in this object.
- * We will move up to the grandparent.
+ * No more children of this parent node.
+ * Move up to the grandparent.
*/
level--;
*/
acpi_ns_delete_children (parent_node);
- /* New "last child" is this parent object */
+ /* New "last child" is this parent node */
child_node = parent_node;
- /* Now we can move up the tree to the grandparent */
+ /* Move up the tree to the grandparent */
parent_node = acpi_ns_get_parent_object (parent_node);
}
}
-
return_ACPI_STATUS (AE_OK);
}
*
* FUNCTION: Acpi_ns_remove_reference
*
- * PARAMETERS: Node - Named object whose reference count is to be
+ * PARAMETERS: Node - Named node whose reference count is to be
* decremented
*
* RETURN: None.
*
* DESCRIPTION: Remove a Node reference. Decrements the reference count
- * of all parent Nodes up to the root. Any object along
+ * of all parent Nodes up to the root. Any node along
* the way that reaches zero references is freed.
*
******************************************************************************/
/*
- * Decrement the reference count(s) of this object and all
- * objects up to the root, Delete anything with zero remaining references.
+ * Decrement the reference count(s) of this node and all
+ * nodes up to the root, Delete anything with zero remaining references.
*/
next_node = node;
while (next_node) {
- /* Decrement the reference count on this object*/
+ /* Decrement the reference count on this node*/
next_node->reference_count--;
- /* Delete the object if no more references */
+ /* Delete the node if no more references */
if (!next_node->reference_count) {
- /* Delete all children and delete the object */
+ /* Delete all children and delete the node */
acpi_ns_delete_children (next_node);
acpi_ns_delete_node (next_node);
{
acpi_namespace_node *child_node;
u32 level;
- acpi_operand_object *obj_desc;
acpi_namespace_node *parent_node;
level = 1;
/*
- * Traverse the tree of objects until we bubble back up
+ * Traverse the tree of nodes until we bubble back up
* to where we started.
*/
while (level > 0) {
- /*
- * Get the next typed object in this scope.
- * Null returned if not found
- */
- child_node = acpi_ns_get_next_object (ACPI_TYPE_ANY, parent_node,
- child_node);
+ /* Get the next node in this scope (NULL if none) */
+ child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node,
+ child_node);
if (child_node) {
if (child_node->owner_id == owner_id) {
- /*
- * Found an object - delete the object within
- * the Value field
- */
- obj_desc = acpi_ns_get_attached_object (child_node);
- if (obj_desc) {
- acpi_ns_detach_object (child_node);
- acpi_ut_remove_reference (obj_desc);
- }
+ /* Found a child node - detach any attached object */
+
+ acpi_ns_detach_object (child_node);
}
- /* Check if this object has any children */
+ /* Check if this node has any children */
- if (acpi_ns_get_next_object (ACPI_TYPE_ANY, child_node, 0)) {
+ if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, 0)) {
/*
- * There is at least one child of this object,
- * visit the object
+ * There is at least one child of this node,
+ * visit the node
*/
-
level++;
parent_node = child_node;
child_node = 0;
else {
/*
- * No more children in this object. Move up to grandparent.
+ * No more children of this parent node.
+ * Move up to the grandparent.
*/
level--;
}
}
- /* New "last child" is this parent object */
+ /* New "last child" is this parent node */
child_node = parent_node;
- /* Now we can move up the tree to the grandparent */
+ /* Move up the tree to the grandparent */
parent_node = acpi_ns_get_parent_object (parent_node);
}
}
-
return_ACPI_STATUS (AE_OK);
}
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
- * $Revision: 99 $
+ * $Revision: 105 $
*
*****************************************************************************/
#include "acinterp.h"
#include "acnamesp.h"
#include "actables.h"
+#include "acparser.h"
#define _COMPONENT ACPI_NAMESPACE
void *context,
void **return_value)
{
- ACPI_WALK_INFO *info = (ACPI_WALK_INFO *) context;
+ acpi_walk_info *info = (acpi_walk_info *) context;
acpi_namespace_node *this_node;
- u8 *value;
acpi_operand_object *obj_desc = NULL;
acpi_object_type8 obj_type;
acpi_object_type8 type;
u32 downstream_sibling_mask = 0;
u32 level_tmp;
u32 which_bit;
+ u32 i;
PROC_NAME ("Ns_dump_one_object");
- this_node = acpi_ns_convert_handle_to_entry (obj_handle);
+ this_node = acpi_ns_map_handle_to_node (obj_handle);
level_tmp = level;
type = this_node->type;
/*
* Now we can print out the pertinent information
*/
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " %4.4s %-9s ", &this_node->name, acpi_ut_get_type_name (type)));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "%p S:%p O:%p", this_node, this_node->child, this_node->object));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " %4.4s %-12s %p",
+ (char*)&this_node->name, acpi_ut_get_type_name (type), this_node));
+ obj_desc = this_node->object;
- if (!this_node->object) {
- /* No attached object, we are done */
+ switch (info->display_type) {
+ case ACPI_DISPLAY_SUMMARY:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
- return (AE_OK);
- }
+ if (!obj_desc) {
+ /* No attached object, we are done */
- switch (type) {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
+ return (AE_OK);
+ }
- case ACPI_TYPE_METHOD:
- /* Name is a Method and its AML offset/length are set */
+ switch (type) {
+ case ACPI_TYPE_PROCESSOR:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ID %d Addr %.4X Len %.4X\n",
+ obj_desc->processor.proc_id,
+ obj_desc->processor.address,
+ obj_desc->processor.length));
+ break;
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " M:%p-%X\n",
- ((acpi_operand_object *) this_node->object)->method.pcode,
- ((acpi_operand_object *) this_node->object)->method.pcode_length));
+ case ACPI_TYPE_DEVICE:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Notification object: %p", obj_desc));
+ break;
- break;
+ case ACPI_TYPE_METHOD:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Args %d Len %.4X Aml %p \n",
+ obj_desc->method.param_count,
+ obj_desc->method.aml_length,
+ obj_desc->method.aml_start));
+ break;
+ case ACPI_TYPE_INTEGER:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " = %8.8X%8.8X\n",
+ HIDWORD (obj_desc->integer.value),
+ LODWORD (obj_desc->integer.value)));
+ break;
- case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_PACKAGE:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Elements %.2X\n",
+ obj_desc->package.count));
+ break;
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " N:%X\n",
- ((acpi_operand_object *) this_node->object)->integer.value));
- break;
+ case ACPI_TYPE_BUFFER:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Len %.2X",
+ obj_desc->buffer.length));
+ /* Dump some of the buffer */
- case ACPI_TYPE_STRING:
+ if (obj_desc->buffer.length > 0) {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ="));
+ for (i = 0; (i < obj_desc->buffer.length && i < 12); i++) {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " %.2X",
+ obj_desc->buffer.pointer[i]));
+ }
+ }
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
+ break;
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " S:%p-%X\n",
- ((acpi_operand_object *) this_node->object)->string.pointer,
- ((acpi_operand_object *) this_node->object)->string.length));
- break;
+ case ACPI_TYPE_STRING:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Len %.2X",
+ obj_desc->string.length));
+ if (obj_desc->string.length > 0) {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " = \"%.32s\"...",
+ obj_desc->string.pointer));
+ }
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
+ break;
- case ACPI_TYPE_BUFFER:
+ case ACPI_TYPE_REGION:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " [%s]",
+ acpi_ut_get_region_name (obj_desc->region.space_id)));
+ if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Addr %8.8X%8.8X Len %.4X\n",
+ HIDWORD(obj_desc->region.address),
+ LODWORD(obj_desc->region.address),
+ obj_desc->region.length));
+ }
+ else {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " [Address/Length not evaluated]\n"));
+ }
+ break;
+
+ case INTERNAL_TYPE_REFERENCE:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " [%s]\n",
+ acpi_ps_get_opcode_name (obj_desc->reference.opcode)));
+ break;
+
+ case ACPI_TYPE_BUFFER_FIELD:
+
+ /* TBD: print Buffer name when we can easily get it */
+ break;
+
+ case INTERNAL_TYPE_REGION_FIELD:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Rgn [%4.4s]",
+ (char *) &obj_desc->common_field.region_obj->region.node->name));
+ break;
+
+ case INTERNAL_TYPE_BANK_FIELD:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Rgn [%4.4s]",
+ (char *) &obj_desc->common_field.region_obj->region.node->name));
+ break;
+
+ case INTERNAL_TYPE_INDEX_FIELD:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Rgn [%4.4s]",
+ (char *) &obj_desc->index_field.index_obj->common_field.region_obj->region.node->name));
+ break;
+
+ default:
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Object %p\n", obj_desc));
+ break;
+ }
+
+ /* Common field handling */
+
+ switch (type) {
+ case ACPI_TYPE_BUFFER_FIELD:
+ case INTERNAL_TYPE_REGION_FIELD:
+ case INTERNAL_TYPE_BANK_FIELD:
+ case INTERNAL_TYPE_INDEX_FIELD:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Off %.2X Len %.2X Acc %.2d\n",
+ (obj_desc->common_field.base_byte_offset * 8) + obj_desc->common_field.start_field_bit_offset,
+ obj_desc->common_field.bit_length,
+ obj_desc->common_field.access_bit_width));
+ break;
+ }
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " B:%p-%X\n",
- ((acpi_operand_object *) this_node->object)->buffer.pointer,
- ((acpi_operand_object *) this_node->object)->buffer.length));
break;
- default:
+ case ACPI_DISPLAY_OBJECTS:
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "%p O:%p",
+ this_node, obj_desc));
+
+ if (!obj_desc) {
+ /* No attached object, we are done */
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
+ return (AE_OK);
+ }
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(R%d)",
+ obj_desc->common.reference_count));
+
+ switch (type) {
+
+ case ACPI_TYPE_METHOD:
+
+ /* Name is a Method and its AML offset/length are set */
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " M:%p-%X\n",
+ obj_desc->method.aml_start,
+ obj_desc->method.aml_length));
+
+ break;
+
+
+ case ACPI_TYPE_INTEGER:
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " N:%X%X\n",
+ HIDWORD(obj_desc->integer.value),
+ LODWORD(obj_desc->integer.value)));
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " S:%p-%X\n",
+ obj_desc->string.pointer,
+ obj_desc->string.length));
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " B:%p-%X\n",
+ obj_desc->buffer.pointer,
+ obj_desc->buffer.length));
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
+ break;
+ }
break;
}
/* If there is an attached object, display it */
- value = this_node->object;
+ obj_desc = this_node->object;
/* Dump attached objects */
- while (value) {
+ while (obj_desc) {
obj_type = INTERNAL_TYPE_INVALID;
/* Decode the type of attached object and dump the contents */
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Attached Object %p: ", value));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Attached Object %p: ", obj_desc));
- if (acpi_tb_system_table_pointer (value)) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to AML Code)\n"));
- bytes_to_dump = 16;
- }
-
- else if (VALID_DESCRIPTOR_TYPE (value, ACPI_DESC_TYPE_NAMED)) {
+ if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to Node)\n"));
bytes_to_dump = sizeof (acpi_namespace_node);
}
- else if (VALID_DESCRIPTOR_TYPE (value, ACPI_DESC_TYPE_INTERNAL)) {
- obj_desc = (acpi_operand_object *) value;
+ else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
obj_type = obj_desc->common.type;
if (obj_type > INTERNAL_TYPE_MAX) {
}
else {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to ACPI Object type %X [%s])\n",
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to ACPI Object type %2.2X [%s])\n",
obj_type, acpi_ut_get_type_name (obj_type)));
bytes_to_dump = sizeof (acpi_operand_object);
}
}
else {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(String or Buffer - not descriptor)\n", value));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(String or Buffer - not descriptor)\n"));
bytes_to_dump = 16;
}
- DUMP_BUFFER (value, bytes_to_dump);
+ DUMP_BUFFER (obj_desc, bytes_to_dump);
/* If value is NOT an internal object, we are done */
- if ((acpi_tb_system_table_pointer (value)) ||
- (VALID_DESCRIPTOR_TYPE (value, ACPI_DESC_TYPE_NAMED))) {
+ if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) {
goto cleanup;
}
*/
switch (obj_type) {
case ACPI_TYPE_STRING:
- value = (u8 *) obj_desc->string.pointer;
+ obj_desc = (acpi_operand_object *) obj_desc->string.pointer;
break;
case ACPI_TYPE_BUFFER:
- value = (u8 *) obj_desc->buffer.pointer;
+ obj_desc = (acpi_operand_object *) obj_desc->buffer.pointer;
break;
case ACPI_TYPE_BUFFER_FIELD:
- value = (u8 *) obj_desc->buffer_field.buffer_obj;
+ obj_desc = (acpi_operand_object *) obj_desc->buffer_field.buffer_obj;
break;
case ACPI_TYPE_PACKAGE:
- value = (u8 *) obj_desc->package.elements;
+ obj_desc = (acpi_operand_object *) obj_desc->package.elements;
break;
case ACPI_TYPE_METHOD:
- value = (u8 *) obj_desc->method.pcode;
+ obj_desc = (acpi_operand_object *) obj_desc->method.aml_start;
break;
case INTERNAL_TYPE_REGION_FIELD:
- value = (u8 *) obj_desc->field.region_obj;
+ obj_desc = (acpi_operand_object *) obj_desc->field.region_obj;
break;
case INTERNAL_TYPE_BANK_FIELD:
- value = (u8 *) obj_desc->bank_field.region_obj;
+ obj_desc = (acpi_operand_object *) obj_desc->bank_field.region_obj;
break;
case INTERNAL_TYPE_INDEX_FIELD:
- value = (u8 *) obj_desc->index_field.index_obj;
+ obj_desc = (acpi_operand_object *) obj_desc->index_field.index_obj;
break;
default:
void
acpi_ns_dump_objects (
acpi_object_type8 type,
+ u8 display_type,
u32 max_depth,
u32 owner_id,
acpi_handle start_handle)
{
- ACPI_WALK_INFO info;
+ acpi_walk_info info;
FUNCTION_ENTRY ();
info.debug_level = ACPI_LV_TABLES;
info.owner_id = owner_id;
+ info.display_type = display_type;
+
acpi_ns_walk_namespace (type, start_handle, max_depth, NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object,
(void *) &info, NULL);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %.8X, ADR: %.8X, Status: %x\n",
- info.hardware_id, info.address, info.current_status));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %x\n",
+ info.hardware_id, HIDWORD(info.address), LODWORD(info.address), info.current_status));
}
return (status);
}
- acpi_ns_dump_objects (ACPI_TYPE_ANY, max_depth, ACPI_UINT32_MAX, search_handle);
+ acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth,
+ ACPI_UINT32_MAX, search_handle);
return_VOID;
}
acpi_handle handle,
u32 debug_level)
{
- ACPI_WALK_INFO info;
+ acpi_walk_info info;
FUNCTION_ENTRY ();
*
* Module Name: nseval - Object evaluation interfaces -- includes control
* method lookup and execution.
- * $Revision: 97 $
+ * $Revision: 102 $
*
******************************************************************************/
acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- prefix_node = acpi_ns_convert_handle_to_entry (handle);
+ prefix_node = acpi_ns_map_handle_to_node (handle);
if (!prefix_node) {
acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
status = AE_BAD_PARAMETER;
acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- node = acpi_ns_convert_handle_to_entry (handle);
+ node = acpi_ns_map_handle_to_node (handle);
if (!node) {
acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (AE_BAD_PARAMETER);
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- return_ACPI_STATUS (AE_ERROR);
+ return_ACPI_STATUS (AE_NULL_OBJECT);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Control method at Offset %x Length %lx]\n",
- obj_desc->method.pcode + 1, obj_desc->method.pcode_length - 1));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Control method at Offset %p Length %x]\n",
+ obj_desc->method.aml_start + 1, obj_desc->method.aml_length - 1));
DUMP_PATHNAME (method_node, "Ns_execute_control_method: Executing",
ACPI_LV_NAMES, _COMPONENT);
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "At offset %8XH\n", obj_desc->method.pcode + 1));
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "At offset %p\n",
+ obj_desc->method.aml_start + 1));
/*
{
acpi_status status = AE_OK;
acpi_operand_object *obj_desc;
- acpi_operand_object *val_desc;
+ acpi_operand_object *source_desc;
FUNCTION_TRACE ("Ns_get_object_value");
/*
* Get the attached object
*/
- val_desc = acpi_ns_get_attached_object (node);
- if (!val_desc) {
+ source_desc = acpi_ns_get_attached_object (node);
+ if (!source_desc) {
status = AE_NULL_OBJECT;
goto unlock_and_exit;
}
* TBD: [Future] - need a low-level object copy that handles
* the reference count automatically. (Don't want to copy it)
*/
- MEMCPY (obj_desc, val_desc, sizeof (acpi_operand_object));
+ MEMCPY (obj_desc, source_desc, sizeof (acpi_operand_object));
obj_desc->common.reference_count = 1;
acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
}
/******************************************************************************
*
* Module Name: nsinit - namespace initialization
- * $Revision: 31 $
+ * $Revision: 33 $
*
*****************************************************************************/
void)
{
acpi_status status;
- ACPI_INIT_WALK_INFO info;
+ acpi_init_walk_info info;
FUNCTION_TRACE ("Ns_initialize_objects");
void)
{
acpi_status status;
- ACPI_DEVICE_WALK_INFO info;
+ acpi_device_walk_info info;
FUNCTION_TRACE ("Ns_initialize_devices");
{
acpi_object_type8 type;
acpi_status status;
- ACPI_INIT_WALK_INFO *info = (ACPI_INIT_WALK_INFO *) context;
+ acpi_init_walk_info *info = (acpi_init_walk_info *) context;
acpi_namespace_node *node = (acpi_namespace_node *) obj_handle;
acpi_operand_object *obj_desc;
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"%s while getting region arguments [%4.4s]\n",
- acpi_format_exception (status), &node->name));
+ acpi_format_exception (status), (char*)&node->name));
}
if (!(acpi_dbg_level & ACPI_LV_INIT)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"%s while getting buffer field arguments [%4.4s]\n",
- acpi_format_exception (status), &node->name));
+ acpi_format_exception (status), (char*)&node->name));
}
if (!(acpi_dbg_level & ACPI_LV_INIT)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
*
* FUNCTION: Acpi_ns_init_one_device
*
- * PARAMETERS: ACPI_WALK_CALLBACK
+ * PARAMETERS: acpi_walk_callback
*
* RETURN: acpi_status
*
acpi_status status;
acpi_namespace_node *node;
u32 flags;
- ACPI_DEVICE_WALK_INFO *info = (ACPI_DEVICE_WALK_INFO *) context;
+ acpi_device_walk_info *info = (acpi_device_walk_info *) context;
FUNCTION_TRACE ("Ns_init_one_device");
acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- node = acpi_ns_convert_handle_to_entry (obj_handle);
+ node = acpi_ns_map_handle_to_node (obj_handle);
if (!node) {
acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
/******************************************************************************
*
* Module Name: nsload - namespace loading/expanding/contracting procedures
- * $Revision: 43 $
+ * $Revision: 47 $
*
*****************************************************************************/
u32 pass_number,
acpi_table_desc *table_desc)
{
- acpi_parse_downwards descending_callback;
- acpi_parse_upwards ascending_callback;
acpi_parse_object *parse_root;
acpi_status status;
+ acpi_walk_state *walk_state;
FUNCTION_TRACE ("Ns_one_complete_parse");
- switch (pass_number) {
- case 1:
- descending_callback = acpi_ds_load1_begin_op;
- ascending_callback = acpi_ds_load1_end_op;
- break;
-
- case 2:
- descending_callback = acpi_ds_load2_begin_op;
- ascending_callback = acpi_ds_load2_end_op;
- break;
-
- case 3:
- descending_callback = acpi_ds_exec_begin_op;
- ascending_callback = acpi_ds_exec_end_op;
- break;
-
- default:
- return (AE_BAD_PARAMETER);
- }
-
/* Create and init a Root Node */
parse_root = acpi_ps_alloc_op (AML_SCOPE_OP);
((acpi_parse2_object *) parse_root)->name = ACPI_ROOT_NAME;
- /* Pass 1: Parse everything except control method bodies */
+ /* Create and initialize a new walk state */
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", pass_number));
+ walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
+ NULL, NULL, NULL);
+ if (!walk_state) {
+ acpi_ps_free_op (parse_root);
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
- status = acpi_ps_parse_aml (parse_root, table_desc->aml_pointer,
- table_desc->aml_length,
- ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
- NULL, NULL, NULL, descending_callback,
- ascending_callback);
+ status = acpi_ds_init_aml_walk (walk_state, parse_root, NULL, table_desc->aml_start,
+ table_desc->aml_length, NULL, NULL, pass_number);
+ if (ACPI_FAILURE (status)) {
+ acpi_ds_delete_walk_state (walk_state);
+ return_ACPI_STATUS (status);
+ }
+
+ /* Parse the AML */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", pass_number));
+ status = acpi_ps_parse_aml (walk_state);
acpi_ps_delete_parse_tree (parse_root);
return_ACPI_STATUS (status);
*
* FUNCTION: Acpi_ns_load_table
*
- * PARAMETERS: *Pcode_addr - Address of pcode block
- * Pcode_length - Length of pcode block
+ * PARAMETERS: Table_desc - Descriptor for table to be loaded
+ * Node - Owning NS node
*
* RETURN: Status
*
FUNCTION_TRACE ("Ns_load_table");
- if (!table_desc->aml_pointer) {
+ if (!table_desc->aml_start) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", table_desc->aml_pointer));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", table_desc->aml_start));
if (!table_desc->aml_length) {
/*******************************************************************************
*
* Module Name: nsnames - Name manipulation and search
- * $Revision: 63 $
+ * $Revision: 64 $
*
******************************************************************************/
return_ACPI_STATUS (AE_NO_NAMESPACE);
}
- node = acpi_ns_convert_handle_to_entry (target_handle);
+ node = acpi_ns_map_handle_to_node (target_handle);
if (!node) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
*
* Module Name: nsobject - Utilities for objects attached to namespace
* table entries
- * $Revision: 65 $
+ * $Revision: 67 $
*
******************************************************************************/
acpi_operand_object *previous_obj_desc;
acpi_object_type8 obj_type = ACPI_TYPE_ANY;
u8 flags;
- u16 opcode;
FUNCTION_TRACE ("Ns_attach_object");
obj_type = type;
}
- /*
- * Type is TYPE_Any, we must try to determinte the
- * actual type of the object.
- * Check if value points into the AML code
- */
- else if (acpi_tb_system_table_pointer (object)) {
- /*
- * Object points into the AML stream.
- * Set a flag bit in the Node to indicate this
- */
- flags |= ANOBJ_AML_ATTACHMENT;
-
- /*
- * The next byte (perhaps the next two bytes)
- * will be the AML opcode
- */
- MOVE_UNALIGNED16_TO_16 (&opcode, object);
-
- /* Check for a recognized Opcode */
-
- switch ((u8) opcode) {
-
- case AML_OP_PREFIX:
-
- if (opcode != AML_REVISION_OP) {
- /*
- * Op_prefix is unrecognized unless part
- * of Revision_op
- */
- break;
- }
-
- /* case AML_REVISION_OP: fall through and set the type to Integer */
-
- case AML_ZERO_OP:
- case AML_ONES_OP:
- case AML_ONE_OP:
- case AML_BYTE_OP:
- case AML_WORD_OP:
- case AML_DWORD_OP:
- case AML_QWORD_OP:
-
- obj_type = ACPI_TYPE_INTEGER;
- break;
-
-
- case AML_STRING_OP:
-
- obj_type = ACPI_TYPE_STRING;
- break;
-
-
- case AML_BUFFER_OP:
-
- obj_type = ACPI_TYPE_BUFFER;
- break;
-
-
- case AML_MUTEX_OP:
-
- obj_type = ACPI_TYPE_MUTEX;
- break;
-
-
- case AML_PACKAGE_OP:
-
- obj_type = ACPI_TYPE_PACKAGE;
- break;
-
-
- default:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "AML Opcode/Type [%x] not supported in attach\n",
- (u8) opcode));
-
- return_ACPI_STATUS (AE_TYPE);
- break;
- }
- }
-
else {
/*
* Cannot figure out the type -- set to Def_any which
"Ns_attach_object confused: setting bogus type for ",
ACPI_LV_INFO, _COMPONENT);
- if (acpi_tb_system_table_pointer (object)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "AML-stream code %02x\n", *(u8 *) object));
- }
-
- else if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED)) {
+ if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED)) {
DUMP_PATHNAME (object, "name ", ACPI_LV_INFO, _COMPONENT);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
- obj_desc, node, &node->name));
+ obj_desc, node, (char*)&node->name));
/*
node->object = NULL;
- /* Found a valid value */
-
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object=%p Value=%p Name %4.4s\n",
- node, obj_desc, &node->name));
+ node, obj_desc, (char*)&node->name));
- /*
- * Not every value is an object allocated via ACPI_MEM_CALLOCATE,
- * - must check
- */
- if (!acpi_tb_system_table_pointer (obj_desc)) {
- /* Attempt to delete the object (and all subobjects) */
-
- acpi_ut_remove_reference (obj_desc);
- }
+ /* Remove one reference on the object (and all subobjects) */
+ acpi_ut_remove_reference (obj_desc);
return_VOID;
}
/*******************************************************************************
*
* Module Name: nssearch - Namespace search
- * $Revision: 74 $
+ * $Revision: 75 $
*
******************************************************************************/
scope_name = acpi_ns_get_table_pathname (node);
if (scope_name) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (type %X)\n",
- scope_name, node, &target_name, type));
+ scope_name, node, (char*)&target_name, type));
ACPI_MEM_FREE (scope_name);
}
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Name %4.4s (actual type %X) found at %p\n",
- &target_name, next_node->type, next_node));
+ (char*)&target_name, next_node->type, next_node));
*return_node = next_node;
return_ACPI_STATUS (AE_OK);
/* Searched entire table, not found */
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Name %4.4s (type %X) not found at %p\n",
- &target_name, type, next_node));
+ (char*)&target_name, type, next_node));
return_ACPI_STATUS (AE_NOT_FOUND);
}
(!parent_node)) {
if (!parent_node) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
- &target_name));
+ (char*)&target_name));
}
if (acpi_ns_local (type)) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] type %X is local(no search)\n",
- &target_name, type));
+ (char*)&target_name, type));
}
return_ACPI_STATUS (AE_NOT_FOUND);
/* Search the parent tree */
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching parent for %4.4s\n", &target_name));
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching parent for %4.4s\n", (char*)&target_name));
/*
* Search parents until found the target or we have backed up to
/* Parameter validation */
if (!node || !target_name || !return_node) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null param- Table %p Name %p Return %p\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null param- Table %p Name %X Return %p\n",
node, target_name, return_node));
REPORT_ERROR (("Ns_search_and_enter: bad (null) parameter\n"));
/* Name must consist of printable characters */
if (!acpi_ut_valid_acpi_name (target_name)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "*** Bad character in name: %08lx *** \n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "*** Bad character in name: %08x *** \n",
target_name));
REPORT_ERROR (("Ns_search_and_enter: Bad character in ACPI Name\n"));
*/
if (interpreter_mode == IMODE_EXECUTE) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s Not found in %p [Not adding]\n",
- &target_name, node));
+ (char*)&target_name, node));
return_ACPI_STATUS (AE_NOT_FOUND);
}
*
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation
- * $Revision: 89 $
+ * $Revision: 92 $
*
*****************************************************************************/
acpi_status
acpi_ns_get_internal_name_length (
- ACPI_NAMESTRING_INFO *info)
+ acpi_namestring_info *info)
{
NATIVE_CHAR *next_external_char;
u32 i;
acpi_status
acpi_ns_build_internal_name (
- ACPI_NAMESTRING_INFO *info)
+ acpi_namestring_info *info)
{
u32 num_segments = info->num_segments;
NATIVE_CHAR *internal_name = info->internal_name;
NATIVE_CHAR **converted_name)
{
NATIVE_CHAR *internal_name;
- ACPI_NAMESTRING_INFO info;
+ acpi_namestring_info info;
acpi_status status;
/*******************************************************************************
*
- * FUNCTION: Acpi_ns_convert_handle_to_entry
+ * FUNCTION: Acpi_ns_map_handle_to_node
*
* PARAMETERS: Handle - Handle to be converted to an Node
*
******************************************************************************/
acpi_namespace_node *
-acpi_ns_convert_handle_to_entry (
+acpi_ns_map_handle_to_node (
acpi_handle handle)
{
parent_node = acpi_ns_get_parent_object (child_node);
if (parent_node) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Parent of %p [%4.4s] is %p [%4.4s]\n",
- child_node, &child_node->name, parent_node, &parent_node->name));
+ child_node, (char*)&child_node->name, parent_node, (char*)&parent_node->name));
if (parent_node->name) {
return_VALUE (parent_node->name);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "unable to find parent of %p (%4.4s)\n",
- child_node, &child_node->name));
+ child_node, (char*)&child_node->name));
}
return_VALUE (ACPI_UNKNOWN_NAME);
/*******************************************************************************
*
- * FUNCTION: Acpi_ns_get_next_valid_object
+ * FUNCTION: Acpi_ns_get_next_valid_node
*
* PARAMETERS: Node - Current table entry
*
- * RETURN: Next valid object in the table. NULL if no more valid
- * objects
+ * RETURN: Next valid Node in the linked node list. NULL if no more valid
+ * nodess
*
- * DESCRIPTION: Find the next valid object within a name table.
+ * DESCRIPTION: Find the next valid node within a name table.
* Useful for implementing NULL-end-of-list loops.
*
******************************************************************************/
acpi_namespace_node *
-acpi_ns_get_next_valid_object (
+acpi_ns_get_next_valid_node (
acpi_namespace_node *node)
{
/******************************************************************************
*
* Module Name: nswalk - Functions for walking the ACPI namespace
- * $Revision: 24 $
+ * $Revision: 26 $
*
*****************************************************************************/
MODULE_NAME ("nswalk")
-/****************************************************************************
+/*******************************************************************************
*
- * FUNCTION: Acpi_get_next_object
+ * FUNCTION: Acpi_ns_get_next_node
*
- * PARAMETERS: Type - Type of object to be searched for
- * Parent - Parent object whose children we are
- * getting
- * Last_child - Previous child that was found.
+ * PARAMETERS: Type - Type of node to be searched for
+ * Parent_node - Parent node whose children we are
+ * getting
+ * Child_node - Previous child that was found.
* The NEXT child will be returned
*
* RETURN: acpi_namespace_node - Pointer to the NEXT child or NULL if
- * none is found.
+ * none is found.
*
- * DESCRIPTION: Return the next peer object within the namespace. If Handle
- * is valid, Scope is ignored. Otherwise, the first object
+ * DESCRIPTION: Return the next peer node within the namespace. If Handle
+ * is valid, Scope is ignored. Otherwise, the first node
* within Scope is returned.
*
- ****************************************************************************/
+ ******************************************************************************/
acpi_namespace_node *
-acpi_ns_get_next_object (
+acpi_ns_get_next_node (
acpi_object_type8 type,
acpi_namespace_node *parent_node,
acpi_namespace_node *child_node)
}
else {
- /* Start search at the NEXT object */
+ /* Start search at the NEXT node */
- next_node = acpi_ns_get_next_valid_object (child_node);
+ next_node = acpi_ns_get_next_valid_node (child_node);
}
-
/* If any type is OK, we are done */
if (type == ACPI_TYPE_ANY) {
return (next_node);
}
-
- /* Must search for the object -- but within this scope only */
+ /* Must search for the node -- but within this scope only */
while (next_node) {
/* If type matches, we are done */
return (next_node);
}
- /* Otherwise, move on to the next object */
+ /* Otherwise, move on to the next node */
- next_node = acpi_ns_get_next_valid_object (next_node);
+ next_node = acpi_ns_get_next_valid_node (next_node);
}
-
/* Not found */
return (NULL);
}
-/******************************************************************************
+/*******************************************************************************
*
* FUNCTION: Acpi_ns_walk_namespace
*
* the callback routine
* User_function - Called when an object of "Type" is found
* Context - Passed to user function
- *
- * RETURNS Return value from the User_function if terminated early.
- * Otherwise, returns NULL.
+ * Return_value - from the User_function if terminated early.
+ * Otherwise, returns NULL.
+ * RETURNS: Status
*
* DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
- * starting (and ending) at the object specified by Start_handle.
- * The User_function is called whenever an object that matches
+ * starting (and ending) at the node specified by Start_handle.
+ * The User_function is called whenever a node that matches
* the type parameter is found. If the user function returns
* a non-zero value, the search is terminated immediately and this
* value is returned to the caller.
acpi_handle start_node,
u32 max_depth,
u8 unlock_before_callback,
- ACPI_WALK_CALLBACK user_function,
+ acpi_walk_callback user_function,
void *context,
void **return_value)
{
start_node = acpi_gbl_root_node;
}
-
- /* Null child means "get first object" */
+ /* Null child means "get first node" */
parent_node = start_node;
- child_node = 0;
+ child_node = 0;
child_type = ACPI_TYPE_ANY;
level = 1;
/*
- * Traverse the tree of objects until we bubble back up to where we
+ * Traverse the tree of nodes until we bubble back up to where we
* started. When Level is zero, the loop is done because we have
* bubbled up to (and passed) the original parent handle (Start_entry)
*/
while (level > 0) {
- /*
- * Get the next typed object in this scope. Null returned
- * if not found
- */
- status = AE_OK;
- child_node = acpi_ns_get_next_object (ACPI_TYPE_ANY,
- parent_node,
- child_node);
+ /* Get the next node in this scope. Null if not found */
+ status = AE_OK;
+ child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, child_node);
if (child_node) {
/*
- * Found an object, Get the type if we are not
+ * Found node, Get the type if we are not
* searching for ANY
*/
if (type != ACPI_TYPE_ANY) {
if (child_type == type) {
/*
- * Found a matching object, invoke the user
+ * Found a matching node, invoke the user
* callback function
*/
if (unlock_before_callback) {
* maximum depth has been reached.
*/
if ((level < max_depth) && (status != AE_CTRL_DEPTH)) {
- if (acpi_ns_get_next_object (ACPI_TYPE_ANY,
- child_node, 0)) {
+ if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, 0)) {
/*
* There is at least one child of this
- * object, visit the object
+ * node, visit the onde
*/
level++;
parent_node = child_node;
else {
/*
- * No more children in this object (Acpi_ns_get_next_object
+ * No more children of this node (Acpi_ns_get_next_node
* failed), go back upwards in the namespace tree to
- * the object's parent.
+ * the node's parent.
*/
level--;
child_node = parent_node;
*
* Module Name: nsxfname - Public interfaces to the ACPI subsystem
* ACPI Namespace oriented interfaces
- * $Revision: 80 $
+ * $Revision: 82 $
*
*****************************************************************************/
FUNCTION_ENTRY ();
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
/* Parameter Validation */
if (!ret_handle || !pathname) {
if (parent) {
acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- prefix_node = acpi_ns_convert_handle_to_entry (parent);
+ prefix_node = acpi_ns_map_handle_to_node (parent);
if (!prefix_node) {
acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
acpi_namespace_node *node;
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
/* Buffer pointer must be valid always */
if (!ret_path_ptr || (name_type > ACPI_NAME_TYPE_MAX)) {
* Validate handle and convert to an Node
*/
acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- node = acpi_ns_convert_handle_to_entry (handle);
+ node = acpi_ns_map_handle_to_node (handle);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
acpi_handle handle,
acpi_device_info *info)
{
- ACPI_DEVICE_ID hid;
- ACPI_DEVICE_ID uid;
+ acpi_device_id hid;
+ acpi_device_id uid;
acpi_status status;
u32 device_status = 0;
acpi_integer address = 0;
acpi_namespace_node *node;
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
/* Parameter validation */
if (!handle || !info) {
acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- node = acpi_ns_convert_handle_to_entry (handle);
+ node = acpi_ns_map_handle_to_node (handle);
if (!node) {
acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
*
* Module Name: nsxfobj - Public interfaces to the ACPI subsystem
* ACPI Object oriented interfaces
- * $Revision: 90 $
+ * $Revision: 95 $
*
******************************************************************************/
*
* PARAMETERS: Handle - Object handle (optional)
* *Pathname - Object pathname (optional)
- * **Params - List of parameters to pass to
- * method, terminated by NULL.
- * Params itself may be NULL
- * if no parameters are being
- * passed.
- * *Return_object - Where to put method's return value (if
+ * **External_params - List of parameters to pass to method,
+ * terminated by NULL. May be NULL
+ * if no parameters are being passed.
+ * *Return_buffer - Where to put method's return value (if
* any). If NULL, no value is returned.
*
* RETURN: Status
acpi_evaluate_object (
acpi_handle handle,
acpi_string pathname,
- acpi_object_list *param_objects,
+ acpi_object_list *external_params,
acpi_buffer *return_buffer)
{
acpi_status status;
- acpi_operand_object **param_ptr = NULL;
- acpi_operand_object *return_obj = NULL;
+ acpi_operand_object **internal_params = NULL;
+ acpi_operand_object *internal_return_obj = NULL;
u32 buffer_space_needed;
u32 user_buffer_length;
u32 i;
FUNCTION_TRACE ("Acpi_evaluate_object");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/*
* If there are parameters to be passed to the object
* (which must be a control method), the external objects
* must be converted to internal objects
*/
- if (param_objects && param_objects->count) {
+ if (external_params && external_params->count) {
/*
* Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list
*/
- param_ptr = ACPI_MEM_CALLOCATE ((param_objects->count + 1) * sizeof (void *));
- if (!param_ptr) {
+ internal_params = ACPI_MEM_CALLOCATE ((external_params->count + 1) * sizeof (void *));
+ if (!internal_params) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
* Convert each external object in the list to an
* internal object
*/
- for (i = 0; i < param_objects->count; i++) {
- status = acpi_ut_copy_eobject_to_iobject (¶m_objects->pointer[i],
- ¶m_ptr[i]);
+ for (i = 0; i < external_params->count; i++) {
+ status = acpi_ut_copy_eobject_to_iobject (&external_params->pointer[i],
+ &internal_params[i]);
if (ACPI_FAILURE (status)) {
- acpi_ut_delete_internal_object_list (param_ptr);
+ acpi_ut_delete_internal_object_list (internal_params);
return_ACPI_STATUS (status);
}
}
- param_ptr[param_objects->count] = NULL;
+ internal_params[external_params->count] = NULL;
}
/*
* The path is fully qualified, just evaluate by name
*/
- status = acpi_ns_evaluate_by_name (pathname, param_ptr, &return_obj);
+ status = acpi_ns_evaluate_by_name (pathname, internal_params, &internal_return_obj);
}
else if (!handle) {
* The null pathname case means the handle is for
* the actual object to be evaluated
*/
- status = acpi_ns_evaluate_by_handle (handle, param_ptr, &return_obj);
+ status = acpi_ns_evaluate_by_handle (handle, internal_params, &internal_return_obj);
}
else {
/*
* Both a Handle and a relative Pathname
*/
- status = acpi_ns_evaluate_relative (handle, pathname, param_ptr,
- &return_obj);
+ status = acpi_ns_evaluate_relative (handle, pathname, internal_params,
+ &internal_return_obj);
}
}
user_buffer_length = return_buffer->length;
return_buffer->length = 0;
- if (return_obj) {
- if (VALID_DESCRIPTOR_TYPE (return_obj, ACPI_DESC_TYPE_NAMED)) {
+ if (internal_return_obj) {
+ if (VALID_DESCRIPTOR_TYPE (internal_return_obj, ACPI_DESC_TYPE_NAMED)) {
/*
* If we got an Node as a return object,
* this means the object we are evaluating
* types at a later date if necessary.
*/
status = AE_TYPE;
- return_obj = NULL; /* No need to delete an Node */
+ internal_return_obj = NULL; /* No need to delete an Node */
}
if (ACPI_SUCCESS (status)) {
* Find out how large a buffer is needed
* to contain the returned object
*/
- status = acpi_ut_get_object_size (return_obj,
+ status = acpi_ut_get_object_size (internal_return_obj,
&buffer_space_needed);
if (ACPI_SUCCESS (status)) {
/*
/*
* We have enough space for the object, build it
*/
- status = acpi_ut_copy_iobject_to_eobject (return_obj,
+ status = acpi_ut_copy_iobject_to_eobject (internal_return_obj,
return_buffer);
return_buffer->length = buffer_space_needed;
}
/* Delete the return and parameter objects */
- if (return_obj) {
+ if (internal_return_obj) {
/*
* Delete the internal return object. (Or at least
* decrement the reference count by one)
*/
- acpi_ut_remove_reference (return_obj);
+ acpi_ut_remove_reference (internal_return_obj);
}
/*
* Free the input parameter list (if we created one),
*/
- if (param_ptr) {
+ if (internal_params) {
/* Free the allocated parameter block */
- acpi_ut_delete_internal_object_list (param_ptr);
+ acpi_ut_delete_internal_object_list (internal_params);
}
return_ACPI_STATUS (status);
acpi_namespace_node *child_node = NULL;
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
/* Parameter validation */
if (type > ACPI_TYPE_MAX) {
if (!child) {
/* Start search at the beginning of the specified scope */
- parent_node = acpi_ns_convert_handle_to_entry (parent);
+ parent_node = acpi_ns_map_handle_to_node (parent);
if (!parent_node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
else {
/* Convert and validate the handle */
- child_node = acpi_ns_convert_handle_to_entry (child);
+ child_node = acpi_ns_map_handle_to_node (child);
if (!child_node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
/* Internal function does the real work */
- node = acpi_ns_get_next_object ((acpi_object_type8) type,
+ node = acpi_ns_get_next_node ((acpi_object_type8) type,
parent_node, child_node);
if (!node) {
status = AE_NOT_FOUND;
acpi_object_type *ret_type)
{
acpi_namespace_node *node;
- acpi_status status;
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
/* Parameter Validation */
if (!ret_type) {
/* Convert and validate the handle */
- node = acpi_ns_convert_handle_to_entry (handle);
+ node = acpi_ns_map_handle_to_node (handle);
if (!node) {
acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
acpi_status status = AE_OK;
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
if (!ret_handle) {
return (AE_BAD_PARAMETER);
}
/* Convert and validate the handle */
- node = acpi_ns_convert_handle_to_entry (handle);
+ node = acpi_ns_map_handle_to_node (handle);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
acpi_object_type type,
acpi_handle start_object,
u32 max_depth,
- ACPI_WALK_CALLBACK user_function,
+ acpi_walk_callback user_function,
void *context,
void **return_value)
{
FUNCTION_TRACE ("Acpi_walk_namespace");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* Parameter validation */
if ((type > ACPI_TYPE_MAX) ||
* must be allowed to make Acpi calls itself.
*/
acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- status = acpi_ns_walk_namespace ((acpi_object_type8) type,
- start_object, max_depth,
- NS_WALK_UNLOCK,
- user_function, context,
- return_value);
+ status = acpi_ns_walk_namespace ((acpi_object_type8) type, start_object,
+ max_depth, NS_WALK_UNLOCK, user_function, context,
+ return_value);
acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
acpi_status status;
acpi_namespace_node *node;
u32 flags;
- ACPI_DEVICE_ID device_id;
- ACPI_GET_DEVICES_INFO *info;
+ acpi_device_id device_id;
+ acpi_get_devices_info *info;
info = context;
acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- node = acpi_ns_convert_handle_to_entry (obj_handle);
+ node = acpi_ns_map_handle_to_node (obj_handle);
acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (!node) {
acpi_status
acpi_get_devices (
NATIVE_CHAR *HID,
- ACPI_WALK_CALLBACK user_function,
+ acpi_walk_callback user_function,
void *context,
void **return_value)
{
acpi_status status;
- ACPI_GET_DEVICES_INFO info;
+ acpi_get_devices_info info;
FUNCTION_TRACE ("Acpi_get_devices");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* Parameter validation */
if (!user_function) {
/******************************************************************************
*
* Module Name: os.c - Linux OSL functions
- * $Revision: 46 $
+ * $Revision: 49 $
*
*****************************************************************************/
#include <linux/delay.h>
#include <asm/io.h>
#include <acpi.h>
-#include "driver.h"
#ifdef CONFIG_ACPI_EFI
#include <asm/efi.h>
}
if ((unsigned long) phys < virt_to_phys(high_memory)) {
- struct page *page;
*virt = phys_to_virt((unsigned long) phys);
-
- /* Check for stamping */
- page = virt_to_page(*virt);
- if(page && !test_bit(PG_reserved, &page->flags))
- printk(KERN_WARNING "ACPI attempting to access kernel owned memory at %08lX.\n", (unsigned long)phys);
-
return AE_OK;
}
acpi_status
acpi_os_write_port(
ACPI_IO_ADDRESS port,
- u32 value,
+ NATIVE_UINT value,
u32 width)
{
switch (width)
/*****************************************************************************
*
* Module Name: ac.c
- * $Revision: 22 $
+ * $Revision: 23 $
*
*****************************************************************************/
* Print out basic adapter information.
*/
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| AC Adapter[%02x]:[%p] %s\n", ac_adapter->device_handle, ac_adapter->acpi_handle, buffer.pointer));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| AC Adapter[%02x]:[%p] %s\n", ac_adapter->device_handle, ac_adapter->acpi_handle, (char*)buffer.pointer));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
acpi_os_free(buffer.pointer);
/*****************************************************************************
*
* Module Name: ac_osl.c
- * $Revision: 9 $
+ * $Revision: 10 $
*
*****************************************************************************/
MODULE_AUTHOR("Andrew Grover");
MODULE_DESCRIPTION("ACPI Component Architecture (CA) - AC Adapter Driver");
-MODULE_LICENSE("GPL");
#define AC_PROC_ROOT "ac_adapter"
return(AE_BAD_PARAMETER);
}
- printk(KERN_INFO "AC Adapter: found\n");
+ printk(KERN_INFO "ACPI: AC Adapter found\n");
proc_entry = proc_mkdir(ac_adapter->uid, ac_proc_root);
if (!proc_entry) {
/*****************************************************************************
*
* Module Name: bt.c
- * $Revision: 27 $
+ * $Revision: 29 $
*
*****************************************************************************/
*/
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Battery[%02x]:[%p] %s\n", battery->device_handle, battery->acpi_handle, buffer.pointer));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Battery[%02x]:[%p] %s\n", battery->device_handle, battery->acpi_handle, (char*)buffer.pointer));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| uid[%s] is_present[%d] power_units[%s]\n", battery->uid, battery->is_present, battery->power_units));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
- MEMSET(&bif_buffer, 0, sizeof(acpi_buffer));
+ memset(&bif_buffer, 0, sizeof(acpi_buffer));
/*
* Evalute _BIF:
package_format.length = sizeof("NNNNNNNNNSSSS");
package_format.pointer = "NNNNNNNNNSSSS";
- MEMSET(&package_data, 0, sizeof(acpi_buffer));
+ memset(&package_data, 0, sizeof(acpi_buffer));
status = bm_extract_package_data(package, &package_format,
&package_data);
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
- MEMSET(&bst_buffer, 0, sizeof(acpi_buffer));
+ memset(&bst_buffer, 0, sizeof(acpi_buffer));
/*
* Evalute _BST:
package_format.length = sizeof("NNNN");
package_format.pointer = "NNNN";
- MEMSET(&package_data, 0, sizeof(acpi_buffer));
+ memset(&package_data, 0, sizeof(acpi_buffer));
status = bm_extract_package_data(package, &package_format,
&package_data);
FUNCTION_TRACE("bt_initialize");
- MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
- MEMSET(&driver, 0, sizeof(BM_DRIVER));
+ memset(&criteria, 0, sizeof(BM_DEVICE_ID));
+ memset(&driver, 0, sizeof(BM_DRIVER));
/*
* Register driver for driver method battery devices.
FUNCTION_TRACE("bt_terminate");
- MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
- MEMSET(&driver, 0, sizeof(BM_DRIVER));
+ memset(&criteria, 0, sizeof(BM_DEVICE_ID));
+ memset(&driver, 0, sizeof(BM_DRIVER));
/*
* Unregister driver for driver method battery devices.
/******************************************************************************
*
* Module Name: bt_osl.c
- * $Revision: 22 $
+ * $Revision: 24 $
*
*****************************************************************************/
MODULE_AUTHOR("Andrew Grover");
MODULE_DESCRIPTION("ACPI Component Architecture (CA) - Control Method Battery Driver");
-MODULE_LICENSE("GPL");
#define BT_PROC_ROOT "battery"
}
else {
p += sprintf(p, "Design Capacity: %d %sh\n",
- battery_info->design_capacity,
+ (u32)battery_info->design_capacity,
battery->power_units);
}
}
else {
p += sprintf(p, "Last Full Capacity: %d %sh\n",
- battery_info->last_full_capacity,
+ (u32)battery_info->last_full_capacity,
battery->power_units);
}
}
else {
p += sprintf(p, "Design Voltage: %d mV\n",
- battery_info->design_voltage);
+ (u32)battery_info->design_voltage);
}
p += sprintf(p, "Design Capacity Warning: %d %sh\n",
- battery_info->design_capacity_warning,
+ (u32)battery_info->design_capacity_warning,
battery->power_units);
p += sprintf(p, "Design Capacity Low: %d %sh\n",
- battery_info->design_capacity_low,
+ (u32)battery_info->design_capacity_low,
battery->power_units);
p += sprintf(p, "Capacity Granularity 1: %d %sh\n",
- battery_info->battery_capacity_granularity_1,
+ (u32)battery_info->battery_capacity_granularity_1,
battery->power_units);
p += sprintf(p, "Capacity Granularity 2: %d %sh\n",
- battery_info->battery_capacity_granularity_2,
+ (u32)battery_info->battery_capacity_granularity_2,
battery->power_units);
p += sprintf(p, "Model Number: %s\n",
battery_info->model_number);
}
else {
p += sprintf(p, "Present Rate: %d %s\n",
- battery_status->present_rate,
+ (u32)battery_status->present_rate,
battery->power_units);
}
}
else {
p += sprintf(p, "Remaining Capacity: %d %sh\n",
- battery_status->remaining_capacity,
+ (u32)battery_status->remaining_capacity,
battery->power_units);
}
}
else {
p += sprintf(p, "Battery Voltage: %d mV\n",
- battery_status->present_voltage);
+ (u32)battery_status->present_voltage);
}
end:
}
if (battery->is_present) {
- printk("Battery: socket found, battery present\n");
+ printk("ACPI: Battery socket found, battery present\n");
}
else {
- printk("Battery: socket found, battery absent\n");
+ printk("ACPI: Battery socket found, battery absent\n");
}
proc_entry = proc_mkdir(battery->uid, bt_proc_root);
/******************************************************************************
*
* Module Name: bm.c
- * $Revision: 47 $
+ * $Revision: 48 $
*
*****************************************************************************/
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+-------------------------------------------------------------------------------\n"));
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| %s[%02x]:[%p] flags[%02x] hid[%s] %s\n", type_string, device->handle, device->acpi_handle, device->flags, (device->id.hid[0] ? device->id.hid : " "), buffer.pointer));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| %s[%02x]:[%p] flags[%02x] hid[%s] %s\n", type_string, device->handle, device->acpi_handle, device->flags, (device->id.hid[0] ? device->id.hid : " "), (char*)buffer.pointer));
if (flags & BM_PRINT_IDENTIFICATION) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| identification: uid[%s] adr[%08x]\n", device->id.uid, device->id.adr));
for (i=0; i<node_list.count; i++) {
if (!node_list.nodes[i]) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) node entry [%02x] detected.\n", device_handle));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) node entry [%p] detected.\n", device_handle));
status = AE_NULL_ENTRY;
break;
}
/*****************************************************************************
*
* Module Name: bm_osl.c
- * $Revision: 16 $
+ * $Revision: 17 $
*
*****************************************************************************/
MODULE_AUTHOR("Andrew Grover");
MODULE_DESCRIPTION("ACPI Component Architecture (CA) - ACPI Bus Manager");
-MODULE_LICENSE("GPL");
-
-
-#ifdef ACPI_DEBUG
-
-static int dbg_layer = ACPI_COMPONENT_DEFAULT;
-MODULE_PARM(dbg_layer, "i");
-MODULE_PARM_DESC(dbg_layer, "Controls debug output (see acpi_dbg_layer).\n");
-
-static int dbg_level = DEBUG_DEFAULT;
-MODULE_PARM(dbg_level, "i");
-MODULE_PARM_DESC(dbg_level, "Controls debug output (see acpi_dbg_level).\n");
-
-#endif /*ACPI_DEBUG*/
/*****************************************************************************
if (ACPI_FAILURE(status))
return -ENODEV;
-#ifdef ACPI_DEBUG
- save_dbg_layer = acpi_dbg_layer;
- acpi_dbg_layer = dbg_layer;
-
- save_dbg_level = acpi_dbg_level;
- acpi_dbg_level = dbg_level;
-#endif /*ACPI_DEBUG*/
-
bm_proc_root = proc_mkdir(BM_PROC_ROOT, NULL);
if (!bm_proc_root) {
return(AE_ERROR);
bm_proc_root = NULL;
}
-#ifdef ACPI_DEBUG
- acpi_dbg_layer = save_dbg_layer;
- acpi_dbg_level = save_dbg_level;
-#endif /*ACPI_DEBUG*/
-
return;
}
/****************************************************************************
*
* Module Name: bmpower.c - Driver for ACPI Power Resource 'devices'
- * $Revision: 19 $
+ * $Revision: 20 $
*
****************************************************************************/
acpi_os_printf("Power Resource: found\n");
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Power_resource[%02x]:[%p] %s\n", pr->device_handle, pr->acpi_handle, buffer.pointer));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Power_resource[%02x]:[%p] %s\n", pr->device_handle, pr->acpi_handle, (char*)buffer.pointer));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| system_level[S%d] resource_order[%d]\n", pr->system_level, pr->resource_order));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| state[D%d] reference_count[%d]\n", pr->state, pr->reference_count));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
/*****************************************************************************
*
* Module Name: bmutils.c
- * $Revision: 38 $
+ * $Revision: 43 $
*
*****************************************************************************/
}
if (pathname) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Evaluate object [%s.%s], %s\n", buffer.pointer, pathname,
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluate object [%s.%s], %s\n", (char*)buffer.pointer, pathname,
acpi_format_exception(status)));
}
else {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Evaluate object [%s], %s\n", buffer.pointer,
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluate object [%s], %s\n", (char*)buffer.pointer,
acpi_format_exception(status)));
}
*
****************************************************************************/
-/*
- * TBD: Don't assume numbers (in ASL) are 32-bit values!!!! (IA64)
- * TBD: Issue with 'assumed' types coming out of interpreter...
- * (e.g. toshiba _BIF)
- */
-
acpi_status
bm_extract_package_data (
acpi_object *package,
- acpi_buffer *package_format,
+ acpi_buffer *format,
acpi_buffer *buffer)
{
- acpi_status status = AE_OK;
- u8 *head = NULL;
- u8 *tail = NULL;
- u8 **pointer = NULL;
u32 tail_offset = 0;
- acpi_object *element = NULL;
u32 size_required = 0;
- char* format = NULL;
+ char *format_string = NULL;
u32 format_count = 0;
u32 i = 0;
+ u8 *head = NULL;
+ u8 *tail = NULL;
FUNCTION_TRACE("bm_extract_package_data");
- if (!package || (package->type != ACPI_TYPE_PACKAGE) ||
- (package->package.count == 0) || !package_format ||
- (package_format->length < 1) ||
- (!package_format->pointer) || !buffer) {
+ if (!package || (package->type != ACPI_TYPE_PACKAGE) || (package->package.count < 1)) {
+ ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'package' argument\n"));
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
- format_count = package_format->length - 1;
+ if (!format || !format->pointer || (format->length < 1)) {
+ ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'format' argument\n"));
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
+ }
+
+ if (!buffer) {
+ ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'buffer' argument\n"));
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
+ }
+ format_count = (format->length/sizeof(char)) - 1;
if (format_count > package->package.count) {
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Format specifies more objects [%d] than exist in package [%d].", format_count, package->package.count));
+ ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Format specifies more objects [%d] than exist in package [%d].", format_count, package->package.count));
return_ACPI_STATUS(AE_BAD_DATA);
}
- format = (char*)package_format->pointer;
+ format_string = (char*)format->pointer;
/*
* Calculate size_required.
*/
for (i=0; i<format_count; i++) {
- element = &(package->package.elements[i]);
+
+ acpi_object *element = &(package->package.elements[i]);
+
+ if (!element) {
+ return_ACPI_STATUS(AE_BAD_DATA);
+ }
switch (element->type) {
case ACPI_TYPE_INTEGER:
- switch (format[i]) {
+ switch (format_string[i]) {
case 'N':
size_required += sizeof(acpi_integer);
tail_offset += sizeof(acpi_integer);
break;
case 'S':
- size_required += sizeof(u8*) +
- sizeof(acpi_integer) + 1;
- tail_offset += sizeof(acpi_integer);
+ size_required += sizeof(char*) + sizeof(acpi_integer) + sizeof(char);
+ tail_offset += sizeof(char*);
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Invalid package element [%d]: got number, expecing [%c].\n", i, format[i]));
+ ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid package element [%d]: got number, expecing [%c].\n", i, format_string[i]));
return_ACPI_STATUS(AE_BAD_DATA);
break;
}
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
- switch (format[i]) {
+ switch (format_string[i]) {
case 'S':
- size_required += sizeof(u8*) +
- element->string.length + 1;
- tail_offset += sizeof(u8*);
+ size_required += sizeof(char*) + (element->string.length * sizeof(char)) + sizeof(char);
+ tail_offset += sizeof(char*);
break;
case 'B':
- size_required += sizeof(u8*) +
- element->buffer.length;
+ size_required += sizeof(u8*) + (element->buffer.length * sizeof(u8));
tail_offset += sizeof(u8*);
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Invalid package element [%d] got string/buffer, expecing [%c].\n", i, format[i]));
+ ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid package element [%d] got string/buffer, expecing [%c].\n", i, format_string[i]));
return_ACPI_STATUS(AE_BAD_DATA);
break;
}
case ACPI_TYPE_PACKAGE:
default:
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found unsupported element at index=%d\n", i));
/* TBD: handle nested packages... */
return_ACPI_STATUS(AE_SUPPORT);
break;
}
}
- if (size_required > buffer->length) {
+ /*
+ * Validate output buffer.
+ */
+ if (buffer->length < size_required) {
buffer->length = size_required;
return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
}
-
- buffer->length = size_required;
-
- if (!buffer->pointer) {
+ else if (buffer->length != size_required || !buffer->pointer) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
head = buffer->pointer;
tail = buffer->pointer + tail_offset;
- /*
- * Extract package data:
+ /*
+ * Extract package data.
*/
for (i=0; i<format_count; i++) {
- element = &(package->package.elements[i]);
+ u8 **pointer = NULL;
+ acpi_object *element = &(package->package.elements[i]);
switch (element->type) {
case ACPI_TYPE_INTEGER:
- switch (format[i]) {
+ switch (format_string[i]) {
case 'N':
- *((acpi_integer*)head) =
- element->integer.value;
+ *((acpi_integer*)head) = element->integer.value;
head += sizeof(acpi_integer);
break;
case 'S':
pointer = (u8**)head;
*pointer = tail;
- *((acpi_integer*)tail) =
- element->integer.value;
+ *((acpi_integer*)tail) = element->integer.value;
head += sizeof(acpi_integer*);
tail += sizeof(acpi_integer);
/* NULL terminate string */
- *tail = 0;
- tail++;
+ *tail = (char)0;
+ tail += sizeof(char);
break;
default:
/* Should never get here */
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
- switch (format[i]) {
+ switch (format_string[i]) {
case 'S':
pointer = (u8**)head;
*pointer = tail;
- memcpy(tail, element->string.pointer,
- element->string.length);
- head += sizeof(u8*);
- tail += element->string.length;
+ memcpy(tail, element->string.pointer, element->string.length);
+ head += sizeof(char*);
+ tail += element->string.length * sizeof(char);
/* NULL terminate string */
- *tail = 0;
- tail++;
+ *tail = (char)0;
+ tail += sizeof(char);
break;
case 'B':
pointer = (u8**)head;
*pointer = tail;
- memcpy(tail, element->buffer.pointer,
- element->buffer.length);
+ memcpy(tail, element->buffer.pointer, element->buffer.length);
head += sizeof(u8*);
- tail += element->buffer.length;
+ tail += element->buffer.length * sizeof(u8);
break;
default:
/* Should never get here */
}
}
- return_ACPI_STATUS(status);
+ return_ACPI_STATUS(AE_OK);
}
*/
status = bm_evaluate_object(handle, pathname, NULL, &buffer);
if (ACPI_FAILURE(status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "failed to evaluate object (%s)\n",
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "failed to evaluate object (%s)\n",
acpi_format_exception(status)));
goto end;
}
if (!element || (element->type != ACPI_TYPE_STRING)) {
status = AE_BAD_DATA;
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Invalid element in package (not a device reference).\n"));
+ ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid element in package (not a device reference).\n"));
DEBUG_EVAL_ERROR (ACPI_LV_WARN, handle, pathname, status);
break;
}
element->string.pointer, &reference_handle);
if (ACPI_FAILURE(status)) {
status = AE_BAD_DATA;
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to resolve device reference [%s].\n", element->string.pointer));
+ ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Unable to resolve device reference [%s].\n", element->string.pointer));
DEBUG_EVAL_ERROR (ACPI_LV_WARN, handle, pathname, status);
break;
}
&(reference_list->handles[i]));
if (ACPI_FAILURE(status)) {
status = AE_BAD_DATA;
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to resolve device reference for [%p].\n", reference_handle));
+ ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Unable to resolve device reference for [%p].\n", reference_handle));
DEBUG_EVAL_ERROR (ACPI_LV_WARN, handle, pathname, status);
break;
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Resolved reference [%s]->[%p]->[%02x]\n", element->string.pointer, reference_handle, reference_list->handles[i]));
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resolved reference [%s]->[%p]->[%02x]\n", element->string.pointer, reference_handle, reference_list->handles[i]));
(reference_list->count)++;
}
/*****************************************************************************
*
* Module Name: bn.c
- * $Revision: 25 $
+ * $Revision: 27 $
*
*****************************************************************************/
case BN_TYPE_POWER_BUTTON:
case BN_TYPE_POWER_BUTTON_FIXED:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Power_button[%02x]:[%p] %s\n", button->device_handle, button->acpi_handle, buffer.pointer));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Power_button[%02x]:[%p] %s\n", button->device_handle, button->acpi_handle, (char*)buffer.pointer));
break;
case BN_TYPE_SLEEP_BUTTON:
case BN_TYPE_SLEEP_BUTTON_FIXED:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Sleep_button[%02x]:[%p] %s\n", button->device_handle, button->acpi_handle, buffer.pointer));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Sleep_button[%02x]:[%p] %s\n", button->device_handle, button->acpi_handle, (char*)buffer.pointer));
break;
case BN_TYPE_LID_SWITCH:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Lid_switch[%02x]:[%p] %s\n", button->device_handle, button->acpi_handle, buffer.pointer));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Lid_switch[%02x]:[%p] %s\n", button->device_handle, button->acpi_handle, (char*)buffer.pointer));
break;
}
/******************************************************************************
*
* Module Name: bn_osl.c
- * $Revision: 14 $
+ * $Revision: 16 $
*
*****************************************************************************/
MODULE_AUTHOR("Andrew Grover");
MODULE_DESCRIPTION("ACPI Component Architecture (CA) - Button Driver");
-MODULE_LICENSE("GPL");
#define BN_PROC_ROOT "button"
static struct proc_dir_entry *bn_proc_root = NULL;
+#define BN_TYPE_UNKNOWN 0
+#define BN_TYPE_FIXED 1
+#define BN_TYPE_GENERIC 2
+
+static int bn_power_button = BN_TYPE_UNKNOWN;
+static int bn_sleep_button = BN_TYPE_UNKNOWN;
+static int bn_lid_switch = BN_TYPE_UNKNOWN;
+
+
/****************************************************************************
*
* FUNCTION: bn_osl_add_device
switch (button->type) {
- case BN_TYPE_POWER_BUTTON:
case BN_TYPE_POWER_BUTTON_FIXED:
- printk(KERN_INFO "Power Button: found\n");
+ bn_power_button = BN_TYPE_FIXED;
+ printk(KERN_INFO "ACPI: Power Button (FF) found\n");
if (!proc_mkdir(BN_PROC_POWER_BUTTON, bn_proc_root)) {
status = AE_ERROR;
}
break;
- case BN_TYPE_SLEEP_BUTTON:
+ case BN_TYPE_POWER_BUTTON:
+ /*
+ * Avoid creating multiple /proc entries when (buggy) ACPI
+ * BIOS tables erroneously list both fixed- and generic-
+ * feature buttons. Note that fixed-feature buttons are
+ * always enumerated first (and there can only be one) so
+ * we only need to check here.
+ */
+ switch (bn_power_button) {
+ case BN_TYPE_GENERIC:
+ printk(KERN_WARNING "ACPI: Multiple generic-space power buttons detected, using first\n");
+ break;
+ case BN_TYPE_FIXED:
+ printk(KERN_WARNING "ACPI: Multiple power buttons detected, ignoring fixed-feature\n");
+ default:
+ printk(KERN_INFO "ACPI: Power Button (CM) found\n");
+ bn_power_button = BN_TYPE_GENERIC;
+ if (!proc_mkdir(BN_PROC_POWER_BUTTON, bn_proc_root)) {
+ status = AE_ERROR;
+ }
+ break;
+ }
+ break;
+
case BN_TYPE_SLEEP_BUTTON_FIXED:
- printk(KERN_INFO "Sleep Button: found\n");
+ bn_sleep_button = BN_TYPE_FIXED;
+ printk(KERN_INFO "ACPI: Sleep Button (FF) found\n");
if (!proc_mkdir(BN_PROC_SLEEP_BUTTON, bn_proc_root)) {
status = AE_ERROR;
}
break;
+ case BN_TYPE_SLEEP_BUTTON:
+ /*
+ * Avoid creating multiple /proc entries when (buggy) ACPI
+ * BIOS tables erroneously list both fixed- and generic-
+ * feature buttons. Note that fixed-feature buttons are
+ * always enumerated first (and there can only be one) so
+ * we only need to check here.
+ */
+ switch (bn_sleep_button) {
+ case BN_TYPE_GENERIC:
+ printk(KERN_WARNING "ACPI: Multiple generic-space sleep buttons detected, using first\n");
+ break;
+ case BN_TYPE_FIXED:
+ printk(KERN_WARNING "ACPI: Multiple sleep buttons detected, ignoring fixed-feature\n");
+ default:
+ bn_sleep_button = BN_TYPE_GENERIC;
+ printk(KERN_INFO "ACPI: Sleep Button (CM) found\n");
+ if (!proc_mkdir(BN_PROC_SLEEP_BUTTON, bn_proc_root)) {
+ status = AE_ERROR;
+ }
+ break;
+ }
+ break;
+
case BN_TYPE_LID_SWITCH:
- printk(KERN_INFO "Lid Switch: found\n");
+ if (bn_lid_switch) {
+ printk(KERN_WARNING "ACPI: Multiple generic-space lid switches detected, using first\n");
+ break;
+ }
+ bn_lid_switch = BN_TYPE_GENERIC;
+ printk(KERN_INFO "ACPI: Lid Switch (CM) found\n");
if (!proc_mkdir(BN_PROC_LID_SWITCH, bn_proc_root)) {
status = AE_ERROR;
}
/*****************************************************************************
*
* Module Name: ec_osl.c
- * $Revision: 10 $
+ * $Revision: 11 $
*
*****************************************************************************/
MODULE_AUTHOR("Andrew Grover");
MODULE_DESCRIPTION("ACPI Component Architecture (CA) - Embedded Controller Driver");
-MODULE_LICENSE("GPL");
-
-#ifdef ACPI_DEBUG
-
-static int dbg_layer = ACPI_COMPONENT_DEFAULT;
-MODULE_PARM(dbg_layer, "i");
-MODULE_PARM_DESC(dbg_layer, "Controls debug output (see acpi_dbg_layer).\n");
-
-static int dbg_level = DEBUG_DEFAULT;
-MODULE_PARM(dbg_level, "i");
-MODULE_PARM_DESC(dbg_level, "Controls debug output (see acpi_dbg_level).\n");
-
-#endif /*ACPI_DEBUG*/
-
-
-#ifdef ACPI_DEBUG
-static u32 save_dbg_layer;
-static u32 save_dbg_level;
-#endif /*ACPI_DEBUG*/
extern struct proc_dir_entry *bm_proc_root;
if (!bm_proc_root)
return -ENODEV;
-#ifdef ACPI_DEBUG
- save_dbg_layer = acpi_dbg_layer;
- acpi_dbg_layer = dbg_layer;
-
- save_dbg_level = acpi_dbg_level;
- acpi_dbg_level = dbg_level;
-#endif /*ACPI_DEBUG*/
-
status = ec_initialize();
return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
{
ec_terminate();
-#ifdef ACPI_DEBUG
- acpi_dbg_layer = save_dbg_layer;
- acpi_dbg_level = save_dbg_level;
-#endif /*ACPI_DEBUG*/
-
return;
}
/*****************************************************************************
*
* Module Name: ecmain.c
- * $Revision: 28 $
+ * $Revision: 29 $
*
*****************************************************************************/
* Print out basic thermal zone information.
*/
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Embedded_controller[%02x]:[%p] %s\n", ec->device_handle, ec->acpi_handle, buffer.pointer));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Embedded_controller[%02x]:[%p] %s\n", ec->device_handle, ec->acpi_handle, (char*)buffer.pointer));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| gpe_bit[%02x] status/command_port[%02x] data_port[%02x]\n", ec->gpe_bit, ec->status_port, ec->data_port));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
/*****************************************************************************
*
* Module Name: ecspace.c
- * $Revision: 22 $
+ * $Revision: 23 $
*
*****************************************************************************/
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Received request with invalid function [%p].\n", function));
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Received request with invalid function [%X].\n", function));
return_ACPI_STATUS(AE_BAD_PARAMETER);
break;
}
/******************************************************************************
*
* Module Name: bn.h
- * $Revision: 10 $
+ * $Revision: 12 $
*
*****************************************************************************/
/******************************************************************************
*
* Module Name: bt.h
- * $Revision: 16 $
+ * $Revision: 18 $
*
*****************************************************************************/
*/
typedef struct
{
- u32 power_unit;
- u32 design_capacity;
- u32 last_full_capacity;
- u32 battery_technology;
- u32 design_voltage;
- u32 design_capacity_warning;
- u32 design_capacity_low;
- u32 battery_capacity_granularity_1;
- u32 battery_capacity_granularity_2;
+ acpi_integer power_unit;
+ acpi_integer design_capacity;
+ acpi_integer last_full_capacity;
+ acpi_integer battery_technology;
+ acpi_integer design_voltage;
+ acpi_integer design_capacity_warning;
+ acpi_integer design_capacity_low;
+ acpi_integer battery_capacity_granularity_1;
+ acpi_integer battery_capacity_granularity_2;
acpi_string model_number;
acpi_string serial_number;
acpi_string battery_type;
*/
typedef struct
{
- u32 state;
- u32 present_rate;
- u32 remaining_capacity;
- u32 present_voltage;
+ acpi_integer state;
+ acpi_integer present_rate;
+ acpi_integer remaining_capacity;
+ acpi_integer present_voltage;
} BT_BATTERY_STATUS;
acpi_status
bt_get_status (
- BT_CONTEXT *battery,
+ BT_CONTEXT *battery,
BT_BATTERY_STATUS **battery_status);
acpi_status
/******************************************************************************
*
* Module Name: processor.h
- * $Revision: 9 $
+ * $Revision: 13 $
*
*****************************************************************************/
/*****************************************************************************
*
* Module Name: tz.h
- * $Revision: 21 $
+ * $Revision: 24 $
*
*****************************************************************************/
typedef u32 TZ_STATE;
#define TZ_STATE_OK ((TZ_STATE) 0x00000000)
+#define TZ_STATE_HOT ((TZ_STATE) 0x10000000)
#define TZ_STATE_ACTIVE ((TZ_STATE) 0x20000000)
#define TZ_STATE_PASSIVE ((TZ_STATE) 0x40000000)
#define TZ_STATE_CRITICAL ((TZ_STATE) 0x80000000)
-
-/*
- * TZ_THRESHOLD:
- * -------------
- * Information on an individual threshold.
- */
typedef struct {
- TZ_THRESHOLD_TYPE type;
- u32 index;
u32 temperature;
- TZ_COOLING_STATE cooling_state;
- BM_HANDLE_LIST cooling_devices;
-} TZ_THRESHOLD;
-
-
-/*
- * TZ_THRESHOLD_LIST:
- * ------------------
- * Container for the thresholds of a given thermal zone.
- * Note that thresholds are always ordered by increasing
- * temperature value to simplify use by thermal policy.
- */
-typedef struct {
- u32 count;
- TZ_THRESHOLD thresholds[TZ_MAX_THRESHOLDS];
-} TZ_THRESHOLD_LIST;
-
+} TZ_CRITICAL_THRESHOLD;
-/*
- * TZ_CRITICAL_POLICY:
- * -------------------
- */
typedef struct {
- TZ_THRESHOLD *threshold;
-} TZ_CRITICAL_POLICY;
-
+ u8 is_valid;
+ u32 temperature;
+} TZ_HOT_THRESHOLD;
-/*
- * TZ_PASSIVE_POLICY:
- * ------------------
- */
typedef struct {
+ u8 is_valid;
+ u32 temperature;
u32 tc1;
u32 tc2;
u32 tsp;
- TZ_THRESHOLD *threshold;
-} TZ_PASSIVE_POLICY;
-
+ BM_HANDLE_LIST devices;
+} TZ_PASSIVE_THRESHOLD;
-/*
- * TZ_ACTIVE_POLICY:
- * -----------------
- */
typedef struct {
- u32 threshold_count;
- TZ_THRESHOLD *threshold[TZ_MAX_ACTIVE_THRESHOLDS];
-} TZ_ACTIVE_POLICY;
+ u8 is_valid;
+ u32 temperature;
+ TZ_COOLING_STATE cooling_state;
+ BM_HANDLE_LIST devices;
+} TZ_ACTIVE_THRESHOLD;
+typedef struct {
+ TZ_CRITICAL_THRESHOLD critical;
+ TZ_HOT_THRESHOLD hot;
+ TZ_PASSIVE_THRESHOLD passive;
+ TZ_ACTIVE_THRESHOLD active[TZ_MAX_ACTIVE_THRESHOLDS];
+} TZ_THRESHOLDS;
/*
* TZ_POLICY:
TZ_STATE state;
TZ_COOLING_MODE cooling_mode;
u32 polling_freq;
- TZ_THRESHOLD_LIST threshold_list;
- TZ_CRITICAL_POLICY critical;
- TZ_PASSIVE_POLICY passive;
- TZ_ACTIVE_POLICY active;
- /* TBD: Linux-specific */
+ TZ_THRESHOLDS thresholds;
struct timer_list timer;
} TZ_POLICY;
* Function Prototypes
*****************************************************************************/
-/* thermal_zone.c */
+/* tz.c */
acpi_status
tz_initialize (void);
acpi_status
tz_get_temperature (
- TZ_CONTEXT *thermal_zone,
- u32 *temperature);
+ TZ_CONTEXT *tz);
acpi_status
tz_get_thresholds (
- TZ_CONTEXT *thermal_zone,
- TZ_THRESHOLD_LIST *threshold_list);
+ TZ_CONTEXT *tz);
+
+acpi_status
+tz_set_cooling_preference (
+ TZ_CONTEXT *tz,
+ TZ_COOLING_MODE cooling_mode);
void
tz_print (
- TZ_CONTEXT *thermal_zone);
+ TZ_CONTEXT *tz);
/* tzpolicy.c */
acpi_status
tz_policy_add_device (
- TZ_CONTEXT *thermal_zone);
+ TZ_CONTEXT *tz);
acpi_status
tz_policy_remove_device (
- TZ_CONTEXT *thermal_zone);
+ TZ_CONTEXT *tz);
void
tz_policy_check (
void *context);
-/* Thermal Zone Driver OSL */
+/* tz_osl.c */
acpi_status
tz_osl_add_device (
- TZ_CONTEXT *thermal_zone);
+ TZ_CONTEXT *tz);
acpi_status
tz_osl_remove_device (
- TZ_CONTEXT *thermal_zone);
+ TZ_CONTEXT *tz);
acpi_status
tz_osl_generate_event (
u32 event,
- TZ_CONTEXT *thermal_zone);
+ TZ_CONTEXT *tz);
#endif /* __TZ_H__ */
/*****************************************************************************
*
* Module Name: pr.c
- * $Revision: 32 $
+ * $Revision: 34 $
*
*****************************************************************************/
#ifdef ACPI_DEBUG
acpi_buffer buffer;
- PROC_NAME("pr_print");
+ FUNCTION_TRACE("pr_print");
buffer.length = 256;
buffer.pointer = acpi_os_callocate(buffer.length);
* Print out basic processor information.
*/
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Processor[%02x]:[%p] uid[%02x] %s\n", processor->device_handle, processor->acpi_handle, processor->uid, buffer.pointer));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Processor[%02x]:[%p] uid[%02x] %s\n", processor->device_handle, processor->acpi_handle, processor->uid, (char*)buffer.pointer));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| power: %cC0 %cC1 %cC2[%d] %cC3[%d]\n", (processor->power.state[0].is_valid?'+':'-'), (processor->power.state[1].is_valid?'+':'-'), (processor->power.state[2].is_valid?'+':'-'), processor->power.state[2].latency, (processor->power.state[3].is_valid?'+':'-'), processor->power.state[3].latency));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| performance: states[%d]\n", processor->performance.state_count));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
* Processor Block:
* ----------------
*/
- MEMSET(&acpi_object, 0, sizeof(acpi_object));
+ memset(&acpi_object, 0, sizeof(acpi_object));
buffer.length = sizeof(acpi_object);
buffer.pointer = &acpi_object;
FUNCTION_TRACE("pr_initialize");
- MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
- MEMSET(&driver, 0, sizeof(BM_DRIVER));
+ memset(&criteria, 0, sizeof(BM_DEVICE_ID));
+ memset(&driver, 0, sizeof(BM_DRIVER));
/*
* Initialize power (Cx state) policy.
FUNCTION_TRACE("pr_terminate");
- MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
- MEMSET(&driver, 0, sizeof(BM_DRIVER));
+ memset(&criteria, 0, sizeof(BM_DEVICE_ID));
+ memset(&driver, 0, sizeof(BM_DRIVER));
/*
* Terminate power (Cx state) policy.
/******************************************************************************
*
* Module Name: pr_osl.c
- * $Revision: 18 $
+ * $Revision: 21 $
*
*****************************************************************************/
MODULE_AUTHOR("Andrew Grover");
MODULE_DESCRIPTION("ACPI Component Architecture (CA) - IA32 Processor Driver");
-MODULE_LICENSE("GPL");
#define PR_PROC_ROOT "processor"
printk(" C%d", i);
}
}
-
- if (processor->performance.state_count > 1) {
- printk(", throttling states: %d", processor->performance.state_count);
- }
-
- if (acpi_piix4_bmisx)
- printk(", PIIX workaround active");
-
+ if (processor->performance.state_count > 1)
+ printk(", %d throttling states", processor->performance.state_count);
+ if (acpi_piix4_bmisx && processor->power.state[3].is_valid)
+ printk(" (PIIX errata enabled)");
printk("\n");
sprintf(processor_uid, "%d", processor->uid);
/*****************************************************************************
*
* Module Name: prperf.c
- * $Revision: 19 $
+ * $Revision: 21 $
*
*****************************************************************************/
return_ACPI_STATUS(AE_BAD_DATA);
}
- if (processor->performance.state_count == 1) {
+ if ((state == processor->performance.active_state) ||
+ (processor->performance.state_count == 1)) {
return_ACPI_STATUS(AE_OK);
}
acpi_os_write_port(processor->pblk.address, pblk_value, 32);
}
+ processor->performance.active_state = state;
+
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Processor [%02x] set to performance state [%d%%].\n", processor->device_handle, processor->performance.state[state].performance));
return_ACPI_STATUS(AE_OK);
if (performance->active_state <
(performance->state_count-1)) {
status = pr_perf_set_state(processor,
- (performance->active_state-1));
+ (performance->active_state+1));
}
break;
case PR_PERF_INC:
if (performance->active_state > 0) {
status = pr_perf_set_state(processor,
- (performance->active_state+1));
+ (performance->active_state-1));
}
break;
}
if (ACPI_SUCCESS(status)) {
- performance->thermal_limit = limit;
+ performance->thermal_limit = performance->active_state;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Processor [%02x] thermal performance limit set to [%d%%].\n", processor->device_handle, processor->performance.state[performance->active_state].performance));
* Get Current State:
* ------------------
*/
- status = pr_perf_get_state(processor,
- &(processor->performance.active_state));
+ status = pr_perf_get_state(processor, &(processor->performance.active_state));
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
+ }
+
+ /*
+ * Set to Maximum Performance:
+ * ---------------------------
+ * We'll let subsequent policy (e.g. thermal/power) decide to lower
+ * performance if it so chooses, but for now crank up the speed.
+ */
+ if (0 != processor->performance.active_state) {
+ status = pr_perf_set_state(processor, 0);
+ }
return_ACPI_STATUS(status);
}
/*****************************************************************************
*
* Module Name: prpower.c
- * $Revision: 30 $
+ * $Revision: 32 $
*
*****************************************************************************/
* Globals
****************************************************************************/
-extern fadt_descriptor_rev2 acpi_fadt;
+extern FADT_DESCRIPTOR acpi_fadt;
static u32 last_idle_jiffies = 0;
static PR_CONTEXT *processor_list[NR_CPUS];
static void (*pr_pm_idle_save)(void) = NULL;
case PR_C1:
/* Invoke C1 */
enable(); halt();
- /* no C1 time measurement, so just enter some number of times */
+ /*
+ * TBD: Can't get time duration while in C1, as resumes
+ * go to an ISR rather than here.
+ */
time_elapsed = 0xFFFFFFFF;
break;
/* Invoke C2 */
acpi_os_read_port(processor->power.p_lvl2, NULL, 8);
/* Dummy op - must do something useless after P_LVL2 read */
- acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_DO_NOT_LOCK,
- BM_STS);
+ acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_DO_NOT_LOCK, BM_STS);
/* Compute time elapsed */
acpi_get_timer(&end_ticks);
/* Re-enable interrupts */
case PR_C3:
/* Disable bus master arbitration */
- acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
- ARB_DIS, 1);
+ acpi_hw_register_bit_access(ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK, ARB_DIS, 1);
/* See how long we're asleep for */
acpi_get_timer(&start_ticks);
/* Invoke C3 */
acpi_os_read_port(processor->power.p_lvl3, NULL, 8);
/* Dummy op - must do something useless after P_LVL3 read */
- acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_DO_NOT_LOCK,
- BM_STS);
+ acpi_hw_register_bit_access(ACPI_READ, ACPI_MTX_DO_NOT_LOCK, BM_STS);
/* Compute time elapsed */
acpi_get_timer(&end_ticks);
/* Enable bus master arbitration */
c_state->promotion.count++;
c_state->demotion.count = 0;
- if (c_state->promotion.count >=
- c_state->promotion.count_threshold) {
-
+ if (c_state->promotion.count >= c_state->promotion.count_threshold) {
/*
* Bus Mastering Activity, if active and used
* by this state's promotion policy, prevents
* promotions from occuring.
*/
- if (bm_control && !(processor->power.bm_activity &
- c_state->promotion.bm_threshold)) {
+ if (!bm_control || !(processor->power.bm_activity & c_state->promotion.bm_threshold))
next_state = c_state->promotion.target_state;
- }
}
}
* state's promotion policy, causes an immediate demotion
* to occur.
*/
- if (bm_control && (processor->power.bm_activity &
- c_state->demotion.bm_threshold)) {
+ if (bm_control && (processor->power.bm_activity & c_state->demotion.bm_threshold))
next_state = c_state->demotion.target_state;
- }
}
/*
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Max CPUs[%d], this CPU[%d].\n", NR_CPUS, smp_processor_id()));
- /* only use C3 if we can control busmastering */
+ /* Only use C3 if we can control bus mastering. */
if (acpi_fadt.V1_pm2_cnt_blk && acpi_fadt.pm2_cnt_len)
bm_control = 1;
/*****************************************************************************
*
* Module Name: sm.c
- * $Revision: 19 $
+ * $Revision: 20 $
*
*****************************************************************************/
* Print out basic system information.
*/
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| System[%02x]:[%p] %s\n", system->device_handle, system->acpi_handle, buffer.pointer));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| System[%02x]:[%p] %s\n", system->device_handle, system->acpi_handle, (char*)buffer.pointer));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| states: %cS0 %cS1 %cS2 %cS3 %cS4 %cS5\n", (system->states[0]?'+':'-'), (system->states[1]?'+':'-'), (system->states[2]?'+':'-'), (system->states[3]?'+':'-'), (system->states[4]?'+':'-'), (system->states[5]?'+':'-')));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
MODULE_AUTHOR("Andrew Grover");
MODULE_DESCRIPTION("ACPI Component Architecture (CA) - ACPI System Driver");
-MODULE_LICENSE("GPL");
#define SM_PROC_INFO "info"
/*****************************************************************************
*
* Module Name: tz.c
- * $Revision: 40 $
+ * $Revision: 44 $
*
*****************************************************************************/
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/*
- * TBD: 1. Finish /proc interface (threshold values, _SCP changes, etc.)
- * 2. Update policy for ACPI 2.0 compliance
- * 3. Check for all required methods prior to enabling a threshold
- * 4. Support for multiple processors in a zone (passive cooling devices)
- */
#include <acpi.h>
#include <bm.h>
#include "tz.h"
+
#define _COMPONENT ACPI_THERMAL
MODULE_NAME ("tz")
+/****************************************************************************
+ * Globals
+ ****************************************************************************/
+
+extern int TZP;
+
+
/****************************************************************************
* Internal Functions
****************************************************************************/
*
* FUNCTION: tz_print
*
- * PARAMETERS:
- *
- * RETURN:
- *
- * DESCRIPTION: Prints out information on a specific thermal zone.
- *
****************************************************************************/
void
tz_print (
- TZ_CONTEXT *thermal_zone)
+ TZ_CONTEXT *tz)
{
#ifdef ACPI_DEBUG
acpi_buffer buffer;
u32 i,j = 0;
- TZ_THRESHOLD *threshold = NULL;
+ TZ_THRESHOLDS *thresholds = NULL;
- PROC_NAME("tz_print");
+ FUNCTION_TRACE("tz_print");
- if (!thermal_zone) {
+ if (!tz)
return;
- }
+
+ thresholds = &(tz->policy.thresholds);
buffer.length = 256;
buffer.pointer = acpi_os_callocate(buffer.length);
- if (!buffer.pointer) {
+ if (!buffer.pointer)
return;
- }
/*
* Get the full pathname for this ACPI object.
*/
- acpi_get_name(thermal_zone->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
+ acpi_get_name(tz->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
/*
* Print out basic thermal zone information.
*/
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Thermal_zone[%02x]:[%p] %s\n", thermal_zone->device_handle, thermal_zone->acpi_handle, buffer.pointer));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| temperature[%d] state[%08x]\n", thermal_zone->policy.temperature, thermal_zone->policy.state));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| cooling_mode[%08x] polling_freq[%d]\n", thermal_zone->policy.cooling_mode, thermal_zone->policy.polling_freq));
-
- for (i=0; i<thermal_zone->policy.threshold_list.count; i++) {
-
- threshold = &(thermal_zone->policy.threshold_list.thresholds[i]);
-
- switch (threshold->type) {
- case TZ_THRESHOLD_CRITICAL:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| critical[%d]\n", threshold->temperature));
- break;
- case TZ_THRESHOLD_PASSIVE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| passive[%d]: tc1[%d] tc2[%d] tsp[%d]\n", threshold->temperature, thermal_zone->policy.passive.tc1, thermal_zone->policy.passive.tc2, thermal_zone->policy.passive.tsp));
- break;
- case TZ_THRESHOLD_ACTIVE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| active[%d]: index[%d]\n", threshold->temperature, threshold->index));
- break;
- default:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| unknown[%d]\n", threshold->temperature));
- break;
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Thermal_zone[%02x]:[%p] %s\n", tz->device_handle, tz->acpi_handle, (char*)buffer.pointer));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| temperature[%d] state[%08x]\n", tz->policy.temperature, tz->policy.state));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| cooling_mode[%08x] polling_freq[%d]\n", tz->policy.cooling_mode, tz->policy.polling_freq));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| critical[%d]\n", thresholds->critical.temperature));
+ if (thresholds->hot.is_valid)
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| hot[%d]\n", thresholds->hot.temperature));
+ if (thresholds->passive.is_valid) {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| passive[%d]: tc1[%d] tc2[%d] tsp[%d]\n", thresholds->passive.temperature, thresholds->passive.tc1, thresholds->passive.tc2, thresholds->passive.tsp));
+ if (thresholds->passive.devices.count > 0) {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| devices"));
+ for (j=0; (j<thresholds->passive.devices.count && j<10); j++) {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "[%02x]", thresholds->passive.devices.handles[j]));
+ }
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
}
-
- if (threshold->cooling_devices.count > 0) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| cooling_devices"));
- for (j=0; (j<threshold->cooling_devices.count && j<10); j++) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "[%02x]", threshold->cooling_devices.handles[j]));
+ }
+ for (i=0; i<TZ_MAX_ACTIVE_THRESHOLDS; i++) {
+ if (!thresholds->active[i].is_valid)
+ break;
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| active[%d]: index[%d]\n", thresholds->active[i].temperature, i));
+ if (thresholds->active[i].devices.count > 0) {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| devices"));
+ for (j=0; (j<thresholds->active[i].devices.count && j<10); j++) {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "[%02x]", thresholds->active[i].devices.handles[j]));
}
-
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
}
}
*
* FUNCTION: tz_get_temperaturee
*
- * PARAMETERS:
- *
- * RETURN:
- *
- * DESCRIPTION:
- *
****************************************************************************/
acpi_status
tz_get_temperature (
- TZ_CONTEXT *thermal_zone,
- u32 *temperature)
+ TZ_CONTEXT *tz)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("tz_get_temperature");
- if (!thermal_zone || !temperature) {
+ if (!tz) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
- * Evaluate the _TMP driver method to get the current temperature.
+ * Evaluate the _TMP method to get the current temperature.
*/
- status = bm_evaluate_simple_integer(thermal_zone->acpi_handle,
- "_TMP", temperature);
+ status = bm_evaluate_simple_integer(tz->acpi_handle, "_TMP", &(tz->policy.temperature));
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
+ }
+
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %d d_k\n", tz->policy.temperature));
return_ACPI_STATUS(status);
}
*
* FUNCTION: tz_set_cooling_preference
*
- * PARAMETERS:
- *
- * RETURN:
- *
- * DESCRIPTION:
- *
****************************************************************************/
acpi_status
tz_set_cooling_preference (
- TZ_CONTEXT *thermal_zone,
+ TZ_CONTEXT *tz,
TZ_COOLING_MODE cooling_mode)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("tz_set_cooling_preference");
- if (!thermal_zone || ((cooling_mode != TZ_COOLING_MODE_ACTIVE) &&
- (cooling_mode != TZ_COOLING_MODE_PASSIVE))) {
+ if (!tz || ((cooling_mode != TZ_COOLING_MODE_ACTIVE) && (cooling_mode != TZ_COOLING_MODE_PASSIVE))) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
* Build the argument list, which simply consists of the current
* cooling preference.
*/
- MEMSET(&arg_list, 0, sizeof(acpi_object));
+ memset(&arg_list, 0, sizeof(acpi_object));
arg_list.count = 1;
arg_list.pointer = &arg0;
- MEMSET(&arg0, 0, sizeof(acpi_object));
+ memset(&arg0, 0, sizeof(acpi_object));
arg0.type = ACPI_TYPE_INTEGER;
arg0.integer.value = cooling_mode;
/*
* Evaluate "_SCP" - setting the new cooling preference.
*/
- status = acpi_evaluate_object(thermal_zone->acpi_handle, "_SCP",
- &arg_list, NULL);
+ status = acpi_evaluate_object(tz->acpi_handle, "_SCP", &arg_list, NULL);
+ if (ACPI_FAILURE(status)) {
+ tz->policy.cooling_mode = -1;
+ return_ACPI_STATUS(status);
+ }
+
+ tz->policy.cooling_mode = cooling_mode;
return_ACPI_STATUS(status);
}
-/***************************************************************************
- *
- * FUNCTION: tz_get_single_threshold
- *
- * PARAMETERS:
- *
- * RETURN:
+/****************************************************************************
*
- * DESCRIPTION:
+ * FUNCTION: tz_get_thresholds
*
****************************************************************************/
acpi_status
-tz_get_single_threshold (
- TZ_CONTEXT *thermal_zone,
- TZ_THRESHOLD *threshold)
+tz_get_thresholds (
+ TZ_CONTEXT *tz)
{
- acpi_status status = AE_OK;
+ acpi_status status = AE_OK;
+ TZ_THRESHOLDS *thresholds = NULL;
+ u32 value = 0;
+ u32 i = 0;
- FUNCTION_TRACE("tz_get_single_threshold");
+ FUNCTION_TRACE("acpi_tz_get_thresholds");
- if (!thermal_zone || !threshold) {
+ if (!tz) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
- switch (threshold->type) {
+ thresholds = &(tz->policy.thresholds);
- /*
- * Critical Threshold:
- * -------------------
- */
- case TZ_THRESHOLD_CRITICAL:
- threshold->index = 0;
- threshold->cooling_devices.count = 0;
- status = bm_evaluate_simple_integer(
- thermal_zone->acpi_handle, "_CRT",
- &(threshold->temperature));
- break;
-
- /*
- * Passive Threshold:
- * ------------------
- * Evaluate _PSV to get the threshold temperature and _PSL to get
- * references to all passive cooling devices.
- */
- case TZ_THRESHOLD_PASSIVE:
- threshold->index = 0;
- threshold->cooling_devices.count = 0;
- status = bm_evaluate_simple_integer(
- thermal_zone->acpi_handle, "_PSV",
- &(threshold->temperature));
- if (ACPI_SUCCESS(status)) {
- status = bm_evaluate_reference_list(
- thermal_zone->acpi_handle, "_PSL",
- &(threshold->cooling_devices));
- }
+ /* Critical Shutdown (required) */
- break;
-
- /*
- * Active Thresholds:
- * ------------------
- * Evaluate _ACx to get all threshold temperatures, and _ALx to get
- * references to all passive cooling devices.
- */
- case TZ_THRESHOLD_ACTIVE:
- {
- char object_name[5] = {'_','A', 'C',
- ('0'+threshold->index),'\0'};
- status = bm_evaluate_simple_integer(
- thermal_zone->acpi_handle, object_name,
- &(threshold->temperature));
- if (ACPI_SUCCESS(status)) {
- object_name[2] = 'L';
- status = bm_evaluate_reference_list(
- thermal_zone->acpi_handle,
- object_name,
- &(threshold->cooling_devices));
- }
- }
- break;
+ status = bm_evaluate_simple_integer(tz->acpi_handle, "_CRT", &value);
+ if (ACPI_FAILURE(status)) {
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No critical threshold\n"));
+ return_ACPI_STATUS(status);
+ }
+ else {
+ thresholds->critical.temperature = value;
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found critical threshold [%d]\n", thresholds->critical.temperature));
- default:
- status = AE_SUPPORT;
- break;
}
- return_ACPI_STATUS(status);
-}
+ /* Critical Sleep (optional) */
+ status = bm_evaluate_simple_integer(tz->acpi_handle, "_HOT", &value);
+ if (ACPI_FAILURE(status)) {
+ thresholds->hot.is_valid = 0;
+ thresholds->hot.temperature = 0;
+ }
+ else {
+ thresholds->hot.is_valid = 1;
+ thresholds->hot.temperature = value;
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found hot threshold [%d]\n", thresholds->hot.temperature));
+ }
-/****************************************************************************
- *
- * FUNCTION: tz_get_thresholds
- *
- * PARAMETERS: thermal_zone - Identifies the thermal zone to parse.
- * buffer - Output buffer.
- *
- * RETURN: acpi_status result code.
- *
- * DESCRIPTION: Builds a TZ_THRESHOLD_LIST structure containing information
- * on all thresholds for a given thermal zone.
- *
- * NOTES: The current design limits the number of cooling devices
- * per theshold to the value specified by BM_MAX_HANDLES.
- * This simplifies parsing of thresholds by allowing a maximum
- * threshold list size to be computed (and enforced) -- which
- * allows all thresholds to be parsed in a single pass (since
- * memory must be contiguous when returned in the acpi_buffer).
- *
- ****************************************************************************/
+ /* Passive: Processors (optional) */
-acpi_status
-tz_get_thresholds (
- TZ_CONTEXT *thermal_zone,
- TZ_THRESHOLD_LIST *threshold_list)
-{
- acpi_status status = AE_OK;
- TZ_THRESHOLD *threshold = NULL;
- u32 i = 0;
+ status = bm_evaluate_simple_integer(tz->acpi_handle, "_PSV", &value);
+ if (ACPI_FAILURE(status)) {
+ thresholds->passive.is_valid = 0;
+ thresholds->passive.temperature = 0;
+ }
+ else {
+ thresholds->passive.is_valid = 1;
+ thresholds->passive.temperature = value;
- FUNCTION_TRACE("tz_get_thresholds");
+ status = bm_evaluate_simple_integer(tz->acpi_handle, "_TC1", &value);
+ if (ACPI_FAILURE(status)) {
+ thresholds->passive.is_valid = 0;
+ }
+ thresholds->passive.tc1 = value;
- if (!thermal_zone || !threshold_list) {
- return_ACPI_STATUS(AE_BAD_PARAMETER);
- }
+ status = bm_evaluate_simple_integer(tz->acpi_handle, "_TC2", &value);
+ if (ACPI_FAILURE(status)) {
+ thresholds->passive.is_valid = 0;
+ }
+ thresholds->passive.tc2 = value;
- threshold_list->count = 0;
+ status = bm_evaluate_simple_integer(tz->acpi_handle, "_TSP", &value);
+ if (ACPI_FAILURE(status)) {
+ thresholds->passive.is_valid = 0;
+ }
+ thresholds->passive.tsp = value;
- /*
- * Critical threshold:
- * -------------------
- * Every thermal zone must have one!
- */
- threshold = &(threshold_list->thresholds[threshold_list->count]);
- threshold->type = TZ_THRESHOLD_CRITICAL;
+ status = bm_evaluate_reference_list(tz->acpi_handle, "_PSL", &(thresholds->passive.devices));
+ if (ACPI_FAILURE(status)) {
+ thresholds->passive.is_valid = 0;
+ }
- status = tz_get_single_threshold(thermal_zone, threshold);
- if (ACPI_SUCCESS(status)) {
- (threshold_list->count)++;
- }
- else {
- return_ACPI_STATUS(status);
+ if (thresholds->passive.is_valid) {
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found passive threshold [%d]\n", thresholds->passive.temperature));
+ }
+ else {
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid passive threshold\n"));
+ }
}
+ /* Active: Fans, etc. (optional) */
- /*
- * Passive threshold:
- * ------------------
- */
- threshold = &(threshold_list->thresholds[threshold_list->count]);
- threshold->type = TZ_THRESHOLD_PASSIVE;
+ for (i=0; i<TZ_MAX_ACTIVE_THRESHOLDS; i++) {
- status = tz_get_single_threshold(thermal_zone, threshold);
- if (ACPI_SUCCESS(status)) {
- (threshold_list->count)++;
- }
+ char name[5] = {'_','A','C',('0'+i),'\0'};
- /*
- * Active threshold:
- * -----------------
- * Note that active thresholds are sorted by index (e.g. _AC0,
- * _AC1, ...), and thus from highest (_AC0) to lowest (_AC9)
- * temperature.
- */
- for (i = 0; i < TZ_MAX_ACTIVE_THRESHOLDS; i++) {
+ status = bm_evaluate_simple_integer(tz->acpi_handle, name, &value);
+ if (ACPI_FAILURE(status)) {
+ thresholds->active[i].is_valid = 0;
+ thresholds->active[i].temperature = 0;
+ break;
+ }
- threshold = &(threshold_list->thresholds[threshold_list->count]);
- threshold->type = TZ_THRESHOLD_ACTIVE;
- threshold->index = i;
+ thresholds->active[i].temperature = value;
+ name[2] = 'L';
- status = tz_get_single_threshold(thermal_zone, threshold);
+ status = bm_evaluate_reference_list(tz->acpi_handle, name, &(thresholds->active[i].devices));
if (ACPI_SUCCESS(status)) {
- (threshold_list->count)++;
+ thresholds->active[i].is_valid = 1;
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found active threshold [%d]:[%d]\n", i, thresholds->active[i].temperature));
}
else {
- threshold->type = TZ_THRESHOLD_UNKNOWN;
- threshold->index = 0;
- thermal_zone->policy.active.threshold_count = i;
- break;
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid active threshold [%d]\n", i));
}
}
*
* FUNCTION: tz_add_device
*
- * PARAMETERS: <none>
- *
- * RETURN:
- *
- * DESCRIPTION:
- *
****************************************************************************/
acpi_status
void **context)
{
acpi_status status = AE_OK;
- TZ_CONTEXT *thermal_zone = NULL;
+ TZ_CONTEXT *tz = NULL;
BM_DEVICE *device = NULL;
acpi_handle tmp_handle = NULL;
static u32 zone_count = 0;
/*
* Allocate a new Thermal Zone device.
*/
- thermal_zone = acpi_os_callocate(sizeof(TZ_CONTEXT));
- if (!thermal_zone) {
- return AE_NO_MEMORY;
+ tz = acpi_os_callocate(sizeof(TZ_CONTEXT));
+ if (!tz) {
+ return_ACPI_STATUS(AE_NO_MEMORY);
}
- thermal_zone->device_handle = device->handle;
- thermal_zone->acpi_handle = device->acpi_handle;
+ tz->device_handle = device->handle;
+ tz->acpi_handle = device->acpi_handle;
/* TBD: How to manage 'uid' when zones are Pn_p? */
- sprintf(thermal_zone->uid, "%d", zone_count++);
+ sprintf(tz->uid, "%d", zone_count++);
/*
- * _TMP?
- * -----
+ * Temperature:
+ * ------------
+ * Make sure we can read the zone's current temperature (_TMP).
+ * If we can't, there's no use in doing any policy (abort).
*/
- status = acpi_get_handle(thermal_zone->acpi_handle, "_TMP",
- &tmp_handle);
- if (ACPI_FAILURE(status)) {
+ status = tz_get_temperature(tz);
+ if (ACPI_FAILURE(status))
goto end;
- }
/*
- * Initialize Policy:
+ * Polling Frequency:
* ------------------
- * TBD: Move all thermal zone policy to user-mode daemon...
+ * If _TZP doesn't exist use the OS default polling frequency.
*/
- status = tz_policy_add_device(thermal_zone);
+ status = bm_evaluate_simple_integer(tz->acpi_handle, "_TZP", &(tz->policy.polling_freq));
if (ACPI_FAILURE(status)) {
- goto end;
+ tz->policy.polling_freq = TZP;
}
+ status = AE_OK;
- status = tz_osl_add_device(thermal_zone);
- if (ACPI_FAILURE(status)) {
+ /*
+ * Cooling Preference:
+ * -------------------
+ * Default to ACTIVE (noisy) cooling until policy decides otherwise.
+ * Note that _SCP is optional.
+ */
+ tz_set_cooling_preference(tz, TZ_COOLING_MODE_ACTIVE);
+
+ /*
+ * Start Policy:
+ * -------------
+ * Thermal policy is included in the kernel (this driver) because
+ * of the critical role it plays in avoiding nuclear meltdown. =O
+ */
+ status = tz_policy_add_device(tz);
+ if (ACPI_FAILURE(status))
goto end;
- }
- *context = thermal_zone;
+ status = tz_osl_add_device(tz);
+ if (ACPI_FAILURE(status))
+ goto end;
- tz_print(thermal_zone);
+ *context = tz;
+
+ tz_print(tz);
end:
- if (ACPI_FAILURE(status)) {
- acpi_os_free(thermal_zone);
- }
+ if (ACPI_FAILURE(status))
+ acpi_os_free(tz);
return_ACPI_STATUS(status);
}
*
* FUNCTION: tz_remove_device
*
- * PARAMETERS: <none>
- *
- * RETURN:
- *
- * DESCRIPTION:
- *
****************************************************************************/
acpi_status
void **context)
{
acpi_status status = AE_OK;
- TZ_CONTEXT *thermal_zone = NULL;
+ TZ_CONTEXT *tz = NULL;
FUNCTION_TRACE("tz_remove_device");
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
- thermal_zone = (TZ_CONTEXT*)(*context);
+ tz = (TZ_CONTEXT*)(*context);
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing thermal zone [%02x].\n", thermal_zone->device_handle));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing thermal zone [%02x].\n", tz->device_handle));
- status = tz_osl_remove_device(thermal_zone);
+ status = tz_osl_remove_device(tz);
/*
* Remove Policy:
* --------------
* TBD: Move all thermal zone policy to user-mode daemon...
*/
- status = tz_policy_remove_device(thermal_zone);
+ status = tz_policy_remove_device(tz);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
- acpi_os_free(thermal_zone);
+ acpi_os_free(tz);
return_ACPI_STATUS(status);
}
*
* FUNCTION: tz_initialize
*
- * PARAMETERS: <none>
- *
- * RETURN:
- *
- * DESCRIPTION:
- *
****************************************************************************/
acpi_status
FUNCTION_TRACE("tz_initialize");
- MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
- MEMSET(&driver, 0, sizeof(BM_DRIVER));
+ memset(&criteria, 0, sizeof(BM_DEVICE_ID));
+ memset(&driver, 0, sizeof(BM_DRIVER));
/*
* Register driver for thermal zone devices.
*
* FUNCTION: tz_terminate
*
- * PARAMETERS: <none>
- *
- * RETURN:
- *
- * DESCRIPTION:
- *
****************************************************************************/
acpi_status
FUNCTION_TRACE("tz_terminate");
- MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
- MEMSET(&driver, 0, sizeof(BM_DRIVER));
+ memset(&criteria, 0, sizeof(BM_DEVICE_ID));
+ memset(&driver, 0, sizeof(BM_DRIVER));
/*
* Unregister driver for thermal zone devices.
*
* FUNCTION: tz_notify
*
- * PARAMETERS: <none>
- *
- * RETURN:
- *
- * DESCRIPTION:
- *
****************************************************************************/
+
acpi_status
tz_notify (
BM_NOTIFY notify_type,
void **context)
{
acpi_status status = AE_OK;
- TZ_CONTEXT *thermal_zone = NULL;
+ TZ_CONTEXT *tz = NULL;
FUNCTION_TRACE("tz_notify");
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
- thermal_zone = (TZ_CONTEXT*)*context;
+ tz = (TZ_CONTEXT*)*context;
switch (notify_type) {
case TZ_NOTIFY_TEMPERATURE_CHANGE:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Temperature (_TMP) change event detected.\n"));
- /* -------------------------------------------- */
- /* TBD: Remove when policy moves to user-mode. */
tz_policy_check(*context);
- /* -------------------------------------------- */
- status = tz_get_temperature(thermal_zone,
- &(thermal_zone->policy.temperature));
+ status = tz_get_temperature(tz);
if (ACPI_SUCCESS(status)) {
- status = tz_osl_generate_event(notify_type,
- thermal_zone);
+ status = tz_osl_generate_event(notify_type, tz);
}
break;
case TZ_NOTIFY_THRESHOLD_CHANGE:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Threshold (_SCP) change event detected.\n"));
- /* -------------------------------------------- */
- /* TBD: Remove when policy moves to user-mode. */
- status = tz_policy_remove_device(thermal_zone);
+ status = tz_policy_remove_device(tz);
if (ACPI_SUCCESS(status)) {
- status = tz_policy_add_device(thermal_zone);
+ status = tz_policy_add_device(tz);
}
- /* -------------------------------------------- */
- status = tz_osl_generate_event(notify_type, thermal_zone);
+ status = tz_osl_generate_event(notify_type, tz);
break;
case TZ_NOTIFY_DEVICE_LISTS_CHANGE:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Device lists (_ALx, _PSL, _TZD) change event detected.\n"));
- /* -------------------------------------------- */
- /* TBD: Remove when policy moves to user-mode. */
- status = tz_policy_remove_device(thermal_zone);
+ status = tz_policy_remove_device(tz);
if (ACPI_SUCCESS(status)) {
- status = tz_policy_add_device(thermal_zone);
+ status = tz_policy_add_device(tz);
}
- /* -------------------------------------------- */
- status = tz_osl_generate_event(notify_type, thermal_zone);
+ status = tz_osl_generate_event(notify_type, tz);
break;
default:
*
* FUNCTION: tz_request
*
- * PARAMETERS:
- *
- * RETURN: Exception code.
- *
- * DESCRIPTION:
- *
****************************************************************************/
acpi_status
void *context)
{
acpi_status status = AE_OK;
- TZ_CONTEXT *thermal_zone = NULL;
+ TZ_CONTEXT *tz = NULL;
FUNCTION_TRACE("tz_request");
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
- thermal_zone = (TZ_CONTEXT*)context;
+ tz = (TZ_CONTEXT*)context;
/*
* Handle request:
/******************************************************************************
*
* Module Name: tz_osl.c
- * $Revision: 21 $
+ * $Revision: 25 $
*
*****************************************************************************/
MODULE_AUTHOR("Andrew Grover");
MODULE_DESCRIPTION("ACPI Component Architecture (CA) - Thermal Zone Driver");
-MODULE_LICENSE("GPL");
int TZP = 0;
MODULE_PARM(TZP, "i");
int *eof,
void *context)
{
- TZ_CONTEXT *thermal_zone = NULL;
+ acpi_status status = AE_OK;
+ char name[5];
+ acpi_buffer buffer = {sizeof(name), &name};
+ TZ_CONTEXT *tz = NULL;
+ TZ_THRESHOLDS *thresholds = NULL;
char *p = page;
int len = 0;
+ u32 i,j;
+ u32 t = 0;
- if (!context || (off != 0)) {
+ if (!context || (off != 0))
goto end;
+
+ tz = (TZ_CONTEXT*)context;
+
+ thresholds = &(tz->policy.thresholds);
+
+ p += sprintf(p, "critical (S5): trip=%d\n", thresholds->critical.temperature);
+
+ if (thresholds->hot.is_valid)
+ p += sprintf(p, "critical (S4): trip=%d\n", thresholds->hot.temperature);
+
+ if (thresholds->passive.is_valid) {
+ p += sprintf(p, "passive: trip=%d tc1=%d tc2=%d tsp=%d devices=", thresholds->passive.temperature, thresholds->passive.tc1, thresholds->passive.tc2, thresholds->passive.tsp);
+ for (j=0; j<thresholds->passive.devices.count; j++)
+ p += sprintf(p, "%08x%c", thresholds->passive.devices.handles[j], (j==thresholds->passive.devices.count-1)?'\n':',');
}
- thermal_zone = (TZ_CONTEXT*)context;
+ for (i=0; i<TZ_MAX_ACTIVE_THRESHOLDS; i++) {
+ if (!(thresholds->active[i].is_valid))
+ break;
+ p += sprintf(p, "active[%d]: trip=%d devices=", i, thresholds->active[i].temperature);
+ for (j=0; j<thresholds->active[i].devices.count; j++)
+ p += sprintf(p, "%08x%c", thresholds->active[i].devices.handles[j], (j==thresholds->passive.devices.count-1)?'\n':',');
+ }
- p += sprintf(p, "<TBD>\n");
+ p += sprintf(p, "cooling mode: ");
+ switch (tz->policy.cooling_mode) {
+ case TZ_COOLING_MODE_ACTIVE:
+ p += sprintf(p, "active (noisy)\n");
+ break;
+ case TZ_COOLING_MODE_PASSIVE:
+ p += sprintf(p, "passive (quiet)\n");
+ break;
+ default:
+ p += sprintf(p, "unknown\n");
+ break;
+ }
+
+ p += sprintf(p, "polling: ");
+ switch (tz->policy.polling_freq) {
+ case 0:
+ p += sprintf(p, "disabled\n");
+ break;
+ default:
+ p += sprintf(p, "%d dS\n", tz->policy.polling_freq);
+ break;
+ }
end:
len = (p - page);
if (len>count) len = count;
if (len<0) len = 0;
- return(len);
+ return len;
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION: tz_osl_proc_write_info
+ *
+ ****************************************************************************/
+
+static int tz_osl_proc_write_info (
+ struct file *file,
+ const char *buffer,
+ unsigned long count,
+ void *data)
+{
+ TZ_CONTEXT *tz = NULL;
+ u32 state = 0;
+ u32 size = 0;
+
+ if (!buffer || (count==0) || !data) {
+ goto end;
+ }
+
+ tz = (TZ_CONTEXT*)data;
+
+ size = strlen(buffer);
+ if (size < 4)
+ goto end;
+
+ /* Cooling preference: "scp=0" (active) or "scp=1" (passive) */
+ if (0 == strncmp(buffer, "scp=", 4)) {
+ tz_set_cooling_preference(tz, (buffer[4] - '0'));
+ }
+
+ /* Polling frequency: "tzp=X" (poll every X [0-9] seconds) */
+ else if (0 == strncmp(buffer, "tzp=", 4)) {
+ tz->policy.polling_freq = (buffer[4] - '0') * 10;
+ tz_policy_check(tz);
+ }
+
+end:
+ return count;
}
int *eof,
void *context)
{
- TZ_CONTEXT *thermal_zone = NULL;
+ TZ_CONTEXT *tz = NULL;
char *p = page;
int len = 0;
goto end;
}
- thermal_zone = (TZ_CONTEXT*)context;
+ tz = (TZ_CONTEXT*)context;
- p += sprintf(p, "Temperature: %d (1/10th degrees Kelvin)\n",
- thermal_zone->policy.temperature);
+ /* Temperature */
- p += sprintf(p, "State: ");
- if (thermal_zone->policy.state & TZ_STATE_ACTIVE) {
- p += sprintf(p, "active[%d] ", thermal_zone->policy.state & 0x07);
- }
- if (thermal_zone->policy.state & TZ_STATE_PASSIVE) {
- p += sprintf(p, "passive ");
- }
- if (thermal_zone->policy.state & TZ_STATE_CRITICAL) {
- p += sprintf(p, "critical ");
- }
- if (thermal_zone->policy.state == 0) {
- p += sprintf(p, "ok ");
- }
- p += sprintf(p, "\n");
+ tz_get_temperature(tz);
- p += sprintf(p, "Cooling Mode: ");
- switch (thermal_zone->policy.cooling_mode) {
- case TZ_COOLING_MODE_ACTIVE:
- p += sprintf(p, "active (noisy)\n");
- break;
- case TZ_COOLING_MODE_PASSIVE:
- p += sprintf(p, "passive (quiet)\n");
- break;
- default:
- p += sprintf(p, "unknown\n");
- break;
- }
+ p += sprintf(p, "temperature: %d dK\n", tz->policy.temperature);
- p += sprintf(p, "Polling Frequency: ");
- switch (thermal_zone->policy.polling_freq) {
- case 0:
- p += sprintf(p, "n/a\n");
- break;
- default:
- p += sprintf(p, "%d (1/10th seconds)\n", thermal_zone->policy.polling_freq);
- break;
+ p += sprintf(p, "state: ");
+ if (tz->policy.state == 0)
+ p += sprintf(p, "ok\n");
+ else if (tz->policy.state & TZ_STATE_CRITICAL)
+ p += sprintf(p, "critical\n");
+ else if (tz->policy.state & TZ_STATE_HOT)
+ p += sprintf(p, "hot\n");
+ else {
+ if (tz->policy.state & TZ_STATE_ACTIVE)
+ p += sprintf(p, "active[%d] ", tz->policy.state & 0x07);
+ if (tz->policy.state & TZ_STATE_PASSIVE)
+ p += sprintf(p, "passive ");
+ p += sprintf(p, "\n");
}
end:
acpi_status
tz_osl_add_device(
- TZ_CONTEXT *thermal_zone)
+ TZ_CONTEXT *tz)
{
- struct proc_dir_entry *proc_entry = NULL, *proc;
+ struct proc_dir_entry *proc_entry = NULL;
+ struct proc_dir_entry *proc_child_entry = NULL;
- if (!thermal_zone) {
+ if (!tz) {
return(AE_BAD_PARAMETER);
}
- printk("Thermal Zone: found\n");
+ printk("ACPI: Thermal Zone found\n");
- proc_entry = proc_mkdir(thermal_zone->uid, tz_proc_root);
- if (!proc_entry)
+ proc_entry = proc_mkdir(tz->uid, tz_proc_root);
+ if (!proc_entry)
return(AE_ERROR);
- proc = create_proc_read_entry(TZ_PROC_STATUS, S_IFREG | S_IRUGO,
- proc_entry, tz_osl_proc_read_status, (void*)thermal_zone);
- if (!proc)
+ proc_child_entry = create_proc_read_entry(TZ_PROC_STATUS, S_IFREG | S_IRUGO, proc_entry, tz_osl_proc_read_status, (void*)tz);
+ if (!proc_child_entry)
return(AE_ERROR);
- proc = create_proc_read_entry(TZ_PROC_INFO, S_IFREG | S_IRUGO,
- proc_entry, tz_osl_proc_read_info, (void*)thermal_zone);
- if (!proc)
+ proc_child_entry = create_proc_entry(TZ_PROC_INFO, S_IFREG | 0644, proc_entry);
+ if (!proc_child_entry)
return(AE_ERROR);
+ proc_child_entry->read_proc = tz_osl_proc_read_info;
+ proc_child_entry->write_proc = tz_osl_proc_write_info;
+ proc_child_entry->data = (void*)tz;
+
return(AE_OK);
}
acpi_status
tz_osl_remove_device (
- TZ_CONTEXT *thermal_zone)
+ TZ_CONTEXT *tz)
{
char proc_entry[64];
- if (!thermal_zone) {
+ if (!tz) {
return(AE_BAD_PARAMETER);
}
- sprintf(proc_entry, "%s/%s", thermal_zone->uid, TZ_PROC_INFO);
+ sprintf(proc_entry, "%s/%s", tz->uid, TZ_PROC_INFO);
remove_proc_entry(proc_entry, tz_proc_root);
- sprintf(proc_entry, "%s/%s", thermal_zone->uid, TZ_PROC_STATUS);
+ sprintf(proc_entry, "%s/%s", tz->uid, TZ_PROC_STATUS);
remove_proc_entry(proc_entry, tz_proc_root);
- sprintf(proc_entry, "%s", thermal_zone->uid);
+ sprintf(proc_entry, "%s", tz->uid);
remove_proc_entry(proc_entry, tz_proc_root);
return(AE_OK);
acpi_status
tz_osl_generate_event (
u32 event,
- TZ_CONTEXT *thermal_zone)
+ TZ_CONTEXT *tz)
{
acpi_status status = AE_OK;
- if (!thermal_zone) {
+ if (!tz) {
return(AE_BAD_PARAMETER);
}
switch (event) {
case TZ_NOTIFY_TEMPERATURE_CHANGE:
- status = bm_osl_generate_event(thermal_zone->device_handle,
- TZ_PROC_ROOT, thermal_zone->uid, event,
- thermal_zone->policy.temperature);
+ status = bm_osl_generate_event(tz->device_handle,
+ TZ_PROC_ROOT, tz->uid, event,
+ tz->policy.temperature);
break;
case TZ_NOTIFY_THRESHOLD_CHANGE:
case TZ_NOTIFY_DEVICE_LISTS_CHANGE:
- status = bm_osl_generate_event(thermal_zone->device_handle,
- TZ_PROC_ROOT, thermal_zone->uid, event, 0);
+ status = bm_osl_generate_event(tz->device_handle,
+ TZ_PROC_ROOT, tz->uid, event, 0);
break;
default:
*
* FUNCTION: tz_osl_init
*
- * PARAMETERS: <none>
- *
- * RETURN: 0: Success
- *
- * DESCRIPTION: Module initialization.
- *
****************************************************************************/
static int __init
*
* FUNCTION: tz_osl_cleanup
*
- * PARAMETERS: <none>
- *
- * RETURN: <none>
- *
- * DESCRIPTION: Module cleanup.
- *
****************************************************************************/
static void __exit
/****************************************************************************
*
* Module Name: tzpolicy.c -
- * $Revision: 28 $
+ * $Revision: 30 $
*
****************************************************************************/
*/
/*
- * TBD: 1. Move to user-space!
- * 2. Support ACPI 2.0 items (e.g. _TZD, _HOT).
- * 3. Support performance-limit control for non-processor devices
+ * TBD: 1. Support performance-limit control for non-processor devices
* (those listed in _TZD, e.g. graphics).
*/
-/* TBD: Linux specific */
#include <linux/proc_fs.h>
#include <linux/sysctl.h>
#include <linux/pm.h>
* Globals
****************************************************************************/
-extern int TZP;
-
void
tz_policy_run (
unsigned long data);
status = bm_request(&request);
- if (ACPI_FAILURE(status)) {
+ if (ACPI_FAILURE(status))
return status;
- }
- else {
+ else
return request.status;
- }
}
{
FUNCTION_TRACE("tz_policy_critical");
- if (!tz || !tz->policy.critical.threshold) {
+ if (!tz) {
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
+ }
+
+ if (tz->policy.temperature >= tz->policy.thresholds.critical.temperature) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Critical (S5) threshold reached.\n"));
+ /* TBD: Need method for shutting down system. */
+ }
+
+ return_ACPI_STATUS(AE_OK);
+}
+
+
+/****************************************************************************
+ *
+ * FUNCTION: tz_policy_hot
+ *
+ * PARAMETERS:
+ *
+ * RETURN:
+ *
+ * DESCRIPTION:
+ *
+ ****************************************************************************/
+
+acpi_status
+tz_policy_hot(
+ TZ_CONTEXT *tz)
+{
+ FUNCTION_TRACE("tz_policy_hot");
+
+ if (!tz || !tz->policy.thresholds.hot.is_valid) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
- if (tz->policy.temperature >=
- tz->policy.critical.threshold->temperature) {
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Critical threshold reached - shutting down system.\n"));
- /* TBD: Need method for calling 'halt' - OSL function? */
+ if (tz->policy.temperature >= tz->policy.thresholds.hot.temperature) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Critical (S4) threshold reached.\n"));
+ /* TBD: Need method for invoking OS-level critical suspend. */
}
return_ACPI_STATUS(AE_OK);
tz_policy_passive(
TZ_CONTEXT *tz)
{
- TZ_PASSIVE_POLICY *passive = NULL;
+ TZ_PASSIVE_THRESHOLD *passive = NULL;
static u32 last_temperature = 0;
s32 trend = 0;
u32 i = 0;
FUNCTION_TRACE("tz_policy_passive");
- if (!tz || !tz->policy.passive.threshold) {
+ if (!tz || !tz->policy.thresholds.passive.is_valid) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
- passive = &(tz->policy.passive);
+ passive = &(tz->policy.thresholds.passive);
- if (tz->policy.temperature >= passive->threshold->temperature) {
+ if (tz->policy.temperature >= passive->temperature) {
/*
* Thermal trend?
* --------------
* Specification), calculate the current thermal trend
* (a.k.a. performance delta).
*/
- trend = passive->tc1 *
- (tz->policy.temperature - last_temperature) +
- passive->tc2 *
- (tz->policy.temperature - passive->threshold->temperature);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "trend[%d] = TC1[%d]*(temp[%d]-last[%d]) + TC2[%d]*(temp[%d]-passive[%d])\n",
- trend, passive->tc1, tz->policy.temperature,
- last_temperature, passive->tc2, tz->policy.temperature,
- passive->threshold->temperature));
+ trend = passive->tc1 * (tz->policy.temperature - last_temperature) + passive->tc2 * (tz->policy.temperature - passive->temperature);
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "trend[%d] = TC1[%d]*(temp[%d]-last[%d]) + TC2[%d]*(temp[%d]-passive[%d])\n", trend, passive->tc1, tz->policy.temperature, last_temperature, passive->tc2, tz->policy.temperature, passive->temperature));
last_temperature = tz->policy.temperature;
* cooling devices (processors).
*/
if (trend > 0) {
- for (i=0; i<passive->threshold->cooling_devices.count; i++) {
- set_performance_limit(
- passive->threshold->cooling_devices.handles[i],
- PR_PERF_DEC);
- }
+ for (i=0; i<passive->devices.count; i++)
+ set_performance_limit(passive->devices.handles[i], PR_PERF_DEC);
}
/*
* Cooling Off?
* cooling devices (processors).
*/
else if (trend < 0) {
- for (i=0; i<passive->threshold->cooling_devices.count; i++) {
- set_performance_limit(
- passive->threshold->cooling_devices.handles[i],
- PR_PERF_INC);
- }
+ for (i=0; i<passive->devices.count; i++)
+ set_performance_limit(passive->devices.handles[i], PR_PERF_INC);
}
}
TZ_CONTEXT *tz)
{
acpi_status status = AE_OK;
- TZ_THRESHOLD *active = NULL;
+ TZ_ACTIVE_THRESHOLD *active = NULL;
u32 i,j = 0;
FUNCTION_TRACE("tz_policy_active");
- if (!tz || !tz->policy.active.threshold) {
+ if (!tz || !tz->policy.thresholds.active[0].is_valid) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
- for (i = 0; i < TZ_MAX_ACTIVE_THRESHOLDS; i++) {
+ for (i=0; i<TZ_MAX_ACTIVE_THRESHOLDS; i++) {
- active = tz->policy.active.threshold[i];
- if (!active) {
+ active = &(tz->policy.thresholds.active[i]);
+ if (!active || !active->is_valid)
break;
- }
/*
* Above Threshold?
* If not already enabled, turn ON all cooling devices
* associated with this active threshold.
*/
- if ((tz->policy.temperature >= active->temperature) &&
- (active->cooling_state != TZ_COOLING_ENABLED)) {
-
- for (j = 0; j < active->cooling_devices.count; j++) {
-
- status = bm_set_device_power_state(
- active->cooling_devices.handles[j],
- ACPI_STATE_D0);
-
+ if ((tz->policy.temperature >= active->temperature) && (active->cooling_state != TZ_COOLING_ENABLED)) {
+ for (j = 0; j < active->devices.count; j++) {
+ status = bm_set_device_power_state(active->devices.handles[j], ACPI_STATE_D0);
if (ACPI_SUCCESS(status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Cooling device [%02x] now ON.\n", active->cooling_devices.handles[j]));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Cooling device [%02x] now ON.\n", active->devices.handles[j]));
}
else {
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to turn ON cooling device [%02x].\n", active->cooling_devices.handles[j]));
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to turn ON cooling device [%02x].\n", active->devices.handles[j]));
}
}
-
- active->cooling_state = TZ_COOLING_ENABLED;
+ active->cooling_state = TZ_COOLING_ENABLED;
}
/*
* Below Threshold?
* during the first pass.
*/
else if (active->cooling_state != TZ_COOLING_DISABLED) {
-
- for (j = 0; j < active->cooling_devices.count; j++) {
-
- status = bm_set_device_power_state(
- active->cooling_devices.handles[j],
- ACPI_STATE_D3);
-
+ for (j = 0; j < active->devices.count; j++) {
+ status = bm_set_device_power_state(active->devices.handles[j], ACPI_STATE_D3);
if (ACPI_SUCCESS(status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Cooling device [%02x] now OFF.\n", active->cooling_devices.handles[j]));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Cooling device [%02x] now OFF.\n", active->devices.handles[j]));
}
else {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unable to turn OFF cooling device [%02x].\n", active->cooling_devices.handles[j]));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unable to turn OFF cooling device [%02x].\n", active->devices.handles[j]));
}
}
-
active->cooling_state = TZ_COOLING_DISABLED;
}
}
{
acpi_status status = AE_OK;
TZ_CONTEXT *tz = NULL;
+ TZ_POLICY *policy = NULL;
+ TZ_THRESHOLDS *thresholds = NULL;
u32 previous_temperature = 0;
u32 previous_state = 0;
u32 active_index = 0;
}
tz = (TZ_CONTEXT*)context;
+ policy = &(tz->policy);
+ thresholds = &(tz->policy.thresholds);
/*
* Preserve Previous State:
* Get Temperature:
* ----------------
*/
- status = tz_get_temperature(tz, &(tz->policy.temperature));
+ status = tz_get_temperature(tz);
if (ACPI_FAILURE(status)) {
return_VOID;
}
* Calculate State:
* ----------------
*/
- tz->policy.state = TZ_STATE_OK;
+ policy->state = TZ_STATE_OK;
/* Critical? */
- if ((tz->policy.critical.threshold) &&
- (tz->policy.temperature >= tz->policy.critical.threshold->temperature)) {
- tz->policy.state |= TZ_STATE_CRITICAL;
- }
+ if (policy->temperature >= thresholds->critical.temperature)
+ policy->state |= TZ_STATE_CRITICAL;
+
+ /* Hot? */
+ if ((thresholds->hot.is_valid) && (policy->temperature >= thresholds->hot.temperature))
+ policy->state |= TZ_STATE_CRITICAL;
/* Passive? */
- if ((tz->policy.passive.threshold) &&
- (tz->policy.temperature >= tz->policy.passive.threshold->temperature)) {
- tz->policy.state |= TZ_STATE_PASSIVE;
- }
+ if ((thresholds->passive.is_valid) && (policy->temperature >= thresholds->passive.temperature))
+ policy->state |= TZ_STATE_PASSIVE;
/* Active? */
- if (tz->policy.active.threshold[0]) {
- for (i=0; i<tz->policy.active.threshold_count; i++) {
- if ((tz->policy.active.threshold[i]) &&
- (tz->policy.temperature >= tz->policy.active.threshold[i]->temperature)) {
- tz->policy.state |= TZ_STATE_ACTIVE;
- if (tz->policy.active.threshold[i]->index > active_index) {
- active_index = tz->policy.active.threshold[i]->index;
- }
+ if (thresholds->active[0].is_valid) {
+ for (i=0; i<TZ_MAX_ACTIVE_THRESHOLDS; i++) {
+ if ((thresholds->active[i].is_valid) && (policy->temperature >= thresholds->active[i].temperature)) {
+ policy->state |= TZ_STATE_ACTIVE;
+ if (i > active_index)
+ active_index = i;
}
}
- tz->policy.state |= active_index;
+ policy->state |= active_index;
}
/*
* out of' a policy state (e.g. to allow fans to be turned off);
* thus we must preserve the previous state.
*/
- if (tz->policy.state & TZ_STATE_CRITICAL) {
+ if (policy->state & TZ_STATE_CRITICAL)
tz_policy_critical(tz);
- }
- if ((tz->policy.state & TZ_STATE_PASSIVE) ||
- (previous_state & TZ_STATE_PASSIVE)) {
+ if (policy->state & TZ_STATE_HOT)
+ tz_policy_hot(tz);
+ if ((policy->state & TZ_STATE_PASSIVE) || (previous_state & TZ_STATE_PASSIVE))
tz_policy_passive(tz);
- }
- if ((tz->policy.state & TZ_STATE_ACTIVE) ||
- (previous_state & TZ_STATE_ACTIVE)) {
+ if ((policy->state & TZ_STATE_ACTIVE) || (previous_state & TZ_STATE_ACTIVE))
tz_policy_active(tz);
- }
/*
* Calculate Sleep Time:
* a thermal event occurs -- e.g. never poll). Note that _TSP
* and _TZD values are given in 1/10th seconds.
*/
- if (tz->policy.state & TZ_STATE_PASSIVE) {
- sleep_time = tz->policy.passive.tsp * 100;
- }
- else if (tz->policy.polling_freq > 0) {
- sleep_time = tz->policy.polling_freq * 100;
- }
- else {
+ if (policy->state & TZ_STATE_PASSIVE)
+ sleep_time = thresholds->passive.tsp * 100;
+ else if (policy->polling_freq > 0)
+ sleep_time = policy->polling_freq * 100;
+ else
sleep_time = WAIT_FOREVER;
- }
-#ifdef ACPI_DEBUG
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Thermal_zone[%02x]: temperature[%d] state[%08x]\n", tz->device_handle, tz->policy.temperature, tz->policy.state));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Thermal_zone[%02x]: temperature[%d] state[%08x]\n", tz->device_handle, policy->temperature, policy->state));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Scheduling next poll in [%d]ms.\n", sleep_time));
-#endif /*ACPI_DEBUG*/
/*
* Schedule Next Poll:
* -------------------
*/
if (sleep_time < WAIT_FOREVER) {
- if (timer_pending(&(tz->policy.timer))) {
- mod_timer(&(tz->policy.timer),
- (HZ*sleep_time)/1000);
- }
+ if (timer_pending(&(policy->timer)))
+ mod_timer(&(policy->timer), (HZ*sleep_time)/1000);
else {
- tz->policy.timer.data = (u32)tz;
- tz->policy.timer.function = tz_policy_run;
- tz->policy.timer.expires =
- jiffies + (HZ*sleep_time)/1000;
- add_timer(&(tz->policy.timer));
+ policy->timer.data = (u32)tz;
+ policy->timer.function = tz_policy_run;
+ policy->timer.expires = jiffies + (HZ*sleep_time)/1000;
+ add_timer(&(policy->timer));
}
}
else {
- if (timer_pending(&(tz->policy.timer))) {
- del_timer(&(tz->policy.timer));
- }
+ if (timer_pending(&(policy->timer)))
+ del_timer(&(policy->timer));
}
return_VOID;
*
****************************************************************************/
+
void
tz_policy_run (
unsigned long data)
* -----------------------------
* Note that all Linux kernel timers run at interrupt-level (ack!).
*/
- status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
- tz_policy_check, (void*)data);
+ status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, tz_policy_check, (void*)data);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Error invoking thermal policy.\n"));
}
TZ_CONTEXT *tz)
{
acpi_status status = AE_OK;
- TZ_THRESHOLD *threshold = NULL;
+ TZ_THRESHOLDS *thresholds = NULL;
u32 i,j = 0;
FUNCTION_TRACE("tz_policy_add_device");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Adding policy for thermal zone [%02x].\n", tz->device_handle));
- /*
- * Temperature:
- * ------------
- * Make sure we can read the zone's current temperature (_TMP).
- * If we can't, there's no use in doing any policy (abort).
- */
- status = tz_get_temperature(tz, &(tz->policy.temperature));
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
-
- /*
- * Polling Frequency:
- * ------------------
- * If a _TZP object doesn't exist, use the OS default polling
- * frequency.
- */
- status = bm_evaluate_simple_integer(tz->acpi_handle, "_TZP",
- &(tz->policy.polling_freq));
- if (ACPI_FAILURE(status)) {
- tz->policy.polling_freq = TZP;
- }
- status = AE_OK;
-
/*
* Get Thresholds:
* ---------------
- * Get all of the zone's thresholds, parse, and organize for
- * later use.
*/
- status = tz_get_thresholds(tz, &(tz->policy.threshold_list));
+ status = tz_get_thresholds(tz);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
* Initialize Policies:
* --------------------
*/
- for (i = 0; i < tz->policy.threshold_list.count; i++) {
-
- threshold = &(tz->policy.threshold_list.thresholds[i]);
-
- switch (threshold->type) {
-
- case TZ_THRESHOLD_CRITICAL:
- tz->policy.critical.threshold = threshold;
- break;
-
- case TZ_THRESHOLD_PASSIVE:
-
- /*
- * Set thermal performance limit on all processors
- * to max.
- */
- for (j=0; j<threshold->cooling_devices.count; j++) {
- set_performance_limit(
- threshold->cooling_devices.handles[j],
- PR_PERF_MAX);
- }
-
- /*
- * Get passive cooling constants.
- */
- status = bm_evaluate_simple_integer(tz->acpi_handle,
- "_TC1", &(tz->policy.passive.tc1));
- if (ACPI_FAILURE(status)) {
- break;
- }
-
- status = bm_evaluate_simple_integer(tz->acpi_handle,
- "_TC2", &(tz->policy.passive.tc2));
- if (ACPI_FAILURE(status)) {
- break;
- }
-
- status = bm_evaluate_simple_integer(tz->acpi_handle,
- "_TSP", &(tz->policy.passive.tsp));
- if (ACPI_FAILURE(status)) {
- break;
- }
-
- tz->policy.passive.threshold = threshold;
-
- tz_policy_passive(tz);
-
- break;
-
- case TZ_THRESHOLD_ACTIVE:
- tz->policy.active.threshold[threshold->index] = threshold;
- tz_policy_active(tz);
- break;
- }
- }
-
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
+ if (tz->policy.thresholds.passive.is_valid) {
+ for (i=0; i<tz->policy.thresholds.passive.devices.count; i++)
+ set_performance_limit(tz->policy.thresholds.passive.devices.handles[i], PR_PERF_MAX);
+ tz_policy_passive(tz);
}
+ if (tz->policy.thresholds.active[0].is_valid)
+ tz_policy_active(tz);
/*
* Initialize Policy Timer:
* ------------------------
- * TBD: Linux-specific - remove when policy moves to user-space.
*/
init_timer(&(tz->policy.timer));
*/
tz_policy_check(tz);
- return_ACPI_STATUS(status);
+ return_ACPI_STATUS(AE_OK);
}
/*
* Delete the thermal zone policy timer entry, if exists.
*/
- if (timer_pending(&(tz->policy.timer))) {
+ if (timer_pending(&(tz->policy.timer)))
del_timer(&(tz->policy.timer));
- }
/*
* Reset thermal performance limit on all processors back to max.
*/
- if (tz->policy.passive.threshold) {
- for (i=0; i<tz->policy.passive.threshold->cooling_devices.count; i++) {
- set_performance_limit(
- tz->policy.passive.threshold->cooling_devices.handles[i],
- PR_PERF_MAX);
- }
+ if (tz->policy.thresholds.passive.is_valid) {
+ for (i=0; i<tz->policy.thresholds.passive.devices.count; i++)
+ set_performance_limit(tz->policy.thresholds.passive.devices.handles[i], PR_PERF_MAX);
}
return_ACPI_STATUS(AE_OK);
/******************************************************************************
*
* Module Name: psargs - Parse AML opcode arguments
- * $Revision: 51 $
+ * $Revision: 52 $
*
*****************************************************************************/
name_op->node = method_node;
acpi_ps_append_arg (arg, name_op);
- if (!(acpi_operand_object *) method_node->object) {
+ if (!method_node->object) {
return_VOID;
}
- *arg_count = ((acpi_operand_object *) method_node->object)->method.param_count;
+ *arg_count = (method_node->object)->method.param_count;
}
return_VOID;
/******************************************************************************
*
- * Module Name: psopcode - Parser opcode information table
- * $Revision: 41 $
+ * Module Name: psopcode - Parser/Interpreter opcode information table
+ * $Revision: 49 $
*
*****************************************************************************/
* into a 32-bit number and stored in the master opcode table at the end of this file.
*/
-#define ARGP_ZERO_OP ARG_NONE
-#define ARGP_ONE_OP ARG_NONE
+
+#define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
+#define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA)
+#define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME)
-#define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ)
-#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA)
-#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
-#define ARGP_LOCAL2 ARG_NONE
-#define ARGP_LOCAL3 ARG_NONE
-#define ARGP_LOCAL4 ARG_NONE
-#define ARGP_LOCAL5 ARG_NONE
-#define ARGP_LOCAL6 ARG_NONE
-#define ARGP_LOCAL7 ARG_NONE
#define ARGP_ARG0 ARG_NONE
#define ARGP_ARG1 ARG_NONE
#define ARGP_ARG2 ARG_NONE
#define ARGP_ARG4 ARG_NONE
#define ARGP_ARG5 ARG_NONE
#define ARGP_ARG6 ARG_NONE
-#define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME)
-#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET)
-#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST)
#define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
-#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_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_BREAK_OP ARG_NONE
+#define ARGP_BREAK_POINT_OP ARG_NONE
+#define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST)
+#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA)
+#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING)
+#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#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)
-#define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
-#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
-#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
-#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
+#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
+#define ARGP_CONTINUE_OP ARG_NONE
+#define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME)
#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
-#define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
+#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
+#define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
#define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
+#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
+#define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_DEBUG_OP ARG_NONE
+#define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG)
+#define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
+#define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET)
+#define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA)
+#define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST)
+#define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME)
+#define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG)
+#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST)
+#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_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
+#define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST)
+#define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#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_LGREATEREQUAL_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_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG)
+#define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME)
+#define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_LOCAL0 ARG_NONE
+#define ARGP_LOCAL1 ARG_NONE
+#define ARGP_LOCAL2 ARG_NONE
+#define ARGP_LOCAL3 ARG_NONE
+#define ARGP_LOCAL4 ARG_NONE
+#define ARGP_LOCAL5 ARG_NONE
+#define ARGP_LOCAL6 ARG_NONE
+#define ARGP_LOCAL7 ARG_NONE
+#define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST)
+#define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING)
#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)
+#define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA)
+#define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ)
+#define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
+#define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_NOOP_OP ARG_NONE
-#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG)
-#define ARGP_BREAK_OP ARG_NONE
-#define ARGP_BREAK_POINT_OP ARG_NONE
+#define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
+#define ARGP_ONE_OP ARG_NONE
#define ARGP_ONES_OP ARG_NONE
-#define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA)
-#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)
-#define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA)
-#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
-#define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_REVISION_OP ARG_NONE
-#define ARGP_DEBUG_OP ARG_NONE
-#define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG)
-#define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
-#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST)
-#define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
-#define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST)
+#define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST)
#define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST)
-#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)
-#define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING)
-#define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING)
-#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING)
+#define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST)
+#define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA)
+#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
+#define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
-#define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
-#define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
+#define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG)
+#define ARGP_REVISION_OP ARG_NONE
+#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST)
+#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG)
+#define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG)
#define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING)
+#define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME)
+#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST)
+#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
+#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
+#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
+#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_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME)
+#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST)
+#define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
+#define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
+#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA)
+#define ARGP_ZERO_OP ARG_NONE
/*
* (Used by Prep_operands procedure and the ASL Compiler)
*/
-#define ARGI_ZERO_OP ARG_NONE
-#define ARGI_ONE_OP ARG_NONE
+
+#define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE
+#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER)
+#define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_ALIAS_OP ARGI_INVALID_OPCODE
-#define ARGI_NAME_OP ARGI_INVALID_OPCODE
-#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
-#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
-#define ARGI_LOCAL2 ARG_NONE
-#define ARGI_LOCAL3 ARG_NONE
-#define ARGI_LOCAL4 ARG_NONE
-#define ARGI_LOCAL5 ARG_NONE
-#define ARGI_LOCAL6 ARG_NONE
-#define ARGI_LOCAL7 ARG_NONE
#define ARGI_ARG0 ARG_NONE
#define ARGI_ARG1 ARG_NONE
#define ARGI_ARG2 ARG_NONE
#define ARGI_ARG4 ARG_NONE
#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_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_BANK_FIELD_OP ARGI_INVALID_OPCODE
#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_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_BREAK_OP ARG_NONE
+#define ARGI_BREAK_POINT_OP ARG_NONE
+#define ARGI_BUFFER_OP ARGI_INVALID_OPCODE
+#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
+#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
+#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
#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_INTEGER, ARGI_TARGETREF)
-#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
-#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
-#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
-#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
+#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
+#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE
+#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET)
#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
-#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE)
+#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
+#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
+#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE)
#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
+#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
+#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
+#define ARGI_DEBUG_OP ARG_NONE
+#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
+#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REFERENCE)
+#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE
+#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF)
+#define ARGI_DWORD_OP ARGI_INVALID_OPCODE
+#define ARGI_ELSE_OP ARGI_INVALID_OPCODE
+#define ARGI_EVENT_OP ARGI_INVALID_OPCODE
+#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
+#define ARGI_FIELD_OP ARGI_INVALID_OPCODE
+#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_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_IF_OP ARGI_INVALID_OPCODE
+#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
+#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
+#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF)
#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_LGREATEREQUAL_OP ARGI_INVALID_OPCODE
#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_LLESSEQUAL_OP ARGI_INVALID_OPCODE
+#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
+#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
+#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION, ARGI_TARGETREF)
+#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_TARGETREF)
+#define ARGI_LOCAL0 ARG_NONE
+#define ARGI_LOCAL1 ARG_NONE
+#define ARGI_LOCAL2 ARG_NONE
+#define ARGI_LOCAL3 ARG_NONE
+#define ARGI_LOCAL4 ARG_NONE
+#define ARGI_LOCAL5 ARG_NONE
+#define ARGI_LOCAL6 ARG_NONE
+#define ARGI_LOCAL7 ARG_NONE
+#define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
+#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
+#define ARGI_METHOD_OP ARGI_INVALID_OPCODE
+#define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE
#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
+#define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_MUTEX_OP ARGI_INVALID_OPCODE
+#define ARGI_NAME_OP ARGI_INVALID_OPCODE
+#define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE
+#define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE
#define ARGI_NOOP_OP ARG_NONE
-#define ARGI_RETURN_OP ARGI_INVALID_OPCODE
-#define ARGI_BREAK_OP ARG_NONE
-#define ARGI_BREAK_POINT_OP ARG_NONE
+#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER)
+#define ARGI_ONE_OP ARG_NONE
#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_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_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_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_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_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
-#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
-#define ARGI_FIELD_OP ARGI_INVALID_OPCODE
-#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE
-#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE
+#define ARGI_PACKAGE_OP ARGI_INVALID_OPCODE
#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE
-#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
-#define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE
-#define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE
-#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
+#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE
+#define ARGI_QWORD_OP ARGI_INVALID_OPCODE
+#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF)
+#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
+#define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX)
#define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE
-#define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE
-#define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE
+#define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT)
+#define ARGI_RETURN_OP ARGI_INVALID_OPCODE
+#define ARGI_REVISION_OP ARG_NONE
+#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE
+#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_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT)
+#define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT)
+#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER)
+#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE
+#define ARGI_STORE_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_TARGETREF)
+#define ARGI_STRING_OP ARGI_INVALID_OPCODE
+#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE
+#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
+#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_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE)
+#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE)
+#define ARGI_VAR_PACKAGE_OP ARGI_INVALID_OPCODE
+#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER)
+#define ARGI_WHILE_OP ARGI_INVALID_OPCODE
+#define ARGI_WORD_OP ARGI_INVALID_OPCODE
+#define ARGI_ZERO_OP ARG_NONE
/*
static const acpi_opcode_info aml_op_info[] =
{
-/* Index Name Parser Args Interpreter Args Flags */
-
-/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS ),
-/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS ),
-/* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
-/* 03 */ ACPI_OP ("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
-/* 04 */ ACPI_OP ("Byte_const", ARGP_BYTE_OP, ARGI_BYTE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS ),
-/* 05 */ ACPI_OP ("Word_const", ARGP_WORD_OP, ARGI_WORD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS ),
-/* 06 */ ACPI_OP ("Dword_const", ARGP_DWORD_OP, ARGI_DWORD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS ),
-/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS ),
-/* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
-/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM| AML_HAS_ARGS),
-/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM| AML_HAS_ARGS),
-/* 0B */ ACPI_OP ("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED|AML_DEFER),
-/* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS ),
-/* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS ),
-/* 0E */ ACPI_OP ("Local2", ARGP_LOCAL2, ARGI_LOCAL2, ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS ),
-/* 0F */ ACPI_OP ("Local3", ARGP_LOCAL3, ARGI_LOCAL3, ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS ),
-/* 10 */ ACPI_OP ("Local4", ARGP_LOCAL4, ARGI_LOCAL4, ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS ),
-/* 11 */ ACPI_OP ("Local5", ARGP_LOCAL5, ARGI_LOCAL5, ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS ),
-/* 12 */ ACPI_OP ("Local6", ARGP_LOCAL6, ARGI_LOCAL6, ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS ),
-/* 13 */ ACPI_OP ("Local7", ARGP_LOCAL7, ARGI_LOCAL7, ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS ),
-/* 14 */ ACPI_OP ("Arg0", ARGP_ARG0, ARGI_ARG0, ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS ),
-/* 15 */ ACPI_OP ("Arg1", ARGP_ARG1, ARGI_ARG1, ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS ),
-/* 16 */ ACPI_OP ("Arg2", ARGP_ARG2, ARGI_ARG2, ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS ),
-/* 17 */ ACPI_OP ("Arg3", ARGP_ARG3, ARGI_ARG3, ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS ),
-/* 18 */ ACPI_OP ("Arg4", ARGP_ARG4, ARGI_ARG4, ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS ),
-/* 19 */ ACPI_OP ("Arg5", ARGP_ARG5, ARGI_ARG5, ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS ),
-/* 1_a */ ACPI_OP ("Arg6", ARGP_ARG6, ARGI_ARG6, ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS ),
-/* 1_b */ ACPI_OP ("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS),
-/* 1_c */ ACPI_OP ("Ref_of", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS),
-/* 1_d */ ACPI_OP ("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS),
-/* 1_e */ ACPI_OP ("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS),
-/* 1_f */ ACPI_OP ("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS),
-/* 20 */ ACPI_OP ("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS),
-/* 21 */ ACPI_OP ("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS),
-/* 22 */ ACPI_OP ("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS),
-/* 23 */ ACPI_OP ("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS),
-/* 24 */ ACPI_OP ("Shift_left", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS),
-/* 25 */ ACPI_OP ("Shift_right", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS),
-/* 26 */ ACPI_OP ("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS),
-/* 27 */ ACPI_OP ("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS),
-/* 28 */ ACPI_OP ("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS),
-/* 29 */ ACPI_OP ("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS),
-/* 2_a */ ACPI_OP ("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS),
-/* 2_b */ ACPI_OP ("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS),
-/* 2_c */ ACPI_OP ("Find_set_left_bit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS),
-/* 2_d */ ACPI_OP ("Find_set_right_bit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS),
-/* 2_e */ ACPI_OP ("Deref_of", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS),
-/* 2_f */ ACPI_OP ("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC1| AML_HAS_ARGS),
-/* 30 */ ACPI_OP ("Size_of", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS),
-/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_TRIADIC| AML_HAS_ARGS),
-/* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_HEXADIC| AML_HAS_ARGS),
-/* 33 */ ACPI_OP ("Create_dWord_field", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS|AML_NSOBJECT|AML_NSNODE|AML_DEFER|AML_CREATE),
-/* 34 */ ACPI_OP ("Create_word_field", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS|AML_NSOBJECT|AML_NSNODE|AML_DEFER|AML_CREATE),
-/* 35 */ ACPI_OP ("Create_byte_field", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS|AML_NSOBJECT|AML_NSNODE|AML_DEFER|AML_CREATE),
-/* 36 */ ACPI_OP ("Create_bit_field", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS|AML_NSOBJECT|AML_NSNODE|AML_DEFER|AML_CREATE),
-/* 37 */ ACPI_OP ("Object_type", ARGP_TYPE_OP, ARGI_TYPE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS),
-/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS),
-/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS),
-/* 3_a */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS),
-/* 3_b */ ACPI_OP ("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS),
-/* 3_c */ ACPI_OP ("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS),
-/* 3_d */ ACPI_OP ("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS),
-/* 3_e */ ACPI_OP ("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS),
-/* 3_f */ ACPI_OP ("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS),
-/* 40 */ ACPI_OP ("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS),
-/* 41 */ ACPI_OP ("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS ),
-/* 42 */ ACPI_OP ("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS),
-/* 43 */ ACPI_OP ("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS ),
-/* 44 */ ACPI_OP ("Break_point", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS ),
-/* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS ),
+/* Index Name Parser Args Interpreter Args Class Type Flags */
+
+/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
+/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
+/* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 03 */ ACPI_OP ("Name", ARGP_NAME_OP, ARGI_NAME_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 04 */ ACPI_OP ("Byte_const", ARGP_BYTE_OP, ARGI_BYTE_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
+/* 05 */ ACPI_OP ("Word_const", ARGP_WORD_OP, ARGI_WORD_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
+/* 06 */ ACPI_OP ("Dword_const", ARGP_DWORD_OP, ARGI_DWORD_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
+/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
+/* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS),
+/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS),
+/* 0B */ ACPI_OP ("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
+/* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 0E */ ACPI_OP ("Local2", ARGP_LOCAL2, ARGI_LOCAL2, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 0F */ ACPI_OP ("Local3", ARGP_LOCAL3, ARGI_LOCAL3, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 10 */ ACPI_OP ("Local4", ARGP_LOCAL4, ARGI_LOCAL4, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 11 */ ACPI_OP ("Local5", ARGP_LOCAL5, ARGI_LOCAL5, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 12 */ ACPI_OP ("Local6", ARGP_LOCAL6, ARGI_LOCAL6, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 13 */ ACPI_OP ("Local7", ARGP_LOCAL7, ARGI_LOCAL7, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
+/* 14 */ ACPI_OP ("Arg0", ARGP_ARG0, ARGI_ARG0, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 15 */ ACPI_OP ("Arg1", ARGP_ARG1, ARGI_ARG1, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 16 */ ACPI_OP ("Arg2", ARGP_ARG2, ARGI_ARG2, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 17 */ ACPI_OP ("Arg3", ARGP_ARG3, ARGI_ARG3, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 18 */ ACPI_OP ("Arg4", ARGP_ARG4, ARGI_ARG4, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 19 */ ACPI_OP ("Arg5", ARGP_ARG5, ARGI_ARG5, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 1_a */ ACPI_OP ("Arg6", ARGP_ARG6, ARGI_ARG6, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
+/* 1_b */ ACPI_OP ("Store", ARGP_STORE_OP, ARGI_STORE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 1_c */ ACPI_OP ("Ref_of", ARGP_REF_OF_OP, ARGI_REF_OF_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 1_d */ ACPI_OP ("Add", ARGP_ADD_OP, ARGI_ADD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 1_e */ ACPI_OP ("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
+/* 1_f */ ACPI_OP ("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 20 */ ACPI_OP ("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 21 */ ACPI_OP ("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 22 */ ACPI_OP ("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 23 */ ACPI_OP ("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_2T_1R, AML_FLAGS_EXEC_2A_2T_1R),
+/* 24 */ ACPI_OP ("Shift_left", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 25 */ ACPI_OP ("Shift_right", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 26 */ ACPI_OP ("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 27 */ ACPI_OP ("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 28 */ ACPI_OP ("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 29 */ ACPI_OP ("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 2_a */ ACPI_OP ("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH),
+/* 2_b */ ACPI_OP ("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 2_c */ ACPI_OP ("Find_set_left_bit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 2_d */ ACPI_OP ("Find_set_right_bit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 2_e */ ACPI_OP ("Deref_of", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 2_f */ ACPI_OP ("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R),
+/* 30 */ ACPI_OP ("Size_of", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
+/* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
+/* 33 */ ACPI_OP ("Create_dWord_field", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
+/* 34 */ ACPI_OP ("Create_word_field", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
+/* 35 */ ACPI_OP ("Create_byte_field", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
+/* 36 */ ACPI_OP ("Create_bit_field", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
+/* 37 */ ACPI_OP ("Object_type", ARGP_TYPE_OP, ARGI_TYPE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL),
+/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL),
+/* 3_a */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 3_b */ ACPI_OP ("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL),
+/* 3_c */ ACPI_OP ("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL),
+/* 3_d */ ACPI_OP ("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL),
+/* 3_e */ ACPI_OP ("If", ARGP_IF_OP, ARGI_IF_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 3_f */ ACPI_OP ("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 40 */ ACPI_OP ("While", ARGP_WHILE_OP, ARGI_WHILE_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 41 */ ACPI_OP ("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 42 */ ACPI_OP ("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 43 */ ACPI_OP ("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 44 */ ACPI_OP ("Break_point", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
/* Prefixed opcodes (Two-byte opcodes with a prefix op) */
-/* 46 */ ACPI_OP ("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
-/* 47 */ ACPI_OP ("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_NO_ARGS |AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED ),
-/* 48 */ ACPI_OP ("Cond_ref_of", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS),
-/* 49 */ ACPI_OP ("Create_field", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS|AML_NSOBJECT|AML_NSNODE|AML_DEFER|AML_FIELD|AML_CREATE),
-/* 4_a */ ACPI_OP ("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS),
-/* 4_b */ ACPI_OP ("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS),
-/* 4_c */ ACPI_OP ("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS),
-/* 4_d */ ACPI_OP ("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_s| AML_HAS_ARGS),
-/* 4_e */ ACPI_OP ("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS),
-/* 4_f */ ACPI_OP ("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_s| AML_HAS_ARGS),
-/* 50 */ ACPI_OP ("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS),
-/* 51 */ ACPI_OP ("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS),
-/* 52 */ ACPI_OP ("From_bCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS),
-/* 53 */ ACPI_OP ("To_bCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS),
-/* 54 */ ACPI_OP ("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS),
-/* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS ),
-/* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS ),
-/* 57 */ ACPI_OP ("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_TRIADIC| AML_HAS_ARGS),
-/* 58 */ ACPI_OP ("Op_region", ARGP_REGION_OP, ARGI_REGION_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED|AML_DEFER),
-/* 59 */ ACPI_OP ("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_FIELD),
-/* 5_a */ ACPI_OP ("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
-/* 5_b */ ACPI_OP ("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
-/* 5_c */ ACPI_OP ("Power_resource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
-/* 5_d */ ACPI_OP ("Thermal_zone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED),
-/* 5_e */ ACPI_OP ("Index_field", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_FIELD),
-/* 5_f */ ACPI_OP ("Bank_field", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_FIELD),
+/* 46 */ ACPI_OP ("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 47 */ ACPI_OP ("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ),
+/* 48 */ ACPI_OP ("Cond_ref_of", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 49 */ ACPI_OP ("Create_field", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_FIELD | AML_CREATE),
+/* 4_a */ ACPI_OP ("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R, AML_FLAGS_EXEC_1A_1T_0R),
+/* 4_b */ ACPI_OP ("Stall", ARGP_STALL_OP, ARGI_STALL_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 4_c */ ACPI_OP ("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 4_d */ ACPI_OP ("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R),
+/* 4_e */ ACPI_OP ("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 4_f */ ACPI_OP ("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R),
+/* 50 */ ACPI_OP ("Reset", ARGP_RESET_OP, ARGI_RESET_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 51 */ ACPI_OP ("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 52 */ ACPI_OP ("From_bCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 53 */ ACPI_OP ("To_bCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 54 */ ACPI_OP ("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
+/* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
+/* 57 */ ACPI_OP ("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R),
+/* 58 */ ACPI_OP ("Op_region", ARGP_REGION_OP, ARGI_REGION_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
+/* 59 */ ACPI_OP ("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
+/* 5_a */ ACPI_OP ("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 5_b */ ACPI_OP ("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 5_c */ ACPI_OP ("Power_resource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 5_d */ ACPI_OP ("Thermal_zone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 5_e */ ACPI_OP ("Index_field", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
+/* 5_f */ ACPI_OP ("Bank_field", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
/* Internal opcodes that map to invalid AML opcodes */
-/* 60 */ ACPI_OP ("LNot_equal", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_HAS_ARGS),
-/* 61 */ ACPI_OP ("LLess_equal", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_HAS_ARGS),
-/* 62 */ ACPI_OP ("LGreater_equal", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_HAS_ARGS),
-/* 63 */ ACPI_OP ("[Name_path]", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS|AML_NSOBJECT|AML_NSNODE ),
-/* 64 */ ACPI_OP ("[Method_call]", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_CALL| AML_HAS_ARGS|AML_NSOBJECT|AML_NSNODE),
-/* 65 */ ACPI_OP ("[Byte_list]", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS ),
-/* 66 */ ACPI_OP ("[Reserved_field]", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS ),
-/* 67 */ ACPI_OP ("[Named_field]", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED ),
-/* 68 */ ACPI_OP ("[Access_field]", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS ),
-/* 69 */ ACPI_OP ("[Static_string", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS ),
-/* 6_a */ ACPI_OP ("[Return Value]", ARG_NONE, ARG_NONE, ACPI_OP_TYPE_OPCODE | OPTYPE_RETURN| AML_HAS_ARGS),
-/* 6_b */ ACPI_OP ("UNKNOWN_OP!", ARG_NONE, ARG_NONE, ACPI_OP_TYPE_UNKNOWN | OPTYPE_BOGUS| AML_HAS_ARGS),
-/* 6_c */ ACPI_OP ("ASCII_ONLY!", ARG_NONE, ARG_NONE, ACPI_OP_TYPE_ASCII | OPTYPE_BOGUS| AML_HAS_ARGS),
-/* 6_d */ ACPI_OP ("PREFIX_ONLY!", ARG_NONE, ARG_NONE, ACPI_OP_TYPE_PREFIX | OPTYPE_BOGUS| AML_HAS_ARGS),
-
-
-/* ACPI 2.0 (new) opcodes */
-
-/* 6_e */ ACPI_OP ("Qword_const", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS ),
-/* 6_f */ ACPI_OP ("Var_package", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM| AML_HAS_ARGS|AML_DEFER),
-/* 70 */ ACPI_OP ("Concat_res", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS),
-/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS),
-/* 72 */ ACPI_OP ("Create_qWord_field", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS|AML_NSOBJECT|AML_NSNODE|AML_DEFER|AML_CREATE),
-/* 73 */ ACPI_OP ("To_buffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS),
-/* 74 */ ACPI_OP ("To_decimal_string", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS),
-/* 75 */ ACPI_OP ("To_hex_string", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS),
-/* 76 */ ACPI_OP ("To_integer", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS),
-/* 77 */ ACPI_OP ("To_string", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS),
-/* 78 */ ACPI_OP ("Copy_object", ARGP_COPY_OP, ARGI_COPY_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS),
-/* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS),
-/* 7_a */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS ),
-/* 7_b */ ACPI_OP ("Load_table", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS),
-/* 7_c */ ACPI_OP ("Data_op_region", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS),
+/* 60 */ ACPI_OP ("LNot_equal", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 61 */ ACPI_OP ("LLess_equal", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 62 */ ACPI_OP ("LGreater_equal", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 63 */ ACPI_OP ("[Name_path]", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE ),
+/* 64 */ ACPI_OP ("[Method_call]", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, AML_CLASS_METHOD_CALL, AML_TYPE_METHOD_CALL, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE),
+/* 65 */ ACPI_OP ("[Byte_list]", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
+/* 66 */ ACPI_OP ("[Reserved_field]", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
+/* 67 */ ACPI_OP ("[Named_field]", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ),
+/* 68 */ ACPI_OP ("[Access_field]", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
+/* 69 */ ACPI_OP ("[Static_string", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
+/* 6_a */ ACPI_OP ("[Return Value]", ARG_NONE, ARG_NONE, AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN, AML_HAS_ARGS | AML_HAS_RETVAL),
+/* 6_b */ ACPI_OP ("UNKNOWN_OP!", ARG_NONE, ARG_NONE, AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 6_c */ ACPI_OP ("ASCII_ONLY!", ARG_NONE, ARG_NONE, AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 6_d */ ACPI_OP ("PREFIX_ONLY!", ARG_NONE, ARG_NONE, AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS),
+
+
+/* ACPI 2.0 opcodes */
+
+/* 6_e */ ACPI_OP ("Qword_const", ARGP_QWORD_OP, ARGI_QWORD_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
+/* 6_f */ ACPI_OP ("Var_package", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS | AML_DEFER),
+/* 70 */ ACPI_OP ("Concat_res", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
+/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
+/* 72 */ ACPI_OP ("Create_qWord_field", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
+/* 73 */ ACPI_OP ("To_buffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 74 */ ACPI_OP ("To_decimal_string", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 75 */ ACPI_OP ("To_hex_string", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 76 */ ACPI_OP ("To_integer", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 77 */ ACPI_OP ("To_string", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
+/* 78 */ ACPI_OP ("Copy_object", ARGP_COPY_OP, ARGI_COPY_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R),
+/* 7_a */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 7_b */ ACPI_OP ("Load_table", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
+/* 7_c */ ACPI_OP ("Data_op_region", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
};
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
- * $Revision: 96 $
+ * $Revision: 104 $
*
*****************************************************************************/
/* Extended opcode */
opcode = (u16) ((opcode << 8) | GET8 (aml));
- aml++;
}
- /* don't convert bare name to a namepath */
return (opcode);
}
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ps_create_state
- *
- * PARAMETERS: Aml - Aml code pointer
- * Aml_size - Length of AML code
- *
- * RETURN: A new parser state object
- *
- * DESCRIPTION: Create and initialize a new parser state object
- *
- ******************************************************************************/
-
-acpi_parse_state *
-acpi_ps_create_state (
- u8 *aml,
- u32 aml_size)
-{
- acpi_parse_state *parser_state;
-
-
- FUNCTION_TRACE ("Ps_create_state");
-
-
- parser_state = ACPI_MEM_CALLOCATE (sizeof (acpi_parse_state));
- if (!parser_state) {
- return_PTR (NULL);
- }
-
- parser_state->aml = aml;
- parser_state->aml_end = aml + aml_size;
- parser_state->pkg_end = parser_state->aml_end;
- parser_state->aml_start = aml;
-
-
- return_PTR (parser_state);
-}
-
-
/*******************************************************************************
*
* FUNCTION: Acpi_ps_find_object
acpi_status
acpi_ps_find_object (
- u16 opcode,
- acpi_parse_object *op,
acpi_walk_state *walk_state,
acpi_parse_object **out_op)
{
NATIVE_CHAR *path;
- const acpi_opcode_info *op_info;
/* We are only interested in opcodes that have an associated name */
- op_info = acpi_ps_get_opcode_info (opcode);
- if (!(op_info->flags & AML_NAMED)) {
- *out_op = op;
+ if (!(walk_state->op_info->flags & AML_NAMED)) {
+ *out_op = walk_state->op;
return (AE_OK);
}
/* Find the name in the parse tree */
- path = acpi_ps_get_next_namestring (walk_state->parser_state);
+ path = acpi_ps_get_next_namestring (&walk_state->parser_state);
- *out_op = acpi_ps_find (acpi_ps_get_parent_scope (walk_state->parser_state),
- path, opcode, 1);
+ *out_op = acpi_ps_find (acpi_ps_get_parent_scope (&walk_state->parser_state),
+ path, walk_state->opcode, 1);
if (!(*out_op)) {
return (AE_NOT_FOUND);
#ifndef PARSER_ONLY
acpi_parse_object *prev;
acpi_parse_object *next;
- const acpi_opcode_info *op_info;
const acpi_opcode_info *parent_info;
- u32 opcode_class;
acpi_parse_object *replacement_op = NULL;
FUNCTION_TRACE_PTR ("Ps_complete_this_op", op);
- op_info = acpi_ps_get_opcode_info (op->opcode);
- opcode_class = ACPI_GET_OP_CLASS (op_info);
-
-
/* Delete this op and the subtree below it if asked to */
if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) == ACPI_PARSE_DELETE_TREE) &&
- (opcode_class != OPTYPE_CONSTANT) &&
- (opcode_class != OPTYPE_LITERAL) &&
- (opcode_class != OPTYPE_LOCAL_VARIABLE) &&
- (opcode_class != OPTYPE_METHOD_ARGUMENT) &&
- (opcode_class != OPTYPE_DATA_TERM) &&
- (op->opcode != AML_INT_NAMEPATH_OP)) {
+ (walk_state->op_info->class != AML_CLASS_ARGUMENT)) {
/* Make sure that we only delete this subtree */
if (op->parent) {
*/
parent_info = acpi_ps_get_opcode_info (op->parent->opcode);
- switch (ACPI_GET_OP_CLASS (parent_info)) {
- case OPTYPE_CONTROL: /* IF, ELSE, WHILE only */
+ switch (parent_info->class) {
+ case AML_CLASS_CONTROL: /* IF, ELSE, WHILE only */
break;
- case OPTYPE_NAMED_OBJECT: /* Scope, method, etc. */
+ case AML_CLASS_NAMED_OBJECT: /* Scope, method, etc. */
+ case AML_CLASS_CREATE:
/*
* These opcodes contain Term_arg operands. The current
acpi_parse_object *op,
acpi_status callback_status)
{
- acpi_parse_state *parser_state = walk_state->parser_state;
+ acpi_parse_state *parser_state = &walk_state->parser_state;
acpi_status status = AE_CTRL_PENDING;
u8 *start;
u32 package_length;
{
acpi_status status = AE_OK;
acpi_parse_object *op = NULL; /* current op */
- const acpi_opcode_info *op_info;
acpi_parse_object *arg = NULL;
- acpi_parse2_object *deferred_op;
- u32 arg_count; /* push for fixed or var args */
- u32 arg_types = 0;
- u32 aml_offset;
- u16 opcode;
acpi_parse_object pre_op;
acpi_parse_state *parser_state;
u8 *aml_op_start;
FUNCTION_TRACE_PTR ("Ps_parse_loop", walk_state);
- parser_state = walk_state->parser_state;
+ parser_state = &walk_state->parser_state;
+ walk_state->arg_types = 0;
#ifndef PARSER_ONLY
if (walk_state->walk_type & WALK_METHOD_RESTART) {
* was just completed
*/
if ((parser_state->scope->parse_scope.op) &&
- ((parser_state->scope->parse_scope.op->opcode == AML_IF_OP) ||
+ ((parser_state->scope->parse_scope.op->opcode == AML_IF_OP) ||
(parser_state->scope->parse_scope.op->opcode == AML_WHILE_OP)) &&
(walk_state->control_state) &&
(walk_state->control_state->common.state ==
* A predicate was just completed, get the value of the
* predicate and branch based on that value
*/
- status = acpi_ds_get_predicate_value (walk_state, NULL, TRUE);
+ walk_state->op = NULL;
+ status = acpi_ds_get_predicate_value (walk_state, TRUE);
if (ACPI_FAILURE (status) &&
((status & AE_CODE_MASK) != AE_CODE_CONTROL)) {
if (status == AE_AML_NO_RETURN_VALUE) {
status = acpi_ps_next_parse_state (walk_state, op, status);
}
- acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
+ acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
}
/* We were in the middle of an op */
op = walk_state->prev_op;
- arg_types = walk_state->prev_arg_types;
+ walk_state->arg_types = walk_state->prev_arg_types;
}
}
#endif
/* Get the next opcode from the AML stream */
aml_op_start = parser_state->aml;
- aml_offset = parser_state->aml - parser_state->aml_start;
- opcode = acpi_ps_peek_opcode (parser_state);
+ walk_state->aml_offset = parser_state->aml - parser_state->aml_start;
+ walk_state->opcode = acpi_ps_peek_opcode (parser_state);
/*
* First cut to determine what we have found:
* 2) A name string
* 3) An unknown/invalid opcode
*/
- op_info = acpi_ps_get_opcode_info (opcode);
- switch (ACPI_GET_OP_TYPE (op_info)) {
- case ACPI_OP_TYPE_OPCODE:
-
- /* Found opcode info, this is a normal opcode */
-
- parser_state->aml += acpi_ps_get_opcode_size (opcode);
- arg_types = op_info->parse_args;
- break;
-
- case ACPI_OP_TYPE_ASCII:
- case ACPI_OP_TYPE_PREFIX:
+ walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
+ switch (walk_state->op_info->class) {
+ case AML_CLASS_ASCII:
+ case AML_CLASS_PREFIX:
/*
* Starts with a valid prefix or ASCII char, this is a name
* string. Convert the bare name string to a namepath.
*/
- opcode = AML_INT_NAMEPATH_OP;
- arg_types = ARGP_NAMESTRING;
+ walk_state->opcode = AML_INT_NAMEPATH_OP;
+ walk_state->arg_types = ARGP_NAMESTRING;
break;
- case ACPI_OP_TYPE_UNKNOWN:
+ case AML_CLASS_UNKNOWN:
/* The opcode is unrecognized. Just skip unknown opcodes */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Found unknown opcode %lX at AML offset %X, ignoring\n",
- opcode, aml_offset));
+ "Found unknown opcode %X at AML offset %X, ignoring\n",
+ walk_state->opcode, walk_state->aml_offset));
DUMP_BUFFER (parser_state->aml, 128);
parser_state->aml++;
continue;
+
+ default:
+
+ /* Found opcode info, this is a normal opcode */
+
+ parser_state->aml += acpi_ps_get_opcode_size (walk_state->opcode);
+ walk_state->arg_types = walk_state->op_info->parse_args;
+ break;
+
}
/* Create Op structure and append to parent's argument list */
- if (op_info->flags & AML_NAMED) {
+ if (walk_state->op_info->flags & AML_NAMED) {
pre_op.value.arg = NULL;
- pre_op.opcode = opcode;
+ pre_op.opcode = walk_state->opcode;
- while (GET_CURRENT_ARG_TYPE (arg_types) != ARGP_NAME) {
+ while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) != ARGP_NAME) {
arg = acpi_ps_get_next_arg (parser_state,
- GET_CURRENT_ARG_TYPE (arg_types),
- &arg_count);
+ GET_CURRENT_ARG_TYPE (walk_state->arg_types),
+ &walk_state->arg_count);
acpi_ps_append_arg (&pre_op, arg);
- INCREMENT_ARG_LIST (arg_types);
+ INCREMENT_ARG_LIST (walk_state->arg_types);
}
/* We know that this arg is a name, move to next arg */
- INCREMENT_ARG_LIST (arg_types);
+ INCREMENT_ARG_LIST (walk_state->arg_types);
if (walk_state->descending_callback != NULL) {
/*
* Find the object. This will either insert the object into
* the namespace or simply look it up
*/
- status = walk_state->descending_callback (opcode, NULL, walk_state, &op);
+ walk_state->op = NULL;
+
+ status = walk_state->descending_callback (walk_state, &op);
+
+ /* TBD: check status here? */
+
+ if (ACPI_FAILURE (status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n",
+ acpi_format_exception (status)));
+ goto close_this_op;
+ }
+
if (op == NULL) {
continue;
}
if (op->opcode == AML_REGION_OP) {
- deferred_op = (acpi_parse2_object *) op;
-
/*
* Defer final parsing of an Operation_region body,
* because we don't have enough info in the first pass
*
* (Length is unknown until parse of the body complete)
*/
- deferred_op->data = aml_op_start;
- deferred_op->length = 0;
+ ((acpi_parse2_object * ) op)->data = aml_op_start;
+ ((acpi_parse2_object * ) op)->length = 0;
}
}
else {
/* Not a named opcode, just allocate Op and append to parent */
- op_info = acpi_ps_get_opcode_info (opcode);
- op = acpi_ps_alloc_op (opcode);
+ walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
+ op = acpi_ps_alloc_op (walk_state->opcode);
if (!op) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
- if (op_info->flags & AML_CREATE) {
+ if (walk_state->op_info->flags & AML_CREATE) {
/*
* Backup to beginning of Create_xXXfield declaration
* Body_length is unknown until we parse the body
*/
- deferred_op = (acpi_parse2_object *) op;
-
- deferred_op->data = aml_op_start;
- deferred_op->length = 0;
+ ((acpi_parse2_object * ) op)->data = aml_op_start;
+ ((acpi_parse2_object * ) op)->length = 0;
}
acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op);
* Find the object. This will either insert the object into
* the namespace or simply look it up
*/
- status = walk_state->descending_callback (opcode, op, walk_state, &op);
+ walk_state->op = op;
+
+ status = walk_state->descending_callback (walk_state, &op);
status = acpi_ps_next_parse_state (walk_state, op, status);
if (status == AE_CTRL_PENDING) {
status = AE_OK;
}
}
- op->aml_offset = aml_offset;
+ op->aml_offset = walk_state->aml_offset;
- if (op_info) {
+ if (walk_state->op_info) {
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "Op=%p Opcode=%4.4lX Aml %p Oft=%5.5lX\n",
+ "Op=%p Opcode=%4.4X Aml %p Oft=%5.5X\n",
op, op->opcode, parser_state->aml, op->aml_offset));
}
}
/* Start Arg_count at zero because we don't know if there are any args yet */
- arg_count = 0;
+ walk_state->arg_count = 0;
- if (arg_types) /* Are there any arguments that must be processed? */ {
+ if (walk_state->arg_types) /* Are there any arguments that must be processed? */ {
/* get arguments */
switch (op->opcode) {
/* fill in constant or string argument directly */
acpi_ps_get_next_simple_arg (parser_state,
- GET_CURRENT_ARG_TYPE (arg_types), op);
+ GET_CURRENT_ARG_TYPE (walk_state->arg_types), op);
break;
case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
- acpi_ps_get_next_namepath (parser_state, op, &arg_count, 1);
- arg_types = 0;
+ acpi_ps_get_next_namepath (parser_state, op, &walk_state->arg_count, 1);
+ walk_state->arg_types = 0;
break;
/* Op is not a constant or string, append each argument */
- while (GET_CURRENT_ARG_TYPE (arg_types) && !arg_count) {
- aml_offset = parser_state->aml - parser_state->aml_start;
+ while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && !walk_state->arg_count) {
+ walk_state->aml_offset = parser_state->aml - parser_state->aml_start;
arg = acpi_ps_get_next_arg (parser_state,
- GET_CURRENT_ARG_TYPE (arg_types),
- &arg_count);
+ GET_CURRENT_ARG_TYPE (walk_state->arg_types),
+ &walk_state->arg_count);
if (arg) {
- arg->aml_offset = aml_offset;
+ arg->aml_offset = walk_state->aml_offset;
acpi_ps_append_arg (op, arg);
}
- INCREMENT_ARG_LIST (arg_types);
+ INCREMENT_ARG_LIST (walk_state->arg_types);
}
/* For a method, save the length and address of the body */
if (op->opcode == AML_METHOD_OP) {
- deferred_op = (acpi_parse2_object *) op;
-
/*
* Skip parsing of control method or opregion body,
* because we don't have enough info in the first pass
* to parse them correctly.
*/
- deferred_op->data = parser_state->aml;
- deferred_op->length = (u32) (parser_state->pkg_end -
+ ((acpi_parse2_object * ) op)->data = parser_state->aml;
+ ((acpi_parse2_object * ) op)->length = (u32) (parser_state->pkg_end -
parser_state->aml);
/*
* package (We don't know where the end is).
*/
parser_state->aml = parser_state->pkg_end;
- arg_count = 0;
+ walk_state->arg_count = 0;
}
break;
/*
* Zero Arg_count means that all arguments for this op have been processed
*/
- if (!arg_count) {
+ if (!walk_state->arg_count) {
/* completed Op, prepare for next */
- op_info = acpi_ps_get_opcode_info (op->opcode);
- if (op_info->flags & AML_NAMED) {
+ walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
+ if (walk_state->op_info->flags & AML_NAMED) {
if (acpi_gbl_depth) {
acpi_gbl_depth--;
}
if (op->opcode == AML_REGION_OP) {
- deferred_op = (acpi_parse2_object *) op;
-
/*
* Skip parsing of control method or opregion body,
* because we don't have enough info in the first pass
* Completed parsing an Op_region declaration, we now
* know the length.
*/
- deferred_op->length = (u32) (parser_state->aml -
- deferred_op->data);
+ ((acpi_parse2_object * ) op)->length = (u32) (parser_state->aml -
+ ((acpi_parse2_object * ) op)->data);
}
}
- if (op_info->flags & AML_CREATE) {
+ if (walk_state->op_info->flags & AML_CREATE) {
/*
* Backup to beginning of Create_xXXfield declaration (1 for
* Opcode)
*
* Body_length is unknown until we parse the body
*/
- deferred_op = (acpi_parse2_object *) op;
- deferred_op->length = (u32) (parser_state->aml -
- deferred_op->data);
+ ((acpi_parse2_object * ) op)->length = (u32) (parser_state->aml -
+ ((acpi_parse2_object * ) op)->data);
}
/* This op complete, notify the dispatcher */
if (walk_state->ascending_callback != NULL) {
- status = walk_state->ascending_callback (walk_state, op);
+ walk_state->op = op;
+ walk_state->opcode = op->opcode;
+
+ status = walk_state->ascending_callback (walk_state);
status = acpi_ps_next_parse_state (walk_state, op, status);
if (status == AE_CTRL_PENDING) {
status = AE_OK;
* We are about to transfer to a called method.
*/
walk_state->prev_op = op;
- walk_state->prev_arg_types = arg_types;
+ walk_state->prev_arg_types = walk_state->arg_types;
return_ACPI_STATUS (status);
break;
case AE_CTRL_END:
- acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
+ acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
+
+ walk_state->op = op;
+ walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
+ walk_state->opcode = op->opcode;
- status = walk_state->ascending_callback (walk_state, op);
+ status = walk_state->ascending_callback (walk_state);
status = acpi_ps_next_parse_state (walk_state, op, status);
acpi_ps_complete_this_op (walk_state, op);
acpi_ps_complete_this_op (walk_state, op);
}
- acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
+ acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
} while (op);
return_ACPI_STATUS (status);
default: /* All other non-AE_OK status */
if (op == NULL) {
- acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
+ acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
}
walk_state->prev_op = op;
- walk_state->prev_arg_types = arg_types;
+ walk_state->prev_arg_types = walk_state->arg_types;
/*
* TEMP:
/* This scope complete? */
if (acpi_ps_has_completed_scope (parser_state)) {
- acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
+ acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
}
else {
/* complex argument, push Op and prepare for argument */
- acpi_ps_push_scope (parser_state, op, arg_types, arg_count);
+ acpi_ps_push_scope (parser_state, op, walk_state->arg_types, walk_state->arg_count);
op = NULL;
}
/*
* Complete the last Op (if not completed), and clear the scope stack.
* It is easily possible to end an AML "package" with an unbounded number
- * of open scopes (such as when several AML blocks are closed with
+ * of open scopes (such as when several ASL blocks are closed with
* sequential closing braces). We want to terminate each one cleanly.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Package complete at Op %p\n", op));
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", op));
do {
if (op) {
if (walk_state->ascending_callback != NULL) {
- status = walk_state->ascending_callback (walk_state, op);
+ walk_state->op = op;
+ walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
+ walk_state->opcode = op->opcode;
+
+ status = walk_state->ascending_callback (walk_state);
status = acpi_ps_next_parse_state (walk_state, op, status);
if (status == AE_CTRL_PENDING) {
status = AE_OK;
acpi_ps_complete_this_op (walk_state, op);
}
- acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
+ acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
} while (op);
acpi_ps_complete_this_op (walk_state, op);
}
- acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
+ acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
} while (op);
acpi_status
acpi_ps_parse_aml (
- acpi_parse_object *start_scope,
- u8 *aml,
- u32 aml_size,
- u32 parse_flags,
- acpi_namespace_node *method_node,
- acpi_operand_object **params,
- acpi_operand_object **caller_return_desc,
- acpi_parse_downwards descending_callback,
- acpi_parse_upwards ascending_callback)
+ acpi_walk_state *walk_state)
{
acpi_status status;
- acpi_parse_state *parser_state;
- acpi_walk_state *walk_state;
acpi_walk_list walk_list;
acpi_walk_list *prev_walk_list = acpi_gbl_current_walk_list;
- acpi_operand_object *return_desc;
- acpi_operand_object *mth_desc = NULL;
+ acpi_walk_state *previous_walk_state;
FUNCTION_TRACE ("Ps_parse_aml");
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Entered with Scope=%p Aml=%p size=%lX\n",
- start_scope, aml, aml_size));
-
-
- /* Create and initialize a new parser state */
-
- parser_state = acpi_ps_create_state (aml, aml_size);
- if (!parser_state) {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Entered with Walk_state=%p Aml=%p size=%X\n",
+ walk_state, walk_state->parser_state.aml, walk_state->parser_state.aml_size));
- acpi_ps_init_scope (parser_state, start_scope);
-
- if (method_node) {
- mth_desc = acpi_ns_get_attached_object (method_node);
- }
/* Create and initialize a new walk list */
- walk_list.walk_state = NULL;
+ walk_list.walk_state = NULL;
walk_list.acquired_mutex_list.prev = NULL;
walk_list.acquired_mutex_list.next = NULL;
- walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, parser_state->start_op,
- mth_desc, &walk_list);
- if (!walk_state) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
+ walk_state->walk_list = &walk_list;
+ acpi_ds_push_walk_state (walk_state, &walk_list);
- walk_state->method_node = method_node;
- walk_state->parser_state = parser_state;
- walk_state->parse_flags = parse_flags;
- walk_state->descending_callback = descending_callback;
- walk_state->ascending_callback = ascending_callback;
/* TBD: [Restructure] TEMP until we pass Walk_state to the interpreter
*/
acpi_gbl_current_walk_list = &walk_list;
-
- if (method_node) {
- parser_state->start_node = method_node;
- walk_state->walk_type = WALK_METHOD;
-
- /* Push start scope on scope stack and make it current */
-
- status = acpi_ds_scope_stack_push (method_node, ACPI_TYPE_METHOD, walk_state);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
- /* Init arguments if this is a control method */
- /* TBD: [Restructure] add walkstate as a param */
-
- acpi_ds_method_data_init_args (params, MTH_NUM_ARGS, walk_state);
- }
-
- else {
- /* Setup the current scope */
-
- parser_state->start_node = parser_state->start_op->node;
- if (parser_state->start_node) {
- /* Push start scope on scope stack and make it current */
-
- status = acpi_ds_scope_stack_push (parser_state->start_node,
- parser_state->start_node->type, walk_state);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
-
- }
- }
-
/*
* Execute the walk loop as long as there is a valid Walk State. This
* handles nested control method invocations without recursion.
status = AE_OK;
while (walk_state) {
if (ACPI_SUCCESS (status)) {
+ /*
+ * The Parse_loop executes AML until the method terminates
+ * or calls another method.
+ */
status = acpi_ps_parse_loop (walk_state);
}
walk_state = acpi_ds_pop_walk_state (&walk_list);
- /* Extract return value before we delete Walk_state */
-
- return_desc = walk_state->return_desc;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Return_value=%p, State=%p\n",
- walk_state->return_desc, walk_state));
-
/* Reset the current scope to the beginning of scope stack */
acpi_ds_scope_stack_clear (walk_state);
/* Delete this walk state and all linked control states */
- acpi_ps_cleanup_scope (walk_state->parser_state);
- ACPI_MEM_FREE (walk_state->parser_state);
- acpi_ds_delete_walk_state (walk_state);
+ acpi_ps_cleanup_scope (&walk_state->parser_state);
+
+ previous_walk_state = walk_state;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Return_value=%p, State=%p\n",
+ walk_state->return_desc, walk_state));
/* Check if we have restarted a preempted walk */
walk_state = acpi_ds_get_current_walk_state (&walk_list);
- if (walk_state &&
- ACPI_SUCCESS (status)) {
- /* There is another walk state, restart it */
+ if (walk_state) {
+ if (ACPI_SUCCESS (status)) {
+ /* There is another walk state, restart it */
- /*
- * If the method returned value is not used by the parent,
- * The object is deleted
- */
- acpi_ds_restart_control_method (walk_state, return_desc);
- walk_state->walk_type |= WALK_METHOD_RESTART;
+ /*
+ * If the method returned value is not used by the parent,
+ * The object is deleted
+ */
+ acpi_ds_restart_control_method (walk_state, previous_walk_state->return_desc);
+ walk_state->walk_type |= WALK_METHOD_RESTART;
+ }
}
/*
* Just completed a 1st-level method, save the final internal return
* value (if any)
*/
- else if (caller_return_desc) {
- *caller_return_desc = return_desc; /* NULL if no return value */
+ else if (previous_walk_state->caller_return_desc) {
+ *(previous_walk_state->caller_return_desc) = previous_walk_state->return_desc; /* NULL if no return value */
}
- else if (return_desc) {
+ else if (previous_walk_state->return_desc) {
/* Caller doesn't want it, must delete it */
- acpi_ut_remove_reference (return_desc);
+ acpi_ut_remove_reference (previous_walk_state->return_desc);
}
+
+ acpi_ds_delete_walk_state (previous_walk_state);
}
acpi_ex_release_all_mutexes ((acpi_operand_object *) &walk_list.acquired_mutex_list);
acpi_gbl_current_walk_list = prev_walk_list;
return_ACPI_STATUS (status);
-
-
-cleanup:
-
- /* Cleanup */
-
- acpi_ds_delete_walk_state (walk_state);
- acpi_ps_cleanup_scope (parser_state);
- ACPI_MEM_FREE (parser_state);
-
- acpi_ex_release_all_mutexes ((acpi_operand_object *)&walk_list.acquired_mutex_list);
- acpi_gbl_current_walk_list = prev_walk_list;
-
- return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: psscope - Parser scope stack management routines
- * $Revision: 29 $
+ * $Revision: 30 $
*
*****************************************************************************/
return_ACPI_STATUS (AE_NO_MEMORY);
}
+ scope->common.data_type = ACPI_DESC_TYPE_STATE_RPSCOPE;
scope->parse_scope.op = root_op;
scope->parse_scope.arg_count = ACPI_VAR_ARGS;
scope->parse_scope.arg_end = parser_state->aml_end;
}
+ scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE;
scope->parse_scope.op = op;
scope->parse_scope.arg_list = remaining_args;
scope->parse_scope.arg_count = arg_count;
/******************************************************************************
*
* Module Name: pstree - Parser op tree manipulation/traversal/search
- * $Revision: 32 $
+ * $Revision: 35 $
*
*****************************************************************************/
/* Get the info structure for this opcode */
op_info = acpi_ps_get_opcode_info (op->opcode);
- if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
+ if (op_info->class == AML_CLASS_UNKNOWN) {
/* Invalid opcode or ASCII character */
return (NULL);
/* Check if this opcode requires argument sub-objects */
- if (!(ACPI_GET_OP_ARGS (op_info))) {
+ if (!(op_info->flags & AML_HAS_ARGS)) {
/* Has no linked argument objects */
return (NULL);
/* Get the info structure for this opcode */
op_info = acpi_ps_get_opcode_info (op->opcode);
- if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) {
+ if (op_info->class == AML_CLASS_UNKNOWN) {
/* Invalid opcode */
+ REPORT_ERROR (("Ps_append_arg: Invalid AML Opcode: 0x%2.2X\n", op->opcode));
return;
}
/* Check if this opcode requires argument sub-objects */
- if (!(ACPI_GET_OP_ARGS (op_info))) {
+ if (!(op_info->flags & AML_HAS_ARGS)) {
/* Has no linked argument objects */
return;
/******************************************************************************
*
* Module Name: psutils - Parser miscellaneous utilities (Parser only)
- * $Revision: 43 $
+ * $Revision: 44 $
*
*****************************************************************************/
#define PARSEOP_GENERIC 0x01
#define PARSEOP_NAMED 0x02
-#define PARSEOP_DEFERRED 0x03
-#define PARSEOP_BYTELIST 0x04
+#define PARSEOP_DEFERRED 0x04
+#define PARSEOP_BYTELIST 0x08
#define PARSEOP_IN_CACHE 0x80
/******************************************************************************
*
* Module Name: pswalk - Parser routines to walk parsed op tree(s)
- * $Revision: 56 $
+ * $Revision: 58 $
*
*****************************************************************************/
next = op->next;
parent = op->parent;
- status = ascending_callback (walk_state, op);
+ walk_state->op = op;
+ walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
+ walk_state->opcode = op->opcode;
+
+ status = ascending_callback (walk_state);
/*
* If we are back to the starting point, the walk is complete.
grand_parent = parent->parent;
next = parent->next;
- status = ascending_callback (walk_state, parent);
+ walk_state->op = parent;
+ walk_state->op_info = acpi_ps_get_opcode_info (parent->opcode);
+ walk_state->opcode = parent->opcode;
+
+ status = ascending_callback (walk_state);
/*
* If we are back to the starting point, the walk is complete.
static acpi_status
acpi_ps_delete_completed_op (
- acpi_walk_state *state,
- acpi_parse_object *op)
+ acpi_walk_state *walk_state)
{
- acpi_ps_free_op (op);
+ acpi_ps_free_op (walk_state->op);
return (AE_OK);
}
return_VOID;
}
- walk_state->parser_state = NULL;
walk_state->parse_flags = 0;
walk_state->descending_callback = NULL;
walk_state->ascending_callback = NULL;
/******************************************************************************
*
* Module Name: psxface - Parser external interfaces
- * $Revision: 47 $
+ * $Revision: 52 $
*
*****************************************************************************/
acpi_operand_object *obj_desc;
u32 i;
acpi_parse_object *op;
+ acpi_walk_state *walk_state;
FUNCTION_TRACE ("Psx_execute");
}
/*
- * Perform the first pass parse of the method to enter any
+ * 1) Perform the first pass parse of the method to enter any
* named objects that it creates into the namespace
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "**** Begin Method Execution **** Entry=%p obj=%p\n",
+ "**** Begin Method Parse **** Entry=%p obj=%p\n",
method_node, obj_desc));
/* Create and init a Root Node */
return_ACPI_STATUS (AE_NO_MEMORY);
}
- status = acpi_ps_parse_aml (op, obj_desc->method.pcode,
- obj_desc->method.pcode_length,
- ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
- method_node, params, return_obj_desc,
- acpi_ds_load1_begin_op, acpi_ds_load1_end_op);
+ /* Create and initialize a new walk state */
+
+ walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
+ NULL, NULL, NULL);
+ if (!walk_state) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ status = acpi_ds_init_aml_walk (walk_state, op, method_node, obj_desc->method.aml_start,
+ obj_desc->method.aml_length, NULL, NULL, 1);
+ if (ACPI_FAILURE (status)) {
+ /* TBD: delete walk state */
+ return_ACPI_STATUS (status);
+ }
+
+ /* Parse the AML */
+
+ status = acpi_ps_parse_aml (walk_state);
acpi_ps_delete_parse_tree (op);
+
+ /*
+ * 2) Execute the method. Performs second pass parse simultaneously
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "**** Begin Method Execution **** Entry=%p obj=%p\n",
+ method_node, obj_desc));
+
/* Create and init a Root Node */
op = acpi_ps_alloc_op (AML_SCOPE_OP);
return_ACPI_STATUS (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;
+ /* Create and initialize a new walk state */
+
+ walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
+ NULL, NULL, NULL);
+ if (!walk_state) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ status = acpi_ds_init_aml_walk (walk_state, op, method_node, obj_desc->method.aml_start,
+ obj_desc->method.aml_length, params, return_obj_desc, 3);
+ if (ACPI_FAILURE (status)) {
+ /* TBD: delete walk state */
+ return_ACPI_STATUS (status);
+ }
+
/*
* The walk of the parse tree is where we actually execute the method
*/
- status = acpi_ps_parse_aml (op, obj_desc->method.pcode,
- obj_desc->method.pcode_length,
- ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE,
- method_node, params, return_obj_desc,
- acpi_ds_exec_begin_op, acpi_ds_exec_end_op);
+ status = acpi_ps_parse_aml (walk_state);
acpi_ps_delete_parse_tree (op);
if (params) {
}
+ if (ACPI_FAILURE (status)) {
+ DUMP_PATHNAME (method_node, "Ps_execute: method failed -",
+ ACPI_LV_ERROR, _COMPONENT);
+ }
+
+
/*
* If the method has returned an object, signal this to the caller with
* a control exception code
*/
if (*return_obj_desc) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Method returned Obj_desc=%X\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Method returned Obj_desc=%p\n",
*return_obj_desc));
DUMP_STACK_ENTRY (*return_obj_desc);
/*******************************************************************************
*
* Module Name: rsutils - Utilities for the resource manager
- * $Revision: 22 $
+ * $Revision: 23 $
*
******************************************************************************/
*/
cleanup:
- ACPI_MEM_FREE (byte_stream);
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* Module Name: rsxface - Public interfaces to the resource manager
- * $Revision: 14 $
+ * $Revision: 15 $
*
******************************************************************************/
FUNCTION_TRACE ("Acpi_get_irq_routing_table ");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/*
* Must have a valid handle and buffer, So we have to have a handle
* and a return buffer structure, and if there is a non-zero buffer length
FUNCTION_TRACE ("Acpi_get_current_resources");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/*
* Must have a valid handle and buffer, So we have to have a handle
* and a return buffer structure, and if there is a non-zero buffer length
FUNCTION_TRACE ("Acpi_get_possible_resources");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/*
* Must have a valid handle and buffer, So we have to have a handle
* and a return buffer structure, and if there is a non-zero buffer length
FUNCTION_TRACE ("Acpi_set_current_resources");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/*
* Must have a valid handle and buffer
*/
/******************************************************************************
*
* Module Name: tbconvrt - ACPI Table conversion utilities
- * $Revision: 27 $
+ * $Revision: 28 $
*
*****************************************************************************/
else
#endif
{
- pointer_size = sizeof (UINT64);
+ pointer_size = sizeof (u64);
}
/*
/* Compute size of the converted XSDT */
- table_size = (*number_of_tables * sizeof (UINT64)) + sizeof (acpi_table_header);
+ table_size = (*number_of_tables * sizeof (u64)) + sizeof (acpi_table_header);
/* Allocate an XSDT */
FADT2->sci_int = FADT71->sci_int;
FADT2->acpi_enable = FADT71->acpi_enable;
FADT2->acpi_disable = FADT71->acpi_disable;
- FADT2->S4_bios_req = FADT71->S4_bios_req;
+ FADT2->S4bios_req = FADT71->S4bios_req;
FADT2->plvl2_lat = FADT71->plvl2_lat;
FADT2->plvl3_lat = FADT71->plvl3_lat;
FADT2->day_alrm = FADT71->day_alrm;
/* Dump the entire FADT */
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
- "Hex dump of common internal FADT, size %ld (%lX)\n",
+ "Hex dump of common internal FADT, size %d (%X)\n",
acpi_gbl_FADT->header.length, acpi_gbl_FADT->header.length));
DUMP_BUFFER ((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->header.length);
FACS1 = (facs_descriptor_rev1 *) acpi_gbl_FACS;
common_facs->global_lock = &(FACS1->global_lock);
- common_facs->firmware_waking_vector = (UINT64 *) &FACS1->firmware_waking_vector;
+ common_facs->firmware_waking_vector = (u64 *) &FACS1->firmware_waking_vector;
common_facs->vector_width = 32;
#endif
/******************************************************************************
*
* Module Name: tbget - ACPI Table get* routines
- * $Revision: 55 $
+ * $Revision: 56 $
*
*****************************************************************************/
* Get the RSDT from the RSDP
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "RSDP located at %p, RSDT physical=%8.8lX%8.8lX \n",
+ "RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
acpi_gbl_RSDP, HIDWORD(acpi_gbl_RSDP->rsdt_physical_address),
LODWORD(acpi_gbl_RSDP->rsdt_physical_address)));
/******************************************************************************
*
* Module Name: tbinstal - ACPI table installation and removal
- * $Revision: 42 $
+ * $Revision: 45 $
*
*****************************************************************************/
status = acpi_gbl_acpi_table_data[i].status;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Found %4.4s\n",
- acpi_gbl_acpi_table_data[i].signature));
+ (char*)acpi_gbl_acpi_table_data[i].signature));
break;
}
}
table_desc->base_pointer = table_info->base_pointer;
table_desc->length = table_info->length;
table_desc->allocation = table_info->allocation;
- table_desc->aml_pointer = (u8 *) (table_desc->pointer + 1),
+ table_desc->aml_start = (u8 *) (table_desc->pointer + 1),
table_desc->aml_length = (u32) (table_desc->length -
(u32) sizeof (acpi_table_header));
table_desc->table_id = acpi_ut_allocate_owner_id (OWNER_TYPE_TABLE);
/******************************************************************************
*
* Module Name: tbutils - Table manipulation utilities
- * $Revision: 40 $
+ * $Revision: 42 $
*
*****************************************************************************/
MOVE_UNALIGNED32_TO_32 (&signature, &table_header->signature);
if (!acpi_ut_valid_acpi_name (signature)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Table signature at %p [%X] has invalid characters\n",
+ "Table signature at %p [%p] has invalid characters\n",
table_header, &signature));
- REPORT_WARNING (("Invalid table signature %4.4s found\n", &signature));
+ REPORT_WARNING (("Invalid table signature %4.4s found\n", (char*)&signature));
DUMP_BUFFER (table_header, sizeof (acpi_table_header));
return (AE_BAD_SIGNATURE);
}
if (table_header->length < sizeof (acpi_table_header)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Invalid length in table header %p name %4.4s\n",
- table_header, &signature));
+ table_header, (char*)&signature));
REPORT_WARNING (("Invalid table header length found\n"));
DUMP_BUFFER (table_header, sizeof (acpi_table_header));
if (checksum) {
REPORT_WARNING (("Invalid checksum (%X) in table %4.4s\n",
- checksum, &table_header->signature));
+ checksum, (char*)&table_header->signature));
status = AE_BAD_CHECKSUM;
}
*
* Module Name: tbxface - Public interfaces to the ACPI subsystem
* ACPI table oriented interfaces
- * $Revision: 43 $
+ * $Revision: 45 $
*
*****************************************************************************/
FUNCTION_TRACE ("Acpi_load_tables");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
-
/* Get the RSDP */
status = acpi_os_get_root_pointer (ACPI_LOGICAL_ADDRESSING,
FUNCTION_TRACE ("Acpi_load_table");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
if (!table_ptr) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
acpi_table_type table_type)
{
acpi_table_desc *list_head;
- acpi_status status;
FUNCTION_TRACE ("Acpi_unload_table");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* Parameter validation */
if (table_type > ACPI_TABLE_MAX) {
FUNCTION_TRACE ("Acpi_get_table_header");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
if ((instance == 0) ||
(table_type == ACPI_TABLE_RSDP) ||
(!out_table_header)) {
FUNCTION_TRACE ("Acpi_get_table");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/*
* If we have a buffer, we must have a length too
*/
/******************************************************************************
*
* Module Name: tbxfroot - Find the root ACPI table (RSDT)
- * $Revision: 49 $
+ * $Revision: 52 $
*
*****************************************************************************/
{
u8 *table_ptr;
u8 *mem_rover;
- UINT64 phys_addr;
+ u64 phys_addr;
acpi_status status = AE_OK;
acpi_table_header **table_pointer)
{
ACPI_PHYSICAL_ADDRESS physical_address;
- acpi_table_header *rsdt_ptr;
+ acpi_table_header *rsdt_ptr = NULL;
acpi_table_header *table_ptr;
acpi_status status;
- u32 rsdt_size;
+ u32 rsdt_size = 0;
u32 table_size;
u32 table_count;
u32 i;
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Get the RSDP */
+ if (!acpi_gbl_RSDP) {
+ /* Get the RSDP */
- status = acpi_os_get_root_pointer (flags, &physical_address);
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n"));
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ status = acpi_os_get_root_pointer (flags, &physical_address);
+ if (ACPI_FAILURE (status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n"));
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
+ /* Map and validate the RSDP */
+
+ if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
+ status = acpi_os_map_memory (physical_address, sizeof (RSDP_DESCRIPTOR),
+ (void **) &acpi_gbl_RSDP);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+ }
+ else {
+ acpi_gbl_RSDP = (void *) (NATIVE_UINT) physical_address;
+ }
+
+ /*
+ * The signature and checksum must both be correct
+ */
+ if (STRNCMP ((NATIVE_CHAR *) acpi_gbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
+ /* Nope, BAD Signature */
+
+ status = AE_BAD_SIGNATURE;
+ goto cleanup;
+ }
+
+ if (acpi_tb_checksum (acpi_gbl_RSDP, RSDP_CHECKSUM_LENGTH) != 0) {
+ /* Nope, BAD Checksum */
+
+ status = AE_BAD_CHECKSUM;
+ goto cleanup;
+ }
}
- acpi_gbl_RSDP = (RSDP_DESCRIPTOR *) (ACPI_TBLPTR) physical_address;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "RSDP located at %p, RSDT physical=%8.8lX%8.8lX \n",
+ "RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
acpi_gbl_RSDP, HIDWORD(acpi_gbl_RSDP->rsdt_physical_address),
LODWORD(acpi_gbl_RSDP->rsdt_physical_address)));
/* Delete table mapping if using virtual addressing */
- if (table_size) {
+ if ((table_size) &&
+ ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)) {
acpi_os_unmap_memory (table_ptr, table_size);
}
}
/******************************************************************************
*
* Module Name: utalloc - local cache and memory allocation routines
- * $Revision: 100 $
+ * $Revision: 106 $
*
*****************************************************************************/
/* Mark the object as cached */
MEMSET (object, 0xCA, cache_info->object_size);
+ ((acpi_operand_object *) object)->common.data_type = ACPI_CACHED_OBJECT;
/* Put the object at the head of the cache list */
* Each memory allocation is tracked via a doubly linked list. Each
* element contains the caller's component, module name, function name, and
* line number. Acpi_ut_allocate and Acpi_ut_callocate call
- * Acpi_ut_add_element_to_alloc_list to add an element to the list; deletion
+ * Acpi_ut_track_allocation to add an element to the list; deletion
* occurs in the body of Acpi_ut_free.
*/
/*******************************************************************************
*
- * FUNCTION: Acpi_ut_search_alloc_list
+ * FUNCTION: Acpi_ut_find_allocation
*
* PARAMETERS: Address - Address of allocated memory
*
*
******************************************************************************/
-ACPI_DEBUG_MEM_BLOCK *
-acpi_ut_search_alloc_list (
+acpi_debug_mem_block *
+acpi_ut_find_allocation (
u32 list_id,
void *address)
{
- ACPI_DEBUG_MEM_BLOCK *element;
+ acpi_debug_mem_block *element;
FUNCTION_ENTRY ();
/*******************************************************************************
*
- * FUNCTION: Acpi_ut_add_element_to_alloc_list
+ * FUNCTION: Acpi_ut_track_allocation
*
* PARAMETERS: Address - Address of allocated memory
* Size - Size of the allocation
******************************************************************************/
acpi_status
-acpi_ut_add_element_to_alloc_list (
+acpi_ut_track_allocation (
u32 list_id,
- ACPI_DEBUG_MEM_BLOCK *address,
+ acpi_debug_mem_block *address,
u32 size,
u8 alloc_type,
u32 component,
u32 line)
{
ACPI_MEMORY_LIST *mem_list;
- ACPI_DEBUG_MEM_BLOCK *element;
+ acpi_debug_mem_block *element;
acpi_status status = AE_OK;
- FUNCTION_TRACE_PTR ("Ut_add_element_to_alloc_list", address);
+ FUNCTION_TRACE_PTR ("Ut_track_allocation", address);
if (list_id > ACPI_MEM_LIST_MAX) {
* This will catch several kinds of problems.
*/
- element = acpi_ut_search_alloc_list (list_id, address);
+ element = acpi_ut_find_allocation (list_id, address);
if (element) {
- REPORT_ERROR (("Ut_add_element_to_alloc_list: Address already present in list! (%p)\n",
+ REPORT_ERROR (("Ut_track_allocation: Address already present in list! (%p)\n",
address));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", element, address));
/* Insert at list head */
if (mem_list->list_head) {
- ((ACPI_DEBUG_MEM_BLOCK *)(mem_list->list_head))->previous = address;
+ ((acpi_debug_mem_block *)(mem_list->list_head))->previous = address;
}
address->next = mem_list->list_head;
/*******************************************************************************
*
- * FUNCTION: Acpi_ut_delete_element_from_alloc_list
+ * FUNCTION: Acpi_ut_remove_allocation
*
* PARAMETERS: Address - Address of allocated memory
* Component - Component type of caller
******************************************************************************/
acpi_status
-acpi_ut_delete_element_from_alloc_list (
+acpi_ut_remove_allocation (
u32 list_id,
- ACPI_DEBUG_MEM_BLOCK *address,
+ acpi_debug_mem_block *address,
u32 component,
NATIVE_CHAR *module,
u32 line)
ACPI_MEMORY_LIST *mem_list;
- FUNCTION_TRACE ("Ut_delete_element_from_alloc_list");
+ FUNCTION_TRACE ("Ut_remove_allocation");
if (list_id > ACPI_MEM_LIST_MAX) {
/* No allocations! */
_REPORT_ERROR (module, line, component,
- ("Ut_delete_element_from_alloc_list: Empty allocation list, nothing to free!\n"));
+ ("Ut_remove_allocation: Empty allocation list, nothing to free!\n"));
return_ACPI_STATUS (AE_OK);
}
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
("%30s: %4d (%3d Kb)\n", "Current allocations",
Mem_list->Current_count,
- ROUND_UP_TO_1_k (Mem_list->Current_size)));
+ ROUND_UP_TO_1K (Mem_list->Current_size)));
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
("%30s: %4d (%3d Kb)\n", "Max concurrent allocations",
Mem_list->Max_concurrent_count,
- ROUND_UP_TO_1_k (Mem_list->Max_concurrent_size)));
+ ROUND_UP_TO_1K (Mem_list->Max_concurrent_size)));
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
("%30s: %4d (%3d Kb)\n", "Total (all) internal objects",
Running_object_count,
- ROUND_UP_TO_1_k (Running_object_size)));
+ ROUND_UP_TO_1K (Running_object_size)));
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
("%30s: %4d (%3d Kb)\n", "Total (all) allocations",
Running_alloc_count,
- ROUND_UP_TO_1_k (Running_alloc_size)));
+ ROUND_UP_TO_1K (Running_alloc_size)));
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
("%30s: %4d (%3d Kb)\n", "Current Nodes",
Acpi_gbl_Current_node_count,
- ROUND_UP_TO_1_k (Acpi_gbl_Current_node_size)));
+ ROUND_UP_TO_1K (Acpi_gbl_Current_node_size)));
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
("%30s: %4d (%3d Kb)\n", "Max Nodes",
Acpi_gbl_Max_concurrent_node_count,
- ROUND_UP_TO_1_k ((Acpi_gbl_Max_concurrent_node_count * sizeof (acpi_namespace_node)))));
+ ROUND_UP_TO_1K ((Acpi_gbl_Max_concurrent_node_count * sizeof (acpi_namespace_node)))));
*/
return_VOID;
}
/*******************************************************************************
*
- * FUNCTION: Acpi_ut_dump_current_allocations
+ * FUNCTION: Acpi_ut_dump_allocations
*
* PARAMETERS: Component - Component(s) to dump info for.
* Module - Module to dump info for. NULL means all.
******************************************************************************/
void
-acpi_ut_dump_current_allocations (
+acpi_ut_dump_allocations (
u32 component,
NATIVE_CHAR *module)
{
- ACPI_DEBUG_MEM_BLOCK *element;
+ acpi_debug_mem_block *element;
u32 i;
- FUNCTION_TRACE ("Ut_dump_current_allocations");
+ FUNCTION_TRACE ("Ut_dump_allocations");
element = acpi_gbl_memory_lists[0].list_head;
if (element == NULL) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ ACPI_DEBUG_PRINT ((ACPI_DB_OK,
"No outstanding allocations.\n"));
return_VOID;
}
*/
acpi_ut_acquire_mutex (ACPI_MTX_MEMORY);
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ ACPI_DEBUG_PRINT ((ACPI_DB_OK,
"Outstanding allocations:\n"));
for (i = 1; ; i++) /* Just a counter */ {
if ((element->component & component) &&
((module == NULL) || (0 == STRCMP (module, element->module)))) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
- "%p Len %04lX %9.9s-%ld",
- &element->user_space, element->size, element->module,
- element->line));
-
- /* Most of the elements will be internal objects. */
-
- switch (((acpi_operand_object *)
- (&element->user_space))->common.data_type) {
- case ACPI_DESC_TYPE_INTERNAL:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS,
- " Obj_type %s",
- acpi_ut_get_type_name (((acpi_operand_object *)(&element->user_space))->common.type)));
- break;
-
- case ACPI_DESC_TYPE_PARSER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS,
- " Parse_obj Opcode %04X",
- ((acpi_parse_object *)(&element->user_space))->opcode));
- break;
-
- case ACPI_DESC_TYPE_NAMED:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS,
- " Node %4.4s",
- &((acpi_namespace_node *)(&element->user_space))->name));
- break;
-
- case ACPI_DESC_TYPE_STATE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS,
- " State_obj"));
- break;
+ if (((acpi_operand_object *)(&element->user_space))->common.type != ACPI_CACHED_OBJECT) {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+ "%p Len %04X %9.9s-%d",
+ &element->user_space, element->size, element->module,
+ element->line));
+
+ /* Most of the elements will be internal objects. */
+
+ switch (((acpi_operand_object *)
+ (&element->user_space))->common.data_type) {
+ case ACPI_DESC_TYPE_INTERNAL:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+ " Obj_type %12.12s R%d",
+ acpi_ut_get_type_name (((acpi_operand_object *)(&element->user_space))->common.type),
+ ((acpi_operand_object *)(&element->user_space))->common.reference_count));
+ break;
+
+ case ACPI_DESC_TYPE_PARSER:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+ " Parse_obj Opcode %04X",
+ ((acpi_parse_object *)(&element->user_space))->opcode));
+ break;
+
+ case ACPI_DESC_TYPE_NAMED:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+ " Node %4.4s",
+ (char*)&((acpi_namespace_node *)(&element->user_space))->name));
+ break;
+
+ case ACPI_DESC_TYPE_STATE:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+ " Untyped State_obj"));
+ break;
+
+ case ACPI_DESC_TYPE_STATE_UPDATE:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+ " UPDATE State_obj"));
+ break;
+
+ case ACPI_DESC_TYPE_STATE_PACKAGE:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+ " PACKAGE State_obj"));
+ break;
+
+ case ACPI_DESC_TYPE_STATE_CONTROL:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+ " CONTROL State_obj"));
+ break;
+
+ case ACPI_DESC_TYPE_STATE_RPSCOPE:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+ " ROOT-PARSE-SCOPE State_obj"));
+ break;
+
+ case ACPI_DESC_TYPE_STATE_PSCOPE:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+ " PARSE-SCOPE State_obj"));
+ break;
+
+ case ACPI_DESC_TYPE_STATE_WSCOPE:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+ " WALK-SCOPE State_obj"));
+ break;
+
+ case ACPI_DESC_TYPE_STATE_RESULT:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+ " RESULT State_obj"));
+ break;
+
+ case ACPI_DESC_TYPE_STATE_NOTIFY:
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+ " NOTIFY State_obj"));
+ break;
+ }
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "\n"));
}
-
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS, "\n"));
}
if (element->next == NULL) {
acpi_ut_release_mutex (ACPI_MTX_MEMORY);
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ ACPI_DEBUG_PRINT ((ACPI_DB_OK,
"Total number of unfreed allocations = %d(%X)\n", i,i));
NATIVE_CHAR *module,
u32 line)
{
- ACPI_DEBUG_MEM_BLOCK *address;
+ acpi_debug_mem_block *address;
acpi_status status;
size = 1;
}
- address = acpi_os_allocate (size + sizeof (ACPI_DEBUG_MEM_BLOCK));
+ address = acpi_os_allocate (size + sizeof (acpi_debug_mem_block));
if (!address) {
/* Report allocation error */
return_PTR (NULL);
}
- status = acpi_ut_add_element_to_alloc_list (ACPI_MEM_LIST_GLOBAL, address, size,
+ status = acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL, address, size,
MEM_MALLOC, component, module, line);
if (ACPI_FAILURE (status)) {
acpi_os_free (address);
NATIVE_CHAR *module,
u32 line)
{
- ACPI_DEBUG_MEM_BLOCK *address;
+ acpi_debug_mem_block *address;
acpi_status status;
}
- address = acpi_os_callocate (size + sizeof (ACPI_DEBUG_MEM_BLOCK));
+ address = acpi_os_callocate (size + sizeof (acpi_debug_mem_block));
if (!address) {
/* Report allocation error */
return_PTR (NULL);
}
- status = acpi_ut_add_element_to_alloc_list (ACPI_MEM_LIST_GLOBAL, address, size,
+ status = acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL, address, size,
MEM_CALLOC, component, module, line);
if (ACPI_FAILURE (status)) {
acpi_os_free (address);
NATIVE_CHAR *module,
u32 line)
{
- ACPI_DEBUG_MEM_BLOCK *debug_block;
+ acpi_debug_mem_block *debug_block;
FUNCTION_TRACE_PTR ("Ut_free", address);
return_VOID;
}
- debug_block = (ACPI_DEBUG_MEM_BLOCK *)
- (((char *) address) - sizeof (ACPI_DEBUG_MEM_HEADER));
+ debug_block = (acpi_debug_mem_block *)
+ (((char *) address) - sizeof (acpi_debug_mem_header));
acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_freed++;
acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size -= debug_block->size;
- acpi_ut_delete_element_from_alloc_list (ACPI_MEM_LIST_GLOBAL, debug_block,
+ acpi_ut_remove_allocation (ACPI_MEM_LIST_GLOBAL, debug_block,
component, module, line);
acpi_os_free (debug_block);
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
- * $Revision: 82 $
+ * $Revision: 83 $
*
*****************************************************************************/
case AML_REVISION_OP:
external_object->type = ACPI_TYPE_INTEGER;
- external_object->integer.value = ACPI_CA_VERSION;
+ external_object->integer.value = ACPI_CA_SUPPORT_LEVEL;
break;
case AML_INT_NAMEPATH_OP:
/******************************************************************************
*
* Module Name: utdebug - Debug print routines
- * $Revision: 87 $
+ * $Revision: 90 $
*
*****************************************************************************/
if (acpi_gbl_nesting_level > acpi_gbl_deepest_nesting) {
acpi_gbl_deepest_nesting = acpi_gbl_nesting_level;
-
- if (acpi_gbl_deepest_nesting == 34) {
- acpi_os_printf ("hit deepest nesting\n");
- }
}
}
acpi_ut_debug_print (
u32 requested_debug_level,
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
char *format,
...)
{
acpi_ut_debug_print_raw (
u32 requested_debug_level,
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
char *format,
...)
{
void
acpi_ut_trace (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info)
+ acpi_debug_print_info *dbg_info)
{
acpi_gbl_nesting_level++;
void
acpi_ut_trace_ptr (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
void *pointer)
{
acpi_gbl_nesting_level++;
void
acpi_ut_trace_str (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
NATIVE_CHAR *string)
{
void
acpi_ut_trace_u32 (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
u32 integer)
{
void
acpi_ut_exit (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info)
+ acpi_debug_print_info *dbg_info)
{
acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
void
acpi_ut_status_exit (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
acpi_status status)
{
void
acpi_ut_value_exit (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
acpi_integer value)
{
acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
- "%s %08X\n", acpi_gbl_fn_exit_str, value);
+ "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str, HIDWORD(value), LODWORD(value));
acpi_gbl_nesting_level--;
}
void
acpi_ut_ptr_exit (
u32 line_number,
- ACPI_DEBUG_PRINT_INFO *dbg_info,
+ acpi_debug_print_info *dbg_info,
u8 *ptr)
{
/*******************************************************************************
*
* Module Name: utdelete - object deletion and reference count utilities
- * $Revision: 76 $
+ * $Revision: 81 $
*
******************************************************************************/
* Delete any allocated memory found above
*/
if (obj_pointer) {
- if (!acpi_tb_system_table_pointer (obj_pointer)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting Obj Ptr %p \n", obj_pointer));
-
- ACPI_MEM_FREE (obj_pointer);
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting Obj Ptr %p \n", obj_pointer));
+ ACPI_MEM_FREE (obj_pointer);
}
-
/* Only delete the object if it was dynamically allocated */
if (object->common.flags & AOPOBJ_STATIC_ALLOCATION) {
*/
if (count > MAX_REFERENCE_COUNT) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "**** AE_ERROR **** Invalid Reference Count (%X) in object %p\n\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
+ "**** Warning **** Large Reference Count (%X) in object %p\n\n",
count, object));
}
return_ACPI_STATUS (AE_OK);
}
- if (acpi_tb_system_table_pointer (object)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Object %p is Pcode Ptr\n", object));
- return_ACPI_STATUS (AE_OK);
- }
-
state = acpi_ut_create_update_state (object, action);
case ACPI_TYPE_REGION:
-
- /* TBD: [Investigate]
- Acpi_ut_update_ref_count (Object->Region.Addr_handler, Action);
- */
-/*
- Status =
- Acpi_ut_create_update_state_and_push (Object->Region.Addr_handler,
- Action, &State_list);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-*/
- break;
-
-
case INTERNAL_TYPE_REFERENCE:
+ /* No subobjects */
break;
}
FUNCTION_TRACE_PTR ("Ut_remove_reference", object);
+ /*
+ * Allow a NULL pointer to be passed in, just ignore it. This saves
+ * each caller from having to check. Also, ignore NS nodes.
+ *
+ */
+ if (!object ||
+ (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED))) {
+ return_VOID;
+ }
/*
* Ensure that we have a valid object
/******************************************************************************
*
* Module Name: uteval - Object evaluation
- * $Revision: 30 $
+ * $Revision: 31 $
*
*****************************************************************************/
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s on %4.4s was not found\n",
- object_name, &device_node->name));
+ object_name, (char*)&device_node->name));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s on %4.4s failed with status %s\n",
- object_name, &device_node->name,
+ object_name, (char*)&device_node->name,
acpi_format_exception (status)));
}
acpi_status
acpi_ut_execute_HID (
acpi_namespace_node *device_node,
- ACPI_DEVICE_ID *hid)
+ acpi_device_id *hid)
{
acpi_operand_object *obj_desc;
acpi_status status;
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_HID on %4.4s was not found\n",
- &device_node->name));
+ (char*)&device_node->name));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_HID on %4.4s failed %s\n",
- &device_node->name, acpi_format_exception (status)));
+ (char*)&device_node->name, acpi_format_exception (status)));
}
return_ACPI_STATUS (status);
acpi_status
acpi_ut_execute_UID (
acpi_namespace_node *device_node,
- ACPI_DEVICE_ID *uid)
+ acpi_device_id *uid)
{
acpi_operand_object *obj_desc;
acpi_status status;
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_UID on %4.4s was not found\n",
- &device_node->name));
+ (char*)&device_node->name));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"_UID on %4.4s failed %s\n",
- &device_node->name, acpi_format_exception (status)));
+ (char*)&device_node->name, acpi_format_exception (status)));
}
return (status);
if (AE_NOT_FOUND == status) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"_STA on %4.4s was not found, assuming present.\n",
- &device_node->name));
+ (char*)&device_node->name));
*flags = 0x0F;
status = AE_OK;
else if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_STA on %4.4s failed %s\n",
- &device_node->name,
+ (char*)&device_node->name,
acpi_format_exception (status)));
}
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
- * $Revision: 131 $
+ * $Revision: 133 $
*
*****************************************************************************/
const NATIVE_CHAR *acpi_gbl_db_sleep_states[ACPI_NUM_SLEEP_STATES] = {
"\\_S0_","\\_S1_","\\_S2_","\\_S3_",
- "\\_S4_","\\_S5_","\\_S4_b"};
+ "\\_S4_","\\_S5_","\\_S4B"};
/******************************************************************************
*/
static const NATIVE_CHAR acpi_gbl_bad_type[] = "UNDEFINED";
-#define TYPE_NAME_LENGTH 9 /* Maximum length of each string */
+#define TYPE_NAME_LENGTH 12 /* Maximum length of each string */
static const NATIVE_CHAR *acpi_gbl_ns_type_names[] = /* printable names of ACPI types */
{
/* 11 */ "Power",
/* 12 */ "Processor",
/* 13 */ "Thermal",
- /* 14 */ "Buff_field",
+ /* 14 */ "Buffer_field",
/* 15 */ "Ddb_handle",
- /* 16 */ "Debug_obj",
- /* 17 */ "Regn_field",
+ /* 16 */ "Debug_object",
+ /* 17 */ "Region_field",
/* 18 */ "Bank_field",
- /* 19 */ "Indx_field",
+ /* 19 */ "Index_field",
/* 20 */ "Reference",
/* 21 */ "Alias",
/* 22 */ "Notify",
- /* 23 */ "Addr_hndlr",
- /* 24 */ "Rsrc_desc",
- /* 25 */ "Rsrc_field",
- /* 26 */ "Rgn_fld_dfn",
- /* 27 */ "Bnk_fld_dfn",
- /* 28 */ "Idx_fld_dfn",
+ /* 23 */ "Addr_handler",
+ /* 24 */ "Resource_desc",
+ /* 25 */ "Resource_fld",
+ /* 26 */ "Region_fld_dfn",
+ /* 27 */ "Bank_fld_dfn",
+ /* 28 */ "Index_fld_dfn",
/* 29 */ "If",
/* 30 */ "Else",
/* 31 */ "While",
/******************************************************************************
*
* Module Name: utinit - Common ACPI subsystem initialization
- * $Revision: 101 $
+ * $Revision: 102 $
*
*****************************************************************************/
/* Debug only - display leftover memory allocation, if any */
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- acpi_ut_dump_current_allocations (ACPI_UINT32_MAX, NULL);
+ acpi_ut_dump_allocations (ACPI_UINT32_MAX, NULL);
#endif
return_ACPI_STATUS (AE_OK);
--- /dev/null
+/*******************************************************************************
+ *
+ * Module Name: utmath - Integer math support routines
+ * $Revision: 7 $
+ *
+ ******************************************************************************/
+
+/*
+ * 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"
+
+
+#define _COMPONENT ACPI_UTILITIES
+ MODULE_NAME ("utmath")
+
+/*
+ * Support for double-precision integer divide. This code is included here
+ * in order to support kernel environments where the double-precision math
+ * library is not available.
+ */
+
+#ifndef ACPI_USE_NATIVE_DIVIDE
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_short_divide
+ *
+ * PARAMETERS: In_dividend - Pointer to the dividend
+ * Divisor - 32-bit divisor
+ * Out_quotient - Pointer to where the quotient is returned
+ * Out_remainder - Pointer to where the remainder is returned
+ *
+ * RETURN: Status (Checks for divide-by-zero)
+ *
+ * DESCRIPTION: Perform a short (maximum 64 bits divided by 32 bits)
+ * divide and modulo. The result is a 64-bit quotient and a
+ * 32-bit remainder.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ut_short_divide (
+ acpi_integer *in_dividend,
+ u32 divisor,
+ acpi_integer *out_quotient,
+ u32 *out_remainder)
+{
+ uint64_overlay dividend;
+ uint64_overlay quotient;
+ u32 remainder32;
+
+
+ FUNCTION_TRACE ("Ut_short_divide");
+
+ dividend.full = *in_dividend;
+
+ /* Always check for a zero divisor */
+
+ if (divisor == 0) {
+ REPORT_ERROR (("Acpi_ut_short_divide: Divide by zero\n"));
+ return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
+ }
+
+ /*
+ * The quotient is 64 bits, the remainder is always 32 bits,
+ * and is generated by the second divide.
+ */
+ ACPI_DIV_64_BY_32 (0, dividend.part.hi, divisor,
+ quotient.part.hi, remainder32);
+ ACPI_DIV_64_BY_32 (remainder32, dividend.part.lo, divisor,
+ quotient.part.lo, remainder32);
+
+ /* Return only what was requested */
+
+ if (out_quotient) {
+ *out_quotient = quotient.full;
+ }
+ if (out_remainder) {
+ *out_remainder = remainder32;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_divide
+ *
+ * PARAMETERS: In_dividend - Pointer to the dividend
+ * In_divisor - Pointer to the divisor
+ * Out_quotient - Pointer to where the quotient is returned
+ * Out_remainder - Pointer to where the remainder is returned
+ *
+ * RETURN: Status (Checks for divide-by-zero)
+ *
+ * DESCRIPTION: Perform a divide and modulo.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ut_divide (
+ acpi_integer *in_dividend,
+ acpi_integer *in_divisor,
+ acpi_integer *out_quotient,
+ acpi_integer *out_remainder)
+{
+ uint64_overlay dividend;
+ uint64_overlay divisor;
+ uint64_overlay quotient;
+ uint64_overlay remainder;
+ uint64_overlay normalized_dividend;
+ uint64_overlay normalized_divisor;
+ u32 partial1;
+ uint64_overlay partial2;
+ uint64_overlay partial3;
+
+
+ FUNCTION_TRACE ("Ut_divide");
+
+
+ /* Always check for a zero divisor */
+
+ if (*in_divisor == 0) {
+ REPORT_ERROR (("Acpi_ut_divide: Divide by zero\n"));
+ return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
+ }
+
+ divisor.full = *in_divisor;
+ dividend.full = *in_dividend;
+ if (divisor.part.hi == 0) {
+ /*
+ * 1) Simplest case is where the divisor is 32 bits, we can
+ * just do two divides
+ */
+ remainder.part.hi = 0;
+
+ /*
+ * The quotient is 64 bits, the remainder is always 32 bits,
+ * and is generated by the second divide.
+ */
+ ACPI_DIV_64_BY_32 (0, dividend.part.hi, divisor.part.lo,
+ quotient.part.hi, partial1);
+ ACPI_DIV_64_BY_32 (partial1, dividend.part.lo, divisor.part.lo,
+ quotient.part.lo, remainder.part.lo);
+ }
+
+ else {
+ /*
+ * 2) The general case where the divisor is a full 64 bits
+ * is more difficult
+ */
+ quotient.part.hi = 0;
+ normalized_dividend = dividend;
+ normalized_divisor = divisor;
+
+ /* Normalize the operands (shift until the divisor is < 32 bits) */
+
+ do {
+ ACPI_SHIFT_RIGHT_64 (normalized_divisor.part.hi,
+ normalized_divisor.part.lo);
+ ACPI_SHIFT_RIGHT_64 (normalized_dividend.part.hi,
+ normalized_dividend.part.lo);
+
+ } while (normalized_divisor.part.hi != 0);
+
+ /* Partial divide */
+
+ ACPI_DIV_64_BY_32 (normalized_dividend.part.hi,
+ normalized_dividend.part.lo,
+ normalized_divisor.part.lo,
+ quotient.part.lo, partial1);
+
+ /*
+ * The quotient is always 32 bits, and simply requires adjustment.
+ * The 64-bit remainder must be generated.
+ */
+ partial1 = quotient.part.lo * divisor.part.hi;
+ partial2.full = (acpi_integer) quotient.part.lo * divisor.part.lo;
+ partial3.full = partial2.part.hi + partial1;
+
+ remainder.part.hi = partial3.part.lo;
+ remainder.part.lo = partial2.part.lo;
+
+ if (partial3.part.hi == 0) {
+ if (partial3.part.lo >= dividend.part.hi) {
+ if (partial3.part.lo == dividend.part.hi) {
+ if (partial2.part.lo > dividend.part.lo) {
+ quotient.part.lo--;
+ remainder.full -= divisor.full;
+ }
+ }
+ else {
+ quotient.part.lo--;
+ remainder.full -= divisor.full;
+ }
+ }
+
+ remainder.full = remainder.full - dividend.full;
+ remainder.part.hi = -((s32) remainder.part.hi);
+ remainder.part.lo = -((s32) remainder.part.lo);
+
+ if (remainder.part.lo) {
+ remainder.part.hi--;
+ }
+ }
+ }
+
+ /* Return only what was requested */
+
+ if (out_quotient) {
+ *out_quotient = quotient.full;
+ }
+ if (out_remainder) {
+ *out_remainder = remainder.full;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+#else
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ut_short_divide, Acpi_ut_divide
+ *
+ * DESCRIPTION: Native versions of the Ut_divide functions. Use these if either
+ * 1) The target is a 64-bit platform and therefore 64-bit
+ * integer math is supported directly by the machine.
+ * 2) The target is a 32-bit or 16-bit platform, and the
+ * double-precision integer math library is available to
+ * perform the divide.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ut_short_divide (
+ acpi_integer *in_dividend,
+ u32 divisor,
+ acpi_integer *out_quotient,
+ u32 *out_remainder)
+{
+
+ FUNCTION_TRACE ("Ut_short_divide");
+
+
+ /* Always check for a zero divisor */
+
+ if (divisor == 0) {
+ REPORT_ERROR (("Acpi_ut_short_divide: Divide by zero\n"));
+ return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
+ }
+
+ /* Return only what was requested */
+
+ if (out_quotient) {
+ *out_quotient = *in_dividend / divisor;
+ }
+ if (out_remainder) {
+ *out_remainder = (u32) *in_dividend % divisor;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+acpi_status
+acpi_ut_divide (
+ acpi_integer *in_dividend,
+ acpi_integer *in_divisor,
+ acpi_integer *out_quotient,
+ acpi_integer *out_remainder)
+{
+ FUNCTION_TRACE ("Ut_divide");
+
+
+ /* Always check for a zero divisor */
+
+ if (*in_divisor == 0) {
+ REPORT_ERROR (("Acpi_ut_divide: Divide by zero\n"));
+ return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
+ }
+
+
+ /* Return only what was requested */
+
+ if (out_quotient) {
+ *out_quotient = *in_dividend / *in_divisor;
+ }
+ if (out_remainder) {
+ *out_remainder = *in_dividend % *in_divisor;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+#endif
+
+
/*******************************************************************************
*
* Module Name: utmisc - common utility procedures
- * $Revision: 50 $
+ * $Revision: 52 $
*
******************************************************************************/
/* Init fields specific to the update struct */
+ state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE;
state->update.object = object;
state->update.value = action;
*
* RETURN: Status
*
- * DESCRIPTION: Create an "Update State" - a flavor of the generic state used
- * to update reference counts and delete complex objects such
- * as packages.
+ * DESCRIPTION: Create a "Package State"
*
******************************************************************************/
/* Init fields specific to the update struct */
+ state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE;
state->pkg.source_object = (acpi_operand_object *) internal_object;
state->pkg.dest_object = external_object;
state->pkg.index = index;
/* Init fields specific to the control struct */
- state->common.state = CONTROL_CONDITIONAL_EXECUTING;
+ state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL;
+ state->common.state = CONTROL_CONDITIONAL_EXECUTING;
return_PTR (state);
}
/******************************************************************************
*
* Module Name: utobject - ACPI object create/delete/size/cache routines
- * $Revision: 55 $
+ * $Revision: 57 $
*
*****************************************************************************/
return (FALSE);
}
- /* Check for a pointer within one of the ACPI tables */
-
- if (acpi_tb_system_table_pointer (object)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Object %p is a Pcode Ptr\n", object));
- return (FALSE);
- }
-
/* Check the descriptor type field */
if (!VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_INTERNAL)) {
/******************************************************************************
*
* Module Name: utxface - External interfaces for "global" ACPI functions
- * $Revision: 80 $
+ * $Revision: 82 $
*
*****************************************************************************/
acpi_status
acpi_terminate (void)
{
- acpi_status status;
-
-
FUNCTION_TRACE ("Acpi_terminate");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/* Terminate the AML Debugger if present */
DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = TRUE);
acpi_ut_mutex_terminate ();
+#ifdef ENABLE_DEBUGGER
+
+ /* Shut down the debugger */
+
+ acpi_db_terminate ();
+#endif
+
/* Now we can shutdown the OS-dependent layer */
acpi_os_terminate ();
+
return_ACPI_STATUS (AE_OK);
}
{
acpi_system_info *info_ptr;
u32 i;
- acpi_status status;
FUNCTION_TRACE ("Acpi_get_system_info");
- /* Ensure that ACPI has been initialized */
-
- ACPI_IS_INITIALIZATION_COMPLETE (status);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
/*
* Must have a valid buffer
*/
*/
MODULE_PARM(max_loop, "i");
MODULE_PARM_DESC(max_loop, "Maximum number of loop devices (1-255)");
+MODULE_LICENSE("GPL");
int loop_register_transfer(struct loop_func_table *funcs)
{
dep_tristate ' FIT TD-2000 protocol' CONFIG_PARIDE_FIT2 $CONFIG_PARIDE
dep_tristate ' FIT TD-3000 protocol' CONFIG_PARIDE_FIT3 $CONFIG_PARIDE
dep_tristate ' Shuttle EPAT/EPEZ protocol' CONFIG_PARIDE_EPAT $CONFIG_PARIDE
+if [ "$CONFIG_PARIDE_EPAT" != "n" ]; then
+ if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+ bool ' Support c7/c8 chips (EXPERIMENTAL)' CONFIG_PARIDE_EPATC8 $CONFIG_PARIDE
+ fi
+fi
+
dep_tristate ' Shuttle EPIA protocol' CONFIG_PARIDE_EPIA $CONFIG_PARIDE
dep_tristate ' Freecom IQ ASIC-2 protocol' CONFIG_PARIDE_FRIQ $CONFIG_PARIDE
dep_tristate ' FreeCom power protocol' CONFIG_PARIDE_FRPW $CONFIG_PARIDE
/* Changes:
1.01 GRG 1998.05.06 init_proto, release_proto
+ 1.02 Joshua b. Jore CPP(renamed), epat_connect, epat_disconnect
*/
-#define EPAT_VERSION "1.01"
+#define EPAT_VERSION "1.02"
#include <linux/module.h>
#include <linux/delay.h>
#define WRi(r,v) epat_write_regr(pi,0,r,v)
#define RRi(r) (epat_read_regr(pi,0,r))
-/* FIXME: the CCP stuff should be fixed to handle multiple EPATs on a chain */
+/* FIXME: the CPP stuff should be fixed to handle multiple EPATs on a chain */
-#define CCP(x) w2(4);w0(0x22);w0(0xaa);w0(0x55);w0(0);w0(0xff);\
+#define CPP(x) w2(4);w0(0x22);w0(0xaa);w0(0x55);w0(0);w0(0xff);\
w0(0x87);w0(0x78);w0(x);w2(4);w2(5);w2(4);w0(0xff);
static void epat_connect ( PIA *pi )
{ pi->saved_r0 = r0();
pi->saved_r2 = r2();
- CCP(0); CCP(0xe0);
+
+#ifdef CONFIG_PARIDE_EPATC8
+ /* Initialize the chip */
+ CPP(0);CPP(0x40);CPP(0xe0);
+ w0(0);w2(1);w2(4);
+ WR(0x8,0x12);WR(0xc,0x14);WR(0x12,0x10);
+ WR(0xe,0xf);WR(0xf,4);
+ /* WR(0xe,0xa);WR(0xf,4); */
+ WR(0xe,0xd);WR(0xf,0);
+ /* CPP(0x30); */
+
+ /* Connect to the chip */
+ CPP(0xe0);
+ w0(0);w2(1);w2(4); /* Idle into SPP */
+ if (pi->mode >= 3) {
+ w0(0);w2(1);w2(4);w2(0xc);
+ /* Request EPP */
+ w0(0x40);w2(6);w2(7);w2(4);w2(0xc);w2(4);
+ }
+#else
+ CPP(0); CPP(0xe0);
w0(0); w2(1); w2(4);
if (pi->mode >= 3) {
w0(0); w2(1); w2(4); w2(0xc);
w0(0x40); w2(6); w2(7); w2(4); w2(0xc); w2(4);
}
WR(8,0x10); WR(0xc,0x14); WR(0xa,0x38); WR(0x12,0x10);
+#endif
}
-static void epat_disconnect ( PIA *pi )
-
-{ CCP(0x30);
- w0(pi->saved_r0);
- w2(pi->saved_r2);
-}
+static void epat_disconnect (PIA *pi)
+{ CPP(0x30);
+ w0(pi->saved_r0);
+ w2(pi->saved_r2);
+}
static int epat_test_proto( PIA *pi, char * scratch, int verbose )
static void epat_init_proto( PIA *pi)
{ MOD_INC_USE_COUNT;
+ printk("epat_init_proto");
}
static void epat_release_proto( PIA *pi)
int pcd_init(void);
void cleanup_module( void );
+static int pcd_dev_open(struct inode *inode, struct file *file);
+static void pcd_dev_release(struct inode *inode, struct file *file);
static int pcd_open(struct cdrom_device_info *cdi, int purpose);
static void pcd_release(struct cdrom_device_info *cdi);
static int pcd_drive_status(struct cdrom_device_info *cdi, int slot_nr);
/* kernel glue structures */
+struct block_device_operations pcd_bdops = {
+ open: pcd_dev_open,
+ release: pcd_dev_release,
+ ioctl: cdrom_ioctl,
+ check_media_change: cdrom_media_changed,
+}
+
static struct cdrom_device_ops pcd_dops = {
pcd_open,
pcd_release,
/* get the atapi capabilities page */
pcd_probe_capabilities();
- if (register_blkdev(MAJOR_NR,name,&cdrom_fops)) {
+ if (register_blkdev(MAJOR_NR,name,&pcd_bdops)) {
printk("pcd: unable to get major number %d\n",MAJOR_NR);
return -1;
}
- for (unit=0;unit<PCD_UNITS;unit++)
- if (PCD.present) register_cdrom(&PCD.info);
+ for (unit=0;unit<PCD_UNITS;unit++) {
+ if (PCD.present) {
+ register_cdrom(&PCD.info);
+ devfs_plain_cdrom(&PCD.info, &pcd_bdops);
+ }
+ }
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST);
read_ahead[MAJOR_NR] = 8; /* 8 sector (4kB) read ahead */
return 0;
}
+static int pcd_dev_open(struct inode *inode, struct file *file)
+{
+ int err;
+
+ MOD_INC_USE_COUNT;
+ err = cdrom_open(inode, file);
+ if (err)
+ MOD_DEC_USE_COUNT;
+ return err;
+}
+
+static int pcd_dev_release(struct inode *inode, struct file *file)
+{
+ int err = cdrom_release(inode, file);
+ MOD_DEC_USE_COUNT;
+ return err;
+}
+
static int pcd_open(struct cdrom_device_info *cdi, int purpose)
{ int unit = DEVICE_NR(cdi->dev);
if ((unit >= PCD_UNITS) || (!PCD.present)) return -ENODEV;
- MOD_INC_USE_COUNT;
-
return 0;
}
static void pcd_release(struct cdrom_device_info *cdi)
-{ MOD_DEC_USE_COUNT;
+{
}
#ifdef MODULE
return 0;
}
-/*
- * Writing: just make sure the page gets marked dirty, so that
- * the page stealer won't grab it.
- */
-static int ramdisk_writepage(struct page *page)
-{
- SetPageDirty(page);
- UnlockPage(page);
- return 0;
-}
-
static int ramdisk_prepare_write(struct file *file, struct page *page, unsigned offset, unsigned to)
{
if (!Page_Uptodate(page)) {
static struct address_space_operations ramdisk_aops = {
readpage: ramdisk_readpage,
- writepage: ramdisk_writepage,
+ writepage: fail_writepage,
prepare_write: ramdisk_prepare_write,
commit_write: ramdisk_commit_write,
};
#define CHECKAUDIO if ((ret=check_for_audio_disc(cdi, cdo))) return ret
/* Not-exported routines. */
-static int cdrom_open(struct inode *ip, struct file *fp);
-static int cdrom_release(struct inode *ip, struct file *fp);
-static int cdrom_ioctl(struct inode *ip, struct file *fp,
- unsigned int cmd, unsigned long arg);
-static int cdrom_media_changed(kdev_t dev);
static int open_for_data(struct cdrom_device_info * cdi);
static int check_for_audio_disc(struct cdrom_device_info * cdi,
struct cdrom_device_ops * cdo);
static devfs_handle_t devfs_handle;
static struct unique_numspace cdrom_numspace = UNIQUE_NUMBERSPACE_INITIALISER;
-struct block_device_operations cdrom_fops =
-{
- open: cdrom_open,
- release: cdrom_release,
- ioctl: cdrom_ioctl,
- check_media_change: cdrom_media_changed,
-};
-
/* This macro makes sure we don't have to check on cdrom_device_ops
* existence in the run-time routines below. Change_capability is a
* hack to have the capability flags defined const, while we can still
int major = MAJOR(cdi->dev);
struct cdrom_device_ops *cdo = cdi->ops;
int *change_capability = (int *)&cdo->capability; /* hack */
- char vname[16];
cdinfo(CD_OPEN, "entering register_cdrom\n");
if (!devfs_handle)
devfs_handle = devfs_mk_dir (NULL, "cdroms", NULL);
cdi->number = devfs_alloc_unique_number (&cdrom_numspace);
- sprintf (vname, "cdrom%d", cdi->number);
if (cdi->de) {
int pos;
devfs_handle_t slave;
pos = devfs_generate_path (cdi->de, rname + 3,
sizeof rname - 3);
if (pos >= 0) {
+ char vname[16];
+ sprintf (vname, "cdrom%d", cdi->number);
strncpy (rname + pos, "../", 3);
devfs_mk_symlink (devfs_handle, vname,
DEVFS_FL_DEFAULT,
devfs_auto_unregister (cdi->de, slave);
}
}
- else {
- cdi->de =
- devfs_register (devfs_handle, vname, DEVFS_FL_DEFAULT,
- MAJOR (cdi->dev), MINOR (cdi->dev),
- S_IFBLK | S_IRUGO | S_IWUGO,
- &cdrom_fops, NULL);
- }
cdinfo(CD_REG_UNREG, "drive \"/dev/%s\" registered\n", cdi->name);
cdi->next = topCdromPtr;
topCdromPtr = cdi;
* is in their own interest: device control becomes a lot easier
* this way.
*/
-static
int cdrom_open(struct inode *ip, struct file *fp)
{
struct cdrom_device_info *cdi;
/* Admittedly, the logic below could be performed in a nicer way. */
-static
int cdrom_release(struct inode *ip, struct file *fp)
{
kdev_t dev = ip->i_rdev;
return ret;
}
-static int cdrom_media_changed(kdev_t dev)
+int cdrom_media_changed(kdev_t dev)
{
struct cdrom_device_info *cdi = cdrom_find_device(dev);
/* This talks to the VFS, which doesn't like errors - just 1 or 0.
* these days. ATAPI / SCSI specific code now mainly resides in
* mmc_ioct().
*/
-static int cdrom_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
+int cdrom_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
unsigned long arg)
{
kdev_t dev = ip->i_rdev;
EXPORT_SYMBOL(cdrom_count_tracks);
EXPORT_SYMBOL(register_cdrom);
EXPORT_SYMBOL(unregister_cdrom);
-EXPORT_SYMBOL(cdrom_fops);
+EXPORT_SYMBOL(cdrom_open);
+EXPORT_SYMBOL(cdrom_release);
+EXPORT_SYMBOL(cdrom_ioctl);
+EXPORT_SYMBOL(cdrom_media_changed);
EXPORT_SYMBOL(cdrom_number_of_slots);
EXPORT_SYMBOL(cdrom_select_disc);
EXPORT_SYMBOL(cdrom_mode_select);
return 0;
}
+static int scd_dev_open(struct inode *inode, struct file *file)
+{
+ int err;
+ MOD_INC_USE_COUNT;
+ err = cdrom_open(inode, file);
+ if (err)
+ MOD_DEC_USE_COUNT;
+ return err;
+}
+
+static int scd_dev_release(struct inode *inode, struct file *file)
+{
+ int err = cdrom_release(inode, file);
+ MOD_DEC_USE_COUNT;
+ return err;
+}
+
/*
* Open the drive for operations. Spin the drive up and read the table of
* contents if these have not already been done.
unsigned int res_size;
unsigned char params[2];
- MOD_INC_USE_COUNT;
if (sony_usage == 0) {
- if (scd_spinup() != 0) {
- MOD_DEC_USE_COUNT;
+ if (scd_spinup() != 0)
return -EIO;
- }
sony_get_toc();
if (!sony_toc_read) {
do_sony_cd_cmd(SONY_SPIN_DOWN_CMD, NULL, 0,
res_reg, &res_size);
- MOD_DEC_USE_COUNT;
return -EIO;
}
sony_spun_up = 0;
}
sony_usage--;
- MOD_DEC_USE_COUNT;
}
+struct block_device_operations scd_bdops =
+{
+ open: scd_dev_open,
+ release: scd_dev_release,
+ ioctl: cdrom_ioctl,
+ check_media_change: cdrom_media_changed,
+};
+
static struct cdrom_device_ops scd_dops = {
open:scd_open,
release:scd_release,
request_region(cdu31a_port, 4, "cdu31a");
- if (devfs_register_blkdev(MAJOR_NR, "cdu31a", &cdrom_fops)) {
+ if (devfs_register_blkdev(MAJOR_NR, "cdu31a", &scd_bdops)) {
printk("Unable to get major %d for CDU-31a\n",
MAJOR_NR);
goto errout2;
if (register_cdrom(&scd_info)) {
goto errout0;
}
+ devfs_plain_cdrom(&scd_info, &scd_bdops);
}
}
}
+static int cm206_dev_open(struct inode *inode, struct file *file)
+{
+ int err;
+ MOD_INC_USE_COUNT;
+ err = cdrom_open(inode, file);
+ if (err)
+ MOD_DEC_USE_COUNT;
+ return err;
+}
+
+static int cm206_dev_release(struct inode *inode, struct file *file)
+{
+ int err = cdrom_release(inode, file);
+ MOD_DEC_USE_COUNT;
+ return err;
+}
+
+struct block_device_operations cm206_bdops =
+{
+ open: cm206_dev_open,
+ release: cm206_dev_release,
+ ioctl: cdrom_ioctl,
+ check_media_change: cdrom_media_changed,
+};
+
/* The new open. The real opening strategy is defined in cdrom.c. */
static int cm206_open(struct cdrom_device_info *cdi, int purpose)
{
- MOD_INC_USE_COUNT;
if (!cd->openfiles) { /* reset only first time */
cd->background = 0;
reset_cm260();
FIRST_TRACK = 0; /* No valid disc status */
}
--cd->openfiles;
- MOD_DEC_USE_COUNT;
}
/* Empty buffer empties $sectors$ sectors of the adapter card buffer,
return -EIO;
}
printk(".\n");
- if (devfs_register_blkdev(MAJOR_NR, "cm206", &cdrom_fops) != 0) {
+ if (devfs_register_blkdev(MAJOR_NR, "cm206", &cm206_bdops) != 0) {
printk(KERN_INFO "Cannot register for major %d!\n",
MAJOR_NR);
cleanup(3);
cleanup(3);
return -EIO;
}
+ devfs_plain_cdrom(&cm206_info, &cm206_bdops);
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST);
blksize_size[MAJOR_NR] = cm206_blocksizes;
read_ahead[MAJOR_NR] = 16; /* reads ahead what? */
void *arg);
int mcd_drive_status(struct cdrom_device_info *cdi, int slot_nr);
+static int mcd_dev_open(struct inode *inode, struct file *file)
+{
+ int err;
+ MOD_INC_USE_COUNT;
+ err = cdrom_open(inode, file);
+ if (err)
+ MOD_DEC_USE_COUNT;
+ return err;
+}
+
+static int mcd_dev_release(struct inode *inode, struct file *file)
+{
+ int err = cdrom_release(inode, file);
+ MOD_DEC_USE_COUNT;
+ return err;
+}
+
+struct block_device_operations mcd_bdops =
+{
+ open: mcd_dev_open,
+ release: mcd_dev_release,
+ ioctl: cdrom_ioctl,
+ check_media_change: cdrom_media_changed,
+};
+
static struct timer_list mcd_timer;
static struct cdrom_device_ops mcd_dops = {
if (mcdPresent == 0)
return -ENXIO; /* no hardware */
- MOD_INC_USE_COUNT;
-
if (mcd_open_count || mcd_state != MCD_S_IDLE)
goto bump_count;
return 0;
err_out:
- MOD_DEC_USE_COUNT;
return -EIO;
}
if (!--mcd_open_count) {
mcd_invalidate_buffers();
}
- MOD_DEC_USE_COUNT;
}
return -EIO;
}
- if (devfs_register_blkdev(MAJOR_NR, "mcd", &cdrom_fops) != 0) {
+ if (devfs_register_blkdev(MAJOR_NR, "mcd", &mcd_bdops) != 0) {
printk(KERN_ERR "mcd: Unable to get major %d for Mitsumi CD-ROM\n", MAJOR_NR);
return -EIO;
}
cleanup(3);
return -EIO;
}
+ devfs_plain_cdrom(&mcd_info, &mcd_bdops);
printk(msg);
return 0;
int mcdx_init(void);
void do_mcdx_request(request_queue_t * q);
+static int mcdx_dev_open(struct inode *inode, struct file *file)
+{
+ int err;
+ MOD_INC_USE_COUNT;
+ err = cdrom_open(inode, file);
+ if (err)
+ MOD_DEC_USE_COUNT;
+ return err;
+}
+
+static int mcdx_dev_release(struct inode *inode, struct file *file)
+{
+ int err = cdrom_release(inode, file);
+ MOD_DEC_USE_COUNT;
+ return err;
+}
+
+struct block_device_operations mcdx_bdops =
+{
+ open: mcdx_dev_open,
+ release: mcdx_dev_release,
+ ioctl: cdrom_ioctl,
+ check_media_change: cdrom_media_changed,
+};
+
/* Indirect exported functions. These functions are exported by their
addresses, such as mcdx_open and mcdx_close in the
/* Make the modules looking used ... (thanx bjorn).
* But we shouldn't forget to decrement the module counter
* on error return */
- MOD_INC_USE_COUNT;
/* this is only done to test if the drive talks with us */
- if (-1 == mcdx_getstatus(stuffp, 1)) {
- MOD_DEC_USE_COUNT;
+ if (-1 == mcdx_getstatus(stuffp, 1))
return -EIO;
- }
if (stuffp->xxx) {
}
xtrace(OPENCLOSE, "open() init irq generation\n");
- if (-1 == mcdx_config(stuffp, 1)) {
- MOD_DEC_USE_COUNT;
+ if (-1 == mcdx_config(stuffp, 1))
return -EIO;
- }
#if FALLBACK
/* Set the read speed */
xwarn("AAA %x AAA\n", stuffp->readcmd);
MODE2 :
MODE1,
1))) {
- /* MOD_DEC_USE_COUNT, return -EIO; */
+ /* return -EIO; */
stuffp->xa = 0;
break;
}
/* xa disks will be read in raw mode, others not */
if (-1 == mcdx_setdrivemode(stuffp,
stuffp->xa ? RAW : COOKED,
- 1)) {
- MOD_DEC_USE_COUNT;
+ 1))
return -EIO;
- }
if (stuffp->audio) {
xinfo("open() audio disk found\n");
} else if (stuffp->lastsector >= 0) {
stuffp = mcdx_stuffp[MINOR(cdi->dev)];
--stuffp->users;
-
- MOD_DEC_USE_COUNT;
}
static int mcdx_media_changed(struct cdrom_device_info *cdi, int disc_nr)
}
xtrace(INIT, "init() register blkdev\n");
- if (devfs_register_blkdev(MAJOR_NR, "mcdx", &cdrom_fops) != 0) {
+ if (devfs_register_blkdev(MAJOR_NR, "mcdx", &mcdx_bdops) != 0) {
xwarn("%s=0x%3p,%d: Init failed. Can't get major %d.\n",
MCDX, stuffp->wreg_data, stuffp->irq, MAJOR_NR);
kfree(stuffp);
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
return 2;
}
+ devfs_plain_cdrom(&mcdx_info, &mcdx_bdops);
printk(msg);
return 0;
}
return (1);
}
/*==========================================================================*/
+
+static int sbpcd_dev_open(struct inode *inode, struct file *file)
+{
+ int err;
+ MOD_INC_USE_COUNT;
+ err = cdrom_open(inode, file);
+ if (err)
+ MOD_DEC_USE_COUNT;
+ return err;
+}
+
+static int sbpcd_dev_release(struct inode *inode, struct file *file)
+{
+ int err = cdrom_release(inode, file);
+ MOD_DEC_USE_COUNT;
+ return err;
+}
+
+static struct block_device_operations sbpcd_bdops =
+{
+ open: sbpcd_dev_open,
+ release: sbpcd_dev_release,
+ ioctl: cdrom_ioctl,
+ check_media_change: cdrom_media_changed,
+};
/*==========================================================================*/
/*
* Open the device special file. Check that a disk is in. Read TOC.
i = MINOR(cdi->dev);
- MOD_INC_USE_COUNT;
down(&ioctl_read_sem);
switch_drive(i);
}
}
up(&ioctl_read_sem);
- MOD_DEC_USE_COUNT;
return ;
}
/*==========================================================================*/
OUT(MIXER_data,0xCC); /* one nibble per channel, max. value: 0xFF */
#endif /* SOUND_BASE */
- if (devfs_register_blkdev(MAJOR_NR, major_name, &cdrom_fops) != 0)
+ if (devfs_register_blkdev(MAJOR_NR, major_name, &sbpcd_bdops) != 0)
{
msg(DBG_INF, "Can't get MAJOR %d for Matsushita CDROM\n", MAJOR_NR);
#ifdef MODULE
sbpcd_infop->de =
devfs_register (devfs_handle, nbuff, DEVFS_FL_DEFAULT,
MAJOR_NR, j, S_IFBLK | S_IRUGO | S_IWUGO,
- &cdrom_fops, NULL);
+ &sbpcd_bdops, NULL);
if (register_cdrom(sbpcd_infop))
{
printk(" sbpcd: Unable to register with Uniform CD-ROm driver\n");
-
Computone Intelliport II/Plus Multiport Serial Driver
-----------------------------------------------------
-Release Notes For Linux Kernel 2.2
-These notes have been tested on Linux kernels 2.0 and 2.2.
-
-Please refer to Documentation/computone.txt for information on the driver
-that is included with the kernel sources.
-
-
-Version: 1.2.9
-Date: 04/12/2000
-Fixes and Updates: Doug McNash
-Historical Author: Andrew Manison
-Kernel Integration: Mike Warfield <mhw@wittsend.com>
-
-1. INTRODUCTION
-
-This driver supports the entire family of Intelliport II/Plus controllers
-with the exception of the MicroChannel controllers.
-
-This driver was developed on the v2.0.x Linux source tree and has been
-tested up to v2.2.14; it will probably not work with earlier v1.X kernels,
-and has not yet been tested on the v2.1.x tree. The most likely problems
-will be in patching the kernel sources to support the driver. For this
-reason there are 2 different patch files for 2.0.XX and 2.2.XX kernels.
-Make sure you use the right one!
-Note that a version (1.2.5) is included in the 2.2.12+ kernels so this
-will not be a new install but and upgrade.
-
-
-2. QUICK INSTALLATION
-
-Hardware - If you have an ISA card, find a free interrupt and io port.
- List those in use with `cat /proc/interrupts` and
- `cat /proc/ioports`. Set the card dip switches to that free
- address. You may need to configure your BIOS to reserve the
- irq for the ISA card. PCI and EISA parameters are set
- automagically and need only be set to nonzero values.
- Insert card into computer with the power off before or after
- driver installation.
-
-Software - New Installation
-
-Module installation:
-
-a) Obtain driver-kernel patch file
-b) Copy to the linux source tree root, Run ip2build (if not patch)
-c) Determine free irq/address to use if any (configure BIOS if need be)
-d) Run "make config" or "make menuconfig" or "make xconfig"
- Select (m) module for CONFIG_COMPUTONE under character
- devices. CONFIG_PCI and CONFIG_MODULES also may need to be set.
-e) Set address on ISA cards then:
- edit /usr/src/linux/drivers/char/ip2/ip2.h if needed
- or
- edit /etc/modules.conf if needed (module).
- or both to match this setting.
-f) Run "make dep"
-g) Run "make modules"
-h) Run "make modules_install"
-i) Run "/sbin/depmod -a"
-i) install driver using `modprobe ip2 <options>` (options listed below)
-j) run mkip2dev
-
-
-Kernel installation:
-
-a) Obtain driver-kernel patch file
-b) Copy to the linux source tree root, Run ip2build (if not patch)
-c) Determine free irq/address to use if any (configure BIOS if need be)
-d) Run "make config" or "make menuconfig" or "make xconfig"
- Select (y) kernel for CONFIG_COMPUTONE under character
- devices. CONFIG_PCI may need to be set if you have PCI bus.
-e) Set address on ISA cards then:
- edit /usr/src/linux/drivers/char/ip2/ip2.h
-f) Run "make dep"
-g) Run "make zImage" or whatever target you prefer.
-h) mv /usr/src/linux/arch/i386/boot/zImage to /boot.
-i) add new config for this kernel into /etc/lilo.conf, run "lilo"
-j) reboot using this kernel
-k) make and run ip2/mkip2dev
-
-Software - Upgrades
-
-a) Install new sources in proper location, usually /usr/src/linux/drivers/char
-b) Follow steps above to create new kernel or modules
-
-3. INSTALLATION
-
-Previously, the driver sources were packaged with a set of patch files
-to update the character drivers' makefile and configuration file, and other
-kernel source files. A build script (ip2build) was included which applies
-the patches if needed, and build any utilities needed.
-What you receive may be a single patch file in conventional kernel
-patch format build script. That form can also be applied by
-running patch -p1 < ThePatchFile. Otherwise the drivers source may be
-a tar file, then untar and run ip2build if a new installation.
-
-The driver can be installed as a module (recommended) or built into the
-kernel. This is selected as for other drivers through the `make config`
-command from the root of the Linux source tree. If the driver is built
-into the kernel you will need to edit the file ip2.h to match the boards
-you are installing. See that file for instructions. If the driver is
-installed as a module the configuration can also be specified on the
-modprobe command line as follows:
-
- modprobe ip2 irq=irq1,irq2,irq3,irq4 io=addr1,addr2,addr3,addr4
-
-where irqnum is one of the valid Intelliport II interrupts (3,4,5,7,10,11,
-12,15) and addr1-4 are the base addresses for up to four controllers. If
-the irqs are not specified the driver uses the default in ip2/ip2.h (which
-selects polled mode). The io addresses are set to io=1 for PCI cards,i
-io=2 for EISA cards or io=[some valid ISA address] for ISA cards. If no
-base addresses are specified the defaults in ip2.h are used. If you are
-autoloading the driver module with kerneld or kmod the base addresses and
-interrupt number must also be set in ip2/ip2.h and recompile or just insert
-an options line in /etc/modules.conf or both. The command line takes
-precidence over the options line which takes precidence over the defaults
-in ip2.h.
-
-command line sample:
-
- modprobe ip2 io=1,0x328 irq=1,10
-
-/etc/modules.conf sample:
-
- options ip2 io=1,0x328 irq=1,10
- alias char-major-71 ip2
- alias char-major-72 ip2
- alias char-major-73 ip2
-
-the equivelant ip2.h:
-
-static ip2config_t ip2config =
-{
- {1,10,0,0},
- {
- 0x0001, // Board 0, ttyF0 - ttyF63 /* PCI card */
- 0x0328, // Board 1, ttyF64 - ttyF127 /* ISA card */
- 0x0000, // Board 2, ttyF128 - ttyF191 /* empty */
- 0x0000 // Board 3, ttyF192 - ttyF255 /* empty */
- }
-};
-
-Specifying an invalid or in-use ISA irq will default the driver into
-running in polled mode for that card. If all irq entries are 0 then
-all cards will operate in polled mode. Note that the PCI will be
-assigned it's irq by the BIOS and may not match what you specify.
-It must be non-zero otherwise it will be polled.
-
-Tarball Install:
-
-The whole tarfile should be untarred in the /usr/src/linux/drivers/char/
-directory. Most files required for the driver are placed in the ip2
-subdirectory. Then execute the script (for a new install only)
-
- ip2build
-
-which will patch the files.
-
-Kernel Patch Install:
-
- cd to the Linux source root, run patch -p1 < ThePatchFile.
-
-Now return to the root directory of the Linux
-source tree and run make config or make menuconfig. You will be prompted
-for the Computone drivers, either as a module or part of the kernel.
-If you have a PCI card you many need to select PCI bios support (CONFIG_PCI)
-if not enabled already. Ditto for CONFIG_MODULES if you use modules.
-
-If you select the driver as part of the kernel run :
-
- make depend
- make bzImage(,zlilo or whatever you do to create a bootable kernel)
-
-If you selected a module run :
-
- make modules && make modules_install
-
-The utility ip2mkdev creates all the device nodes required by the driver.
-For a device to be created it must be configured in the driver and the
-board must be installed. Only devices corresponding to real IntelliPort II
-ports are created. With multiple boards and expansion boxes this will
-leave gaps in the sequence of device names. ip2mkdev uses Linux tty naming
-conventions: ttyF0 - ttyF255 for normal devices, and cuf0 - cuf255 for
-callout devices. Note that the callout devices are going away in the
-future and that is what the warning messages are trying to tell you.
-
-4. USING THE DRIVERS
-
-As noted above, the driver implements the ports in accordance with Linux
-conventions, and the devices should be interchangeable with the standard
-serial devices. (This is a key point for problem reporting: please make
-sure that what you are trying do works on the ttySx/cuax ports first; then
-tell us what went wrong with the ip2 ports!)
-
-Higher speeds can be obtained using the setserial utility which remaps
-38,400 bps (extb) to 57,600 bps, 115,200 bps, or a custom speed.
-Intelliport II installations using the PowerPort expansion module can
-use the custom speed setting to select the highest speeds: 153,600 bps,
-230,400 bps, 307,200 bps, 460,800bps and 921,600 bps. The base for
-custom baud rate configuration is fixed at 921,600 for cards/expantion
-modules with ST654's and 115200 for those with Cirrus CD1400's. This
-corresponds to the maximum bit rates those chips are capable.
-For example if the baud base is 921600 and the baud divisor is 18 then
-the custom rate is 921600/18 = 51200 bps. See the setserial man page for
-complete details. Of course, if stty accepts the higher rates now you can
-use that as well as the standard ioctls().
-
-5. NOTES
-
-This is a release version of the driver, but it is impossible to test it
-in all configurations of Linux. If there is any anomalous behaviour that
-does not match the standard serial port's behaviour please let us know.
-
-Some installations report that characters fail to echo immediatly at a
-terminal if the kernel/modules are compiled with the CONFIG_M386 and
-the card is run in polling mode on a pentium class machine. Compiling
-with a more appropriate processor flag or running on interrupt would be
-the fix as well as the wise thing to do.
+Release Notes For Linux Kernel 2.2 and higher
+This file is now deprecated and will be removed at some point.
+Please refer to the file Documentation/computone.txt instead.
-Author: dougm@computone.com
-Testing: larryg@computone.com
-Support: support@computone.com
+Michael H. Warfield 08/12/2001
int
ip2_loadmain(int *, int *, unsigned char *, int ); // ref into ip2main.c
-#ifdef MODULE
+/* Note: Add compiled in defaults to these arrays, not to the structure
+ in ip2/ip2.h any longer. That structure WILL get overridden
+ by these values, or command line values, or insmod values!!! =mhw=
+*/
+static int io[IP2_MAX_BOARDS]= { 0, 0, 0, 0 };
+static int irq[IP2_MAX_BOARDS] = { -1, -1, -1, -1 };
+static int poll_only = 0;
-static int io[IP2_MAX_BOARDS]= { 0,};
-static int irq[IP2_MAX_BOARDS] = { 0,};
+#ifdef MODULE
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
MODULE_AUTHOR("Doug McNash");
MODULE_PARM_DESC(irq,"Interrupts for IntelliPort Cards");
MODULE_PARM(io,"1-"__MODULE_STRING(IP2_MAX_BOARDS) "i");
MODULE_PARM_DESC(io,"I/O ports for IntelliPort Cards");
+ MODULE_PARM(poll_only,"1i");
+ MODULE_PARM_DESC(poll_only,"Do not use card interrupts");
# endif /* LINUX_VERSION */
MOD_INC_USE_COUNT; // hold till done
+ if( poll_only ) {
+ /* Hard lock the interrupts to zero */
+ irq[0] = irq[1] = irq[2] = irq[3] = 0;
+ }
+
rc = ip2_loadmain(io,irq,(unsigned char *)fip_firm,sizeof(fip_firm));
// The call to lock and load main, create dep
int
ip2_init(void)
{
- // call to this is int tty_io.c so we need this
+ // call to this is in tty_io.c so we need this
return 0;
}
# define NULL ((void *) 0)
#endif
+/******************************************************************************
+ * ip2_setup:
+ * str: kernel command line string
+ *
+ * Can't autoprobe the boards so user must specify configuration on
+ * kernel command line. Sane people build it modular but the others
+ * come here.
+ *
+ * Alternating pairs of io,irq for up to 4 boards.
+ * ip2=io0,irq0,io1,irq1,io2,irq2,io3,irq3
+ *
+ * io=0 => No board
+ * io=1 => PCI
+ * io=2 => EISA
+ * else => ISA I/O address
+ *
+ * irq=0 or invalid for ISA will revert to polling mode
+ *
+ * Any value = -1, do not overwrite compiled in value.
+ *
+ ******************************************************************************/
+static int __init ip2_setup(char *str)
+{
+ int ints[10]; /* 4 boards, 2 parameters + 2 */
+ int i, j;
+
+ str = get_options (str, ARRAY_SIZE(ints), ints);
+
+ for( i = 0, j = 1; i < 4; i++ ) {
+ if( j > ints[0] ) {
+ break;
+ }
+ if( ints[j] >= 0 ) {
+ io[i] = ints[j];
+ }
+ j++;
+ if( j > ints[0] ) {
+ break;
+ }
+ if( ints[j] >= 0 ) {
+ irq[i] = ints[j];
+ }
+ j++;
+ }
+ return 1;
+}
+
int
ip2_init(void) {
- return ip2_loadmain(NULL,NULL,(unsigned char *)fip_firm,sizeof(fip_firm));
+ return ip2_loadmain(io,irq,(unsigned char *)fip_firm,sizeof(fip_firm));
}
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13))
+__setup("ip2=", ip2_setup);
+__initcall(ip2_init);
+#endif
+
#endif /* !MODULE */
//static UCHAR ct86[]={ 2, BTH, 0x56,0 }; // RCV_ENABLE
static UCHAR ct87[] = { 1, BYP, 0x57 }; // HW_TEST
//static UCHAR ct88[]={ 3, BTH, 0x58,0,0 }; // RCV_THRESHOLD
-//static UCHAR ct89[]={ 1, BYP, 0x59 }; // DSS_NOW
+static UCHAR ct89[]={ 1, BYP, 0x59 }; // DSS_NOW
//static UCHAR ct90[]={ 3, BYP, 0x5A,0,0 }; // Set SILO
//static UCHAR ct91[]={ 2, BYP, 0x5B,0 }; // timed break
pB->i2eStartMail = iiGetMail(pB);
+ // Throw it away and clear the mailbox structure element
+ pB->i2eStartMail = NO_MAIL_HERE;
+
// Everything is ok now, return with good status/
pB->i2eValid = I2E_MAGIC;
static void
ii2DelayTimer(unsigned int mseconds)
{
+ wait_queue_t wait;
+
+ init_waitqueue_entry(&wait, current);
+
init_timer ( pDelayTimer );
+ add_wait_queue(&pDelayWait, &wait);
+
+ set_current_state( TASK_INTERRUPTIBLE );
+
pDelayTimer->expires = jiffies + ( mseconds + 9 ) / 10;
pDelayTimer->function = ii2DelayWakeup;
pDelayTimer->data = 0;
add_timer ( pDelayTimer );
- interruptible_sleep_on ( &pDelayWait );
+
+ schedule();
+
+ set_current_state( TASK_RUNNING );
+ remove_wait_queue(&pDelayWait, &wait);
+
del_timer ( pDelayTimer );
}
rwlock_t read_fifo_spinlock;
rwlock_t write_fifo_spinlock;
+// For queuing interupt bottom half handlers. /\/\|=mhw=|\/\/
+ struct tq_struct tqueue_interrupt;
+
+ struct timer_list SendPendingTimer; // Used by iiSendPending
+ unsigned int SendPendingRetry;
+
#ifdef CONFIG_DEVFS_FS
/* Device handles into devfs */
devfs_handle_t devfs_ipl_handle;
pB->i2eWaitingForEmptyFifo |=
(pB->i2eOutMailWaiting & MB_OUT_STUFFED);
pB->i2eOutMailWaiting = 0;
+ pB->SendPendingRetry = 0;
+ } else {
+/* The only time we hit this area is when "iiTrySendMail" has
+ failed. That only occurs when the outbound mailbox is
+ still busy with the last message. We take a short breather
+ to let the board catch up with itself and then try again.
+ 16 Retries is the limit - then we got a borked board.
+ /\/\|=mhw=|\/\/ */
+
+ if( ++pB->SendPendingRetry < 16 ) {
+
+ init_timer( &(pB->SendPendingTimer) );
+ pB->SendPendingTimer.expires = jiffies + 1;
+ pB->SendPendingTimer.function = (void*)(unsigned long)iiSendPendingMail;
+ pB->SendPendingTimer.data = (unsigned long)pB;
+ add_timer( &(pB->SendPendingTimer) );
+ } else {
+ printk( KERN_ERR "IP2: iiSendPendingMail unable to queue outbound mail\n" );
+ }
}
}
}
pB->i2Dbuf_strip = pB->i2Dbuf_stuff = 0;
pB->i2Bbuf_strip = pB->i2Bbuf_stuff = 0;
+ pB->SendPendingRetry = 0;
+
memset ( pCh, 0, sizeof (i2ChanStr) * nChannels );
for (index = stuffIndex = 0, ppCh = (i2ChanStrPtr *)(pB->i2Fbuf);
pCh->ClosingDelay = 5*HZ/10;
pCh->ClosingWaitTime = 30*HZ;
-#ifdef USE_IQ
// Initialize task queue objects
pCh->tqueue_input.routine = (void(*)(void*)) do_input;
pCh->tqueue_input.data = pCh;
pCh->tqueue_status.routine = (void(*)(void*)) do_status;
pCh->tqueue_status.data = pCh;
-#endif
pCh->trace = ip2trace;
static void
i2DrainOutput(i2ChanStrPtr pCh, int timeout)
{
+ wait_queue_t wait;
i2eBordStrPtr pB;
#ifdef IP2DEBUG_TRACE
}
i2QueueCommands( PTYPE_INLINE, pCh, -1, 1, CMD_BMARK_REQ );
+
+ init_waitqueue_entry(&wait, current);
+ add_wait_queue(&(pCh->pBookmarkWait), &wait);
+ set_current_state( TASK_INTERRUPTIBLE );
+
serviceOutgoingFifo( pB );
- interruptible_sleep_on( &(pCh->pBookmarkWait) );
+ schedule(); // Now we take our interruptible sleep on
+
+ // Clean up the queue
+ set_current_state( TASK_RUNNING );
+ remove_wait_queue(&(pCh->pBookmarkWait), &wait);
// if expires == 0 then timer poped, then do not need to del_timer
if ((timeout > 0) && pCh->BookmarkTimer.expires &&
unsigned long flags;
- inmail = iiGetMail(pB);
+ /* This should be atomic because of the way we are called... */
+ if (NO_MAIL_HERE == ( inmail = pB->i2eStartMail ) ) {
+ inmail = iiGetMail(pB);
+ }
+ pB->i2eStartMail = NO_MAIL_HERE;
#ifdef IP2DEBUG_TRACE
ip2trace (ITRC_NO_PORT, ITRC_INTR, 2, 1, inmail );
* /etc/modules.conf and load with modprobe, kerneld or kmod, the kernel
* module loader
*/
+
+ /* This structure is NOW always initialized when the driver is initialized.
+ * Compiled in defaults MUST be added to the io and irq arrays in
+ * ip2.c. Those values are configurable from insmod parameters in the
+ * case of modules or from command line parameters (ip2=io,irq) when
+ * compiled in.
+ */
+
static ip2config_t ip2config =
{
{0,0,0,0}, // irqs
{ // Addresses
+ /* Do NOT set compile time defaults HERE! Use the arrays in
+ ip2.c! These WILL be overwritten! =mhw= */
0x0000, // Board 0, ttyF0 - ttyF63
0x0000, // Board 1, ttyF64 - ttyF127
0x0000, // Board 2, ttyF128 - ttyF191
*******************************************************************************/
// ToDo:
//
+// Fix the immediate DSS_NOW problem.
+//
// Done:
//
+// 1.2.12 /\/\|=mhw=|\/\/
+// Cleaned up some remove queue cut and paste errors
+//
+// 1.2.11 /\/\|=mhw=|\/\/
+// Clean up potential NULL pointer dereferences
+// Clean up devfs registration
+// Add kernel command line parsing for io and irq
+// Compile defaults for io and irq are now set in ip2.c not ip2/ip2.h!
+// Reworked poll_only hack for explicit parameter setting
+// You must now EXPLICITLY set poll_only = 1 or set all irqs to 0
+// Merged ip2_loadmain and old_ip2_init
+// Converted all instances of interruptible_sleep_on into queue calls
+// Most of these had no race conditions but better to clean up now
+//
+// 1.2.10 /\/\|=mhw=|\/\/
+// Fixed the bottom half interrupt handler and enabled USE_IQI
+// to split the interrupt handler into a formal top-half / bottom-half
+// Fixed timing window on high speed processors that queued messages to
+// the outbound mail fifo faster than the board could handle.
+//
// 1.2.9
// Four box EX was barfing on >128k kmalloc, made structure smaller by
// reducing output buffer size
/* String constants to identify ourselves */
static char *pcName = "Computone IntelliPort Plus multiport driver";
-static char *pcVersion = "1.2.9";
+static char *pcVersion = "1.2.11";
/* String constants for port names */
static char *pcDriver_name = "ip2";
void cleanup_module(void);
#endif
-int old_ip2_init(void);
-
/* Private (static) functions */
static int ip2_open(PTTY, struct file *);
static void ip2_close(PTTY, struct file *);
static void ip2_hangup(PTTY);
static void set_irq(int, int);
+static void ip2_interrupt_bh(i2eBordStrPtr pB);
static void ip2_interrupt(int irq, void *dev_id, struct pt_regs * regs);
static void ip2_poll(unsigned long arg);
static inline void service_all_boards(void);
open: ip2_ipl_open,
};
-static long irq_counter;
-static long bh_counter;
+static unsigned long irq_counter = 0;
+static unsigned long bh_counter = 0;
// Use immediate queue to service interrupts
-//#define USE_IQI // PCI&2.2 needs work
+#define USE_IQI
//#define USE_IQ // PCI&2.2 needs work
/* The timer_list entry for our poll routine. If interrupt operation is not
# endif /* LINUX_VERSION */
#endif /* MODULE */
-static int poll_only;
+static int poll_only = 0;
static int Eisa_irq;
static int Eisa_slot;
static char rirqs[IP2_MAX_BOARDS];
static int Valid_Irqs[] = { 3, 4, 5, 7, 10, 11, 12, 15, 0};
-/******************************************************************************/
-/* Initialisation Section */
-/******************************************************************************/
-int
-ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
-{
- int i;
- /* process command line arguments to modprobe or insmod i.e. iop & irqp */
- /* otherwise ip2config is initialized by what's in ip2/ip2.h */
- /* command line trumps initialization in ip2.h */
- /* first two args are null if builtin to kernel */
- if ((irqp != NULL) || (iop != NULL)) {
- for ( i = 0; i < IP2_MAX_BOARDS; ++i ) {
- if (irqp && irqp[i]) {
- ip2config.irq[i] = irqp[i];
- }
- if (iop && iop[i]) {
- ip2config.addr[i] = iop[i];
- }
- }
- }
- Fip_firmware = firmware;
- Fip_firmware_size = firmsize;
- return old_ip2_init();
-}
-
// Some functions to keep track of what irq's we have
static int __init
#ifdef IP2DEBUG_INIT
printk (KERN_DEBUG "Loading module ...\n" );
#endif
- //was return old_ip2_init();
return 0;
}
#endif /* MODULE */
#endif /* MODULE */
/******************************************************************************/
-/* Function: old_ip2_init() */
+/* Function: ip2_loadmain() */
/* Parameters: irq, io from command line of insmod et. al. */
+/* pointer to fip firmware and firmware size for boards */
/* Returns: Success (0) */
/* */
/* Description: */
#define IP2_SA_FLAGS 0
int __init
-old_ip2_init(void)
+ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
{
#ifdef CONFIG_DEVFS_FS
static devfs_handle_t devfs_handle;
ip2trace (ITRC_NO_PORT, ITRC_INIT, ITRC_ENTER, 0 );
#endif
+ /* process command line arguments to modprobe or
+ insmod i.e. iop & irqp */
+ /* irqp and iop should ALWAYS be specified now... But we check
+ them individually just to be sure, anyways... */
+ for ( i = 0; i < IP2_MAX_BOARDS; ++i ) {
+ if (iop) {
+ ip2config.addr[i] = iop[i];
+ if (irqp) {
+ if( irqp[i] >= 0 ) {
+ ip2config.irq[i] = irqp[i];
+ } else {
+ ip2config.irq[i] = 0;
+ }
+ // This is a little bit of a hack. If poll_only=1 on command
+ // line back in ip2.c OR all IRQs on all specified boards are
+ // explicitly set to 0, then drop to poll only mode and override
+ // PCI or EISA interrupts. This superceeds the old hack of
+ // triggering if all interrupts were zero (like da default).
+ // Still a hack but less prone to random acts of terrorism.
+ //
+ // What we really should do, now that the IRQ default is set
+ // to -1, is to use 0 as a hard coded, do not probe.
+ //
+ // /\/\|=mhw=|\/\/
+ poll_only |= irqp[i];
+ }
+ }
+ }
+ poll_only = !poll_only;
+
+ Fip_firmware = firmware;
+ Fip_firmware_size = firmsize;
+
/* Announce our presence */
printk( KERN_INFO "%s version %s\n", pcName, pcVersion );
}
loaded++;
- /* if all irq config is zero we shall poll_only */
- for ( i = 0; i < IP2_MAX_BOARDS; ++i ) {
- poll_only |= ip2config.irq[i];
- }
- poll_only = !poll_only;
-
/* Initialise the iiEllis subsystem. */
iiEllisInit();
pcibios_read_config_byte(pci_bus, pci_devfn,
PCI_INTERRUPT_LINE, &pci_irq);
- if (!is_valid_irq(pci_irq)) {
- printk( KERN_ERR "IP2: Bad PCI BIOS IRQ(%d)\n",pci_irq);
- pci_irq = 0;
- }
+// If the PCI BIOS assigned it, lets try and use it. If we
+// can't acquire it or it screws up, deal with it then.
+
+// if (!is_valid_irq(pci_irq)) {
+// printk( KERN_ERR "IP2: Bad PCI BIOS IRQ(%d)\n",pci_irq);
+// pci_irq = 0;
+// }
ip2config.irq[i] = pci_irq;
} else { // ann error
ip2config.addr[i] = 0;
status =
pci_read_config_byte(pci_dev_i, PCI_INTERRUPT_LINE, &pci_irq);
- if (!is_valid_irq(pci_irq)) {
- printk( KERN_ERR "IP2: Bad PCI BIOS IRQ(%d)\n",pci_irq);
- pci_irq = 0;
- }
+// If the PCI BIOS assigned it, lets try and use it. If we
+// can't acquire it or it screws up, deal with it then.
+
+// if (!is_valid_irq(pci_irq)) {
+// printk( KERN_ERR "IP2: Bad PCI BIOS IRQ(%d)\n",pci_irq);
+// pci_irq = 0;
+// }
ip2config.irq[i] = pci_irq;
} else { // ann error
ip2config.addr[i] = 0;
}
#ifdef CONFIG_DEVFS_FS
- sprintf( name, "ipl%d", i );
- i2BoardPtrTable[i]->devfs_ipl_handle =
- devfs_register (devfs_handle, name,
- DEVFS_FL_DEFAULT,
- IP2_IPL_MAJOR, 4 * i,
- S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR,
- &ip2_ipl, NULL);
-
- sprintf( name, "stat%d", i );
- i2BoardPtrTable[i]->devfs_stat_handle =
- devfs_register (devfs_handle, name,
- DEVFS_FL_DEFAULT,
- IP2_IPL_MAJOR, 4 * i + 1,
- S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR,
- &ip2_ipl, NULL);
-
- for ( box = 0; box < ABS_MAX_BOXES; ++box )
- {
- for ( j = 0; j < ABS_BIGGEST_BOX; ++j )
+ if ( NULL != ( pB = i2BoardPtrTable[i] ) ) {
+ sprintf( name, "ipl%d", i );
+ pB->devfs_ipl_handle =
+ devfs_register (devfs_handle, name,
+ DEVFS_FL_DEFAULT,
+ IP2_IPL_MAJOR, 4 * i,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR,
+ &ip2_ipl, NULL);
+
+ sprintf( name, "stat%d", i );
+ pB->devfs_stat_handle =
+ devfs_register (devfs_handle, name,
+ DEVFS_FL_DEFAULT,
+ IP2_IPL_MAJOR, 4 * i + 1,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR,
+ &ip2_ipl, NULL);
+
+ for ( box = 0; box < ABS_MAX_BOXES; ++box )
{
- if ( pB->i2eChannelMap[box] & (1 << j) )
- {
- tty_register_devfs(&ip2_tty_driver,
- 0, j + ABS_BIGGEST_BOX *
- (box+i*ABS_MAX_BOXES));
- tty_register_devfs(&ip2_callout_driver,
- 0, j + ABS_BIGGEST_BOX *
- (box+i*ABS_MAX_BOXES));
- }
+ for ( j = 0; j < ABS_BIGGEST_BOX; ++j )
+ {
+ if ( pB->i2eChannelMap[box] & (1 << j) )
+ {
+ tty_register_devfs(&ip2_tty_driver,
+ 0, j + ABS_BIGGEST_BOX *
+ (box+i*ABS_MAX_BOXES));
+ tty_register_devfs(&ip2_callout_driver,
+ 0, j + ABS_BIGGEST_BOX *
+ (box+i*ABS_MAX_BOXES));
+ }
+ }
}
}
#endif
if (poll_only) {
- ip2config.irq[i] = CIR_POLL;
+// Poll only forces driver to only use polling and
+// to ignore the probed PCI or EISA interrupts.
+ ip2config.irq[i] = CIR_POLL;
}
if ( ip2config.irq[i] == CIR_POLL ) {
retry:
if ( !iiInitialize ( pB ) ) {
printk ( KERN_ERR "IP2: Failed to initialize board at 0x%x, error %d\n",
pB->i2eBase, pB->i2eError );
- kfree ( pB );
- i2BoardPtrTable[boardnum] = NULL;
- return;
+ goto err_initialize;
}
- printk(KERN_INFO "Board %d: addr=0x%x irq=%d ", boardnum + 1,
+ printk(KERN_INFO "IP2: Board %d: addr=0x%x irq=%d\n", boardnum + 1,
ip2config.addr[boardnum], ip2config.irq[boardnum] );
if (0 != ( rc = check_region( ip2config.addr[boardnum], 8))) {
- i2BoardPtrTable[boardnum] = NULL;
- printk(KERN_ERR "bad addr=0x%x rc = %d\n",
+ printk(KERN_ERR "IP2: bad addr=0x%x rc = %d\n",
ip2config.addr[boardnum], rc );
- return;
+ goto err_initialize;
}
request_region( ip2config.addr[boardnum], 8, pcName );
if ( iiDownloadAll ( pB, (loadHdrStrPtr)Fip_firmware, 1, Fip_firmware_size )
!= II_DOWN_GOOD ) {
- printk ( KERN_ERR "IP2:failed to download loadware " );
+ printk ( KERN_ERR "IP2: failed to download loadware\n" );
+ goto err_release_region;
} else {
- printk ( KERN_INFO "fv=%d.%d.%d lv=%d.%d.%d\n",
+ printk ( KERN_INFO "IP2: fv=%d.%d.%d lv=%d.%d.%d\n",
pB->i2ePom.e.porVersion,
pB->i2ePom.e.porRevision,
pB->i2ePom.e.porSubRev, pB->i2eLVersion,
switch ( pB->i2ePom.e.porID & ~POR_ID_RESERVED ) {
default:
- printk( KERN_ERR "IP2: Unknown board type, ID = %x",
+ printk( KERN_ERR "IP2: Unknown board type, ID = %x\n",
pB->i2ePom.e.porID );
nports = 0;
- goto ex_exit;
+ goto err_release_region;
break;
case POR_ID_II_4: /* IntelliPort-II, ISA-4 (4xRJ45) */
- printk ( KERN_INFO "ISA-4" );
+ printk ( KERN_INFO "IP2: ISA-4\n" );
nports = 4;
break;
case POR_ID_II_8: /* IntelliPort-II, 8-port using standard brick. */
- printk ( KERN_INFO "ISA-8 std" );
+ printk ( KERN_INFO "IP2: ISA-8 std\n" );
nports = 8;
break;
case POR_ID_II_8R: /* IntelliPort-II, 8-port using RJ11's (no CTS) */
- printk ( KERN_INFO "ISA-8 RJ11" );
+ printk ( KERN_INFO "IP2: ISA-8 RJ11\n" );
nports = 8;
break;
}
DevTableMem[boardnum] = pCh =
kmalloc( sizeof(i2ChanStr) * nports, GFP_KERNEL );
+ if ( !pCh ) {
+ printk ( KERN_ERR "IP2: (i2_init_channel:) Out of memory.\n");
+ goto err_release_region;
+ }
if ( !i2InitChannels( pB, nports, pCh ) ) {
- printk(KERN_ERR "i2InitChannels failed: %d\n",pB->i2eError);
+ printk(KERN_ERR "IP2: i2InitChannels failed: %d\n",pB->i2eError);
+ kfree ( pCh );
+ goto err_release_region;
}
pB->i2eChannelPtr = &DevTable[portnum];
pB->i2eChannelCnt = ABS_MOST_PORTS;
}
}
}
- printk(KERN_INFO "IP2: EX box=%d ports=%d %d bit",
+ printk(KERN_INFO "IP2: EX box=%d ports=%d %d bit\n",
nboxes, nports, pB->i2eDataWidth16 ? 16 : 8 );
}
goto ex_exit;
- break;
}
DevTableMem[boardnum] = pCh =
kmalloc ( sizeof (i2ChanStr) * nports, GFP_KERNEL );
+ if ( !pCh ) {
+ printk ( KERN_ERR "IP2: (i2_init_channel:) Out of memory.\n");
+ goto err_release_region;
+ }
pB->i2eChannelPtr = pCh;
pB->i2eChannelCnt = nports;
- i2InitChannels ( pB, pB->i2eChannelCnt, pCh );
+ if ( !i2InitChannels( pB, nports, pCh ) ) {
+ printk(KERN_ERR "IP2: i2InitChannels failed: %d\n",pB->i2eError);
+ kfree ( pCh );
+ goto err_release_region;
+ }
pB->i2eChannelPtr = &DevTable[IP2_PORTS_PER_BOARD * boardnum];
for( i = 0; i < pB->i2eChannelCnt; ++i ) {
pCh++;
}
ex_exit:
- printk ( KERN_INFO "\n" );
+ pB->tqueue_interrupt.routine = (void(*)(void*)) ip2_interrupt_bh;
+ pB->tqueue_interrupt.data = pB;
+ return;
+
+err_release_region:
+ release_region(ip2config.addr[boardnum], 8);
+err_initialize:
+ kfree ( pB );
+ i2BoardPtrTable[boardnum] = NULL;
+ return;
}
/******************************************************************************/
}
-#ifdef USE_IQI
-static struct tq_struct
-senior_service =
-{ // it's the death that worse than fate
- NULL,
- 0,
- (void(*)(void*)) service_all_boards,
- NULL, //later - board address XXX
-};
-#endif
+/******************************************************************************/
+/* Function: ip2_interrupt_bh(pB) */
+/* Parameters: pB - pointer to the board structure */
+/* Returns: Nothing */
+/* */
+/* Description: */
+/* Service the board in a bottom half interrupt handler and then */
+/* reenable the board's interrupts if it has an IRQ number */
+/* */
+/******************************************************************************/
+static void
+ip2_interrupt_bh(i2eBordStrPtr pB)
+{
+// pB better well be set or we have a problem! We can only get
+// here from the IMMEDIATE queue. Here, we process the boards.
+// Checking pB doesn't cost much and it saves us from the sanity checkers.
+
+ bh_counter++;
+
+ if ( pB ) {
+ i2ServiceBoard( pB );
+ if( pB->i2eUsingIrq ) {
+// Re-enable his interrupts
+ iiEnableMailIrq(pB);
+ }
+ }
+}
+
/******************************************************************************/
/* Function: ip2_interrupt(int irq, void *dev_id, struct pt_regs * regs) */
/* */
/* Description: */
/* */
+/* Our task here is simply to identify each board which needs servicing. */
+/* If we are queuing then, queue it to be serviced, and disable its irq */
+/* mask otherwise process the board directly. */
+/* */
+/* We could queue by IRQ but that just complicates things on both ends */
+/* with very little gain in performance (how many instructions does */
+/* it take to iterate on the immediate queue). */
+/* */
/* */
/******************************************************************************/
static void
ip2trace (ITRC_NO_PORT, ITRC_INTR, 99, 1, irq );
#endif
-#ifdef USE_IQI
-
- queue_task(&senior_service, &tq_immediate);
- mark_bh(IMMEDIATE_BH);
-
-#else
/* Service just the boards on the list using this irq */
for( i = 0; i < i2nBoards; ++i ) {
pB = i2BoardPtrTable[i];
+
+// Only process those boards which match our IRQ.
+// IRQ = 0 for polled boards, we won't poll "IRQ" boards
+
if ( pB && (pB->i2eUsingIrq == irq) ) {
+#ifdef USE_IQI
+
+ if (NO_MAIL_HERE != ( pB->i2eStartMail = iiGetMail(pB))) {
+// Disable his interrupt (will be enabled when serviced)
+// This is mostly to protect from reentrancy.
+ iiDisableMailIrq(pB);
+
+// Park the board on the immediate queue for processing.
+ queue_task(&pB->tqueue_interrupt, &tq_immediate);
+
+// Make sure the immediate queue is flagged to fire.
+ mark_bh(IMMEDIATE_BH);
+ }
+#else
+// We are using immediate servicing here. This sucks and can
+// cause all sorts of havoc with ppp and others. The failsafe
+// check on iiSendPendingMail could also throw a hairball.
i2ServiceBoard( pB );
+#endif /* USE_IQI */
}
}
-#endif /* USE_IQI */
-
++irq_counter;
#ifdef IP2DEBUG_TRACE
#endif
TimerOn = 0; // it's the truth but not checked in service
- bh_counter++;
-
-#ifdef USE_IQI
-
- queue_task(&senior_service, &tq_immediate);
- mark_bh(IMMEDIATE_BH);
-
-#else
- // Just polled boards, service_all might be better
+ // Just polled boards, IRQ = 0 will hit all non-interrupt boards.
+ // It will NOT poll boards handled by hard interrupts.
+ // The issue of queued BH interrups is handled in ip2_interrupt().
ip2_interrupt(0, NULL, NULL);
-#endif /* USE_IQI */
-
PollTimer.expires = POLL_TIMEOUT;
add_timer( &PollTimer );
TimerOn = 1;
static int
ip2_open( PTTY tty, struct file *pFile )
{
+ wait_queue_t wait;
int rc = 0;
int do_clocal = 0;
i2ChanStrPtr pCh = DevTable[MINOR(tty->device)];
* 1. If the port is in the middle of closing wait for the completion
* and then return the appropriate error.
*/
+ init_waitqueue_entry(&wait, current);
+ add_wait_queue(&pCh->close_wait, &wait);
+ set_current_state( TASK_INTERRUPTIBLE );
+
if ( tty_hung_up_p(pFile) || ( pCh->flags & ASYNC_CLOSING )) {
if ( pCh->flags & ASYNC_CLOSING ) {
- interruptible_sleep_on( &pCh->close_wait);
+ schedule();
}
if ( tty_hung_up_p(pFile) ) {
+ set_current_state( TASK_RUNNING );
+ remove_wait_queue(&pCh->close_wait, &wait);
return( pCh->flags & ASYNC_HUP_NOTIFY ) ? -EAGAIN : -ERESTARTSYS;
}
}
+ set_current_state( TASK_RUNNING );
+ remove_wait_queue(&pCh->close_wait, &wait);
+
/*
* 2. If this is a callout device, make sure the normal port is not in
* use, and that someone else doesn't have the callout device locked.
#endif
++pCh->wopen;
+
+ init_waitqueue_entry(&wait, current);
+ add_wait_queue(&pCh->open_wait, &wait);
+
for(;;) {
if ( !(pCh->flags & ASYNC_CALLOUT_ACTIVE)) {
i2QueueCommands(PTYPE_INLINE, pCh, 100, 2, CMD_DTRUP, CMD_RTSUP);
pCh->dataSetOut |= (I2_DTR | I2_RTS);
+ set_current_state( TASK_INTERRUPTIBLE );
serviceOutgoingFifo( pCh->pMyBord );
}
if ( tty_hung_up_p(pFile) ) {
+ set_current_state( TASK_RUNNING );
+ remove_wait_queue(&pCh->open_wait, &wait);
return ( pCh->flags & ASYNC_HUP_NOTIFY ) ? -EBUSY : -ERESTARTSYS;
}
if ( !(pCh->flags & ASYNC_CALLOUT_ACTIVE) &&
rc = (( pCh->flags & ASYNC_HUP_NOTIFY ) ? -EAGAIN : -ERESTARTSYS);
break;
}
- interruptible_sleep_on(&pCh->open_wait);
+ schedule();
}
+ set_current_state( TASK_RUNNING );
+ remove_wait_queue(&pCh->open_wait, &wait);
+
--pCh->wopen; //why count?
#ifdef IP2DEBUG_TRACE
ip2trace (CHANN, ITRC_OPEN, 4, 0 );
{
i2ChanStrPtr pCh = tty->driver_data;
+ if( !pCh ) {
+ return;
+ }
+
#ifdef IP2DEBUG_TRACE
ip2trace (CHANN, ITRC_HANGUP, ITRC_ENTER, 0 );
#endif
i2QueueCommands(PTYPE_BYPASS, pCh, 0, 1, CMD_DCD_NREP);
i2QueueCommands(PTYPE_INLINE, pCh, 0, 2, CMD_CTSFL_DSAB, CMD_RTSFL_DSAB);
- if ( !tty || (tty->termios->c_cflag & HUPCL) ) {
+ if ( (tty->termios->c_cflag & HUPCL) ) {
i2QueueCommands(PTYPE_BYPASS, pCh, 0, 2, CMD_RTSDN, CMD_DTRDN);
pCh->dataSetOut &= ~(I2_DTR | I2_RTS);
i2QueueCommands( PTYPE_INLINE, pCh, 100, 1, CMD_PAUSE(25));
static int
ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
{
+ wait_queue_t wait;
i2ChanStrPtr pCh = DevTable[MINOR(tty->device)];
struct async_icount cprev, cnow; /* kernel counter temps */
struct serial_icounter_struct *p_cuser; /* user space */
to return the DSS signal status immediately. Why doesn't it do
the same thing in 2.2.14?
*/
-/*
+
+/* This thing is still busted in the 1.2.12 driver on 2.4.x
+ and even hoses the serial console so the oops can be trapped.
+ /\/\|=mhw=|\/\/ */
+
+#ifdef ENABLE_DSSNOW
i2QueueCommands(PTYPE_BYPASS, pCh, 100, 1, CMD_DSS_NOW);
+
+ init_waitqueue_entry(&wait, current);
+ add_wait_queue(&pCh->dss_now_wait, &wait);
+ set_current_state( TASK_INTERRUPTIBLE );
+
serviceOutgoingFifo( pCh->pMyBord );
- interruptible_sleep_on(&pCh->dss_now_wait);
+
+ schedule();
+
+ set_current_state( TASK_RUNNING );
+ remove_wait_queue(&pCh->dss_now_wait, &wait);
+
if (signal_pending(current)) {
return -EINTR;
}
-*/
+#endif
PUT_USER(rc,
((pCh->dataSetOut & I2_RTS) ? TIOCM_RTS : 0)
| ((pCh->dataSetOut & I2_DTR) ? TIOCM_DTR : 0)
restore_flags(flags);
i2QueueCommands(PTYPE_BYPASS, pCh, 100, 4,
CMD_DCD_REP, CMD_CTS_REP, CMD_DSR_REP, CMD_RI_REP);
+ init_waitqueue_entry(&wait, current);
+ add_wait_queue(&pCh->delta_msr_wait, &wait);
+ set_current_state( TASK_INTERRUPTIBLE );
+
serviceOutgoingFifo( pCh->pMyBord );
for(;;) {
#ifdef IP2DEBUG_TRACE
ip2trace (CHANN, ITRC_IOCTL, 10, 0 );
#endif
- interruptible_sleep_on(&pCh->delta_msr_wait);
+ schedule();
#ifdef IP2DEBUG_TRACE
ip2trace (CHANN, ITRC_IOCTL, 11, 0 );
#endif
}
cprev = cnow;
}
+ set_current_state( TASK_RUNNING );
+ remove_wait_queue(&pCh->delta_msr_wait, &wait);
+
i2QueueCommands(PTYPE_BYPASS, pCh, 100, 3,
CMD_CTS_NREP, CMD_DSR_NREP, CMD_RI_NREP);
if ( ! (pCh->flags & ASYNC_CHECK_CD)) {
#undef LP_DEBUG
+/* Bits used to manage claiming the parport device */
+#define LP_PREEMPT_REQUEST 1
+#define LP_PARPORT_CLAIMED 2
+
/* --- low-level port access ----------------------------------- */
#define r_dtr(x) (parport_read_data(lp_table[(x)].dev->port))
#define w_ctr(x,y) do { parport_write_control(lp_table[(x)].dev->port, (y)); } while (0)
#define w_dtr(x,y) do { parport_write_data(lp_table[(x)].dev->port, (y)); } while (0)
+/* Claim the parport or block trying unless we've already claimed it */
+static void lp_claim_parport_or_block(struct lp_struct *this_lp)
+{
+ if (!test_and_set_bit(LP_PARPORT_CLAIMED, &this_lp->bits)) {
+ parport_claim_or_block (this_lp->dev);
+ }
+}
+
+/* Claim the parport or block trying unless we've already claimed it */
+static void lp_release_parport(struct lp_struct *this_lp)
+{
+ if (test_and_clear_bit(LP_PARPORT_CLAIMED, &this_lp->bits)) {
+ parport_release (this_lp->dev);
+ }
+}
+
+
+
+static int lp_preempt(void *handle)
+{
+ struct lp_struct *this_lp = (struct lp_struct *)handle;
+ set_bit(LP_PREEMPT_REQUEST, &this_lp->bits);
+ return (1);
+}
+
+
+/*
+ * Try to negotiate to a new mode; if unsuccessful negotiate to
+ * compatibility mode. Return the mode we ended up in.
+ */
+static int lp_negotiate(struct parport * port, int mode)
+{
+ if (parport_negotiate (port, mode) != 0) {
+ mode = IEEE1284_MODE_COMPAT;
+ parport_negotiate (port, mode);
+ }
+
+ return (mode);
+}
+
static int lp_reset(int minor)
{
int retval;
- parport_claim_or_block (lp_table[minor].dev);
+ lp_claim_parport_or_block (&lp_table[minor]);
w_ctr(minor, LP_PSELECP);
udelay (LP_DELAY);
w_ctr(minor, LP_PSELECP | LP_PINITP);
retval = r_str(minor);
- parport_release (lp_table[minor].dev);
+ lp_release_parport (&lp_table[minor]);
return retval;
}
return;
polling = lp_table[minor].dev->port->irq == PARPORT_IRQ_NONE;
- if (polling) parport_release (lp_table[minor].dev);
+ if (polling) lp_release_parport (&lp_table[minor]);
interruptible_sleep_on_timeout (&lp_table[minor].waitq,
LP_TIMEOUT_POLLED);
- if (polling) parport_claim_or_block (lp_table[minor].dev);
+ if (polling) lp_claim_parport_or_block (&lp_table[minor]);
else parport_yield_blocking (lp_table[minor].dev);
}
static int lp_wait_ready(int minor)
{
int error = 0;
+
+ /* If we're not in compatibility mode, we're ready now! */
+ if (lp_table[minor].current_mode != IEEE1284_MODE_COMPAT) {
+ return (0);
+ }
+
do {
error = lp_check_status (minor);
if (error && (LP_F(minor) & LP_ABORT))
/* Claim Parport or sleep until it becomes available
*/
- parport_claim_or_block (lp_table[minor].dev);
-
- /* Go to compatibility mode. */
- parport_negotiate (port, IEEE1284_MODE_COMPAT);
+ lp_claim_parport_or_block (&lp_table[minor]);
+ /* Go to the proper mode. */
+ lp_table[minor].current_mode = lp_negotiate (port,
+ lp_table[minor].best_mode);
parport_set_timeout (lp_table[minor].dev,
lp_table[minor].timeout);
if (copy_size > 0) {
/* incomplete write -> check error ! */
- int error = lp_wait_ready (minor);
+ int error;
+
+ parport_negotiate (lp_table[minor].dev->port,
+ IEEE1284_MODE_COMPAT);
+ lp_table[minor].current_mode = IEEE1284_MODE_COMPAT;
+
+ error = lp_wait_ready (minor);
if (error) {
if (retv == 0)
}
parport_yield_blocking (lp_table[minor].dev);
+ lp_table[minor].current_mode
+ = lp_negotiate (port,
+ lp_table[minor].best_mode);
+
} else if (current->need_resched)
schedule ();
}
} while (count > 0);
- parport_release (lp_table[minor].dev);
+ if (test_and_clear_bit(LP_PREEMPT_REQUEST,
+ &lp_table[minor].bits)) {
+ printk(KERN_INFO "lp%d releasing parport\n", minor);
+ parport_negotiate (lp_table[minor].dev->port,
+ IEEE1284_MODE_COMPAT);
+ lp_table[minor].current_mode = IEEE1284_MODE_COMPAT;
+ lp_release_parport (&lp_table[minor]);
+ }
up (&lp_table[minor].port_mutex);
if (down_interruptible (&lp_table[minor].port_mutex))
return -EINTR;
- parport_claim_or_block (lp_table[minor].dev);
+ lp_claim_parport_or_block (&lp_table[minor]);
retval = parport_read (port, kbuf, count);
- parport_release (lp_table[minor].dev);
+ lp_release_parport (&lp_table[minor]);
if (retval > 0 && copy_to_user (buf, kbuf, retval))
retval = -EFAULT;
should most likely only ever be used by the tunelp application. */
if ((LP_F(minor) & LP_ABORTOPEN) && !(file->f_flags & O_NONBLOCK)) {
int status;
- parport_claim_or_block (lp_table[minor].dev);
+ lp_claim_parport_or_block (&lp_table[minor]);
status = r_str(minor);
- parport_release (lp_table[minor].dev);
+ lp_release_parport (&lp_table[minor]);
if (status & LP_POUTPA) {
printk(KERN_INFO "lp%d out of paper\n", minor);
LP_F(minor) &= ~LP_BUSY;
LP_F(minor) &= ~LP_BUSY;
return -ENOMEM;
}
+ /* Determine if the peripheral supports ECP mode */
+ lp_claim_parport_or_block (&lp_table[minor]);
+ if ( (lp_table[minor].dev->port->modes & PARPORT_MODE_ECP) &&
+ !parport_negotiate (lp_table[minor].dev->port,
+ IEEE1284_MODE_ECP)) {
+ printk (KERN_INFO "lp%d: ECP mode\n", minor);
+ lp_table[minor].best_mode = IEEE1284_MODE_ECP;
+ } else {
+ printk (KERN_INFO "lp%d: compatibility mode\n", minor);
+ lp_table[minor].best_mode = IEEE1284_MODE_COMPAT;
+ }
+ /* Leave peripheral in compatibility mode */
+ parport_negotiate (lp_table[minor].dev->port, IEEE1284_MODE_COMPAT);
+ lp_release_parport (&lp_table[minor]);
+ lp_table[minor].current_mode = IEEE1284_MODE_COMPAT;
return 0;
}
{
unsigned int minor = MINOR(inode->i_rdev);
+ lp_claim_parport_or_block (&lp_table[minor]);
+ parport_negotiate (lp_table[minor].dev->port, IEEE1284_MODE_COMPAT);
+ lp_table[minor].current_mode = IEEE1284_MODE_COMPAT;
+ lp_release_parport (&lp_table[minor]);
lock_kernel();
kfree(lp_table[minor].lp_buffer);
lp_table[minor].lp_buffer = NULL;
return -EFAULT;
break;
case LPGETSTATUS:
- parport_claim_or_block (lp_table[minor].dev);
+ lp_claim_parport_or_block (&lp_table[minor]);
status = r_str(minor);
- parport_release (lp_table[minor].dev);
+ lp_release_parport (&lp_table[minor]);
if (copy_to_user((int *) arg, &status, sizeof(int)))
return -EFAULT;
char name[8];
lp_table[nr].dev = parport_register_device(port, "lp",
- NULL, NULL, NULL, 0,
+ lp_preempt, NULL, NULL, 0,
(void *) &lp_table[nr]);
if (lp_table[nr].dev == NULL)
return 1;
struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
- return cdrom_fops.ioctl (inode, file, cmd, arg);
+ return cdrom_ioctl (inode, file, cmd, arg);
}
static
MOD_INC_USE_COUNT;
if (info->buffer == NULL)
info->buffer = (char *) kmalloc(SECTOR_BUFFER_SIZE, GFP_KERNEL);
- if ((info->buffer == NULL) || (rc = cdrom_fops.open(ip, fp))) {
+ if ((info->buffer == NULL) || (rc = cdrom_open(ip, fp))) {
drive->usage--;
MOD_DEC_USE_COUNT;
}
void ide_cdrom_release (struct inode *inode, struct file *file,
ide_drive_t *drive)
{
- cdrom_fops.release (inode, file);
+ cdrom_release (inode, file);
MOD_DEC_USE_COUNT;
}
static
int ide_cdrom_check_media_change (ide_drive_t *drive)
{
- return cdrom_fops.check_media_change(MKDEV (HWIF (drive)->major,
+ return cdrom_media_changed(MKDEV (HWIF (drive)->major,
(drive->select.b.unit) << PARTN_BITS));
}
# in the moment.
# Read ../../../Documentation/isdn/HiSax.cert for more informations.
#
-6f9433a8b696076562562d090e3c420f isac.c
-13c3eed869f5139f44c563e3a8fea1f5 isdnl1.c
-addcff863b0ff1e366c0f2ae9fa6e81e isdnl2.c
-7076deb94a363945c21ea27aca4a720a isdnl3.c
-51c603829b6cc4f8421f744ad657ceff tei.c
-669050ab5079f02887ed0239d86e5474 callc.c
-ecacd146b8f8881ef9349935dab3df4a cert.c
-fadeb3b85bb23bc1ac48470c0848d6fa l3dss1.c
-cf7dec9fac6283716904d26b99188476 l3_1tr6.c
-2f75c8765e1be13d114d5f4433cf364b elsa.c
-b4cf8a4dceed9ea6dcba65a85b4eecc7 diva.c
-dee3f8f40c6fe78a4b57729804b7e6cd sedlbauer.c
-0d79fe6dfc5bfaa4826970c41a6d273d hfc_pci.c
+d08b59f56fb9ed1fbd17713342c75081 isac.c
+e81e6e96f307e55f8b9777aca2b356d9 isdnl1.c
+cfd2527d9fb01885484cba74bfc67121 isdnl2.c
+8c6829f11459f9d044b5768803fb646d isdnl3.c
+d40f88dff4191d2660240749cbdcb688 tei.c
+3bd3bd05ee4cb25ffe046200b569a83a callc.c
+d518f52402ebc3f1be84e09af375313c cert.c
+c425de1f8be86e84006de63c9bb3cc5f l3dss1.c
+4c411e29d4103ba60e9af4e3e1234a99 l3_1tr6.c
+68c6cc2784f208e3247a5a555918d014 elsa.c
+8d63a85d7222cf7b40e663e543191d8f diva.c
+8c8cb4ce621fb84d8e337a696e75b0df sedlbauer.c
+ebe5613d535748409407568435b2be97 hfc_pci.c
# end of md5sums
-/* $Id: niccy.c,v 1.15.6.5 2001/09/23 22:24:50 kai Exp $
+/* $Id: niccy.c,v 1.15.6.6 2001/10/20 22:08:24 kai Exp $
*
* low level stuff for Dr. Neuhaus NICCY PnP and NICCY PCI and
* compatible (SAGEM cybermodem)
#include <linux/pci.h>
extern const char *CardType[];
-const char *niccy_revision = "$Revision: 1.15.6.5 $";
+const char *niccy_revision = "$Revision: 1.15.6.6 $";
#define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr)
val = inl(cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG);
val &= PCI_IRQ_DISABLE;
outl(val, cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG);
- release_region(cs->hw.niccy.cfg_reg, 0x80);
+ release_region(cs->hw.niccy.cfg_reg, 0x40);
release_region(cs->hw.niccy.isac, 4);
} else {
release_region(cs->hw.niccy.isac, 2);
return (0);
} else
request_region(cs->hw.niccy.isac, 4, "niccy");
- if (check_region(cs->hw.niccy.cfg_reg, 0x80)) {
+ if (check_region(cs->hw.niccy.cfg_reg, 0x40)) {
printk(KERN_WARNING
"HiSax: %s pci port %x-%x already in use\n",
CardType[card->typ],
cs->hw.niccy.cfg_reg,
- cs->hw.niccy.cfg_reg + 0x80);
+ cs->hw.niccy.cfg_reg + 0x40);
release_region(cs->hw.niccy.isac, 4);
return (0);
} else {
- request_region(cs->hw.niccy.cfg_reg, 0x80, "niccy pci");
+ request_region(cs->hw.niccy.cfg_reg, 0x40, "niccy pci");
}
#else
printk(KERN_WARNING "Niccy: io0 0 and NO_PCI_BIOS\n");
va_start(args, fmt);
vsprintf(buf, fmt, args);
- printk("buf %s\n", buf);
DBG(8, "%s", buf);
va_end(args);
}
// Fill the isochronous URB
fill_isoc_urb(urb[j], dev, pipe, buf,
- num_packets, packet_size, complete,
- context);
+ num_packets, packet_size, complete,
+ context);
}
return 0;
/* if we RECEIVE an ackowledge we enable the decompressor */
if(is->debug & 0x10)
printk(KERN_DEBUG "Enable decompression here!\n");
- if(proto == PPP_CCP)
+ if(proto == PPP_CCP) {
+ if (!mis->decompressor)
+ break;
mis->compflags |= SC_DECOMP_ON;
- else
+ } else {
+ if (!is->decompressor)
+ break;
is->compflags |= SC_LINK_DECOMP_ON;
+ }
break;
case CCP_RESETACK:
/* if we SEND an ackowledge we can/must enable the compressor */
if(is->debug & 0x10)
printk(KERN_DEBUG "Enable compression here!\n");
- if(proto == PPP_CCP)
+ if(proto == PPP_CCP) {
+ if (!is->compressor)
+ break;
is->compflags |= SC_COMP_ON;
- else
+ } else {
+ if (!is->compressor)
+ break;
is->compflags |= SC_LINK_COMP_ON;
+ }
break;
case CCP_RESETACK:
/* If we send a ACK we should reset our compressor */
*
* This code is GPL
*
- * $Id: cfi_cmdset_0002.c,v 1.51 2001/10/02 15:05:12 dwmw2 Exp $
+ * $Id: cfi_cmdset_0002.c,v 1.52 2001/10/24 09:37:30 dwmw2 Exp $
*
*/
major = cfi_read_query(map, base + (adr+3)*ofs_factor);
minor = cfi_read_query(map, base + (adr+4)*ofs_factor);
- printk(" Amd/Fujitsu Extended Query Table v%c.%c at 0x%4.4X\n",
+ printk(KERN_NOTICE " Amd/Fujitsu Extended Query Table v%c.%c at 0x%4.4X\n",
major, minor, adr);
cfi_send_gen_cmd(0xf0, 0x55, base, map, cfi, cfi->device_type, NULL);
unsigned long devsize = (1<<cfi->cfiq->DevSize) * cfi->interleave;
mtd = kmalloc(sizeof(*mtd), GFP_KERNEL);
- printk("number of %s chips: %d\n", (cfi->cfi_mode)?"JEDEC":"CFI",cfi->numchips);
+ printk(KERN_NOTICE "number of %s chips: %d\n", (cfi->cfi_mode)?"CFI":"JEDEC",cfi->numchips);
if (!mtd) {
- printk("Failed to allocate memory for MTD device\n");
+ printk(KERN_WARNING "Failed to allocate memory for MTD device\n");
kfree(cfi->cmdset_priv);
return NULL;
}
mtd->numeraseregions = cfi->cfiq->NumEraseRegions * cfi->numchips;
mtd->eraseregions = kmalloc(sizeof(struct mtd_erase_region_info) * mtd->numeraseregions, GFP_KERNEL);
if (!mtd->eraseregions) {
- printk("Failed to allocate memory for MTD erase region info\n");
+ printk(KERN_WARNING "Failed to allocate memory for MTD erase region info\n");
kfree(cfi->cmdset_priv);
return NULL;
}
}
if (offset != devsize) {
/* Argh */
- printk("Sum of regions (%lx) != total size of set of interleaved chips (%lx)\n", offset, devsize);
+ printk(KERN_WARNING "Sum of regions (%lx) != total size of set of interleaved chips (%lx)\n", offset, devsize);
kfree(mtd->eraseregions);
kfree(cfi->cmdset_priv);
return NULL;
}
+#if 0
// debug
for (i=0; i<mtd->numeraseregions;i++){
printk("%d: offset=0x%x,size=0x%x,blocks=%d\n",
mtd->eraseregions[i].erasesize,
mtd->eraseregions[i].numblocks);
}
+#endif
}
switch (CFIDEV_BUSWIDTH)
break;
default:
- printk("Unsupported buswidth\n");
+ printk(KERN_WARNING "Unsupported buswidth\n");
kfree(mtd);
kfree(cfi->cmdset_priv);
return NULL;
cfi_spin_lock(chip->mutex);
if (chip->state != FL_READY){
- printk("Waiting for chip to read, status = %d\n", chip->state);
+#if 0
+ printk(KERN_DEBUG "Waiting for chip to read, status = %d\n", chip->state);
+#endif
set_current_state(TASK_UNINTERRUPTIBLE);
add_wait_queue(&chip->wq, &wait);
cfi_spin_lock(chip->mutex);
if (chip->state != FL_READY){
- printk("Waiting for chip to write, status = %d\n", chip->state);
+#if 0
+ printk(KERN_DEBUG "Waiting for chip to write, status = %d\n", chip->state);
+#endif
set_current_state(TASK_UNINTERRUPTIBLE);
add_wait_queue(&chip->wq, &wait);
schedule();
remove_wait_queue(&chip->wq, &wait);
- printk("Wake up to write:\n");
#if 0
+ printk(KERN_DEBUG "Wake up to write:\n");
if(signal_pending(current))
return -EINTR;
#endif
}
if (Last[(Count - 1) % 4] != datum){
- printk("Last[%ld] is %x, datum is %x\n",(Count - 1) % 4,Last[(Count - 1) % 4],datum);
+ printk(KERN_WARNING "Last[%ld] is %x, datum is %x\n",(Count - 1) % 4,Last[(Count - 1) % 4],datum);
cfi_send_gen_cmd(0xF0, 0, chip->start, map, cfi, cfi->device_type, NULL);
DISABLE_VPP(map);
ret = -EIO;
add_wait_queue(&chip->wq, &wait);
cfi_spin_unlock(chip->mutex);
- printk("erase suspended. Sleeping\n");
+ printk(KERN_DEBUG "erase suspended. Sleeping\n");
schedule();
remove_wait_queue(&chip->wq, &wait);
if (time_after(jiffies, timeo)) {
chip->state = FL_READY;
cfi_spin_unlock(chip->mutex);
- printk("waiting for erase to complete timed out.");
+ printk(KERN_WARNING "waiting for erase to complete timed out.");
DISABLE_VPP(map);
return -EIO;
}
z++;
if ( 0 && !(z % 100 ))
- printk("chip not ready yet after erase. looping\n");
+ printk(KERN_WARNING "chip not ready yet after erase. looping\n");
cfi_udelay(1);
wake_up(&chip->wq);
}
else
- printk("Argh. Chip not in PM_SUSPENDED state upon resume()\n");
+ printk(KERN_ERR "Argh. Chip not in PM_SUSPENDED state upon resume()\n");
cfi_spin_unlock(chip->mutex);
}
struct ace_private *ap;
struct ace_regs *regs;
struct ace_info *info = NULL;
- unsigned long tmp_ptr, myjif;
+ u64 tmp_ptr;
+ unsigned long myjif;
u32 tig_ver, mac1, mac2, tmp, pci_state;
int board_idx, ecode = 0;
short i;
+2001-10-24 Dave Strauss <D.Strauss@motorola.com>
+
+ * parport_pc.c (parport_pc_compat_write_block_pio,
+ parport_pc_ecp_write_block_pio): Allow a few seconds for an ECP
+ transfer to finish up.
+
+2001-10-11 Tim Waugh <twaugh@redhat.com>
+
+ * parport_pc (sio_ite_8872_probe): New function, submitted by Rich
+ Liu from ITE. Cleaned up, removed bogus phys_to_virt calls.
+
+2001-10-24 Tim Waugh <twaugh@redhat.com>
+
+ * parport_pc.c: Support for AKS AladdinCARD. Patch from
+ Aladdin Knowledge Systems (Christian Groessler).
+
+2001-10-24 Tim Waugh <twaugh@redhat.com>
+
+ * ieee1284_ops.c (parport_ieee1284_ecp_read_data): Try to minimise
+ turnaround time.
+
+ * ieee1284.c (parport_poll_peripheral): Try a couple of times
+ first without delaying.
+
2001-10-10 Tim Waugh <twaugh@redhat.com>
* parport_pc.c: Support for OX16PCI954 PCI card.
int usec)
{
/* Zero return code is success, >0 is timeout. */
- int counter = usec / 5;
+ int count = usec / 5 + 2;
+ int i;
unsigned char status;
- for (; counter > 0; counter--) {
+ for (i = 0; i < count; i++) {
status = parport_read_status (port);
if ((status & mask) == result)
return 0;
return -EINTR;
if (current->need_resched)
break;
- udelay (5);
+ if (i >= 2)
+ udelay (5);
}
return 1;
struct pardevice *dev = port->cad;
unsigned char *buf = buffer;
int rle_count = 0; /* shut gcc up */
+ unsigned char ctl;
int rle = 0;
ssize_t count = 0;
port->ieee1284.phase = IEEE1284_PH_REV_DATA;
/* Set HostAck low to start accepting data. */
- parport_frob_control (port,
- PARPORT_CONTROL_AUTOFD
- | PARPORT_CONTROL_STROBE
- | PARPORT_CONTROL_INIT,
- PARPORT_CONTROL_AUTOFD);
+ ctl = parport_read_control (port);
+ ctl &= ~(PARPORT_CONTROL_STROBE | PARPORT_CONTROL_INIT);
+ parport_write_control (port,
+ ctl | PARPORT_CONTROL_AUTOFD);
while (count < len) {
long expire = jiffies + dev->timeout;
unsigned char byte;
}
/* Event 44: Set HostAck high, acknowledging handshake. */
- parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0);
+ parport_write_control (port, ctl);
/* Event 45: The peripheral has 35ms to set nAck high. */
if (parport_wait_peripheral (port, PARPORT_STATUS_ACK,
}
/* Event 46: Set HostAck low and accept the data. */
- parport_frob_control (port,
- PARPORT_CONTROL_AUTOFD,
- PARPORT_CONTROL_AUTOFD);
+ parport_write_control (port,
+ ctl | PARPORT_CONTROL_AUTOFD);
/* If we just read a run-length count, fetch the data. */
if (command)
{
size_t written;
int r;
+ long int expire;
+ const struct parport_pc_private *priv = port->physport->private_data;
/* Special case: a timeout of zero means we cannot call schedule(). */
if (!port->physport->cad->timeout)
written = parport_pc_fifo_write_block_pio (port, buf, length);
/* Finish up. */
- if (change_mode (port, ECR_PS2) == -EBUSY) {
- const struct parport_pc_private *priv =
- port->physport->private_data;
+ /* For some hardware we don't want to touch the mode until
+ * the FIFO is empty, so allow 4 seconds for each position
+ * in the fifo.
+ */
+ expire = jiffies + (priv->fifo_depth * HZ * 4);
+ do {
+ /* Wait for the FIFO to empty */
+ r = change_mode (port, ECR_PS2);
+ if (r != -EBUSY) {
+ break;
+ }
+ } while (time_before (jiffies, expire));
+ if (r == -EBUSY) {
printk (KERN_DEBUG "%s: FIFO is stuck\n", port->name);
{
size_t written;
int r;
+ long int expire;
+ const struct parport_pc_private *priv = port->physport->private_data;
/* Special case: a timeout of zero means we cannot call schedule(). */
if (!port->physport->cad->timeout)
written = parport_pc_fifo_write_block_pio (port, buf, length);
/* Finish up. */
- if (change_mode (port, ECR_PS2) == -EBUSY) {
- const struct parport_pc_private *priv =
- port->physport->private_data;
+ /* For some hardware we don't want to touch the mode until
+ * the FIFO is empty, so allow 4 seconds for each position
+ * in the fifo.
+ */
+ expire = jiffies + (priv->fifo_depth * (HZ * 4));
+ do {
+ /* Wait for the FIFO to empty */
+ r = change_mode (port, ECR_PS2);
+ if (r != -EBUSY) {
+ break;
+ }
+ } while (time_before (jiffies, expire));
+ if (r == -EBUSY) {
printk (KERN_DEBUG "%s: FIFO is stuck\n", port->name);
}
#ifdef CONFIG_PCI
+
+/* ITE support maintained by Rich Liu <richliu@poorman.org> */
+static int __devinit sio_ite_8872_probe (struct pci_dev *pdev, int autoirq,
+ int autodma)
+{
+ short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 };
+ u32 ite8872set;
+ u32 ite8872_lpt, ite8872_lpthi;
+ u8 ite8872_irq, type;
+ int irq;
+ int i;
+
+ DPRINTK (KERN_DEBUG "sio_ite_8872_probe()\n");
+
+ // make sure which one chip
+ for(i = 0; i < 5; i++) {
+ if (check_region (inta_addr[i], 0x8) >= 0) {
+ int test;
+ pci_write_config_dword (pdev, 0x60,
+ 0xe7000000 | inta_addr[i]);
+ pci_write_config_dword (pdev, 0x78,
+ 0x00000000 | inta_addr[i]);
+ test = inb (inta_addr[i]);
+ if (test != 0xff) break;
+ }
+ }
+ if(i >= 5) {
+ printk (KERN_INFO "parport_pc: cannot find ITE8872 INTA\n");
+ return 0;
+ }
+
+ type = inb (inta_addr[i] + 0x18);
+ type &= 0x0f;
+
+ switch (type) {
+ case 0x2:
+ printk (KERN_INFO "parport_pc: ITE8871 found (1P)\n");
+ ite8872set = 0x64200000;
+ break;
+ case 0xa:
+ printk (KERN_INFO "parport_pc: ITE8875 found (1P)\n");
+ ite8872set = 0x64200000;
+ break;
+ case 0xe:
+ printk (KERN_INFO "parport_pc: ITE8872 found (2S1P)\n");
+ ite8872set = 0x64e00000;
+ break;
+ case 0x6:
+ printk (KERN_INFO "parport_pc: ITE8873 found (1S1P)\n");
+ ite8872set = 0x64a00000;
+ break;
+ case 0x8:
+ DPRINTK (KERN_DEBUG "parport_pc: ITE8874 found (2S)\n");
+ return 0;
+ default:
+ printk (KERN_INFO "parport_pc: unknown ITE887x\n");
+ printk (KERN_INFO "parport_pc: please mail 'lspci -nvv' "
+ "output to Rich.Liu@ite.com.tw\n");
+ return 0;
+ }
+
+ pci_read_config_byte (pdev, 0x3c, &ite8872_irq);
+ pci_read_config_dword (pdev, 0x1c, &ite8872_lpt);
+ ite8872_lpt &= 0x0000ff00;
+ pci_read_config_dword (pdev, 0x20, &ite8872_lpthi);
+ ite8872_lpthi &= 0x0000ff00;
+ pci_write_config_dword (pdev, 0x6c, 0xe3000000 | ite8872_lpt);
+ pci_write_config_dword (pdev, 0x70, 0xe3000000 | ite8872_lpthi);
+ pci_write_config_dword (pdev, 0x80, (ite8872_lpthi<<16) | ite8872_lpt);
+ // SET SPP&EPP , Parallel Port NO DMA , Enable All Function
+ // SET Parallel IRQ
+ pci_write_config_dword (pdev, 0x9c,
+ ite8872set | (ite8872_irq * 0x11111));
+
+ DPRINTK (KERN_DEBUG "ITE887x: The IRQ is %d.\n", ite8872_irq);
+ DPRINTK (KERN_DEBUG "ITE887x: The PARALLEL I/O port is 0x%x.\n",
+ ite8872_lpt);
+ DPRINTK (KERN_DEBUG "ITE887x: The PARALLEL I/O porthi is 0x%x.\n",
+ ite8872_lpthi);
+
+ /* Let the user (or defaults) steer us away from interrupts */
+ irq = ite8872_irq;
+ if (autoirq != PARPORT_IRQ_AUTO)
+ irq = PARPORT_IRQ_NONE;
+
+ if (parport_pc_probe_port (ite8872_lpt, ite8872_lpthi,
+ irq, PARPORT_DMA_NONE, NULL)) {
+ printk (KERN_INFO
+ "parport_pc: ITE 8872 parallel port: io=0x%X",
+ ite8872_lpt);
+ if (irq != PARPORT_IRQ_NONE)
+ printk (", irq=%d", irq);
+ printk ("\n");
+ return 1;
+ }
+
+ return 0;
+}
+
/* Via support maintained by Jeff Garzik <jgarzik@mandrakesoft.com> */
static int __devinit sio_via_686a_probe (struct pci_dev *pdev, int autoirq,
int autodma)
enum parport_pc_sio_types {
sio_via_686a = 0, /* Via VT82C686A motherboard Super I/O */
+ sio_ite_8872,
last_sio
};
int (*probe) (struct pci_dev *pdev, int autoirq, int autodma);
} parport_pc_superio_info[] __devinitdata = {
{ sio_via_686a_probe, },
+ { sio_ite_8872_probe, },
};
avlab_2p,
oxsemi_954,
oxsemi_840,
+ aks_0100,
};
* and 840 locks up if you write 1 to bit 2! */
/* oxsemi_954 */ { 1, { { 0, -1 }, } },
/* oxsemi_840 */ { 1, { { 0, -1 }, } },
+ /* aks_0100 */ { 1, { { 0, 1 }, } },
};
static struct pci_device_id parport_pc_pci_tbl[] __devinitdata = {
/* Super-IO onboard chips */
{ 0x1106, 0x0686, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sio_via_686a },
+ { PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8872,
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, sio_ite_8872 },
/* PCI cards */
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_10x_550,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, oxsemi_954 },
{ PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_12PCI840,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, oxsemi_840 },
+ { PCI_VENDOR_ID_AKS, PCI_DEVICE_ID_AKS_ALADDINCARD,
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, aks_0100 },
{ 0, } /* terminate list */
};
MODULE_DEVICE_TABLE(pci,parport_pc_pci_tbl);
4033 Addtron Technology Co, Inc.
4143 Digital Equipment Corp
416c Aladdin Knowledge Systems
+ 0100 AladdinCARD
+ 0200 CPC
4444 Internext Compression Inc
4468 Bridgeport machines
4594 Cogetec Informatique Inc
return 1;
}
+static int sr_dev_open(struct inode *inode, struct file *file)
+{
+ int err;
+ MOD_INC_USE_COUNT;
+ err = cdrom_open(inode, file);
+ if (err)
+ MOD_DEC_USE_COUNT;
+ return err;
+}
+
+static int sr_dev_release(struct inode *inode, struct file *file)
+{
+ int err = cdrom_release(inode, file);
+ MOD_DEC_USE_COUNT;
+ return err;
+}
+
+struct block_device_operations sr_bdops =
+{
+ open: sr_dev_open,
+ release: sr_dev_release,
+ ioctl: cdrom_ioctl,
+ check_media_change: cdrom_media_changed,
+};
+
static int sr_open(struct cdrom_device_info *cdi, int purpose)
{
check_disk_change(cdi->dev);
return 0;
if (!sr_registered) {
- if (devfs_register_blkdev(MAJOR_NR, "sr", &cdrom_fops)) {
+ if (devfs_register_blkdev(MAJOR_NR, "sr", &sr_bdops)) {
printk("Unable to get major %d for SCSI-CD\n", MAJOR_NR);
return 1;
}
devfs_register (scsi_CDs[i].device->de, "cd",
DEVFS_FL_DEFAULT, MAJOR_NR, i,
S_IFBLK | S_IRUGO | S_IWUGO,
- &cdrom_fops, NULL);
+ &sr_bdops, NULL);
register_cdrom(&scsi_CDs[i].cdi);
}
typedef struct ohci {
struct ohci_hcca *hcca; /* hcca */
- u32 hcca_dma;
+ dma_addr_t hcca_dma;
int irq;
int disabled; /* e.g. got a UE, we're hung */
dbg("qh has not QH_TYPE");
return;
}
- dbg("QH @ %p/%08X:", qh, qh->dma_addr);
+ dbg("QH @ %p/%08llX:", qh, (u64)qh->dma_addr);
if (qh->hw.qh.head & UHCI_PTR_TERM)
dbg(" Head Terminate");
* provisions above, a recipient may use your version of this file
* under either the RHEPL or the GPL.
*
- * $Id: background.c,v 1.15 2001/09/20 08:05:04 dwmw2 Exp $
+ * $Id: background.c,v 1.16 2001/10/08 09:22:38 dwmw2 Exp $
*
*/
if (!thread_should_wake(c)) {
set_current_state (TASK_INTERRUPTIBLE);
D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread sleeping...\n"));
+ /* Yes, there's a race here; we checked thread_should_wake() before
+ setting current->state to TASK_INTERRUPTIBLE. But it doesn't
+ matter - We don't care if we miss a wakeup, because the GC thread
+ is only an optimisation anyway. */
+ schedule();
}
if (current->need_resched)
return 0;
}
-/*
- * Writing: just make sure the page gets marked dirty, so that
- * the page stealer won't grab it.
- */
-static int ramfs_writepage(struct page *page)
-{
- SetPageDirty(page);
- UnlockPage(page);
- return 0;
-}
-
static int ramfs_prepare_write(struct file *file, struct page *page, unsigned offset, unsigned to)
{
void *addr = kmap(page);
static struct address_space_operations ramfs_aops = {
readpage: ramfs_readpage,
- writepage: ramfs_writepage,
+ writepage: fail_writepage,
prepare_write: ramfs_prepare_write,
commit_write: ramfs_commit_write
};
};
/* the general block_device operations structure: */
-extern struct block_device_operations cdrom_fops;
+extern int cdrom_open(struct inode *, struct file *);
+extern int cdrom_release(struct inode *, struct file *);
+extern int cdrom_ioctl(struct inode *, struct file *, unsigned, unsigned long);
+extern int cdrom_media_changed(kdev_t);
extern int register_cdrom(struct cdrom_device_info *cdi);
extern int unregister_cdrom(struct cdrom_device_info *cdi);
+static inline void devfs_plain_cdrom(struct cdrom_device_info *cdi,
+ struct block_device_operations *ops)
+{
+ char vname[23];
+
+ sprintf (vname, "cdroms/cdrom%d", cdi->number);
+ cdi->de = devfs_register (NULL, vname, DEVFS_FL_DEFAULT,
+ MAJOR (cdi->dev), MINOR (cdi->dev),
+ S_IFBLK | S_IRUGO | S_IWUGO,
+ ops, NULL);
+}
+
typedef struct {
int data;
int audio;
struct semaphore port_mutex;
wait_queue_head_t dataq;
long timeout;
+ unsigned int best_mode;
+ unsigned int current_mode;
+ unsigned long bits;
};
/*
/*
* There is only one 'core' page-freeing function.
*/
+extern void FASTCALL(free_lru_page(struct page *));
extern void FASTCALL(__free_pages(struct page *page, unsigned int order));
extern void FASTCALL(free_pages(unsigned long addr, unsigned int order));
extern void clear_page_tables(struct mm_struct *, unsigned long, int);
+extern int fail_writepage(struct page *);
struct page * shmem_nopage(struct vm_area_struct * vma, unsigned long address, int no_share);
struct file *shmem_file_setup(char * name, loff_t size);
extern void shmem_lock(struct file * file, int lock);
#define PCI_VENDOR_ID_ITE 0x1283
#define PCI_DEVICE_ID_ITE_IT8172G 0x8172
+#define PCI_VENDOR_ID_ITE 0x1283
+#define PCI_DEVICE_ID_ITE_8872 0x8872
+
+
/* formerly Platform Tech */
#define PCI_VENDOR_ID_ESS_OLD 0x1285
#define PCI_DEVICE_ID_ESS_ESS0100 0x0100
#define PCI_DEVICE_ID_AVANCE_ALG2064 0x2064
#define PCI_DEVICE_ID_AVANCE_2302 0x2302
+#define PCI_VENDOR_ID_AKS 0x416c
+#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100
+#define PCI_DEVICE_ID_AKS_CPC 0x0200
+
#define PCI_VENDOR_ID_NETVIN 0x4a14
#define PCI_DEVICE_ID_NETVIN_NV5000SC 0x5000
list_del(&(page)->lru); \
ClearPageActive(page); \
nr_active_pages--; \
- DEBUG_LRU_PAGE(page); \
} while (0)
#define del_page_from_inactive_list(page) \
list_del(&(page)->lru); \
ClearPageInactive(page); \
nr_inactive_pages--; \
- DEBUG_LRU_PAGE(page); \
} while (0)
/*
}
#endif
- ep = &default_exec_domain;
+ ep = NULL;
out:
read_unlock(&exec_domains_lock);
return (ep);
O_TARGET := mm.o
-export-objs := shmem.o
+export-objs := shmem.o filemap.o
obj-y := memory.o mmap.o filemap.o mprotect.o mlock.o mremap.o \
vmalloc.o slab.o bootmem.o swap.o vmscan.o page_io.o \
return retval;
}
+/*
+ * In-memory filesystems have to fail their
+ * writepage function - and this has to be
+ * worked around in the VM layer..
+ *
+ * We
+ * - mark the page dirty again (but do NOT
+ * add it back to the inode dirty list, as
+ * that would livelock in fdatasync)
+ * - activate the page so that the page stealer
+ * doesn't try to write it out over and over
+ * again.
+ */
+int fail_writepage(struct page *page)
+{
+ activate_page(page);
+ SetPageDirty(page);
+ UnlockPage(page);
+ return 0;
+}
+
+EXPORT_SYMBOL(fail_writepage);
+
/**
* filemap_fdatasync - walk the list of dirty pages of the given address space
* and writepage() all of them.
if (!new_page)
goto no_mem;
copy_cow_page(old_page,new_page,address);
- page_cache_release(old_page);
+ free_lru_page(old_page);
/*
* Re-check the pte - we dropped the lock
if (PageReserved(old_page))
++mm->rss;
break_cow(vma, new_page, address, page_table);
+ lru_cache_add(new_page);
/* Free the old page.. */
new_page = old_page;
}
- page_cache_release(new_page);
+ free_lru_page(new_page);
return 1; /* Minor fault */
bad_wp_page:
printk("do_wp_page: bogus page at address %08lx (page 0x%lx)\n",address,(unsigned long)old_page);
return -1;
no_mem:
- page_cache_release(old_page);
+ free_lru_page(old_page);
spin_lock(&mm->page_table_lock);
return -1;
}
mm->rss++;
flush_page_to_ram(page);
entry = pte_mkwrite(pte_mkdirty(mk_pte(page, vma->vm_page_prot)));
+ lru_cache_add(page);
}
set_pte(page_table, entry);
return 0;
}
+void free_lru_page(struct page *page)
+{
+ if (!PageReserved(page) && put_page_testzero(page)) {
+ if (PageActive(page) || PageInactive(page))
+ lru_cache_del(page);
+ __free_pages_ok(page, 0);
+ }
+}
+
void __free_pages(struct page *page, unsigned int order)
{
if (!PageReserved(page) && put_page_testzero(page))
*/
static int shmem_writepage(struct page * page)
{
- int error;
struct shmem_inode_info *info;
swp_entry_t *entry, swap;
struct address_space *mapping;
info = SHMEM_I(inode);
getswap:
swap = get_swap_page();
- if (!swap.val) {
- activate_page(page);
- SetPageDirty(page);
- error = -ENOMEM;
- goto out;
- }
+ if (!swap.val)
+ return fail_writepage(page);
spin_lock(&info->lock);
entry = shmem_swp_entry(info, index, 0);
info->swapped++;
spin_unlock(&info->lock);
set_page_dirty(page);
- error = 0;
-out:
UnlockPage(page);
- return error;
+ return 0;
}
/*
*/
void lru_cache_add(struct page * page)
{
- if (!PageLocked(page))
- BUG();
- spin_lock(&pagemap_lru_lock);
- add_page_to_inactive_list(page);
- spin_unlock(&pagemap_lru_lock);
+ if (!PageActive(page) && !PageInactive(page)) {
+ spin_lock(&pagemap_lru_lock);
+ add_page_to_inactive_list(page);
+ spin_unlock(&pagemap_lru_lock);
+ }
}
/**
del_page_from_active_list(page);
} else if (PageInactive(page)) {
del_page_from_inactive_list(page);
- } else
- printk("VM: __lru_cache_del, found unknown page ?!\n");
+ } else {
+// printk("VM: __lru_cache_del, found unknown page ?!\n");
+ }
DEBUG_LRU_PAGE(page);
}
*/
void lru_cache_del(struct page * page)
{
- if (!PageLocked(page))
- BUG();
spin_lock(&pagemap_lru_lock);
__lru_cache_del(page);
spin_unlock(&pagemap_lru_lock);
delete_from_swap_cache(page);
UnlockPage(page);
}
- page_cache_release(page);
+ free_lru_page(page);
}
/*
/* Don't look at this pte if it's been accessed recently. */
if (ptep_test_and_clear_young(page_table)) {
- flush_tlb_page(vma, address);
mark_page_accessed(page);
return 0;
}
return 0;
}
-static int FASTCALL(shrink_cache(int nr_pages, int max_mapped, zone_t * classzone, unsigned int gfp_mask));
-static int shrink_cache(int nr_pages, int max_mapped, zone_t * classzone, unsigned int gfp_mask)
+static int FASTCALL(shrink_cache(int nr_pages, zone_t * classzone, unsigned int gfp_mask, int priority));
+static int shrink_cache(int nr_pages, zone_t * classzone, unsigned int gfp_mask, int priority)
{
struct list_head * entry;
+ int max_scan = nr_inactive_pages / priority;
+ int max_mapped = max_scan / 4;
spin_lock(&pagemap_lru_lock);
- while (max_mapped && (entry = inactive_list.prev) != &inactive_list) {
+ while (--max_scan >= 0 && (entry = inactive_list.prev) != &inactive_list) {
struct page * page;
if (unlikely(current->need_resched)) {
list_del(entry);
list_add(entry, &inactive_list);
+ /*
+ * Zero page counts can happen because we unlink the pages
+ * _after_ decrementing the usage count..
+ */
+ if (unlikely(!page_count(page)))
+ continue;
+
if (!memclass(page->zone, classzone))
continue;
/* Racy check to avoid trylocking when not worthwhile */
- if (!page->buffers && page_count(page) != 1)
+ if (!page->buffers && (page_count(page) != 1 || !page->mapping))
goto page_mapped;
/*
}
}
- if (unlikely(!page->mapping))
- BUG();
-
if (unlikely(!spin_trylock(&pagecache_lock))) {
/* we hold the page lock so the page cannot go away from under us */
spin_unlock(&pagemap_lru_lock);
}
/*
- * this is the non-racy check, it is critical to check
- * PageDirty _after_ we made sure the page is freeable
- * so not in use by anybody.
+ * this is the non-racy check for busy page.
*/
- if (!is_page_cache_freeable(page) || PageDirty(page)) {
+ if (!page->mapping || !is_page_cache_freeable(page)) {
spin_unlock(&pagecache_lock);
UnlockPage(page);
page_mapped:
- if (--max_mapped)
+ if (--max_mapped >= 0)
continue;
- break;
+
+ /*
+ * Alert! We've found too many mapped pages on the
+ * inactive list, so we start swapping out now!
+ */
+ spin_unlock(&pagemap_lru_lock);
+ swap_out(priority, gfp_mask, classzone);
+ return nr_pages;
+ }
+
+ /*
+ * It is critical to check PageDirty _after_ we made sure
+ * the page is freeable* so not in use by anybody.
+ */
+ if (PageDirty(page)) {
+ spin_unlock(&pagecache_lock);
+ UnlockPage(page);
+ continue;
}
/* point of no return */
static int FASTCALL(shrink_caches(zone_t * classzone, int priority, unsigned int gfp_mask, int nr_pages));
static int shrink_caches(zone_t * classzone, int priority, unsigned int gfp_mask, int nr_pages)
{
- int max_scan;
int chunk_size = nr_pages;
unsigned long ratio;
ratio = (unsigned long) nr_pages * nr_active_pages / ((nr_inactive_pages + 1) * 2);
refill_inactive(ratio);
- max_scan = nr_inactive_pages / priority;
- nr_pages = shrink_cache(nr_pages, max_scan, classzone, gfp_mask);
+ nr_pages = shrink_cache(nr_pages, classzone, gfp_mask, priority);
if (nr_pages <= 0)
return 0;
nr_pages = shrink_caches(classzone, priority, gfp_mask, nr_pages);
if (nr_pages <= 0)
return 1;
-
- ret |= swap_out(priority, gfp_mask, classzone);
} while (--priority);
return ret;