ReactOS  0.4.14-dev-1112-g2b067d6
utmisc.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
Include dependency graph for utmisc.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_UTILITIES
 

Functions

BOOLEAN AcpiUtIsPciRootBridge (char *Id)
 
UINT32 AcpiUtDwordByteSwap (UINT32 Value)
 
void AcpiUtSetIntegerWidth (UINT8 Revision)
 
ACPI_STATUS AcpiUtCreateUpdateStateAndPush (ACPI_OPERAND_OBJECT *Object, UINT16 Action, ACPI_GENERIC_STATE **StateList)
 
ACPI_STATUS AcpiUtWalkPackageTree (ACPI_OPERAND_OBJECT *SourceObject, void *TargetObject, ACPI_PKG_CALLBACK WalkCallback, void *Context)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_UTILITIES

Definition at line 49 of file utmisc.c.

Function Documentation

◆ AcpiUtCreateUpdateStateAndPush()

ACPI_STATUS AcpiUtCreateUpdateStateAndPush ( ACPI_OPERAND_OBJECT Object,
UINT16  Action,
ACPI_GENERIC_STATE **  StateList 
)

Definition at line 219 of file utmisc.c.

223 {
225 
226 
228 
229 
230  /* Ignore null objects; these are expected */
231 
232  if (!Object)
233  {
234  return (AE_OK);
235  }
236 
238  if (!State)
239  {
240  return (AE_NO_MEMORY);
241  }
242 
243  AcpiUtPushGenericState (StateList, State);
244  return (AE_OK);
245 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
void AcpiUtPushGenericState(ACPI_GENERIC_STATE **ListHead, ACPI_GENERIC_STATE *State)
Definition: utstate.c:65
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
_In_ PLIST_ENTRY _In_ PSTRING _In_ USHORT _In_opt_ PSTRING _In_opt_ PSTRING _In_ ULONG _In_ ULONG Action
Definition: fsrtlfuncs.h:738
static IUnknown Object
Definition: main.c:512
enum State_ State
Definition: pofuncs.h:54
ACPI_GENERIC_STATE * AcpiUtCreateUpdateState(ACPI_OPERAND_OBJECT *Object, UINT16 Action)
Definition: utstate.c:214
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiUtUpdateObjectReference().

◆ AcpiUtDwordByteSwap()

UINT32 AcpiUtDwordByteSwap ( UINT32  Value)

Definition at line 136 of file utmisc.c.

138 {
139  union
140  {
141  UINT32 Value;
142  UINT8 Bytes[4];
143  } Out;
144  union
145  {
146  UINT32 Value;
147  UINT8 Bytes[4];
148  } In;
149 
150 
152 
153 
154  In.Value = Value;
155 
156  Out.Bytes[0] = In.Bytes[3];
157  Out.Bytes[1] = In.Bytes[2];
158  Out.Bytes[2] = In.Bytes[1];
159  Out.Bytes[3] = In.Bytes[0];
160 
161  return (Out.Value);
162 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2374
_In_ UINT Bytes
Definition: mmcopy.h:9
unsigned int UINT32
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
unsigned char UINT8

Referenced by AcpiExEisaIdToString().

◆ AcpiUtIsPciRootBridge()

BOOLEAN AcpiUtIsPciRootBridge ( char Id)

Definition at line 66 of file utmisc.c.

68 {
69 
70  /*
71  * Check if this is a PCI root bridge.
72  * ACPI 3.0+: check for a PCI Express root also.
73  */
74  if (!(strcmp (Id,
76 
77  !(strcmp (Id,
79  {
80  return (TRUE);
81  }
82 
83  return (FALSE);
84 }
#define TRUE
Definition: types.h:120
DWORD Id
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define PCI_ROOT_HID_STRING
Definition: actypes.h:426
#define PCI_EXPRESS_ROOT_HID_STRING
Definition: actypes.h:427

Referenced by AcpiEvIsPciRootBridge(), and AcpiGetObjectInfo().

◆ AcpiUtSetIntegerWidth()

void AcpiUtSetIntegerWidth ( UINT8  Revision)

Definition at line 181 of file utmisc.c.

183 {
184 
185  if (Revision < 2)
186  {
187  /* 32-bit case */
188 
189  AcpiGbl_IntegerBitWidth = 32;
190  AcpiGbl_IntegerNybbleWidth = 8;
191  AcpiGbl_IntegerByteWidth = 4;
192  }
193  else
194  {
195  /* 64-bit case (ACPI 2.0+) */
196 
197  AcpiGbl_IntegerBitWidth = 64;
198  AcpiGbl_IntegerNybbleWidth = 16;
199  AcpiGbl_IntegerByteWidth = 8;
200  }
201 }
_In_ ULONG Revision
Definition: rtlfuncs.h:1104

Referenced by AcpiTbInstallTableWithOverride().

◆ AcpiUtWalkPackageTree()

ACPI_STATUS AcpiUtWalkPackageTree ( ACPI_OPERAND_OBJECT SourceObject,
void TargetObject,
ACPI_PKG_CALLBACK  WalkCallback,
void Context 
)

Definition at line 264 of file utmisc.c.

269 {
271  ACPI_GENERIC_STATE *StateList = NULL;
273  ACPI_OPERAND_OBJECT *ThisSourceObj;
274  UINT32 ThisIndex;
275 
276 
277  ACPI_FUNCTION_TRACE (UtWalkPackageTree);
278 
279 
280  State = AcpiUtCreatePkgState (SourceObject, TargetObject, 0);
281  if (!State)
282  {
284  }
285 
286  while (State)
287  {
288  /* Get one element of the package */
289 
290  ThisIndex = State->Pkg.Index;
291  ThisSourceObj =
292  State->Pkg.SourceObject->Package.Elements[ThisIndex];
293  State->Pkg.ThisTargetObj =
294  &State->Pkg.SourceObject->Package.Elements[ThisIndex];
295 
296  /*
297  * Check for:
298  * 1) An uninitialized package element. It is completely
299  * legal to declare a package and leave it uninitialized
300  * 2) Not an internal object - can be a namespace node instead
301  * 3) Any type other than a package. Packages are handled in else
302  * case below.
303  */
304  if ((!ThisSourceObj) ||
305  (ACPI_GET_DESCRIPTOR_TYPE (ThisSourceObj) !=
307  (ThisSourceObj->Common.Type != ACPI_TYPE_PACKAGE))
308  {
309  Status = WalkCallback (ACPI_COPY_TYPE_SIMPLE, ThisSourceObj,
310  State, Context);
311  if (ACPI_FAILURE (Status))
312  {
314  }
315 
316  State->Pkg.Index++;
317  while (State->Pkg.Index >=
318  State->Pkg.SourceObject->Package.Count)
319  {
320  /*
321  * We've handled all of the objects at this level, This means
322  * that we have just completed a package. That package may
323  * have contained one or more packages itself.
324  *
325  * Delete this state and pop the previous state (package).
326  */
328  State = AcpiUtPopGenericState (&StateList);
329 
330  /* Finished when there are no more states */
331 
332  if (!State)
333  {
334  /*
335  * We have handled all of the objects in the top level
336  * package just add the length of the package objects
337  * and exit
338  */
340  }
341 
342  /*
343  * Go back up a level and move the index past the just
344  * completed package object.
345  */
346  State->Pkg.Index++;
347  }
348  }
349  else
350  {
351  /* This is a subobject of type package */
352 
353  Status = WalkCallback (
354  ACPI_COPY_TYPE_PACKAGE, ThisSourceObj, State, Context);
355  if (ACPI_FAILURE (Status))
356  {
358  }
359 
360  /*
361  * Push the current state and create a new one
362  * The callback above returned a new target package object.
363  */
364  AcpiUtPushGenericState (&StateList, State);
366  ThisSourceObj, State->Pkg.ThisTargetObj, 0);
367  if (!State)
368  {
369  /* Free any stacked Update State objects */
370 
371  while (StateList)
372  {
373  State = AcpiUtPopGenericState (&StateList);
375  }
377  }
378  }
379  }
380 
381  /* We should never get here */
382 
384  "State list did not terminate correctly"));
385 
387 }
void AcpiUtDeleteGenericState(ACPI_GENERIC_STATE *State)
Definition: utstate.c:340
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_AML_INTERNAL
Definition: acexcep.h:194
void AcpiUtPushGenericState(ACPI_GENERIC_STATE **ListHead, ACPI_GENERIC_STATE *State)
Definition: utstate.c:65
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_GENERIC_STATE * AcpiUtPopGenericState(ACPI_GENERIC_STATE **ListHead)
Definition: utstate.c:93
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:683
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
unsigned int UINT32
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_DESC_TYPE_OPERAND
Definition: acobject.h:574
ACPI_GENERIC_STATE * AcpiUtCreatePkgState(void *InternalObject, void *ExternalObject, UINT32 Index)
Definition: utstate.c:255
#define ACPI_COPY_TYPE_SIMPLE
Definition: aclocal.h:281
Status
Definition: gdiplustypes.h:24
enum State_ State
Definition: pofuncs.h:54
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_OBJECT_COMMON Common
Definition: acobject.h:517
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_COPY_TYPE_PACKAGE
Definition: aclocal.h:282
#define AE_OK
Definition: acexcep.h:97
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414

Referenced by AcpiNsInitOnePackage(), AcpiUtCopyIpackageToEpackage(), AcpiUtCopyIpackageToIpackage(), and AcpiUtGetPackageObjectSize().