Merge with 2.4.0-test3-pre4.
[linux-2.6/linux-mips.git] / drivers / acpi / parser / psxface.c
blob667df681ec4a538f8136ae1ab0cea1d1ce76024b
2 /******************************************************************************
4 * Module Name: psxface - Parser external interfaces
6 *****************************************************************************/
8 /*
9 * Copyright (C) 2000 R. Byron Moore
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include "acpi.h"
28 #include "parser.h"
29 #include "dispatch.h"
30 #include "interp.h"
31 #include "amlcode.h"
32 #include "namesp.h"
35 #define _COMPONENT PARSER
36 MODULE_NAME ("psxface");
39 char *acpi_gbl_parser_id = "Non-recursive AML Parser";
42 /*****************************************************************************
44 * FUNCTION: Acpi_psx_execute
46 * PARAMETERS: Obj_desc - A method object containing both the AML
47 * address and length.
48 * **Params - List of parameters to pass to method,
49 * terminated by NULL. Params itself may be
50 * NULL if no parameters are being passed.
52 * RETURN: Status
54 * DESCRIPTION: Execute a control method
56 ****************************************************************************/
58 ACPI_STATUS
59 acpi_psx_execute (
60 ACPI_NAMED_OBJECT *method_entry,
61 ACPI_OBJECT_INTERNAL **params,
62 ACPI_OBJECT_INTERNAL **return_obj_desc)
64 ACPI_STATUS status;
65 ACPI_OBJECT_INTERNAL *obj_desc;
66 u32 i;
69 /* Validate the NTE and get the attached object */
71 if (!method_entry) {
72 return (AE_NULL_ENTRY);
75 obj_desc = acpi_ns_get_attached_object (method_entry);
76 if (!obj_desc) {
77 return (AE_NULL_OBJECT);
80 /* Parse method if necessary, wait on concurrency semaphore */
82 status = acpi_ds_begin_method_execution (method_entry, obj_desc);
83 if (ACPI_FAILURE (status)) {
84 return (status);
87 if (params) {
89 * The caller "owns" the parameters, so give each one an extra
90 * reference
93 for (i = 0; params[i]; i++) {
94 acpi_cm_add_reference (params[i]);
99 * Method is parsed and ready to execute
100 * The walk of the parse tree is where we actually execute the method
103 status = acpi_ps_walk_parsed_aml (obj_desc->method.parser_op,
104 obj_desc->method.parser_op, obj_desc,
105 method_entry->child_table, params, return_obj_desc,
106 obj_desc->method.owning_id, acpi_ds_exec_begin_op,
107 acpi_ds_exec_end_op);
109 if (params) {
110 /* Take away the extra reference that we gave the parameters above */
112 for (i = 0; params[i]; i++) {
113 acpi_cm_update_object_reference (params[i], REF_DECREMENT);
119 * Normal exit is with Status == AE_RETURN_VALUE when a Return_op has been
120 * executed, or with Status == AE_PENDING at end of AML block (end of
121 * Method code)
124 if (*return_obj_desc) {
125 status = AE_CTRL_RETURN_VALUE;
129 return (status);