Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/dispatcher/dsargs.c
+++ new/usr/src/common/acpica/components/dispatcher/dsargs.c
1 1 /******************************************************************************
2 2 *
3 3 * Module Name: dsargs - Support for execution of dynamic arguments for static
4 4 * objects (regions, fields, buffer fields, etc.)
5 5 *
6 6 *****************************************************************************/
7 7
8 8 /*
9 - * Copyright (C) 2000 - 2011, Intel Corp.
9 + * Copyright (C) 2000 - 2014, Intel Corp.
10 10 * All rights reserved.
11 11 *
12 12 * Redistribution and use in source and binary forms, with or without
13 13 * modification, are permitted provided that the following conditions
14 14 * are met:
15 15 * 1. Redistributions of source code must retain the above copyright
16 16 * notice, this list of conditions, and the following disclaimer,
17 17 * without modification.
18 18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 19 * substantially similar to the "NO WARRANTY" disclaimer below
20 20 * ("Disclaimer") and any redistribution must be conditioned upon
21 21 * including a substantially similar Disclaimer requirement for further
22 22 * binary redistribution.
23 23 * 3. Neither the names of the above-listed copyright holders nor the names
24 24 * of any contributors may be used to endorse or promote products derived
25 25 * from this software without specific prior written permission.
26 26 *
27 27 * Alternatively, this software may be distributed under the terms of the
28 28 * GNU General Public License ("GPL") version 2 as published by the Free
29 29 * Software Foundation.
30 30 *
31 31 * NO WARRANTY
32 32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 42 * POSSIBILITY OF SUCH DAMAGES.
43 43 */
44 44
45 45 #define __DSARGS_C__
46 46
47 47 #include "acpi.h"
48 48 #include "accommon.h"
49 49 #include "acparser.h"
50 50 #include "amlcode.h"
51 51 #include "acdispat.h"
52 52 #include "acnamesp.h"
53 53
54 54 #define _COMPONENT ACPI_DISPATCHER
55 55 ACPI_MODULE_NAME ("dsargs")
56 56
57 57 /* Local prototypes */
58 58
59 59 static ACPI_STATUS
60 60 AcpiDsExecuteArguments (
61 61 ACPI_NAMESPACE_NODE *Node,
62 62 ACPI_NAMESPACE_NODE *ScopeNode,
63 63 UINT32 AmlLength,
64 64 UINT8 *AmlStart);
65 65
66 66
67 67 /*******************************************************************************
68 68 *
69 69 * FUNCTION: AcpiDsExecuteArguments
70 70 *
71 71 * PARAMETERS: Node - Object NS node
72 72 * ScopeNode - Parent NS node
73 73 * AmlLength - Length of executable AML
74 74 * AmlStart - Pointer to the AML
75 75 *
76 76 * RETURN: Status.
77 77 *
78 78 * DESCRIPTION: Late (deferred) execution of region or field arguments
79 79 *
80 80 ******************************************************************************/
81 81
82 82 static ACPI_STATUS
83 83 AcpiDsExecuteArguments (
84 84 ACPI_NAMESPACE_NODE *Node,
85 85 ACPI_NAMESPACE_NODE *ScopeNode,
86 86 UINT32 AmlLength,
87 87 UINT8 *AmlStart)
88 88 {
89 89 ACPI_STATUS Status;
90 90 ACPI_PARSE_OBJECT *Op;
91 91 ACPI_WALK_STATE *WalkState;
92 92
93 93
94 94 ACPI_FUNCTION_TRACE (DsExecuteArguments);
95 95
96 96
97 97 /* Allocate a new parser op to be the root of the parsed tree */
98 98
99 99 Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
100 100 if (!Op)
101 101 {
102 102 return_ACPI_STATUS (AE_NO_MEMORY);
103 103 }
104 104
105 105 /* Save the Node for use in AcpiPsParseAml */
106 106
107 107 Op->Common.Node = ScopeNode;
108 108
109 109 /* Create and initialize a new parser state */
110 110
111 111 WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
112 112 if (!WalkState)
113 113 {
114 114 Status = AE_NO_MEMORY;
115 115 goto Cleanup;
116 116 }
117 117
118 118 Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
119 119 AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
120 120 if (ACPI_FAILURE (Status))
121 121 {
122 122 AcpiDsDeleteWalkState (WalkState);
123 123 goto Cleanup;
124 124 }
125 125
126 126 /* Mark this parse as a deferred opcode */
127 127
128 128 WalkState->ParseFlags = ACPI_PARSE_DEFERRED_OP;
129 129 WalkState->DeferredNode = Node;
130 130
131 131 /* Pass1: Parse the entire declaration */
132 132
133 133 Status = AcpiPsParseAml (WalkState);
134 134 if (ACPI_FAILURE (Status))
135 135 {
136 136 goto Cleanup;
137 137 }
138 138
139 139 /* Get and init the Op created above */
140 140
141 141 Op->Common.Node = Node;
142 142 AcpiPsDeleteParseTree (Op);
143 143
144 144 /* Evaluate the deferred arguments */
145 145
146 146 Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
147 147 if (!Op)
148 148 {
149 149 return_ACPI_STATUS (AE_NO_MEMORY);
150 150 }
151 151
152 152 Op->Common.Node = ScopeNode;
153 153
154 154 /* Create and initialize a new parser state */
155 155
156 156 WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
157 157 if (!WalkState)
158 158 {
159 159 Status = AE_NO_MEMORY;
160 160 goto Cleanup;
161 161 }
162 162
163 163 /* Execute the opcode and arguments */
164 164
165 165 Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
166 166 AmlLength, NULL, ACPI_IMODE_EXECUTE);
167 167 if (ACPI_FAILURE (Status))
168 168 {
169 169 AcpiDsDeleteWalkState (WalkState);
170 170 goto Cleanup;
171 171 }
172 172
173 173 /* Mark this execution as a deferred opcode */
174 174
175 175 WalkState->DeferredNode = Node;
176 176 Status = AcpiPsParseAml (WalkState);
177 177
178 178 Cleanup:
179 179 AcpiPsDeleteParseTree (Op);
180 180 return_ACPI_STATUS (Status);
181 181 }
182 182
183 183
184 184 /*******************************************************************************
185 185 *
186 186 * FUNCTION: AcpiDsGetBufferFieldArguments
187 187 *
188 188 * PARAMETERS: ObjDesc - A valid BufferField object
189 189 *
190 190 * RETURN: Status.
191 191 *
192 192 * DESCRIPTION: Get BufferField Buffer and Index. This implements the late
193 193 * evaluation of these field attributes.
194 194 *
195 195 ******************************************************************************/
196 196
197 197 ACPI_STATUS
198 198 AcpiDsGetBufferFieldArguments (
199 199 ACPI_OPERAND_OBJECT *ObjDesc)
200 200 {
201 201 ACPI_OPERAND_OBJECT *ExtraDesc;
202 202 ACPI_NAMESPACE_NODE *Node;
203 203 ACPI_STATUS Status;
204 204
205 205
206 206 ACPI_FUNCTION_TRACE_PTR (DsGetBufferFieldArguments, ObjDesc);
207 207
208 208
209 209 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
210 210 {
211 211 return_ACPI_STATUS (AE_OK);
212 212 }
213 213
214 214 /* Get the AML pointer (method object) and BufferField node */
215 215
216 216 ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
217 217 Node = ObjDesc->BufferField.Node;
218 218
219 219 ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD,
220 220 Node, NULL));
221 221
222 222 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n",
223 223 AcpiUtGetNodeName (Node)));
224 224
225 225 /* Execute the AML code for the TermArg arguments */
226 226
227 227 Status = AcpiDsExecuteArguments (Node, Node->Parent,
228 228 ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
229 229 return_ACPI_STATUS (Status);
230 230 }
231 231
232 232
233 233 /*******************************************************************************
234 234 *
235 235 * FUNCTION: AcpiDsGetBankFieldArguments
236 236 *
237 237 * PARAMETERS: ObjDesc - A valid BankField object
238 238 *
239 239 * RETURN: Status.
240 240 *
241 241 * DESCRIPTION: Get BankField BankValue. This implements the late
242 242 * evaluation of these field attributes.
243 243 *
244 244 ******************************************************************************/
245 245
246 246 ACPI_STATUS
247 247 AcpiDsGetBankFieldArguments (
248 248 ACPI_OPERAND_OBJECT *ObjDesc)
249 249 {
250 250 ACPI_OPERAND_OBJECT *ExtraDesc;
251 251 ACPI_NAMESPACE_NODE *Node;
252 252 ACPI_STATUS Status;
253 253
254 254
255 255 ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc);
256 256
257 257
258 258 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
259 259 {
260 260 return_ACPI_STATUS (AE_OK);
261 261 }
262 262
263 263 /* Get the AML pointer (method object) and BankField node */
264 264
265 265 ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
266 266 Node = ObjDesc->BankField.Node;
267 267
268 268 ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_LOCAL_BANK_FIELD,
269 269 Node, NULL));
270 270
271 271 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n",
272 272 AcpiUtGetNodeName (Node)));
273 273
274 274 /* Execute the AML code for the TermArg arguments */
275 275
276 276 Status = AcpiDsExecuteArguments (Node, Node->Parent,
277 277 ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
278 278 return_ACPI_STATUS (Status);
279 279 }
280 280
281 281
282 282 /*******************************************************************************
283 283 *
284 284 * FUNCTION: AcpiDsGetBufferArguments
285 285 *
286 286 * PARAMETERS: ObjDesc - A valid Buffer object
287 287 *
288 288 * RETURN: Status.
289 289 *
290 290 * DESCRIPTION: Get Buffer length and initializer byte list. This implements
291 291 * the late evaluation of these attributes.
292 292 *
293 293 ******************************************************************************/
294 294
295 295 ACPI_STATUS
296 296 AcpiDsGetBufferArguments (
297 297 ACPI_OPERAND_OBJECT *ObjDesc)
298 298 {
299 299 ACPI_NAMESPACE_NODE *Node;
300 300 ACPI_STATUS Status;
301 301
302 302
303 303 ACPI_FUNCTION_TRACE_PTR (DsGetBufferArguments, ObjDesc);
304 304
305 305
306 306 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
307 307 {
308 308 return_ACPI_STATUS (AE_OK);
309 309 }
310 310
311 311 /* Get the Buffer node */
312 312
313 313 Node = ObjDesc->Buffer.Node;
314 314 if (!Node)
315 315 {
316 316 ACPI_ERROR ((AE_INFO,
317 317 "No pointer back to namespace node in buffer object %p", ObjDesc));
318 318 return_ACPI_STATUS (AE_AML_INTERNAL);
319 319 }
320 320
321 321 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n"));
322 322
323 323 /* Execute the AML code for the TermArg arguments */
324 324
325 325 Status = AcpiDsExecuteArguments (Node, Node,
326 326 ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart);
327 327 return_ACPI_STATUS (Status);
328 328 }
329 329
330 330
331 331 /*******************************************************************************
332 332 *
333 333 * FUNCTION: AcpiDsGetPackageArguments
334 334 *
335 335 * PARAMETERS: ObjDesc - A valid Package object
336 336 *
337 337 * RETURN: Status.
338 338 *
339 339 * DESCRIPTION: Get Package length and initializer byte list. This implements
340 340 * the late evaluation of these attributes.
341 341 *
342 342 ******************************************************************************/
343 343
344 344 ACPI_STATUS
345 345 AcpiDsGetPackageArguments (
346 346 ACPI_OPERAND_OBJECT *ObjDesc)
347 347 {
348 348 ACPI_NAMESPACE_NODE *Node;
349 349 ACPI_STATUS Status;
350 350
351 351
352 352 ACPI_FUNCTION_TRACE_PTR (DsGetPackageArguments, ObjDesc);
353 353
354 354
355 355 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
356 356 {
357 357 return_ACPI_STATUS (AE_OK);
358 358 }
359 359
360 360 /* Get the Package node */
361 361
362 362 Node = ObjDesc->Package.Node;
363 363 if (!Node)
364 364 {
365 365 ACPI_ERROR ((AE_INFO,
366 366 "No pointer back to namespace node in package %p", ObjDesc));
367 367 return_ACPI_STATUS (AE_AML_INTERNAL);
368 368 }
369 369
370 370 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n"));
371 371
372 372 /* Execute the AML code for the TermArg arguments */
373 373
374 374 Status = AcpiDsExecuteArguments (Node, Node,
375 375 ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart);
376 376 return_ACPI_STATUS (Status);
377 377 }
378 378
379 379
380 380 /*******************************************************************************
381 381 *
382 382 * FUNCTION: AcpiDsGetRegionArguments
383 383 *
384 384 * PARAMETERS: ObjDesc - A valid region object
385 385 *
386 386 * RETURN: Status.
387 387 *
388 388 * DESCRIPTION: Get region address and length. This implements the late
389 389 * evaluation of these region attributes.
390 390 *
391 391 ******************************************************************************/
392 392
393 393 ACPI_STATUS
394 394 AcpiDsGetRegionArguments (
395 395 ACPI_OPERAND_OBJECT *ObjDesc)
396 396 {
397 397 ACPI_NAMESPACE_NODE *Node;
398 398 ACPI_STATUS Status;
399 399 ACPI_OPERAND_OBJECT *ExtraDesc;
400 400
401 401
402 402 ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc);
403 403
404 404
405 405 if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
406 406 {
407 407 return_ACPI_STATUS (AE_OK);
408 408 }
409 409
410 410 ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
411 411 if (!ExtraDesc)
412 412 {
413 413 return_ACPI_STATUS (AE_NOT_EXIST);
414 414 }
415 415
416 416 /* Get the Region node */
↓ open down ↓ |
397 lines elided |
↑ open up ↑ |
417 417
418 418 Node = ObjDesc->Region.Node;
419 419
420 420 ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL));
421 421
422 422 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n",
423 423 AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart));
424 424
425 425 /* Execute the argument AML */
426 426
427 - Status = AcpiDsExecuteArguments (Node, Node->Parent,
427 + Status = AcpiDsExecuteArguments (Node, ExtraDesc->Extra.ScopeNode,
428 428 ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
429 + if (ACPI_FAILURE (Status))
430 + {
431 + return_ACPI_STATUS (Status);
432 + }
433 +
434 + Status = AcpiUtAddAddressRange (ObjDesc->Region.SpaceId,
435 + ObjDesc->Region.Address, ObjDesc->Region.Length,
436 + Node);
429 437 return_ACPI_STATUS (Status);
430 438 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX