ReactOS  0.4.14-dev-317-g96040ec
dsfield.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "acparser.h"
Include dependency graph for dsfield.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_DISPATCHER
 

Functions

static ACPI_STATUS AcpiDsGetFieldNames (ACPI_CREATE_FIELD_INFO *Info, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg)
 
ACPI_STATUS AcpiDsCreateBufferField (ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsCreateField (ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *RegionNode, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsInitFieldObjects (ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsCreateBankField (ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *RegionNode, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsCreateIndexField (ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *RegionNode, ACPI_WALK_STATE *WalkState)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_DISPATCHER

Definition at line 57 of file dsfield.c.

Function Documentation

◆ AcpiDsCreateBankField()

ACPI_STATUS AcpiDsCreateBankField ( ACPI_PARSE_OBJECT Op,
ACPI_NAMESPACE_NODE RegionNode,
ACPI_WALK_STATE WalkState 
)

Definition at line 739 of file dsfield.c.

743 {
745  ACPI_PARSE_OBJECT *Arg;
747 
748 
749  ACPI_FUNCTION_TRACE_PTR (DsCreateBankField, Op);
750 
751 
752  /* First arg is the name of the parent OpRegion (must already exist) */
753 
754  Arg = Op->Common.Value.Arg;
755  if (!RegionNode)
756  {
757  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name,
759  ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
760 #ifdef ACPI_ASL_COMPILER
761  Status = AcpiDsCreateExternalRegion (Status, Arg,
762  Arg->Common.Value.Name, WalkState, &RegionNode);
763 #endif
764  if (ACPI_FAILURE (Status))
765  {
766  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
767  Arg->Common.Value.Name, Status);
769  }
770  }
771 
772  /* Second arg is the Bank Register (Field) (must already exist) */
773 
774  Arg = Arg->Common.Next;
775  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
777  ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
778  if (ACPI_FAILURE (Status))
779  {
780  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
781  Arg->Common.Value.String, Status);
783  }
784 
785  /*
786  * Third arg is the BankValue
787  * This arg is a TermArg, not a constant
788  * It will be evaluated later, by AcpiDsEvalBankFieldOperands
789  */
790  Arg = Arg->Common.Next;
791 
792  /* Fourth arg is the field flags */
793 
794  Arg = Arg->Common.Next;
795  Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
796 
797  /* Each remaining arg is a Named Field */
798 
799  Info.FieldType = ACPI_TYPE_LOCAL_BANK_FIELD;
800  Info.RegionNode = RegionNode;
801 
802  /*
803  * Use Info.DataRegisterNode to store BankField Op
804  * It's safe because DataRegisterNode will never be used when create
805  * bank field \we store AmlStart and AmlLength in the BankField Op for
806  * late evaluation. Used in AcpiExPrepFieldValue(Info)
807  *
808  * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like
809  * "void *ParentOp"?
810  */
811  Info.DataRegisterNode = (ACPI_NAMESPACE_NODE*) Op;
812 
813  Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
815 }
#define ACPI_NS_SEARCH_PARENT
Definition: acnamesp.h:63
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:329
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
static ACPI_STATUS AcpiDsGetFieldNames(ACPI_CREATE_FIELD_INFO *Info, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg)
Definition: dsfield.c:320
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
#define ACPI_TYPE_ANY
Definition: actypes.h:678
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_TYPE_REGION
Definition: actypes.h:688
#define ACPI_TYPE_LOCAL_BANK_FIELD
Definition: actypes.h:708
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
unsigned char UINT8

Referenced by AcpiDsLoad2EndOp().

◆ AcpiDsCreateBufferField()

ACPI_STATUS AcpiDsCreateBufferField ( ACPI_PARSE_OBJECT Op,
ACPI_WALK_STATE WalkState 
)

Definition at line 165 of file dsfield.c.

168 {
169  ACPI_PARSE_OBJECT *Arg;
172  ACPI_OPERAND_OBJECT *ObjDesc;
173  ACPI_OPERAND_OBJECT *SecondDesc = NULL;
174  UINT32 Flags;
175 
176 
177  ACPI_FUNCTION_TRACE (DsCreateBufferField);
178 
179 
180  /*
181  * Get the NameString argument (name of the new BufferField)
182  */
183  if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
184  {
185  /* For CreateField, name is the 4th argument */
186 
187  Arg = AcpiPsGetArg (Op, 3);
188  }
189  else
190  {
191  /* For all other CreateXXXField operators, name is the 3rd argument */
192 
193  Arg = AcpiPsGetArg (Op, 2);
194  }
195 
196  if (!Arg)
197  {
199  }
200 
201  if (WalkState->DeferredNode)
202  {
203  Node = WalkState->DeferredNode;
204  Status = AE_OK;
205  }
206  else
207  {
208  /* Execute flag should always be set when this function is entered */
209 
210  if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE))
211  {
213  "Parse execute mode is not set"));
215  }
216 
217  /* Creating new namespace node, should not already exist */
218 
221 
222  /*
223  * Mark node temporary if we are executing a normal control
224  * method. (Don't mark if this is a module-level code method)
225  */
226  if (WalkState->MethodNode &&
227  !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
228  {
230  }
231 
232  /* Enter the NameString into the namespace */
233 
234  Status = AcpiNsLookup (WalkState->ScopeInfo,
235  Arg->Common.Value.String, ACPI_TYPE_ANY,
236  ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
237  if (ACPI_FAILURE (Status))
238  {
239  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
240  Arg->Common.Value.String, Status);
242  }
243  }
244 
245  /*
246  * We could put the returned object (Node) on the object stack for later,
247  * but for now, we will put it in the "op" object that the parser uses,
248  * so we can get it again at the end of this scope.
249  */
250  Op->Common.Node = Node;
251 
252  /*
253  * If there is no object attached to the node, this node was just created
254  * and we need to create the field object. Otherwise, this was a lookup
255  * of an existing node and we don't want to create the field object again.
256  */
257  ObjDesc = AcpiNsGetAttachedObject (Node);
258  if (ObjDesc)
259  {
261  }
262 
263  /*
264  * The Field definition is not fully parsed at this time.
265  * (We must save the address of the AML for the buffer and index operands)
266  */
267 
268  /* Create the buffer field object */
269 
271  if (!ObjDesc)
272  {
274  goto Cleanup;
275  }
276 
277  /*
278  * Remember location in AML stream of the field unit opcode and operands
279  * -- since the buffer and index operands must be evaluated.
280  */
281  SecondDesc = ObjDesc->Common.NextObject;
282  SecondDesc->Extra.AmlStart = Op->Named.Data;
283  SecondDesc->Extra.AmlLength = Op->Named.Length;
284  ObjDesc->BufferField.Node = Node;
285 
286  /* Attach constructed field descriptors to parent node */
287 
289  if (ACPI_FAILURE (Status))
290  {
291  goto Cleanup;
292  }
293 
294 
295 Cleanup:
296 
297  /* Remove local reference to the object */
298 
299  AcpiUtRemoveReference (ObjDesc);
301 }
#define ACPI_NS_TEMPORARY
Definition: acnamesp.h:69
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:329
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_AML_INTERNAL
Definition: acexcep.h:194
#define AE_AML_NO_OPERAND
Definition: acexcep.h:181
struct acpi_namespace_node * DeferredNode
Definition: acstruct.h:111
#define ACPI_NS_ERROR_IF_FOUND
Definition: acnamesp.h:66
UINT8 * AmlStart
Definition: acobject.h:481
UINT32 ParseFlags
Definition: acstruct.h:95
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_PARSE_EXECUTE
Definition: acparser.h:61
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_OBJECT_EXTRA Extra
Definition: acobject.h:538
unsigned int UINT32
union node Node
Definition: types.h:1255
#define ACPI_NS_DONT_OPEN_SCOPE
Definition: acnamesp.h:64
#define AML_CREATE_FIELD_OP
Definition: amlcode.h:163
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
ACPI_PARSE_OBJ_NAMED Named
Definition: aclocal.h:1079
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
#define ACPI_TYPE_ANY
Definition: actypes.h:678
static const WCHAR Cleanup[]
Definition: register.c:80
struct acpi_namespace_node * MethodNode
Definition: acstruct.h:116
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiNsAttachObject(ACPI_NAMESPACE_NODE *Node, ACPI_OPERAND_OBJECT *Object, ACPI_OBJECT_TYPE Type)
Definition: nsobject.c:76
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_NS_NO_UPSEARCH
Definition: acnamesp.h:62
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_PARSE_MODULE_LEVEL
Definition: acparser.h:67
#define ACPI_TYPE_BUFFER_FIELD
Definition: actypes.h:692
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
ACPI_PARSE_OBJECT * AcpiPsGetArg(ACPI_PARSE_OBJECT *op, UINT32 argn)
Definition: pstree.c:76
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:654
ACPI_OBJECT_BUFFER_FIELD BufferField
Definition: acobject.h:532
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
#define AE_OK
Definition: acexcep.h:97
UINT32 AmlLength
Definition: acobject.h:482
Definition: dlist.c:348

Referenced by AcpiDsLoad2EndOp().

◆ AcpiDsCreateField()

ACPI_STATUS AcpiDsCreateField ( ACPI_PARSE_OBJECT Op,
ACPI_NAMESPACE_NODE RegionNode,
ACPI_WALK_STATE WalkState 
)

Definition at line 532 of file dsfield.c.

536 {
538  ACPI_PARSE_OBJECT *Arg;
540 
541 
542  ACPI_FUNCTION_TRACE_PTR (DsCreateField, Op);
543 
544 
545  /* First arg is the name of the parent OpRegion (must already exist) */
546 
547  Arg = Op->Common.Value.Arg;
548 
549  if (!RegionNode)
550  {
551  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name,
553  ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
554 #ifdef ACPI_ASL_COMPILER
555  Status = AcpiDsCreateExternalRegion (Status, Arg,
556  Arg->Common.Value.Name, WalkState, &RegionNode);
557 #endif
558  if (ACPI_FAILURE (Status))
559  {
560  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
561  Arg->Common.Value.Name, Status);
563  }
564  }
565 
566  memset (&Info, 0, sizeof (ACPI_CREATE_FIELD_INFO));
567 
568  /* Second arg is the field flags */
569 
570  Arg = Arg->Common.Next;
571  Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
572  Info.Attribute = 0;
573 
574  /* Each remaining arg is a Named Field */
575 
577  Info.RegionNode = RegionNode;
578 
579  Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
580  if (Info.RegionNode->Object->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_COMM &&
581  !(RegionNode->Object->Field.InternalPccBuffer
582  = ACPI_ALLOCATE_ZEROED(Info.RegionNode->Object->Region.Length)))
583  {
585  }
587 }
#define ACPI_NS_SEARCH_PARENT
Definition: acnamesp.h:63
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
union acpi_operand_object * Object
Definition: aclocal.h:187
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:329
#define AE_NO_MEMORY
Definition: acexcep.h:112
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_ADR_SPACE_PLATFORM_COMM
Definition: actypes.h:861
static ACPI_STATUS AcpiDsGetFieldNames(ACPI_CREATE_FIELD_INFO *Info, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg)
Definition: dsfield.c:320
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_TYPE_LOCAL_REGION_FIELD
Definition: actypes.h:707
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_OBJECT_REGION_FIELD Field
Definition: acobject.h:531
#define ACPI_TYPE_REGION
Definition: actypes.h:688
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
unsigned char UINT8
#define memset(x, y, z)
Definition: compat.h:39

Referenced by AcpiDsLoad2EndOp().

◆ AcpiDsCreateIndexField()

ACPI_STATUS AcpiDsCreateIndexField ( ACPI_PARSE_OBJECT Op,
ACPI_NAMESPACE_NODE RegionNode,
ACPI_WALK_STATE WalkState 
)

Definition at line 833 of file dsfield.c.

837 {
839  ACPI_PARSE_OBJECT *Arg;
841 
842 
843  ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField, Op);
844 
845 
846  /* First arg is the name of the Index register (must already exist) */
847 
848  Arg = Op->Common.Value.Arg;
849  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
851  ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
852  if (ACPI_FAILURE (Status))
853  {
854  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
855  Arg->Common.Value.String, Status);
857  }
858 
859  /* Second arg is the data register (must already exist) */
860 
861  Arg = Arg->Common.Next;
862  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
864  ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode);
865  if (ACPI_FAILURE (Status))
866  {
867  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
868  Arg->Common.Value.String, Status);
870  }
871 
872  /* Next arg is the field flags */
873 
874  Arg = Arg->Common.Next;
875  Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
876 
877  /* Each remaining arg is a Named Field */
878 
879  Info.FieldType = ACPI_TYPE_LOCAL_INDEX_FIELD;
880  Info.RegionNode = RegionNode;
881 
882  Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
884 }
#define ACPI_NS_SEARCH_PARENT
Definition: acnamesp.h:63
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:329
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_TYPE_LOCAL_INDEX_FIELD
Definition: actypes.h:709
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
static ACPI_STATUS AcpiDsGetFieldNames(ACPI_CREATE_FIELD_INFO *Info, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg)
Definition: dsfield.c:320
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
#define ACPI_TYPE_ANY
Definition: actypes.h:678
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
unsigned char UINT8

Referenced by AcpiDsLoad2EndOp().

◆ AcpiDsGetFieldNames()

static ACPI_STATUS AcpiDsGetFieldNames ( ACPI_CREATE_FIELD_INFO Info,
ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Arg 
)
static

Definition at line 320 of file dsfield.c.

324 {
328 
329 #ifdef ACPI_EXEC_APP
330  UINT64 Value = 0;
331  ACPI_OPERAND_OBJECT *ResultDesc;
332  ACPI_OPERAND_OBJECT *ObjDesc;
333  char *NamePath;
334 #endif
335 
336 
337  ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info);
338 
339 
340  /* First field starts at bit zero */
341 
342  Info->FieldBitPosition = 0;
343 
344  /* Process all elements in the field list (of parse nodes) */
345 
346  while (Arg)
347  {
348  /*
349  * Four types of field elements are handled:
350  * 1) Name - Enters a new named field into the namespace
351  * 2) Offset - specifies a bit offset
352  * 3) AccessAs - changes the access mode/attributes
353  * 4) Connection - Associate a resource template with the field
354  */
355  switch (Arg->Common.AmlOpcode)
356  {
358 
359  Position = (UINT64) Info->FieldBitPosition +
360  (UINT64) Arg->Common.Value.Size;
361 
363  {
365  "Bit offset within field too large (> 0xFFFFFFFF)"));
367  }
368 
369  Info->FieldBitPosition = (UINT32) Position;
370  break;
371 
374  /*
375  * Get new AccessType, AccessAttribute, and AccessLength fields
376  * -- to be used for all field units that follow, until the
377  * end-of-field or another AccessAs keyword is encountered.
378  * NOTE. These three bytes are encoded in the integer value
379  * of the parseop for convenience.
380  *
381  * In FieldFlags, preserve the flag bits other than the
382  * ACCESS_TYPE bits.
383  */
384 
385  /* AccessType (ByteAcc, WordAcc, etc.) */
386 
387  Info->FieldFlags = (UINT8)
388  ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
389  ((UINT8) ((UINT32) (Arg->Common.Value.Integer & 0x07))));
390 
391  /* AccessAttribute (AttribQuick, AttribByte, etc.) */
392 
393  Info->Attribute = (UINT8)
394  ((Arg->Common.Value.Integer >> 8) & 0xFF);
395 
396  /* AccessLength (for serial/buffer protocols) */
397 
398  Info->AccessLength = (UINT8)
399  ((Arg->Common.Value.Integer >> 16) & 0xFF);
400  break;
401 
403  /*
404  * Clear any previous connection. New connection is used for all
405  * fields that follow, similar to AccessAs
406  */
407  Info->ResourceBuffer = NULL;
408  Info->ConnectionNode = NULL;
409  Info->PinNumberIndex = 0;
410 
411  /*
412  * A Connection() is either an actual resource descriptor (buffer)
413  * or a named reference to a resource template
414  */
415  Child = Arg->Common.Value.Arg;
416  if (Child->Common.AmlOpcode == AML_INT_BYTELIST_OP)
417  {
418  Info->ResourceBuffer = Child->Named.Data;
419  Info->ResourceLength = (UINT16) Child->Named.Value.Integer;
420  }
421  else
422  {
423  /* Lookup the Connection() namepath, it should already exist */
424 
425  Status = AcpiNsLookup (WalkState->ScopeInfo,
426  Child->Common.Value.Name, ACPI_TYPE_ANY,
428  WalkState, &Info->ConnectionNode);
429  if (ACPI_FAILURE (Status))
430  {
431  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
432  Child->Common.Value.Name, Status);
434  }
435  }
436  break;
437 
439 
440  /* Lookup the name, it should already exist */
441 
442  Status = AcpiNsLookup (WalkState->ScopeInfo,
443  (char *) &Arg->Named.Name, Info->FieldType,
445  WalkState, &Info->FieldNode);
446  if (ACPI_FAILURE (Status))
447  {
448  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
449  (char *) &Arg->Named.Name, Status);
451  }
452  else
453  {
454  Arg->Common.Node = Info->FieldNode;
455  Info->FieldBitLength = Arg->Common.Value.Size;
456 
457  /*
458  * If there is no object attached to the node, this node was
459  * just created and we need to create the field object.
460  * Otherwise, this was a lookup of an existing node and we
461  * don't want to create the field object again.
462  */
463  if (!AcpiNsGetAttachedObject (Info->FieldNode))
464  {
466  if (ACPI_FAILURE (Status))
467  {
469  }
470 #ifdef ACPI_EXEC_APP
471  NamePath = AcpiNsGetExternalPathname (Info->FieldNode);
472  ObjDesc = AcpiUtCreateIntegerObject (Value);
473  if (ACPI_SUCCESS (AeLookupInitFileEntry (NamePath, &Value)))
474  {
475  AcpiExWriteDataToField (ObjDesc,
476  AcpiNsGetAttachedObject (Info->FieldNode),
477  &ResultDesc);
478  }
479  AcpiUtRemoveReference (ObjDesc);
480  ACPI_FREE (NamePath);
481 #endif
482  }
483  }
484 
485  /* Keep track of bit position for the next field */
486 
487  Position = (UINT64) Info->FieldBitPosition +
488  (UINT64) Arg->Common.Value.Size;
489 
491  {
493  "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
494  ACPI_CAST_PTR (char, &Info->FieldNode->Name)));
496  }
497 
498  Info->FieldBitPosition += Info->FieldBitLength;
499  Info->PinNumberIndex++; /* Index relative to previous Connection() */
500  break;
501 
502  default:
503 
505  "Invalid opcode in field list: 0x%X",
506  Arg->Common.AmlOpcode));
508  }
509 
510  Arg = Arg->Common.Next;
511  }
512 
514 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define ACPI_FREE(a)
Definition: actypes.h:386
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
#define AML_INT_ACCESSFIELD_OP
Definition: amlcode.h:208
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:329
static COORD Position
Definition: mouse.c:34
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
unsigned int UINT32
#define ACPI_NS_DONT_OPEN_SCOPE
Definition: acnamesp.h:64
ACPI_STATUS AcpiExWriteDataToField(ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc)
Definition: exfield.c:309
#define AML_INT_EXTACCESSFIELD_OP
Definition: amlcode.h:214
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
#define AE_AML_BAD_OPCODE
Definition: acexcep.h:180
ACPI_STATUS AcpiExPrepFieldValue(ACPI_CREATE_FIELD_INFO *Info)
Definition: exprep.c:438
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_PARSE_OBJ_NAMED Named
Definition: aclocal.h:1079
char * AcpiNsGetExternalPathname(ACPI_NAMESPACE_NODE *Node)
Definition: nsnames.c:76
#define ACPI_UINT32_MAX
Definition: actypes.h:66
ACPI_OPERAND_OBJECT * AcpiUtCreateIntegerObject(UINT64 Value)
Definition: utobject.c:223
#define AE_SUPPORT
Definition: acexcep.h:123
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
#define ACPI_TYPE_ANY
Definition: actypes.h:678
#define AML_INT_CONNECTION_OP
Definition: amlcode.h:213
#define AML_INT_NAMEDFIELD_OP
Definition: amlcode.h:206
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define AML_INT_RESERVEDFIELD_OP
Definition: amlcode.h:207
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
unsigned short UINT16
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AML_INT_BYTELIST_OP
Definition: amlcode.h:209
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 Child
Definition: acpixf.h:722
unsigned long long UINT64
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97
#define AML_FIELD_ACCESS_TYPE_MASK
Definition: amlcode.h:442

Referenced by AcpiDsCreateBankField(), AcpiDsCreateField(), and AcpiDsCreateIndexField().

◆ AcpiDsInitFieldObjects()

ACPI_STATUS AcpiDsInitFieldObjects ( ACPI_PARSE_OBJECT Op,
ACPI_WALK_STATE WalkState 
)

Definition at line 606 of file dsfield.c.

609 {
611  ACPI_PARSE_OBJECT *Arg = NULL;
613  UINT8 Type = 0;
614  UINT32 Flags;
615 
616 
617  ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects, Op);
618 
619 
620  /* Execute flag should always be set when this function is entered */
621 
622  if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE))
623  {
624  if (WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP)
625  {
626  /* BankField Op is deferred, just return OK */
627 
629  }
630 
632  "Parse deferred mode is not set"));
634  }
635 
636  /*
637  * Get the FieldList argument for this opcode. This is the start of the
638  * list of field elements.
639  */
640  switch (WalkState->Opcode)
641  {
642  case AML_FIELD_OP:
643 
644  Arg = AcpiPsGetArg (Op, 2);
646  break;
647 
648  case AML_BANK_FIELD_OP:
649 
650  Arg = AcpiPsGetArg (Op, 4);
652  break;
653 
654  case AML_INDEX_FIELD_OP:
655 
656  Arg = AcpiPsGetArg (Op, 3);
658  break;
659 
660  default:
661 
663  }
664 
665  /* Creating new namespace node(s), should not already exist */
666 
669 
670  /*
671  * Mark node(s) temporary if we are executing a normal control
672  * method. (Don't mark if this is a module-level code method)
673  */
674  if (WalkState->MethodNode &&
675  !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
676  {
678  }
679 
680 #ifdef ACPI_EXEC_APP
682 #endif
683  /*
684  * Walk the list of entries in the FieldList
685  * Note: FieldList can be of zero length. In this case, Arg will be NULL.
686  */
687  while (Arg)
688  {
689  /*
690  * Ignore OFFSET/ACCESSAS/CONNECTION terms here; we are only interested
691  * in the field names in order to enter them into the namespace.
692  */
693  if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
694  {
695  Status = AcpiNsLookup (WalkState->ScopeInfo,
696  (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1,
697  Flags, WalkState, &Node);
698  if (ACPI_FAILURE (Status))
699  {
700  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
701  (char *) &Arg->Named.Name, Status);
702  if (Status != AE_ALREADY_EXISTS)
703  {
705  }
706 
707  /* Name already exists, just ignore this error */
708 
709  Status = AE_OK;
710  }
711 
712  Arg->Common.Node = Node;
713  }
714 
715  /* Get the next field element in the list */
716 
717  Arg = Arg->Common.Next;
718  }
719 
721 }
#define ACPI_NS_TEMPORARY
Definition: acnamesp.h:69
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:329
Type
Definition: Type.h:6
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define AE_AML_INTERNAL
Definition: acexcep.h:194
#define ACPI_NS_ERROR_IF_FOUND
Definition: acnamesp.h:66
UINT32 ParseFlags
Definition: acstruct.h:95
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_PARSE_EXECUTE
Definition: acparser.h:61
#define ACPI_TYPE_LOCAL_INDEX_FIELD
Definition: actypes.h:709
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
unsigned int UINT32
union node Node
Definition: types.h:1255
#define ACPI_NS_DONT_OPEN_SCOPE
Definition: acnamesp.h:64
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_PARSE_OBJ_NAMED Named
Definition: aclocal.h:1079
#define AML_BANK_FIELD_OP
Definition: amlcode.h:187
#define AE_ALREADY_EXISTS
Definition: acexcep.h:115
#define AML_FIELD_OP
Definition: amlcode.h:181
#define AML_INDEX_FIELD_OP
Definition: amlcode.h:186
#define ACPI_TYPE_LOCAL_REGION_FIELD
Definition: actypes.h:707
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
struct acpi_namespace_node * MethodNode
Definition: acstruct.h:116
#define AML_INT_NAMEDFIELD_OP
Definition: amlcode.h:206
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_NS_NO_UPSEARCH
Definition: acnamesp.h:62
#define ACPI_PARSE_MODULE_LEVEL
Definition: acparser.h:67
#define ACPI_NS_OVERRIDE_IF_FOUND
Definition: acnamesp.h:70
ACPI_PARSE_OBJECT * AcpiPsGetArg(ACPI_PARSE_OBJECT *op, UINT32 argn)
Definition: pstree.c:76
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_TYPE_LOCAL_BANK_FIELD
Definition: actypes.h:708
UINT16 Opcode
Definition: acstruct.h:78
#define ACPI_PARSE_DEFERRED_OP
Definition: acparser.h:64
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97
Definition: dlist.c:348

Referenced by AcpiDsLoad1EndOp(), and AcpiDsLoad2EndOp().