ReactOS  0.4.14-dev-1233-gf5658fd
utobject.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
Include dependency graph for utobject.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_UTILITIES
 

Functions

static ACPI_STATUS AcpiUtGetSimpleObjectSize (ACPI_OPERAND_OBJECT *Obj, ACPI_SIZE *ObjLength)
 
static ACPI_STATUS AcpiUtGetPackageObjectSize (ACPI_OPERAND_OBJECT *Obj, ACPI_SIZE *ObjLength)
 
static ACPI_STATUS AcpiUtGetElementLength (UINT8 ObjectType, ACPI_OPERAND_OBJECT *SourceObject, ACPI_GENERIC_STATE *State, void *Context)
 
ACPI_OPERAND_OBJECTAcpiUtCreateInternalObjectDbg (const char *ModuleName, UINT32 LineNumber, UINT32 ComponentId, ACPI_OBJECT_TYPE Type)
 
ACPI_OPERAND_OBJECTAcpiUtCreatePackageObject (UINT32 Count)
 
ACPI_OPERAND_OBJECTAcpiUtCreateIntegerObject (UINT64 InitialValue)
 
ACPI_OPERAND_OBJECTAcpiUtCreateBufferObject (ACPI_SIZE BufferSize)
 
ACPI_OPERAND_OBJECTAcpiUtCreateStringObject (ACPI_SIZE StringSize)
 
BOOLEAN AcpiUtValidInternalObject (void *Object)
 
voidAcpiUtAllocateObjectDescDbg (const char *ModuleName, UINT32 LineNumber, UINT32 ComponentId)
 
void AcpiUtDeleteObjectDesc (ACPI_OPERAND_OBJECT *Object)
 
ACPI_STATUS AcpiUtGetObjectSize (ACPI_OPERAND_OBJECT *InternalObject, ACPI_SIZE *ObjLength)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_UTILITIES

Definition at line 49 of file utobject.c.

Function Documentation

◆ AcpiUtAllocateObjectDescDbg()

void* AcpiUtAllocateObjectDescDbg ( const char ModuleName,
UINT32  LineNumber,
UINT32  ComponentId 
)

Definition at line 429 of file utobject.c.

433 {
435 
436 
437  ACPI_FUNCTION_TRACE (UtAllocateObjectDescDbg);
438 
439 
440  Object = AcpiOsAcquireObject (AcpiGbl_OperandCache);
441  if (!Object)
442  {
444  "Could not allocate an object descriptor"));
445 
446  return_PTR (NULL);
447  }
448 
449  /* Mark the descriptor type */
450 
452 
453  ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
454  Object, (UINT32) sizeof (ACPI_OPERAND_OBJECT)));
455 
456  return_PTR (Object);
457 }
#define return_PTR(s)
Definition: acoutput.h:497
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1274
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_DESC_TYPE_OPERAND
Definition: acobject.h:574
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
static IUnknown Object
Definition: main.c:512
#define ACPI_SET_DESCRIPTOR_TYPE(d, t)
Definition: acmacros.h:415
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
Definition: acpixf.h:1216
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
void * AcpiOsAcquireObject(ACPI_CACHE_T *Cache)
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_DB_ALLOCATIONS
Definition: acoutput.h:175

Referenced by AcpiUtCreateInternalObjectDbg().

◆ AcpiUtCreateBufferObject()

ACPI_OPERAND_OBJECT* AcpiUtCreateBufferObject ( ACPI_SIZE  BufferSize)

Definition at line 258 of file utobject.c.

260 {
261  ACPI_OPERAND_OBJECT *BufferDesc;
262  UINT8 *Buffer = NULL;
263 
264 
265  ACPI_FUNCTION_TRACE_U32 (UtCreateBufferObject, BufferSize);
266 
267 
268  /* Create a new Buffer object */
269 
271  if (!BufferDesc)
272  {
273  return_PTR (NULL);
274  }
275 
276  /* Create an actual buffer only if size > 0 */
277 
278  if (BufferSize > 0)
279  {
280  /* Allocate the actual buffer */
281 
283  if (!Buffer)
284  {
285  ACPI_ERROR ((AE_INFO, "Could not allocate size %u",
286  (UINT32) BufferSize));
287 
288  AcpiUtRemoveReference (BufferDesc);
289  return_PTR (NULL);
290  }
291  }
292 
293  /* Complete buffer object initialization */
294 
295  BufferDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
296  BufferDesc->Buffer.Pointer = Buffer;
297  BufferDesc->Buffer.Length = (UINT32) BufferSize;
298 
299  /* Return the new buffer descriptor */
300 
301  return_PTR (BufferDesc);
302 }
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define return_PTR(s)
Definition: acoutput.h:497
#define ACPI_TYPE_BUFFER
Definition: actypes.h:682
#define ACPI_FUNCTION_TRACE_U32(a, b)
Definition: acoutput.h:482
unsigned int UINT32
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:520
#define BufferSize
Definition: classpnp.h:419
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:655
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
unsigned char UINT8

Referenced by AcpiExConcatTemplate(), AcpiExConvertToBuffer(), AcpiExDoConcatenate(), AcpiExReadDataFromField(), AcpiExReadSerialBus(), AcpiExWriteSerialBus(), AcpiNsConvertToBuffer(), AcpiNsConvertToResource(), AcpiNsConvertToUnicode(), AcpiNsRepair_FDE(), and AcpiNsRepairNullElement().

◆ AcpiUtCreateIntegerObject()

ACPI_OPERAND_OBJECT* AcpiUtCreateIntegerObject ( UINT64  InitialValue)

Definition at line 223 of file utobject.c.

225 {
226  ACPI_OPERAND_OBJECT *IntegerDesc;
227 
228 
229  ACPI_FUNCTION_TRACE (UtCreateIntegerObject);
230 
231 
232  /* Create and initialize a new integer object */
233 
235  if (!IntegerDesc)
236  {
237  return_PTR (NULL);
238  }
239 
240  IntegerDesc->Integer.Value = InitialValue;
241  return_PTR (IntegerDesc);
242 }
#define return_PTR(s)
Definition: acoutput.h:497
#define ACPI_TYPE_INTEGER
Definition: actypes.h:680
smooth NULL
Definition: ftsmooth.c:416
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:518
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:655

Referenced by AcpiDsMethodDataGetValue(), AcpiEvExecuteRegMethod(), AcpiExConvertToInteger(), AcpiExLoadTableOp(), AcpiExOpcode_0A_0T_1R(), AcpiExOpcode_1A_0T_1R(), AcpiExOpcode_6A_0T_1R(), AcpiExReadDataFromField(), AcpiNsConvertToInteger(), AcpiNsRepairNullElement(), AcpiPsExecuteMethod(), and AcpiPsParseAml().

◆ AcpiUtCreateInternalObjectDbg()

ACPI_OPERAND_OBJECT* AcpiUtCreateInternalObjectDbg ( const char ModuleName,
UINT32  LineNumber,
UINT32  ComponentId,
ACPI_OBJECT_TYPE  Type 
)

Definition at line 94 of file utobject.c.

99 {
101  ACPI_OPERAND_OBJECT *SecondObject;
102 
103 
104  ACPI_FUNCTION_TRACE_STR (UtCreateInternalObjectDbg,
106 
107 
108  /* Allocate the raw object descriptor */
109 
112  if (!Object)
113  {
114  return_PTR (NULL);
115  }
116 
117  switch (Type)
118  {
119  case ACPI_TYPE_REGION:
122 
123  /* These types require a secondary object */
124 
125  SecondObject = AcpiUtAllocateObjectDescDbg (
127  if (!SecondObject)
128  {
130  return_PTR (NULL);
131  }
132 
133  SecondObject->Common.Type = ACPI_TYPE_LOCAL_EXTRA;
134  SecondObject->Common.ReferenceCount = 1;
135 
136  /* Link the second object to the first */
137 
138  Object->Common.NextObject = SecondObject;
139  break;
140 
141  default:
142 
143  /* All others have no secondary object */
144  break;
145  }
146 
147  /* Save the object type in the object descriptor */
148 
149  Object->Common.Type = (UINT8) Type;
150 
151  /* Init the reference count */
152 
153  Object->Common.ReferenceCount = 1;
154 
155  /* Any per-type initialization should go here */
156 
157  return_PTR (Object);
158 }
void * AcpiUtAllocateObjectDescDbg(const char *ModuleName, UINT32 LineNumber, UINT32 ComponentId)
Definition: utobject.c:429
#define return_PTR(s)
Definition: acoutput.h:497
Type
Definition: Type.h:6
#define ACPI_TYPE_LOCAL_EXTRA
Definition: actypes.h:727
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
Definition: acpixf.h:1274
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1274
void AcpiUtDeleteObjectDesc(ACPI_OPERAND_OBJECT *Object)
Definition: utobject.c:473
smooth NULL
Definition: ftsmooth.c:416
static IUnknown Object
Definition: main.c:512
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
Definition: acpixf.h:1216
#define ACPI_TYPE_BUFFER_FIELD
Definition: actypes.h:693
ACPI_OBJECT_COMMON Common
Definition: acobject.h:517
#define ACPI_FUNCTION_TRACE_STR(a, b)
Definition: acoutput.h:483
const char * AcpiUtGetTypeName(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:249
#define ACPI_TYPE_REGION
Definition: actypes.h:689
#define ACPI_TYPE_LOCAL_BANK_FIELD
Definition: actypes.h:709
unsigned char UINT8

◆ AcpiUtCreatePackageObject()

ACPI_OPERAND_OBJECT* AcpiUtCreatePackageObject ( UINT32  Count)

Definition at line 174 of file utobject.c.

176 {
177  ACPI_OPERAND_OBJECT *PackageDesc;
178  ACPI_OPERAND_OBJECT **PackageElements;
179 
180 
181  ACPI_FUNCTION_TRACE_U32 (UtCreatePackageObject, Count);
182 
183 
184  /* Create a new Package object */
185 
187  if (!PackageDesc)
188  {
189  return_PTR (NULL);
190  }
191 
192  /*
193  * Create the element array. Count+1 allows the array to be null
194  * terminated.
195  */
196  PackageElements = ACPI_ALLOCATE_ZEROED (
197  ((ACPI_SIZE) Count + 1) * sizeof (void *));
198  if (!PackageElements)
199  {
200  ACPI_FREE (PackageDesc);
201  return_PTR (NULL);
202  }
203 
204  PackageDesc->Package.Count = Count;
205  PackageDesc->Package.Elements = PackageElements;
206  return_PTR (PackageDesc);
207 }
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define return_PTR(s)
Definition: acoutput.h:497
ACPI_OBJECT_PACKAGE Package
Definition: acobject.h:521
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define ACPI_FUNCTION_TRACE_U32(a, b)
Definition: acoutput.h:482
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:683
smooth NULL
Definition: ftsmooth.c:416
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:655
union acpi_operand_object ** Elements
Definition: acobject.h:161

Referenced by AcpiNsWrapWithPackage(), AcpiUtCopyEpackageToIpackage(), and AcpiUtCopyIelementToIelement().

◆ AcpiUtCreateStringObject()

ACPI_OPERAND_OBJECT* AcpiUtCreateStringObject ( ACPI_SIZE  StringSize)

Definition at line 320 of file utobject.c.

322 {
323  ACPI_OPERAND_OBJECT *StringDesc;
324  char *String;
325 
326 
327  ACPI_FUNCTION_TRACE_U32 (UtCreateStringObject, StringSize);
328 
329 
330  /* Create a new String object */
331 
333  if (!StringDesc)
334  {
335  return_PTR (NULL);
336  }
337 
338  /*
339  * Allocate the actual string buffer -- (Size + 1) for NULL terminator.
340  * NOTE: Zero-length strings are NULL terminated
341  */
342  String = ACPI_ALLOCATE_ZEROED (StringSize + 1);
343  if (!String)
344  {
345  ACPI_ERROR ((AE_INFO, "Could not allocate size %u",
346  (UINT32) StringSize));
347 
348  AcpiUtRemoveReference (StringDesc);
349  return_PTR (NULL);
350  }
351 
352  /* Complete string object initialization */
353 
354  StringDesc->String.Pointer = String;
355  StringDesc->String.Length = (UINT32) StringSize;
356 
357  /* Return the new string descriptor */
358 
359  return_PTR (StringDesc);
360 }
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define return_PTR(s)
Definition: acoutput.h:497
static WCHAR String[]
Definition: stringtable.c:55
#define ACPI_FUNCTION_TRACE_U32(a, b)
Definition: acoutput.h:482
unsigned int UINT32
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
ACPI_OBJECT_STRING String
Definition: acobject.h:519
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_TYPE_STRING
Definition: actypes.h:681
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:655

Referenced by AcpiExConvertToObjectTypeString(), AcpiExConvertToString(), AcpiExDoConcatenate(), AcpiExOpcode_2A_1T_1R(), AcpiNsConvertToString(), AcpiNsRepair_HID(), and AcpiNsRepairNullElement().

◆ AcpiUtDeleteObjectDesc()

void AcpiUtDeleteObjectDesc ( ACPI_OPERAND_OBJECT Object)

Definition at line 473 of file utobject.c.

475 {
476  ACPI_FUNCTION_TRACE_PTR (UtDeleteObjectDesc, Object);
477 
478 
479  /* Object must be of type ACPI_OPERAND_OBJECT */
480 
482  {
484  "%p is not an ACPI Operand object [%s]", Object,
486  return_VOID;
487  }
488 
489  (void) AcpiOsReleaseObject (AcpiGbl_OperandCache, Object);
490  return_VOID;
491 }
const char * AcpiUtGetDescriptorName(void *Object)
Definition: utdecode.c:381
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_DESC_TYPE_OPERAND
Definition: acobject.h:574
static IUnknown Object
Definition: main.c:512
#define return_VOID
Definition: acoutput.h:495
ACPI_STATUS AcpiOsReleaseObject(ACPI_CACHE_T *Cache, void *Object)
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414

Referenced by AcpiDsBuildInternalBufferObj(), AcpiDsBuildInternalPackageObj(), AcpiDsCreateMethodMutex(), AcpiDsCreateOperand(), AcpiExPrepFieldValue(), AcpiUtCreateInternalObjectDbg(), and AcpiUtDeleteInternalObj().

◆ AcpiUtGetElementLength()

static ACPI_STATUS AcpiUtGetElementLength ( UINT8  ObjectType,
ACPI_OPERAND_OBJECT SourceObject,
ACPI_GENERIC_STATE State,
void Context 
)
static

Definition at line 646 of file utobject.c.

651 {
654  ACPI_SIZE ObjectSpace;
655 
656 
657  switch (ObjectType)
658  {
660  /*
661  * Simple object - just get the size (Null object/entry is handled
662  * here also) and sum it into the running package length
663  */
664  Status = AcpiUtGetSimpleObjectSize (SourceObject, &ObjectSpace);
665  if (ACPI_FAILURE (Status))
666  {
667  return (Status);
668  }
669 
670  Info->Length += ObjectSpace;
671  break;
672 
674 
675  /* Package object - nothing much to do here, let the walk handle it */
676 
677  Info->NumPackages++;
678  State->Pkg.ThisTargetObj = NULL;
679  break;
680 
681  default:
682 
683  /* No other types allowed */
684 
685  return (AE_BAD_PARAMETER);
686  }
687 
688  return (Status);
689 }
ObjectType
Definition: metafile.c:80
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
smooth NULL
Definition: ftsmooth.c:416
static ACPI_STATUS AcpiUtGetSimpleObjectSize(ACPI_OPERAND_OBJECT *Obj, ACPI_SIZE *ObjLength)
Definition: utobject.c:512
#define ACPI_COPY_TYPE_SIMPLE
Definition: aclocal.h:281
Status
Definition: gdiplustypes.h:24
#define ACPI_COPY_TYPE_PACKAGE
Definition: aclocal.h:282
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiUtGetPackageObjectSize().

◆ AcpiUtGetObjectSize()

ACPI_STATUS AcpiUtGetObjectSize ( ACPI_OPERAND_OBJECT InternalObject,
ACPI_SIZE *  ObjLength 
)

Definition at line 762 of file utobject.c.

765 {
767 
768 
770 
771 
772  if ((ACPI_GET_DESCRIPTOR_TYPE (InternalObject) ==
774  (InternalObject->Common.Type == ACPI_TYPE_PACKAGE))
775  {
776  Status = AcpiUtGetPackageObjectSize (InternalObject, ObjLength);
777  }
778  else
779  {
780  Status = AcpiUtGetSimpleObjectSize (InternalObject, ObjLength);
781  }
782 
783  return (Status);
784 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:683
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
#define ACPI_DESC_TYPE_OPERAND
Definition: acobject.h:574
static ACPI_STATUS AcpiUtGetSimpleObjectSize(ACPI_OPERAND_OBJECT *Obj, ACPI_SIZE *ObjLength)
Definition: utobject.c:512
Status
Definition: gdiplustypes.h:24
ACPI_OBJECT_COMMON Common
Definition: acobject.h:517
static ACPI_STATUS AcpiUtGetPackageObjectSize(ACPI_OPERAND_OBJECT *Obj, ACPI_SIZE *ObjLength)
Definition: utobject.c:710
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414

Referenced by AcpiEvaluateObject().

◆ AcpiUtGetPackageObjectSize()

static ACPI_STATUS AcpiUtGetPackageObjectSize ( ACPI_OPERAND_OBJECT Obj,
ACPI_SIZE *  ObjLength 
)
static

Definition at line 710 of file utobject.c.

713 {
716 
717 
718  ACPI_FUNCTION_TRACE_PTR (UtGetPackageObjectSize, InternalObject);
719 
720 
721  Info.Length = 0;
722  Info.ObjectSpace = 0;
723  Info.NumPackages = 1;
724 
726  InternalObject, NULL, AcpiUtGetElementLength, &Info);
727  if (ACPI_FAILURE (Status))
728  {
730  }
731 
732  /*
733  * We have handled all of the objects in all levels of the package.
734  * just add the length of the package objects themselves.
735  * Round up to the next machine word.
736  */
738  sizeof (ACPI_OBJECT)) * (ACPI_SIZE) Info.NumPackages;
739 
740  /* Return the total package length */
741 
742  *ObjLength = Info.Length;
744 }
ACPI_STATUS AcpiUtWalkPackageTree(ACPI_OPERAND_OBJECT *SourceObject, void *TargetObject, ACPI_PKG_CALLBACK WalkCallback, void *Context)
Definition: utmisc.c:264
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_ROUND_UP_TO_NATIVE_WORD(a)
Definition: acmacros.h:254
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
static ACPI_STATUS AcpiUtGetElementLength(UINT8 ObjectType, ACPI_OPERAND_OBJECT *SourceObject, ACPI_GENERIC_STATE *State, void *Context)
Definition: utobject.c:646

Referenced by AcpiUtGetObjectSize().

◆ AcpiUtGetSimpleObjectSize()

static ACPI_STATUS AcpiUtGetSimpleObjectSize ( ACPI_OPERAND_OBJECT Obj,
ACPI_SIZE *  ObjLength 
)
static

Definition at line 512 of file utobject.c.

515 {
516  ACPI_SIZE Length;
517  ACPI_SIZE Size;
519 
520 
521  ACPI_FUNCTION_TRACE_PTR (UtGetSimpleObjectSize, InternalObject);
522 
523 
524  /* Start with the length of the (external) Acpi object */
525 
526  Length = sizeof (ACPI_OBJECT);
527 
528  /* A NULL object is allowed, can be a legal uninitialized package element */
529 
530  if (!InternalObject)
531  {
532  /*
533  * Object is NULL, just return the length of ACPI_OBJECT
534  * (A NULL ACPI_OBJECT is an object of all zeroes.)
535  */
536  *ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length);
538  }
539 
540  /* A Namespace Node should never appear here */
541 
542  if (ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_NAMED)
543  {
544  /* A namespace node should never get here */
545 
547  "Received a namespace node [%4.4s] "
548  "where an operand object is required",
549  ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, InternalObject)->Name.Ascii));
551  }
552 
553  /*
554  * The final length depends on the object type
555  * Strings and Buffers are packed right up against the parent object and
556  * must be accessed bytewise or there may be alignment problems on
557  * certain processors
558  */
559  switch (InternalObject->Common.Type)
560  {
561  case ACPI_TYPE_STRING:
562 
563  Length += (ACPI_SIZE) InternalObject->String.Length + 1;
564  break;
565 
566  case ACPI_TYPE_BUFFER:
567 
568  Length += (ACPI_SIZE) InternalObject->Buffer.Length;
569  break;
570 
571  case ACPI_TYPE_INTEGER:
572  case ACPI_TYPE_PROCESSOR:
573  case ACPI_TYPE_POWER:
574 
575  /* No extra data for these types */
576 
577  break;
578 
580 
581  switch (InternalObject->Reference.Class)
582  {
583  case ACPI_REFCLASS_NAME:
584  /*
585  * Get the actual length of the full pathname to this object.
586  * The reference will be converted to the pathname to the object
587  */
588  Size = AcpiNsGetPathnameLength (InternalObject->Reference.Node);
589  if (!Size)
590  {
592  }
593 
595  break;
596 
597  default:
598  /*
599  * No other reference opcodes are supported.
600  * Notably, Locals and Args are not supported, but this may be
601  * required eventually.
602  */
603  ACPI_ERROR ((AE_INFO, "Cannot convert to external object - "
604  "unsupported Reference Class [%s] 0x%X in object %p",
605  AcpiUtGetReferenceName (InternalObject),
606  InternalObject->Reference.Class, InternalObject));
607  Status = AE_TYPE;
608  break;
609  }
610  break;
611 
612  default:
613 
614  ACPI_ERROR ((AE_INFO, "Cannot convert to external object - "
615  "unsupported type [%s] 0x%X in object %p",
616  AcpiUtGetObjectTypeName (InternalObject),
617  InternalObject->Common.Type, InternalObject));
618  Status = AE_TYPE;
619  break;
620  }
621 
622  /*
623  * Account for the space required by the object rounded up to the next
624  * multiple of the machine word size. This keeps each object aligned
625  * on a machine word boundary. (preventing alignment faults on some
626  * machines.)
627  */
628  *ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length);
630 }
union acpi_object ACPI_OBJECT
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define ACPI_TYPE_BUFFER
Definition: actypes.h:682
#define ACPI_TYPE_INTEGER
Definition: actypes.h:680
#define ACPI_TYPE_POWER
Definition: actypes.h:690
#define AE_AML_INTERNAL
Definition: acexcep.h:194
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:711
const char * AcpiUtGetReferenceName(ACPI_OPERAND_OBJECT *Object)
Definition: utdecode.c:425
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_SIZE AcpiNsGetPathnameLength(ACPI_NAMESPACE_NODE *Node)
Definition: nsnames.c:103
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_ROUND_UP_TO_NATIVE_WORD(a)
Definition: acmacros.h:254
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define AE_TYPE
Definition: acexcep.h:116
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define ACPI_TYPE_PROCESSOR
Definition: actypes.h:691
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_TYPE_STRING
Definition: actypes.h:681
#define ACPI_DESC_TYPE_NAMED
Definition: acobject.h:575
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
const char * AcpiUtGetObjectTypeName(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: utdecode.c:263
#define AE_OK
Definition: acexcep.h:97
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414

Referenced by AcpiUtGetElementLength(), and AcpiUtGetObjectSize().

◆ AcpiUtValidInternalObject()

BOOLEAN AcpiUtValidInternalObject ( void Object)

Definition at line 376 of file utobject.c.

378 {
379 
380  ACPI_FUNCTION_NAME (UtValidInternalObject);
381 
382 
383  /* Check for a null pointer */
384 
385  if (!Object)
386  {
387  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Null Object Ptr\n"));
388  return (FALSE);
389  }
390 
391  /* Check the descriptor type field */
392 
394  {
396 
397  /* The object appears to be a valid ACPI_OPERAND_OBJECT */
398 
399  return (TRUE);
400 
401  default:
402 
404  "%p is not an ACPI operand obj [%s]\n",
406  break;
407  }
408 
409  return (FALSE);
410 }
const char * AcpiUtGetDescriptorName(void *Object)
Definition: utdecode.c:381
#define TRUE
Definition: types.h:120
#define ACPI_DESC_TYPE_OPERAND
Definition: acobject.h:574
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
static IUnknown Object
Definition: main.c:512
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414

Referenced by AcpiExDoDebugObject(), AcpiUtAddReference(), and AcpiUtRemoveReference().