ReactOS 0.4.15-dev-7907-g95bf896
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
#define AE_OK
Definition: acexcep.h:97
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
ACPI_GENERIC_STATE * AcpiUtCreateUpdateState(ACPI_OPERAND_OBJECT *Object, UINT16 Action)
Definition: utstate.c:214
void AcpiUtPushGenericState(ACPI_GENERIC_STATE **ListHead, ACPI_GENERIC_STATE *State)
Definition: utstate.c:65
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510

Referenced by AcpiUtUpdateObjectReference().

◆ AcpiUtDwordByteSwap()

UINT32 AcpiUtDwordByteSwap ( UINT32  Value)

Definition at line 136 of file utmisc.c.

138{
139 union
140 {
142 UINT8 Bytes[4];
143 } Out;
144 union
145 {
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}
unsigned char UINT8
unsigned int UINT32
@ Out
@ In
_In_ UINT Bytes
Definition: mmcopy.h:9
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

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}
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
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117

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:1130

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}
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_AML_INTERNAL
Definition: acexcep.h:194
#define ACPI_COPY_TYPE_PACKAGE
Definition: aclocal.h:282
#define ACPI_COPY_TYPE_SIMPLE
Definition: aclocal.h:281
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414
#define ACPI_DESC_TYPE_OPERAND
Definition: acobject.h:576
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:691
ACPI_GENERIC_STATE * AcpiUtCreatePkgState(void *InternalObject, void *ExternalObject, UINT32 Index)
Definition: utstate.c:255
ACPI_GENERIC_STATE * AcpiUtPopGenericState(ACPI_GENERIC_STATE **ListHead)
Definition: utstate.c:93
void AcpiUtDeleteGenericState(ACPI_GENERIC_STATE *State)
Definition: utstate.c:340
#define NULL
Definition: types.h:112
Status
Definition: gdiplustypes.h:25
ACPI_OBJECT_COMMON Common
Definition: acobject.h:519

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