aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/parser/pstree.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/parser/pstree.c')
-rw-r--r--drivers/acpi/parser/pstree.c92
1 files changed, 30 insertions, 62 deletions
diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c
index d5aafe73fca0..f0e755884eea 100644
--- a/drivers/acpi/parser/pstree.c
+++ b/drivers/acpi/parser/pstree.c
@@ -41,23 +41,18 @@
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/amlcode.h> 46#include <acpi/amlcode.h>
48 47
49#define _COMPONENT ACPI_PARSER 48#define _COMPONENT ACPI_PARSER
50 ACPI_MODULE_NAME ("pstree") 49ACPI_MODULE_NAME("pstree")
51 50
52/* Local prototypes */ 51/* Local prototypes */
53
54#ifdef ACPI_OBSOLETE_FUNCTIONS 52#ifdef ACPI_OBSOLETE_FUNCTIONS
55union acpi_parse_object * 53union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op);
56acpi_ps_get_child (
57 union acpi_parse_object *op);
58#endif 54#endif
59 55
60
61/******************************************************************************* 56/*******************************************************************************
62 * 57 *
63 * FUNCTION: acpi_ps_get_arg 58 * FUNCTION: acpi_ps_get_arg
@@ -71,21 +66,16 @@ acpi_ps_get_child (
71 * 66 *
72 ******************************************************************************/ 67 ******************************************************************************/
73 68
74union acpi_parse_object * 69union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
75acpi_ps_get_arg (
76 union acpi_parse_object *op,
77 u32 argn)
78{ 70{
79 union acpi_parse_object *arg = NULL; 71 union acpi_parse_object *arg = NULL;
80 const struct acpi_opcode_info *op_info; 72 const struct acpi_opcode_info *op_info;
81
82
83 ACPI_FUNCTION_ENTRY ();
84 73
74 ACPI_FUNCTION_ENTRY();
85 75
86 /* Get the info structure for this opcode */ 76 /* Get the info structure for this opcode */
87 77
88 op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); 78 op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
89 if (op_info->class == AML_CLASS_UNKNOWN) { 79 if (op_info->class == AML_CLASS_UNKNOWN) {
90 /* Invalid opcode or ASCII character */ 80 /* Invalid opcode or ASCII character */
91 81
@@ -111,7 +101,6 @@ acpi_ps_get_arg (
111 return (arg); 101 return (arg);
112} 102}
113 103
114
115/******************************************************************************* 104/*******************************************************************************
116 * 105 *
117 * FUNCTION: acpi_ps_append_arg 106 * FUNCTION: acpi_ps_append_arg
@@ -126,16 +115,12 @@ acpi_ps_get_arg (
126 ******************************************************************************/ 115 ******************************************************************************/
127 116
128void 117void
129acpi_ps_append_arg ( 118acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
130 union acpi_parse_object *op,
131 union acpi_parse_object *arg)
132{ 119{
133 union acpi_parse_object *prev_arg; 120 union acpi_parse_object *prev_arg;
134 const struct acpi_opcode_info *op_info; 121 const struct acpi_opcode_info *op_info;
135
136
137 ACPI_FUNCTION_ENTRY ();
138 122
123 ACPI_FUNCTION_ENTRY();
139 124
140 if (!op) { 125 if (!op) {
141 return; 126 return;
@@ -143,12 +128,11 @@ acpi_ps_append_arg (
143 128
144 /* Get the info structure for this opcode */ 129 /* Get the info structure for this opcode */
145 130
146 op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); 131 op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
147 if (op_info->class == AML_CLASS_UNKNOWN) { 132 if (op_info->class == AML_CLASS_UNKNOWN) {
148 /* Invalid opcode */ 133 /* Invalid opcode */
149 134
150 ACPI_REPORT_ERROR (("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n", 135 ACPI_REPORT_ERROR(("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n", op->common.aml_opcode));
151 op->common.aml_opcode));
152 return; 136 return;
153 } 137 }
154 138
@@ -170,8 +154,7 @@ acpi_ps_append_arg (
170 prev_arg = prev_arg->common.next; 154 prev_arg = prev_arg->common.next;
171 } 155 }
172 prev_arg->common.next = arg; 156 prev_arg->common.next = arg;
173 } 157 } else {
174 else {
175 /* No argument list, this will be the first argument */ 158 /* No argument list, this will be the first argument */
176 159
177 op->common.value.arg = arg; 160 op->common.value.arg = arg;
@@ -185,7 +168,6 @@ acpi_ps_append_arg (
185 } 168 }
186} 169}
187 170
188
189#ifdef ACPI_FUTURE_USAGE 171#ifdef ACPI_FUTURE_USAGE
190/******************************************************************************* 172/*******************************************************************************
191 * 173 *
@@ -201,18 +183,14 @@ acpi_ps_append_arg (
201 * 183 *
202 ******************************************************************************/ 184 ******************************************************************************/
203 185
204union acpi_parse_object * 186union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
205acpi_ps_get_depth_next ( 187 union acpi_parse_object *op)
206 union acpi_parse_object *origin,
207 union acpi_parse_object *op)
208{ 188{
209 union acpi_parse_object *next = NULL; 189 union acpi_parse_object *next = NULL;
210 union acpi_parse_object *parent; 190 union acpi_parse_object *parent;
211 union acpi_parse_object *arg; 191 union acpi_parse_object *arg;
212
213
214 ACPI_FUNCTION_ENTRY ();
215 192
193 ACPI_FUNCTION_ENTRY();
216 194
217 if (!op) { 195 if (!op) {
218 return (NULL); 196 return (NULL);
@@ -220,7 +198,7 @@ acpi_ps_get_depth_next (
220 198
221 /* Look for an argument or child */ 199 /* Look for an argument or child */
222 200
223 next = acpi_ps_get_arg (op, 0); 201 next = acpi_ps_get_arg(op, 0);
224 if (next) { 202 if (next) {
225 return (next); 203 return (next);
226 } 204 }
@@ -237,7 +215,7 @@ acpi_ps_get_depth_next (
237 parent = op->common.parent; 215 parent = op->common.parent;
238 216
239 while (parent) { 217 while (parent) {
240 arg = acpi_ps_get_arg (parent, 0); 218 arg = acpi_ps_get_arg(parent, 0);
241 while (arg && (arg != origin) && (arg != op)) { 219 while (arg && (arg != origin) && (arg != op)) {
242 arg = arg->common.next; 220 arg = arg->common.next;
243 } 221 }
@@ -261,7 +239,6 @@ acpi_ps_get_depth_next (
261 return (next); 239 return (next);
262} 240}
263 241
264
265#ifdef ACPI_OBSOLETE_FUNCTIONS 242#ifdef ACPI_OBSOLETE_FUNCTIONS
266/******************************************************************************* 243/*******************************************************************************
267 * 244 *
@@ -275,15 +252,11 @@ acpi_ps_get_depth_next (
275 * 252 *
276 ******************************************************************************/ 253 ******************************************************************************/
277 254
278union acpi_parse_object * 255union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op)
279acpi_ps_get_child (
280 union acpi_parse_object *op)
281{ 256{
282 union acpi_parse_object *child = NULL; 257 union acpi_parse_object *child = NULL;
283
284
285 ACPI_FUNCTION_ENTRY ();
286 258
259 ACPI_FUNCTION_ENTRY();
287 260
288 switch (op->common.aml_opcode) { 261 switch (op->common.aml_opcode) {
289 case AML_SCOPE_OP: 262 case AML_SCOPE_OP:
@@ -292,10 +265,9 @@ acpi_ps_get_child (
292 case AML_THERMAL_ZONE_OP: 265 case AML_THERMAL_ZONE_OP:
293 case AML_INT_METHODCALL_OP: 266 case AML_INT_METHODCALL_OP:
294 267
295 child = acpi_ps_get_arg (op, 0); 268 child = acpi_ps_get_arg(op, 0);
296 break; 269 break;
297 270
298
299 case AML_BUFFER_OP: 271 case AML_BUFFER_OP:
300 case AML_PACKAGE_OP: 272 case AML_PACKAGE_OP:
301 case AML_METHOD_OP: 273 case AML_METHOD_OP:
@@ -303,24 +275,21 @@ acpi_ps_get_child (
303 case AML_WHILE_OP: 275 case AML_WHILE_OP:
304 case AML_FIELD_OP: 276 case AML_FIELD_OP:
305 277
306 child = acpi_ps_get_arg (op, 1); 278 child = acpi_ps_get_arg(op, 1);
307 break; 279 break;
308 280
309
310 case AML_POWER_RES_OP: 281 case AML_POWER_RES_OP:
311 case AML_INDEX_FIELD_OP: 282 case AML_INDEX_FIELD_OP:
312 283
313 child = acpi_ps_get_arg (op, 2); 284 child = acpi_ps_get_arg(op, 2);
314 break; 285 break;
315 286
316
317 case AML_PROCESSOR_OP: 287 case AML_PROCESSOR_OP:
318 case AML_BANK_FIELD_OP: 288 case AML_BANK_FIELD_OP:
319 289
320 child = acpi_ps_get_arg (op, 3); 290 child = acpi_ps_get_arg(op, 3);
321 break; 291 break;
322 292
323
324 default: 293 default:
325 /* All others have no children */ 294 /* All others have no children */
326 break; 295 break;
@@ -330,5 +299,4 @@ acpi_ps_get_child (
330} 299}
331#endif 300#endif
332 301
333#endif /* ACPI_FUTURE_USAGE */ 302#endif /* ACPI_FUTURE_USAGE */
334