aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/parser/psxface.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/parser/psxface.c')
-rw-r--r--drivers/acpi/parser/psxface.c142
1 files changed, 61 insertions, 81 deletions
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c
index d1541fabaf0a..80c67f2d3dd2 100644
--- a/drivers/acpi/parser/psxface.c
+++ b/drivers/acpi/parser/psxface.c
@@ -41,27 +41,19 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acparser.h> 45#include <acpi/acparser.h>
47#include <acpi/acdispat.h> 46#include <acpi/acdispat.h>
48#include <acpi/acinterp.h> 47#include <acpi/acinterp.h>
49 48
50
51#define _COMPONENT ACPI_PARSER 49#define _COMPONENT ACPI_PARSER
52 ACPI_MODULE_NAME ("psxface") 50ACPI_MODULE_NAME("psxface")
53 51
54/* Local Prototypes */ 52/* Local Prototypes */
55 53static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info);
56static acpi_status
57acpi_ps_execute_pass (
58 struct acpi_parameter_info *info);
59 54
60static void 55static void
61acpi_ps_update_parameter_list ( 56acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action);
62 struct acpi_parameter_info *info,
63 u16 action);
64
65 57
66/******************************************************************************* 58/*******************************************************************************
67 * 59 *
@@ -86,27 +78,24 @@ acpi_ps_update_parameter_list (
86 * 78 *
87 ******************************************************************************/ 79 ******************************************************************************/
88 80
89acpi_status 81acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
90acpi_ps_execute_method (
91 struct acpi_parameter_info *info)
92{ 82{
93 acpi_status status; 83 acpi_status status;
94
95
96 ACPI_FUNCTION_TRACE ("ps_execute_method");
97 84
85 ACPI_FUNCTION_TRACE("ps_execute_method");
98 86
99 /* Validate the Info and method Node */ 87 /* Validate the Info and method Node */
100 88
101 if (!info || !info->node) { 89 if (!info || !info->node) {
102 return_ACPI_STATUS (AE_NULL_ENTRY); 90 return_ACPI_STATUS(AE_NULL_ENTRY);
103 } 91 }
104 92
105 /* Init for new method, wait on concurrency semaphore */ 93 /* Init for new method, wait on concurrency semaphore */
106 94
107 status = acpi_ds_begin_method_execution (info->node, info->obj_desc, NULL); 95 status =
108 if (ACPI_FAILURE (status)) { 96 acpi_ds_begin_method_execution(info->node, info->obj_desc, NULL);
109 return_ACPI_STATUS (status); 97 if (ACPI_FAILURE(status)) {
98 return_ACPI_STATUS(status);
110 } 99 }
111 100
112 /* 101 /*
@@ -114,55 +103,54 @@ acpi_ps_execute_method (
114 * objects (such as Operation Regions) can be created during the 103 * objects (such as Operation Regions) can be created during the
115 * first pass parse. 104 * first pass parse.
116 */ 105 */
117 status = acpi_ut_allocate_owner_id (&info->obj_desc->method.owner_id); 106 status = acpi_ut_allocate_owner_id(&info->obj_desc->method.owner_id);
118 if (ACPI_FAILURE (status)) { 107 if (ACPI_FAILURE(status)) {
119 return_ACPI_STATUS (status); 108 return_ACPI_STATUS(status);
120 } 109 }
121 110
122 /* 111 /*
123 * The caller "owns" the parameters, so give each one an extra 112 * The caller "owns" the parameters, so give each one an extra
124 * reference 113 * reference
125 */ 114 */
126 acpi_ps_update_parameter_list (info, REF_INCREMENT); 115 acpi_ps_update_parameter_list(info, REF_INCREMENT);
127 116
128 /* 117 /*
129 * 1) Perform the first pass parse of the method to enter any 118 * 1) Perform the first pass parse of the method to enter any
130 * named objects that it creates into the namespace 119 * named objects that it creates into the namespace
131 */ 120 */
132 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, 121 ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
133 "**** Begin Method Parse **** Entry=%p obj=%p\n", 122 "**** Begin Method Parse **** Entry=%p obj=%p\n",
134 info->node, info->obj_desc)); 123 info->node, info->obj_desc));
135 124
136 info->pass_number = 1; 125 info->pass_number = 1;
137 status = acpi_ps_execute_pass (info); 126 status = acpi_ps_execute_pass(info);
138 if (ACPI_FAILURE (status)) { 127 if (ACPI_FAILURE(status)) {
139 goto cleanup; 128 goto cleanup;
140 } 129 }
141 130
142 /* 131 /*
143 * 2) Execute the method. Performs second pass parse simultaneously 132 * 2) Execute the method. Performs second pass parse simultaneously
144 */ 133 */
145 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, 134 ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
146 "**** Begin Method Execution **** Entry=%p obj=%p\n", 135 "**** Begin Method Execution **** Entry=%p obj=%p\n",
147 info->node, info->obj_desc)); 136 info->node, info->obj_desc));
148 137
149 info->pass_number = 3; 138 info->pass_number = 3;
150 status = acpi_ps_execute_pass (info); 139 status = acpi_ps_execute_pass(info);
151
152 140
153cleanup: 141 cleanup:
154 if (info->obj_desc->method.owner_id) { 142 if (info->obj_desc->method.owner_id) {
155 acpi_ut_release_owner_id (&info->obj_desc->method.owner_id); 143 acpi_ut_release_owner_id(&info->obj_desc->method.owner_id);
156 } 144 }
157 145
158 /* Take away the extra reference that we gave the parameters above */ 146 /* Take away the extra reference that we gave the parameters above */
159 147
160 acpi_ps_update_parameter_list (info, REF_DECREMENT); 148 acpi_ps_update_parameter_list(info, REF_DECREMENT);
161 149
162 /* Exit now if error above */ 150 /* Exit now if error above */
163 151
164 if (ACPI_FAILURE (status)) { 152 if (ACPI_FAILURE(status)) {
165 return_ACPI_STATUS (status); 153 return_ACPI_STATUS(status);
166 } 154 }
167 155
168 /* 156 /*
@@ -170,17 +158,17 @@ cleanup:
170 * a control exception code 158 * a control exception code
171 */ 159 */
172 if (info->return_object) { 160 if (info->return_object) {
173 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n", 161 ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
174 info->return_object)); 162 "Method returned obj_desc=%p\n",
175 ACPI_DUMP_STACK_ENTRY (info->return_object); 163 info->return_object));
164 ACPI_DUMP_STACK_ENTRY(info->return_object);
176 165
177 status = AE_CTRL_RETURN_VALUE; 166 status = AE_CTRL_RETURN_VALUE;
178 } 167 }
179 168
180 return_ACPI_STATUS (status); 169 return_ACPI_STATUS(status);
181} 170}
182 171
183
184/******************************************************************************* 172/*******************************************************************************
185 * 173 *
186 * FUNCTION: acpi_ps_update_parameter_list 174 * FUNCTION: acpi_ps_update_parameter_list
@@ -196,26 +184,23 @@ cleanup:
196 ******************************************************************************/ 184 ******************************************************************************/
197 185
198static void 186static void
199acpi_ps_update_parameter_list ( 187acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action)
200 struct acpi_parameter_info *info,
201 u16 action)
202{ 188{
203 acpi_native_uint i; 189 acpi_native_uint i;
204
205 190
206 if ((info->parameter_type == ACPI_PARAM_ARGS) && 191 if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) {
207 (info->parameters)) {
208 /* Update reference count for each parameter */ 192 /* Update reference count for each parameter */
209 193
210 for (i = 0; info->parameters[i]; i++) { 194 for (i = 0; info->parameters[i]; i++) {
211 /* Ignore errors, just do them all */ 195 /* Ignore errors, just do them all */
212 196
213 (void) acpi_ut_update_object_reference (info->parameters[i], action); 197 (void)acpi_ut_update_object_reference(info->
198 parameters[i],
199 action);
214 } 200 }
215 } 201 }
216} 202}
217 203
218
219/******************************************************************************* 204/*******************************************************************************
220 * 205 *
221 * FUNCTION: acpi_ps_execute_pass 206 * FUNCTION: acpi_ps_execute_pass
@@ -229,53 +214,48 @@ acpi_ps_update_parameter_list (
229 * 214 *
230 ******************************************************************************/ 215 ******************************************************************************/
231 216
232static acpi_status 217static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info)
233acpi_ps_execute_pass (
234 struct acpi_parameter_info *info)
235{ 218{
236 acpi_status status; 219 acpi_status status;
237 union acpi_parse_object *op; 220 union acpi_parse_object *op;
238 struct acpi_walk_state *walk_state; 221 struct acpi_walk_state *walk_state;
239
240
241 ACPI_FUNCTION_TRACE ("ps_execute_pass");
242 222
223 ACPI_FUNCTION_TRACE("ps_execute_pass");
243 224
244 /* Create and init a Root Node */ 225 /* Create and init a Root Node */
245 226
246 op = acpi_ps_create_scope_op (); 227 op = acpi_ps_create_scope_op();
247 if (!op) { 228 if (!op) {
248 return_ACPI_STATUS (AE_NO_MEMORY); 229 return_ACPI_STATUS(AE_NO_MEMORY);
249 } 230 }
250 231
251 /* Create and initialize a new walk state */ 232 /* Create and initialize a new walk state */
252 233
253 walk_state = acpi_ds_create_walk_state ( 234 walk_state =
254 info->obj_desc->method.owner_id, NULL, NULL, NULL); 235 acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL,
236 NULL, NULL);
255 if (!walk_state) { 237 if (!walk_state) {
256 status = AE_NO_MEMORY; 238 status = AE_NO_MEMORY;
257 goto cleanup; 239 goto cleanup;
258 } 240 }
259 241
260 status = acpi_ds_init_aml_walk (walk_state, op, info->node, 242 status = acpi_ds_init_aml_walk(walk_state, op, info->node,
261 info->obj_desc->method.aml_start, 243 info->obj_desc->method.aml_start,
262 info->obj_desc->method.aml_length, 244 info->obj_desc->method.aml_length,
263 info->pass_number == 1 ? NULL : info, 245 info->pass_number == 1 ? NULL : info,
264 info->pass_number); 246 info->pass_number);
265 if (ACPI_FAILURE (status)) { 247 if (ACPI_FAILURE(status)) {
266 acpi_ds_delete_walk_state (walk_state); 248 acpi_ds_delete_walk_state(walk_state);
267 goto cleanup; 249 goto cleanup;
268 } 250 }
269 251
270 /* Parse the AML */ 252 /* Parse the AML */
271 253
272 status = acpi_ps_parse_aml (walk_state); 254 status = acpi_ps_parse_aml(walk_state);
273 255
274 /* Walk state was deleted by parse_aml */ 256 /* Walk state was deleted by parse_aml */
275 257
276cleanup: 258 cleanup:
277 acpi_ps_delete_parse_tree (op); 259 acpi_ps_delete_parse_tree(op);
278 return_ACPI_STATUS (status); 260 return_ACPI_STATUS(status);
279} 261}
280
281