diff options
Diffstat (limited to 'drivers/acpi/parser/psscope.c')
-rw-r--r-- | drivers/acpi/parser/psscope.c | 130 |
1 files changed, 50 insertions, 80 deletions
diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c index 8dcd1b1e7131..1c953b6f1af1 100644 --- a/drivers/acpi/parser/psscope.c +++ b/drivers/acpi/parser/psscope.c | |||
@@ -41,13 +41,11 @@ | |||
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 | 46 | ||
48 | #define _COMPONENT ACPI_PARSER | 47 | #define _COMPONENT ACPI_PARSER |
49 | ACPI_MODULE_NAME ("psscope") | 48 | ACPI_MODULE_NAME("psscope") |
50 | |||
51 | 49 | ||
52 | /******************************************************************************* | 50 | /******************************************************************************* |
53 | * | 51 | * |
@@ -60,16 +58,13 @@ | |||
60 | * DESCRIPTION: Get parent of current op being parsed | 58 | * DESCRIPTION: Get parent of current op being parsed |
61 | * | 59 | * |
62 | ******************************************************************************/ | 60 | ******************************************************************************/ |
63 | 61 | union acpi_parse_object *acpi_ps_get_parent_scope(struct acpi_parse_state | |
64 | union acpi_parse_object * | 62 | *parser_state) |
65 | acpi_ps_get_parent_scope ( | ||
66 | struct acpi_parse_state *parser_state) | ||
67 | { | 63 | { |
68 | 64 | ||
69 | return (parser_state->scope->parse_scope.op); | 65 | return (parser_state->scope->parse_scope.op); |
70 | } | 66 | } |
71 | 67 | ||
72 | |||
73 | /******************************************************************************* | 68 | /******************************************************************************* |
74 | * | 69 | * |
75 | * FUNCTION: acpi_ps_has_completed_scope | 70 | * FUNCTION: acpi_ps_has_completed_scope |
@@ -84,17 +79,14 @@ acpi_ps_get_parent_scope ( | |||
84 | * | 79 | * |
85 | ******************************************************************************/ | 80 | ******************************************************************************/ |
86 | 81 | ||
87 | u8 | 82 | u8 acpi_ps_has_completed_scope(struct acpi_parse_state * parser_state) |
88 | acpi_ps_has_completed_scope ( | ||
89 | struct acpi_parse_state *parser_state) | ||
90 | { | 83 | { |
91 | 84 | ||
92 | return ((u8) | 85 | return ((u8) |
93 | ((parser_state->aml >= parser_state->scope->parse_scope.arg_end || | 86 | ((parser_state->aml >= parser_state->scope->parse_scope.arg_end |
94 | !parser_state->scope->parse_scope.arg_count))); | 87 | || !parser_state->scope->parse_scope.arg_count))); |
95 | } | 88 | } |
96 | 89 | ||
97 | |||
98 | /******************************************************************************* | 90 | /******************************************************************************* |
99 | * | 91 | * |
100 | * FUNCTION: acpi_ps_init_scope | 92 | * FUNCTION: acpi_ps_init_scope |
@@ -109,34 +101,30 @@ acpi_ps_has_completed_scope ( | |||
109 | ******************************************************************************/ | 101 | ******************************************************************************/ |
110 | 102 | ||
111 | acpi_status | 103 | acpi_status |
112 | acpi_ps_init_scope ( | 104 | acpi_ps_init_scope(struct acpi_parse_state * parser_state, |
113 | struct acpi_parse_state *parser_state, | 105 | union acpi_parse_object * root_op) |
114 | union acpi_parse_object *root_op) | ||
115 | { | 106 | { |
116 | union acpi_generic_state *scope; | 107 | union acpi_generic_state *scope; |
117 | 108 | ||
109 | ACPI_FUNCTION_TRACE_PTR("ps_init_scope", root_op); | ||
118 | 110 | ||
119 | ACPI_FUNCTION_TRACE_PTR ("ps_init_scope", root_op); | 111 | scope = acpi_ut_create_generic_state(); |
120 | |||
121 | |||
122 | scope = acpi_ut_create_generic_state (); | ||
123 | if (!scope) { | 112 | if (!scope) { |
124 | return_ACPI_STATUS (AE_NO_MEMORY); | 113 | return_ACPI_STATUS(AE_NO_MEMORY); |
125 | } | 114 | } |
126 | 115 | ||
127 | scope->common.data_type = ACPI_DESC_TYPE_STATE_RPSCOPE; | 116 | scope->common.data_type = ACPI_DESC_TYPE_STATE_RPSCOPE; |
128 | scope->parse_scope.op = root_op; | 117 | scope->parse_scope.op = root_op; |
129 | scope->parse_scope.arg_count = ACPI_VAR_ARGS; | 118 | scope->parse_scope.arg_count = ACPI_VAR_ARGS; |
130 | scope->parse_scope.arg_end = parser_state->aml_end; | 119 | scope->parse_scope.arg_end = parser_state->aml_end; |
131 | scope->parse_scope.pkg_end = parser_state->aml_end; | 120 | scope->parse_scope.pkg_end = parser_state->aml_end; |
132 | 121 | ||
133 | parser_state->scope = scope; | 122 | parser_state->scope = scope; |
134 | parser_state->start_op = root_op; | 123 | parser_state->start_op = root_op; |
135 | 124 | ||
136 | return_ACPI_STATUS (AE_OK); | 125 | return_ACPI_STATUS(AE_OK); |
137 | } | 126 | } |
138 | 127 | ||
139 | |||
140 | /******************************************************************************* | 128 | /******************************************************************************* |
141 | * | 129 | * |
142 | * FUNCTION: acpi_ps_push_scope | 130 | * FUNCTION: acpi_ps_push_scope |
@@ -153,48 +141,42 @@ acpi_ps_init_scope ( | |||
153 | ******************************************************************************/ | 141 | ******************************************************************************/ |
154 | 142 | ||
155 | acpi_status | 143 | acpi_status |
156 | acpi_ps_push_scope ( | 144 | acpi_ps_push_scope(struct acpi_parse_state *parser_state, |
157 | struct acpi_parse_state *parser_state, | 145 | union acpi_parse_object *op, |
158 | union acpi_parse_object *op, | 146 | u32 remaining_args, u32 arg_count) |
159 | u32 remaining_args, | ||
160 | u32 arg_count) | ||
161 | { | 147 | { |
162 | union acpi_generic_state *scope; | 148 | union acpi_generic_state *scope; |
163 | |||
164 | |||
165 | ACPI_FUNCTION_TRACE_PTR ("ps_push_scope", op); | ||
166 | 149 | ||
150 | ACPI_FUNCTION_TRACE_PTR("ps_push_scope", op); | ||
167 | 151 | ||
168 | scope = acpi_ut_create_generic_state (); | 152 | scope = acpi_ut_create_generic_state(); |
169 | if (!scope) { | 153 | if (!scope) { |
170 | return_ACPI_STATUS (AE_NO_MEMORY); | 154 | return_ACPI_STATUS(AE_NO_MEMORY); |
171 | } | 155 | } |
172 | 156 | ||
173 | scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE; | 157 | scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE; |
174 | scope->parse_scope.op = op; | 158 | scope->parse_scope.op = op; |
175 | scope->parse_scope.arg_list = remaining_args; | 159 | scope->parse_scope.arg_list = remaining_args; |
176 | scope->parse_scope.arg_count = arg_count; | 160 | scope->parse_scope.arg_count = arg_count; |
177 | scope->parse_scope.pkg_end = parser_state->pkg_end; | 161 | scope->parse_scope.pkg_end = parser_state->pkg_end; |
178 | 162 | ||
179 | /* Push onto scope stack */ | 163 | /* Push onto scope stack */ |
180 | 164 | ||
181 | acpi_ut_push_generic_state (&parser_state->scope, scope); | 165 | acpi_ut_push_generic_state(&parser_state->scope, scope); |
182 | 166 | ||
183 | if (arg_count == ACPI_VAR_ARGS) { | 167 | if (arg_count == ACPI_VAR_ARGS) { |
184 | /* Multiple arguments */ | 168 | /* Multiple arguments */ |
185 | 169 | ||
186 | scope->parse_scope.arg_end = parser_state->pkg_end; | 170 | scope->parse_scope.arg_end = parser_state->pkg_end; |
187 | } | 171 | } else { |
188 | else { | ||
189 | /* Single argument */ | 172 | /* Single argument */ |
190 | 173 | ||
191 | scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR); | 174 | scope->parse_scope.arg_end = ACPI_TO_POINTER(ACPI_MAX_PTR); |
192 | } | 175 | } |
193 | 176 | ||
194 | return_ACPI_STATUS (AE_OK); | 177 | return_ACPI_STATUS(AE_OK); |
195 | } | 178 | } |
196 | 179 | ||
197 | |||
198 | /******************************************************************************* | 180 | /******************************************************************************* |
199 | * | 181 | * |
200 | * FUNCTION: acpi_ps_pop_scope | 182 | * FUNCTION: acpi_ps_pop_scope |
@@ -212,48 +194,41 @@ acpi_ps_push_scope ( | |||
212 | ******************************************************************************/ | 194 | ******************************************************************************/ |
213 | 195 | ||
214 | void | 196 | void |
215 | acpi_ps_pop_scope ( | 197 | acpi_ps_pop_scope(struct acpi_parse_state *parser_state, |
216 | struct acpi_parse_state *parser_state, | 198 | union acpi_parse_object **op, u32 * arg_list, u32 * arg_count) |
217 | union acpi_parse_object **op, | ||
218 | u32 *arg_list, | ||
219 | u32 *arg_count) | ||
220 | { | 199 | { |
221 | union acpi_generic_state *scope = parser_state->scope; | 200 | union acpi_generic_state *scope = parser_state->scope; |
222 | |||
223 | |||
224 | ACPI_FUNCTION_TRACE ("ps_pop_scope"); | ||
225 | 201 | ||
202 | ACPI_FUNCTION_TRACE("ps_pop_scope"); | ||
226 | 203 | ||
227 | /* Only pop the scope if there is in fact a next scope */ | 204 | /* Only pop the scope if there is in fact a next scope */ |
228 | 205 | ||
229 | if (scope->common.next) { | 206 | if (scope->common.next) { |
230 | scope = acpi_ut_pop_generic_state (&parser_state->scope); | 207 | scope = acpi_ut_pop_generic_state(&parser_state->scope); |
231 | 208 | ||
232 | /* return to parsing previous op */ | 209 | /* return to parsing previous op */ |
233 | 210 | ||
234 | *op = scope->parse_scope.op; | 211 | *op = scope->parse_scope.op; |
235 | *arg_list = scope->parse_scope.arg_list; | 212 | *arg_list = scope->parse_scope.arg_list; |
236 | *arg_count = scope->parse_scope.arg_count; | 213 | *arg_count = scope->parse_scope.arg_count; |
237 | parser_state->pkg_end = scope->parse_scope.pkg_end; | 214 | parser_state->pkg_end = scope->parse_scope.pkg_end; |
238 | 215 | ||
239 | /* All done with this scope state structure */ | 216 | /* All done with this scope state structure */ |
240 | 217 | ||
241 | acpi_ut_delete_generic_state (scope); | 218 | acpi_ut_delete_generic_state(scope); |
242 | } | 219 | } else { |
243 | else { | ||
244 | /* empty parse stack, prepare to fetch next opcode */ | 220 | /* empty parse stack, prepare to fetch next opcode */ |
245 | 221 | ||
246 | *op = NULL; | 222 | *op = NULL; |
247 | *arg_list = 0; | 223 | *arg_list = 0; |
248 | *arg_count = 0; | 224 | *arg_count = 0; |
249 | } | 225 | } |
250 | 226 | ||
251 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, | 227 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
252 | "Popped Op %p Args %X\n", *op, *arg_count)); | 228 | "Popped Op %p Args %X\n", *op, *arg_count)); |
253 | return_VOID; | 229 | return_VOID; |
254 | } | 230 | } |
255 | 231 | ||
256 | |||
257 | /******************************************************************************* | 232 | /******************************************************************************* |
258 | * | 233 | * |
259 | * FUNCTION: acpi_ps_cleanup_scope | 234 | * FUNCTION: acpi_ps_cleanup_scope |
@@ -267,15 +242,11 @@ acpi_ps_pop_scope ( | |||
267 | * | 242 | * |
268 | ******************************************************************************/ | 243 | ******************************************************************************/ |
269 | 244 | ||
270 | void | 245 | void acpi_ps_cleanup_scope(struct acpi_parse_state *parser_state) |
271 | acpi_ps_cleanup_scope ( | ||
272 | struct acpi_parse_state *parser_state) | ||
273 | { | 246 | { |
274 | union acpi_generic_state *scope; | 247 | union acpi_generic_state *scope; |
275 | |||
276 | |||
277 | ACPI_FUNCTION_TRACE_PTR ("ps_cleanup_scope", parser_state); | ||
278 | 248 | ||
249 | ACPI_FUNCTION_TRACE_PTR("ps_cleanup_scope", parser_state); | ||
279 | 250 | ||
280 | if (!parser_state) { | 251 | if (!parser_state) { |
281 | return_VOID; | 252 | return_VOID; |
@@ -284,10 +255,9 @@ acpi_ps_cleanup_scope ( | |||
284 | /* Delete anything on the scope stack */ | 255 | /* Delete anything on the scope stack */ |
285 | 256 | ||
286 | while (parser_state->scope) { | 257 | while (parser_state->scope) { |
287 | scope = acpi_ut_pop_generic_state (&parser_state->scope); | 258 | scope = acpi_ut_pop_generic_state(&parser_state->scope); |
288 | acpi_ut_delete_generic_state (scope); | 259 | acpi_ut_delete_generic_state(scope); |
289 | } | 260 | } |
290 | 261 | ||
291 | return_VOID; | 262 | return_VOID; |
292 | } | 263 | } |
293 | |||