Print this page
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/dispatcher/dsopcode.c
+++ new/usr/src/common/acpica/components/dispatcher/dsopcode.c
1 1 /******************************************************************************
2 2 *
3 - * Module Name: dsopcode - Dispatcher suport for regions and fields
3 + * Module Name: dsopcode - Dispatcher support for regions and fields
4 4 *
5 5 *****************************************************************************/
6 6
7 7 /*
8 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2013, Intel Corp.
9 9 * All rights reserved.
10 10 *
11 11 * Redistribution and use in source and binary forms, with or without
12 12 * modification, are permitted provided that the following conditions
13 13 * are met:
14 14 * 1. Redistributions of source code must retain the above copyright
15 15 * notice, this list of conditions, and the following disclaimer,
16 16 * without modification.
17 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 18 * substantially similar to the "NO WARRANTY" disclaimer below
19 19 * ("Disclaimer") and any redistribution must be conditioned upon
20 20 * including a substantially similar Disclaimer requirement for further
21 21 * binary redistribution.
22 22 * 3. Neither the names of the above-listed copyright holders nor the names
23 23 * of any contributors may be used to endorse or promote products derived
24 24 * from this software without specific prior written permission.
25 25 *
26 26 * Alternatively, this software may be distributed under the terms of the
27 27 * GNU General Public License ("GPL") version 2 as published by the Free
28 28 * Software Foundation.
29 29 *
30 30 * NO WARRANTY
31 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 41 * POSSIBILITY OF SUCH DAMAGES.
42 42 */
43 43
44 44 #define __DSOPCODE_C__
45 45
46 46 #include "acpi.h"
47 47 #include "accommon.h"
48 48 #include "acparser.h"
49 49 #include "amlcode.h"
50 50 #include "acdispat.h"
51 51 #include "acinterp.h"
52 52 #include "acnamesp.h"
53 53 #include "acevents.h"
54 54 #include "actables.h"
55 55
56 56 #define _COMPONENT ACPI_DISPATCHER
57 57 ACPI_MODULE_NAME ("dsopcode")
58 58
59 59 /* Local prototypes */
60 60
61 61 static ACPI_STATUS
62 62 AcpiDsInitBufferField (
63 63 UINT16 AmlOpcode,
64 64 ACPI_OPERAND_OBJECT *ObjDesc,
65 65 ACPI_OPERAND_OBJECT *BufferDesc,
66 66 ACPI_OPERAND_OBJECT *OffsetDesc,
67 67 ACPI_OPERAND_OBJECT *LengthDesc,
68 68 ACPI_OPERAND_OBJECT *ResultDesc);
69 69
70 70
71 71 /*******************************************************************************
72 72 *
73 73 * FUNCTION: AcpiDsInitializeRegion
74 74 *
75 75 * PARAMETERS: ObjHandle - Region namespace node
76 76 *
77 77 * RETURN: Status
78 78 *
79 79 * DESCRIPTION: Front end to EvInitializeRegion
80 80 *
81 81 ******************************************************************************/
82 82
83 83 ACPI_STATUS
84 84 AcpiDsInitializeRegion (
85 85 ACPI_HANDLE ObjHandle)
86 86 {
87 87 ACPI_OPERAND_OBJECT *ObjDesc;
88 88 ACPI_STATUS Status;
89 89
90 90
91 91 ObjDesc = AcpiNsGetAttachedObject (ObjHandle);
92 92
93 93 /* Namespace is NOT locked */
94 94
95 95 Status = AcpiEvInitializeRegion (ObjDesc, FALSE);
96 96 return (Status);
97 97 }
98 98
99 99
100 100 /*******************************************************************************
101 101 *
102 102 * FUNCTION: AcpiDsInitBufferField
103 103 *
104 104 * PARAMETERS: AmlOpcode - CreateXxxField
105 105 * ObjDesc - BufferField object
106 106 * BufferDesc - Host Buffer
107 107 * OffsetDesc - Offset into buffer
108 108 * LengthDesc - Length of field (CREATE_FIELD_OP only)
109 109 * ResultDesc - Where to store the result
110 110 *
111 111 * RETURN: Status
112 112 *
113 113 * DESCRIPTION: Perform actual initialization of a buffer field
114 114 *
115 115 ******************************************************************************/
116 116
117 117 static ACPI_STATUS
118 118 AcpiDsInitBufferField (
119 119 UINT16 AmlOpcode,
120 120 ACPI_OPERAND_OBJECT *ObjDesc,
121 121 ACPI_OPERAND_OBJECT *BufferDesc,
122 122 ACPI_OPERAND_OBJECT *OffsetDesc,
123 123 ACPI_OPERAND_OBJECT *LengthDesc,
124 124 ACPI_OPERAND_OBJECT *ResultDesc)
125 125 {
126 126 UINT32 Offset;
127 127 UINT32 BitOffset;
128 128 UINT32 BitCount;
129 129 UINT8 FieldFlags;
130 130 ACPI_STATUS Status;
131 131
132 132
133 133 ACPI_FUNCTION_TRACE_PTR (DsInitBufferField, ObjDesc);
134 134
135 135
136 136 /* Host object must be a Buffer */
137 137
138 138 if (BufferDesc->Common.Type != ACPI_TYPE_BUFFER)
139 139 {
140 140 ACPI_ERROR ((AE_INFO,
141 141 "Target of Create Field is not a Buffer object - %s",
142 142 AcpiUtGetObjectTypeName (BufferDesc)));
143 143
144 144 Status = AE_AML_OPERAND_TYPE;
145 145 goto Cleanup;
146 146 }
147 147
148 148 /*
149 149 * The last parameter to all of these opcodes (ResultDesc) started
150 150 * out as a NameString, and should therefore now be a NS node
151 151 * after resolution in AcpiExResolveOperands().
152 152 */
153 153 if (ACPI_GET_DESCRIPTOR_TYPE (ResultDesc) != ACPI_DESC_TYPE_NAMED)
154 154 {
155 155 ACPI_ERROR ((AE_INFO,
156 156 "(%s) destination not a NS Node [%s]",
157 157 AcpiPsGetOpcodeName (AmlOpcode),
158 158 AcpiUtGetDescriptorName (ResultDesc)));
159 159
160 160 Status = AE_AML_OPERAND_TYPE;
161 161 goto Cleanup;
162 162 }
163 163
164 164 Offset = (UINT32) OffsetDesc->Integer.Value;
165 165
166 166 /*
167 167 * Setup the Bit offsets and counts, according to the opcode
168 168 */
169 169 switch (AmlOpcode)
170 170 {
171 171 case AML_CREATE_FIELD_OP:
172 172
173 173 /* Offset is in bits, count is in bits */
174 174
175 175 FieldFlags = AML_FIELD_ACCESS_BYTE;
176 176 BitOffset = Offset;
177 177 BitCount = (UINT32) LengthDesc->Integer.Value;
178 178
179 179 /* Must have a valid (>0) bit count */
180 180
181 181 if (BitCount == 0)
182 182 {
183 183 ACPI_ERROR ((AE_INFO,
184 184 "Attempt to CreateField of length zero"));
185 185 Status = AE_AML_OPERAND_VALUE;
186 186 goto Cleanup;
187 187 }
188 188 break;
189 189
190 190 case AML_CREATE_BIT_FIELD_OP:
191 191
192 192 /* Offset is in bits, Field is one bit */
193 193
194 194 BitOffset = Offset;
195 195 BitCount = 1;
196 196 FieldFlags = AML_FIELD_ACCESS_BYTE;
197 197 break;
198 198
199 199 case AML_CREATE_BYTE_FIELD_OP:
200 200
201 201 /* Offset is in bytes, field is one byte */
202 202
203 203 BitOffset = 8 * Offset;
204 204 BitCount = 8;
205 205 FieldFlags = AML_FIELD_ACCESS_BYTE;
206 206 break;
207 207
208 208 case AML_CREATE_WORD_FIELD_OP:
209 209
210 210 /* Offset is in bytes, field is one word */
211 211
212 212 BitOffset = 8 * Offset;
213 213 BitCount = 16;
214 214 FieldFlags = AML_FIELD_ACCESS_WORD;
215 215 break;
216 216
217 217 case AML_CREATE_DWORD_FIELD_OP:
218 218
219 219 /* Offset is in bytes, field is one dword */
220 220
221 221 BitOffset = 8 * Offset;
222 222 BitCount = 32;
223 223 FieldFlags = AML_FIELD_ACCESS_DWORD;
224 224 break;
225 225
226 226 case AML_CREATE_QWORD_FIELD_OP:
227 227
228 228 /* Offset is in bytes, field is one qword */
229 229
230 230 BitOffset = 8 * Offset;
231 231 BitCount = 64;
232 232 FieldFlags = AML_FIELD_ACCESS_QWORD;
233 233 break;
234 234
235 235 default:
236 236
237 237 ACPI_ERROR ((AE_INFO,
238 238 "Unknown field creation opcode 0x%02X",
239 239 AmlOpcode));
240 240 Status = AE_AML_BAD_OPCODE;
241 241 goto Cleanup;
242 242 }
243 243
244 244 /* Entire field must fit within the current length of the buffer */
245 245
246 246 if ((BitOffset + BitCount) >
247 247 (8 * (UINT32) BufferDesc->Buffer.Length))
248 248 {
249 249 ACPI_ERROR ((AE_INFO,
250 250 "Field [%4.4s] at %u exceeds Buffer [%4.4s] size %u (bits)",
251 251 AcpiUtGetNodeName (ResultDesc),
252 252 BitOffset + BitCount,
253 253 AcpiUtGetNodeName (BufferDesc->Buffer.Node),
254 254 8 * (UINT32) BufferDesc->Buffer.Length));
255 255 Status = AE_AML_BUFFER_LIMIT;
256 256 goto Cleanup;
257 257 }
258 258
259 259 /*
260 260 * Initialize areas of the field object that are common to all fields
261 261 * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK),
262 262 * UPDATE_RULE = 0 (UPDATE_PRESERVE)
263 263 */
264 264 Status = AcpiExPrepCommonFieldObject (ObjDesc, FieldFlags, 0,
265 265 BitOffset, BitCount);
266 266 if (ACPI_FAILURE (Status))
267 267 {
268 268 goto Cleanup;
269 269 }
270 270
271 271 ObjDesc->BufferField.BufferObj = BufferDesc;
272 272
273 273 /* Reference count for BufferDesc inherits ObjDesc count */
274 274
275 275 BufferDesc->Common.ReferenceCount = (UINT16)
276 276 (BufferDesc->Common.ReferenceCount + ObjDesc->Common.ReferenceCount);
277 277
278 278
279 279 Cleanup:
280 280
281 281 /* Always delete the operands */
282 282
283 283 AcpiUtRemoveReference (OffsetDesc);
284 284 AcpiUtRemoveReference (BufferDesc);
285 285
286 286 if (AmlOpcode == AML_CREATE_FIELD_OP)
287 287 {
288 288 AcpiUtRemoveReference (LengthDesc);
289 289 }
290 290
291 291 /* On failure, delete the result descriptor */
292 292
293 293 if (ACPI_FAILURE (Status))
294 294 {
295 295 AcpiUtRemoveReference (ResultDesc); /* Result descriptor */
296 296 }
297 297 else
298 298 {
299 299 /* Now the address and length are valid for this BufferField */
300 300
301 301 ObjDesc->BufferField.Flags |= AOPOBJ_DATA_VALID;
302 302 }
303 303
304 304 return_ACPI_STATUS (Status);
305 305 }
306 306
307 307
308 308 /*******************************************************************************
309 309 *
310 310 * FUNCTION: AcpiDsEvalBufferFieldOperands
311 311 *
312 312 * PARAMETERS: WalkState - Current walk
313 313 * Op - A valid BufferField Op object
314 314 *
315 315 * RETURN: Status
316 316 *
317 317 * DESCRIPTION: Get BufferField Buffer and Index
318 318 * Called from AcpiDsExecEndOp during BufferField parse tree walk
319 319 *
320 320 ******************************************************************************/
321 321
322 322 ACPI_STATUS
323 323 AcpiDsEvalBufferFieldOperands (
324 324 ACPI_WALK_STATE *WalkState,
325 325 ACPI_PARSE_OBJECT *Op)
326 326 {
327 327 ACPI_STATUS Status;
328 328 ACPI_OPERAND_OBJECT *ObjDesc;
329 329 ACPI_NAMESPACE_NODE *Node;
330 330 ACPI_PARSE_OBJECT *NextOp;
331 331
332 332
333 333 ACPI_FUNCTION_TRACE_PTR (DsEvalBufferFieldOperands, Op);
334 334
335 335
336 336 /*
337 337 * This is where we evaluate the address and length fields of the
338 338 * CreateXxxField declaration
339 339 */
340 340 Node = Op->Common.Node;
341 341
342 342 /* NextOp points to the op that holds the Buffer */
343 343
344 344 NextOp = Op->Common.Value.Arg;
345 345
346 346 /* Evaluate/create the address and length operands */
347 347
348 348 Status = AcpiDsCreateOperands (WalkState, NextOp);
349 349 if (ACPI_FAILURE (Status))
350 350 {
351 351 return_ACPI_STATUS (Status);
352 352 }
353 353
354 354 ObjDesc = AcpiNsGetAttachedObject (Node);
355 355 if (!ObjDesc)
356 356 {
357 357 return_ACPI_STATUS (AE_NOT_EXIST);
358 358 }
359 359
360 360 /* Resolve the operands */
361 361
362 362 Status = AcpiExResolveOperands (Op->Common.AmlOpcode,
363 363 ACPI_WALK_OPERANDS, WalkState);
364 364 if (ACPI_FAILURE (Status))
365 365 {
366 366 ACPI_ERROR ((AE_INFO, "(%s) bad operand(s), status 0x%X",
367 367 AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status));
368 368
369 369 return_ACPI_STATUS (Status);
370 370 }
371 371
372 372 /* Initialize the Buffer Field */
373 373
374 374 if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
375 375 {
376 376 /* NOTE: Slightly different operands for this opcode */
377 377
378 378 Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
379 379 WalkState->Operands[0], WalkState->Operands[1],
380 380 WalkState->Operands[2], WalkState->Operands[3]);
381 381 }
382 382 else
383 383 {
384 384 /* All other, CreateXxxField opcodes */
385 385
386 386 Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
387 387 WalkState->Operands[0], WalkState->Operands[1],
388 388 NULL, WalkState->Operands[2]);
389 389 }
390 390
391 391 return_ACPI_STATUS (Status);
392 392 }
393 393
394 394
395 395 /*******************************************************************************
396 396 *
397 397 * FUNCTION: AcpiDsEvalRegionOperands
398 398 *
399 399 * PARAMETERS: WalkState - Current walk
400 400 * Op - A valid region Op object
401 401 *
402 402 * RETURN: Status
403 403 *
404 404 * DESCRIPTION: Get region address and length
405 405 * Called from AcpiDsExecEndOp during OpRegion parse tree walk
406 406 *
407 407 ******************************************************************************/
408 408
409 409 ACPI_STATUS
410 410 AcpiDsEvalRegionOperands (
411 411 ACPI_WALK_STATE *WalkState,
412 412 ACPI_PARSE_OBJECT *Op)
413 413 {
414 414 ACPI_STATUS Status;
415 415 ACPI_OPERAND_OBJECT *ObjDesc;
416 416 ACPI_OPERAND_OBJECT *OperandDesc;
417 417 ACPI_NAMESPACE_NODE *Node;
418 418 ACPI_PARSE_OBJECT *NextOp;
419 419
420 420
421 421 ACPI_FUNCTION_TRACE_PTR (DsEvalRegionOperands, Op);
422 422
423 423
424 424 /*
425 425 * This is where we evaluate the address and length fields of the
426 426 * OpRegion declaration
427 427 */
428 428 Node = Op->Common.Node;
429 429
430 430 /* NextOp points to the op that holds the SpaceID */
431 431
432 432 NextOp = Op->Common.Value.Arg;
433 433
434 434 /* NextOp points to address op */
435 435
436 436 NextOp = NextOp->Common.Next;
437 437
438 438 /* Evaluate/create the address and length operands */
439 439
440 440 Status = AcpiDsCreateOperands (WalkState, NextOp);
441 441 if (ACPI_FAILURE (Status))
442 442 {
443 443 return_ACPI_STATUS (Status);
444 444 }
445 445
446 446 /* Resolve the length and address operands to numbers */
447 447
448 448 Status = AcpiExResolveOperands (Op->Common.AmlOpcode,
449 449 ACPI_WALK_OPERANDS, WalkState);
450 450 if (ACPI_FAILURE (Status))
451 451 {
452 452 return_ACPI_STATUS (Status);
453 453 }
454 454
455 455 ObjDesc = AcpiNsGetAttachedObject (Node);
456 456 if (!ObjDesc)
457 457 {
458 458 return_ACPI_STATUS (AE_NOT_EXIST);
459 459 }
460 460
461 461 /*
462 462 * Get the length operand and save it
463 463 * (at Top of stack)
464 464 */
465 465 OperandDesc = WalkState->Operands[WalkState->NumOperands - 1];
466 466
467 467 ObjDesc->Region.Length = (UINT32) OperandDesc->Integer.Value;
468 468 AcpiUtRemoveReference (OperandDesc);
469 469
470 470 /*
471 471 * Get the address and save it
472 472 * (at top of stack - 1)
473 473 */
474 474 OperandDesc = WalkState->Operands[WalkState->NumOperands - 2];
475 475
476 476 ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS)
477 477 OperandDesc->Integer.Value;
478 478 AcpiUtRemoveReference (OperandDesc);
479 479
480 480 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
481 481 ObjDesc,
482 482 ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
483 483 ObjDesc->Region.Length));
484 484
485 485 /* Now the address and length are valid for this opregion */
486 486
487 487 ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
488 488
489 489 return_ACPI_STATUS (Status);
490 490 }
491 491
492 492
493 493 /*******************************************************************************
494 494 *
495 495 * FUNCTION: AcpiDsEvalTableRegionOperands
496 496 *
497 497 * PARAMETERS: WalkState - Current walk
498 498 * Op - A valid region Op object
499 499 *
500 500 * RETURN: Status
501 501 *
502 502 * DESCRIPTION: Get region address and length.
503 503 * Called from AcpiDsExecEndOp during DataTableRegion parse
504 504 * tree walk.
505 505 *
506 506 ******************************************************************************/
507 507
508 508 ACPI_STATUS
509 509 AcpiDsEvalTableRegionOperands (
510 510 ACPI_WALK_STATE *WalkState,
511 511 ACPI_PARSE_OBJECT *Op)
512 512 {
513 513 ACPI_STATUS Status;
514 514 ACPI_OPERAND_OBJECT *ObjDesc;
515 515 ACPI_OPERAND_OBJECT **Operand;
↓ open down ↓ |
497 lines elided |
↑ open up ↑ |
516 516 ACPI_NAMESPACE_NODE *Node;
517 517 ACPI_PARSE_OBJECT *NextOp;
518 518 UINT32 TableIndex;
519 519 ACPI_TABLE_HEADER *Table;
520 520
521 521
522 522 ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op);
523 523
524 524
525 525 /*
526 - * This is where we evaluate the SignatureString and OemIDString
527 - * and OemTableIDString of the DataTableRegion declaration
526 + * This is where we evaluate the Signature string, OemId string,
527 + * and OemTableId string of the Data Table Region declaration
528 528 */
529 529 Node = Op->Common.Node;
530 530
531 - /* NextOp points to SignatureString op */
531 + /* NextOp points to Signature string op */
532 532
533 533 NextOp = Op->Common.Value.Arg;
534 534
535 535 /*
536 - * Evaluate/create the SignatureString and OemIDString
537 - * and OemTableIDString operands
536 + * Evaluate/create the Signature string, OemId string,
537 + * and OemTableId string operands
538 538 */
539 539 Status = AcpiDsCreateOperands (WalkState, NextOp);
540 540 if (ACPI_FAILURE (Status))
541 541 {
542 542 return_ACPI_STATUS (Status);
543 543 }
544 544
545 545 /*
546 - * Resolve the SignatureString and OemIDString
547 - * and OemTableIDString operands
546 + * Resolve the Signature string, OemId string,
547 + * and OemTableId string operands
548 548 */
549 549 Status = AcpiExResolveOperands (Op->Common.AmlOpcode,
550 550 ACPI_WALK_OPERANDS, WalkState);
551 551 if (ACPI_FAILURE (Status))
552 552 {
553 553 return_ACPI_STATUS (Status);
554 554 }
555 555
556 556 Operand = &WalkState->Operands[0];
557 557
558 558 /* Find the ACPI table */
559 559
560 560 Status = AcpiTbFindTable (Operand[0]->String.Pointer,
561 561 Operand[1]->String.Pointer, Operand[2]->String.Pointer,
562 562 &TableIndex);
563 563 if (ACPI_FAILURE (Status))
564 564 {
565 565 return_ACPI_STATUS (Status);
566 566 }
567 567
568 568 AcpiUtRemoveReference (Operand[0]);
569 569 AcpiUtRemoveReference (Operand[1]);
570 570 AcpiUtRemoveReference (Operand[2]);
571 571
572 572 Status = AcpiGetTableByIndex (TableIndex, &Table);
573 573 if (ACPI_FAILURE (Status))
574 574 {
575 575 return_ACPI_STATUS (Status);
576 576 }
577 577
578 578 ObjDesc = AcpiNsGetAttachedObject (Node);
579 579 if (!ObjDesc)
580 580 {
581 581 return_ACPI_STATUS (AE_NOT_EXIST);
582 582 }
583 583
584 584 ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table);
585 585 ObjDesc->Region.Length = Table->Length;
586 586
587 587 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
588 588 ObjDesc,
589 589 ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
590 590 ObjDesc->Region.Length));
591 591
592 592 /* Now the address and length are valid for this opregion */
593 593
594 594 ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
595 595
596 596 return_ACPI_STATUS (Status);
597 597 }
598 598
599 599
600 600 /*******************************************************************************
601 601 *
602 602 * FUNCTION: AcpiDsEvalDataObjectOperands
603 603 *
604 604 * PARAMETERS: WalkState - Current walk
605 605 * Op - A valid DataObject Op object
606 606 * ObjDesc - DataObject
607 607 *
608 608 * RETURN: Status
609 609 *
610 610 * DESCRIPTION: Get the operands and complete the following data object types:
611 611 * Buffer, Package.
612 612 *
613 613 ******************************************************************************/
614 614
615 615 ACPI_STATUS
616 616 AcpiDsEvalDataObjectOperands (
617 617 ACPI_WALK_STATE *WalkState,
618 618 ACPI_PARSE_OBJECT *Op,
619 619 ACPI_OPERAND_OBJECT *ObjDesc)
620 620 {
621 621 ACPI_STATUS Status;
622 622 ACPI_OPERAND_OBJECT *ArgDesc;
623 623 UINT32 Length;
624 624
625 625
626 626 ACPI_FUNCTION_TRACE (DsEvalDataObjectOperands);
627 627
628 628
629 629 /* The first operand (for all of these data objects) is the length */
630 630
631 631 /*
632 632 * Set proper index into operand stack for AcpiDsObjStackPush
633 633 * invoked inside AcpiDsCreateOperand.
634 634 */
635 635 WalkState->OperandIndex = WalkState->NumOperands;
636 636
637 637 Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1);
638 638 if (ACPI_FAILURE (Status))
639 639 {
640 640 return_ACPI_STATUS (Status);
641 641 }
642 642
643 643 Status = AcpiExResolveOperands (WalkState->Opcode,
644 644 &(WalkState->Operands [WalkState->NumOperands -1]),
645 645 WalkState);
646 646 if (ACPI_FAILURE (Status))
647 647 {
648 648 return_ACPI_STATUS (Status);
649 649 }
650 650
651 651 /* Extract length operand */
652 652
653 653 ArgDesc = WalkState->Operands [WalkState->NumOperands - 1];
654 654 Length = (UINT32) ArgDesc->Integer.Value;
655 655
656 656 /* Cleanup for length operand */
657 657
658 658 Status = AcpiDsObjStackPop (1, WalkState);
659 659 if (ACPI_FAILURE (Status))
660 660 {
661 661 return_ACPI_STATUS (Status);
662 662 }
663 663
664 664 AcpiUtRemoveReference (ArgDesc);
665 665
666 666 /*
667 667 * Create the actual data object
668 668 */
669 669 switch (Op->Common.AmlOpcode)
670 670 {
671 671 case AML_BUFFER_OP:
672 672
↓ open down ↓ |
115 lines elided |
↑ open up ↑ |
673 673 Status = AcpiDsBuildInternalBufferObj (WalkState, Op, Length, &ObjDesc);
674 674 break;
675 675
676 676 case AML_PACKAGE_OP:
677 677 case AML_VAR_PACKAGE_OP:
678 678
679 679 Status = AcpiDsBuildInternalPackageObj (WalkState, Op, Length, &ObjDesc);
680 680 break;
681 681
682 682 default:
683 +
683 684 return_ACPI_STATUS (AE_AML_BAD_OPCODE);
684 685 }
685 686
686 687 if (ACPI_SUCCESS (Status))
687 688 {
688 689 /*
689 690 * Return the object in the WalkState, unless the parent is a package -
690 691 * in this case, the return object will be stored in the parse tree
691 692 * for the package.
692 693 */
693 694 if ((!Op->Common.Parent) ||
694 695 ((Op->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) &&
695 696 (Op->Common.Parent->Common.AmlOpcode != AML_VAR_PACKAGE_OP) &&
696 697 (Op->Common.Parent->Common.AmlOpcode != AML_NAME_OP)))
697 698 {
698 699 WalkState->ResultObj = ObjDesc;
699 700 }
700 701 }
701 702
702 703 return_ACPI_STATUS (Status);
703 704 }
704 705
705 706
706 707 /*******************************************************************************
707 708 *
708 709 * FUNCTION: AcpiDsEvalBankFieldOperands
709 710 *
710 711 * PARAMETERS: WalkState - Current walk
711 712 * Op - A valid BankField Op object
712 713 *
713 714 * RETURN: Status
714 715 *
715 716 * DESCRIPTION: Get BankField BankValue
716 717 * Called from AcpiDsExecEndOp during BankField parse tree walk
717 718 *
718 719 ******************************************************************************/
719 720
720 721 ACPI_STATUS
721 722 AcpiDsEvalBankFieldOperands (
722 723 ACPI_WALK_STATE *WalkState,
723 724 ACPI_PARSE_OBJECT *Op)
724 725 {
725 726 ACPI_STATUS Status;
726 727 ACPI_OPERAND_OBJECT *ObjDesc;
727 728 ACPI_OPERAND_OBJECT *OperandDesc;
728 729 ACPI_NAMESPACE_NODE *Node;
729 730 ACPI_PARSE_OBJECT *NextOp;
730 731 ACPI_PARSE_OBJECT *Arg;
731 732
732 733
733 734 ACPI_FUNCTION_TRACE_PTR (DsEvalBankFieldOperands, Op);
734 735
735 736
736 737 /*
737 738 * This is where we evaluate the BankValue field of the
738 739 * BankField declaration
739 740 */
740 741
741 742 /* NextOp points to the op that holds the Region */
742 743
743 744 NextOp = Op->Common.Value.Arg;
744 745
745 746 /* NextOp points to the op that holds the Bank Register */
746 747
747 748 NextOp = NextOp->Common.Next;
748 749
749 750 /* NextOp points to the op that holds the Bank Value */
750 751
751 752 NextOp = NextOp->Common.Next;
752 753
753 754 /*
754 755 * Set proper index into operand stack for AcpiDsObjStackPush
755 756 * invoked inside AcpiDsCreateOperand.
756 757 *
757 758 * We use WalkState->Operands[0] to store the evaluated BankValue
758 759 */
759 760 WalkState->OperandIndex = 0;
760 761
761 762 Status = AcpiDsCreateOperand (WalkState, NextOp, 0);
762 763 if (ACPI_FAILURE (Status))
763 764 {
764 765 return_ACPI_STATUS (Status);
765 766 }
766 767
767 768 Status = AcpiExResolveToValue (&WalkState->Operands[0], WalkState);
768 769 if (ACPI_FAILURE (Status))
769 770 {
770 771 return_ACPI_STATUS (Status);
771 772 }
772 773
773 774 ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS,
774 775 AcpiPsGetOpcodeName (Op->Common.AmlOpcode), 1);
775 776 /*
776 777 * Get the BankValue operand and save it
777 778 * (at Top of stack)
778 779 */
779 780 OperandDesc = WalkState->Operands[0];
780 781
781 782 /* Arg points to the start Bank Field */
782 783
783 784 Arg = AcpiPsGetArg (Op, 4);
784 785 while (Arg)
785 786 {
786 787 /* Ignore OFFSET and ACCESSAS terms here */
787 788
788 789 if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
789 790 {
790 791 Node = Arg->Common.Node;
791 792
792 793 ObjDesc = AcpiNsGetAttachedObject (Node);
793 794 if (!ObjDesc)
794 795 {
795 796 return_ACPI_STATUS (AE_NOT_EXIST);
796 797 }
797 798
798 799 ObjDesc->BankField.Value = (UINT32) OperandDesc->Integer.Value;
↓ open down ↓ |
106 lines elided |
↑ open up ↑ |
799 800 }
800 801
801 802 /* Move to next field in the list */
802 803
803 804 Arg = Arg->Common.Next;
804 805 }
805 806
806 807 AcpiUtRemoveReference (OperandDesc);
807 808 return_ACPI_STATUS (Status);
808 809 }
809 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX