ReactOS  0.4.14-dev-1279-gc1464a4
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 734 of file dsfield.c.

738 {
740  ACPI_PARSE_OBJECT *Arg;
742 
743 
744  ACPI_FUNCTION_TRACE_PTR (DsCreateBankField, Op);
745 
746 
747  /* First arg is the name of the parent OpRegion (must already exist) */
748 
749  Arg = Op->Common.Value.Arg;
750  if (!RegionNode)
751  {
752  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name,
754  ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
755 #ifdef ACPI_ASL_COMPILER
756  Status = AcpiDsCreateExternalRegion (Status, Arg,
757  Arg->Common.Value.Name, WalkState, &RegionNode);
758 #endif
759  if (ACPI_FAILURE (Status))
760  {
761  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
762  Arg->Common.Value.Name, Status);
764  }
765  }
766 
767  /* Second arg is the Bank Register (Field) (must already exist) */
768 
769  Arg = Arg->Common.Next;
770  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
772  ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
773  if (ACPI_FAILURE (Status))
774  {
775  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
776  Arg->Common.Value.String, Status);
778  }
779 
780  /*
781  * Third arg is the BankValue
782  * This arg is a TermArg, not a constant
783  * It will be evaluated later, by AcpiDsEvalBankFieldOperands
784  */
785  Arg = Arg->Common.Next;
786 
787  /* Fourth arg is the field flags */
788 
789  Arg = Arg->Common.Next;
790  Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
791 
792  /* Each remaining arg is a Named Field */
793 
794  Info.FieldType = ACPI_TYPE_LOCAL_BANK_FIELD;
795  Info.RegionNode = RegionNode;
796 
797  /*
798  * Use Info.DataRegisterNode to store BankField Op
799  * It's safe because DataRegisterNode will never be used when create
800  * bank field \we store AmlStart and AmlLength in the BankField Op for
801  * late evaluation. Used in AcpiExPrepFieldValue(Info)
802  *
803  * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like
804  * "void *ParentOp"?
805  */
806  Info.DataRegisterNode = (ACPI_NAMESPACE_NODE*) Op;
807 
808  Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
810 }
#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:319
#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:679
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_TYPE_REGION
Definition: actypes.h:689
#define ACPI_TYPE_LOCAL_BANK_FIELD
Definition: actypes.h:709
#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  }
205  else
206  {
207  /* Execute flag should always be set when this function is entered */
208 
209  if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE))
210  {
212  "Parse execute mode is not set"));
214  }
215 
216  /* Creating new namespace node, should not already exist */
217 
220 
221  /*
222  * Mark node temporary if we are executing a normal control
223  * method. (Don't mark if this is a module-level code method)
224  */
225  if (WalkState->MethodNode &&
226  !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
227  {
229  }
230 
231  /* Enter the NameString into the namespace */
232 
233  Status = AcpiNsLookup (WalkState->ScopeInfo,
234  Arg->Common.Value.String, ACPI_TYPE_ANY,
235  ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
236  if (ACPI_FAILURE (Status))
237  {
238  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
239  Arg->Common.Value.String, Status);
241  }
242  }
243 
244  /*
245  * We could put the returned object (Node) on the object stack for later,
246  * but for now, we will put it in the "op" object that the parser uses,
247  * so we can get it again at the end of this scope.
248  */
249  Op->Common.Node = Node;
250 
251  /*
252  * If there is no object attached to the node, this node was just created
253  * and we need to create the field object. Otherwise, this was a lookup
254  * of an existing node and we don't want to create the field object again.
255  */
256  ObjDesc = AcpiNsGetAttachedObject (Node);
257  if (ObjDesc)
258  {
260  }
261 
262  /*
263  * The Field definition is not fully parsed at this time.
264  * (We must save the address of the AML for the buffer and index operands)
265  */
266 
267  /* Create the buffer field object */
268 
270  if (!ObjDesc)
271  {
273  goto Cleanup;
274  }
275 
276  /*
277  * Remember location in AML stream of the field unit opcode and operands
278  * -- since the buffer and index operands must be evaluated.
279  */
280  SecondDesc = ObjDesc->Common.NextObject;
281  SecondDesc->Extra.AmlStart = Op->Named.Data;
282  SecondDesc->Extra.AmlLength = Op->Named.Length;
283  ObjDesc->BufferField.Node = Node;
284 
285  /* Attach constructed field descriptors to parent node */
286 
288  if (ACPI_FAILURE (Status))
289  {
290  goto Cleanup;
291  }
292 
293 
294 Cleanup:
295 
296  /* Remove local reference to the object */
297 
298  AcpiUtRemoveReference (ObjDesc);
300 }
#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:482
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:539
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:679
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:693
ACPI_OBJECT_COMMON Common
Definition: acobject.h:517
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:655
ACPI_OBJECT_BUFFER_FIELD BufferField
Definition: acobject.h:533
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
#define AE_OK
Definition: acexcep.h:97
UINT32 AmlLength
Definition: acobject.h:483
Definition: dlist.c:348

Referenced by AcpiDsLoad1EndOp(), and AcpiDsLoad2EndOp().

◆ AcpiDsCreateField()

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

Definition at line 529 of file dsfield.c.

533 {
535  ACPI_PARSE_OBJECT *Arg;
537 
538 
539  ACPI_FUNCTION_TRACE_PTR (DsCreateField, Op);
540 
541 
542  /* First arg is the name of the parent OpRegion (must already exist) */
543 
544  Arg = Op->Common.Value.Arg;
545 
546  if (!RegionNode)
547  {
548  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name,
550  ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
551 #ifdef ACPI_ASL_COMPILER
552  Status = AcpiDsCreateExternalRegion (Status, Arg,
553  Arg->Common.Value.Name, WalkState, &RegionNode);
554 #endif
555  if (ACPI_FAILURE (Status))
556  {
557  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
558  Arg->Common.Value.Name, Status);
560  }
561  }
562 
563  memset (&Info, 0, sizeof (ACPI_CREATE_FIELD_INFO));
564 
565  /* Second arg is the field flags */
566 
567  Arg = Arg->Common.Next;
568  Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
569  Info.Attribute = 0;
570 
571  /* Each remaining arg is a Named Field */
572 
574  Info.RegionNode = RegionNode;
575 
576  Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
577  if (Info.RegionNode->Object->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_COMM &&
578  !(RegionNode->Object->Field.InternalPccBuffer
579  = ACPI_ALLOCATE_ZEROED(Info.RegionNode->Object->Region.Length)))
580  {
582  }
584 }
#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:862
static ACPI_STATUS AcpiDsGetFieldNames(ACPI_CREATE_FIELD_INFO *Info, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg)
Definition: dsfield.c:319
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_TYPE_LOCAL_REGION_FIELD
Definition: actypes.h:708
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:532
#define ACPI_TYPE_REGION
Definition: actypes.h:689
#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 828 of file dsfield.c.

832 {
834  ACPI_PARSE_OBJECT *Arg;
836 
837 
838  ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField, Op);
839 
840 
841  /* First arg is the name of the Index register (must already exist) */
842 
843  Arg = Op->Common.Value.Arg;
844  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
846  ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
847  if (ACPI_FAILURE (Status))
848  {
849  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
850  Arg->Common.Value.String, Status);
852  }
853 
854  /* Second arg is the data register (must already exist) */
855 
856  Arg = Arg->Common.Next;
857  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
859  ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode);
860  if (ACPI_FAILURE (Status))
861  {
862  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
863  Arg->Common.Value.String, Status);
865  }
866 
867  /* Next arg is the field flags */
868 
869  Arg = Arg->Common.Next;
870  Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
871 
872  /* Each remaining arg is a Named Field */
873 
874  Info.FieldType = ACPI_TYPE_LOCAL_INDEX_FIELD;
875  Info.RegionNode = RegionNode;
876 
877  Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
879 }
#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:710
#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:319
#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:679
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 319 of file dsfield.c.

323 {
327 
328 #ifdef ACPI_EXEC_APP
329  ACPI_OPERAND_OBJECT *ResultDesc;
330  ACPI_OPERAND_OBJECT *ObjDesc;
331  char *NamePath;
332 #endif
333 
334 
335  ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info);
336 
337 
338  /* First field starts at bit zero */
339 
340  Info->FieldBitPosition = 0;
341 
342  /* Process all elements in the field list (of parse nodes) */
343 
344  while (Arg)
345  {
346  /*
347  * Four types of field elements are handled:
348  * 1) Name - Enters a new named field into the namespace
349  * 2) Offset - specifies a bit offset
350  * 3) AccessAs - changes the access mode/attributes
351  * 4) Connection - Associate a resource template with the field
352  */
353  switch (Arg->Common.AmlOpcode)
354  {
356 
357  Position = (UINT64) Info->FieldBitPosition +
358  (UINT64) Arg->Common.Value.Size;
359 
361  {
363  "Bit offset within field too large (> 0xFFFFFFFF)"));
365  }
366 
367  Info->FieldBitPosition = (UINT32) Position;
368  break;
369 
372  /*
373  * Get new AccessType, AccessAttribute, and AccessLength fields
374  * -- to be used for all field units that follow, until the
375  * end-of-field or another AccessAs keyword is encountered.
376  * NOTE. These three bytes are encoded in the integer value
377  * of the parseop for convenience.
378  *
379  * In FieldFlags, preserve the flag bits other than the
380  * ACCESS_TYPE bits.
381  */
382 
383  /* AccessType (ByteAcc, WordAcc, etc.) */
384 
385  Info->FieldFlags = (UINT8)
386  ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
387  ((UINT8) ((UINT32) (Arg->Common.Value.Integer & 0x07))));
388 
389  /* AccessAttribute (AttribQuick, AttribByte, etc.) */
390 
391  Info->Attribute = (UINT8)
392  ((Arg->Common.Value.Integer >> 8) & 0xFF);
393 
394  /* AccessLength (for serial/buffer protocols) */
395 
396  Info->AccessLength = (UINT8)
397  ((Arg->Common.Value.Integer >> 16) & 0xFF);
398  break;
399 
401  /*
402  * Clear any previous connection. New connection is used for all
403  * fields that follow, similar to AccessAs
404  */
405  Info->ResourceBuffer = NULL;
406  Info->ConnectionNode = NULL;
407  Info->PinNumberIndex = 0;
408 
409  /*
410  * A Connection() is either an actual resource descriptor (buffer)
411  * or a named reference to a resource template
412  */
413  Child = Arg->Common.Value.Arg;
414  if (Child->Common.AmlOpcode == AML_INT_BYTELIST_OP)
415  {
416  Info->ResourceBuffer = Child->Named.Data;
417  Info->ResourceLength = (UINT16) Child->Named.Value.Integer;
418  }
419  else
420  {
421  /* Lookup the Connection() namepath, it should already exist */
422 
423  Status = AcpiNsLookup (WalkState->ScopeInfo,
424  Child->Common.Value.Name, ACPI_TYPE_ANY,
426  WalkState, &Info->ConnectionNode);
427  if (ACPI_FAILURE (Status))
428  {
429  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
430  Child->Common.Value.Name, Status);
432  }
433  }
434  break;
435 
437 
438  /* Lookup the name, it should already exist */
439 
440  Status = AcpiNsLookup (WalkState->ScopeInfo,
441  (char *) &Arg->Named.Name, Info->FieldType,
443  WalkState, &Info->FieldNode);
444  if (ACPI_FAILURE (Status))
445  {
446  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
447  (char *) &Arg->Named.Name, Status);
449  }
450  else
451  {
452  Arg->Common.Node = Info->FieldNode;
453  Info->FieldBitLength = Arg->Common.Value.Size;
454 
455  /*
456  * If there is no object attached to the node, this node was
457  * just created and we need to create the field object.
458  * Otherwise, this was a lookup of an existing node and we
459  * don't want to create the field object again.
460  */
461  if (!AcpiNsGetAttachedObject (Info->FieldNode))
462  {
464  if (ACPI_FAILURE (Status))
465  {
467  }
468 #ifdef ACPI_EXEC_APP
469  NamePath = AcpiNsGetExternalPathname (Info->FieldNode);
470  if (ACPI_SUCCESS (AeLookupInitFileEntry (NamePath, &ObjDesc)))
471  {
472  AcpiExWriteDataToField (ObjDesc,
473  AcpiNsGetAttachedObject (Info->FieldNode),
474  &ResultDesc);
475  AcpiUtRemoveReference (ObjDesc);
476  }
477  ACPI_FREE (NamePath);
478 #endif
479  }
480  }
481 
482  /* Keep track of bit position for the next field */
483 
484  Position = (UINT64) Info->FieldBitPosition +
485  (UINT64) Arg->Common.Value.Size;
486 
488  {
490  "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
491  ACPI_CAST_PTR (char, &Info->FieldNode->Name)));
493  }
494 
495  Info->FieldBitPosition += Info->FieldBitLength;
496  Info->PinNumberIndex++; /* Index relative to previous Connection() */
497  break;
498 
499  default:
500 
502  "Invalid opcode in field list: 0x%X",
503  Arg->Common.AmlOpcode));
505  }
506 
507  Arg = Arg->Common.Next;
508  }
509 
511 }
#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:315
#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
#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:679
#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:728
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 603 of file dsfield.c.

606 {
608  ACPI_PARSE_OBJECT *Arg = NULL;
610  UINT8 Type = 0;
611  UINT32 Flags;
612 
613 
614  ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects, Op);
615 
616 
617  /* Execute flag should always be set when this function is entered */
618 
619  if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE))
620  {
621  if (WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP)
622  {
623  /* BankField Op is deferred, just return OK */
624 
626  }
627 
629  "Parse deferred mode is not set"));
631  }
632 
633  /*
634  * Get the FieldList argument for this opcode. This is the start of the
635  * list of field elements.
636  */
637  switch (WalkState->Opcode)
638  {
639  case AML_FIELD_OP:
640 
641  Arg = AcpiPsGetArg (Op, 2);
643  break;
644 
645  case AML_BANK_FIELD_OP:
646 
647  Arg = AcpiPsGetArg (Op, 4);
649  break;
650 
651  case AML_INDEX_FIELD_OP:
652 
653  Arg = AcpiPsGetArg (Op, 3);
655  break;
656 
657  default:
658 
660  }
661 
662  /* Creating new namespace node(s), should not already exist */
663 
666 
667  /*
668  * Mark node(s) temporary if we are executing a normal control
669  * method. (Don't mark if this is a module-level code method)
670  */
671  if (WalkState->MethodNode &&
672  !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
673  {
675  }
676 
677 #ifdef ACPI_EXEC_APP
679 #endif
680  /*
681  * Walk the list of entries in the FieldList
682  * Note: FieldList can be of zero length. In this case, Arg will be NULL.
683  */
684  while (Arg)
685  {
686  /*
687  * Ignore OFFSET/ACCESSAS/CONNECTION terms here; we are only interested
688  * in the field names in order to enter them into the namespace.
689  */
690  if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
691  {
692  Status = AcpiNsLookup (WalkState->ScopeInfo,
693  (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1,
694  Flags, WalkState, &Node);
695  if (ACPI_FAILURE (Status))
696  {
697  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
698  (char *) &Arg->Named.Name, Status);
699  if (Status != AE_ALREADY_EXISTS)
700  {
702  }
703 
704  /* Name already exists, just ignore this error */
705  }
706 
707  Arg->Common.Node = Node;
708  }
709 
710  /* Get the next field element in the list */
711 
712  Arg = Arg->Common.Next;
713  }
714 
716 }
#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:710
_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:708
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:709
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().