ReactOS  0.4.14-dev-376-gaedba84
acinterp.h File Reference

Go to the source code of this file.

Classes

struct  acpi_exdump_info
 

Macros

#define ACPI_WALK_OPERANDS   (&(WalkState->Operands [WalkState->NumOperands -1]))
 
#define ACPI_EXD_OFFSET(f)   (UINT8) ACPI_OFFSET (ACPI_OPERAND_OBJECT,f)
 
#define ACPI_EXD_NSOFFSET(f)   (UINT8) ACPI_OFFSET (ACPI_NAMESPACE_NODE,f)
 
#define ACPI_EXD_TABLE_SIZE(name)   (sizeof(name) / sizeof (ACPI_EXDUMP_INFO))
 
#define ACPI_EXD_INIT   0
 
#define ACPI_EXD_TYPE   1
 
#define ACPI_EXD_UINT8   2
 
#define ACPI_EXD_UINT16   3
 
#define ACPI_EXD_UINT32   4
 
#define ACPI_EXD_UINT64   5
 
#define ACPI_EXD_LITERAL   6
 
#define ACPI_EXD_POINTER   7
 
#define ACPI_EXD_ADDRESS   8
 
#define ACPI_EXD_STRING   9
 
#define ACPI_EXD_BUFFER   10
 
#define ACPI_EXD_PACKAGE   11
 
#define ACPI_EXD_FIELD   12
 
#define ACPI_EXD_REFERENCE   13
 
#define ACPI_EXD_LIST   14 /* Operand object list */
 
#define ACPI_EXD_HDLR_LIST   15 /* Address Handler list */
 
#define ACPI_EXD_RGN_LIST   16 /* Region list */
 
#define ACPI_EXD_NODE   17 /* Namespace Node */
 
#define ACPI_EXPLICIT_BYTE_COPY   0x00000000
 
#define ACPI_EXPLICIT_CONVERT_HEX   0x00000001
 
#define ACPI_IMPLICIT_CONVERT_HEX   0x00000002
 
#define ACPI_EXPLICIT_CONVERT_DECIMAL   0x00000003
 

Typedefs

typedef const struct acpi_exdump_info ACPI_EXDUMP_INFO
 

Functions

ACPI_STATUS AcpiExConvertToInteger (ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, UINT32 ImplicitConversion)
 
ACPI_STATUS AcpiExConvertToBuffer (ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc)
 
ACPI_STATUS AcpiExConvertToString (ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, UINT32 Type)
 
ACPI_STATUS AcpiExConvertToTargetType (ACPI_OBJECT_TYPE DestinationType, ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT **ResultDesc, ACPI_WALK_STATE *WalkState)
 
void AcpiExDoDebugObject (ACPI_OPERAND_OBJECT *SourceDesc, UINT32 Level, UINT32 Index)
 
void AcpiExStartTraceMethod (ACPI_NAMESPACE_NODE *MethodNode, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState)
 
void AcpiExStopTraceMethod (ACPI_NAMESPACE_NODE *MethodNode, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState)
 
void AcpiExStartTraceOpcode (ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState)
 
void AcpiExStopTraceOpcode (ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState)
 
void AcpiExTracePoint (ACPI_TRACE_EVENT_TYPE Type, BOOLEAN Begin, UINT8 *Aml, char *Pathname)
 
ACPI_STATUS AcpiExGetProtocolBufferLength (UINT32 ProtocolId, UINT32 *ReturnLength)
 
ACPI_STATUS AcpiExCommonBufferSetup (ACPI_OPERAND_OBJECT *ObjDesc, UINT32 BufferLength, UINT32 *DatumCount)
 
ACPI_STATUS AcpiExWriteWithUpdateRule (ACPI_OPERAND_OBJECT *ObjDesc, UINT64 Mask, UINT64 FieldValue, UINT32 FieldDatumByteOffset)
 
void AcpiExGetBufferDatum (UINT64 *Datum, void *Buffer, UINT32 BufferLength, UINT32 ByteGranularity, UINT32 BufferOffset)
 
void AcpiExSetBufferDatum (UINT64 MergedDatum, void *Buffer, UINT32 BufferLength, UINT32 ByteGranularity, UINT32 BufferOffset)
 
ACPI_STATUS AcpiExReadDataFromField (ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **RetBufferDesc)
 
ACPI_STATUS AcpiExWriteDataToField (ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc)
 
ACPI_STATUS AcpiExExtractFromField (ACPI_OPERAND_OBJECT *ObjDesc, void *Buffer, UINT32 BufferLength)
 
ACPI_STATUS AcpiExInsertIntoField (ACPI_OPERAND_OBJECT *ObjDesc, void *Buffer, UINT32 BufferLength)
 
ACPI_STATUS AcpiExAccessRegion (ACPI_OPERAND_OBJECT *ObjDesc, UINT32 FieldDatumByteOffset, UINT64 *Value, UINT32 ReadWrite)
 
ACPI_STATUS AcpiExGetObjectReference (ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ReturnDesc, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExConcatTemplate (ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT *ObjDesc2, ACPI_OPERAND_OBJECT **ActualReturnDesc, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExDoConcatenate (ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT *ObjDesc2, ACPI_OPERAND_OBJECT **ActualReturnDesc, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExDoLogicalNumericOp (UINT16 Opcode, UINT64 Integer0, UINT64 Integer1, BOOLEAN *LogicalResult)
 
ACPI_STATUS AcpiExDoLogicalOp (UINT16 Opcode, ACPI_OPERAND_OBJECT *Operand0, ACPI_OPERAND_OBJECT *Operand1, BOOLEAN *LogicalResult)
 
UINT64 AcpiExDoMathOp (UINT16 Opcode, UINT64 Operand0, UINT64 Operand1)
 
ACPI_STATUS AcpiExCreateMutex (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExCreateProcessor (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExCreatePowerResource (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExCreateRegion (UINT8 *AmlStart, UINT32 AmlLength, UINT8 RegionSpace, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExCreateEvent (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExCreateAlias (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExCreateMethod (UINT8 *AmlStart, UINT32 AmlLength, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExLoadOp (ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT *Target, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExLoadTableOp (ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc)
 
ACPI_STATUS AcpiExUnloadTable (ACPI_OPERAND_OBJECT *DdbHandle)
 
ACPI_STATUS AcpiExAcquireMutex (ACPI_OPERAND_OBJECT *TimeDesc, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExAcquireMutexObject (UINT16 Timeout, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_THREAD_ID ThreadId)
 
ACPI_STATUS AcpiExReleaseMutex (ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExReleaseMutexObject (ACPI_OPERAND_OBJECT *ObjDesc)
 
void AcpiExReleaseAllMutexes (ACPI_THREAD_STATE *Thread)
 
void AcpiExUnlinkMutex (ACPI_OPERAND_OBJECT *ObjDesc)
 
ACPI_STATUS AcpiExPrepCommonFieldObject (ACPI_OPERAND_OBJECT *ObjDesc, UINT8 FieldFlags, UINT8 FieldAttribute, UINT32 FieldBitPosition, UINT32 FieldBitLength)
 
ACPI_STATUS AcpiExPrepFieldValue (ACPI_CREATE_FIELD_INFO *Info)
 
ACPI_STATUS AcpiExReadSerialBus (ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ReturnBuffer)
 
ACPI_STATUS AcpiExWriteSerialBus (ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ReturnBuffer)
 
ACPI_STATUS AcpiExReadGpio (ACPI_OPERAND_OBJECT *ObjDesc, void *Buffer)
 
ACPI_STATUS AcpiExWriteGpio (ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ReturnBuffer)
 
ACPI_STATUS AcpiExSystemDoNotifyOp (ACPI_OPERAND_OBJECT *Value, ACPI_OPERAND_OBJECT *ObjDesc)
 
ACPI_STATUS AcpiExSystemDoSleep (UINT64 Time)
 
ACPI_STATUS AcpiExSystemDoStall (UINT32 Time)
 
ACPI_STATUS AcpiExSystemSignalEvent (ACPI_OPERAND_OBJECT *ObjDesc)
 
ACPI_STATUS AcpiExSystemWaitEvent (ACPI_OPERAND_OBJECT *Time, ACPI_OPERAND_OBJECT *ObjDesc)
 
ACPI_STATUS AcpiExSystemResetEvent (ACPI_OPERAND_OBJECT *ObjDesc)
 
ACPI_STATUS AcpiExSystemWaitSemaphore (ACPI_SEMAPHORE Semaphore, UINT16 Timeout)
 
ACPI_STATUS AcpiExSystemWaitMutex (ACPI_MUTEX Mutex, UINT16 Timeout)
 
ACPI_STATUS AcpiExOpcode_0A_0T_1R (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExOpcode_1A_0T_0R (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExOpcode_1A_0T_1R (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExOpcode_1A_1T_1R (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExOpcode_1A_1T_0R (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExOpcode_2A_0T_0R (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExOpcode_2A_0T_1R (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExOpcode_2A_1T_1R (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExOpcode_2A_2T_1R (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExOpcode_3A_0T_0R (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExOpcode_3A_1T_1R (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExOpcode_6A_0T_1R (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExResolveToValue (ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExResolveMultiple (ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT *Operand, ACPI_OBJECT_TYPE *ReturnType, ACPI_OPERAND_OBJECT **ReturnDesc)
 
ACPI_STATUS AcpiExResolveNodeToValue (ACPI_NAMESPACE_NODE **StackPtr, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExResolveOperands (UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
 
void AcpiExDumpOperand (ACPI_OPERAND_OBJECT *ObjDesc, UINT32 Depth)
 
void AcpiExDumpOperands (ACPI_OPERAND_OBJECT **Operands, const char *OpcodeName, UINT32 NumOpcodes)
 
void AcpiExDumpObjectDescriptor (ACPI_OPERAND_OBJECT *Object, UINT32 Flags)
 
void AcpiExDumpNamespaceNode (ACPI_NAMESPACE_NODE *Node, UINT32 Flags)
 
ACPI_STATUS AcpiExGetNameString (ACPI_OBJECT_TYPE DataType, UINT8 *InAmlAddress, char **OutNameString, UINT32 *OutNameLength)
 
ACPI_STATUS AcpiExStore (ACPI_OPERAND_OBJECT *ValDesc, ACPI_OPERAND_OBJECT *DestDesc, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExStoreObjectToNode (ACPI_OPERAND_OBJECT *SourceDesc, ACPI_NAMESPACE_NODE *Node, ACPI_WALK_STATE *WalkState, UINT8 ImplicitConversion)
 
ACPI_STATUS AcpiExResolveObject (ACPI_OPERAND_OBJECT **SourceDescPtr, ACPI_OBJECT_TYPE TargetType, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExStoreObjectToObject (ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *DestDesc, ACPI_OPERAND_OBJECT **NewDesc, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExStoreBufferToBuffer (ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc)
 
ACPI_STATUS AcpiExStoreStringToString (ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc)
 
ACPI_STATUS AcpiExCopyIntegerToIndexField (ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc)
 
ACPI_STATUS AcpiExCopyIntegerToBankField (ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc)
 
ACPI_STATUS AcpiExCopyDataToNamedField (ACPI_OPERAND_OBJECT *SourceDesc, ACPI_NAMESPACE_NODE *Node)
 
ACPI_STATUS AcpiExCopyIntegerToBufferField (ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc)
 
void AcpiExEnterInterpreter (void)
 
void AcpiExExitInterpreter (void)
 
BOOLEAN AcpiExTruncateFor32bitTable (ACPI_OPERAND_OBJECT *ObjDesc)
 
void AcpiExAcquireGlobalLock (UINT32 Rule)
 
void AcpiExReleaseGlobalLock (UINT32 Rule)
 
void AcpiExEisaIdToString (char *Dest, UINT64 CompressedId)
 
void AcpiExIntegerToString (char *Dest, UINT64 Value)
 
void AcpiExPciClsToString (char *Dest, UINT8 ClassCode[3])
 
BOOLEAN AcpiIsValidSpaceId (UINT8 SpaceId)
 
ACPI_STATUS AcpiExSystemMemorySpaceHandler (UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext)
 
ACPI_STATUS AcpiExSystemIoSpaceHandler (UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext)
 
ACPI_STATUS AcpiExPciConfigSpaceHandler (UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext)
 
ACPI_STATUS AcpiExCmosSpaceHandler (UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext)
 
ACPI_STATUS AcpiExPciBarSpaceHandler (UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext)
 
ACPI_STATUS AcpiExEmbeddedControllerSpaceHandler (UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext)
 
ACPI_STATUS AcpiExSmBusSpaceHandler (UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext)
 
ACPI_STATUS AcpiExDataTableSpaceHandler (UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext)
 

Macro Definition Documentation

◆ ACPI_EXD_ADDRESS

#define ACPI_EXD_ADDRESS   8

Definition at line 86 of file acinterp.h.

◆ ACPI_EXD_BUFFER

#define ACPI_EXD_BUFFER   10

Definition at line 88 of file acinterp.h.

◆ ACPI_EXD_FIELD

#define ACPI_EXD_FIELD   12

Definition at line 90 of file acinterp.h.

◆ ACPI_EXD_HDLR_LIST

#define ACPI_EXD_HDLR_LIST   15 /* Address Handler list */

Definition at line 93 of file acinterp.h.

◆ ACPI_EXD_INIT

#define ACPI_EXD_INIT   0

Definition at line 78 of file acinterp.h.

◆ ACPI_EXD_LIST

#define ACPI_EXD_LIST   14 /* Operand object list */

Definition at line 92 of file acinterp.h.

◆ ACPI_EXD_LITERAL

#define ACPI_EXD_LITERAL   6

Definition at line 84 of file acinterp.h.

◆ ACPI_EXD_NODE

#define ACPI_EXD_NODE   17 /* Namespace Node */

Definition at line 95 of file acinterp.h.

◆ ACPI_EXD_NSOFFSET

#define ACPI_EXD_NSOFFSET (   f)    (UINT8) ACPI_OFFSET (ACPI_NAMESPACE_NODE,f)

Definition at line 53 of file acinterp.h.

◆ ACPI_EXD_OFFSET

#define ACPI_EXD_OFFSET (   f)    (UINT8) ACPI_OFFSET (ACPI_OPERAND_OBJECT,f)

Definition at line 52 of file acinterp.h.

◆ ACPI_EXD_PACKAGE

#define ACPI_EXD_PACKAGE   11

Definition at line 89 of file acinterp.h.

◆ ACPI_EXD_POINTER

#define ACPI_EXD_POINTER   7

Definition at line 85 of file acinterp.h.

◆ ACPI_EXD_REFERENCE

#define ACPI_EXD_REFERENCE   13

Definition at line 91 of file acinterp.h.

◆ ACPI_EXD_RGN_LIST

#define ACPI_EXD_RGN_LIST   16 /* Region list */

Definition at line 94 of file acinterp.h.

◆ ACPI_EXD_STRING

#define ACPI_EXD_STRING   9

Definition at line 87 of file acinterp.h.

◆ ACPI_EXD_TABLE_SIZE

#define ACPI_EXD_TABLE_SIZE (   name)    (sizeof(name) / sizeof (ACPI_EXDUMP_INFO))

Definition at line 54 of file acinterp.h.

◆ ACPI_EXD_TYPE

#define ACPI_EXD_TYPE   1

Definition at line 79 of file acinterp.h.

◆ ACPI_EXD_UINT16

#define ACPI_EXD_UINT16   3

Definition at line 81 of file acinterp.h.

◆ ACPI_EXD_UINT32

#define ACPI_EXD_UINT32   4

Definition at line 82 of file acinterp.h.

◆ ACPI_EXD_UINT64

#define ACPI_EXD_UINT64   5

Definition at line 83 of file acinterp.h.

◆ ACPI_EXD_UINT8

#define ACPI_EXD_UINT8   2

Definition at line 80 of file acinterp.h.

◆ ACPI_EXPLICIT_BYTE_COPY

#define ACPI_EXPLICIT_BYTE_COPY   0x00000000

Definition at line 124 of file acinterp.h.

◆ ACPI_EXPLICIT_CONVERT_DECIMAL

#define ACPI_EXPLICIT_CONVERT_DECIMAL   0x00000003

Definition at line 127 of file acinterp.h.

◆ ACPI_EXPLICIT_CONVERT_HEX

#define ACPI_EXPLICIT_CONVERT_HEX   0x00000001

Definition at line 125 of file acinterp.h.

◆ ACPI_IMPLICIT_CONVERT_HEX

#define ACPI_IMPLICIT_CONVERT_HEX   0x00000002

Definition at line 126 of file acinterp.h.

◆ ACPI_WALK_OPERANDS

#define ACPI_WALK_OPERANDS   (&(WalkState->Operands [WalkState->NumOperands -1]))

Definition at line 48 of file acinterp.h.

Typedef Documentation

◆ ACPI_EXDUMP_INFO

Function Documentation

◆ AcpiExAccessRegion()

ACPI_STATUS AcpiExAccessRegion ( ACPI_OPERAND_OBJECT ObjDesc,
UINT32  FieldDatumByteOffset,
UINT64 Value,
UINT32  ReadWrite 
)

Definition at line 249 of file exfldio.c.

254 {
256  ACPI_OPERAND_OBJECT *RgnDesc;
257  UINT32 RegionOffset;
258 
259 
260  ACPI_FUNCTION_TRACE (ExAccessRegion);
261 
262 
263  /*
264  * Ensure that the region operands are fully evaluated and verify
265  * the validity of the request
266  */
267  Status = AcpiExSetupRegion (ObjDesc, FieldDatumByteOffset);
268  if (ACPI_FAILURE (Status))
269  {
271  }
272 
273  /*
274  * The physical address of this field datum is:
275  *
276  * 1) The base of the region, plus
277  * 2) The base offset of the field, plus
278  * 3) The current offset into the field
279  */
280  RgnDesc = ObjDesc->CommonField.RegionObj;
281  RegionOffset =
282  ObjDesc->CommonField.BaseByteOffset +
283  FieldDatumByteOffset;
284 
285  if ((Function & ACPI_IO_MASK) == ACPI_READ)
286  {
287  ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]"));
288  }
289  else
290  {
291  ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[WRITE]"));
292  }
293 
295  " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n",
297  RgnDesc->Region.SpaceId,
298  ObjDesc->CommonField.AccessByteWidth,
299  ObjDesc->CommonField.BaseByteOffset,
300  FieldDatumByteOffset,
301  ACPI_FORMAT_UINT64 (RgnDesc->Region.Address + RegionOffset)));
302 
303  /* Invoke the appropriate AddressSpace/OpRegion handler */
304 
305  Status = AcpiEvAddressSpaceDispatch (RgnDesc, ObjDesc,
306  Function, RegionOffset,
307  ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value);
308 
309  if (ACPI_FAILURE (Status))
310  {
311  if (Status == AE_NOT_IMPLEMENTED)
312  {
314  "Region %s (ID=%u) not implemented",
316  RgnDesc->Region.SpaceId));
317  }
318  else if (Status == AE_NOT_EXIST)
319  {
321  "Region %s (ID=%u) has no handler",
323  RgnDesc->Region.SpaceId));
324  }
325  }
326 
328 }
#define ACPI_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define ACPI_DB_BFIELD
Definition: acoutput.h:168
static ACPI_STATUS AcpiExSetupRegion(ACPI_OPERAND_OBJECT *ObjDesc, UINT32 FieldDatumByteOffset)
Definition: exfldio.c:92
#define ACPI_READ
Definition: actypes.h:742
ACPI_OBJECT_FIELD_COMMON CommonField
Definition: acobject.h:530
#define ACPI_MUL_8(a)
Definition: acmacros.h:215
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_OBJECT_COMMON_HEADER UINT8 SpaceId
Definition: acobject.h:202
#define AE_NOT_IMPLEMENTED
Definition: acexcep.h:122
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiEvAddressSpaceDispatch(ACPI_OPERAND_OBJECT *RegionObj, ACPI_OPERAND_OBJECT *FieldObj, UINT32 Function, UINT32 RegionOffset, UINT32 BitWidth, UINT64 *Value)
Definition: evregion.c:148
const char * AcpiUtGetRegionName(UINT8 SpaceId)
Definition: utdecode.c:124
static LPOVERLAPPED_COMPLETION_ROUTINE Function
Definition: sync.c:684
unsigned int UINT32
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object * RegionObj
Definition: acobject.h:335
#define AE_INFO
Definition: acoutput.h:230
ACPI_OBJECT_REGION Region
Definition: acobject.h:524
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define AE_NOT_EXIST
Definition: acexcep.h:114
Status
Definition: gdiplustypes.h:24
#define ACPI_IO_MASK
Definition: actypes.h:744
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
ACPI_PHYSICAL_ADDRESS Address
Definition: acobject.h:206

Referenced by AcpiExFieldDatumIo(), AcpiExReadGpio(), AcpiExReadSerialBus(), AcpiExWriteDataToField(), AcpiExWriteGpio(), and AcpiExWriteSerialBus().

◆ AcpiExAcquireGlobalLock()

void AcpiExAcquireGlobalLock ( UINT32  Rule)

Definition at line 225 of file exutils.c.

227 {
229 
230 
231  ACPI_FUNCTION_TRACE (ExAcquireGlobalLock);
232 
233 
234  /* Only use the lock if the AlwaysLock bit is set */
235 
236  if (!(FieldFlags & AML_FIELD_LOCK_RULE_MASK))
237  {
238  return_VOID;
239  }
240 
241  /* Attempt to get the global lock, wait forever */
242 
244  AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ());
245 
246  if (ACPI_FAILURE (Status))
247  {
249  "Could not acquire Global Lock"));
250  }
251 
252  return_VOID;
253 }
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
ACPI_THREAD_ID AcpiOsGetThreadId(void)
Definition: osl.c:217
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_INFO
Definition: acoutput.h:230
ACPI_STATUS AcpiExAcquireMutexObject(UINT16 Timeout, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_THREAD_ID ThreadId)
Definition: exmutex.c:176
#define ACPI_WAIT_FOREVER
Definition: actypes.h:501
#define return_VOID
Definition: acoutput.h:495
#define AML_FIELD_LOCK_RULE_MASK
Definition: amlcode.h:443
Status
Definition: gdiplustypes.h:24
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480

Referenced by AcpiExReadDataFromField(), AcpiExReadGpio(), AcpiExReadSerialBus(), AcpiExWriteDataToField(), AcpiExWriteGpio(), and AcpiExWriteSerialBus().

◆ AcpiExAcquireMutex()

ACPI_STATUS AcpiExAcquireMutex ( ACPI_OPERAND_OBJECT TimeDesc,
ACPI_OPERAND_OBJECT ObjDesc,
ACPI_WALK_STATE WalkState 
)

Definition at line 248 of file exmutex.c.

252 {
254 
255 
256  ACPI_FUNCTION_TRACE_PTR (ExAcquireMutex, ObjDesc);
257 
258 
259  if (!ObjDesc)
260  {
262  }
263 
264  /* Must have a valid thread state struct */
265 
266  if (!WalkState->Thread)
267  {
269  "Cannot acquire Mutex [%4.4s], null thread info",
270  AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
272  }
273 
274  /*
275  * Current sync level must be less than or equal to the sync level
276  * of the mutex. This mechanism provides some deadlock prevention.
277  */
278  if (WalkState->Thread->CurrentSyncLevel > ObjDesc->Mutex.SyncLevel)
279  {
281  "Cannot acquire Mutex [%4.4s], "
282  "current SyncLevel is too large (%u)",
283  AcpiUtGetNodeName (ObjDesc->Mutex.Node),
284  WalkState->Thread->CurrentSyncLevel));
286  }
287 
289  "Acquiring: Mutex SyncLevel %u, Thread SyncLevel %u, "
290  "Depth %u TID %p\n",
291  ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel,
292  ObjDesc->Mutex.AcquisitionDepth, WalkState->Thread));
293 
295  ObjDesc, WalkState->Thread->ThreadId);
296 
297  if (ACPI_SUCCESS (Status) && ObjDesc->Mutex.AcquisitionDepth == 1)
298  {
299  /* Save Thread object, original/current sync levels */
300 
301  ObjDesc->Mutex.OwnerThread = WalkState->Thread;
302  ObjDesc->Mutex.OriginalSyncLevel =
303  WalkState->Thread->CurrentSyncLevel;
304  WalkState->Thread->CurrentSyncLevel =
305  ObjDesc->Mutex.SyncLevel;
306 
307  /* Link the mutex to the current thread for force-unlock at method exit */
308 
309  AcpiExLinkMutex (ObjDesc, WalkState->Thread);
310  }
311 
313  "Acquired: Mutex SyncLevel %u, Thread SyncLevel %u, Depth %u\n",
314  ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel,
315  ObjDesc->Mutex.AcquisitionDepth));
316 
318 }
ACPI_THREAD_STATE * Thread
Definition: acstruct.h:127
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define AE_AML_INTERNAL
Definition: acexcep.h:194
ACPI_OBJECT_MUTEX Mutex
Definition: acobject.h:523
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_OBJECT_COMMON_HEADER UINT8 SyncLevel
Definition: acobject.h:186
UINT8 OriginalSyncLevel
Definition: acobject.h:194
UINT16 AcquisitionDepth
Definition: acobject.h:187
#define AE_AML_MUTEX_ORDER
Definition: acexcep.h:200
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_STATUS AcpiExAcquireMutexObject(UINT16 Timeout, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_THREAD_ID ThreadId)
Definition: exmutex.c:176
ACPI_STATE_COMMON UINT8 CurrentSyncLevel
Definition: aclocal.h:764
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
static void AcpiExLinkMutex(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_THREAD_STATE *Thread)
Definition: exmutex.c:125
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:517
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
unsigned short UINT16
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:305
ACPI_THREAD_ID ThreadId
Definition: aclocal.h:767
ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:193
struct acpi_thread_state * OwnerThread
Definition: acobject.h:190

Referenced by AcpiExOpcode_2A_0T_1R().

◆ AcpiExAcquireMutexObject()

ACPI_STATUS AcpiExAcquireMutexObject ( UINT16  Timeout,
ACPI_OPERAND_OBJECT ObjDesc,
ACPI_THREAD_ID  ThreadId 
)

Definition at line 176 of file exmutex.c.

180 {
182 
183 
184  ACPI_FUNCTION_TRACE_PTR (ExAcquireMutexObject, ObjDesc);
185 
186 
187  if (!ObjDesc)
188  {
190  }
191 
192  /* Support for multiple acquires by the owning thread */
193 
194  if (ObjDesc->Mutex.ThreadId == ThreadId)
195  {
196  /*
197  * The mutex is already owned by this thread, just increment the
198  * acquisition depth
199  */
200  ObjDesc->Mutex.AcquisitionDepth++;
202  }
203 
204  /* Acquire the mutex, wait if necessary. Special case for Global Lock */
205 
206  if (ObjDesc == AcpiGbl_GlobalLockMutex)
207  {
209  }
210  else
211  {
213  }
214 
215  if (ACPI_FAILURE (Status))
216  {
217  /* Includes failure from a timeout on TimeDesc */
218 
220  }
221 
222  /* Acquired the mutex: update mutex object */
223 
224  ObjDesc->Mutex.ThreadId = ThreadId;
225  ObjDesc->Mutex.AcquisitionDepth = 1;
226  ObjDesc->Mutex.OriginalSyncLevel = 0;
227  ObjDesc->Mutex.OwnerThread = NULL; /* Used only for AML Acquire() */
228 
230 }
ACPI_STATUS AcpiEvAcquireGlobalLock(UINT16 Timeout)
Definition: evglock.c:230
ACPI_MUTEX OsMutex
Definition: acobject.h:188
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
ACPI_OBJECT_MUTEX Mutex
Definition: acobject.h:523
UINT32 ACPI_STATUS
Definition: actypes.h:460
UINT8 OriginalSyncLevel
Definition: acobject.h:194
UINT16 AcquisitionDepth
Definition: acobject.h:187
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiExSystemWaitMutex(ACPI_MUTEX Mutex, UINT16 Timeout)
Definition: exsystem.c:120
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_THREAD_ID ThreadId
Definition: acobject.h:189
Status
Definition: gdiplustypes.h:24
static ULONG Timeout
Definition: ping.c:61
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define AE_OK
Definition: acexcep.h:97
struct acpi_thread_state * OwnerThread
Definition: acobject.h:190

Referenced by AcpiAcquireGlobalLock(), AcpiExAcquireGlobalLock(), and AcpiExAcquireMutex().

◆ AcpiExCmosSpaceHandler()

ACPI_STATUS AcpiExCmosSpaceHandler ( UINT32  Function,
ACPI_PHYSICAL_ADDRESS  Address,
UINT32  BitWidth,
UINT64 Value,
void HandlerContext,
void RegionContext 
)

Definition at line 469 of file exregion.c.

476 {
478 
479 
480  ACPI_FUNCTION_TRACE (ExCmosSpaceHandler);
481 
482 
484 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiEvInstallSpaceHandler().

◆ AcpiExCommonBufferSetup()

ACPI_STATUS AcpiExCommonBufferSetup ( ACPI_OPERAND_OBJECT ObjDesc,
UINT32  BufferLength,
UINT32 DatumCount 
)

◆ AcpiExConcatTemplate()

ACPI_STATUS AcpiExConcatTemplate ( ACPI_OPERAND_OBJECT ObjDesc,
ACPI_OPERAND_OBJECT ObjDesc2,
ACPI_OPERAND_OBJECT **  ActualReturnDesc,
ACPI_WALK_STATE WalkState 
)

Definition at line 388 of file exconcat.c.

393 {
395  ACPI_OPERAND_OBJECT *ReturnDesc;
396  UINT8 *NewBuf;
397  UINT8 *EndTag;
398  ACPI_SIZE Length0;
399  ACPI_SIZE Length1;
400  ACPI_SIZE NewLength;
401 
402 
403  ACPI_FUNCTION_TRACE (ExConcatTemplate);
404 
405 
406  /*
407  * Find the EndTag descriptor in each resource template.
408  * Note1: returned pointers point TO the EndTag, not past it.
409  * Note2: zero-length buffers are allowed; treated like one EndTag
410  */
411 
412  /* Get the length of the first resource template */
413 
414  Status = AcpiUtGetResourceEndTag (Operand0, &EndTag);
415  if (ACPI_FAILURE (Status))
416  {
418  }
419 
420  Length0 = ACPI_PTR_DIFF (EndTag, Operand0->Buffer.Pointer);
421 
422  /* Get the length of the second resource template */
423 
424  Status = AcpiUtGetResourceEndTag (Operand1, &EndTag);
425  if (ACPI_FAILURE (Status))
426  {
428  }
429 
430  Length1 = ACPI_PTR_DIFF (EndTag, Operand1->Buffer.Pointer);
431 
432  /* Combine both lengths, minimum size will be 2 for EndTag */
433 
434  NewLength = Length0 + Length1 + sizeof (AML_RESOURCE_END_TAG);
435 
436  /* Create a new buffer object for the result (with one EndTag) */
437 
438  ReturnDesc = AcpiUtCreateBufferObject (NewLength);
439  if (!ReturnDesc)
440  {
442  }
443 
444  /*
445  * Copy the templates to the new buffer, 0 first, then 1 follows. One
446  * EndTag descriptor is copied from Operand1.
447  */
448  NewBuf = ReturnDesc->Buffer.Pointer;
449  memcpy (NewBuf, Operand0->Buffer.Pointer, Length0);
450  memcpy (NewBuf + Length0, Operand1->Buffer.Pointer, Length1);
451 
452  /* Insert EndTag and set the checksum to zero, means "ignore checksum" */
453 
454  NewBuf[NewLength - 1] = 0;
455  NewBuf[NewLength - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;
456 
457  /* Return the completed resource template */
458 
459  *ActualReturnDesc = ReturnDesc;
461 }
#define ACPI_RESOURCE_NAME_END_TAG
Definition: aclocal.h:1323
#define AE_NO_MEMORY
Definition: acexcep.h:112
ACPI_STATUS AcpiUtGetResourceEndTag(ACPI_OPERAND_OBJECT *ObjDesc, UINT8 **EndTag)
Definition: utresrc.c:635
ACPI_OPERAND_OBJECT * AcpiUtCreateBufferObject(ACPI_SIZE BufferSize)
Definition: utobject.c:258
#define ACPI_PTR_DIFF(a, b)
Definition: actypes.h:548
UINT32 ACPI_STATUS
Definition: actypes.h:460
static USHORT USHORT * NewLength
INT Length1
Definition: FsRtlDissect.c:15
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:519
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
struct aml_resource_end_tag AML_RESOURCE_END_TAG
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiExOpcode_2A_1T_1R().

◆ AcpiExConvertToBuffer()

ACPI_STATUS AcpiExConvertToBuffer ( ACPI_OPERAND_OBJECT ObjDesc,
ACPI_OPERAND_OBJECT **  ResultDesc 
)

Definition at line 224 of file exconvrt.c.

227 {
228  ACPI_OPERAND_OBJECT *ReturnDesc;
229  UINT8 *NewBuf;
230 
231 
232  ACPI_FUNCTION_TRACE_PTR (ExConvertToBuffer, ObjDesc);
233 
234 
235  switch (ObjDesc->Common.Type)
236  {
237  case ACPI_TYPE_BUFFER:
238 
239  /* No conversion necessary */
240 
241  *ResultDesc = ObjDesc;
243 
244 
245  case ACPI_TYPE_INTEGER:
246  /*
247  * Create a new Buffer object.
248  * Need enough space for one integer
249  */
250  ReturnDesc = AcpiUtCreateBufferObject (AcpiGbl_IntegerByteWidth);
251  if (!ReturnDesc)
252  {
254  }
255 
256  /* Copy the integer to the buffer, LSB first */
257 
258  NewBuf = ReturnDesc->Buffer.Pointer;
259  memcpy (NewBuf, &ObjDesc->Integer.Value, AcpiGbl_IntegerByteWidth);
260  break;
261 
262  case ACPI_TYPE_STRING:
263  /*
264  * Create a new Buffer object
265  * Size will be the string length
266  *
267  * NOTE: Add one to the string length to include the null terminator.
268  * The ACPI spec is unclear on this subject, but there is existing
269  * ASL/AML code that depends on the null being transferred to the new
270  * buffer.
271  */
272  ReturnDesc = AcpiUtCreateBufferObject ((ACPI_SIZE)
273  ObjDesc->String.Length + 1);
274  if (!ReturnDesc)
275  {
277  }
278 
279  /* Copy the string to the buffer */
280 
281  NewBuf = ReturnDesc->Buffer.Pointer;
282  strncpy ((char *) NewBuf, (char *) ObjDesc->String.Pointer,
283  ObjDesc->String.Length);
284  break;
285 
286  default:
287 
289  }
290 
291  /* Mark buffer initialized */
292 
293  ReturnDesc->Common.Flags |= AOPOBJ_DATA_VALID;
294  *ResultDesc = ReturnDesc;
296 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_TYPE_BUFFER
Definition: actypes.h:681
#define ACPI_TYPE_INTEGER
Definition: actypes.h:679
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
ACPI_OPERAND_OBJECT * AcpiUtCreateBufferObject(ACPI_SIZE BufferSize)
Definition: utobject.c:258
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:519
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:517
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define AE_TYPE
Definition: acexcep.h:116
ACPI_OBJECT_STRING String
Definition: acobject.h:518
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
#define ACPI_TYPE_STRING
Definition: actypes.h:680
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiExConvertToTargetType(), AcpiExDoConcatenate(), AcpiExDoLogicalOp(), AcpiExOpcode_1A_1T_1R(), AcpiExResolveOperands(), and AcpiNsConvertToBuffer().

◆ AcpiExConvertToInteger()

ACPI_STATUS AcpiExConvertToInteger ( ACPI_OPERAND_OBJECT ObjDesc,
ACPI_OPERAND_OBJECT **  ResultDesc,
UINT32  ImplicitConversion 
)

Definition at line 79 of file exconvrt.c.

83 {
84  ACPI_OPERAND_OBJECT *ReturnDesc;
85  UINT8 *Pointer;
86  UINT64 Result;
87  UINT32 i;
88  UINT32 Count;
89 
90 
91  ACPI_FUNCTION_TRACE_PTR (ExConvertToInteger, ObjDesc);
92 
93 
94  switch (ObjDesc->Common.Type)
95  {
96  case ACPI_TYPE_INTEGER:
97 
98  /* No conversion necessary */
99 
100  *ResultDesc = ObjDesc;
102 
103  case ACPI_TYPE_BUFFER:
104  case ACPI_TYPE_STRING:
105 
106  /* Note: Takes advantage of common buffer/string fields */
107 
108  Pointer = ObjDesc->Buffer.Pointer;
109  Count = ObjDesc->Buffer.Length;
110  break;
111 
112  default:
113 
115  }
116 
117  /*
118  * Convert the buffer/string to an integer. Note that both buffers and
119  * strings are treated as raw data - we don't convert ascii to hex for
120  * strings.
121  *
122  * There are two terminating conditions for the loop:
123  * 1) The size of an integer has been reached, or
124  * 2) The end of the buffer or string has been reached
125  */
126  Result = 0;
127 
128  /* String conversion is different than Buffer conversion */
129 
130  switch (ObjDesc->Common.Type)
131  {
132  case ACPI_TYPE_STRING:
133  /*
134  * Convert string to an integer - for most cases, the string must be
135  * hexadecimal as per the ACPI specification. The only exception (as
136  * of ACPI 3.0) is that the ToInteger() operator allows both decimal
137  * and hexadecimal strings (hex prefixed with "0x").
138  *
139  * Explicit conversion is used only by ToInteger.
140  * All other string-to-integer conversions are implicit conversions.
141  */
142  if (ImplicitConversion)
143  {
144  Result = AcpiUtImplicitStrtoul64 (ACPI_CAST_PTR (char, Pointer));
145  }
146  else
147  {
148  Result = AcpiUtExplicitStrtoul64 (ACPI_CAST_PTR (char, Pointer));
149  }
150  break;
151 
152  case ACPI_TYPE_BUFFER:
153 
154  /* Check for zero-length buffer */
155 
156  if (!Count)
157  {
159  }
160 
161  /* Transfer no more than an integer's worth of data */
162 
163  if (Count > AcpiGbl_IntegerByteWidth)
164  {
165  Count = AcpiGbl_IntegerByteWidth;
166  }
167 
168  /*
169  * Convert buffer to an integer - we simply grab enough raw data
170  * from the buffer to fill an integer
171  */
172  for (i = 0; i < Count; i++)
173  {
174  /*
175  * Get next byte and shift it into the Result.
176  * Little endian is used, meaning that the first byte of the buffer
177  * is the LSB of the integer
178  */
179  Result |= (((UINT64) Pointer[i]) << (i * 8));
180  }
181  break;
182 
183  default:
184 
185  /* No other types can get here */
186 
187  break;
188  }
189 
190  /* Create a new integer */
191 
192  ReturnDesc = AcpiUtCreateIntegerObject (Result);
193  if (!ReturnDesc)
194  {
196  }
197 
198  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
200 
201  /* Save the Result */
202 
203  (void) AcpiExTruncateFor32bitTable (ReturnDesc);
204  *ResultDesc = ReturnDesc;
206 }
#define AE_AML_BUFFER_LIMIT
Definition: acexcep.h:189
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_TYPE_BUFFER
Definition: actypes.h:681
#define ACPI_TYPE_INTEGER
Definition: actypes.h:679
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT32
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:519
ACPI_OPERAND_OBJECT * AcpiUtCreateIntegerObject(UINT64 Value)
Definition: utobject.c:223
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
UINT64 AcpiUtImplicitStrtoul64(char *String)
Definition: utstrtoul64.c:259
#define AE_TYPE
Definition: acexcep.h:116
#define ACPI_DB_EXEC
Definition: acoutput.h:165
BOOLEAN AcpiExTruncateFor32bitTable(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: exutils.c:177
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
#define ACPI_TYPE_STRING
Definition: actypes.h:680
unsigned long long UINT64
UINT64 AcpiUtExplicitStrtoul64(char *String)
Definition: utstrtoul64.c:347
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiDsGetPredicateValue(), AcpiExConvertToTargetType(), AcpiExDoConcatenate(), AcpiExDoLogicalOp(), AcpiExOpcode_1A_1T_1R(), and AcpiExResolveOperands().

◆ AcpiExConvertToString()

ACPI_STATUS AcpiExConvertToString ( ACPI_OPERAND_OBJECT ObjDesc,
ACPI_OPERAND_OBJECT **  ResultDesc,
UINT32  Type 
)

Definition at line 440 of file exconvrt.c.

444 {
445  ACPI_OPERAND_OBJECT *ReturnDesc;
446  UINT8 *NewBuf;
447  UINT32 i;
448  UINT32 StringLength = 0;
449  UINT16 Base = 16;
450  UINT8 Separator = ',';
451 
452 
453  ACPI_FUNCTION_TRACE_PTR (ExConvertToString, ObjDesc);
454 
455 
456  switch (ObjDesc->Common.Type)
457  {
458  case ACPI_TYPE_STRING:
459 
460  /* No conversion necessary */
461 
462  *ResultDesc = ObjDesc;
464 
465  case ACPI_TYPE_INTEGER:
466 
467  switch (Type)
468  {
470  /*
471  * From ToDecimalString, integer source.
472  *
473  * Make room for the maximum decimal number size
474  */
475  StringLength = ACPI_MAX_DECIMAL_DIGITS;
476  Base = 10;
477  break;
478 
479  default:
480 
481  /* Two hex string characters for each integer byte */
482 
483  StringLength = ACPI_MUL_2 (AcpiGbl_IntegerByteWidth);
484  break;
485  }
486 
487  /*
488  * Create a new String
489  * Need enough space for one ASCII integer (plus null terminator)
490  */
491  ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) StringLength);
492  if (!ReturnDesc)
493  {
495  }
496 
497  NewBuf = ReturnDesc->Buffer.Pointer;
498 
499  /* Convert integer to string */
500 
501  StringLength = AcpiExConvertToAscii (
502  ObjDesc->Integer.Value, Base, NewBuf, AcpiGbl_IntegerByteWidth);
503 
504  /* Null terminate at the correct place */
505 
506  ReturnDesc->String.Length = StringLength;
507  NewBuf [StringLength] = 0;
508  break;
509 
510  case ACPI_TYPE_BUFFER:
511 
512  /* Setup string length, base, and separator */
513 
514  switch (Type)
515  {
516  case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by ToDecimalString */
517  /*
518  * Explicit conversion from the ToDecimalString ASL operator.
519  *
520  * From ACPI: "If the input is a buffer, it is converted to a
521  * a string of decimal values separated by commas."
522  */
523  Base = 10;
524 
525  /*
526  * Calculate the final string length. Individual string values
527  * are variable length (include separator for each)
528  */
529  for (i = 0; i < ObjDesc->Buffer.Length; i++)
530  {
531  if (ObjDesc->Buffer.Pointer[i] >= 100)
532  {
533  StringLength += 4;
534  }
535  else if (ObjDesc->Buffer.Pointer[i] >= 10)
536  {
537  StringLength += 3;
538  }
539  else
540  {
541  StringLength += 2;
542  }
543  }
544  break;
545 
547  /*
548  * Implicit buffer-to-string conversion
549  *
550  * From the ACPI spec:
551  * "The entire contents of the buffer are converted to a string of
552  * two-character hexadecimal numbers, each separated by a space."
553  *
554  * Each hex number is prefixed with 0x (11/2018)
555  */
556  Separator = ' ';
557  StringLength = (ObjDesc->Buffer.Length * 5);
558  break;
559 
561  /*
562  * Explicit conversion from the ToHexString ASL operator.
563  *
564  * From ACPI: "If Data is a buffer, it is converted to a string of
565  * hexadecimal values separated by commas."
566  *
567  * Each hex number is prefixed with 0x (11/2018)
568  */
569  Separator = ',';
570  StringLength = (ObjDesc->Buffer.Length * 5);
571  break;
572 
573  default:
575  }
576 
577  /*
578  * Create a new string object and string buffer
579  * (-1 because of extra separator included in StringLength from above)
580  * Allow creation of zero-length strings from zero-length buffers.
581  */
582  if (StringLength)
583  {
584  StringLength--;
585  }
586 
587  ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) StringLength);
588  if (!ReturnDesc)
589  {
591  }
592 
593  NewBuf = ReturnDesc->Buffer.Pointer;
594 
595  /*
596  * Convert buffer bytes to hex or decimal values
597  * (separated by commas or spaces)
598  */
599  for (i = 0; i < ObjDesc->Buffer.Length; i++)
600  {
601  if (Base == 16)
602  {
603  /* Emit 0x prefix for explicit/implicit hex conversion */
604 
605  *NewBuf++ = '0';
606  *NewBuf++ = 'x';
607  }
608 
609  NewBuf += AcpiExConvertToAscii (
610  (UINT64) ObjDesc->Buffer.Pointer[i], Base, NewBuf, 1);
611 
612  /* Each digit is separated by either a comma or space */
613 
614  *NewBuf++ = Separator;
615  }
616 
617  /*
618  * Null terminate the string
619  * (overwrites final comma/space from above)
620  */
621  if (ObjDesc->Buffer.Length)
622  {
623  NewBuf--;
624  }
625  *NewBuf = 0;
626  break;
627 
628  default:
629 
631  }
632 
633  *ResultDesc = ReturnDesc;
635 }
Type
Definition: Type.h:6
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define ACPI_TYPE_BUFFER
Definition: actypes.h:681
#define ACPI_TYPE_INTEGER
Definition: actypes.h:679
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2343
#define ACPI_MAX_DECIMAL_DIGITS
Definition: actypes.h:491
#define ACPI_EXPLICIT_CONVERT_HEX
Definition: acinterp.h:125
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT32
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_OPERAND_OBJECT * AcpiUtCreateStringObject(ACPI_SIZE StringSize)
Definition: utobject.c:320
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:519
#define ACPI_MUL_2(a)
Definition: acmacros.h:207
static UINT32 AcpiExConvertToAscii(UINT64 Integer, UINT16 Base, UINT8 *String, UINT8 MaxLength)
Definition: exconvrt.c:315
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:517
#define AE_TYPE
Definition: acexcep.h:116
ACPI_OBJECT_STRING String
Definition: acobject.h:518
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
unsigned short UINT16
#define ACPI_TYPE_STRING
Definition: actypes.h:680
unsigned long long UINT64
unsigned char UINT8
#define ACPI_EXPLICIT_CONVERT_DECIMAL
Definition: acinterp.h:127
#define AE_OK
Definition: acexcep.h:97
#define ACPI_IMPLICIT_CONVERT_HEX
Definition: acinterp.h:126

Referenced by AcpiExConvertToTargetType(), AcpiExDoConcatenate(), AcpiExDoLogicalOp(), AcpiExOpcode_1A_1T_1R(), AcpiExResolveOperands(), and AcpiNsConvertToString().

◆ AcpiExConvertToTargetType()

ACPI_STATUS AcpiExConvertToTargetType ( ACPI_OBJECT_TYPE  DestinationType,
ACPI_OPERAND_OBJECT SourceDesc,
ACPI_OPERAND_OBJECT **  ResultDesc,
ACPI_WALK_STATE WalkState 
)

Definition at line 654 of file exconvrt.c.

659 {
661 
662 
663  ACPI_FUNCTION_TRACE (ExConvertToTargetType);
664 
665 
666  /* Default behavior */
667 
668  *ResultDesc = SourceDesc;
669 
670  /*
671  * If required by the target,
672  * perform implicit conversion on the source before we store it.
673  */
674  switch (GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs))
675  {
676  case ARGI_SIMPLE_TARGET:
677  case ARGI_FIXED_TARGET:
678  case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */
679 
680  switch (DestinationType)
681  {
683  /*
684  * Named field can always handle conversions
685  */
686  break;
687 
688  default:
689 
690  /* No conversion allowed for these types */
691 
692  if (DestinationType != SourceDesc->Common.Type)
693  {
695  "Explicit operator, will store (%s) over existing type (%s)\n",
696  AcpiUtGetObjectTypeName (SourceDesc),
697  AcpiUtGetTypeName (DestinationType)));
698  Status = AE_TYPE;
699  }
700  }
701  break;
702 
703  case ARGI_TARGETREF:
704  case ARGI_STORE_TARGET:
705 
706  switch (DestinationType)
707  {
708  case ACPI_TYPE_INTEGER:
712  /*
713  * These types require an Integer operand. We can convert
714  * a Buffer or a String to an Integer if necessary.
715  */
716  Status = AcpiExConvertToInteger (SourceDesc, ResultDesc,
718  break;
719 
720  case ACPI_TYPE_STRING:
721  /*
722  * The operand must be a String. We can convert an
723  * Integer or Buffer if necessary
724  */
725  Status = AcpiExConvertToString (SourceDesc, ResultDesc,
727  break;
728 
729  case ACPI_TYPE_BUFFER:
730  /*
731  * The operand must be a Buffer. We can convert an
732  * Integer or String if necessary
733  */
734  Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc);
735  break;
736 
737  default:
738 
740  "Bad destination type during conversion: 0x%X",
741  DestinationType));
743  break;
744  }
745  break;
746 
747  case ARGI_REFERENCE:
748  /*
749  * CreateXxxxField cases - we are storing the field object into the name
750  */
751  break;
752 
753  default:
754 
756  "Unknown Target type ID 0x%X AmlOpcode 0x%X DestType %s",
758  WalkState->Opcode, AcpiUtGetTypeName (DestinationType)));
760  }
761 
762  /*
763  * Source-to-Target conversion semantics:
764  *
765  * If conversion to the target type cannot be performed, then simply
766  * overwrite the target with the new object and type.
767  */
768  if (Status == AE_TYPE)
769  {
770  Status = AE_OK;
771  }
772 
774 }
#define ARGI_INTEGER_REF
Definition: amlcode.h:276
#define ACPI_TYPE_BUFFER
Definition: actypes.h:681
#define ACPI_TYPE_INTEGER
Definition: actypes.h:679
#define AE_AML_INTERNAL
Definition: acexcep.h:194
#define ARGI_SIMPLE_TARGET
Definition: amlcode.h:282
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_TYPE_LOCAL_INDEX_FIELD
Definition: actypes.h:709
#define AE_INFO
Definition: acoutput.h:230
#define ARGI_REFERENCE
Definition: amlcode.h:279
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
ACPI_STATUS AcpiExConvertToString(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, UINT32 Type)
Definition: exconvrt.c:440
const ACPI_OPCODE_INFO * OpInfo
Definition: acstruct.h:119
#define ACPI_TYPE_LOCAL_REGION_FIELD
Definition: actypes.h:707
ACPI_STATUS AcpiExConvertToInteger(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, UINT32 ImplicitConversion)
Definition: exconvrt.c:79
#define AE_TYPE
Definition: acexcep.h:116
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_INFO
Definition: acoutput.h:153
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_TYPE_BUFFER_FIELD
Definition: actypes.h:692
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
const char * AcpiUtGetTypeName(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:249
#define GET_CURRENT_ARG_TYPE(List)
Definition: acmacros.h:450
#define ARGI_TARGETREF
Definition: amlcode.h:280
ACPI_STATUS AcpiExConvertToBuffer(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc)
Definition: exconvrt.c:224
#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_TYPE_STRING
Definition: actypes.h:680
UINT32 RuntimeArgs
Definition: aclocal.h:872
const char * AcpiUtGetObjectTypeName(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: utdecode.c:263
#define ARGI_FIXED_TARGET
Definition: amlcode.h:281
#define AE_OK
Definition: acexcep.h:97
#define ARGI_STORE_TARGET
Definition: amlcode.h:283
#define ACPI_IMPLICIT_CONVERT_HEX
Definition: acinterp.h:126
#define ACPI_IMPLICIT_CONVERSION
Definition: acutils.h:144

Referenced by AcpiExStoreObjectToObject().

◆ AcpiExCopyDataToNamedField()

ACPI_STATUS AcpiExCopyDataToNamedField ( ACPI_OPERAND_OBJECT SourceDesc,
ACPI_NAMESPACE_NODE Node 
)

◆ AcpiExCopyIntegerToBankField()

ACPI_STATUS AcpiExCopyIntegerToBankField ( ACPI_OPERAND_OBJECT SourceDesc,
ACPI_OPERAND_OBJECT TargetDesc 
)

◆ AcpiExCopyIntegerToBufferField()

ACPI_STATUS AcpiExCopyIntegerToBufferField ( ACPI_OPERAND_OBJECT SourceDesc,
ACPI_OPERAND_OBJECT TargetDesc 
)

◆ AcpiExCopyIntegerToIndexField()

ACPI_STATUS AcpiExCopyIntegerToIndexField ( ACPI_OPERAND_OBJECT SourceDesc,
ACPI_OPERAND_OBJECT TargetDesc 
)

◆ AcpiExCreateAlias()

ACPI_STATUS AcpiExCreateAlias ( ACPI_WALK_STATE WalkState)

Definition at line 68 of file excreate.c.

70 {
71  ACPI_NAMESPACE_NODE *TargetNode;
72  ACPI_NAMESPACE_NODE *AliasNode;
74 
75 
76  ACPI_FUNCTION_TRACE (ExCreateAlias);
77 
78 
79  /* Get the source/alias operands (both namespace nodes) */
80 
81  AliasNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
82  TargetNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[1];
83 
84  if ((TargetNode->Type == ACPI_TYPE_LOCAL_ALIAS) ||
85  (TargetNode->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS))
86  {
87  /*
88  * Dereference an existing alias so that we don't create a chain
89  * of aliases. With this code, we guarantee that an alias is
90  * always exactly one level of indirection away from the
91  * actual aliased name.
92  */
93  TargetNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, TargetNode->Object);
94  }
95 
96  /* Ensure that the target node is valid */
97 
98  if (!TargetNode)
99  {
101  }
102 
103  /* Construct the alias object (a namespace node) */
104 
105  switch (TargetNode->Type)
106  {
107  case ACPI_TYPE_METHOD:
108  /*
109  * Control method aliases need to be differentiated with
110  * a special type
111  */
112  AliasNode->Type = ACPI_TYPE_LOCAL_METHOD_ALIAS;
113  break;
114 
115  default:
116  /*
117  * All other object types.
118  *
119  * The new alias has the type ALIAS and points to the original
120  * NS node, not the object itself.
121  */
122  AliasNode->Type = ACPI_TYPE_LOCAL_ALIAS;
123  AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode);
124  break;
125  }
126 
127  /* Since both operands are Nodes, we don't need to delete them */
128 
129  AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode);
131 }
#define AE_NULL_OBJECT
Definition: acexcep.h:117
union acpi_operand_object * Object
Definition: aclocal.h:187
#define ACPI_TYPE_LOCAL_ALIAS
Definition: actypes.h:711
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_TYPE_LOCAL_METHOD_ALIAS
Definition: actypes.h:712
#define ACPI_TYPE_METHOD
Definition: actypes.h:686
Status
Definition: gdiplustypes.h:24
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiDsLoad2EndOp().

◆ AcpiExCreateEvent()

ACPI_STATUS AcpiExCreateEvent ( ACPI_WALK_STATE WalkState)

Definition at line 147 of file excreate.c.

149 {
151  ACPI_OPERAND_OBJECT *ObjDesc;
152 
153 
154  ACPI_FUNCTION_TRACE (ExCreateEvent);
155 
156 
158  if (!ObjDesc)
159  {
161  goto Cleanup;
162  }
163 
164  /*
165  * Create the actual OS semaphore, with zero initial units -- meaning
166  * that the event is created in an unsignalled state
167  */
169  &ObjDesc->Event.OsSemaphore);
170  if (ACPI_FAILURE (Status))
171  {
172  goto Cleanup;
173  }
174 
175  /* Attach object to the Node */
176 
178  (ACPI_NAMESPACE_NODE *) WalkState->Operands[0],
179  ObjDesc, ACPI_TYPE_EVENT);
180 
181 Cleanup:
182  /*
183  * Remove local reference to the object (on error, will cause deletion
184  * of both object and semaphore if present.)
185  */
186  AcpiUtRemoveReference (ObjDesc);
188 }
#define ACPI_TYPE_EVENT
Definition: actypes.h:685
#define AE_NO_MEMORY
Definition: acexcep.h:112
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_OBJECT_EVENT Event
Definition: acobject.h:521
ACPI_STATUS AcpiOsCreateSemaphore(UINT32 MaxUnits, UINT32 InitialUnits, ACPI_SEMAPHORE *OutHandle)
Definition: osl.c:352
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
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_FUNCTION_TRACE(a)
Definition: acoutput.h:480
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_NO_UNIT_LIMIT
Definition: acpiosxf.h:67
ACPI_OBJECT_COMMON_HEADER ACPI_SEMAPHORE OsSemaphore
Definition: acobject.h:178
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:655

Referenced by AcpiDsLoad2EndOp().

◆ AcpiExCreateMethod()

ACPI_STATUS AcpiExCreateMethod ( UINT8 AmlStart,
UINT32  AmlLength,
ACPI_WALK_STATE WalkState 
)

Definition at line 483 of file excreate.c.

487 {
488  ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
489  ACPI_OPERAND_OBJECT *ObjDesc;
491  UINT8 MethodFlags;
492 
493 
494  ACPI_FUNCTION_TRACE_PTR (ExCreateMethod, WalkState);
495 
496 
497  /* Create a new method object */
498 
500  if (!ObjDesc)
501  {
503  goto Exit;
504  }
505 
506  /* Save the method's AML pointer and length */
507 
508  ObjDesc->Method.AmlStart = AmlStart;
509  ObjDesc->Method.AmlLength = AmlLength;
510  ObjDesc->Method.Node = Operand[0];
511 
512  /*
513  * Disassemble the method flags. Split off the ArgCount, Serialized
514  * flag, and SyncLevel for efficiency.
515  */
516  MethodFlags = (UINT8) Operand[1]->Integer.Value;
517  ObjDesc->Method.ParamCount = (UINT8)
518  (MethodFlags & AML_METHOD_ARG_COUNT);
519 
520  /*
521  * Get the SyncLevel. If method is serialized, a mutex will be
522  * created for this method when it is parsed.
523  */
524  if (MethodFlags & AML_METHOD_SERIALIZED)
525  {
527 
528  /*
529  * ACPI 1.0: SyncLevel = 0
530  * ACPI 2.0: SyncLevel = SyncLevel in method declaration
531  */
532  ObjDesc->Method.SyncLevel = (UINT8)
533  ((MethodFlags & AML_METHOD_SYNC_LEVEL) >> 4);
534  }
535 
536  /* Attach the new object to the method Node */
537 
539  ObjDesc, ACPI_TYPE_METHOD);
540 
541  /* Remove local reference to the object */
542 
543  AcpiUtRemoveReference (ObjDesc);
544 
545 Exit:
546  /* Remove a reference to the operand */
547 
548  AcpiUtRemoveReference (Operand[1]);
550 }
UINT8 * AmlStart
Definition: acobject.h:220
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_METHOD_SERIALIZED
Definition: acobject.h:237
ACPI_OBJECT_COMMON_HEADER UINT8 InfoFlags
Definition: acobject.h:215
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define AML_METHOD_SERIALIZED
Definition: amlcode.h:506
#define AML_METHOD_ARG_COUNT
Definition: amlcode.h:505
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define AML_METHOD_SYNC_LEVEL
Definition: amlcode.h:507
#define ACPI_TYPE_METHOD
Definition: actypes.h:686
static void Exit(void)
Definition: sock.c:1331
Status
Definition: gdiplustypes.h:24
ACPI_OBJECT_METHOD Method
Definition: acobject.h:522
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
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
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:655
unsigned char UINT8
union acpi_operand_object * Node
Definition: acobject.h:219

Referenced by AcpiDsLoad1EndOp(), and AcpiDsLoad2EndOp().

◆ AcpiExCreateMutex()

ACPI_STATUS AcpiExCreateMutex ( ACPI_WALK_STATE WalkState)

Definition at line 206 of file excreate.c.

208 {
210  ACPI_OPERAND_OBJECT *ObjDesc;
211 
212 
214 
215 
216  /* Create the new mutex object */
217 
219  if (!ObjDesc)
220  {
222  goto Cleanup;
223  }
224 
225  /* Create the actual OS Mutex */
226 
227  Status = AcpiOsCreateMutex (&ObjDesc->Mutex.OsMutex);
228  if (ACPI_FAILURE (Status))
229  {
230  goto Cleanup;
231  }
232 
233  /* Init object and attach to NS node */
234 
235  ObjDesc->Mutex.SyncLevel = (UINT8) WalkState->Operands[1]->Integer.Value;
236  ObjDesc->Mutex.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
237 
239  ObjDesc->Mutex.Node, ObjDesc, ACPI_TYPE_MUTEX);
240 
241 
242 Cleanup:
243  /*
244  * Remove local reference to the object (on error, will cause deletion
245  * of both object and semaphore if present.)
246  */
247  AcpiUtRemoveReference (ObjDesc);
249 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
ACPI_MUTEX OsMutex
Definition: acobject.h:188
ACPI_OBJECT_MUTEX Mutex
Definition: acobject.h:523
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_OBJECT_COMMON_HEADER UINT8 SyncLevel
Definition: acobject.h:186
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:517
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
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
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_TYPE_MUTEX
Definition: actypes.h:687
ACPI_STATUS AcpiOsCreateMutex(ACPI_MUTEX *OutHandle)
Definition: osl.c:271
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:655
#define ACPI_WALK_OPERANDS
Definition: acinterp.h:48
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97
ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:193

Referenced by AcpiDsLoad2EndOp().

◆ AcpiExCreatePowerResource()

ACPI_STATUS AcpiExCreatePowerResource ( ACPI_WALK_STATE WalkState)

Definition at line 432 of file excreate.c.

434 {
435  ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
437  ACPI_OPERAND_OBJECT *ObjDesc;
438 
439 
440  ACPI_FUNCTION_TRACE_PTR (ExCreatePowerResource, WalkState);
441 
442 
443  /* Create the power resource object */
444 
446  if (!ObjDesc)
447  {
449  }
450 
451  /* Initialize the power object from the operands */
452 
453  ObjDesc->PowerResource.SystemLevel = (UINT8) Operand[1]->Integer.Value;
454  ObjDesc->PowerResource.ResourceOrder = (UINT16) Operand[2]->Integer.Value;
455 
456  /* Install the power resource object in the parent Node */
457 
459  ObjDesc, ACPI_TYPE_POWER);
460 
461  /* Remove local reference to the object */
462 
463  AcpiUtRemoveReference (ObjDesc);
465 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_TYPE_POWER
Definition: actypes.h:689
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO UINT32 SystemLevel
Definition: acobject.h:279
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_OBJECT_POWER_RESOURCE PowerResource
Definition: acobject.h:527
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:517
Status
Definition: gdiplustypes.h:24
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
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
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
unsigned short UINT16
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:655
unsigned char UINT8

Referenced by AcpiDsLoad2EndOp().

◆ AcpiExCreateProcessor()

ACPI_STATUS AcpiExCreateProcessor ( ACPI_WALK_STATE WalkState)

Definition at line 380 of file excreate.c.

382 {
383  ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
384  ACPI_OPERAND_OBJECT *ObjDesc;
386 
387 
388  ACPI_FUNCTION_TRACE_PTR (ExCreateProcessor, WalkState);
389 
390 
391  /* Create the processor object */
392 
394  if (!ObjDesc)
395  {
397  }
398 
399  /* Initialize the processor object from the operands */
400 
401  ObjDesc->Processor.ProcId = (UINT8) Operand[1]->Integer.Value;
402  ObjDesc->Processor.Length = (UINT8) Operand[3]->Integer.Value;
403  ObjDesc->Processor.Address = (ACPI_IO_ADDRESS) Operand[2]->Integer.Value;
404 
405  /* Install the processor object in the parent Node */
406 
408  ObjDesc, ACPI_TYPE_PROCESSOR);
409 
410  /* Remove local reference to the object */
411 
412  AcpiUtRemoveReference (ObjDesc);
414 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
ACPI_OBJECT_PROCESSOR Processor
Definition: acobject.h:528
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_COMMON_NOTIFY_INFO ACPI_IO_ADDRESS Address
Definition: acobject.h:294
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:517
#define ACPI_TYPE_PROCESSOR
Definition: actypes.h:690
Status
Definition: gdiplustypes.h:24
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
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
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:655
ACPI_OBJECT_COMMON_HEADER UINT8 ProcId
Definition: acobject.h:291
unsigned char UINT8

Referenced by AcpiDsLoad2EndOp().

◆ AcpiExCreateRegion()

ACPI_STATUS AcpiExCreateRegion ( UINT8 AmlStart,
UINT32  AmlLength,
UINT8  RegionSpace,
ACPI_WALK_STATE WalkState 
)

Definition at line 268 of file excreate.c.

273 {
275  ACPI_OPERAND_OBJECT *ObjDesc;
277  ACPI_OPERAND_OBJECT *RegionObj2;
278 
279 
280  ACPI_FUNCTION_TRACE (ExCreateRegion);
281 
282 
283  /* Get the Namespace Node */
284 
285  Node = WalkState->Op->Common.Node;
286 
287  /*
288  * If the region object is already attached to this node,
289  * just return
290  */
292  {
294  }
295 
296  /*
297  * Space ID must be one of the predefined IDs, or in the user-defined
298  * range
299  */
301  {
302  /*
303  * Print an error message, but continue. We don't want to abort
304  * a table load for this exception. Instead, if the region is
305  * actually used at runtime, abort the executing method.
306  */
308  "Invalid/unknown Address Space ID: 0x%2.2X", SpaceId));
309  }
310 
311  ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n",
313 
314  /* Create the region descriptor */
315 
317  if (!ObjDesc)
318  {
320  goto Cleanup;
321  }
322 
323  /*
324  * Remember location in AML stream of address & length
325  * operands since they need to be evaluated at run time.
326  */
327  RegionObj2 = AcpiNsGetSecondaryObject (ObjDesc);
328  RegionObj2->Extra.AmlStart = AmlStart;
329  RegionObj2->Extra.AmlLength = AmlLength;
330  RegionObj2->Extra.Method_REG = NULL;
331  if (WalkState->ScopeInfo)
332  {
333  RegionObj2->Extra.ScopeNode = WalkState->ScopeInfo->Scope.Node;
334  }
335  else
336  {
337  RegionObj2->Extra.ScopeNode = Node;
338  }
339 
340  /* Init the region from the operands */
341 
342  ObjDesc->Region.SpaceId = SpaceId;
343  ObjDesc->Region.Address = 0;
344  ObjDesc->Region.Length = 0;
345  ObjDesc->Region.Node = Node;
346  ObjDesc->Region.Handler = NULL;
347  ObjDesc->Common.Flags &=
350 
351  /* Install the new region object in the parent Node */
352 
354 
355 
356 Cleanup:
357 
358  /* Remove local reference to the object */
359 
360  AcpiUtRemoveReference (ObjDesc);
362 }
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
union acpi_operand_object * Handler
Definition: acobject.h:204
#define ACPI_DB_LOAD
Definition: acoutput.h:164
#define AE_NO_MEMORY
Definition: acexcep.h:112
ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:203
ACPI_NAMESPACE_NODE * ScopeNode
Definition: acobject.h:479
BOOLEAN AcpiIsValidSpaceId(UINT8 SpaceId)
Definition: exutils.c:494
UINT8 * AmlStart
Definition: acobject.h:481
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_OBJECT_COMMON_HEADER UINT8 SpaceId
Definition: acobject.h:202
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 ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE SpaceId
Definition: acpixf.h:828
ACPI_OBJECT_EXTRA Extra
Definition: acobject.h:538
const char * AcpiUtGetRegionName(UINT8 SpaceId)
Definition: utdecode.c:124
union node Node
Definition: types.h:1255
#define AOPOBJ_SETUP_COMPLETE
Definition: acobject.h:99
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
ACPI_OBJECT_REGION Region
Definition: acobject.h:524
ACPI_PARSE_OBJECT * Op
Definition: acstruct.h:118
#define AOPOBJ_OBJECT_INITIALIZED
Definition: acobject.h:97
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
#define AOPOBJ_REG_CONNECTED
Definition: acobject.h:98
ACPI_OBJECT_COMMON_HEADER ACPI_NAMESPACE_NODE * Method_REG
Definition: acobject.h:478
static const WCHAR Cleanup[]
Definition: register.c:80
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_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
ACPI_STATE_COMMON ACPI_NAMESPACE_NODE * Node
Definition: aclocal.h:740
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
ACPI_PHYSICAL_ADDRESS Address
Definition: acobject.h:206
#define ACPI_TYPE_REGION
Definition: actypes.h:688
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:655
#define AE_OK
Definition: acexcep.h:97
ACPI_SCOPE_STATE Scope
Definition: aclocal.h:825
ACPI_OPERAND_OBJECT * AcpiNsGetSecondaryObject(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: nsobject.c:346
UINT32 AmlLength
Definition: acobject.h:482
Definition: dlist.c:348

Referenced by AcpiDsLoad1EndOp(), and AcpiDsLoad2EndOp().

◆ AcpiExDataTableSpaceHandler()

ACPI_STATUS AcpiExDataTableSpaceHandler ( UINT32  Function,
ACPI_PHYSICAL_ADDRESS  Address,
UINT32  BitWidth,
UINT64 Value,
void HandlerContext,
void RegionContext 
)

Definition at line 543 of file exregion.c.

550 {
551  ACPI_FUNCTION_TRACE (ExDataTableSpaceHandler);
552 
553 
554  /*
555  * Perform the memory read or write. The BitWidth was already
556  * validated.
557  */
558  switch (Function)
559  {
560  case ACPI_READ:
561 
563  ACPI_DIV_8 (BitWidth));
564  break;
565 
566  case ACPI_WRITE:
567 
569  ACPI_DIV_8 (BitWidth));
570  break;
571 
572  default:
573 
575  }
576 
578 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define ACPI_READ
Definition: actypes.h:742
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
static LPOVERLAPPED_COMPLETION_ROUTINE Function
Definition: sync.c:684
static WCHAR Address[46]
Definition: ping.c:68
#define ACPI_PHYSADDR_TO_PTR(i)
Definition: actypes.h:555
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ACPI_DIV_8(a)
Definition: acmacros.h:214
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define AE_OK
Definition: acexcep.h:97
#define ACPI_WRITE
Definition: actypes.h:743

Referenced by AcpiEvInstallSpaceHandler().

◆ AcpiExDoConcatenate()

ACPI_STATUS AcpiExDoConcatenate ( ACPI_OPERAND_OBJECT ObjDesc,
ACPI_OPERAND_OBJECT ObjDesc2,
ACPI_OPERAND_OBJECT **  ActualReturnDesc,
ACPI_WALK_STATE WalkState 
)

Definition at line 85 of file exconcat.c.

90 {
91  ACPI_OPERAND_OBJECT *LocalOperand0 = Operand0;
92  ACPI_OPERAND_OBJECT *LocalOperand1 = Operand1;
93  ACPI_OPERAND_OBJECT *TempOperand1 = NULL;
94  ACPI_OPERAND_OBJECT *ReturnDesc;
95  char *Buffer;
96  ACPI_OBJECT_TYPE Operand0Type;
97  ACPI_OBJECT_TYPE Operand1Type;
99 
100 
101  ACPI_FUNCTION_TRACE (ExDoConcatenate);
102 
103 
104  /* Operand 0 preprocessing */
105 
106  switch (Operand0->Common.Type)
107  {
108  case ACPI_TYPE_INTEGER:
109  case ACPI_TYPE_STRING:
110  case ACPI_TYPE_BUFFER:
111 
112  Operand0Type = Operand0->Common.Type;
113  break;
114 
115  default:
116 
117  /* For all other types, get the "object type" string */
118 
120  Operand0, &LocalOperand0);
121  if (ACPI_FAILURE (Status))
122  {
123  goto Cleanup;
124  }
125 
126  Operand0Type = ACPI_TYPE_STRING;
127  break;
128  }
129 
130  /* Operand 1 preprocessing */
131 
132  switch (Operand1->Common.Type)
133  {
134  case ACPI_TYPE_INTEGER:
135  case ACPI_TYPE_STRING:
136  case ACPI_TYPE_BUFFER:
137 
138  Operand1Type = Operand1->Common.Type;
139  break;
140 
141  default:
142 
143  /* For all other types, get the "object type" string */
144 
146  Operand1, &LocalOperand1);
147  if (ACPI_FAILURE (Status))
148  {
149  goto Cleanup;
150  }
151 
152  Operand1Type = ACPI_TYPE_STRING;
153  break;
154  }
155 
156  /*
157  * Convert the second operand if necessary. The first operand (0)
158  * determines the type of the second operand (1) (See the Data Types
159  * section of the ACPI specification). Both object types are
160  * guaranteed to be either Integer/String/Buffer by the operand
161  * resolution mechanism.
162  */
163  switch (Operand0Type)
164  {
165  case ACPI_TYPE_INTEGER:
166 
167  Status = AcpiExConvertToInteger (LocalOperand1, &TempOperand1,
169  break;
170 
171  case ACPI_TYPE_BUFFER:
172 
173  Status = AcpiExConvertToBuffer (LocalOperand1, &TempOperand1);
174  break;
175 
176  case ACPI_TYPE_STRING:
177 
178  switch (Operand1Type)
179  {
180  case ACPI_TYPE_INTEGER:
181  case ACPI_TYPE_STRING:
182  case ACPI_TYPE_BUFFER:
183 
184  /* Other types have already been converted to string */
185 
187  LocalOperand1, &TempOperand1, ACPI_IMPLICIT_CONVERT_HEX);
188  break;
189 
190  default:
191 
192  Status = AE_OK;
193  break;
194  }
195  break;
196 
197  default:
198 
199  ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X",
200  Operand0->Common.Type));
202  }
203 
204  if (ACPI_FAILURE (Status))
205  {
206  goto Cleanup;
207  }
208 
209  /* Take care with any newly created operand objects */
210 
211  if ((LocalOperand1 != Operand1) &&
212  (LocalOperand1 != TempOperand1))
213  {
214  AcpiUtRemoveReference (LocalOperand1);
215  }
216 
217  LocalOperand1 = TempOperand1;
218 
219  /*
220  * Both operands are now known to be the same object type
221  * (Both are Integer, String, or Buffer), and we can now perform
222  * the concatenation.
223  *
224  * There are three cases to handle, as per the ACPI spec:
225  *
226  * 1) Two Integers concatenated to produce a new Buffer
227  * 2) Two Strings concatenated to produce a new String
228  * 3) Two Buffers concatenated to produce a new Buffer
229  */
230  switch (Operand0Type)
231  {
232  case ACPI_TYPE_INTEGER:
233 
234  /* Result of two Integers is a Buffer */
235  /* Need enough buffer space for two integers */
236 
237  ReturnDesc = AcpiUtCreateBufferObject (
238  (ACPI_SIZE) ACPI_MUL_2 (AcpiGbl_IntegerByteWidth));
239  if (!ReturnDesc)
240  {
242  goto Cleanup;
243  }
244 
245  Buffer = (char *) ReturnDesc->Buffer.Pointer;
246 
247  /* Copy the first integer, LSB first */
248 
249  memcpy (Buffer, &Operand0->Integer.Value,
250  AcpiGbl_IntegerByteWidth);
251 
252  /* Copy the second integer (LSB first) after the first */
253 
254  memcpy (Buffer + AcpiGbl_IntegerByteWidth,
255  &LocalOperand1->Integer.Value, AcpiGbl_IntegerByteWidth);
256  break;
257 
258  case ACPI_TYPE_STRING:
259 
260  /* Result of two Strings is a String */
261 
262  ReturnDesc = AcpiUtCreateStringObject (
263  ((ACPI_SIZE) LocalOperand0->String.Length +
264  LocalOperand1->String.Length));
265  if (!ReturnDesc)
266  {
268  goto Cleanup;
269  }
270 
271  Buffer = ReturnDesc->String.Pointer;
272 
273  /* Concatenate the strings */
274 
275  strcpy (Buffer, LocalOperand0->String.Pointer);
276  strcat (Buffer, LocalOperand1->String.Pointer);
277  break;
278 
279  case ACPI_TYPE_BUFFER:
280 
281  /* Result of two Buffers is a Buffer */
282 
283  ReturnDesc = AcpiUtCreateBufferObject (
284  ((ACPI_SIZE) Operand0->Buffer.Length +
285  LocalOperand1->Buffer.Length));
286  if (!ReturnDesc)
287  {
289  goto Cleanup;
290  }
291 
292  Buffer = (char *) ReturnDesc->Buffer.Pointer;
293 
294  /* Concatenate the buffers */
295 
296  memcpy (Buffer, Operand0->Buffer.Pointer,
297  Operand0->Buffer.Length);
298  memcpy (Buffer + Operand0->Buffer.Length,
299  LocalOperand1->Buffer.Pointer,
300  LocalOperand1->Buffer.Length);
301  break;
302 
303  default:
304 
305  /* Invalid object type, should not happen here */
306 
307  ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X",
308  Operand0->Common.Type));
310  goto Cleanup;
311  }
312 
313  *ActualReturnDesc = ReturnDesc;
314 
315 Cleanup:
316  if (LocalOperand0 != Operand0)
317  {
318  AcpiUtRemoveReference (LocalOperand0);
319  }
320 
321  if (LocalOperand1 != Operand1)
322  {
323  AcpiUtRemoveReference (LocalOperand1);
324  }
325 
327 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define ACPI_TYPE_BUFFER
Definition: actypes.h:681
#define ACPI_TYPE_INTEGER
Definition: actypes.h:679
ACPI_OPERAND_OBJECT * AcpiUtCreateBufferObject(ACPI_SIZE BufferSize)
Definition: utobject.c:258
#define AE_AML_INTERNAL
Definition: acexcep.h:194
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
UINT32 ACPI_OBJECT_TYPE
Definition: actypes.h:676
Definition: bufpool.h:45
ACPI_OPERAND_OBJECT * AcpiUtCreateStringObject(ACPI_SIZE StringSize)
Definition: utobject.c:320
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:519
static ACPI_STATUS AcpiExConvertToObjectTypeString(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc)
Definition: exconcat.c:346
#define ACPI_MUL_2(a)
Definition: acmacros.h:207
ACPI_STATUS AcpiExConvertToString(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, UINT32 Type)
Definition: exconvrt.c:440
ACPI_STATUS AcpiExConvertToInteger(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, UINT32 ImplicitConversion)
Definition: exconvrt.c:79
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:517
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const WCHAR Cleanup[]
Definition: register.c:80
ACPI_OBJECT_STRING String
Definition: acobject.h:518
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
ACPI_STATUS AcpiExConvertToBuffer(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc)
Definition: exconvrt.c:224
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define ACPI_TYPE_STRING
Definition: actypes.h:680
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define AE_OK
Definition: acexcep.h:97
#define ACPI_IMPLICIT_CONVERT_HEX
Definition: acinterp.h:126
#define ACPI_IMPLICIT_CONVERSION
Definition: acutils.h:144

Referenced by AcpiExOpcode_2A_1T_1R().

◆ AcpiExDoDebugObject()

void AcpiExDoDebugObject ( ACPI_OPERAND_OBJECT SourceDesc,
UINT32  Level,
UINT32  Index 
)

Definition at line 77 of file exdebug.c.

81 {
82  UINT32 i;
83  UINT32 Timer;
84  ACPI_OPERAND_OBJECT *ObjectDesc;
85  UINT32 Value;
86 
87 
88  ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc);
89 
90 
91  /* Output must be enabled via the DebugObject global or the DbgLevel */
92 
93  if (!AcpiGbl_EnableAmlDebugObject &&
94  !(AcpiDbgLevel & ACPI_LV_DEBUG_OBJECT))
95  {
97  }
98 
99  /* Newline -- don't emit the line header */
100 
101  if (SourceDesc &&
103  (SourceDesc->Common.Type == ACPI_TYPE_STRING))
104  {
105  if ((SourceDesc->String.Length == 1) &&
106  (*SourceDesc->String.Pointer == '\n'))
107  {
108  AcpiOsPrintf ("\n");
109  return_VOID;
110  }
111  }
112 
113  /*
114  * Print line header as long as we are not in the middle of an
115  * object display
116  */
117  if (!((Level > 0) && Index == 0))
118  {
119  if (AcpiGbl_DisplayDebugTimer)
120  {
121  /*
122  * We will emit the current timer value (in microseconds) with each
123  * debug output. Only need the lower 26 bits. This allows for 67
124  * million microseconds or 67 seconds before rollover.
125  *
126  * Convert 100 nanosecond units to microseconds
127  */
128  Timer = ((UINT32) AcpiOsGetTimer () / 10);
129  Timer &= 0x03FFFFFF;
130 
131  AcpiOsPrintf ("ACPI Debug: T=0x%8.8X %*s", Timer, Level, " ");
132  }
133  else
134  {
135  AcpiOsPrintf ("ACPI Debug: %*s", Level, " ");
136  }
137  }
138 
139  /* Display the index for package output only */
140 
141  if (Index > 0)
142  {
143  AcpiOsPrintf ("(%.2u) ", Index - 1);
144  }
145 
146  if (!SourceDesc)
147  {
148  AcpiOsPrintf ("[Null Object]\n");
149  return_VOID;
150  }
151 
153  {
154  /* No object type prefix needed for integers and strings */
155 
156  if ((SourceDesc->Common.Type != ACPI_TYPE_INTEGER) &&
157  (SourceDesc->Common.Type != ACPI_TYPE_STRING))
158  {
159  AcpiOsPrintf ("%s ", AcpiUtGetObjectTypeName (SourceDesc));
160  }
161 
162  if (!AcpiUtValidInternalObject (SourceDesc))
163  {
164  AcpiOsPrintf ("%p, Invalid Internal Object!\n", SourceDesc);
165  return_VOID;
166  }
167  }
168  else if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_NAMED)
169  {
170  AcpiOsPrintf ("%s (Node %p)\n",
171  AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) SourceDesc)->Type),
172  SourceDesc);
173  return_VOID;
174  }
175  else
176  {
177  return_VOID;
178  }
179 
180  /* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */
181 
182  switch (SourceDesc->Common.Type)
183  {
184  case ACPI_TYPE_INTEGER:
185 
186  /* Output correct integer width */
187 
188  if (AcpiGbl_IntegerByteWidth == 4)
189  {
190  AcpiOsPrintf ("0x%8.8X\n",
191  (UINT32) SourceDesc->Integer.Value);
192  }
193  else
194  {
195  AcpiOsPrintf ("0x%8.8X%8.8X\n",
196  ACPI_FORMAT_UINT64 (SourceDesc->Integer.Value));
197  }
198  break;
199 
200  case ACPI_TYPE_BUFFER:
201 
202  AcpiOsPrintf ("[0x%.2X]\n", (UINT32) SourceDesc->Buffer.Length);
203  AcpiUtDumpBuffer (SourceDesc->Buffer.Pointer,
204  (SourceDesc->Buffer.Length < 256) ?
205  SourceDesc->Buffer.Length : 256, DB_BYTE_DISPLAY, 0);
206  break;
207 
208  case ACPI_TYPE_STRING:
209 
210  AcpiOsPrintf ("\"%s\"\n", SourceDesc->String.Pointer);
211  break;
212 
213  case ACPI_TYPE_PACKAGE:
214 
215  AcpiOsPrintf ("(Contains 0x%.2X Elements):\n",
216  SourceDesc->Package.Count);
217 
218  /* Output the entire contents of the package */
219 
220  for (i = 0; i < SourceDesc->Package.Count; i++)
221  {
222  AcpiExDoDebugObject (SourceDesc->Package.Elements[i],
223  Level + 4, i + 1);
224  }
225  break;
226 
228 
229  AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (SourceDesc));
230 
231  /* Decode the reference */
232 
233  switch (SourceDesc->Reference.Class)
234  {
235  case ACPI_REFCLASS_INDEX:
236 
237  AcpiOsPrintf ("0x%X\n", SourceDesc->Reference.Value);
238  break;
239 
240  case ACPI_REFCLASS_TABLE:
241 
242  /* Case for DdbHandle */
243 
244  AcpiOsPrintf ("Table Index 0x%X\n", SourceDesc->Reference.Value);
245  return_VOID;
246 
247  default:
248 
249  break;
250  }
251 
252  AcpiOsPrintf (" ");
253 
254  /* Check for valid node first, then valid object */
255 
256  if (SourceDesc->Reference.Node)
257  {
258  if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Node) !=
260  {
261  AcpiOsPrintf (" %p - Not a valid namespace node\n",
262  SourceDesc->Reference.Node);
263  }
264  else
265  {
266  AcpiOsPrintf ("Node %p [%4.4s] ", SourceDesc->Reference.Node,
267  (SourceDesc->Reference.Node)->Name.Ascii);
268 
269  switch ((SourceDesc->Reference.Node)->Type)
270  {
271  /* These types have no attached object */
272 
273  case ACPI_TYPE_DEVICE:
274  AcpiOsPrintf ("Device\n");
275  break;
276 
277  case ACPI_TYPE_THERMAL:
278  AcpiOsPrintf ("Thermal Zone\n");
279  break;
280 
281  default:
282 
283  AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object,
284  Level + 4, 0);
285  break;
286  }
287  }
288  }
289  else if (SourceDesc->Reference.Object)
290  {
291  if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) ==
293  {
294  /* Reference object is a namespace node */
295 
297  SourceDesc->Reference.Object),
298  Level + 4, 0);
299  }
300  else
301  {
302  ObjectDesc = SourceDesc->Reference.Object;
303  Value = SourceDesc->Reference.Value;
304 
305  switch (ObjectDesc->Common.Type)
306  {
307  case ACPI_TYPE_BUFFER:
308 
309  AcpiOsPrintf ("Buffer[%u] = 0x%2.2X\n",
310  Value, *SourceDesc->Reference.IndexPointer);
311  break;
312 
313  case ACPI_TYPE_STRING:
314 
315  AcpiOsPrintf ("String[%u] = \"%c\" (0x%2.2X)\n",
316  Value, *SourceDesc->Reference.IndexPointer,
317  *SourceDesc->Reference.IndexPointer);
318  break;
319 
320  case ACPI_TYPE_PACKAGE:
321 
322  AcpiOsPrintf ("Package[%u] = ", Value);
323  if (!(*SourceDesc->Reference.Where))
324  {
325  AcpiOsPrintf ("[Uninitialized Package Element]\n");
326  }
327  else
328  {
329  AcpiExDoDebugObject (*SourceDesc->Reference.Where,
330  Level+4, 0);
331  }
332  break;
333 
334  default:
335 
336  AcpiOsPrintf ("Unknown Reference object type %X\n",
337  ObjectDesc->Common.Type);
338  break;
339  }
340  }
341  }
342  break;
343 
344  default:
345 
346  AcpiOsPrintf ("(Descriptor %p)\n", SourceDesc);
347  break;
348  }
349 
351  return_VOID;
352 }
#define ACPI_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
UINT64 AcpiOsGetTimer(void)
Definition: osl.c:884
#define ACPI_TYPE_THERMAL
Definition: actypes.h:691
Type
Definition: Type.h:6
ACPI_OBJECT_PACKAGE Package
Definition: acobject.h:520
#define ACPI_TYPE_BUFFER
Definition: actypes.h:681
#define ACPI_TYPE_INTEGER
Definition: actypes.h:679
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:710
const char * AcpiUtGetReferenceName(ACPI_OPERAND_OBJECT *Object)
Definition: utdecode.c:425
char Ascii[4]
Definition: actbl.h:394
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
void AcpiExDoDebugObject(ACPI_OPERAND_OBJECT *SourceDesc, UINT32 Level, UINT32 Index)
Definition: exdebug.c:77
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:682
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DB_BYTE_DISPLAY
Definition: acutils.h:185
ACPI_OBJECT_COMMON_HEADER UINT8 Class
Definition: acobject.h:440
unsigned int UINT32
ACPI_NAME_UNION Name
Definition: aclocal.h:191
ACPI_OBJECT_REFERENCE Reference
Definition: acobject.h:537
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_DESC_TYPE_OPERAND
Definition: acobject.h:573
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:519
static const UCHAR Index[8]
Definition: usbohci.c:18
#define return_VOID
Definition: acoutput.h:495
void ACPI_INTERNAL_VAR_XFACE AcpiOsPrintf(const char *Format,...)
Definition: osl.c:851
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:517
#define ACPI_TYPE_DEVICE
Definition: actypes.h:684
void AcpiUtDumpBuffer(UINT8 *Buffer, UINT32 Count, UINT32 Display, UINT32 Offset)
Definition: utbuffer.c:71
ACPI_OBJECT_STRING String
Definition: acobject.h:518
BOOLEAN AcpiUtValidInternalObject(void *Object)
Definition: utobject.c:376
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define ACPI_LV_DEBUG_OBJECT
Definition: acoutput.h:89
UINT Timer
Definition: capclock.c:11
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:444
const char * AcpiUtGetTypeName(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:249
union acpi_operand_object ** Where
Definition: acobject.h:445
#define ACPI_TYPE_STRING
Definition: actypes.h:680
#define ACPI_DESC_TYPE_NAMED
Definition: acobject.h:574
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
const char * AcpiUtGetObjectTypeName(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: utdecode.c:263
union acpi_operand_object ** Elements
Definition: acobject.h:161
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414

Referenced by AcpiExDoDebugObject().

◆ AcpiExDoLogicalNumericOp()

ACPI_STATUS AcpiExDoLogicalNumericOp ( UINT16  Opcode,
UINT64  Integer0,
UINT64  Integer1,
BOOLEAN LogicalResult 
)

Definition at line 262 of file exmisc.c.

267 {
269  BOOLEAN LocalResult = FALSE;
270 
271 
272  ACPI_FUNCTION_TRACE (ExDoLogicalNumericOp);
273 
274 
275  switch (Opcode)
276  {
277  case AML_LOGICAL_AND_OP: /* LAnd (Integer0, Integer1) */
278 
279  if (Integer0 && Integer1)
280  {
281  LocalResult = TRUE;
282  }
283  break;
284 
285  case AML_LOGICAL_OR_OP: /* LOr (Integer0, Integer1) */
286 
287  if (Integer0 || Integer1)
288  {
289  LocalResult = TRUE;
290  }
291  break;
292 
293  default:
294 
296  "Invalid numeric logical opcode: %X", Opcode));
298  break;
299  }
300 
301  /* Return the logical result and status */
302 
303  *LogicalResult = LocalResult;
305 }
#define TRUE
Definition: types.h:120
_In_ PVOID _In_ ULONG Opcode
Definition: hubbusif.h:330
#define AML_LOGICAL_OR_OP
Definition: amlcode.h:121
#define AE_AML_INTERNAL
Definition: acexcep.h:194
UINT32 ACPI_STATUS
Definition: actypes.h:460
unsigned char BOOLEAN
#define AE_INFO
Definition: acoutput.h:230
#define AML_LOGICAL_AND_OP
Definition: amlcode.h:120
Status
Definition: gdiplustypes.h:24
#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_OK
Definition: acexcep.h:97

Referenced by AcpiExOpcode_2A_0T_1R().

◆ AcpiExDoLogicalOp()

ACPI_STATUS AcpiExDoLogicalOp ( UINT16  Opcode,
ACPI_OPERAND_OBJECT Operand0,
ACPI_OPERAND_OBJECT Operand1,
BOOLEAN LogicalResult 
)

Definition at line 335 of file exmisc.c.

340 {
341  ACPI_OPERAND_OBJECT *LocalOperand1 = Operand1;
342  UINT64 Integer0;
343  UINT64 Integer1;
344  UINT32 Length0;
345  UINT32 Length1;
347  BOOLEAN LocalResult = FALSE;
348  int Compare;
349 
350 
351  ACPI_FUNCTION_TRACE (ExDoLogicalOp);
352 
353 
354  /*
355  * Convert the second operand if necessary. The first operand
356  * determines the type of the second operand, (See the Data Types
357  * section of the ACPI 3.0+ specification.) Both object types are
358  * guaranteed to be either Integer/String/Buffer by the operand
359  * resolution mechanism.
360  */
361  switch (Operand0->Common.Type)
362  {
363  case ACPI_TYPE_INTEGER:
364 
365  Status = AcpiExConvertToInteger (Operand1, &LocalOperand1,
367  break;
368 
369  case ACPI_TYPE_STRING:
370 
372  Operand1, &LocalOperand1, ACPI_IMPLICIT_CONVERT_HEX);
373  break;
374 
375  case ACPI_TYPE_BUFFER:
376 
377  Status = AcpiExConvertToBuffer (Operand1, &LocalOperand1);
378  break;
379 
380  default:
381 
383  "Invalid object type for logical operator: %X",
384  Operand0->Common.Type));
386  break;
387  }
388 
389  if (ACPI_FAILURE (Status))
390  {
391  goto Cleanup;
392  }
393 
394  /*
395  * Two cases: 1) Both Integers, 2) Both Strings or Buffers
396  */
397  if (Operand0->Common.Type == ACPI_TYPE_INTEGER)
398  {
399  /*
400  * 1) Both operands are of type integer
401  * Note: LocalOperand1 may have changed above
402  */
403  Integer0 = Operand0->Integer.Value;
404  Integer1 = LocalOperand1->Integer.Value;
405 
406  switch (Opcode)
407  {
408  case AML_LOGICAL_EQUAL_OP: /* LEqual (Operand0, Operand1) */
409 
410  if (Integer0 == Integer1)
411  {
412  LocalResult = TRUE;
413  }
414  break;
415 
416  case AML_LOGICAL_GREATER_OP: /* LGreater (Operand0, Operand1) */
417 
418  if (Integer0 > Integer1)
419  {
420  LocalResult = TRUE;
421  }
422  break;
423 
424  case AML_LOGICAL_LESS_OP: /* LLess (Operand0, Operand1) */
425 
426  if (Integer0 < Integer1)
427  {
428  LocalResult = TRUE;
429  }
430  break;
431 
432  default:
433 
435  "Invalid comparison opcode: %X", Opcode));
437  break;
438  }
439  }
440  else
441  {
442  /*
443  * 2) Both operands are Strings or both are Buffers
444  * Note: Code below takes advantage of common Buffer/String
445  * object fields. LocalOperand1 may have changed above. Use
446  * memcmp to handle nulls in buffers.
447  */
448  Length0 = Operand0->Buffer.Length;
449  Length1 = LocalOperand1->Buffer.Length;
450 
451  /* Lexicographic compare: compare the data bytes */
452 
453  Compare = memcmp (Operand0->Buffer.Pointer,
454  LocalOperand1->Buffer.Pointer,
455  (Length0 > Length1) ? Length1 : Length0);
456 
457  switch (Opcode)
458  {
459  case AML_LOGICAL_EQUAL_OP: /* LEqual (Operand0, Operand1) */
460 
461  /* Length and all bytes must be equal */
462 
463  if ((Length0 == Length1) &&
464  (Compare == 0))
465  {
466  /* Length and all bytes match ==> TRUE */
467 
468  LocalResult = TRUE;
469  }
470  break;
471 
472  case AML_LOGICAL_GREATER_OP: /* LGreater (Operand0, Operand1) */
473 
474  if (Compare > 0)
475  {
476  LocalResult = TRUE;
477  goto Cleanup; /* TRUE */
478  }
479  if (Compare < 0)
480  {
481  goto Cleanup; /* FALSE */
482  }
483 
484  /* Bytes match (to shortest length), compare lengths */
485 
486  if (Length0 > Length1)
487  {
488  LocalResult = TRUE;
489  }
490  break;
491 
492  case AML_LOGICAL_LESS_OP: /* LLess (Operand0, Operand1) */
493 
494  if (Compare > 0)
495  {
496  goto Cleanup; /* FALSE */
497  }
498  if (Compare < 0)
499  {
500  LocalResult = TRUE;
501  goto Cleanup; /* TRUE */
502  }
503 
504  /* Bytes match (to shortest length), compare lengths */
505 
506  if (Length0 < Length1)
507  {
508  LocalResult = TRUE;
509  }
510  break;
511 
512  default:
513 
515  "Invalid comparison opcode: %X", Opcode));
517  break;
518  }
519  }
520 
521 Cleanup:
522 
523  /* New object was created if implicit conversion performed - delete */
524 
525  if (LocalOperand1 != Operand1)
526  {
527  AcpiUtRemoveReference (LocalOperand1);
528  }
529 
530  /* Return the logical result and status */
531 
532  *LogicalResult = LocalResult;
534 }
#define TRUE
Definition: types.h:120
_In_ PVOID _In_ ULONG Opcode
Definition: hubbusif.h:330
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ACPI_TYPE_BUFFER
Definition: actypes.h:681
#define ACPI_TYPE_INTEGER
Definition: actypes.h:679
#define AE_AML_INTERNAL
Definition: acexcep.h:194
UINT32 ACPI_STATUS
Definition: actypes.h:460
INT Length1
Definition: FsRtlDissect.c:15
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
unsigned int UINT32
unsigned char BOOLEAN
#define AML_LOGICAL_EQUAL_OP
Definition: amlcode.h:123
#define AE_INFO
Definition: acoutput.h:230
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:519
ACPI_STATUS AcpiExConvertToString(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, UINT32 Type)
Definition: exconvrt.c:440
ACPI_STATUS AcpiExConvertToInteger(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, UINT32 ImplicitConversion)
Definition: exconvrt.c:79
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:517
static const WCHAR Cleanup[]
Definition: register.c:80
#define AML_LOGICAL_GREATER_OP
Definition: amlcode.h:124
Status
Definition: gdiplustypes.h:24
#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:516
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
ACPI_STATUS AcpiExConvertToBuffer(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc)
Definition: exconvrt.c:224
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_TYPE_STRING
Definition: actypes.h:680
unsigned long long UINT64
#define AML_LOGICAL_LESS_OP
Definition: amlcode.h:125
#define AE_OK
Definition: acexcep.h:97
#define ACPI_IMPLICIT_CONVERT_HEX
Definition: acinterp.h:126
#define ACPI_IMPLICIT_CONVERSION
Definition: acutils.h:144

Referenced by AcpiExDoMatch(), and AcpiExOpcode_2A_0T_1R().

◆ AcpiExDoMathOp()

UINT64 AcpiExDoMathOp ( UINT16  Opcode,
UINT64  Operand0,
UINT64  Operand1 
)

Definition at line 167 of file exmisc.c.

171 {
172 
174 
175 
176  switch (Opcode)
177  {
178  case AML_ADD_OP: /* Add (Integer0, Integer1, Result) */
179 
180  return (Integer0 + Integer1);
181 
182  case AML_BIT_AND_OP: /* And (Integer0, Integer1, Result) */
183 
184  return (Integer0 & Integer1);
185 
186  case AML_BIT_NAND_OP: /* NAnd (Integer0, Integer1, Result) */
187 
188  return (~(Integer0 & Integer1));
189 
190  case AML_BIT_OR_OP: /* Or (Integer0, Integer1, Result) */
191 
192  return (Integer0 | Integer1);
193 
194  case AML_BIT_NOR_OP: /* NOr (Integer0, Integer1, Result) */
195 
196  return (~(Integer0 | Integer1));
197 
198  case AML_BIT_XOR_OP: /* XOr (Integer0, Integer1, Result) */
199 
200  return (Integer0 ^ Integer1);
201 
202  case AML_MULTIPLY_OP: /* Multiply (Integer0, Integer1, Result) */
203 
204  return (Integer0 * Integer1);
205 
206  case AML_SHIFT_LEFT_OP: /* ShiftLeft (Operand, ShiftCount, Result)*/
207 
208  /*
209  * We need to check if the shiftcount is larger than the integer bit
210  * width since the behavior of this is not well-defined in the C language.
211  */
212  if (Integer1 >= AcpiGbl_IntegerBitWidth)
213  {
214  return (0);
215  }
216  return (Integer0 << Integer1);
217 
218  case AML_SHIFT_RIGHT_OP: /* ShiftRight (Operand, ShiftCount, Result) */
219 
220  /*
221  * We need to check if the shiftcount is larger than the integer bit
222  * width since the behavior of this is not well-defined in the C language.
223  */
224  if (Integer1 >= AcpiGbl_IntegerBitWidth)
225  {
226  return (0);
227  }
228  return (Integer0 >> Integer1);
229 
230  case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */
231 
232  return (Integer0 - Integer1);
233 
234  default:
235 
236  return (0);
237  }
238 }
#define AML_BIT_NOR_OP
Definition: amlcode.h:102
_In_ PVOID _In_ ULONG Opcode
Definition: hubbusif.h:330
#define AML_BIT_NAND_OP
Definition: amlcode.h:100
#define AML_SHIFT_RIGHT_OP
Definition: amlcode.h:98
#define AML_BIT_AND_OP
Definition: amlcode.h:99
#define AML_SHIFT_LEFT_OP
Definition: amlcode.h:97
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
#define AML_BIT_OR_OP
Definition: amlcode.h:101
#define AML_BIT_XOR_OP
Definition: amlcode.h:103
#define AML_ADD_OP
Definition: amlcode.h:90
#define AML_SUBTRACT_OP
Definition: amlcode.h:92
#define AML_MULTIPLY_OP
Definition: amlcode.h:95

Referenced by AcpiExOpcode_2A_1T_1R().

◆ AcpiExDumpNamespaceNode()

void AcpiExDumpNamespaceNode ( ACPI_NAMESPACE_NODE Node,
UINT32  Flags 
)

◆ AcpiExDumpObjectDescriptor()

void AcpiExDumpObjectDescriptor ( ACPI_OPERAND_OBJECT Object,
UINT32  Flags 
)

◆ AcpiExDumpOperand()

void AcpiExDumpOperand ( ACPI_OPERAND_OBJECT ObjDesc,
UINT32  Depth 
)

◆ AcpiExDumpOperands()

void AcpiExDumpOperands ( ACPI_OPERAND_OBJECT **  Operands,
const char OpcodeName,
UINT32  NumOpcodes 
)

◆ AcpiExEisaIdToString()

void AcpiExEisaIdToString ( char Dest,
UINT64  CompressedId 
)

Definition at line 366 of file exutils.c.

369 {
370  UINT32 SwappedId;
371 
372 
374 
375 
376  /* The EISAID should be a 32-bit integer */
377 
378  if (CompressedId > ACPI_UINT32_MAX)
379  {
381  "Expected EISAID is larger than 32 bits: "
382  "0x%8.8X%8.8X, truncating",
383  ACPI_FORMAT_UINT64 (CompressedId)));
384  }
385 
386  /* Swap ID to big-endian to get contiguous bits */
387 
388  SwappedId = AcpiUtDwordByteSwap ((UINT32) CompressedId);
389 
390  /* First 3 bytes are uppercase letters. Next 4 bytes are hexadecimal */
391 
392  OutString[0] = (char) (0x40 + (((unsigned long) SwappedId >> 26) & 0x1F));
393  OutString[1] = (char) (0x40 + ((SwappedId >> 21) & 0x1F));
394  OutString[2] = (char) (0x40 + ((SwappedId >> 16) & 0x1F));
395  OutString[3] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 12);
396  OutString[4] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 8);
397  OutString[5] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 4);
398  OutString[6] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 0);
399  OutString[7] = 0;
400 }
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
UINT32 AcpiUtDwordByteSwap(UINT32 Value)
Definition: utmisc.c:136
unsigned int UINT32
#define AE_INFO
Definition: acoutput.h:230
unsigned char
Definition: typeof.h:29
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
#define ACPI_UINT32_MAX
Definition: actypes.h:66
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
char AcpiUtHexToAsciiChar(UINT64 Integer, UINT32 Position)
Definition: uthex.c:74
unsigned long long UINT64

Referenced by AcpiUtExecute_CID(), and AcpiUtExecute_HID().

◆ AcpiExEmbeddedControllerSpaceHandler()

ACPI_STATUS AcpiExEmbeddedControllerSpaceHandler ( UINT32  Function,
ACPI_PHYSICAL_ADDRESS  Address,
UINT32  BitWidth,
UINT64 Value,
void HandlerContext,
void RegionContext 
)

◆ AcpiExEnterInterpreter()

void AcpiExEnterInterpreter ( void  )

Definition at line 91 of file exutils.c.

93 {
95 
96 
97  ACPI_FUNCTION_TRACE (ExEnterInterpreter);
98 
99 
101  if (ACPI_FAILURE (Status))
102  {
103  ACPI_ERROR ((AE_INFO, "Could not acquire AML Interpreter mutex"));
104  }
106  if (ACPI_FAILURE (Status))
107  {
108  ACPI_ERROR ((AE_INFO, "Could not acquire AML Namespace mutex"));
109  }
110 
111  return_VOID;
112 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
#define AE_INFO
Definition: acoutput.h:230
#define return_VOID
Definition: acoutput.h:495
Status
Definition: gdiplustypes.h:24
#define ACPI_MTX_INTERPRETER
Definition: aclocal.h:84
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_MTX_NAMESPACE
Definition: aclocal.h:85

Referenced by AcpiAcquireGlobalLock(), AcpiDsMethodError(), AcpiDsTerminateControlMethod(), AcpiEvAddressSpaceDispatch(), AcpiEvaluateObject(), AcpiEvInitializeRegion(), AcpiExLoadOp(), AcpiExLoadTableOp(), AcpiExSystemDoSleep(), AcpiExSystemWaitMutex(), AcpiExSystemWaitSemaphore(), AcpiExUnloadTable(), AcpiNsEvaluate(), AcpiNsInitOneObject(), AcpiNsLoadTable(), AcpiNsOneCompleteParse(), AcpiPsExecuteTable(), and AcpiPsParseAml().

◆ AcpiExExitInterpreter()

void AcpiExExitInterpreter ( void  )

Definition at line 139 of file exutils.c.

141 {
143 
144 
145  ACPI_FUNCTION_TRACE (ExExitInterpreter);
146 
147 
149  if (ACPI_FAILURE (Status))
150  {
151  ACPI_ERROR ((AE_INFO, "Could not release AML Namespace mutex"));
152  }
154  if (ACPI_FAILURE (Status))
155  {
156  ACPI_ERROR ((AE_INFO, "Could not release AML Interpreter mutex"));
157  }
158 
159  return_VOID;
160 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
#define AE_INFO
Definition: acoutput.h:230
#define return_VOID
Definition: acoutput.h:495
Status
Definition: gdiplustypes.h:24
#define ACPI_MTX_INTERPRETER
Definition: aclocal.h:84
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_MTX_NAMESPACE
Definition: aclocal.h:85

Referenced by AcpiAcquireGlobalLock(), AcpiDsMethodError(), AcpiDsTerminateControlMethod(), AcpiEvAddressSpaceDispatch(), AcpiEvaluateObject(), AcpiEvInitializeRegion(), AcpiExLoadOp(), AcpiExLoadTableOp(), AcpiExSystemDoSleep(), AcpiExSystemWaitMutex(), AcpiExSystemWaitSemaphore(), AcpiExUnloadTable(), AcpiNsEvaluate(), AcpiNsInitOneObject(), AcpiNsLoadTable(), AcpiNsOneCompleteParse(), AcpiPsExecuteTable(), and AcpiPsParseAml().

◆ AcpiExExtractFromField()

ACPI_STATUS AcpiExExtractFromField ( ACPI_OPERAND_OBJECT ObjDesc,
void Buffer,
UINT32  BufferLength 
)

Definition at line 723 of file exfldio.c.

727 {
729  UINT64 RawDatum;
730  UINT64 MergedDatum;
731  UINT32 FieldOffset = 0;
732  UINT32 BufferOffset = 0;
733  UINT32 BufferTailBits;
734  UINT32 DatumCount;
735  UINT32 FieldDatumCount;
736  UINT32 AccessBitWidth;
737  UINT32 i;
738 
739 
740  ACPI_FUNCTION_TRACE (ExExtractFromField);
741 
742 
743  /* Validate target buffer and clear it */
744 
745  if (BufferLength <
746  ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength))
747  {
749  "Field size %u (bits) is too large for buffer (%u)",
750  ObjDesc->CommonField.BitLength, BufferLength));
751 
753  }
754 
755  memset (Buffer, 0, BufferLength);
756  AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth);
757 
758  /* Handle the simple case here */
759 
760  if ((ObjDesc->CommonField.StartFieldBitOffset == 0) &&
761  (ObjDesc->CommonField.BitLength == AccessBitWidth))
762  {
763  if (BufferLength >= sizeof (UINT64))
764  {
765  Status = AcpiExFieldDatumIo (ObjDesc, 0, Buffer, ACPI_READ);
766  }
767  else
768  {
769  /* Use RawDatum (UINT64) to handle buffers < 64 bits */
770 
771  Status = AcpiExFieldDatumIo (ObjDesc, 0, &RawDatum, ACPI_READ);
772  memcpy (Buffer, &RawDatum, BufferLength);
773  }
774 
776  }
777 
778 /* TBD: Move to common setup code */
779 
780  /* Field algorithm is limited to sizeof(UINT64), truncate if needed */
781 
782  if (ObjDesc->CommonField.AccessByteWidth > sizeof (UINT64))
783  {
784  ObjDesc->CommonField.AccessByteWidth = sizeof (UINT64);
785  AccessBitWidth = sizeof (UINT64) * 8;
786  }
787 
788  /* Compute the number of datums (access width data items) */
789 
790  DatumCount = ACPI_ROUND_UP_TO (
791  ObjDesc->CommonField.BitLength, AccessBitWidth);
792 
793  FieldDatumCount = ACPI_ROUND_UP_TO (
794  ObjDesc->CommonField.BitLength +
795  ObjDesc->CommonField.StartFieldBitOffset, AccessBitWidth);
796 
797  /* Priming read from the field */
798 
799  Status = AcpiExFieldDatumIo (ObjDesc, FieldOffset, &RawDatum, ACPI_READ);
800  if (ACPI_FAILURE (Status))
801  {
803  }
804  MergedDatum = RawDatum >> ObjDesc->CommonField.StartFieldBitOffset;
805 
806  /* Read the rest of the field */
807 
808  for (i = 1; i < FieldDatumCount; i++)
809  {
810  /* Get next input datum from the field */
811 
812  FieldOffset += ObjDesc->CommonField.AccessByteWidth;
814  ObjDesc, FieldOffset, &RawDatum, ACPI_READ);
815  if (ACPI_FAILURE (Status))
816  {
818  }
819 
820  /*
821  * Merge with previous datum if necessary.
822  *
823  * Note: Before the shift, check if the shift value will be larger than
824  * the integer size. If so, there is no need to perform the operation.
825  * This avoids the differences in behavior between different compilers
826  * concerning shift values larger than the target data width.
827  */
828  if (AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset <
830  {
831  MergedDatum |= RawDatum <<
832  (AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset);
833  }
834 
835  if (i == DatumCount)
836  {
837  break;
838  }
839 
840  /* Write merged datum to target buffer */
841 
842  memcpy (((char *) Buffer) + BufferOffset, &MergedDatum,
843  ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
844  BufferLength - BufferOffset));
845 
846  BufferOffset += ObjDesc->CommonField.AccessByteWidth;
847  MergedDatum = RawDatum >> ObjDesc->CommonField.StartFieldBitOffset;
848  }
849 
850  /* Mask off any extra bits in the last datum */
851 
852  BufferTailBits = ObjDesc->CommonField.BitLength % AccessBitWidth;
853  if (BufferTailBits)
854  {
855  MergedDatum &= ACPI_MASK_BITS_ABOVE (BufferTailBits);
856  }
857 
858  /* Write the last datum to the buffer */
859 
860  memcpy (((char *) Buffer) + BufferOffset, &MergedDatum,
861  ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
862  BufferLength - BufferOffset));
863 
865 }
#define ACPI_READ
Definition: actypes.h:742
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
ACPI_OBJECT_FIELD_COMMON CommonField
Definition: acobject.h:530
#define ACPI_MUL_8(a)
Definition: acmacros.h:215
UINT32 ACPI_STATUS
Definition: actypes.h:460
static ACPI_STATUS AcpiExFieldDatumIo(ACPI_OPERAND_OBJECT *ObjDesc, UINT32 FieldDatumByteOffset, UINT64 *Value, UINT32 ReadWrite)
Definition: exfldio.c:402
#define ACPI_MIN(a, b)
Definition: actypes.h:535
#define ACPI_INTEGER_BIT_SIZE
Definition: actypes.h:490
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define AE_BUFFER_OVERFLOW
Definition: acexcep.h:119
unsigned int UINT32
_In_ ULONG BufferLength
Definition: usbdlib.h:225
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_MASK_BITS_ABOVE(position)
Definition: acmacros.h:344
Definition: bufpool.h:45
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_ROUND_UP_TO(value, boundary)
Definition: acmacros.h:263
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_ROUND_BITS_UP_TO_BYTES(a)
Definition: acmacros.h:256
unsigned long long UINT64
#define memset(x, y, z)
Definition: compat.h:39
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiExFieldDatumIo(), and AcpiExReadDataFromField().

◆ AcpiExGetBufferDatum()

void AcpiExGetBufferDatum ( UINT64 Datum,
void Buffer,
UINT32  BufferLength,
UINT32  ByteGranularity,
UINT32  BufferOffset 
)

◆ AcpiExGetNameString()

ACPI_STATUS AcpiExGetNameString ( ACPI_OBJECT_TYPE  DataType,
UINT8 InAmlAddress,
char **  OutNameString,
UINT32 OutNameLength 
)

Definition at line 278 of file exnames.c.

283 {
285  UINT8 *AmlAddress = InAmlAddress;
286  char *NameString = NULL;
287  UINT32 NumSegments;
288  UINT32 PrefixCount = 0;
290 
291 
292  ACPI_FUNCTION_TRACE_PTR (ExGetNameString, AmlAddress);
293 
294 
298  {
299  /* Disallow prefixes for types associated with FieldUnit names */
300 
301  NameString = AcpiExAllocateNameString (0, 1);
302  if (!NameString)
303  {
305  }
306  else
307  {
308  Status = AcpiExNameSegment (&AmlAddress, NameString);
309  }
310  }
311  else
312  {
313  /*
314  * DataType is not a field name.
315  * Examine first character of name for root or parent prefix operators
316  */
317  switch (*AmlAddress)
318  {
319  case AML_ROOT_PREFIX:
320 
321  ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "RootPrefix(\\) at %p\n",
322  AmlAddress));
323 
324  /*
325  * Remember that we have a RootPrefix --
326  * see comment in AcpiExAllocateNameString()
327  */
328  AmlAddress++;
329  PrefixCount = ACPI_UINT32_MAX;
330  HasPrefix = TRUE;
331  break;
332 
333  case AML_PARENT_PREFIX:
334 
335  /* Increment past possibly multiple parent prefixes */
336 
337  do
338  {
339  ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "ParentPrefix (^) at %p\n",
340  AmlAddress));
341 
342  AmlAddress++;
343  PrefixCount++;
344 
345  } while (*AmlAddress == AML_PARENT_PREFIX);
346 
347  HasPrefix = TRUE;
348  break;
349 
350  default:
351 
352  /* Not a prefix character */
353 
354  break;
355  }
356 
357  /* Examine first character of name for name segment prefix operator */
358 
359  switch (*AmlAddress)
360  {
362 
363  ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "DualNamePrefix at %p\n",
364  AmlAddress));
365 
366  AmlAddress++;
367  NameString = AcpiExAllocateNameString (PrefixCount, 2);
368  if (!NameString)
369  {
371  break;
372  }
373 
374  /* Indicate that we processed a prefix */
375 
376  HasPrefix = TRUE;
377 
378  Status = AcpiExNameSegment (&AmlAddress, NameString);
379  if (ACPI_SUCCESS (Status))
380  {
381  Status = AcpiExNameSegment (&AmlAddress, NameString);
382  }
383  break;
384 
386 
387  ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "MultiNamePrefix at %p\n",
388  AmlAddress));
389 
390  /* Fetch count of segments remaining in name path */
391 
392  AmlAddress++;
393  NumSegments = *AmlAddress;
394 
395  NameString = AcpiExAllocateNameString (
396  PrefixCount, NumSegments);
397  if (!NameString)
398  {
400  break;
401  }
402 
403  /* Indicate that we processed a prefix */
404 
405  AmlAddress++;
406  HasPrefix = TRUE;
407 
408  while (NumSegments &&
409  (Status = AcpiExNameSegment (&AmlAddress, NameString)) ==
410  AE_OK)
411  {
412  NumSegments--;
413  }
414 
415  break;
416 
417  case 0:
418 
419  /* NullName valid as of 8-12-98 ASL/AML Grammar Update */
420 
421  if (PrefixCount == ACPI_UINT32_MAX)
422  {
424  "NameSeg is \"\\\" followed by NULL\n"));
425  }
426 
427  /* Consume the NULL byte */
428 
429  AmlAddress++;
430  NameString = AcpiExAllocateNameString (PrefixCount, 0);
431  if (!NameString)
432  {
434  break;
435  }
436 
437  break;
438 
439  default:
440 
441  /* Name segment string */
442 
443  NameString = AcpiExAllocateNameString (PrefixCount, 1);
444  if (!NameString)
445  {
447  break;
448  }
449 
450  Status = AcpiExNameSegment (&AmlAddress, NameString);
451  break;
452  }
453  }
454 
455  if (AE_CTRL_PENDING == Status && HasPrefix)
456  {
457  /* Ran out of segments after processing a prefix */
458 
460  "Malformed Name at %p", NameString));
462  }
463 
464  if (ACPI_FAILURE (Status))
465  {
466  if (NameString)
467  {
468  ACPI_FREE (NameString);
469  }
471  }
472 
473  *OutNameString = NameString;
474  *OutNameLength = (UINT32) (AmlAddress - InAmlAddress);
475 
477 }
#define ACPI_FREE(a)
Definition: actypes.h:386
#define TRUE
Definition: types.h:120
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define ACPI_DB_LOAD
Definition: acoutput.h:164
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_AML_BAD_NAME
Definition: acexcep.h:192
BOOLEAN HasPrefix(PIP_ADDRESS Address, PIP_ADDRESS Prefix, UINT Length)
Definition: interface.c:111
static char * AcpiExAllocateNameString(UINT32 PrefixCount, UINT32 NumNameSegs)
Definition: exnames.c:82
static ACPI_STATUS AcpiExNameSegment(UINT8 **InAmlAddress, char *NameString)
Definition: exnames.c:179
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_TYPE_LOCAL_INDEX_FIELD
Definition: actypes.h:709
#define AE_CTRL_PENDING
Definition: acexcep.h:225
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
unsigned int UINT32
#define AML_DUAL_NAME_PREFIX
Definition: amlcode.h:66
unsigned char BOOLEAN
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define AML_PARENT_PREFIX
Definition: amlcode.h:70
#define ACPI_UINT32_MAX
Definition: actypes.h:66
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define AML_ROOT_PREFIX
Definition: amlcode.h:69
#define ACPI_TYPE_LOCAL_REGION_FIELD
Definition: actypes.h:707
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AML_MULTI_NAME_PREFIX
Definition: amlcode.h:67
#define ACPI_TYPE_LOCAL_BANK_FIELD
Definition: actypes.h:708
_In_ ULONG DataType
Definition: iotypes.h:788
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiDsCreateOperand().

◆ AcpiExGetObjectReference()

ACPI_STATUS AcpiExGetObjectReference ( ACPI_OPERAND_OBJECT ObjDesc,
ACPI_OPERAND_OBJECT **  ReturnDesc,
ACPI_WALK_STATE WalkState 
)

Definition at line 70 of file exmisc.c.

74 {
75  ACPI_OPERAND_OBJECT *ReferenceObj;
76  ACPI_OPERAND_OBJECT *ReferencedObj;
77 
78 
79  ACPI_FUNCTION_TRACE_PTR (ExGetObjectReference, ObjDesc);
80 
81 
82  *ReturnDesc = NULL;
83 
84  switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
85  {
87 
88  if (ObjDesc->Common.Type != ACPI_TYPE_LOCAL_REFERENCE)
89  {
91  }
92 
93  /*
94  * Must be a reference to a Local or Arg
95  */
96  switch (ObjDesc->Reference.Class)
97  {
99  case ACPI_REFCLASS_ARG:
100  case ACPI_REFCLASS_DEBUG:
101 
102  /* The referenced object is the pseudo-node for the local/arg */
103 
104  ReferencedObj = ObjDesc->Reference.Object;
105  break;
106 
107  default:
108 
109  ACPI_ERROR ((AE_INFO, "Invalid Reference Class 0x%2.2X",
110  ObjDesc->Reference.Class));
112  }
113  break;
114 
116  /*
117  * A named reference that has already been resolved to a Node
118  */
119  ReferencedObj = ObjDesc;
120  break;
121 
122  default:
123 
124  ACPI_ERROR ((AE_INFO, "Invalid descriptor type 0x%X",
125  ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)));
127  }
128 
129 
130  /* Create a new reference object */
131 
133  if (!ReferenceObj)
134  {
136  }
137 
138  ReferenceObj->Reference.Class = ACPI_REFCLASS_REFOF;
139  ReferenceObj->Reference.Object = ReferencedObj;
140  *ReturnDesc = ReferenceObj;
141 
143  "Object %p Type [%s], returning Reference %p\n",
144  ObjDesc, AcpiUtGetObjectTypeName (ObjDesc), *ReturnDesc));
145 
147 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:710
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
ACPI_OBJECT_COMMON_HEADER UINT8 Class
Definition: acobject.h:440
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
ACPI_OBJECT_REFERENCE Reference
Definition: acobject.h:537
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_DESC_TYPE_OPERAND
Definition: acobject.h:573
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define AE_TYPE
Definition: acexcep.h:116
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:655
#define ACPI_DESC_TYPE_NAMED
Definition: acobject.h:574
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 AcpiExOpcode_1A_0T_1R(), and AcpiExOpcode_1A_1T_1R().

◆ AcpiExGetProtocolBufferLength()

ACPI_STATUS AcpiExGetProtocolBufferLength ( UINT32  ProtocolId,
UINT32 ReturnLength 
)

Definition at line 111 of file exfield.c.

114 {
115 
118  {
120  "Invalid Field/AccessAs protocol ID: 0x%4.4X", ProtocolId));
121 
122  return (AE_AML_PROTOCOL);
123  }
124 
126  return (AE_OK);
127 }
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
#define ACPI_MAX_PROTOCOL_ID
Definition: exfield.c:60
#define ACPI_INVALID_PROTOCOL_ID
Definition: exfield.c:59
#define AE_INFO
Definition: acoutput.h:230
_In_ UINT ProtocolId
Definition: ndis.h:2924
const UINT8 AcpiProtocolLengths[]
Definition: exfield.c:62
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_AML_PROTOCOL
Definition: acexcep.h:215
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiExReadSerialBus(), and AcpiExWriteSerialBus().

◆ AcpiExInsertIntoField()

ACPI_STATUS AcpiExInsertIntoField ( ACPI_OPERAND_OBJECT ObjDesc,
void Buffer,
UINT32  BufferLength 
)

Definition at line 883 of file exfldio.c.

887 {
888  void *NewBuffer;
890  UINT64 Mask;
891  UINT64 WidthMask;
892  UINT64 MergedDatum;
893  UINT64 RawDatum = 0;
894  UINT32 FieldOffset = 0;
895  UINT32 BufferOffset = 0;
896  UINT32 BufferTailBits;
897  UINT32 DatumCount;
898  UINT32 FieldDatumCount;
899  UINT32 AccessBitWidth;
901  UINT32 i;
902 
903 
904  ACPI_FUNCTION_TRACE (ExInsertIntoField);
905 
906 
907  /* Validate input buffer */
908 
909  NewBuffer = NULL;
911  ObjDesc->CommonField.BitLength);
912 
913  /*
914  * We must have a buffer that is at least as long as the field
915  * we are writing to. This is because individual fields are
916  * indivisible and partial writes are not supported -- as per
917  * the ACPI specification.
918  */
920  {
921  /* We need to create a new buffer */
922 
923  NewBuffer = ACPI_ALLOCATE_ZEROED (RequiredLength);
924  if (!NewBuffer)
925  {
927  }
928 
929  /*
930  * Copy the original data to the new buffer, starting
931  * at Byte zero. All unused (upper) bytes of the
932  * buffer will be 0.
933  */
934  memcpy ((char *) NewBuffer, (char *) Buffer, BufferLength);
935  Buffer = NewBuffer;
937  }
938 
939 /* TBD: Move to common setup code */
940 
941  /* Algo is limited to sizeof(UINT64), so cut the AccessByteWidth */
942  if (ObjDesc->CommonField.AccessByteWidth > sizeof (UINT64))
943  {
944  ObjDesc->CommonField.AccessByteWidth = sizeof (UINT64);
945  }
946 
947  AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth);
948 
949  /* Create the bitmasks used for bit insertion */
950 
951  WidthMask = ACPI_MASK_BITS_ABOVE_64 (AccessBitWidth);
952  Mask = WidthMask &
953  ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
954 
955  /* Compute the number of datums (access width data items) */
956 
957  DatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength,
958  AccessBitWidth);
959 
960  FieldDatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength +
961  ObjDesc->CommonField.StartFieldBitOffset,
962  AccessBitWidth);
963 
964  /* Get initial Datum from the input buffer */
965 
966  memcpy (&RawDatum, Buffer,
967  ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
968  BufferLength - BufferOffset));
969 
970  MergedDatum = RawDatum << ObjDesc->CommonField.StartFieldBitOffset;
971 
972  /* Write the entire field */
973 
974  for (i = 1; i < FieldDatumCount; i++)
975  {
976  /* Write merged datum to the target field */
977 
978  MergedDatum &= Mask;
980  ObjDesc, Mask, MergedDatum, FieldOffset);
981  if (ACPI_FAILURE (Status))
982  {
983  goto Exit;
984  }
985 
986  FieldOffset += ObjDesc->CommonField.AccessByteWidth;
987 
988  /*
989  * Start new output datum by merging with previous input datum
990  * if necessary.
991  *
992  * Note: Before the shift, check if the shift value will be larger than
993  * the integer size. If so, there is no need to perform the operation.
994  * This avoids the differences in behavior between different compilers
995  * concerning shift values larger than the target data width.
996  */
997  if ((AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset) <
999  {
1000  MergedDatum = RawDatum >>
1001  (AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset);
1002  }
1003  else
1004  {
1005  MergedDatum = 0;
1006  }
1007 
1008  Mask = WidthMask;
1009 
1010  if (i == DatumCount)
1011  {
1012  break;
1013  }
1014 
1015  /* Get the next input datum from the buffer */
1016 
1017  BufferOffset += ObjDesc->CommonField.AccessByteWidth;
1018  memcpy (&RawDatum, ((char *) Buffer) + BufferOffset,
1019  ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
1020  BufferLength - BufferOffset));
1021 
1022  MergedDatum |= RawDatum << ObjDesc->CommonField.StartFieldBitOffset;
1023  }
1024 
1025  /* Mask off any extra bits in the last datum */
1026 
1027  BufferTailBits = (ObjDesc->CommonField.BitLength +
1028  ObjDesc->CommonField.StartFieldBitOffset) % AccessBitWidth;
1029  if (BufferTailBits)
1030  {
1031  Mask &= ACPI_MASK_BITS_ABOVE (BufferTailBits);
1032  }
1033 
1034  /* Write the last datum to the field */
1035 
1036  MergedDatum &= Mask;
1038  ObjDesc, Mask, MergedDatum, FieldOffset);
1039 
1040 Exit:
1041  /* Free temporary buffer if we used one */
1042 
1043  if (NewBuffer)
1044  {
1045  ACPI_FREE (NewBuffer);
1046  }
1048 }
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define AE_NO_MEMORY
Definition: acexcep.h:112
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
ACPI_OBJECT_FIELD_COMMON CommonField
Definition: acobject.h:530
#define ACPI_MUL_8(a)
Definition: acmacros.h:215
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_MASK_BITS_ABOVE_64(width)
Definition: acmacros.h:348
#define ACPI_MIN(a, b)
Definition: actypes.h:535
#define ACPI_INTEGER_BIT_SIZE
Definition: actypes.h:490
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT32
_In_ ULONG BufferLength
Definition: usbdlib.h:225
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_MASK_BITS_ABOVE(position)
Definition: acmacros.h:344
Definition: bufpool.h:45
#define ACPI_MASK_BITS_BELOW(position)
Definition: acmacros.h:345
static void Exit(void)
Definition: sock.c:1331
ACPI_STATUS AcpiExWriteWithUpdateRule(ACPI_OPERAND_OBJECT *ObjDesc, UINT64 Mask, UINT64 FieldValue, UINT32 FieldDatumByteOffset)
Definition: exfldio.c:617
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:29
#define ACPI_ROUND_UP_TO(value, boundary)
Definition: acmacros.h:263
#define ACPI_ROUND_BITS_UP_TO_BYTES(a)
Definition: acmacros.h:256
unsigned long long UINT64

Referenced by AcpiExFieldDatumIo(), and AcpiExWriteDataToField().

◆ AcpiExIntegerToString()

void AcpiExIntegerToString ( char Dest,
UINT64  Value 
)

Definition at line 421 of file exutils.c.

424 {
425  UINT32 Count;
426  UINT32 DigitsNeeded;
428 
429 
431 
432 
433  DigitsNeeded = AcpiExDigitsNeeded (Value, 10);
434  OutString[DigitsNeeded] = 0;
435 
436  for (Count = DigitsNeeded; Count > 0; Count--)
437  {
439  OutString[Count-1] = (char) ('0' + Remainder);\
440  }
441 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
unsigned int UINT32
unsigned char
Definition: typeof.h:29
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
ACPI_STATUS AcpiUtShortDivide(UINT64 InDividend, UINT32 Divisor, UINT64 *OutQuotient, UINT32 *OutRemainder)
Definition: utmath.c:337
static UINT32 AcpiExDigitsNeeded(UINT64 Value, UINT32 Base)
Definition: exutils.c:316
_In_ LARGE_INTEGER _Out_opt_ PLARGE_INTEGER Remainder
Definition: rtlfuncs.h:3046

Referenced by AcpiUtExecute_UID().

◆ AcpiExLoadOp()

ACPI_STATUS AcpiExLoadOp ( ACPI_OPERAND_OBJECT ObjDesc,
ACPI_OPERAND_OBJECT Target,
ACPI_WALK_STATE WalkState 
)

Definition at line 333 of file exconfig.c.

337 {
338  ACPI_OPERAND_OBJECT *DdbHandle;
339  ACPI_TABLE_HEADER *TableHeader;
341  UINT32 TableIndex;
343  UINT32 Length;
344 
345 
346  ACPI_FUNCTION_TRACE (ExLoadOp);
347 
348 
349  /* Source Object can be either an OpRegion or a Buffer/Field */
350 
351  switch (ObjDesc->Common.Type)
352  {
353  case ACPI_TYPE_REGION:
354 
356  "Load table from Region %p\n", ObjDesc));
357 
358  /* Region must be SystemMemory (from ACPI spec) */
359 
361  {
363  }
364 
365  /*
366  * If the Region Address and Length have not been previously
367  * evaluated, evaluate them now and save the results.
368  */
369  if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID))
370  {
371  Status = AcpiDsGetRegionArguments (ObjDesc);
372  if (ACPI_FAILURE (Status))
373  {
375  }
376  }
377 
378  /* Get the table header first so we can get the table length */
379 
380  TableHeader = ACPI_ALLOCATE (sizeof (ACPI_TABLE_HEADER));
381  if (!TableHeader)
382  {
384  }
385 
386  Status = AcpiExRegionRead (ObjDesc, sizeof (ACPI_TABLE_HEADER),
387  ACPI_CAST_PTR (UINT8, TableHeader));
388  Length = TableHeader->Length;
389  ACPI_FREE (TableHeader);
390 
391  if (ACPI_FAILURE (Status))
392  {
394  }
395 
396  /* Must have at least an ACPI table header */
397 
398  if (Length < sizeof (ACPI_TABLE_HEADER))
399  {
401  }
402 
403  /*
404  * The original implementation simply mapped the table, with no copy.
405  * However, the memory region is not guaranteed to remain stable and
406  * we must copy the table to a local buffer. For example, the memory
407  * region is corrupted after suspend on some machines. Dynamically
408  * loaded tables are usually small, so this overhead is minimal.
409  *
410  * The latest implementation (5/2009) does not use a mapping at all.
411  * We use the low-level operation region interface to read the table
412  * instead of the obvious optimization of using a direct mapping.
413  * This maintains a consistent use of operation regions across the
414  * entire subsystem. This is important if additional processing must
415  * be performed in the (possibly user-installed) operation region
416  * handler. For example, AcpiExec and ASLTS depend on this.
417  */
418 
419  /* Allocate a buffer for the table */
420 
422  if (!Table)
423  {
425  }
426 
427  /* Read the entire table */
428 
429  Status = AcpiExRegionRead (ObjDesc, Length,
431  if (ACPI_FAILURE (Status))
432  {
433  ACPI_FREE (Table);
435  }
436  break;
437 
438  case ACPI_TYPE_BUFFER: /* Buffer or resolved RegionField */
439 
441  "Load table from Buffer or Field %p\n", ObjDesc));
442 
443  /* Must have at least an ACPI table header */
444 
445  if (ObjDesc->Buffer.Length < sizeof (ACPI_TABLE_HEADER))
446  {
448  }
449 
450  /* Get the actual table length from the table header */
451 
452  TableHeader = ACPI_CAST_PTR (
453  ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer);
454  Length = TableHeader->Length;
455 
456  /* Table cannot extend beyond the buffer */
457 
458  if (Length > ObjDesc->Buffer.Length)
459  {
461  }
462  if (Length < sizeof (ACPI_TABLE_HEADER))
463  {
465  }
466 
467  /*
468  * Copy the table from the buffer because the buffer could be
469  * modified or even deleted in the future
470  */
472  if (!Table)
473  {
475  }
476 
477  memcpy (Table, TableHeader, Length);
478  break;
479 
480  default:
481 
483  }
484 
485  /* Install the new table into the local data structures */
486 
487  ACPI_INFO (("Dynamic OEM Table Load:"));
492  if (ACPI_FAILURE (Status))
493  {
494  /* Delete allocated table buffer */
495 
496  ACPI_FREE (Table);
498  }
499 
500  /*
501  * Add the table to the namespace.
502  *
503  * Note: Load the table objects relative to the root of the namespace.
504  * This appears to go against the ACPI specification, but we do it for
505  * compatibility with other ACPI implementations.
506  */
507  Status = AcpiExAddTable (TableIndex, &DdbHandle);
508  if (ACPI_FAILURE (Status))
509  {
510  /* On error, TablePtr was deallocated above */
511 
513  }
514 
515  /* Complete the initialization/resolution of new objects */
516 
520 
521  /* Store the DdbHandle into the Target operand */
522 
523  Status = AcpiExStore (DdbHandle, Target, WalkState);
524  if (ACPI_FAILURE (Status))
525  {
526  (void) AcpiExUnloadTable (DdbHandle);
527 
528  /* TablePtr was deallocated above */
529 
530  AcpiUtRemoveReference (DdbHandle);
532  }
533 
534  /* Remove the reference by added by AcpiExStore above */
535 
536  AcpiUtRemoveReference (DdbHandle);
538 }
#define AE_AML_BUFFER_LIMIT
Definition: acexcep.h:189
#define ACPI_FREE(a)
Definition: actypes.h:386
ASMGENDATA Table[]
Definition: genincdata.c:61
#define TRUE
Definition: types.h:120
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
ACPI_STATUS AcpiNsInitializeObjects(void)
Definition: nsinit.c:92
ACPI_STATUS AcpiExStore(ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *DestDesc, ACPI_WALK_STATE *WalkState)
Definition: exstore.c:91
#define AE_NO_MEMORY
Definition: acexcep.h:112
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define ACPI_TYPE_BUFFER
Definition: actypes.h:681
UINT32 Length
Definition: actbl.h:109
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_OBJECT_COMMON_HEADER UINT8 SpaceId
Definition: acobject.h:202
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_ALLOCATE(a)
Definition: actypes.h:384
static ACPI_STATUS AcpiExRegionRead(ACPI_OPERAND_OBJECT *ObjDesc, UINT32 Length, UINT8 *Buffer)
Definition: exconfig.c:280
unsigned int UINT32
ACPI_OBJECT_REGION Region
Definition: acobject.h:524
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:519
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1068
#define ACPI_PTR_TO_PHYSADDR(i)
Definition: actypes.h:556
#define ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL
Definition: actbl.h:431
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ACPI_INFO(plist)
Definition: acoutput.h:237
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_EXEC
Definition: acoutput.h:165
void AcpiExExitInterpreter(void)
Definition: exutils.c:139
void AcpiExEnterInterpreter(void)
Definition: exutils.c:91
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_STATUS AcpiDsGetRegionArguments(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: dsargs.c:395
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_STATUS AcpiExUnloadTable(ACPI_OPERAND_OBJECT *DdbHandle)
Definition: exconfig.c:554
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
static ACPI_STATUS AcpiExAddTable(UINT32 TableIndex, ACPI_OPERAND_OBJECT **DdbHandle)
Definition: exconfig.c:87
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
#define ACPI_TYPE_REGION
Definition: actypes.h:688
#define AE_INVALID_TABLE_LENGTH
Definition: acexcep.h:171
#define ACPI_ADR_SPACE_SYSTEM_MEMORY
Definition: actypes.h:851
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
unsigned char UINT8
ACPI_STATUS AcpiTbInstallAndLoadTable(ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, BOOLEAN Override, UINT32 *TableIndex)
Definition: tbdata.c:1124

Referenced by AcpiExOpcode_1A_1T_0R().

◆ AcpiExLoadTableOp()

ACPI_STATUS AcpiExLoadTableOp ( ACPI_WALK_STATE WalkState,
ACPI_OPERAND_OBJECT **  ReturnDesc 
)

Definition at line 129 of file exconfig.c.

132 {
134  ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
135  ACPI_NAMESPACE_NODE *ParentNode;
136  ACPI_NAMESPACE_NODE *StartNode;
137  ACPI_NAMESPACE_NODE *ParameterNode = NULL;
138  ACPI_OPERAND_OBJECT *DdbHandle;
139  UINT32 TableIndex;
140 
141 
142  ACPI_FUNCTION_TRACE (ExLoadTableOp);
143 
144 
145  /* Find the ACPI table in the RSDT/XSDT */
146 
149  Operand[0]->String.Pointer,
150  Operand[1]->String.Pointer,
151  Operand[2]->String.Pointer, &TableIndex);
153  if (ACPI_FAILURE (Status))
154  {
155  if (Status != AE_NOT_FOUND)
156  {
158  }
159 
160  /* Table not found, return an Integer=0 and AE_OK */
161 
162  DdbHandle = AcpiUtCreateIntegerObject ((UINT64) 0);
163  if (!DdbHandle)
164  {
166  }
167 
168  *ReturnDesc = DdbHandle;
170  }
171 
172  /* Default nodes */
173 
174  StartNode = WalkState->ScopeInfo->Scope.Node;
175  ParentNode = AcpiGbl_RootNode;
176 
177  /* RootPath (optional parameter) */
178 
179  if (Operand[3]->String.Length > 0)
180  {
181  /*
182  * Find the node referenced by the RootPathString. This is the
183  * location within the namespace where the table will be loaded.
184  */
185  Status = AcpiNsGetNodeUnlocked (StartNode,
186  Operand[3]->String.Pointer, ACPI_NS_SEARCH_PARENT,
187  &ParentNode);
188  if (ACPI_FAILURE (Status))
189  {
191  }
192  }
193 
194  /* ParameterPath (optional parameter) */
195 
196  if (Operand[4]->String.Length > 0)
197  {
198  if ((Operand[4]->String.Pointer[0] != AML_ROOT_PREFIX) &&
199  (Operand[4]->String.Pointer[0] != AML_PARENT_PREFIX))
200  {
201  /*
202  * Path is not absolute, so it will be relative to the node
203  * referenced by the RootPathString (or the NS root if omitted)
204  */
205  StartNode = ParentNode;
206  }
207 
208  /* Find the node referenced by the ParameterPathString */
209 
210  Status = AcpiNsGetNodeUnlocked (StartNode,
211  Operand[4]->String.Pointer, ACPI_NS_SEARCH_PARENT,
212  &ParameterNode);
213  if (ACPI_FAILURE (Status))
214  {
216  }
217  }
218 
219  /* Load the table into the namespace */
220 
221  ACPI_INFO (("Dynamic OEM Table Load:"));
223  Status = AcpiTbLoadTable (TableIndex, ParentNode);
225  if (ACPI_FAILURE (Status))
226  {
228  }
229 
230  Status = AcpiExAddTable (TableIndex, &DdbHandle);
231  if (ACPI_FAILURE (Status))
232  {
234  }
235 
236  /* Complete the initialization/resolution of new objects */
237 
241 
242  /* Parameter Data (optional) */
243 
244  if (ParameterNode)
245  {
246  /* Store the parameter data into the optional parameter object */
247 
248  Status = AcpiExStore (Operand[5],
249  ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode), WalkState);
250  if (ACPI_FAILURE (Status))
251  {
252  (void) AcpiExUnloadTable (DdbHandle);
253 
254  AcpiUtRemoveReference (DdbHandle);
256  }
257  }
258 
259  *ReturnDesc = DdbHandle;
261 }
#define ACPI_NS_SEARCH_PARENT
Definition: acnamesp.h:63
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
ACPI_STATUS AcpiNsInitializeObjects(void)
Definition: nsinit.c:92
ACPI_STATUS AcpiExStore(ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *DestDesc, ACPI_WALK_STATE *WalkState)
Definition: exstore.c:91
#define AE_NO_MEMORY
Definition: acexcep.h:112
ACPI_STATUS AcpiNsGetNodeUnlocked(ACPI_NAMESPACE_NODE *PrefixNode, const char *ExternalPathname, UINT32 Flags, ACPI_NAMESPACE_NODE **OutNode)
Definition: nsutils.c:777
static WCHAR String[]
Definition: stringtable.c:55
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
#define AML_PARENT_PREFIX
Definition: amlcode.h:70
ACPI_OPERAND_OBJECT * AcpiUtCreateIntegerObject(UINT64 Value)
Definition: utobject.c:223
#define AE_NOT_FOUND
Definition: acexcep.h:113
#define AML_ROOT_PREFIX
Definition: amlcode.h:69
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
#define ACPI_INFO(plist)
Definition: acoutput.h:237
Status
Definition: gdiplustypes.h:24
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
void AcpiExExitInterpreter(void)
Definition: exutils.c:139
void AcpiExEnterInterpreter(void)
Definition: exutils.c:91
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_STATUS AcpiExUnloadTable(ACPI_OPERAND_OBJECT *DdbHandle)
Definition: exconfig.c:554
ACPI_STATUS AcpiTbLoadTable(UINT32 TableIndex, ACPI_NAMESPACE_NODE *ParentNode)
Definition: tbdata.c:1062
ACPI_STATE_COMMON ACPI_NAMESPACE_NODE * Node
Definition: aclocal.h:740
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
static ACPI_STATUS AcpiExAddTable(UINT32 TableIndex, ACPI_OPERAND_OBJECT **DdbHandle)
Definition: exconfig.c:87
unsigned long long UINT64
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define AE_OK
Definition: acexcep.h:97
ACPI_SCOPE_STATE Scope
Definition: aclocal.h:825
ACPI_STATUS AcpiTbFindTable(char *Signature, char *OemId, char *OemTableId, UINT32 *TableIndex)
Definition: tbfind.c:70

Referenced by AcpiExOpcode_6A_0T_1R().

◆ AcpiExOpcode_0A_0T_1R()

ACPI_STATUS AcpiExOpcode_0A_0T_1R ( ACPI_WALK_STATE WalkState)

Naming convention for AML interpreter execution routines.

The routines that begin execution of AML opcodes are named with a common convention based upon the number of arguments, the number of target operands, and whether or not a value is returned:

 AcpiExOpcode_xA_yT_zR

Where:

xA - ARGUMENTS: The number of arguments (input operands) that are required for this opcode type (0 through 6 args). yT - TARGETS: The number of targets (output operands) that are required for this opcode type (0, 1, or 2 targets). zR - RETURN VALUE: Indicates whether this opcode type returns a value as the function return (0 or 1).

The AcpiExOpcode* functions are called via the Dispatcher component with fully resolved operands. !

Definition at line 92 of file exoparg1.c.

94 {
96  ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
97 
98 
99  ACPI_FUNCTION_TRACE_STR (ExOpcode_0A_0T_1R,
100  AcpiPsGetOpcodeName (WalkState->Opcode));
101 
102 
103  /* Examine the AML opcode */
104 
105  switch (WalkState->Opcode)
106  {
107  case AML_TIMER_OP: /* Timer () */
108