Deleted Added
full compact
dsopcode.c (85756) dsopcode.c (87031)
1/******************************************************************************
2 *
3 * Module Name: dsopcode - Dispatcher Op Region support and handling of
4 * "control" opcodes
1/******************************************************************************
2 *
3 * Module Name: dsopcode - Dispatcher Op Region support and handling of
4 * "control" opcodes
5 * $Revision: 56 $
5 * $Revision: 66 $
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
13 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.

--- 113 unchanged lines hidden (view full) ---

127#include "actables.h"
128
129#define _COMPONENT ACPI_DISPATCHER
130 MODULE_NAME ("dsopcode")
131
132
133/*****************************************************************************
134 *
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
13 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.

--- 113 unchanged lines hidden (view full) ---

127#include "actables.h"
128
129#define _COMPONENT ACPI_DISPATCHER
130 MODULE_NAME ("dsopcode")
131
132
133/*****************************************************************************
134 *
135 * FUNCTION: AcpiDsGetBufferFieldArguments
135 * FUNCTION: AcpiDsExecuteArguments
136 *
136 *
137 * PARAMETERS: ObjDesc - A valid BufferField object
137 * PARAMETERS: Node - Parent NS node
138 * ExtraDesc - Has AML pointer and length
138 *
139 * RETURN: Status.
140 *
139 *
140 * RETURN: Status.
141 *
141 * DESCRIPTION: Get BufferField Buffer and Index. This implements the late
142 * evaluation of these field attributes.
142 * DESCRIPTION: Late execution of region or field arguments
143 *
144 ****************************************************************************/
145
146ACPI_STATUS
143 *
144 ****************************************************************************/
145
146ACPI_STATUS
147AcpiDsGetBufferFieldArguments (
148 ACPI_OPERAND_OBJECT *ObjDesc)
147AcpiDsExecuteArguments (
148 ACPI_NAMESPACE_NODE *Node,
149 ACPI_OPERAND_OBJECT *ExtraDesc)
149{
150{
150 ACPI_OPERAND_OBJECT *ExtraDesc;
151 ACPI_NAMESPACE_NODE *Node;
152 ACPI_PARSE_OBJECT *Op;
153 ACPI_PARSE_OBJECT *FieldOp;
154 ACPI_STATUS Status;
151 ACPI_STATUS Status;
155 ACPI_TABLE_DESC *TableDesc;
152 ACPI_PARSE_OBJECT *Op;
156 ACPI_WALK_STATE *WalkState;
153 ACPI_WALK_STATE *WalkState;
154 ACPI_PARSE_OBJECT *Arg;
157
158
155
156
159 FUNCTION_TRACE_PTR ("DsGetBufferFieldArguments", ObjDesc);
157 FUNCTION_TRACE ("AcpiDsExecuteArguments");
160
161
158
159
162 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
163 {
164 return_ACPI_STATUS (AE_OK);
165 }
166
167
168 /* Get the AML pointer (method object) and BufferField node */
169
170 ExtraDesc = ObjDesc->BufferField.Extra;
171 Node = ObjDesc->BufferField.Node;
172
173 DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Field]"));
174 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField JIT Init\n",
175 (char*)&Node->Name));
176
177
178 /*
179 * Allocate a new parser op to be the root of the parsed
160 /*
161 * Allocate a new parser op to be the root of the parsed
180 * OpRegion tree
162 * BufferField tree
181 */
182 Op = AcpiPsAllocOp (AML_SCOPE_OP);
183 if (!Op)
184 {
163 */
164 Op = AcpiPsAllocOp (AML_SCOPE_OP);
165 if (!Op)
166 {
185 return (AE_NO_MEMORY);
167 return_ACPI_STATUS (AE_NO_MEMORY);
186 }
187
188 /* Save the Node for use in AcpiPsParseAml */
189
190 Op->Node = AcpiNsGetParentObject (Node);
191
168 }
169
170 /* Save the Node for use in AcpiPsParseAml */
171
172 Op->Node = AcpiNsGetParentObject (Node);
173
192 /* Get a handle to the parent ACPI table */
193
194 Status = AcpiTbHandleToObject (Node->OwnerId, &TableDesc);
195 if (ACPI_FAILURE (Status))
196 {
197 return_ACPI_STATUS (Status);
198 }
199
200 /* Create and initialize a new parser state */
201
174 /* Create and initialize a new parser state */
175
202 WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT,
203 NULL, NULL, NULL);
176 WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, NULL);
204 if (!WalkState)
205 {
206 return_ACPI_STATUS (AE_NO_MEMORY);
207 }
208
177 if (!WalkState)
178 {
179 return_ACPI_STATUS (AE_NO_MEMORY);
180 }
181
209 Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, ExtraDesc->Extra.AmlStart,
182 Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, ExtraDesc->Extra.AmlStart,
210 ExtraDesc->Extra.AmlLength, NULL, NULL, 1);
211 if (ACPI_FAILURE (Status))
212 {
183 ExtraDesc->Extra.AmlLength, NULL, NULL, 1);
184 if (ACPI_FAILURE (Status))
185 {
213 /* TBD: delete walk state */
186 AcpiDsDeleteWalkState (WalkState);
214 return_ACPI_STATUS (Status);
215 }
216
187 return_ACPI_STATUS (Status);
188 }
189
217 /* TBD: No Walk flags?? */
218
219 WalkState->ParseFlags = 0;
220
221 /* Pass1: Parse the entire BufferField declaration */
222
223 Status = AcpiPsParseAml (WalkState);
224 if (ACPI_FAILURE (Status))
225 {
226 AcpiPsDeleteParseTree (Op);
227 return_ACPI_STATUS (Status);
228 }
229
230 /* Get and init the actual FieldUnit Op created above */
231
190 WalkState->ParseFlags = 0;
191
192 /* Pass1: Parse the entire BufferField declaration */
193
194 Status = AcpiPsParseAml (WalkState);
195 if (ACPI_FAILURE (Status))
196 {
197 AcpiPsDeleteParseTree (Op);
198 return_ACPI_STATUS (Status);
199 }
200
201 /* Get and init the actual FieldUnit Op created above */
202
232 FieldOp = Op->Value.Arg;
203 Arg = Op->Value.Arg;
233 Op->Node = Node;
204 Op->Node = Node;
234
235
236 FieldOp = Op->Value.Arg;
237 FieldOp->Node = Node;
205 Arg->Node = Node;
238 AcpiPsDeleteParseTree (Op);
239
206 AcpiPsDeleteParseTree (Op);
207
240 /* Evaluate the address and length arguments for the OpRegion */
208 /* Evaluate the address and length arguments for the Buffer Field */
241
242 Op = AcpiPsAllocOp (AML_SCOPE_OP);
243 if (!Op)
244 {
209
210 Op = AcpiPsAllocOp (AML_SCOPE_OP);
211 if (!Op)
212 {
245 return (AE_NO_MEMORY);
213 return_ACPI_STATUS (AE_NO_MEMORY);
246 }
247
248 Op->Node = AcpiNsGetParentObject (Node);
249
250 /* Create and initialize a new parser state */
251
214 }
215
216 Op->Node = AcpiNsGetParentObject (Node);
217
218 /* Create and initialize a new parser state */
219
252 WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT,
253 NULL, NULL, NULL);
220 WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, NULL);
254 if (!WalkState)
255 {
256 return_ACPI_STATUS (AE_NO_MEMORY);
257 }
258
259 Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, ExtraDesc->Extra.AmlStart,
260 ExtraDesc->Extra.AmlLength, NULL, NULL, 3);
261 if (ACPI_FAILURE (Status))
262 {
221 if (!WalkState)
222 {
223 return_ACPI_STATUS (AE_NO_MEMORY);
224 }
225
226 Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, ExtraDesc->Extra.AmlStart,
227 ExtraDesc->Extra.AmlLength, NULL, NULL, 3);
228 if (ACPI_FAILURE (Status))
229 {
263 /* TBD: delete walk state */
230 AcpiDsDeleteWalkState (WalkState);
264 return_ACPI_STATUS (Status);
265 }
266
267 Status = AcpiPsParseAml (WalkState);
268 AcpiPsDeleteParseTree (Op);
269
231 return_ACPI_STATUS (Status);
232 }
233
234 Status = AcpiPsParseAml (WalkState);
235 AcpiPsDeleteParseTree (Op);
236
270 /*
271 * The pseudo-method object is no longer needed since the region is
272 * now initialized
273 */
274 AcpiUtRemoveReference (ObjDesc->BufferField.Extra);
275 ObjDesc->BufferField.Extra = NULL;
276
277 return_ACPI_STATUS (Status);
278}
279
280
281/*****************************************************************************
282 *
237 return_ACPI_STATUS (Status);
238}
239
240
241/*****************************************************************************
242 *
283 * FUNCTION: AcpiDsGetRegionArguments
243 * FUNCTION: AcpiDsGetBufferFieldArguments
284 *
244 *
285 * PARAMETERS: ObjDesc - A valid region object
245 * PARAMETERS: ObjDesc - A valid BufferField object
286 *
287 * RETURN: Status.
288 *
246 *
247 * RETURN: Status.
248 *
289 * DESCRIPTION: Get region address and length. This implements the late
290 * evaluation of these region attributes.
249 * DESCRIPTION: Get BufferField Buffer and Index. This implements the late
250 * evaluation of these field attributes.
291 *
292 ****************************************************************************/
293
294ACPI_STATUS
251 *
252 ****************************************************************************/
253
254ACPI_STATUS
295AcpiDsGetRegionArguments (
255AcpiDsGetBufferFieldArguments (
296 ACPI_OPERAND_OBJECT *ObjDesc)
297{
256 ACPI_OPERAND_OBJECT *ObjDesc)
257{
298 ACPI_OPERAND_OBJECT *ExtraDesc = NULL;
258 ACPI_OPERAND_OBJECT *ExtraDesc;
299 ACPI_NAMESPACE_NODE *Node;
259 ACPI_NAMESPACE_NODE *Node;
300 ACPI_PARSE_OBJECT *Op;
301 ACPI_PARSE_OBJECT *RegionOp;
302 ACPI_STATUS Status;
260 ACPI_STATUS Status;
303 ACPI_TABLE_DESC *TableDesc;
304 ACPI_WALK_STATE *WalkState;
305
306
261
262
307 FUNCTION_TRACE_PTR ("DsGetRegionArguments", ObjDesc);
263 FUNCTION_TRACE_PTR ("DsGetBufferFieldArguments", ObjDesc);
308
309
264
265
310 if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
266 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
311 {
312 return_ACPI_STATUS (AE_OK);
313 }
314
267 {
268 return_ACPI_STATUS (AE_OK);
269 }
270
271 /* Get the AML pointer (method object) and BufferField node */
315
272
316 /* Get the AML pointer (method object) and region node */
273 ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
274 Node = ObjDesc->BufferField.Node;
317
275
318 ExtraDesc = ObjDesc->Region.Extra;
319 Node = ObjDesc->Region.Node;
276 DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Field]"));
277 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField JIT Init\n",
278 (char *) &Node->Name));
320
279
321 DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Operation Region]"));
280 /* Execute the AML code for the TermArg arguments */
322
281
323 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Init at AML %p\n",
324 (char*)&Node->Name, ExtraDesc->Extra.AmlStart));
282 Status = AcpiDsExecuteArguments (Node, ExtraDesc);
283 return_ACPI_STATUS (Status);
284}
325
285
326 /*
327 * Allocate a new parser op to be the root of the parsed
328 * OpRegion tree
329 */
330 Op = AcpiPsAllocOp (AML_SCOPE_OP);
331 if (!Op)
332 {
333 return (AE_NO_MEMORY);
334 }
335
286
336 /* Save the Node for use in AcpiPsParseAml */
287/*****************************************************************************
288 *
289 * FUNCTION: AcpiDsGetRegionArguments
290 *
291 * PARAMETERS: ObjDesc - A valid region object
292 *
293 * RETURN: Status.
294 *
295 * DESCRIPTION: Get region address and length. This implements the late
296 * evaluation of these region attributes.
297 *
298 ****************************************************************************/
337
299
338 Op->Node = AcpiNsGetParentObject (Node);
300ACPI_STATUS
301AcpiDsGetRegionArguments (
302 ACPI_OPERAND_OBJECT *ObjDesc)
303{
304 ACPI_NAMESPACE_NODE *Node;
305 ACPI_STATUS Status;
306 ACPI_OPERAND_OBJECT *RegionObj2;
339
307
340 /* Get a handle to the parent ACPI table */
341
308
342 Status = AcpiTbHandleToObject (Node->OwnerId, &TableDesc);
343 if (ACPI_FAILURE (Status))
344 {
345 return_ACPI_STATUS (Status);
346 }
309 FUNCTION_TRACE_PTR ("DsGetRegionArguments", ObjDesc);
347
310
348 /* Create and initialize a new parser state */
349
311
350 WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT,
351 Op, NULL, NULL);
352 if (!WalkState)
312 if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
353 {
313 {
354 return_ACPI_STATUS (AE_NO_MEMORY);
314 return_ACPI_STATUS (AE_OK);
355 }
356
315 }
316
357 Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, ExtraDesc->Extra.AmlStart,
358 ExtraDesc->Extra.AmlLength, NULL, NULL, 1);
359 if (ACPI_FAILURE (Status))
317 RegionObj2 = AcpiNsGetSecondaryObject (ObjDesc);
318 if (!RegionObj2)
360 {
319 {
361 /* TBD: delete walk state */
362 return_ACPI_STATUS (Status);
320 return_ACPI_STATUS (AE_NOT_EXIST);
363 }
364
321 }
322
365 /* TBD: No Walk flags?? */
323 /* Get the AML pointer (method object) and region node */
366
324
367 WalkState->ParseFlags = 0;
325 Node = ObjDesc->Region.Node;
368
326
369 /* Parse the entire OpRegion declaration, creating a parse tree */
327 DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Operation Region]"));
370
328
371 Status = AcpiPsParseAml (WalkState);
372 if (ACPI_FAILURE (Status))
373 {
374 AcpiPsDeleteParseTree (Op);
375 return_ACPI_STATUS (Status);
376 }
329 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Init at AML %p\n",
330 (char *) &Node->Name, RegionObj2->Extra.AmlStart));
377
331
378 /* Get and init the actual RegionOp created above */
379
332
380 RegionOp = Op->Value.Arg;
381 Op->Node = Node;
333 Status = AcpiDsExecuteArguments (Node, RegionObj2);
382
334
383
384 RegionOp = Op->Value.Arg;
385 RegionOp->Node = Node;
386 AcpiPsDeleteParseTree (Op);
387
388 /* Evaluate the address and length arguments for the OpRegion */
389
390 Op = AcpiPsAllocOp (AML_SCOPE_OP);
391 if (!Op)
392 {
393 return (AE_NO_MEMORY);
394 }
395
396 Op->Node = AcpiNsGetParentObject (Node);
397
398 /* Create and initialize a new parser state */
399
400 WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT,
401 Op, NULL, NULL);
402 if (!WalkState)
403 {
404 return_ACPI_STATUS (AE_NO_MEMORY);
405 }
406
407 Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, ExtraDesc->Extra.AmlStart,
408 ExtraDesc->Extra.AmlLength, NULL, NULL, 3);
409 if (ACPI_FAILURE (Status))
410 {
411 /* TBD: delete walk state */
412 return_ACPI_STATUS (Status);
413 }
414
415 Status = AcpiPsParseAml (WalkState);
416 AcpiPsDeleteParseTree (Op);
417
418 return_ACPI_STATUS (Status);
419}
420
421
422/*****************************************************************************
423 *
424 * FUNCTION: AcpiDsInitializeRegion
425 *

--- 29 unchanged lines hidden (view full) ---

455 *
456 * PARAMETERS: Op - A valid BufferField Op object
457 *
458 * RETURN: Status
459 *
460 * DESCRIPTION: Get BufferField Buffer and Index
461 * Called from AcpiDsExecEndOp during BufferField parse tree walk
462 *
335 return_ACPI_STATUS (Status);
336}
337
338
339/*****************************************************************************
340 *
341 * FUNCTION: AcpiDsInitializeRegion
342 *

--- 29 unchanged lines hidden (view full) ---

372 *
373 * PARAMETERS: Op - A valid BufferField Op object
374 *
375 * RETURN: Status
376 *
377 * DESCRIPTION: Get BufferField Buffer and Index
378 * Called from AcpiDsExecEndOp during BufferField parse tree walk
379 *
463 * ACPI SPECIFICATION REFERENCES:
464 * Each of the Buffer Field opcodes is defined as specified in in-line
465 * comments below. For each one, use the following definitions.
466 *
467 * DefBitField := BitFieldOp SrcBuf BitIdx Destination
468 * DefByteField := ByteFieldOp SrcBuf ByteIdx Destination
469 * DefCreateField := CreateFieldOp SrcBuf BitIdx NumBits NameString
470 * DefDWordField := DWordFieldOp SrcBuf ByteIdx Destination
471 * DefWordField := WordFieldOp SrcBuf ByteIdx Destination
472 * BitIndex := TermArg=>Integer
473 * ByteIndex := TermArg=>Integer
474 * Destination := NameString
475 * NumBits := TermArg=>Integer
476 * SourceBuf := TermArg=>Buffer
477 *
478 ****************************************************************************/
479
480ACPI_STATUS
481AcpiDsEvalBufferFieldOperands (
482 ACPI_WALK_STATE *WalkState,
483 ACPI_PARSE_OBJECT *Op)
484{
485 ACPI_STATUS Status;

--- 32 unchanged lines hidden (view full) ---

518 }
519
520 ObjDesc = AcpiNsGetAttachedObject (Node);
521 if (!ObjDesc)
522 {
523 return_ACPI_STATUS (AE_NOT_EXIST);
524 }
525
380 ****************************************************************************/
381
382ACPI_STATUS
383AcpiDsEvalBufferFieldOperands (
384 ACPI_WALK_STATE *WalkState,
385 ACPI_PARSE_OBJECT *Op)
386{
387 ACPI_STATUS Status;

--- 32 unchanged lines hidden (view full) ---

420 }
421
422 ObjDesc = AcpiNsGetAttachedObject (Node);
423 if (!ObjDesc)
424 {
425 return_ACPI_STATUS (AE_NOT_EXIST);
426 }
427
526
527 /* Resolve the operands */
528
529 Status = AcpiExResolveOperands (Op->Opcode, WALK_OPERANDS, WalkState);
530 DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Op->Opcode),
531 WalkState->NumOperands, "after AcpiExResolveOperands");
532
533 if (ACPI_FAILURE (Status))
534 {

--- 12 unchanged lines hidden (view full) ---

547 }
548 else
549 {
550 ResDesc = WalkState->Operands[2];
551 }
552
553 OffDesc = WalkState->Operands[1];
554 SrcDesc = WalkState->Operands[0];
428 /* Resolve the operands */
429
430 Status = AcpiExResolveOperands (Op->Opcode, WALK_OPERANDS, WalkState);
431 DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Op->Opcode),
432 WalkState->NumOperands, "after AcpiExResolveOperands");
433
434 if (ACPI_FAILURE (Status))
435 {

--- 12 unchanged lines hidden (view full) ---

448 }
449 else
450 {
451 ResDesc = WalkState->Operands[2];
452 }
453
454 OffDesc = WalkState->Operands[1];
455 SrcDesc = WalkState->Operands[0];
456 Offset = (UINT32) OffDesc->Integer.Value;
555
457
556
557
558 Offset = (UINT32) OffDesc->Integer.Value;
559
560 /*
561 * If ResDesc is a Name, it will be a direct name pointer after
562 * AcpiExResolveOperands()
563 */
564 if (!VALID_DESCRIPTOR_TYPE (ResDesc, ACPI_DESC_TYPE_NAMED))
565 {
566 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination must be a Node\n",
567 AcpiPsGetOpcodeName (Op->Opcode)));
568
569 Status = AE_AML_OPERAND_TYPE;
570 goto Cleanup;
571 }
572
573 /*
574 * Setup the Bit offsets and counts, according to the opcode
575 */
576 switch (Op->Opcode)
577 {
578
458 /*
459 * If ResDesc is a Name, it will be a direct name pointer after
460 * AcpiExResolveOperands()
461 */
462 if (!VALID_DESCRIPTOR_TYPE (ResDesc, ACPI_DESC_TYPE_NAMED))
463 {
464 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination must be a Node\n",
465 AcpiPsGetOpcodeName (Op->Opcode)));
466
467 Status = AE_AML_OPERAND_TYPE;
468 goto Cleanup;
469 }
470
471 /*
472 * Setup the Bit offsets and counts, according to the opcode
473 */
474 switch (Op->Opcode)
475 {
476
579 /* DefCreateField */
580
581 case AML_CREATE_FIELD_OP:
582
583 /* Offset is in bits, count is in bits */
584
585 BitOffset = Offset;
586 BitCount = (UINT32) CntDesc->Integer.Value;
477 case AML_CREATE_FIELD_OP:
478
479 /* Offset is in bits, count is in bits */
480
481 BitOffset = Offset;
482 BitCount = (UINT32) CntDesc->Integer.Value;
587 FieldFlags = ACCESS_BYTE_ACC;
483 FieldFlags = AML_FIELD_ACCESS_BYTE;
588 break;
589
484 break;
485
590
591 /* DefCreateBitField */
592
593 case AML_CREATE_BIT_FIELD_OP:
594
595 /* Offset is in bits, Field is one bit */
596
597 BitOffset = Offset;
598 BitCount = 1;
486 case AML_CREATE_BIT_FIELD_OP:
487
488 /* Offset is in bits, Field is one bit */
489
490 BitOffset = Offset;
491 BitCount = 1;
599 FieldFlags = ACCESS_BYTE_ACC;
492 FieldFlags = AML_FIELD_ACCESS_BYTE;
600 break;
601
493 break;
494
602
603 /* DefCreateByteField */
604
605 case AML_CREATE_BYTE_FIELD_OP:
606
607 /* Offset is in bytes, field is one byte */
608
609 BitOffset = 8 * Offset;
610 BitCount = 8;
495 case AML_CREATE_BYTE_FIELD_OP:
496
497 /* Offset is in bytes, field is one byte */
498
499 BitOffset = 8 * Offset;
500 BitCount = 8;
611 FieldFlags = ACCESS_BYTE_ACC;
501 FieldFlags = AML_FIELD_ACCESS_BYTE;
612 break;
613
502 break;
503
614
615 /* DefCreateWordField */
616
617 case AML_CREATE_WORD_FIELD_OP:
618
619 /* Offset is in bytes, field is one word */
620
621 BitOffset = 8 * Offset;
622 BitCount = 16;
504 case AML_CREATE_WORD_FIELD_OP:
505
506 /* Offset is in bytes, field is one word */
507
508 BitOffset = 8 * Offset;
509 BitCount = 16;
623 FieldFlags = ACCESS_WORD_ACC;
510 FieldFlags = AML_FIELD_ACCESS_WORD;
624 break;
625
511 break;
512
626
627 /* DefCreateDWordField */
628
629 case AML_CREATE_DWORD_FIELD_OP:
630
631 /* Offset is in bytes, field is one dword */
632
633 BitOffset = 8 * Offset;
634 BitCount = 32;
513 case AML_CREATE_DWORD_FIELD_OP:
514
515 /* Offset is in bytes, field is one dword */
516
517 BitOffset = 8 * Offset;
518 BitCount = 32;
635 FieldFlags = ACCESS_DWORD_ACC;
519 FieldFlags = AML_FIELD_ACCESS_DWORD;
636 break;
637
520 break;
521
638
639 /* DefCreateQWordField */
640
641 case AML_CREATE_QWORD_FIELD_OP:
642
643 /* Offset is in bytes, field is one qword */
644
645 BitOffset = 8 * Offset;
646 BitCount = 64;
522 case AML_CREATE_QWORD_FIELD_OP:
523
524 /* Offset is in bytes, field is one qword */
525
526 BitOffset = 8 * Offset;
527 BitCount = 64;
647 FieldFlags = ACCESS_QWORD_ACC;
528 FieldFlags = AML_FIELD_ACCESS_QWORD;
648 break;
649
529 break;
530
650
651 default:
652
653 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
654 "Internal error - unknown field creation opcode %02x\n",
655 Op->Opcode));
656 Status = AE_AML_BAD_OPCODE;
657 goto Cleanup;
658 }
659
531 default:
532
533 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
534 "Internal error - unknown field creation opcode %02x\n",
535 Op->Opcode));
536 Status = AE_AML_BAD_OPCODE;
537 goto Cleanup;
538 }
539
660
661 /*
662 * Setup field according to the object type
663 */
664 switch (SrcDesc->Common.Type)
665 {
666
667 /* SourceBuff := TermArg=>Buffer */
668

--- 4 unchanged lines hidden (view full) ---

673 {
674 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
675 "Field size %d exceeds Buffer size %d (bits)\n",
676 BitOffset + BitCount, 8 * (UINT32) SrcDesc->Buffer.Length));
677 Status = AE_AML_BUFFER_LIMIT;
678 goto Cleanup;
679 }
680
540 /*
541 * Setup field according to the object type
542 */
543 switch (SrcDesc->Common.Type)
544 {
545
546 /* SourceBuff := TermArg=>Buffer */
547

--- 4 unchanged lines hidden (view full) ---

552 {
553 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
554 "Field size %d exceeds Buffer size %d (bits)\n",
555 BitOffset + BitCount, 8 * (UINT32) SrcDesc->Buffer.Length));
556 Status = AE_AML_BUFFER_LIMIT;
557 goto Cleanup;
558 }
559
681
682 /*
683 * Initialize areas of the field object that are common to all fields
684 * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE)
685 */
560 /*
561 * Initialize areas of the field object that are common to all fields
562 * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE)
563 */
686 Status = AcpiExPrepCommonFieldObject (ObjDesc, FieldFlags,
564 Status = AcpiExPrepCommonFieldObject (ObjDesc, FieldFlags, 0,
687 BitOffset, BitCount);
688 if (ACPI_FAILURE (Status))
689 {
690 return_ACPI_STATUS (Status);
691 }
692
693 ObjDesc->BufferField.BufferObj = SrcDesc;
694
695 /* Reference count for SrcDesc inherits ObjDesc count */
696
697 SrcDesc->Common.ReferenceCount = (UINT16) (SrcDesc->Common.ReferenceCount +
698 ObjDesc->Common.ReferenceCount);
565 BitOffset, BitCount);
566 if (ACPI_FAILURE (Status))
567 {
568 return_ACPI_STATUS (Status);
569 }
570
571 ObjDesc->BufferField.BufferObj = SrcDesc;
572
573 /* Reference count for SrcDesc inherits ObjDesc count */
574
575 SrcDesc->Common.ReferenceCount = (UINT16) (SrcDesc->Common.ReferenceCount +
576 ObjDesc->Common.ReferenceCount);
699
700 break;
701
702
703 /* Improper object type */
704
705 default:
706
577 break;
578
579
580 /* Improper object type */
581
582 default:
583
707 if ((SrcDesc->Common.Type > (UINT8) INTERNAL_TYPE_REFERENCE) || !AcpiUtValidObjectType (SrcDesc->Common.Type)) /* TBD: This line MUST be a single line until AcpiSrc can handle it (block deletion) */
584 if ((SrcDesc->Common.Type > (UINT8) INTERNAL_TYPE_REFERENCE) || !AcpiUtValidObjectType (SrcDesc->Common.Type)) /* This line MUST be a single line until AcpiSrc can handle it (block deletion) */
708 {
709 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
710 "Tried to create field in invalid object type %X\n",
711 SrcDesc->Common.Type));
712 }
713
714 else
715 {

--- 194 unchanged lines hidden (view full) ---

910 AcpiUtPushGenericState (&WalkState->ControlState, ControlState);
911
912 /*
913 * Save a pointer to the predicate for multiple executions
914 * of a loop
915 */
916 WalkState->ControlState->Control.AmlPredicateStart =
917 WalkState->ParserState.Aml - 1;
585 {
586 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
587 "Tried to create field in invalid object type %X\n",
588 SrcDesc->Common.Type));
589 }
590
591 else
592 {

--- 194 unchanged lines hidden (view full) ---

787 AcpiUtPushGenericState (&WalkState->ControlState, ControlState);
788
789 /*
790 * Save a pointer to the predicate for multiple executions
791 * of a loop
792 */
793 WalkState->ControlState->Control.AmlPredicateStart =
794 WalkState->ParserState.Aml - 1;
918 /* TBD: can this be removed? */
919 /*AcpiPsPkgLengthEncodingSize (GET8 (WalkState->ParserState->Aml));*/
920 break;
921
795 break;
796
922
923 case AML_ELSE_OP:
924
925 /* Predicate is in the state object */
926 /* If predicate is true, the IF was executed, ignore ELSE part */
927
928 if (WalkState->LastPredicate)
929 {
930 Status = AE_CTRL_TRUE;
931 }
932
933 break;
934
797 case AML_ELSE_OP:
798
799 /* Predicate is in the state object */
800 /* If predicate is true, the IF was executed, ignore ELSE part */
801
802 if (WalkState->LastPredicate)
803 {
804 Status = AE_CTRL_TRUE;
805 }
806
807 break;
808
935
936 case AML_RETURN_OP:
937
938 break;
939
809 case AML_RETURN_OP:
810
811 break;
812
940
941 default:
942 break;
943 }
944
945 return (Status);
946}
947
948

--- 4 unchanged lines hidden (view full) ---

953 * PARAMETERS: WalkList - The list that owns the walk stack
954 * Op - The control Op
955 *
956 * RETURN: Status
957 *
958 * DESCRIPTION: Handles all control ops encountered during control method
959 * execution.
960 *
813 default:
814 break;
815 }
816
817 return (Status);
818}
819
820

--- 4 unchanged lines hidden (view full) ---

825 * PARAMETERS: WalkList - The list that owns the walk stack
826 * Op - The control Op
827 *
828 * RETURN: Status
829 *
830 * DESCRIPTION: Handles all control ops encountered during control method
831 * execution.
832 *
961 *
962 ******************************************************************************/
963
964ACPI_STATUS
965AcpiDsExecEndControlOp (
966 ACPI_WALK_STATE *WalkState,
967 ACPI_PARSE_OBJECT *Op)
968{
969 ACPI_STATUS Status = AE_OK;

--- 102 unchanged lines hidden (view full) ---

1072 * cease to exist at the end of the method.
1073 *
1074 * Allow references created by the Index operator to return unchanged.
1075 */
1076 if (VALID_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc [0], ACPI_DESC_TYPE_INTERNAL) &&
1077 ((WalkState->Results->Results.ObjDesc [0])->Common.Type == INTERNAL_TYPE_REFERENCE) &&
1078 ((WalkState->Results->Results.ObjDesc [0])->Reference.Opcode != AML_INDEX_OP))
1079 {
833 ******************************************************************************/
834
835ACPI_STATUS
836AcpiDsExecEndControlOp (
837 ACPI_WALK_STATE *WalkState,
838 ACPI_PARSE_OBJECT *Op)
839{
840 ACPI_STATUS Status = AE_OK;

--- 102 unchanged lines hidden (view full) ---

943 * cease to exist at the end of the method.
944 *
945 * Allow references created by the Index operator to return unchanged.
946 */
947 if (VALID_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc [0], ACPI_DESC_TYPE_INTERNAL) &&
948 ((WalkState->Results->Results.ObjDesc [0])->Common.Type == INTERNAL_TYPE_REFERENCE) &&
949 ((WalkState->Results->Results.ObjDesc [0])->Reference.Opcode != AML_INDEX_OP))
950 {
1080 Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState);
1081 if (ACPI_FAILURE (Status))
1082 {
1083 return (Status);
1084 }
951 Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState);
952 if (ACPI_FAILURE (Status))
953 {
954 return (Status);
955 }
1085 }
1086
1087 WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0];
1088 }
1089
1090 else
1091 {
1092 /* No return operand */

--- 68 unchanged lines hidden (view full) ---

1161
1162 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown control opcode=%X Op=%p\n",
1163 Op->Opcode, Op));
1164
1165 Status = AE_AML_BAD_OPCODE;
1166 break;
1167 }
1168
956 }
957
958 WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0];
959 }
960
961 else
962 {
963 /* No return operand */

--- 68 unchanged lines hidden (view full) ---

1032
1033 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown control opcode=%X Op=%p\n",
1034 Op->Opcode, Op));
1035
1036 Status = AE_AML_BAD_OPCODE;
1037 break;
1038 }
1039
1169
1170 return (Status);
1171}
1172
1040 return (Status);
1041}
1042