ReactOS 0.4.15-dev-7674-gc0b4db1
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
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 {
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}
unsigned int UINT32
#define AE_NOT_IMPLEMENTED
Definition: acexcep.h:122
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_NOT_EXIST
Definition: acexcep.h:114
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
#define ACPI_MUL_8(a)
Definition: acmacros.h:215
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_DB_BFIELD
Definition: acoutput.h:168
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
#define ACPI_IO_MASK
Definition: actypes.h:753
#define ACPI_READ
Definition: actypes.h:751
UINT32 ACPI_STATUS
Definition: actypes.h:460
const char * AcpiUtGetRegionName(UINT8 SpaceId)
Definition: utdecode.c:125
_In_ CDROM_SCAN_FOR_SPECIAL_INFO _In_ PCDROM_SCAN_FOR_SPECIAL_HANDLER Function
Definition: cdrom.h:1156
ACPI_STATUS AcpiEvAddressSpaceDispatch(ACPI_OPERAND_OBJECT *RegionObj, ACPI_OPERAND_OBJECT *FieldObj, UINT32 Function, UINT32 RegionOffset, UINT32 BitWidth, UINT64 *Value)
Definition: evregion.c:150
static ACPI_STATUS AcpiExSetupRegion(ACPI_OPERAND_OBJECT *ObjDesc, UINT32 FieldDatumByteOffset)
Definition: exfldio.c:92
Status
Definition: gdiplustypes.h:25
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object * RegionObj
Definition: acobject.h:336
ACPI_OBJECT_COMMON_HEADER UINT8 SpaceId
Definition: acobject.h:202
ACPI_PHYSICAL_ADDRESS Address
Definition: acobject.h:206
ACPI_OBJECT_REGION Region
Definition: acobject.h:527
ACPI_OBJECT_FIELD_COMMON CommonField
Definition: acobject.h:533
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

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 {
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
253}
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define return_VOID
Definition: acoutput.h:495
ACPI_THREAD_ID AcpiOsGetThreadId(void)
Definition: osl.c:217
#define ACPI_WAIT_FOREVER
Definition: actypes.h:501
#define AML_FIELD_LOCK_RULE_MASK
Definition: amlcode.h:443
ACPI_STATUS AcpiExAcquireMutexObject(UINT16 Timeout, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_THREAD_ID ThreadId)
Definition: exmutex.c:176

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}
unsigned short UINT16
#define AE_AML_INTERNAL
Definition: acexcep.h:194
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define AE_AML_MUTEX_ORDER
Definition: acexcep.h:200
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:306
static void AcpiExLinkMutex(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_THREAD_STATE *Thread)
Definition: exmutex.c:125
ACPI_OBJECT_COMMON_HEADER UINT8 SyncLevel
Definition: acobject.h:186
struct acpi_thread_state * OwnerThread
Definition: acobject.h:190
UINT16 AcquisitionDepth
Definition: acobject.h:187
ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:193
UINT8 OriginalSyncLevel
Definition: acobject.h:194
ACPI_STATE_COMMON UINT8 CurrentSyncLevel
Definition: aclocal.h:764
ACPI_THREAD_ID ThreadId
Definition: aclocal.h:767
ACPI_THREAD_STATE * Thread
Definition: acstruct.h:127
ACPI_OBJECT_MUTEX Mutex
Definition: acobject.h:526
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:520

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}
#define AE_OK
Definition: acexcep.h:97
#define NULL
Definition: types.h:112
ACPI_STATUS AcpiEvAcquireGlobalLock(UINT16 Timeout)
Definition: evglock.c:230
ACPI_STATUS AcpiExSystemWaitMutex(ACPI_MUTEX Mutex, UINT16 Timeout)
Definition: exsystem.c:120
static ULONG Timeout
Definition: ping.c:61
ACPI_THREAD_ID ThreadId
Definition: acobject.h:189
ACPI_MUTEX OsMutex
Definition: acobject.h:188

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 505 of file exregion.c.

512{
514
515
516 ACPI_FUNCTION_TRACE (ExCmosSpaceHandler);
517
518
520}

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}
INT Length1
Definition: FsRtlDissect.c:15
static USHORT USHORT * NewLength
unsigned char UINT8
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_RESOURCE_NAME_END_TAG
Definition: aclocal.h:1323
#define ACPI_PTR_DIFF(a, b)
Definition: actypes.h:548
ACPI_STATUS AcpiUtGetResourceEndTag(ACPI_OPERAND_OBJECT *ObjDesc, UINT8 **EndTag)
Definition: utresrc.c:636
ACPI_OPERAND_OBJECT * AcpiUtCreateBufferObject(ACPI_SIZE BufferSize)
Definition: utobject.c:258
struct aml_resource_end_tag AML_RESOURCE_END_TAG
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:522

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
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}
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
#define AE_TYPE
Definition: acexcep.h:116
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
#define ACPI_TYPE_STRING
Definition: actypes.h:689
#define ACPI_TYPE_BUFFER
Definition: actypes.h:690
#define ACPI_TYPE_INTEGER
Definition: actypes.h:688
ACPI_OBJECT_COMMON Common
Definition: acobject.h:519
ACPI_OBJECT_STRING String
Definition: acobject.h:521

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;
87 UINT32 i;
89
90
91 ACPI_FUNCTION_TRACE_PTR (ExConvertToInteger, ObjDesc);
92
93
94 switch (ObjDesc->Common.Type)
95 {
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}
unsigned long long UINT64
#define AE_AML_BUFFER_LIMIT
Definition: acexcep.h:189
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
UINT64 AcpiUtExplicitStrtoul64(char *String)
Definition: utstrtoul64.c:347
ACPI_OPERAND_OBJECT * AcpiUtCreateIntegerObject(UINT64 Value)
Definition: utobject.c:223
UINT64 AcpiUtImplicitStrtoul64(char *String)
Definition: utstrtoul64.c:259
BOOLEAN AcpiExTruncateFor32bitTable(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: exutils.c:177
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
int Count
Definition: noreturn.cpp:7
_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:409

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
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:7
#define ACPI_EXPLICIT_CONVERT_DECIMAL
Definition: acinterp.h:127
#define ACPI_EXPLICIT_CONVERT_HEX
Definition: acinterp.h:125
#define ACPI_IMPLICIT_CONVERT_HEX
Definition: acinterp.h:126
#define ACPI_MUL_2(a)
Definition: acmacros.h:207
#define ACPI_MAX_DECIMAL_DIGITS
Definition: actypes.h:491
ACPI_OPERAND_OBJECT * AcpiUtCreateStringObject(ACPI_SIZE StringSize)
Definition: utobject.c:320
static UINT32 AcpiExConvertToAscii(UINT64 Integer, UINT16 Base, UINT8 *String, UINT8 MaxLength)
Definition: exconvrt.c:315
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2439

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 {
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:
705
706 switch (DestinationType)
707 {
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 GET_CURRENT_ARG_TYPE(List)
Definition: acmacros.h:450
#define ACPI_DB_INFO
Definition: acoutput.h:153
#define ACPI_TYPE_BUFFER_FIELD
Definition: actypes.h:701
#define ACPI_TYPE_LOCAL_BANK_FIELD
Definition: actypes.h:717
#define ACPI_TYPE_LOCAL_REGION_FIELD
Definition: actypes.h:716
#define ACPI_TYPE_LOCAL_INDEX_FIELD
Definition: actypes.h:718
const char * AcpiUtGetTypeName(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:250
const char * AcpiUtGetObjectTypeName(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: utdecode.c:264
#define ACPI_IMPLICIT_CONVERSION
Definition: acutils.h:145
#define ARGI_REFERENCE
Definition: amlcode.h:279
#define ARGI_INTEGER_REF
Definition: amlcode.h:276
#define ARGI_FIXED_TARGET
Definition: amlcode.h:281
#define ARGI_TARGETREF
Definition: amlcode.h:280
#define ARGI_STORE_TARGET
Definition: amlcode.h:283
#define ARGI_SIMPLE_TARGET
Definition: amlcode.h:282
ACPI_STATUS AcpiExConvertToBuffer(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc)
Definition: exconvrt.c:224
ACPI_STATUS AcpiExConvertToInteger(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, UINT32 ImplicitConversion)
Definition: exconvrt.c:79
ACPI_STATUS AcpiExConvertToString(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, UINT32 Type)
Definition: exconvrt.c:440
UINT32 RuntimeArgs
Definition: aclocal.h:872
UINT16 Opcode
Definition: acstruct.h:78
const ACPI_OPCODE_INFO * OpInfo
Definition: acstruct.h:119

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 */
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
#define ACPI_TYPE_LOCAL_ALIAS
Definition: actypes.h:720
#define ACPI_TYPE_LOCAL_METHOD_ALIAS
Definition: actypes.h:721
#define ACPI_TYPE_METHOD
Definition: actypes.h:695
union acpi_operand_object * Object
Definition: aclocal.h:187
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105

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
181Cleanup:
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}
ACPI_STATUS AcpiNsAttachObject(ACPI_NAMESPACE_NODE *Node, ACPI_OPERAND_OBJECT *Object, ACPI_OBJECT_TYPE Type)
Definition: nsobject.c:76
ACPI_STATUS AcpiOsCreateSemaphore(UINT32 MaxUnits, UINT32 InitialUnits, ACPI_SEMAPHORE *OutHandle)
Definition: osl.c:352
#define ACPI_NO_UNIT_LIMIT
Definition: acpiosxf.h:67
#define ACPI_TYPE_EVENT
Definition: actypes.h:694
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:681
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:790
static const WCHAR Cleanup[]
Definition: register.c:80
ACPI_OBJECT_COMMON_HEADER ACPI_SEMAPHORE OsSemaphore
Definition: acobject.h:178
ACPI_OBJECT_EVENT Event
Definition: acobject.h:524

Referenced by AcpiDsLoad2EndOp().

◆ AcpiExCreateMethod()

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

Definition at line 484 of file excreate.c.

488{
489 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
490 ACPI_OPERAND_OBJECT *ObjDesc;
492 UINT8 MethodFlags;
493
494
495 ACPI_FUNCTION_TRACE_PTR (ExCreateMethod, WalkState);
496
497
498 /* Create a new method object */
499
501 if (!ObjDesc)
502 {
504 goto Exit;
505 }
506
507 /* Save the method's AML pointer and length */
508
509 ObjDesc->Method.AmlStart = AmlStart;
510 ObjDesc->Method.AmlLength = AmlLength;
511 ObjDesc->Method.Node = Operand[0];
512
513 /*
514 * Disassemble the method flags. Split off the ArgCount, Serialized
515 * flag, and SyncLevel for efficiency.
516 */
517 MethodFlags = (UINT8) Operand[1]->Integer.Value;
518 ObjDesc->Method.ParamCount = (UINT8)
519 (MethodFlags & AML_METHOD_ARG_COUNT);
520
521 /*
522 * Get the SyncLevel. If method is serialized, a mutex will be
523 * created for this method when it is parsed.
524 */
525 if (MethodFlags & AML_METHOD_SERIALIZED)
526 {
528
529 /*
530 * ACPI 1.0: SyncLevel = 0
531 * ACPI 2.0: SyncLevel = SyncLevel in method declaration
532 */
533 ObjDesc->Method.SyncLevel = (UINT8)
534 ((MethodFlags & AML_METHOD_SYNC_LEVEL) >> 4);
535 }
536
537 /* Attach the new object to the method Node */
538
540 ObjDesc, ACPI_TYPE_METHOD);
541
542 /* Remove local reference to the object */
543
544 AcpiUtRemoveReference (ObjDesc);
545
546Exit:
547 /* Remove a reference to the operand */
548
549 AcpiUtRemoveReference (Operand[1]);
551}
#define ACPI_METHOD_SERIALIZED
Definition: acobject.h:238
#define AML_METHOD_ARG_COUNT
Definition: amlcode.h:505
#define AML_METHOD_SERIALIZED
Definition: amlcode.h:506
#define AML_METHOD_SYNC_LEVEL
Definition: amlcode.h:507
static void Exit(void)
Definition: sock.c:1330
UINT8 * AmlStart
Definition: acobject.h:221
ACPI_OBJECT_COMMON_HEADER UINT8 InfoFlags
Definition: acobject.h:216
union acpi_operand_object * Node
Definition: acobject.h:220
ACPI_OBJECT_METHOD Method
Definition: acobject.h:525

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
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
242Cleanup:
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 ACPI_WALK_OPERANDS
Definition: acinterp.h:48
#define ACPI_TYPE_MUTEX
Definition: actypes.h:696
#define AcpiOsCreateMutex(OutHandle)
Definition: actypes.h:274

Referenced by AcpiDsLoad2EndOp().

◆ AcpiExCreatePowerResource()

ACPI_STATUS AcpiExCreatePowerResource ( ACPI_WALK_STATE WalkState)

Definition at line 433 of file excreate.c.

435{
436 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
438 ACPI_OPERAND_OBJECT *ObjDesc;
439
440
441 ACPI_FUNCTION_TRACE_PTR (ExCreatePowerResource, WalkState);
442
443
444 /* Create the power resource object */
445
447 if (!ObjDesc)
448 {
450 }
451
452 /* Initialize the power object from the operands */
453
454 ObjDesc->PowerResource.SystemLevel = (UINT8) Operand[1]->Integer.Value;
455 ObjDesc->PowerResource.ResourceOrder = (UINT16) Operand[2]->Integer.Value;
456
457 /* Install the power resource object in the parent Node */
458
460 ObjDesc, ACPI_TYPE_POWER);
461
462 /* Remove local reference to the object */
463
464 AcpiUtRemoveReference (ObjDesc);
466}
#define ACPI_TYPE_POWER
Definition: actypes.h:698
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO UINT32 SystemLevel
Definition: acobject.h:280
ACPI_OBJECT_POWER_RESOURCE PowerResource
Definition: acobject.h:530

Referenced by AcpiDsLoad2EndOp().

◆ AcpiExCreateProcessor()

ACPI_STATUS AcpiExCreateProcessor ( ACPI_WALK_STATE WalkState)

Definition at line 381 of file excreate.c.

383{
384 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
385 ACPI_OPERAND_OBJECT *ObjDesc;
387
388
389 ACPI_FUNCTION_TRACE_PTR (ExCreateProcessor, WalkState);
390
391
392 /* Create the processor object */
393
395 if (!ObjDesc)
396 {
398 }
399
400 /* Initialize the processor object from the operands */
401
402 ObjDesc->Processor.ProcId = (UINT8) Operand[1]->Integer.Value;
403 ObjDesc->Processor.Length = (UINT8) Operand[3]->Integer.Value;
404 ObjDesc->Processor.Address = (ACPI_IO_ADDRESS) Operand[2]->Integer.Value;
405
406 /* Install the processor object in the parent Node */
407
409 ObjDesc, ACPI_TYPE_PROCESSOR);
410
411 /* Remove local reference to the object */
412
413 AcpiUtRemoveReference (ObjDesc);
415}
#define ACPI_TYPE_PROCESSOR
Definition: actypes.h:699
ACPI_COMMON_NOTIFY_INFO ACPI_IO_ADDRESS Address
Definition: acobject.h:295
ACPI_OBJECT_COMMON_HEADER UINT8 ProcId
Definition: acobject.h:292
ACPI_OBJECT_PROCESSOR Processor
Definition: acobject.h:531

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.Pointer = NULL;
346 ObjDesc->Region.Node = Node;
347 ObjDesc->Region.Handler = NULL;
348 ObjDesc->Common.Flags &=
351
352 /* Install the new region object in the parent Node */
353
355
356
357Cleanup:
358
359 /* Remove local reference to the object */
360
361 AcpiUtRemoveReference (ObjDesc);
363}
ACPI_OPERAND_OBJECT * AcpiNsGetSecondaryObject(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: nsobject.c:346
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
#define AOPOBJ_REG_CONNECTED
Definition: acobject.h:98
#define AOPOBJ_OBJECT_INITIALIZED
Definition: acobject.h:97
#define AOPOBJ_SETUP_COMPLETE
Definition: acobject.h:99
#define ACPI_DB_LOAD
Definition: acoutput.h:164
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx 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:832
#define ACPI_TYPE_REGION
Definition: actypes.h:697
union node Node
Definition: types.h:1255
BOOLEAN AcpiIsValidSpaceId(UINT8 SpaceId)
Definition: exutils.c:494
ACPI_OBJECT_COMMON_HEADER ACPI_NAMESPACE_NODE * Method_REG
Definition: acobject.h:481
UINT32 AmlLength
Definition: acobject.h:485
ACPI_NAMESPACE_NODE * ScopeNode
Definition: acobject.h:482
UINT8 * AmlStart
Definition: acobject.h:484
ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:203
union acpi_operand_object * Handler
Definition: acobject.h:204
ACPI_STATE_COMMON ACPI_NAMESPACE_NODE * Node
Definition: aclocal.h:740
ACPI_PARSE_OBJECT * Op
Definition: acstruct.h:118
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
ACPI_SCOPE_STATE Scope
Definition: aclocal.h:825
ACPI_OBJECT_EXTRA Extra
Definition: acobject.h:541
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
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 579 of file exregion.c.

586{
588 char *Pointer;
589
590
591 ACPI_FUNCTION_TRACE (ExDataTableSpaceHandler);
592
593
594 Mapping = (ACPI_DATA_TABLE_MAPPING *) RegionContext;
595 Pointer = ACPI_CAST_PTR (char, Mapping->Pointer) +
596 (Address - ACPI_PTR_TO_PHYSADDR (Mapping->Pointer));
597
598 /*
599 * Perform the memory read or write. The BitWidth was already
600 * validated.
601 */
602 switch (Function)
603 {
604 case ACPI_READ:
605
606 memcpy (ACPI_CAST_PTR (char, Value), Pointer, ACPI_DIV_8 (BitWidth));
607 break;
608
609 case ACPI_WRITE:
610
611 memcpy (Pointer, ACPI_CAST_PTR (char, Value), ACPI_DIV_8 (BitWidth));
612 break;
613
614 default:
615
617 }
618
620}
#define ACPI_DIV_8(a)
Definition: acmacros.h:214
#define ACPI_WRITE
Definition: actypes.h:752
#define ACPI_PTR_TO_PHYSADDR(i)
Definition: actypes.h:559
static PVOID Mapping[EMS_PHYSICAL_PAGES]
Definition: emsdrv.c:41
static WCHAR Address[46]
Definition: ping.c:68

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 {
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 {
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 {
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 {
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 {
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
315Cleanup:
316 if (LocalOperand0 != Operand0)
317 {
318 AcpiUtRemoveReference (LocalOperand0);
319 }
320
321 if (LocalOperand1 != Operand1)
322 {
323 AcpiUtRemoveReference (LocalOperand1);
324 }
325
327}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
UINT32 ACPI_OBJECT_TYPE
Definition: actypes.h:685
Definition: bufpool.h:45
static ACPI_STATUS AcpiExConvertToObjectTypeString(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc)
Definition: exconcat.c:346

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;
84 ACPI_OPERAND_OBJECT *ObjectDesc;
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");
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");
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);
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);
174 }
175 else
176 {
178 }
179
180 /* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */
181
182 switch (SourceDesc->Common.Type)
183 {
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
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 {
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 {
236
237 AcpiOsPrintf ("0x%X\n", SourceDesc->Reference.Value);
238 break;
239
241
242 /* Case for DdbHandle */
243
244 AcpiOsPrintf ("Table Index 0x%X\n", SourceDesc->Reference.Value);
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
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
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
352}
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414
#define ACPI_DESC_TYPE_OPERAND
Definition: acobject.h:576
#define ACPI_DESC_TYPE_NAMED
Definition: acobject.h:577
@ ACPI_REFCLASS_TABLE
Definition: acobject.h:463
@ ACPI_REFCLASS_INDEX
Definition: acobject.h:462
#define ACPI_LV_DEBUG_OBJECT
Definition: acoutput.h:89
UINT64 AcpiOsGetTimer(void)
Definition: osl.c:884
void ACPI_INTERNAL_VAR_XFACE AcpiOsPrintf(const char *Format,...)
Definition: osl.c:851
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:719
#define ACPI_TYPE_DEVICE
Definition: actypes.h:693
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:691
#define ACPI_TYPE_THERMAL
Definition: actypes.h:700
const char * AcpiUtGetReferenceName(ACPI_OPERAND_OBJECT *Object)
Definition: utdecode.c:426
BOOLEAN AcpiUtValidInternalObject(void *Object)
Definition: utobject.c:376
void AcpiUtDumpBuffer(UINT8 *Buffer, UINT32 Count, UINT32 Display, UINT32 Offset)
Definition: utbuffer.c:71
#define DB_BYTE_DISPLAY
Definition: acutils.h:186
void AcpiExDoDebugObject(ACPI_OPERAND_OBJECT *SourceDesc, UINT32 Level, UINT32 Index)
Definition: exdebug.c:77
ACPI_NAME_UNION Name
Definition: aclocal.h:191
union acpi_operand_object ** Elements
Definition: acobject.h:161
union acpi_operand_object ** Where
Definition: acobject.h:448
ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:447
ACPI_OBJECT_COMMON_HEADER UINT8 Class
Definition: acobject.h:443
char Ascii[4]
Definition: actbl.h:394
ACPI_OBJECT_REFERENCE Reference
Definition: acobject.h:540
ACPI_OBJECT_PACKAGE Package
Definition: acobject.h:523
_In_ WDFCOLLECTION _In_ ULONG Index
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:56

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}
unsigned char BOOLEAN
#define AML_LOGICAL_OR_OP
Definition: amlcode.h:121
#define AML_LOGICAL_AND_OP
Definition: amlcode.h:120
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
_In_ PVOID _In_ ULONG Opcode
Definition: hubbusif.h:331

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;
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 {
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
521Cleanup:
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}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define AML_LOGICAL_GREATER_OP
Definition: amlcode.h:124
#define AML_LOGICAL_LESS_OP
Definition: amlcode.h:125
#define AML_LOGICAL_EQUAL_OP
Definition: amlcode.h:123

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 ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
#define AML_SHIFT_RIGHT_OP
Definition: amlcode.h:98
#define AML_BIT_XOR_OP
Definition: amlcode.h:103
#define AML_BIT_NOR_OP
Definition: amlcode.h:102
#define AML_SHIFT_LEFT_OP
Definition: amlcode.h:97
#define AML_SUBTRACT_OP
Definition: amlcode.h:92
#define AML_BIT_AND_OP
Definition: amlcode.h:99
#define AML_BIT_NAND_OP
Definition: amlcode.h:100
#define AML_BIT_OR_OP
Definition: amlcode.h:101
#define AML_ADD_OP
Definition: amlcode.h:90
#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
#define ACPI_UINT32_MAX
Definition: actypes.h:66
UINT32 AcpiUtDwordByteSwap(UINT32 Value)
Definition: utmisc.c:136
char AcpiUtHexToAsciiChar(UINT64 Integer, UINT32 Position)
Definition: uthex.c:74
unsigned char
Definition: typeof.h:29

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
112}
#define ACPI_MTX_INTERPRETER
Definition: aclocal.h:84
#define ACPI_MTX_NAMESPACE
Definition: aclocal.h:85
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256

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  )

◆ 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
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 AE_BUFFER_OVERFLOW
Definition: acexcep.h:119
#define ACPI_MASK_BITS_ABOVE(position)
Definition: acmacros.h:344
#define ACPI_ROUND_UP_TO(value, boundary)
Definition: acmacros.h:263
#define ACPI_ROUND_BITS_UP_TO_BYTES(a)
Definition: acmacros.h:256
#define ACPI_MIN(a, b)
Definition: actypes.h:535
#define ACPI_INTEGER_BIT_SIZE
Definition: actypes.h:490
static ACPI_STATUS AcpiExFieldDatumIo(ACPI_OPERAND_OBJECT *ObjDesc, UINT32 FieldDatumByteOffset, UINT64 *Value, UINT32 ReadWrite)
Definition: exfldio.c:402
#define memset(x, y, z)
Definition: compat.h:39
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

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
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
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 AE_AML_BAD_NAME
Definition: acexcep.h:192
#define AE_CTRL_PENDING
Definition: acexcep.h:225
#define ACPI_FREE(a)
Definition: actypes.h:386
#define AML_PARENT_PREFIX
Definition: amlcode.h:70
#define AML_DUAL_NAME_PREFIX
Definition: amlcode.h:66
#define AML_MULTI_NAME_PREFIX
Definition: amlcode.h:67
#define AML_ROOT_PREFIX
Definition: amlcode.h:69
BOOL HasPrefix(_In_ PWSTR pszString, _In_ PWSTR pszPrefix, _Out_opt_ PWSTR *pszSuffix)
Definition: misc.c:58
static ACPI_STATUS AcpiExNameSegment(UINT8 **InAmlAddress, char *NameString)
Definition: exnames.c:179
static char * AcpiExAllocateNameString(UINT32 PrefixCount, UINT32 NumNameSegs)
Definition: exnames.c:82
DataType
Definition: simd.h:252

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 {
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_AML_OPERAND_TYPE
Definition: acexcep.h:182
@ ACPI_REFCLASS_ARG
Definition: acobject.h:460
@ ACPI_REFCLASS_LOCAL
Definition: acobject.h:459
@ ACPI_REFCLASS_REFOF
Definition: acobject.h:461
@ ACPI_REFCLASS_DEBUG
Definition: acobject.h:465

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}
#define AE_AML_PROTOCOL
Definition: acexcep.h:215
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:43
#define ACPI_INVALID_PROTOCOL_ID
Definition: exfield.c:59
static const UINT8 AcpiProtocolLengths[]
Definition: exfield.c:62
#define ACPI_MAX_PROTOCOL_ID
Definition: exfield.c:60
_In_ UINT ProtocolId
Definition: ndis.h:2924

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
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
1040Exit:
1041 /* Free temporary buffer if we used one */
1042
1043 if (NewBuffer)
1044 {
1045 ACPI_FREE (NewBuffer);
1046 }
1048}
#define ACPI_MASK_BITS_ABOVE_64(width)
Definition: acmacros.h:348
#define ACPI_MASK_BITS_BELOW(position)
Definition: acmacros.h:345
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
ACPI_STATUS AcpiExWriteWithUpdateRule(ACPI_OPERAND_OBJECT *ObjDesc, UINT64 Mask, UINT64 FieldValue, UINT32 FieldDatumByteOffset)
Definition: exfldio.c:617
unsigned int Mask
Definition: fpcontrol.c:82
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:30

Referenced by AcpiExFieldDatumIo(), and AcpiExWriteDataToField().

◆ AcpiExIntegerToString()

void AcpiExIntegerToString ( char Dest,
UINT64  Value 
)

Definition at line 421 of file exutils.c.

424{
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}
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:3045

Referenced by AcpiUtExecute_UID().

◆ AcpiExLoadOp()

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

Definition at line 343 of file exconfig.c.

347{
348 ACPI_OPERAND_OBJECT *DdbHandle;
349 ACPI_TABLE_HEADER *TableHeader;
351 UINT32 TableIndex;
354
355
356 ACPI_FUNCTION_TRACE (ExLoadOp);
357
358
359 if (Target->Common.DescriptorType == ACPI_DESC_TYPE_NAMED)
360 {
362 }
363 if (Target->Common.Type != ACPI_TYPE_INTEGER)
364 {
365 ACPI_ERROR ((AE_INFO, "Type not integer: %X", Target->Common.Type));
367 }
368
369 Target->Integer.Value = 0;
370
371 /* Source Object can be either an OpRegion or a Buffer/Field */
372
373 switch (ObjDesc->Common.Type)
374 {
375 case ACPI_TYPE_REGION:
376
378 "Load table from Region %p\n", ObjDesc));
379
380 /* Region must be SystemMemory (from ACPI spec) */
381
383 {
385 }
386
387 /*
388 * If the Region Address and Length have not been previously
389 * evaluated, evaluate them now and save the results.
390 */
391 if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID))
392 {
394 if (ACPI_FAILURE (Status))
395 {
397 }
398 }
399
400 /* Get the table header first so we can get the table length */
401
402 TableHeader = ACPI_ALLOCATE (sizeof (ACPI_TABLE_HEADER));
403 if (!TableHeader)
404 {
406 }
407
408 Status = AcpiExRegionRead (ObjDesc, sizeof (ACPI_TABLE_HEADER),
409 ACPI_CAST_PTR (UINT8, TableHeader));
410 Length = TableHeader->Length;
411 ACPI_FREE (TableHeader);
412
413 if (ACPI_FAILURE (Status))
414 {
416 }
417
418 /* Must have at least an ACPI table header */
419
420 if (Length < sizeof (ACPI_TABLE_HEADER))
421 {
423 }
424
425 /*
426 * The original implementation simply mapped the table, with no copy.
427 * However, the memory region is not guaranteed to remain stable and
428 * we must copy the table to a local buffer. For example, the memory
429 * region is corrupted after suspend on some machines. Dynamically
430 * loaded tables are usually small, so this overhead is minimal.
431 *
432 * The latest implementation (5/2009) does not use a mapping at all.
433 * We use the low-level operation region interface to read the table
434 * instead of the obvious optimization of using a direct mapping.
435 * This maintains a consistent use of operation regions across the
436 * entire subsystem. This is important if additional processing must
437 * be performed in the (possibly user-installed) operation region
438 * handler. For example, AcpiExec and ASLTS depend on this.
439 */
440
441 /* Allocate a buffer for the table */
442
444 if (!Table)
445 {
447 }
448
449 /* Read the entire table */
450
451 Status = AcpiExRegionRead (ObjDesc, Length,
453 if (ACPI_FAILURE (Status))
454 {
457 }
458 break;
459
460 case ACPI_TYPE_BUFFER: /* Buffer or resolved RegionField */
461
463 "Load table from Buffer or Field %p\n", ObjDesc));
464
465 /* Must have at least an ACPI table header */
466
467 if (ObjDesc->Buffer.Length < sizeof (ACPI_TABLE_HEADER))
468 {
470 }
471
472 /* Get the actual table length from the table header */
473
474 TableHeader = ACPI_CAST_PTR (
475 ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer);
476 Length = TableHeader->Length;
477
478 /* Table cannot extend beyond the buffer */
479
480 if (Length > ObjDesc->Buffer.Length)
481 {
483 }
484 if (Length < sizeof (ACPI_TABLE_HEADER))
485 {
487 }
488
489 /*
490 * Copy the table from the buffer because the buffer could be
491 * modified or even deleted in the future
492 */
494 if (!Table)
495 {
497 }
498
499 memcpy (Table, TableHeader, Length);
500 break;
501
502 default:
503
505 }
506
507 /* Install the new table into the local data structures */
508
509 ACPI_INFO (("Dynamic OEM Table Load:"));
514 if (ACPI_FAILURE (Status))
515 {
516 /* Delete allocated table buffer */
517
520 }
521
522 /*
523 * Add the table to the namespace.
524 *
525 * Note: Load the table objects relative to the root of the namespace.
526 * This appears to go against the ACPI specification, but we do it for
527 * compatibility with other ACPI implementations.
528 */
529 Status = AcpiExAddTable (TableIndex, &DdbHandle);
530 if (ACPI_FAILURE (Status))
531 {
533 }
534
535 /* Complete the initialization/resolution of new objects */
536
540
541 /* Remove the reference to DdbHandle created by AcpiExAddTable above */
542
543 AcpiUtRemoveReference (DdbHandle);
544
545 /* Return -1 (non-zero) indicates success */
546
547 Target->Integer.Value = 0xFFFFFFFFFFFFFFFF;
549}
#define AE_INVALID_TABLE_LENGTH
Definition: acexcep.h:171
ACPI_STATUS AcpiNsInitializeObjects(void)
Definition: nsinit.c:92
#define ACPI_INFO(plist)
Definition: acoutput.h:237
ACPI_STATUS AcpiTbInstallAndLoadTable(ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, ACPI_TABLE_HEADER *Table, BOOLEAN Override, UINT32 *TableIndex)
Definition: tbdata.c:1162
#define ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL
Definition: actbl.h:431
#define ACPI_ADR_SPACE_SYSTEM_MEMORY
Definition: actypes.h:861
#define ACPI_ALLOCATE(a)
Definition: actypes.h:384
ACPI_STATUS AcpiDsGetRegionArguments(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: dsargs.c:395
static ACPI_STATUS AcpiExRegionRead(ACPI_OPERAND_OBJECT *ObjDesc, UINT32 Length, UINT8 *Buffer)
Definition: exconfig.c:290
static ACPI_STATUS AcpiExAddTable(UINT32 TableIndex, ACPI_OPERAND_OBJECT **DdbHandle)
Definition: exconfig.c:87
void AcpiExExitInterpreter(void)
Definition: exutils.c:139
void AcpiExEnterInterpreter(void)
Definition: exutils.c:91
ASMGENDATA Table[]
Definition: genincdata.c:61
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
UINT32 Length
Definition: actbl.h:109
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

Referenced by AcpiExOpcode_1A_1T_1R().

◆ 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 *ReturnObj;
139 ACPI_OPERAND_OBJECT *DdbHandle;
140 UINT32 TableIndex;
141
142
143 ACPI_FUNCTION_TRACE (ExLoadTableOp);
144
145
146 /* Create the return object */
147
148 ReturnObj = AcpiUtCreateIntegerObject ((UINT64) 0);
149 if (!ReturnObj)
150 {
152 }
153
154 *ReturnDesc = ReturnObj;
155
156 /* Find the ACPI table in the RSDT/XSDT */
157
160 Operand[0]->String.Pointer,
161 Operand[1]->String.Pointer,
162 Operand[2]->String.Pointer, &TableIndex);
164 if (ACPI_FAILURE (Status))
165 {
166 if (Status != AE_NOT_FOUND)
167 {
169 }
170
171 /* Table not found, return an Integer=0 and AE_OK */
172
174 }
175
176 /* Default nodes */
177
178 StartNode = WalkState->ScopeInfo->Scope.Node;
179 ParentNode = AcpiGbl_RootNode;
180
181 /* RootPath (optional parameter) */
182
183 if (Operand[3]->String.Length > 0)
184 {
185 /*
186 * Find the node referenced by the RootPathString. This is the
187 * location within the namespace where the table will be loaded.
188 */
189 Status = AcpiNsGetNodeUnlocked (StartNode,
190 Operand[3]->String.Pointer, ACPI_NS_SEARCH_PARENT,
191 &ParentNode);
192 if (ACPI_FAILURE (Status))
193 {
195 }
196 }
197
198 /* ParameterPath (optional parameter) */
199
200 if (Operand[4]->String.Length > 0)
201 {
202 if ((Operand[4]->String.Pointer[0] != AML_ROOT_PREFIX) &&
203 (Operand[4]->String.Pointer[0] != AML_PARENT_PREFIX))
204 {
205 /*
206 * Path is not absolute, so it will be relative to the node
207 * referenced by the RootPathString (or the NS root if omitted)
208 */
209 StartNode = ParentNode;
210 }
211
212 /* Find the node referenced by the ParameterPathString */
213
214 Status = AcpiNsGetNodeUnlocked (StartNode,
215 Operand[4]->String.Pointer, ACPI_NS_SEARCH_PARENT,
216 &ParameterNode);
217 if (ACPI_FAILURE (Status))
218 {
220 }
221 }
222
223 /* Load the table into the namespace */
224
225 ACPI_INFO (("Dynamic OEM Table Load:"));
227 Status = AcpiTbLoadTable (TableIndex, ParentNode);
229 if (ACPI_FAILURE (Status))
230 {
232 }
233
234 Status = AcpiExAddTable (TableIndex, &DdbHandle);
235 if (ACPI_FAILURE (Status))
236 {
238 }
239
240 /* Complete the initialization/resolution of new objects */
241
245
246 /* Parameter Data (optional) */
247
248 if (ParameterNode)
249 {
250 /* Store the parameter data into the optional parameter object */
251
252 Status = AcpiExStore (Operand[5],
253 ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode), WalkState);
254 if (ACPI_FAILURE (Status))
255 {
256 (void) AcpiExUnloadTable (DdbHandle);
257
258 AcpiUtRemoveReference (DdbHandle);
260 }
261 }
262
263 /* Remove the reference to DdbHandle created by AcpiExAddTable above */
264
265 AcpiUtRemoveReference (DdbHandle);
266
267 /* Return -1 (non-zero) indicates success */
268
269 ReturnObj->Integer.Value = 0xFFFFFFFFFFFFFFFF;
271}
#define AE_NOT_FOUND
Definition: acexcep.h:113
ACPI_STATUS AcpiNsGetNodeUnlocked(ACPI_NAMESPACE_NODE *PrefixNode, const char *ExternalPathname, UINT32 Flags, ACPI_NAMESPACE_NODE **OutNode)
Definition: nsutils.c:777
#define ACPI_NS_SEARCH_PARENT
Definition: acnamesp.h:63
ACPI_STATUS AcpiTbLoadTable(UINT32 TableIndex, ACPI_NAMESPACE_NODE *ParentNode)
Definition: tbdata.c:1097
ACPI_STATUS AcpiTbFindTable(char *Signature, char *OemId, char *OemTableId, UINT32 *TableIndex)
Definition: tbfind.c:70
ACPI_STATUS AcpiExUnloadTable(ACPI_OPERAND_OBJECT *DdbHandle)
Definition: exconfig.c:565
ACPI_STATUS AcpiExStore(ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *DestDesc, ACPI_WALK_STATE *WalkState)
Definition: exstore.c:91
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433

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
109 /* Create a return object of type Integer */
110
112 if (!ReturnDesc)
113 {
115 goto Cleanup;
116 }
117 break;
118
119 default: /* Unknown opcode */
120
121 ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
122 WalkState->Opcode));
124 break;
125 }
126
127Cleanup:
128
129 /* Delete return object on error */
130
131 if ((ACPI_FAILURE (Status)) || WalkState->ResultObj)
132 {
133 AcpiUtRemoveReference (ReturnDesc);
134 WalkState->ResultObj = NULL;
135 }
136 else
137 {
138 /* Save the return value */
139
140 WalkState->ResultObj = ReturnDesc;
141 }
142
144}
#define AE_AML_BAD_OPCODE
Definition: acexcep.h:180
#define ACPI_FUNCTION_TRACE_STR(a, b)
Definition: acoutput.h:483
const char * AcpiPsGetOpcodeName(UINT16 Opcode)
Definition: psopinfo.c:169
#define AML_TIMER_OP
Definition: amlcode.h:179
union acpi_operand_object * ResultObj
Definition: acstruct.h:121

◆ AcpiExOpcode_1A_0T_0R()

ACPI_STATUS AcpiExOpcode_1A_0T_0R ( ACPI_WALK_STATE WalkState)

Definition at line 161 of file exoparg1.c.

163{
164 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
166
167
168 ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_0T_0R,
169 AcpiPsGetOpcodeName (WalkState->Opcode));
170
171
172 /* Examine the AML opcode */
173
174 switch (WalkState->Opcode)
175 {
176 case AML_RELEASE_OP: /* Release (MutexObject) */
177
178 Status = AcpiExReleaseMutex (Operand[0], WalkState);
179 break;
180
181 case AML_RESET_OP: /* Reset (EventObject) */
182
183 Status = AcpiExSystemResetEvent (Operand[0]);
184 break;
185
186 case AML_SIGNAL_OP: /* Signal (EventObject) */
187
188 Status = AcpiExSystemSignalEvent (Operand[0]);
189 break;
190
191 case AML_SLEEP_OP: /* Sleep (MsecTime) */
192
193 Status = AcpiExSystemDoSleep (Operand[0]->Integer.Value);
194 break;
195
196 case AML_STALL_OP: /* Stall (UsecTime) */
197
198 Status = AcpiExSystemDoStall ((UINT32) Operand[0]->Integer.Value);
199 break;
200
201 case AML_UNLOAD_OP: /* Unload (Handle) */
202
203 Status = AcpiExUnloadTable (Operand[0]);
204 break;
205
206 default: /* Unknown opcode */
207
208 ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
209 WalkState->Opcode));
211 break;
212 }
213
215}
#define AML_RELEASE_OP
Definition: amlcode.h:172
#define AML_STALL_OP
Definition: amlcode.h:166
#define AML_SIGNAL_OP
Definition: amlcode.h:169
#define AML_RESET_OP
Definition: amlcode.h:171
#define AML_UNLOAD_OP
Definition: amlcode.h:175
#define AML_SLEEP_OP
Definition: amlcode.h:167
ACPI_STATUS AcpiExReleaseMutex(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState)
Definition: exmutex.c:408
ACPI_STATUS AcpiExSystemDoStall(UINT32 HowLongUs)
Definition: exsystem.c:174
ACPI_STATUS AcpiExSystemDoSleep(UINT64 HowLongMs)
Definition: exsystem.c:223
ACPI_STATUS AcpiExSystemSignalEvent(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: exsystem.c:265
ACPI_STATUS AcpiExSystemResetEvent(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: exsystem.c:332

◆ AcpiExOpcode_1A_0T_1R()

ACPI_STATUS AcpiExOpcode_1A_0T_1R ( ACPI_WALK_STATE WalkState)

Definition at line 642 of file exoparg1.c.

644{
645 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
646 ACPI_OPERAND_OBJECT *TempDesc;
647 ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
649 UINT32 Type;
651
652
653 ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_0T_1R,
654 AcpiPsGetOpcodeName (WalkState->Opcode));
655
656
657 /* Examine the AML opcode */
658
659 switch (WalkState->Opcode)
660 {
661 case AML_LOGICAL_NOT_OP: /* LNot (Operand) */
662
663 ReturnDesc = AcpiUtCreateIntegerObject ((UINT64) 0);
664 if (!ReturnDesc)
665 {
667 goto Cleanup;
668 }
669
670 /*
671 * Set result to ONES (TRUE) if Value == 0. Note:
672 * ReturnDesc->Integer.Value is initially == 0 (FALSE) from above.
673 */
674 if (!Operand[0]->Integer.Value)
675 {
676 ReturnDesc->Integer.Value = ACPI_UINT64_MAX;
677 }
678 break;
679
680 case AML_DECREMENT_OP: /* Decrement (Operand) */
681 case AML_INCREMENT_OP: /* Increment (Operand) */
682 /*
683 * Create a new integer. Can't just get the base integer and
684 * increment it because it may be an Arg or Field.
685 */
687 if (!ReturnDesc)
688 {
690 goto Cleanup;
691 }
692
693 /*
694 * Since we are expecting a Reference operand, it can be either a
695 * NS Node or an internal object.
696 */
697 TempDesc = Operand[0];
699 {
700 /* Internal reference object - prevent deletion */
701
702 AcpiUtAddReference (TempDesc);
703 }
704
705 /*
706 * Convert the Reference operand to an Integer (This removes a
707 * reference on the Operand[0] object)
708 *
709 * NOTE: We use LNOT_OP here in order to force resolution of the
710 * reference operand to an actual integer.
711 */
713 &TempDesc, WalkState);
714 if (ACPI_FAILURE (Status))
715 {
717 "While resolving operands for [%s]",
718 AcpiPsGetOpcodeName (WalkState->Opcode)));
719
720 goto Cleanup;
721 }
722
723 /*
724 * TempDesc is now guaranteed to be an Integer object --
725 * Perform the actual increment or decrement
726 */
727 if (WalkState->Opcode == AML_INCREMENT_OP)
728 {
729 ReturnDesc->Integer.Value = TempDesc->Integer.Value + 1;
730 }
731 else
732 {
733 ReturnDesc->Integer.Value = TempDesc->Integer.Value - 1;
734 }
735
736 /* Finished with this Integer object */
737
738 AcpiUtRemoveReference (TempDesc);
739
740 /*
741 * Store the result back (indirectly) through the original
742 * Reference object
743 */
744 Status = AcpiExStore (ReturnDesc, Operand[0], WalkState);
745 break;
746
747 case AML_OBJECT_TYPE_OP: /* ObjectType (SourceObject) */
748 /*
749 * Note: The operand is not resolved at this point because we want to
750 * get the associated object, not its value. For example, we don't
751 * want to resolve a FieldUnit to its value, we want the actual
752 * FieldUnit object.
753 */
754
755 /* Get the type of the base object */
756
757 Status = AcpiExResolveMultiple (WalkState, Operand[0], &Type, NULL);
758 if (ACPI_FAILURE (Status))
759 {
760 goto Cleanup;
761 }
762
763 /* Allocate a descriptor to hold the type. */
764
765 ReturnDesc = AcpiUtCreateIntegerObject ((UINT64) Type);
766 if (!ReturnDesc)
767 {
769 goto Cleanup;
770 }
771 break;
772
773 case AML_SIZE_OF_OP: /* SizeOf (SourceObject) */
774 /*
775 * Note: The operand is not resolved at this point because we want to
776 * get the associated object, not its value.
777 */
778
779 /* Get the base object */
780
782 WalkState, Operand[0], &Type, &TempDesc);
783 if (ACPI_FAILURE (Status))
784 {
785 goto Cleanup;
786 }
787
788 /*
789 * The type of the base object must be integer, buffer, string, or
790 * package. All others are not supported.
791 *
792 * NOTE: Integer is not specifically supported by the ACPI spec,
793 * but is supported implicitly via implicit operand conversion.
794 * rather than bother with conversion, we just use the byte width
795 * global (4 or 8 bytes).
796 */
797 switch (Type)
798 {
800
801 Value = AcpiGbl_IntegerByteWidth;
802 break;
803
804 case ACPI_TYPE_STRING:
805
806 Value = TempDesc->String.Length;
807 break;
808
809 case ACPI_TYPE_BUFFER:
810
811 /* Buffer arguments may not be evaluated at this point */
812
813 Status = AcpiDsGetBufferArguments (TempDesc);
814 Value = TempDesc->Buffer.Length;
815 break;
816
818
819 /* Package arguments may not be evaluated at this point */
820
822 Value = TempDesc->Package.Count;
823 break;
824
825 default:
826
828 "Operand must be Buffer/Integer/String/Package"
829 " - found type %s",
831
833 goto Cleanup;
834 }
835
836 if (ACPI_FAILURE (Status))
837 {
838 goto Cleanup;
839 }
840
841 /*
842 * Now that we have the size of the object, create a result
843 * object to hold the value
844 */
845 ReturnDesc = AcpiUtCreateIntegerObject (Value);
846 if (!ReturnDesc)
847 {
849 goto Cleanup;
850 }
851 break;
852
853
854 case AML_REF_OF_OP: /* RefOf (SourceObject) */
855
857 Operand[0], &ReturnDesc, WalkState);
858 if (ACPI_FAILURE (Status))
859 {
860 goto Cleanup;
861 }
862 break;
863
864
865 case AML_DEREF_OF_OP: /* DerefOf (ObjReference | String) */
866
867 /* Check for a method local or argument, or standalone String */
868
870 {
871 TempDesc = AcpiNsGetAttachedObject (
872 (ACPI_NAMESPACE_NODE *) Operand[0]);
873 if (TempDesc &&
874 ((TempDesc->Common.Type == ACPI_TYPE_STRING) ||
875 (TempDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE)))
876 {
877 Operand[0] = TempDesc;
878 AcpiUtAddReference (TempDesc);
879 }
880 else
881 {
883 goto Cleanup;
884 }
885 }
886 else
887 {
888 switch ((Operand[0])->Common.Type)
889 {
891 /*
892 * This is a DerefOf (LocalX | ArgX)
893 *
894 * Must resolve/dereference the local/arg reference first
895 */
896 switch (Operand[0]->Reference.Class)
897 {
900
901 /* Set Operand[0] to the value of the local/arg */
902
904 Operand[0]->Reference.Class,
905 Operand[0]->Reference.Value,
906 WalkState, &TempDesc);
907 if (ACPI_FAILURE (Status))
908 {
909 goto Cleanup;
910 }
911
912 /*
913 * Delete our reference to the input object and
914 * point to the object just retrieved
915 */
916 AcpiUtRemoveReference (Operand[0]);
917 Operand[0] = TempDesc;
918 break;
919
921
922 /* Get the object to which the reference refers */
923
924 TempDesc = Operand[0]->Reference.Object;
925 AcpiUtRemoveReference (Operand[0]);
926 Operand[0] = TempDesc;
927 break;
928
929 default:
930
931 /* Must be an Index op - handled below */
932 break;
933 }
934 break;
935
936 case ACPI_TYPE_STRING:
937
938 break;
939
940 default:
941
943 goto Cleanup;
944 }
945 }
946
948 {
949 if ((Operand[0])->Common.Type == ACPI_TYPE_STRING)
950 {
951 /*
952 * This is a DerefOf (String). The string is a reference
953 * to a named ACPI object.
954 *
955 * 1) Find the owning Node
956 * 2) Dereference the node to an actual object. Could be a
957 * Field, so we need to resolve the node to a value.
958 */
960 Operand[0]->String.Pointer,
963 ACPI_NAMESPACE_NODE, &ReturnDesc));
964 if (ACPI_FAILURE (Status))
965 {
966 goto Cleanup;
967 }
968
971 ACPI_NAMESPACE_NODE, &ReturnDesc),
972 WalkState);
973 goto Cleanup;
974 }
975 }
976
977 /* Operand[0] may have changed from the code above */
978
980 {
981 /*
982 * This is a DerefOf (ObjectReference)
983 * Get the actual object from the Node (This is the dereference).
984 * This case may only happen when a LocalX or ArgX is
985 * dereferenced above, or for references to device and
986 * thermal objects.
987 */
988 switch (((ACPI_NAMESPACE_NODE *) Operand[0])->Type)
989 {
990 case ACPI_TYPE_DEVICE:
992
993 /* These types have no node subobject, return the NS node */
994
995 ReturnDesc = Operand[0];
996 break;
997
998 default:
999 /* For most types, get the object attached to the node */
1000
1001 ReturnDesc = AcpiNsGetAttachedObject (
1002 (ACPI_NAMESPACE_NODE *) Operand[0]);
1003 AcpiUtAddReference (ReturnDesc);
1004 break;
1005 }
1006 }
1007 else
1008 {
1009 /*
1010 * This must be a reference object produced by either the
1011 * Index() or RefOf() operator
1012 */
1013 switch (Operand[0]->Reference.Class)
1014 {
1016 /*
1017 * The target type for the Index operator must be
1018 * either a Buffer or a Package
1019 */
1020 switch (Operand[0]->Reference.TargetType)
1021 {
1023
1024 TempDesc = Operand[0]->Reference.Object;
1025
1026 /*
1027 * Create a new object that contains one element of the
1028 * buffer -- the element pointed to by the index.
1029 *
1030 * NOTE: index into a buffer is NOT a pointer to a
1031 * sub-buffer of the main buffer, it is only a pointer to a
1032 * single element (byte) of the buffer!
1033 *
1034 * Since we are returning the value of the buffer at the
1035 * indexed location, we don't need to add an additional
1036 * reference to the buffer itself.
1037 */
1038 ReturnDesc = AcpiUtCreateIntegerObject ((UINT64)
1039 TempDesc->Buffer.Pointer[Operand[0]->Reference.Value]);
1040 if (!ReturnDesc)
1041 {
1043 goto Cleanup;
1044 }
1045 break;
1046
1047 case ACPI_TYPE_PACKAGE:
1048 /*
1049 * Return the referenced element of the package. We must
1050 * add another reference to the referenced object, however.
1051 */
1052 ReturnDesc = *(Operand[0]->Reference.Where);
1053 if (!ReturnDesc)
1054 {
1055 /*
1056 * Element is NULL, do not allow the dereference.
1057 * This provides compatibility with other ACPI
1058 * implementations.
1059 */
1061 }
1062
1063 AcpiUtAddReference (ReturnDesc);
1064 break;
1065
1066 default:
1067
1069 "Unknown Index TargetType 0x%X in reference object %p",
1070 Operand[0]->Reference.TargetType, Operand[0]));
1071
1073 goto Cleanup;
1074 }
1075 break;
1076
1078
1079 ReturnDesc = Operand[0]->Reference.Object;
1080
1081 if (ACPI_GET_DESCRIPTOR_TYPE (ReturnDesc) ==
1083 {
1084 ReturnDesc = AcpiNsGetAttachedObject (
1085 (ACPI_NAMESPACE_NODE *) ReturnDesc);
1086 if (!ReturnDesc)
1087 {
1088 break;
1089 }
1090
1091 /*
1092 * June 2013:
1093 * BufferFields/FieldUnits require additional resolution
1094 */
1095 switch (ReturnDesc->Common.Type)
1096 {
1101
1103 WalkState, ReturnDesc, &TempDesc);
1104 if (ACPI_FAILURE (Status))
1105 {
1107 }
1108
1109 ReturnDesc = TempDesc;
1110 break;
1111
1112 default:
1113
1114 /* Add another reference to the object */
1115
1116 AcpiUtAddReference (ReturnDesc);
1117 break;
1118 }
1119 }
1120 break;
1121
1122 default:
1123
1125 "Unknown class in reference(%p) - 0x%2.2X",
1126 Operand[0], Operand[0]->Reference.Class));
1127
1128 Status = AE_TYPE;
1129 goto Cleanup;
1130 }
1131 }
1132 break;
1133
1134 default:
1135
1136 ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
1137 WalkState->Opcode));
1138
1140 goto Cleanup;
1141 }
1142
1143
1144Cleanup:
1145
1146 /* Delete return object on error */
1147
1148 if (ACPI_FAILURE (Status))
1149 {
1150 AcpiUtRemoveReference (ReturnDesc);
1151 }
1152
1153 /* Save return object on success */
1154
1155 else
1156 {
1157 WalkState->ResultObj = ReturnDesc;
1158 }
1159
1161}
#define AE_AML_UNINITIALIZED_ELEMENT
Definition: acexcep.h:186
#define ACPI_UINT64_MAX
Definition: actypes.h:67
#define ACPI_CAST_INDIRECT_PTR(t, p)
Definition: actypes.h:545
void AcpiUtAddReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:752
#define AML_OBJECT_TYPE_OP
Definition: amlcode.h:118
#define AML_DECREMENT_OP
Definition: amlcode.h:94
#define AML_REF_OF_OP
Definition: amlcode.h:89
#define AML_LOGICAL_NOT_OP
Definition: amlcode.h:122
#define AML_INCREMENT_OP
Definition: amlcode.h:93
#define AML_SIZE_OF_OP
Definition: amlcode.h:111
#define AML_DEREF_OF_OP
Definition: amlcode.h:107
ACPI_STATUS AcpiDsGetPackageArguments(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: dsargs.c:344
ACPI_STATUS AcpiDsGetBufferArguments(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: dsargs.c:294
ACPI_STATUS AcpiDsMethodDataGetValue(UINT8 Type, UINT32 Index, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **DestDesc)
Definition: dsmthdat.c:406
ACPI_STATUS AcpiExReadDataFromField(ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **RetBufferDesc)
Definition: exfield.c:147
ACPI_STATUS AcpiExGetObjectReference(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ReturnDesc, ACPI_WALK_STATE *WalkState)
Definition: exmisc.c:70
ACPI_STATUS AcpiExResolveNodeToValue(ACPI_NAMESPACE_NODE **ObjectPtr, ACPI_WALK_STATE *WalkState)
Definition: exresnte.c:82
ACPI_STATUS AcpiExResolveMultiple(ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT *Operand, ACPI_OBJECT_TYPE *ReturnType, ACPI_OPERAND_OBJECT **ReturnDesc)
Definition: exresolv.c:350
ACPI_STATUS AcpiExResolveOperands(UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresop.c:145

◆ AcpiExOpcode_1A_1T_0R()

ACPI_STATUS AcpiExOpcode_1A_1T_0R ( ACPI_WALK_STATE WalkState)

◆ AcpiExOpcode_1A_1T_1R()

ACPI_STATUS AcpiExOpcode_1A_1T_1R ( ACPI_WALK_STATE WalkState)

Definition at line 286 of file exoparg1.c.

288{
290 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
291 ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
292 ACPI_OPERAND_OBJECT *ReturnDesc2 = NULL;
293 UINT32 Temp32;
294 UINT32 i;
295 UINT64 PowerOfTen;
296 UINT64 Digit;
297
298
299 ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_1T_1R,
300 AcpiPsGetOpcodeName (WalkState->Opcode));
301
302
303 /* Examine the AML opcode */
304
305 switch (WalkState->Opcode)
306 {
307 case AML_BIT_NOT_OP:
310 case AML_FROM_BCD_OP:
311 case AML_LOAD_OP:
312 case AML_TO_BCD_OP:
314
315 /* Create a return object of type Integer for these opcodes */
316
318 if (!ReturnDesc)
319 {
321 goto Cleanup;
322 }
323
324 switch (WalkState->Opcode)
325 {
326 case AML_BIT_NOT_OP: /* Not (Operand, Result) */
327
328 ReturnDesc->Integer.Value = ~Operand[0]->Integer.Value;
329 break;
330
331 case AML_FIND_SET_LEFT_BIT_OP: /* FindSetLeftBit (Operand, Result) */
332
333 ReturnDesc->Integer.Value = Operand[0]->Integer.Value;
334
335 /*
336 * Acpi specification describes Integer type as a little
337 * endian unsigned value, so this boundary condition is valid.
338 */
339 for (Temp32 = 0; ReturnDesc->Integer.Value &&
340 Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32)
341 {
342 ReturnDesc->Integer.Value >>= 1;
343 }
344
345 ReturnDesc->Integer.Value = Temp32;
346 break;
347
348 case AML_FIND_SET_RIGHT_BIT_OP: /* FindSetRightBit (Operand, Result) */
349
350 ReturnDesc->Integer.Value = Operand[0]->Integer.Value;
351
352 /*
353 * The Acpi specification describes Integer type as a little
354 * endian unsigned value, so this boundary condition is valid.
355 */
356 for (Temp32 = 0; ReturnDesc->Integer.Value &&
357 Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32)
358 {
359 ReturnDesc->Integer.Value <<= 1;
360 }
361
362 /* Since the bit position is one-based, subtract from 33 (65) */
363
364 ReturnDesc->Integer.Value =
365 Temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - Temp32;
366 break;
367
368 case AML_FROM_BCD_OP: /* FromBcd (BCDValue, Result) */
369 /*
370 * The 64-bit ACPI integer can hold 16 4-bit BCD characters
371 * (if table is 32-bit, integer can hold 8 BCD characters)
372 * Convert each 4-bit BCD value
373 */
374 PowerOfTen = 1;
375 ReturnDesc->Integer.Value = 0;
376 Digit = Operand[0]->Integer.Value;
377
378 /* Convert each BCD digit (each is one nybble wide) */
379
380 for (i = 0; (i < AcpiGbl_IntegerNybbleWidth) && (Digit > 0); i++)
381 {
382 /* Get the least significant 4-bit BCD digit */
383
384 Temp32 = ((UINT32) Digit) & 0xF;
385
386 /* Check the range of the digit */
387
388 if (Temp32 > 9)
389 {
391 "BCD digit too large (not decimal): 0x%X",
392 Temp32));
393
395 goto Cleanup;
396 }
397
398 /* Sum the digit into the result with the current power of 10 */
399
400 ReturnDesc->Integer.Value +=
401 (((UINT64) Temp32) * PowerOfTen);
402
403 /* Shift to next BCD digit */
404
405 Digit >>= 4;
406
407 /* Next power of 10 */
408
409 PowerOfTen *= 10;
410 }
411 break;
412
413 case AML_LOAD_OP: /* Result1 = Load (Operand[0], Result1) */
414
415 ReturnDesc->Integer.Value = 0;
416 Status = AcpiExLoadOp (Operand[0], ReturnDesc, WalkState);
417 if (ACPI_SUCCESS (Status))
418 {
419 /* Return -1 (non-zero) indicates success */
420
421 ReturnDesc->Integer.Value = 0xFFFFFFFFFFFFFFFF;
422 }
423 break;
424
425 case AML_TO_BCD_OP: /* ToBcd (Operand, Result) */
426
427 ReturnDesc->Integer.Value = 0;
428 Digit = Operand[0]->Integer.Value;
429
430 /* Each BCD digit is one nybble wide */
431
432 for (i = 0; (i < AcpiGbl_IntegerNybbleWidth) && (Digit > 0); i++)
433 {
434 (void) AcpiUtShortDivide (Digit, 10, &Digit, &Temp32);
435
436 /*
437 * Insert the BCD digit that resides in the
438 * remainder from above
439 */
440 ReturnDesc->Integer.Value |=
441 (((UINT64) Temp32) << ACPI_MUL_4 (i));
442 }
443
444 /* Overflow if there is any data left in Digit */
445
446 if (Digit > 0)
447 {
449 "Integer too large to convert to BCD: 0x%8.8X%8.8X",
450 ACPI_FORMAT_UINT64 (Operand[0]->Integer.Value)));
452 goto Cleanup;
453 }
454 break;
455
456 case AML_CONDITIONAL_REF_OF_OP: /* CondRefOf (SourceObject, Result) */
457 /*
458 * This op is a little strange because the internal return value is
459 * different than the return value stored in the result descriptor
460 * (There are really two return values)
461 */
462 if ((ACPI_NAMESPACE_NODE *) Operand[0] == AcpiGbl_RootNode)
463 {
464 /*
465 * This means that the object does not exist in the namespace,
466 * return FALSE
467 */
468 ReturnDesc->Integer.Value = 0;
469 goto Cleanup;
470 }
471
472 /* Get the object reference, store it, and remove our reference */
473
474 Status = AcpiExGetObjectReference (Operand[0],
475 &ReturnDesc2, WalkState);
476 if (ACPI_FAILURE (Status))
477 {
478 goto Cleanup;
479 }
480
481 Status = AcpiExStore (ReturnDesc2, Operand[1], WalkState);
482 AcpiUtRemoveReference (ReturnDesc2);
483
484 /* The object exists in the namespace, return TRUE */
485
486 ReturnDesc->Integer.Value = ACPI_UINT64_MAX;
487 goto Cleanup;
488
489
490 default:
491
492 /* No other opcodes get here */
493
494 break;
495 }
496 break;
497
498 case AML_STORE_OP: /* Store (Source, Target) */
499 /*
500 * A store operand is typically a number, string, buffer or lvalue
501 * Be careful about deleting the source object,
502 * since the object itself may have been stored.
503 */
504 Status = AcpiExStore (Operand[0], Operand[1], WalkState);
505 if (ACPI_FAILURE (Status))
506 {
508 }
509
510 /* It is possible that the Store already produced a return object */
511
512 if (!WalkState->ResultObj)
513 {
514 /*
515 * Normally, we would remove a reference on the Operand[0]
516 * parameter; But since it is being used as the internal return
517 * object (meaning we would normally increment it), the two
518 * cancel out, and we simply don't do anything.
519 */
520 WalkState->ResultObj = Operand[0];
521 WalkState->Operands[0] = NULL; /* Prevent deletion */
522 }
524
525 /*
526 * ACPI 2.0 Opcodes
527 */
528 case AML_COPY_OBJECT_OP: /* CopyObject (Source, Target) */
529
531 Operand[0], &ReturnDesc, WalkState);
532 break;
533
534 case AML_TO_DECIMAL_STRING_OP: /* ToDecimalString (Data, Result) */
535
537 Operand[0], &ReturnDesc, ACPI_EXPLICIT_CONVERT_DECIMAL);
538 if (ReturnDesc == Operand[0])
539 {
540 /* No conversion performed, add ref to handle return value */
541
542 AcpiUtAddReference (ReturnDesc);
543 }
544 break;
545
546 case AML_TO_HEX_STRING_OP: /* ToHexString (Data, Result) */
547
549 Operand[0], &ReturnDesc, ACPI_EXPLICIT_CONVERT_HEX);
550 if (ReturnDesc == Operand[0])
551 {
552 /* No conversion performed, add ref to handle return value */
553
554 AcpiUtAddReference (ReturnDesc);
555 }
556 break;
557
558 case AML_TO_BUFFER_OP: /* ToBuffer (Data, Result) */
559
560 Status = AcpiExConvertToBuffer (Operand[0], &ReturnDesc);
561 if (ReturnDesc == Operand[0])
562 {
563 /* No conversion performed, add ref to handle return value */
564
565 AcpiUtAddReference (ReturnDesc);
566 }
567 break;
568
569 case AML_TO_INTEGER_OP: /* ToInteger (Data, Result) */
570
571 /* Perform "explicit" conversion */
572
573 Status = AcpiExConvertToInteger (Operand[0], &ReturnDesc, 0);
574 if (ReturnDesc == Operand[0])
575 {
576 /* No conversion performed, add ref to handle return value */
577
578 AcpiUtAddReference (ReturnDesc);
579 }
580 break;
581
582 case AML_SHIFT_LEFT_BIT_OP: /* ShiftLeftBit (Source, BitNum) */
583 case AML_SHIFT_RIGHT_BIT_OP: /* ShiftRightBit (Source, BitNum) */
584
585 /* These are two obsolete opcodes */
586
588 "%s is obsolete and not implemented",
589 AcpiPsGetOpcodeName (WalkState->Opcode)));
591 goto Cleanup;
592
593 default: /* Unknown opcode */
594
595 ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
596 WalkState->Opcode));
598 goto Cleanup;
599 }
600
601 if (ACPI_SUCCESS (Status))
602 {
603 /* Store the return value computed above into the target object */
604
605 Status = AcpiExStore (ReturnDesc, Operand[1], WalkState);
606 }
607
608
609Cleanup:
610
611 /* Delete return object on error */
612
613 if (ACPI_FAILURE (Status))
614 {
615 AcpiUtRemoveReference (ReturnDesc);
616 }
617
618 /* Save return object on success */
619
620 else if (!WalkState->ResultObj)
621 {
622 WalkState->ResultObj = ReturnDesc;
623 }
624
626}
#define AE_SUPPORT
Definition: acexcep.h:123
#define AE_AML_NUMERIC_OVERFLOW
Definition: acexcep.h:187
#define ACPI_MUL_4(a)
Definition: acmacros.h:211
ACPI_STATUS AcpiUtCopyIobjectToIobject(ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT **DestDesc, ACPI_WALK_STATE *WalkState)
Definition: utcopy.c:1037
#define AML_TO_DECIMAL_STRING_OP
Definition: amlcode.h:127
#define AML_TO_HEX_STRING_OP
Definition: amlcode.h:128
#define AML_FIND_SET_RIGHT_BIT_OP
Definition: amlcode.h:106
#define AML_FROM_BCD_OP
Definition: amlcode.h:173
#define AML_COPY_OBJECT_OP
Definition: amlcode.h:131
#define AML_SHIFT_LEFT_BIT_OP
Definition: amlcode.h:161
#define AML_TO_BCD_OP
Definition: amlcode.h:174
#define AML_STORE_OP
Definition: amlcode.h:88
#define AML_CONDITIONAL_REF_OF_OP
Definition: amlcode.h:162
#define AML_TO_BUFFER_OP
Definition: amlcode.h:126
#define AML_LOAD_OP
Definition: amlcode.h:165
#define AML_TO_INTEGER_OP
Definition: amlcode.h:129
#define AML_FIND_SET_LEFT_BIT_OP
Definition: amlcode.h:105
#define AML_BIT_NOT_OP
Definition: amlcode.h:104
#define AML_SHIFT_RIGHT_BIT_OP
Definition: amlcode.h:160
ACPI_STATUS AcpiExLoadOp(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT *Target, ACPI_WALK_STATE *WalkState)
Definition: exconfig.c:343

◆ AcpiExOpcode_2A_0T_0R()

ACPI_STATUS AcpiExOpcode_2A_0T_0R ( 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 (1 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 95 of file exoparg2.c.

97{
98 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
102
103
104 ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_0T_0R,
105 AcpiPsGetOpcodeName (WalkState->Opcode));
106
107
108 /* Examine the opcode */
109
110 switch (WalkState->Opcode)
111 {
112 case AML_NOTIFY_OP: /* Notify (NotifyObject, NotifyValue) */
113
114 /* The first operand is a namespace node */
115
116 Node = (ACPI_NAMESPACE_NODE *) Operand[0];
117
118 /* Second value is the notify value */
119
120 Value = (UINT32) Operand[1]->Integer.Value;
121
122 /* Are notifies allowed on this object? */
123
125 {
127 "Unexpected notify object type [%s]",
128 AcpiUtGetTypeName (Node->Type)));
129
131 break;
132 }
133
134 /*
135 * Dispatch the notify to the appropriate handler
136 * NOTE: the request is queued for execution after this method
137 * completes. The notify handlers are NOT invoked synchronously
138 * from this thread -- because handlers may in turn run other
139 * control methods.
140 */
142 break;
143
144 default:
145
146 ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
147 WalkState->Opcode));
149 }
150
152}
#define AML_NOTIFY_OP
Definition: amlcode.h:110
ACPI_STATUS AcpiEvQueueNotifyRequest(ACPI_NAMESPACE_NODE *Node, UINT32 NotifyValue)
Definition: evmisc.c:111
BOOLEAN AcpiEvIsNotifyObject(ACPI_NAMESPACE_NODE *Node)
Definition: evmisc.c:75
if(dx< 0)
Definition: linetemp.h:194

◆ AcpiExOpcode_2A_0T_1R()

ACPI_STATUS AcpiExOpcode_2A_0T_1R ( ACPI_WALK_STATE WalkState)

Definition at line 540 of file exoparg2.c.

542{
543 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
544 ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
546 BOOLEAN LogicalResult = FALSE;
547
548
549 ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_0T_1R,
550 AcpiPsGetOpcodeName (WalkState->Opcode));
551
552
553 /* Create the internal return object */
554
556 if (!ReturnDesc)
557 {
559 goto Cleanup;
560 }
561
562 /* Execute the Opcode */
563
564 if (WalkState->OpInfo->Flags & AML_LOGICAL_NUMERIC)
565 {
566 /* LogicalOp (Operand0, Operand1) */
567
569 Operand[0]->Integer.Value, Operand[1]->Integer.Value,
570 &LogicalResult);
571 goto StoreLogicalResult;
572 }
573 else if (WalkState->OpInfo->Flags & AML_LOGICAL)
574 {
575 /* LogicalOp (Operand0, Operand1) */
576
577 Status = AcpiExDoLogicalOp (WalkState->Opcode, Operand[0],
578 Operand[1], &LogicalResult);
579 goto StoreLogicalResult;
580 }
581
582 switch (WalkState->Opcode)
583 {
584 case AML_ACQUIRE_OP: /* Acquire (MutexObject, Timeout) */
585
586 Status = AcpiExAcquireMutex (Operand[1], Operand[0], WalkState);
587 if (Status == AE_TIME)
588 {
589 LogicalResult = TRUE; /* TRUE = Acquire timed out */
590 Status = AE_OK;
591 }
592 break;
593
594
595 case AML_WAIT_OP: /* Wait (EventObject, Timeout) */
596
597 Status = AcpiExSystemWaitEvent (Operand[1], Operand[0]);
598 if (Status == AE_TIME)
599 {
600 LogicalResult = TRUE; /* TRUE, Wait timed out */
601 Status = AE_OK;
602 }
603 break;
604
605 default:
606
607 ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
608 WalkState->Opcode));
609
611 goto Cleanup;
612 }
613
614
615StoreLogicalResult:
616 /*
617 * Set return value to according to LogicalResult. logical TRUE (all ones)
618 * Default is FALSE (zero)
619 */
620 if (LogicalResult)
621 {
622 ReturnDesc->Integer.Value = ACPI_UINT64_MAX;
623 }
624
625Cleanup:
626
627 /* Delete return object on error */
628
629 if (ACPI_FAILURE (Status))
630 {
631 AcpiUtRemoveReference (ReturnDesc);
632 }
633
634 /* Save return object on success */
635
636 else
637 {
638 WalkState->ResultObj = ReturnDesc;
639 }
640
642}
#define AE_TIME
Definition: acexcep.h:125
#define AML_WAIT_OP
Definition: amlcode.h:170
#define AML_ACQUIRE_OP
Definition: amlcode.h:168
#define AML_LOGICAL
Definition: amlcode.h:317
#define AML_LOGICAL_NUMERIC
Definition: amlcode.h:318
ACPI_STATUS AcpiExDoLogicalOp(UINT16 Opcode, ACPI_OPERAND_OBJECT *Operand0, ACPI_OPERAND_OBJECT *Operand1, BOOLEAN *LogicalResult)
Definition: exmisc.c:335
ACPI_STATUS AcpiExDoLogicalNumericOp(UINT16 Opcode, UINT64 Integer0, UINT64 Integer1, BOOLEAN *LogicalResult)
Definition: exmisc.c:262
ACPI_STATUS AcpiExAcquireMutex(ACPI_OPERAND_OBJECT *TimeDesc, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState)
Definition: exmutex.c:248
ACPI_STATUS AcpiExSystemWaitEvent(ACPI_OPERAND_OBJECT *TimeDesc, ACPI_OPERAND_OBJECT *ObjDesc)
Definition: exsystem.c:299
UINT16 Flags
Definition: aclocal.h:873

◆ AcpiExOpcode_2A_1T_1R()

ACPI_STATUS AcpiExOpcode_2A_1T_1R ( ACPI_WALK_STATE WalkState)

Definition at line 279 of file exoparg2.c.

281{
282 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
283 ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
286 ACPI_SIZE Length = 0;
287
288
289 ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_1T_1R,
290 AcpiPsGetOpcodeName (WalkState->Opcode));
291
292
293 /* Execute the opcode */
294
295 if (WalkState->OpInfo->Flags & AML_MATH)
296 {
297 /* All simple math opcodes (add, etc.) */
298
300 if (!ReturnDesc)
301 {
303 goto Cleanup;
304 }
305
306 ReturnDesc->Integer.Value = AcpiExDoMathOp (
307 WalkState->Opcode,
308 Operand[0]->Integer.Value,
309 Operand[1]->Integer.Value);
310 goto StoreResultToTarget;
311 }
312
313 switch (WalkState->Opcode)
314 {
315 case AML_MOD_OP: /* Mod (Dividend, Divisor, RemainderResult (ACPI 2.0) */
316
318 if (!ReturnDesc)
319 {
321 goto Cleanup;
322 }
323
324 /* ReturnDesc will contain the remainder */
325
327 Operand[0]->Integer.Value,
328 Operand[1]->Integer.Value,
329 NULL,
330 &ReturnDesc->Integer.Value);
331 break;
332
333 case AML_CONCATENATE_OP: /* Concatenate (Data1, Data2, Result) */
334
336 Operand[0], Operand[1], &ReturnDesc, WalkState);
337 break;
338
339 case AML_TO_STRING_OP: /* ToString (Buffer, Length, Result) (ACPI 2.0) */
340 /*
341 * Input object is guaranteed to be a buffer at this point (it may have
342 * been converted.) Copy the raw buffer data to a new object of
343 * type String.
344 */
345
346 /*
347 * Get the length of the new string. It is the smallest of:
348 * 1) Length of the input buffer
349 * 2) Max length as specified in the ToString operator
350 * 3) Length of input buffer up to a zero byte (null terminator)
351 *
352 * NOTE: A length of zero is ok, and will create a zero-length, null
353 * terminated string.
354 */
355 while ((Length < Operand[0]->Buffer.Length) && /* Length of input buffer */
356 (Length < Operand[1]->Integer.Value) && /* Length operand */
357 (Operand[0]->Buffer.Pointer[Length])) /* Null terminator */
358 {
359 Length++;
360 }
361
362 /* Allocate a new string object */
363
364 ReturnDesc = AcpiUtCreateStringObject (Length);
365 if (!ReturnDesc)
366 {
368 goto Cleanup;
369 }
370
371 /*
372 * Copy the raw buffer data with no transform.
373 * (NULL terminated already)
374 */
375 memcpy (ReturnDesc->String.Pointer,
376 Operand[0]->Buffer.Pointer, Length);
377 break;
378
380
381 /* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */
382
384 Operand[0], Operand[1], &ReturnDesc, WalkState);
385 break;
386
387 case AML_INDEX_OP: /* Index (Source Index Result) */
388
389 /* Create the internal return object */
390
392 if (!ReturnDesc)
393 {
395 goto Cleanup;
396 }
397
398 /* Initialize the Index reference object */
399
400 Index = Operand[1]->Integer.Value;
401 ReturnDesc->Reference.Value = (UINT32) Index;
402 ReturnDesc->Reference.Class = ACPI_REFCLASS_INDEX;
403
404 /*
405 * At this point, the Source operand is a String, Buffer, or Package.
406 * Verify that the index is within range.
407 */
408 switch ((Operand[0])->Common.Type)
409 {
410 case ACPI_TYPE_STRING:
411
412 if (Index >= Operand[0]->String.Length)
413 {
414 Length = Operand[0]->String.Length;
416 }
417
419 ReturnDesc->Reference.IndexPointer =
420 &(Operand[0]->Buffer.Pointer [Index]);
421 break;
422
423 case ACPI_TYPE_BUFFER:
424
42