ReactOS  0.4.15-dev-1207-g698a8e6
dsopcode.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "acevents.h"
#include "actables.h"
Include dependency graph for dsopcode.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_DISPATCHER
 

Functions

static ACPI_STATUS AcpiDsInitBufferField (UINT16 AmlOpcode, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT *BufferDesc, ACPI_OPERAND_OBJECT *OffsetDesc, ACPI_OPERAND_OBJECT *LengthDesc, ACPI_OPERAND_OBJECT *ResultDesc)
 
ACPI_STATUS AcpiDsInitializeRegion (ACPI_HANDLE ObjHandle)
 
ACPI_STATUS AcpiDsEvalBufferFieldOperands (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
 
ACPI_STATUS AcpiDsEvalRegionOperands (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
 
ACPI_STATUS AcpiDsEvalTableRegionOperands (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
 
ACPI_STATUS AcpiDsEvalDataObjectOperands (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT *ObjDesc)
 
ACPI_STATUS AcpiDsEvalBankFieldOperands (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_DISPATCHER

Definition at line 54 of file dsopcode.c.

Function Documentation

◆ AcpiDsEvalBankFieldOperands()

ACPI_STATUS AcpiDsEvalBankFieldOperands ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op 
)

Definition at line 754 of file dsopcode.c.

757 {
759  ACPI_OPERAND_OBJECT *ObjDesc;
760  ACPI_OPERAND_OBJECT *OperandDesc;
762  ACPI_PARSE_OBJECT *NextOp;
763  ACPI_PARSE_OBJECT *Arg;
764 
765 
766  ACPI_FUNCTION_TRACE_PTR (DsEvalBankFieldOperands, Op);
767 
768 
769  /*
770  * This is where we evaluate the BankValue field of the
771  * BankField declaration
772  */
773 
774  /* NextOp points to the op that holds the Region */
775 
776  NextOp = Op->Common.Value.Arg;
777 
778  /* NextOp points to the op that holds the Bank Register */
779 
780  NextOp = NextOp->Common.Next;
781 
782  /* NextOp points to the op that holds the Bank Value */
783 
784  NextOp = NextOp->Common.Next;
785 
786  /*
787  * Set proper index into operand stack for AcpiDsObjStackPush
788  * invoked inside AcpiDsCreateOperand.
789  *
790  * We use WalkState->Operands[0] to store the evaluated BankValue
791  */
792  WalkState->OperandIndex = 0;
793 
794  Status = AcpiDsCreateOperand (WalkState, NextOp, 0);
795  if (ACPI_FAILURE (Status))
796  {
798  }
799 
800  Status = AcpiExResolveToValue (&WalkState->Operands[0], WalkState);
801  if (ACPI_FAILURE (Status))
802  {
804  }
805 
807  AcpiPsGetOpcodeName (Op->Common.AmlOpcode), 1);
808  /*
809  * Get the BankValue operand and save it
810  * (at Top of stack)
811  */
812  OperandDesc = WalkState->Operands[0];
813 
814  /* Arg points to the start Bank Field */
815 
816  Arg = AcpiPsGetArg (Op, 4);
817  while (Arg)
818  {
819  /* Ignore OFFSET and ACCESSAS terms here */
820 
821  if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
822  {
823  Node = Arg->Common.Node;
824 
825  ObjDesc = AcpiNsGetAttachedObject (Node);
826  if (!ObjDesc)
827  {
829  }
830 
831  ObjDesc->BankField.Value = (UINT32) OperandDesc->Integer.Value;
832  }
833 
834  /* Move to next field in the list */
835 
836  Arg = Arg->Common.Next;
837  }
838 
839  AcpiUtRemoveReference (OperandDesc);
841 }
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
const char * AcpiPsGetOpcodeName(UINT16 Opcode)
Definition: psopinfo.c:169
UINT8 OperandIndex
Definition: acstruct.h:81
#define ACPI_DUMP_OPERANDS(a, b, c)
Definition: acoutput.h:486
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_STATUS AcpiDsCreateOperand(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg, UINT32 ArgIndex)
Definition: dsutils.c:497
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_OBJECT_BANK_FIELD BankField
Definition: acobject.h:534
unsigned int UINT32
union node Node
Definition: types.h:1255
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
Status
Definition: gdiplustypes.h:24
#define AE_NOT_EXIST
Definition: acexcep.h:114
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:518
ACPI_STATUS AcpiExResolveToValue(ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresolv.c:79
#define AML_INT_NAMEDFIELD_OP
Definition: amlcode.h:206
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:781
ACPI_PARSE_OBJECT * AcpiPsGetArg(ACPI_PARSE_OBJECT *op, UINT32 argn)
Definition: pstree.c:76
#define ACPI_WALK_OPERANDS
Definition: acinterp.h:48
Definition: dlist.c:348

Referenced by AcpiDsExecEndOp().

◆ AcpiDsEvalBufferFieldOperands()

ACPI_STATUS AcpiDsEvalBufferFieldOperands ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op 
)

Definition at line 321 of file dsopcode.c.

324 {
326  ACPI_OPERAND_OBJECT *ObjDesc;
328  ACPI_PARSE_OBJECT *NextOp;
329 
330 
331  ACPI_FUNCTION_TRACE_PTR (DsEvalBufferFieldOperands, Op);
332 
333 
334  /*
335  * This is where we evaluate the address and length fields of the
336  * CreateXxxField declaration
337  */
338  Node = Op->Common.Node;
339 
340  /* NextOp points to the op that holds the Buffer */
341 
342  NextOp = Op->Common.Value.Arg;
343 
344  /* Evaluate/create the address and length operands */
345 
346  Status = AcpiDsCreateOperands (WalkState, NextOp);
347  if (ACPI_FAILURE (Status))
348  {
350  }
351 
352  ObjDesc = AcpiNsGetAttachedObject (Node);
353  if (!ObjDesc)
354  {
356  }
357 
358  /* Resolve the operands */
359 
361  Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
362  if (ACPI_FAILURE (Status))
363  {
364  ACPI_ERROR ((AE_INFO, "(%s) bad operand(s), status 0x%X",
365  AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status));
366 
368  }
369 
370  /* Initialize the Buffer Field */
371 
372  if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
373  {
374  /* NOTE: Slightly different operands for this opcode */
375 
376  Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
377  WalkState->Operands[0], WalkState->Operands[1],
378  WalkState->Operands[2], WalkState->Operands[3]);
379  }
380  else
381  {
382  /* All other, CreateXxxField opcodes */
383 
384  Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
385  WalkState->Operands[0], WalkState->Operands[1],
386  NULL, WalkState->Operands[2]);
387  }
388 
390 }
ACPI_STATUS AcpiDsCreateOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *FirstArg)
Definition: dsutils.c:753
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
const char * AcpiPsGetOpcodeName(UINT16 Opcode)
Definition: psopinfo.c:169
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
union node Node
Definition: types.h:1255
#define AML_CREATE_FIELD_OP
Definition: amlcode.h:163
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
static ACPI_STATUS AcpiDsInitBufferField(UINT16 AmlOpcode, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT *BufferDesc, ACPI_OPERAND_OBJECT *OffsetDesc, ACPI_OPERAND_OBJECT *LengthDesc, ACPI_OPERAND_OBJECT *ResultDesc)
Definition: dsopcode.c:116
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
Status
Definition: gdiplustypes.h:24
#define AE_NOT_EXIST
Definition: acexcep.h:114
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
ACPI_STATUS AcpiExResolveOperands(UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresop.c:145
#define ACPI_WALK_OPERANDS
Definition: acinterp.h:48
Definition: dlist.c:348

Referenced by AcpiDsExecEndOp().

◆ AcpiDsEvalDataObjectOperands()

ACPI_STATUS AcpiDsEvalDataObjectOperands ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op,
ACPI_OPERAND_OBJECT ObjDesc 
)

Definition at line 636 of file dsopcode.c.

640 {
642  ACPI_OPERAND_OBJECT *ArgDesc;
643  UINT32 Length;
644 
645 
646  ACPI_FUNCTION_TRACE (DsEvalDataObjectOperands);
647 
648 
649  /* The first operand (for all of these data objects) is the length */
650 
651  /*
652  * Set proper index into operand stack for AcpiDsObjStackPush
653  * invoked inside AcpiDsCreateOperand.
654  */
655  WalkState->OperandIndex = WalkState->NumOperands;
656 
657  /* Ignore if child is not valid */
658 
659  if (!Op->Common.Value.Arg)
660  {
662  "Missing child while evaluating opcode %4.4X, Op %p",
663  Op->Common.AmlOpcode, Op));
665  }
666 
667  Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1);
668  if (ACPI_FAILURE (Status))
669  {
671  }
672 
673  Status = AcpiExResolveOperands (WalkState->Opcode,
674  &(WalkState->Operands [WalkState->NumOperands -1]),
675  WalkState);
676  if (ACPI_FAILURE (Status))
677  {
679  }
680 
681  /* Extract length operand */
682 
683  ArgDesc = WalkState->Operands [WalkState->NumOperands - 1];
684  Length = (UINT32) ArgDesc->Integer.Value;
685 
686  /* Cleanup for length operand */
687 
688  Status = AcpiDsObjStackPop (1, WalkState);
689  if (ACPI_FAILURE (Status))
690  {
692  }
693 
694  AcpiUtRemoveReference (ArgDesc);
695 
696  /*
697  * Create the actual data object
698  */
699  switch (Op->Common.AmlOpcode)
700  {
701  case AML_BUFFER_OP:
702 
704  WalkState, Op, Length, &ObjDesc);
705  break;
706 
707  case AML_PACKAGE_OP:
709 
711  WalkState, Op, Length, &ObjDesc);
712  break;
713 
714  default:
715 
717  }
718 
719  if (ACPI_SUCCESS (Status))
720  {
721  /*
722  * Return the object in the WalkState, unless the parent is a package -
723  * in this case, the return object will be stored in the parse tree
724  * for the package.
725  */
726  if ((!Op->Common.Parent) ||
727  ((Op->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) &&
728  (Op->Common.Parent->Common.AmlOpcode != AML_VARIABLE_PACKAGE_OP) &&
729  (Op->Common.Parent->Common.AmlOpcode != AML_NAME_OP)))
730  {
731  WalkState->ResultObj = ObjDesc;
732  }
733  }
734 
736 }
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
UINT8 OperandIndex
Definition: acstruct.h:81
UINT8 NumOperands
Definition: acstruct.h:80
ACPI_STATUS AcpiDsBuildInternalPackageObj(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, UINT32 ElementCount, ACPI_OPERAND_OBJECT **ObjDescPtr)
Definition: dspkginit.c:94
ACPI_STATUS AcpiDsBuildInternalBufferObj(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, UINT32 BufferLength, ACPI_OPERAND_OBJECT **ObjDescPtr)
Definition: dsobject.c:188
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_STATUS AcpiDsCreateOperand(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg, UINT32 ArgIndex)
Definition: dsutils.c:497
ACPI_STATUS AcpiDsObjStackPop(UINT32 PopCount, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:391
#define AML_VARIABLE_PACKAGE_OP
Definition: amlcode.h:63
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AML_NAME_OP
Definition: amlcode.h:54
unsigned int UINT32
#define AE_INFO
Definition: acoutput.h:230
#define AE_AML_BAD_OPCODE
Definition: acexcep.h:180
union acpi_operand_object * ResultObj
Definition: acstruct.h:121
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
Status
Definition: gdiplustypes.h:24
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:518
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:781
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AML_BUFFER_OP
Definition: amlcode.h:61
UINT16 Opcode
Definition: acstruct.h:78
ACPI_STATUS AcpiExResolveOperands(UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresop.c:145
#define AE_OK
Definition: acexcep.h:97
#define AML_PACKAGE_OP
Definition: amlcode.h:62

Referenced by AcpiDsExecEndOp().

◆ AcpiDsEvalRegionOperands()

ACPI_STATUS AcpiDsEvalRegionOperands ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op 
)

Definition at line 408 of file dsopcode.c.

411 {
413  ACPI_OPERAND_OBJECT *ObjDesc;
414  ACPI_OPERAND_OBJECT *OperandDesc;
416  ACPI_PARSE_OBJECT *NextOp;
418 
419 
420  ACPI_FUNCTION_TRACE_PTR (DsEvalRegionOperands, Op);
421 
422 
423  /*
424  * This is where we evaluate the address and length fields of the
425  * OpRegion declaration
426  */
427  Node = Op->Common.Node;
428 
429  /* NextOp points to the op that holds the SpaceID */
430 
431  NextOp = Op->Common.Value.Arg;
432  SpaceId = (ACPI_ADR_SPACE_TYPE) NextOp->Common.Value.Integer;
433 
434  /* NextOp points to address op */
435 
436  NextOp = NextOp->Common.Next;
437 
438  /* Evaluate/create the address and length operands */
439 
440  Status = AcpiDsCreateOperands (WalkState, NextOp);
441  if (ACPI_FAILURE (Status))
442  {
444  }
445 
446  /* Resolve the length and address operands to numbers */
447 
449  Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
450  if (ACPI_FAILURE (Status))
451  {
453  }
454 
455  ObjDesc = AcpiNsGetAttachedObject (Node);
456  if (!ObjDesc)
457  {
459  }
460 
461  /*
462  * Get the length operand and save it
463  * (at Top of stack)
464  */
465  OperandDesc = WalkState->Operands[WalkState->NumOperands - 1];
466 
467  ObjDesc->Region.Length = (UINT32) OperandDesc->Integer.Value;
468  AcpiUtRemoveReference (OperandDesc);
469 
470  /* A zero-length operation region is unusable. Just warn */
471 
472  if (!ObjDesc->Region.Length && (SpaceId < ACPI_NUM_PREDEFINED_REGIONS))
473  {
475  "Operation Region [%4.4s] has zero length (SpaceId %X)",
476  Node->Name.Ascii, SpaceId));
477  }
478 
479  /*
480  * Get the address and save it
481  * (at top of stack - 1)
482  */
483  OperandDesc = WalkState->Operands[WalkState->NumOperands - 2];
484 
485  ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS)
486  OperandDesc->Integer.Value;
487  AcpiUtRemoveReference (OperandDesc);
488 
489  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
490  ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
491  ObjDesc->Region.Length));
492 
494  ObjDesc->Region.Address, ObjDesc->Region.Length, Node);
495 
496  /* Now the address and length are valid for this opregion */
497 
498  ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
500 }
ACPI_STATUS AcpiDsCreateOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *FirstArg)
Definition: dsutils.c:753
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
UINT8 ACPI_ADR_SPACE_TYPE
Definition: actypes.h:850
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
UINT8 NumOperands
Definition: acstruct.h:80
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_OBJECT_COMMON_HEADER UINT8 SpaceId
Definition: acobject.h:202
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE SpaceId
Definition: acpixf.h:828
unsigned int UINT32
union node Node
Definition: types.h:1255
#define AE_INFO
Definition: acoutput.h:230
ACPI_OBJECT_REGION Region
Definition: acobject.h:525
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_STATUS AcpiUtAddAddressRange(ACPI_ADR_SPACE_TYPE SpaceId, ACPI_PHYSICAL_ADDRESS Address, UINT32 Length, ACPI_NAMESPACE_NODE *RegionNode)
Definition: utaddress.c:78
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
Status
Definition: gdiplustypes.h:24
#define AE_NOT_EXIST
Definition: acexcep.h:114
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:518
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:781
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
ACPI_PHYSICAL_ADDRESS Address
Definition: acobject.h:206
#define ACPI_NUM_PREDEFINED_REGIONS
Definition: actypes.h:865
ACPI_STATUS AcpiExResolveOperands(UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresop.c:145
#define ACPI_WALK_OPERANDS
Definition: acinterp.h:48
Definition: dlist.c:348

Referenced by AcpiDsExecEndOp().

◆ AcpiDsEvalTableRegionOperands()

ACPI_STATUS AcpiDsEvalTableRegionOperands ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op 
)

Definition at line 519 of file dsopcode.c.

522 {
524  ACPI_OPERAND_OBJECT *ObjDesc;
525  ACPI_OPERAND_OBJECT **Operand;
527  ACPI_PARSE_OBJECT *NextOp;
529  UINT32 TableIndex;
530 
531 
532  ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op);
533 
534 
535  /*
536  * This is where we evaluate the Signature string, OemId string,
537  * and OemTableId string of the Data Table Region declaration
538  */
539  Node = Op->Common.Node;
540 
541  /* NextOp points to Signature string op */
542 
543  NextOp = Op->Common.Value.Arg;
544 
545  /*
546  * Evaluate/create the Signature string, OemId string,
547  * and OemTableId string operands
548  */
549  Status = AcpiDsCreateOperands (WalkState, NextOp);
550  if (ACPI_FAILURE (Status))
551  {
553  }
554 
555  Operand = &WalkState->Operands[0];
556 
557  /*
558  * Resolve the Signature string, OemId string,
559  * and OemTableId string operands
560  */
562  Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
563  if (ACPI_FAILURE (Status))
564  {
565  goto Cleanup;
566  }
567 
568  /* Find the ACPI table */
569 
571  Operand[0]->String.Pointer,
572  Operand[1]->String.Pointer,
573  Operand[2]->String.Pointer, &TableIndex);
574  if (ACPI_FAILURE (Status))
575  {
576  if (Status == AE_NOT_FOUND)
577  {
579  "ACPI Table [%4.4s] OEM:(%s, %s) not found in RSDT/XSDT",
580  Operand[0]->String.Pointer,
581  Operand[1]->String.Pointer,
582  Operand[2]->String.Pointer));
583  }
584  goto Cleanup;
585  }
586 
587  Status = AcpiGetTableByIndex (TableIndex, &Table);
588  if (ACPI_FAILURE (Status))
589  {
590  goto Cleanup;
591  }
592 
593  ObjDesc = AcpiNsGetAttachedObject (Node);
594  if (!ObjDesc)
595  {
597  goto Cleanup;
598  }
599 
601  ObjDesc->Region.Length = Table->Length;
602 
603  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
604  ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
605  ObjDesc->Region.Length));
606 
607  /* Now the address and length are valid for this opregion */
608 
609  ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
610 
611 Cleanup:
612  AcpiUtRemoveReference (Operand[0]);
613  AcpiUtRemoveReference (Operand[1]);
614  AcpiUtRemoveReference (Operand[2]);
615 
617 }
ACPI_STATUS AcpiDsCreateOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *FirstArg)
Definition: dsutils.c:753
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
ASMGENDATA Table[]
Definition: genincdata.c:61
static WCHAR String[]
Definition: stringtable.c:55
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiGetTableByIndex(UINT32 TableIndex, ACPI_TABLE_HEADER **OutTable)
Definition: tbxface.c:491
unsigned int UINT32
union node Node
Definition: types.h:1255
#define AE_INFO
Definition: acoutput.h:230
ACPI_OBJECT_REGION Region
Definition: acobject.h:525
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
#define AE_NOT_FOUND
Definition: acexcep.h:113
Status
Definition: gdiplustypes.h:24
#define AE_NOT_EXIST
Definition: acexcep.h:114
#define ACPI_PTR_TO_PHYSADDR(i)
Definition: actypes.h:556
static const WCHAR Cleanup[]
Definition: register.c:80
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:781
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
ACPI_PHYSICAL_ADDRESS Address
Definition: acobject.h:206
ACPI_STATUS AcpiExResolveOperands(UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresop.c:145
#define ACPI_WALK_OPERANDS
Definition: acinterp.h:48
ACPI_STATUS AcpiTbFindTable(char *Signature, char *OemId, char *OemTableId, UINT32 *TableIndex)
Definition: tbfind.c:70
Definition: dlist.c:348

Referenced by AcpiDsExecEndOp().

◆ AcpiDsInitBufferField()

static ACPI_STATUS AcpiDsInitBufferField ( UINT16  AmlOpcode,
ACPI_OPERAND_OBJECT ObjDesc,
ACPI_OPERAND_OBJECT BufferDesc,
ACPI_OPERAND_OBJECT OffsetDesc,
ACPI_OPERAND_OBJECT LengthDesc,
ACPI_OPERAND_OBJECT ResultDesc 
)
static

Definition at line 116 of file dsopcode.c.

123 {
124  UINT32 Offset;
125  UINT32 BitOffset;
126  UINT32 BitCount;
127  UINT8 FieldFlags;
129 
130 
131  ACPI_FUNCTION_TRACE_PTR (DsInitBufferField, ObjDesc);
132 
133 
134  /* Host object must be a Buffer */
135 
136  if (BufferDesc->Common.Type != ACPI_TYPE_BUFFER)
137  {
139  "Target of Create Field is not a Buffer object - %s",
140  AcpiUtGetObjectTypeName (BufferDesc)));
141 
143  goto Cleanup;
144  }
145 
146  /*
147  * The last parameter to all of these opcodes (ResultDesc) started
148  * out as a NameString, and should therefore now be a NS node
149  * after resolution in AcpiExResolveOperands().
150  */
152  {
154  "(%s) destination not a NS Node [%s]",
155  AcpiPsGetOpcodeName (AmlOpcode),
156  AcpiUtGetDescriptorName (ResultDesc)));
157 
159  goto Cleanup;
160  }
161 
162  Offset = (UINT32) OffsetDesc->Integer.Value;
163 
164  /*
165  * Setup the Bit offsets and counts, according to the opcode
166  */
167  switch (AmlOpcode)
168  {
169  case AML_CREATE_FIELD_OP:
170 
171  /* Offset is in bits, count is in bits */
172 
173  FieldFlags = AML_FIELD_ACCESS_BYTE;
174  BitOffset = Offset;
175  BitCount = (UINT32) LengthDesc->Integer.Value;
176 
177  /* Must have a valid (>0) bit count */
178 
179  if (BitCount == 0)
180  {
182  "Attempt to CreateField of length zero"));
184  goto Cleanup;
185  }
186  break;
187 
189 
190  /* Offset is in bits, Field is one bit */
191 
192  BitOffset = Offset;
193  BitCount = 1;
194  FieldFlags = AML_FIELD_ACCESS_BYTE;
195  break;
196 
198 
199  /* Offset is in bytes, field is one byte */
200 
201  BitOffset = 8 * Offset;
202  BitCount = 8;
203  FieldFlags = AML_FIELD_ACCESS_BYTE;
204  break;
205 
207 
208  /* Offset is in bytes, field is one word */
209 
210  BitOffset = 8 * Offset;
211  BitCount = 16;
212  FieldFlags = AML_FIELD_ACCESS_WORD;
213  break;
214 
216 
217  /* Offset is in bytes, field is one dword */
218 
219  BitOffset = 8 * Offset;
220  BitCount = 32;
221  FieldFlags = AML_FIELD_ACCESS_DWORD;
222  break;
223 
225 
226  /* Offset is in bytes, field is one qword */
227 
228  BitOffset = 8 * Offset;
229  BitCount = 64;
230  FieldFlags = AML_FIELD_ACCESS_QWORD;
231  break;
232 
233  default:
234 
236  "Unknown field creation opcode 0x%02X",
237  AmlOpcode));
239  goto Cleanup;
240  }
241 
242  /* Entire field must fit within the current length of the buffer */
243 
244  if ((BitOffset + BitCount) >
245  (8 * (UINT32) BufferDesc->Buffer.Length))
246  {
249  "Field [%4.4s] at bit offset/length %u/%u "
250  "exceeds size of target Buffer (%u bits)",
251  AcpiUtGetNodeName (ResultDesc), BitOffset, BitCount,
252  8 * (UINT32) BufferDesc->Buffer.Length));
253  goto Cleanup;
254  }
255 
256  /*
257  * Initialize areas of the field object that are common to all fields
258  * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK),
259  * UPDATE_RULE = 0 (UPDATE_PRESERVE)
260  */
262  ObjDesc, FieldFlags, 0, BitOffset, BitCount);
263  if (ACPI_FAILURE (Status))
264  {
265  goto Cleanup;
266  }
267 
268  ObjDesc->BufferField.BufferObj = BufferDesc;
269  ObjDesc->BufferField.IsCreateField = AmlOpcode == AML_CREATE_FIELD_OP;
270 
271  /* Reference count for BufferDesc inherits ObjDesc count */
272 
273  BufferDesc->Common.ReferenceCount = (UINT16)
274  (BufferDesc->Common.ReferenceCount + ObjDesc->Common.ReferenceCount);
275 
276 
277 Cleanup:
278 
279  /* Always delete the operands */
280 
281  AcpiUtRemoveReference (OffsetDesc);
282  AcpiUtRemoveReference (BufferDesc);
283 
284  if (AmlOpcode == AML_CREATE_FIELD_OP)
285  {
286  AcpiUtRemoveReference (LengthDesc);
287  }
288 
289  /* On failure, delete the result descriptor */
290 
291  if (ACPI_FAILURE (Status))
292  {
293  AcpiUtRemoveReference (ResultDesc); /* Result descriptor */
294  }
295  else
296  {
297  /* Now the address and length are valid for this BufferField */
298 
299  ObjDesc->BufferField.Flags |= AOPOBJ_DATA_VALID;
300  }
301 
303 }
#define AE_AML_BUFFER_LIMIT
Definition: acexcep.h:189
const char * AcpiUtGetDescriptorName(void *Object)
Definition: utdecode.c:382
const char * AcpiPsGetOpcodeName(UINT16 Opcode)
Definition: psopinfo.c:169
#define AML_CREATE_WORD_FIELD_OP
Definition: amlcode.h:115
#define AML_CREATE_BYTE_FIELD_OP
Definition: amlcode.h:116
#define ACPI_TYPE_BUFFER
Definition: actypes.h:682
#define AE_AML_OPERAND_VALUE
Definition: acexcep.h:183
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO BOOLEAN IsCreateField
Definition: acobject.h:384
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
ACPI_STATUS AcpiExPrepCommonFieldObject(ACPI_OPERAND_OBJECT *ObjDesc, UINT8 FieldFlags, UINT8 FieldAttribute, UINT32 FieldBitPosition, UINT32 FieldBitLength)
Definition: exprep.c:347
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
unsigned int UINT32
#define AML_CREATE_FIELD_OP
Definition: amlcode.h:163
#define AE_INFO
Definition: acoutput.h:230
#define AE_AML_BAD_OPCODE
Definition: acexcep.h:180
#define ACPI_BIOS_ERROR(plist)
Definition: acoutput.h:243
switch(r->id)
Definition: btrfs.c:2980
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:520
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define ACPI_BIOS_EXCEPTION(plist)
Definition: acoutput.h:242
Status
Definition: gdiplustypes.h:24
#define AML_CREATE_BIT_FIELD_OP
Definition: amlcode.h:117
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:518
union acpi_operand_object * BufferObj
Definition: acobject.h:385
static const WCHAR Cleanup[]
Definition: register.c:80
#define AML_CREATE_QWORD_FIELD_OP
Definition: amlcode.h:119
#define AML_CREATE_DWORD_FIELD_OP
Definition: amlcode.h:114
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_OBJECT_COMMON Common
Definition: acobject.h:517
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:781
unsigned short UINT16
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:306
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
ACPI_OBJECT_BUFFER_FIELD BufferField
Definition: acobject.h:533
#define ACPI_DESC_TYPE_NAMED
Definition: acobject.h:575
unsigned char UINT8
const char * AcpiUtGetObjectTypeName(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: utdecode.c:264
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414

Referenced by AcpiDsEvalBufferFieldOperands().

◆ AcpiDsInitializeRegion()

ACPI_STATUS AcpiDsInitializeRegion ( ACPI_HANDLE  ObjHandle)

Definition at line 82 of file dsopcode.c.

84 {
85  ACPI_OPERAND_OBJECT *ObjDesc;
87 
88 
89  ObjDesc = AcpiNsGetAttachedObject (ObjHandle);
90 
91  /* Namespace is NOT locked */
92 
93  Status = AcpiEvInitializeRegion (ObjDesc);
94  return (Status);
95 }
ACPI_STATUS AcpiEvInitializeRegion(ACPI_OPERAND_OBJECT *RegionObj)
Definition: evrgnini.c:571
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
Status
Definition: gdiplustypes.h:24

Referenced by AcpiDsInitOneObject().