本文整理汇总了C++中ACPI_FUNCTION_TRACE_STR函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_FUNCTION_TRACE_STR函数的具体用法?C++ ACPI_FUNCTION_TRACE_STR怎么用?C++ ACPI_FUNCTION_TRACE_STR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACPI_FUNCTION_TRACE_STR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AcpiExOpcode_2A_2T_1R
ACPI_STATUS
AcpiExOpcode_2A_2T_1R (
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ReturnDesc1 = NULL;
ACPI_OPERAND_OBJECT *ReturnDesc2 = NULL;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_2T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
/* Execute the opcode */
switch (WalkState->Opcode)
{
case AML_DIVIDE_OP:
/* Divide (Dividend, Divisor, RemainderResult QuotientResult) */
ReturnDesc1 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc1)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
ReturnDesc2 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc2)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/* Quotient to ReturnDesc1, remainder to ReturnDesc2 */
Status = AcpiUtDivide (Operand[0]->Integer.Value,
Operand[1]->Integer.Value,
&ReturnDesc1->Integer.Value,
&ReturnDesc2->Integer.Value);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
/* Store the results to the target reference operands */
Status = AcpiExStore (ReturnDesc2, Operand[2], WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
Status = AcpiExStore (ReturnDesc1, Operand[3], WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
Cleanup:
/*
* Since the remainder is not returned indirectly, remove a reference to
* it. Only the quotient is returned indirectly.
*/
AcpiUtRemoveReference (ReturnDesc2);
if (ACPI_FAILURE (Status))
{
/* Delete the return object */
AcpiUtRemoveReference (ReturnDesc1);
}
/* Save return object (the remainder) on success */
else
{
WalkState->ResultObj = ReturnDesc1;
}
return_ACPI_STATUS (Status);
}
示例2: acpi_ex_opcode_6A_0T_1R
acpi_status
acpi_ex_opcode_6A_0T_1R (
struct acpi_walk_state *walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *return_desc = NULL;
acpi_status status = AE_OK;
u32 index;
union acpi_operand_object *this_element;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
switch (walk_state->opcode) {
case AML_MATCH_OP:
/*
* Match (search_package[0], match_op1[1], match_object1[2],
* match_op2[3], match_object2[4], start_index[5])
*/
/* Validate match comparison sub-opcodes */
if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) ||
(operand[3]->integer.value > MAX_MATCH_OPERATOR)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "operation encoding out of range\n"));
status = AE_AML_OPERAND_VALUE;
goto cleanup;
}
index = (u32) operand[5]->integer.value;
if (index >= (u32) operand[0]->package.count) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index beyond package end\n"));
status = AE_AML_PACKAGE_LIMIT;
goto cleanup;
}
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
}
/* Default return value if no match found */
return_desc->integer.value = ACPI_INTEGER_MAX;
/*
* Examine each element until a match is found. Within the loop,
* "continue" signifies that the current element does not match
* and the next should be examined.
*
* Upon finding a match, the loop will terminate via "break" at
* the bottom. If it terminates "normally", match_value will be -1
* (its initial value) indicating that no match was found. When
* returned as a Number, this will produce the Ones value as specified.
*/
for ( ; index < operand[0]->package.count; index++) {
this_element = operand[0]->package.elements[index];
/*
* Treat any NULL or non-numeric elements as non-matching.
*/
if (!this_element ||
ACPI_GET_OBJECT_TYPE (this_element) != ACPI_TYPE_INTEGER) {
continue;
}
/*
* "continue" (proceed to next iteration of enclosing
* "for" loop) signifies a non-match.
*/
if (!acpi_ex_do_match ((u32) operand[1]->integer.value,
this_element->integer.value, operand[2]->integer.value)) {
continue;
}
if (!acpi_ex_do_match ((u32) operand[3]->integer.value,
this_element->integer.value, operand[4]->integer.value)) {
continue;
}
/* Match found: Index is the return value */
return_desc->integer.value = index;
break;
}
break;
case AML_LOAD_TABLE_OP:
status = acpi_ex_load_table_op (walk_state, &return_desc);
break;
default:
//.........这里部分代码省略.........
示例3: acpi_ut_strtoul64
/*******************************************************************************
*
* FUNCTION: acpi_ut_strtoul64
*
* PARAMETERS: string - Null terminated input string,
* must be a valid pointer
* return_value - Where the converted integer is
* returned. Must be a valid pointer
*
* RETURN: Status and converted integer. Returns an exception on a
* 64-bit numeric overflow
*
* DESCRIPTION: Convert a string into an unsigned integer. Always performs a
* full 64-bit conversion, regardless of the current global
* integer width. Supports Decimal, Hex, and Octal strings.
*
* Current users of this function:
*
* iASL - Preprocessor (constants and math expressions)
* iASL - Main ASL parser, conversion of ASL constants to integers
* iASL - Data Table Compiler parser (constants and math expressions)
* interpreter - Repair code for return values from predefined names
* acpi_dump - ACPI table physical addresses
* acpi_exec - Support for namespace overrides
*
******************************************************************************/
acpi_status acpi_ut_strtoul64(char *string, u64 *return_value)
{
acpi_status status = AE_OK;
u8 original_bit_width;
u32 base = 10; /* Default is decimal */
ACPI_FUNCTION_TRACE_STR(ut_strtoul64, string);
*return_value = 0;
/* A NULL return string returns a value of zero */
if (*string == 0) {
return_ACPI_STATUS(AE_OK);
}
if (!acpi_ut_remove_whitespace(&string)) {
return_ACPI_STATUS(AE_OK);
}
/*
* 1) Check for a hex constant. A "0x" prefix indicates base 16.
*/
if (acpi_ut_detect_hex_prefix(&string)) {
base = 16;
}
/*
* 2) Check for an octal constant, defined to be a leading zero
* followed by sequence of octal digits (0-7)
*/
else if (acpi_ut_detect_octal_prefix(&string)) {
base = 8;
}
if (!acpi_ut_remove_leading_zeros(&string)) {
return_ACPI_STATUS(AE_OK); /* Return value 0 */
}
/*
* Force a full 64-bit conversion. The caller (usually iASL) must
* check for a 32-bit overflow later as necessary (If current mode
* is 32-bit, meaning a 32-bit DSDT).
*/
original_bit_width = acpi_gbl_integer_bit_width;
acpi_gbl_integer_bit_width = 64;
/*
* Perform the base 8, 10, or 16 conversion. A 64-bit numeric overflow
* will return an exception (to allow iASL to flag the statement).
*/
switch (base) {
case 8:
status = acpi_ut_convert_octal_string(string, return_value);
break;
case 10:
status = acpi_ut_convert_decimal_string(string, return_value);
break;
case 16:
default:
status = acpi_ut_convert_hex_string(string, return_value);
break;
}
/* Only possible exception from above is a 64-bit overflow */
acpi_gbl_integer_bit_width = original_bit_width;
return_ACPI_STATUS(status);
}
示例4: AcpiExOpcode_1A_0T_1R
ACPI_STATUS
AcpiExOpcode_1A_0T_1R (
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *TempDesc;
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
ACPI_STATUS Status = AE_OK;
UINT32 Type;
ACPI_INTEGER Value;
ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_0T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the AML opcode */
switch (WalkState->Opcode)
{
case AML_LNOT_OP: /* LNot (Operand) */
ReturnDesc = AcpiUtCreateIntegerObject ((UINT64) 0);
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/*
* Set result to ONES (TRUE) if Value == 0. Note:
* ReturnDesc->Integer.Value is initially == 0 (FALSE) from above.
*/
if (!Operand[0]->Integer.Value)
{
ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
}
break;
case AML_DECREMENT_OP: /* Decrement (Operand) */
case AML_INCREMENT_OP: /* Increment (Operand) */
/*
* Create a new integer. Can't just get the base integer and
* increment it because it may be an Arg or Field.
*/
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/*
* Since we are expecting a Reference operand, it can be either a
* NS Node or an internal object.
*/
TempDesc = Operand[0];
if (ACPI_GET_DESCRIPTOR_TYPE (TempDesc) == ACPI_DESC_TYPE_OPERAND)
{
/* Internal reference object - prevent deletion */
AcpiUtAddReference (TempDesc);
}
/*
* Convert the Reference operand to an Integer (This removes a
* reference on the Operand[0] object)
*
* NOTE: We use LNOT_OP here in order to force resolution of the
* reference operand to an actual integer.
*/
Status = AcpiExResolveOperands (AML_LNOT_OP, &TempDesc, WalkState);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"While resolving operands for [%s]",
AcpiPsGetOpcodeName (WalkState->Opcode)));
goto Cleanup;
}
/*
* TempDesc is now guaranteed to be an Integer object --
* Perform the actual increment or decrement
*/
if (WalkState->Opcode == AML_INCREMENT_OP)
{
ReturnDesc->Integer.Value = TempDesc->Integer.Value +1;
}
else
{
ReturnDesc->Integer.Value = TempDesc->Integer.Value -1;
}
/* Finished with this Integer object */
AcpiUtRemoveReference (TempDesc);
//.........这里部分代码省略.........
示例5: AcpiUtStrtoul64
ACPI_STATUS
AcpiUtStrtoul64 (
char *String,
UINT32 Base,
UINT64 *RetInteger)
{
UINT32 ThisDigit = 0;
UINT64 ReturnValue = 0;
UINT64 Quotient;
UINT64 Dividend;
UINT32 ToIntegerOp = (Base == ACPI_ANY_BASE);
UINT32 Mode32 = (AcpiGbl_IntegerByteWidth == 4);
UINT8 ValidDigits = 0;
UINT8 SignOf0x = 0;
UINT8 Term = 0;
ACPI_FUNCTION_TRACE_STR (UtStroul64, String);
switch (Base)
{
case ACPI_ANY_BASE:
case 16:
break;
default:
/* Invalid Base */
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (!String)
{
goto ErrorExit;
}
/* Skip over any white space in the buffer */
while ((*String) && (ACPI_IS_SPACE (*String) || *String == '\t'))
{
String++;
}
if (ToIntegerOp)
{
/*
* Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
* We need to determine if it is decimal or hexadecimal.
*/
if ((*String == '0') && (ACPI_TOLOWER (*(String + 1)) == 'x'))
{
SignOf0x = 1;
Base = 16;
/* Skip over the leading '0x' */
String += 2;
}
else
{
Base = 10;
}
}
/* Any string left? Check that '0x' is not followed by white space. */
if (!(*String) || ACPI_IS_SPACE (*String) || *String == '\t')
{
if (ToIntegerOp)
{
goto ErrorExit;
}
else
{
goto AllDone;
}
}
/*
* Perform a 32-bit or 64-bit conversion, depending upon the current
* execution mode of the interpreter
*/
Dividend = (Mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
/* Main loop: convert the string to a 32- or 64-bit integer */
while (*String)
{
if (ACPI_IS_DIGIT (*String))
{
/* Convert ASCII 0-9 to Decimal value */
ThisDigit = ((UINT8) *String) - '0';
}
else if (Base == 10)
{
/* Digit is out of range; possible in ToInteger case only */
//.........这里部分代码省略.........
示例6: AcpiExOpcode_1A_0T_0R
ACPI_STATUS
AcpiExOpcode_1A_0T_0R (
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_0T_0R,
AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the AML opcode */
switch (WalkState->Opcode)
{
case AML_RELEASE_OP: /* Release (MutexObject) */
Status = AcpiExReleaseMutex (Operand[0], WalkState);
break;
case AML_RESET_OP: /* Reset (EventObject) */
Status = AcpiExSystemResetEvent (Operand[0]);
break;
case AML_SIGNAL_OP: /* Signal (EventObject) */
Status = AcpiExSystemSignalEvent (Operand[0]);
break;
case AML_SLEEP_OP: /* Sleep (MsecTime) */
Status = AcpiExSystemDoSuspend (Operand[0]->Integer.Value);
break;
case AML_STALL_OP: /* Stall (UsecTime) */
Status = AcpiExSystemDoStall ((UINT32) Operand[0]->Integer.Value);
break;
case AML_UNLOAD_OP: /* Unload (Handle) */
Status = AcpiExUnloadTable (Operand[0]);
break;
default: /* Unknown opcode */
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
break;
}
return_ACPI_STATUS (Status);
}
示例7: acpi_ex_opcode_1A_1T_1R
acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *return_desc = NULL;
union acpi_operand_object *return_desc2 = NULL;
u32 temp32;
u32 i;
acpi_integer power_of_ten;
acpi_integer digit;
ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R,
acpi_ps_get_opcode_name(walk_state->opcode));
/* Examine the AML opcode */
switch (walk_state->opcode) {
case AML_BIT_NOT_OP:
case AML_FIND_SET_LEFT_BIT_OP:
case AML_FIND_SET_RIGHT_BIT_OP:
case AML_FROM_BCD_OP:
case AML_TO_BCD_OP:
case AML_COND_REF_OF_OP:
/* Create a return object of type Integer for these opcodes */
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
}
switch (walk_state->opcode) {
case AML_BIT_NOT_OP: /* Not (Operand, Result) */
return_desc->integer.value = ~operand[0]->integer.value;
break;
case AML_FIND_SET_LEFT_BIT_OP: /* find_set_left_bit (Operand, Result) */
return_desc->integer.value = operand[0]->integer.value;
/*
* Acpi specification describes Integer type as a little
* endian unsigned value, so this boundary condition is valid.
*/
for (temp32 = 0; return_desc->integer.value &&
temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) {
return_desc->integer.value >>= 1;
}
return_desc->integer.value = temp32;
break;
case AML_FIND_SET_RIGHT_BIT_OP: /* find_set_right_bit (Operand, Result) */
return_desc->integer.value = operand[0]->integer.value;
/*
* The Acpi specification describes Integer type as a little
* endian unsigned value, so this boundary condition is valid.
*/
for (temp32 = 0; return_desc->integer.value &&
temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) {
return_desc->integer.value <<= 1;
}
/* Since the bit position is one-based, subtract from 33 (65) */
return_desc->integer.value =
temp32 ==
0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
break;
case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */
/*
* The 64-bit ACPI integer can hold 16 4-bit BCD characters
* (if table is 32-bit, integer can hold 8 BCD characters)
* Convert each 4-bit BCD value
*/
power_of_ten = 1;
return_desc->integer.value = 0;
digit = operand[0]->integer.value;
/* Convert each BCD digit (each is one nybble wide) */
for (i = 0;
(i < acpi_gbl_integer_nybble_width) && (digit > 0);
i++) {
/* Get the least significant 4-bit BCD digit */
temp32 = ((u32) digit) & 0xF;
/* Check the range of the digit */
if (temp32 > 9) {
ACPI_ERROR((AE_INFO,
"BCD digit too large (not decimal): 0x%X",
//.........这里部分代码省略.........
示例8: acpi_ex_opcode_1A_0T_1R
acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *temp_desc;
union acpi_operand_object *return_desc = NULL;
acpi_status status = AE_OK;
u32 type;
acpi_integer value;
ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R,
acpi_ps_get_opcode_name(walk_state->opcode));
/* Examine the AML opcode */
switch (walk_state->opcode) {
case AML_LNOT_OP: /* LNot (Operand) */
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
}
/*
* Set result to ONES (TRUE) if Value == 0. Note:
* return_desc->Integer.Value is initially == 0 (FALSE) from above.
*/
if (!operand[0]->integer.value) {
return_desc->integer.value = ACPI_INTEGER_MAX;
}
break;
case AML_DECREMENT_OP: /* Decrement (Operand) */
case AML_INCREMENT_OP: /* Increment (Operand) */
/*
* Create a new integer. Can't just get the base integer and
* increment it because it may be an Arg or Field.
*/
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
}
/*
* Since we are expecting a Reference operand, it can be either a
* NS Node or an internal object.
*/
temp_desc = operand[0];
if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) ==
ACPI_DESC_TYPE_OPERAND) {
/* Internal reference object - prevent deletion */
acpi_ut_add_reference(temp_desc);
}
/*
* Convert the Reference operand to an Integer (This removes a
* reference on the Operand[0] object)
*
* NOTE: We use LNOT_OP here in order to force resolution of the
* reference operand to an actual integer.
*/
status =
acpi_ex_resolve_operands(AML_LNOT_OP, &temp_desc,
walk_state);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"While resolving operands for [%s]",
acpi_ps_get_opcode_name(walk_state->
opcode)));
goto cleanup;
}
/*
* temp_desc is now guaranteed to be an Integer object --
* Perform the actual increment or decrement
*/
if (walk_state->opcode == AML_INCREMENT_OP) {
return_desc->integer.value =
temp_desc->integer.value + 1;
} else {
return_desc->integer.value =
temp_desc->integer.value - 1;
}
/* Finished with this Integer object */
acpi_ut_remove_reference(temp_desc);
/*
* Store the result back (indirectly) through the original
* Reference object
*/
status = acpi_ex_store(return_desc, operand[0], walk_state);
break;
//.........这里部分代码省略.........
示例9: acpi_ex_opcode_3A_0T_0R
/*******************************************************************************
*
* FUNCTION: acpi_ex_opcode_3A_0T_0R
*
* PARAMETERS: walk_state - Current walk state
*
* RETURN: Status
*
* DESCRIPTION: Execute Triadic operator (3 operands)
*
******************************************************************************/
acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
struct acpi_signal_fatal_info *fatal;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_0T_0R,
acpi_ps_get_opcode_name(walk_state->opcode));
switch (walk_state->opcode) {
case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"FatalOp: Type %X Code %X Arg %X "
"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
(u32)operand[0]->integer.value,
(u32)operand[1]->integer.value,
(u32)operand[2]->integer.value));
fatal = ACPI_ALLOCATE(sizeof(struct acpi_signal_fatal_info));
if (fatal) {
fatal->type = (u32) operand[0]->integer.value;
fatal->code = (u32) operand[1]->integer.value;
fatal->argument = (u32) operand[2]->integer.value;
}
/* Always signal the OS! */
status = acpi_os_signal(ACPI_SIGNAL_FATAL, fatal);
/* Might return while OS is shutting down, just continue */
ACPI_FREE(fatal);
goto cleanup;
case AML_EXTERNAL_OP:
/*
* If the interpreter sees this opcode, just ignore it. The External
* op is intended for use by disassemblers in order to properly
* disassemble control method invocations. The opcode or group of
* opcodes should be surrounded by an "if (0)" clause to ensure that
* AML interpreters never see the opcode. Thus, something is
* wrong if an external opcode ever gets here.
*/
ACPI_ERROR((AE_INFO, "Executed External Op"));
status = AE_OK;
goto cleanup;
default:
ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X",
walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
}
cleanup:
return_ACPI_STATUS(status);
}
示例10: acpi_ex_opcode_6A_0T_1R
acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *return_desc = NULL;
acpi_status status = AE_OK;
acpi_integer index;
union acpi_operand_object *this_element;
ACPI_FUNCTION_TRACE_STR("ex_opcode_6A_0T_1R",
acpi_ps_get_opcode_name(walk_state->opcode));
switch (walk_state->opcode) {
case AML_MATCH_OP:
/*
* Match (search_pkg[0], match_op1[1], match_obj1[2],
* match_op2[3], match_obj2[4], start_index[5])
*/
/* Validate both Match Term Operators (MTR, MEQ, etc.) */
if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) ||
(operand[3]->integer.value > MAX_MATCH_OPERATOR)) {
ACPI_ERROR((AE_INFO, "Match operator out of range"));
status = AE_AML_OPERAND_VALUE;
goto cleanup;
}
/* Get the package start_index, validate against the package length */
index = operand[5]->integer.value;
if (index >= operand[0]->package.count) {
ACPI_ERROR((AE_INFO,
"Index (%X%8.8X) beyond package end (%X)",
ACPI_FORMAT_UINT64(index),
operand[0]->package.count));
status = AE_AML_PACKAGE_LIMIT;
goto cleanup;
}
/* Create an integer for the return value */
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
}
/* Default return value if no match found */
return_desc->integer.value = ACPI_INTEGER_MAX;
/*
* Examine each element until a match is found. Both match conditions
* must be satisfied for a match to occur. Within the loop,
* "continue" signifies that the current element does not match
* and the next should be examined.
*
* Upon finding a match, the loop will terminate via "break" at
* the bottom. If it terminates "normally", match_value will be
* ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no
* match was found.
*/
for (; index < operand[0]->package.count; index++) {
/* Get the current package element */
this_element = operand[0]->package.elements[index];
/* Treat any uninitialized (NULL) elements as non-matching */
if (!this_element) {
continue;
}
/*
* Both match conditions must be satisfied. Execution of a continue
* (proceed to next iteration of enclosing for loop) signifies a
* non-match.
*/
if (!acpi_ex_do_match((u32) operand[1]->integer.value,
this_element, operand[2])) {
continue;
}
if (!acpi_ex_do_match((u32) operand[3]->integer.value,
this_element, operand[4])) {
continue;
}
/* Match found: Index is the return value */
return_desc->integer.value = index;
break;
}
break;
case AML_LOAD_TABLE_OP:
status = acpi_ex_load_table_op(walk_state, &return_desc);
break;
//.........这里部分代码省略.........
示例11: AcpiUtStrtoul64
ACPI_STATUS
AcpiUtStrtoul64 (
char *String,
UINT64 *ReturnValue)
{
ACPI_STATUS Status = AE_OK;
UINT8 OriginalBitWidth;
UINT32 Base = 10; /* Default is decimal */
ACPI_FUNCTION_TRACE_STR (UtStrtoul64, String);
*ReturnValue = 0;
/* A NULL return string returns a value of zero */
if (*String == 0)
{
return_ACPI_STATUS (AE_OK);
}
if (!AcpiUtRemoveWhitespace (&String))
{
return_ACPI_STATUS (AE_OK);
}
/*
* 1) Check for a hex constant. A "0x" prefix indicates base 16.
*/
if (AcpiUtDetectHexPrefix (&String))
{
Base = 16;
}
/*
* 2) Check for an octal constant, defined to be a leading zero
* followed by sequence of octal digits (0-7)
*/
else if (AcpiUtDetectOctalPrefix (&String))
{
Base = 8;
}
if (!AcpiUtRemoveLeadingZeros (&String))
{
return_ACPI_STATUS (AE_OK); /* Return value 0 */
}
/*
* Force a full 64-bit conversion. The caller (usually iASL) must
* check for a 32-bit overflow later as necessary (If current mode
* is 32-bit, meaning a 32-bit DSDT).
*/
OriginalBitWidth = AcpiGbl_IntegerBitWidth;
AcpiGbl_IntegerBitWidth = 64;
/*
* Perform the base 8, 10, or 16 conversion. A 64-bit numeric overflow
* will return an exception (to allow iASL to flag the statement).
*/
switch (Base)
{
case 8:
Status = AcpiUtConvertOctalString (String, ReturnValue);
break;
case 10:
Status = AcpiUtConvertDecimalString (String, ReturnValue);
break;
case 16:
default:
Status = AcpiUtConvertHexString (String, ReturnValue);
break;
}
/* Only possible exception from above is a 64-bit overflow */
AcpiGbl_IntegerBitWidth = OriginalBitWidth;
return_ACPI_STATUS (Status);
}
示例12: AcpiExOpcode_2A_0T_0R
ACPI_STATUS
AcpiExOpcode_2A_0T_0R (
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_NAMESPACE_NODE *Node;
UINT32 Value;
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_0T_0R,
AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the opcode */
switch (WalkState->Opcode)
{
case AML_NOTIFY_OP: /* Notify (NotifyObject, NotifyValue) */
/* The first operand is a namespace node */
Node = (ACPI_NAMESPACE_NODE *) Operand[0];
/* Second value is the notify value */
Value = (UINT32) Operand[1]->Integer.Value;
/* Are notifies allowed on this object? */
if (!AcpiEvIsNotifyObject (Node))
{
ACPI_ERROR ((AE_INFO,
"Unexpected notify object type [%s]",
AcpiUtGetTypeName (Node->Type)));
Status = AE_AML_OPERAND_TYPE;
break;
}
#ifdef ACPI_GPE_NOTIFY_CHECK
/*
* GPE method wake/notify check. Here, we want to ensure that we
* don't receive any "DeviceWake" Notifies from a GPE _Lxx or _Exx
* GPE method during system runtime. If we do, the GPE is marked
* as "wake-only" and disabled.
*
* 1) Is the Notify() value == DeviceWake?
* 2) Is this a GPE deferred method? (An _Lxx or _Exx method)
* 3) Did the original GPE happen at system runtime?
* (versus during wake)
*
* If all three cases are true, this is a wake-only GPE that should
* be disabled at runtime.
*/
if (Value == 2) /* DeviceWake */
{
Status = AcpiEvCheckForWakeOnlyGpe (WalkState->GpeEventInfo);
if (ACPI_FAILURE (Status))
{
/* AE_WAKE_ONLY_GPE only error, means ignore this notify */
return_ACPI_STATUS (AE_OK)
}
}
#endif
/*
* Dispatch the notify to the appropriate handler
* NOTE: the request is queued for execution after this method
* completes. The notify handlers are NOT invoked synchronously
* from this thread -- because handlers may in turn run other
* control methods.
*/
Status = AcpiEvQueueNotifyRequest (Node, Value);
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
}
示例13: AcpiExOpcode_2A_1T_1R
ACPI_STATUS
AcpiExOpcode_2A_1T_1R (
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
UINT64 Index;
ACPI_STATUS Status = AE_OK;
ACPI_SIZE Length = 0;
ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_1T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
/* Execute the opcode */
if (WalkState->OpInfo->Flags & AML_MATH)
{
/* All simple math opcodes (add, etc.) */
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
ReturnDesc->Integer.Value = AcpiExDoMathOp (WalkState->Opcode,
Operand[0]->Integer.Value,
Operand[1]->Integer.Value);
goto StoreResultToTarget;
}
switch (WalkState->Opcode)
{
case AML_MOD_OP: /* Mod (Dividend, Divisor, RemainderResult (ACPI 2.0) */
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/* ReturnDesc will contain the remainder */
Status = AcpiUtDivide (Operand[0]->Integer.Value,
Operand[1]->Integer.Value,
NULL,
&ReturnDesc->Integer.Value);
break;
case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
Status = AcpiExDoConcatenate (Operand[0], Operand[1],
&ReturnDesc, WalkState);
break;
case AML_TO_STRING_OP: /* ToString (Buffer, Length, Result) (ACPI 2.0) */
/*
* Input object is guaranteed to be a buffer at this point (it may have
* been converted.) Copy the raw buffer data to a new object of
* type String.
*/
/*
* Get the length of the new string. It is the smallest of:
* 1) Length of the input buffer
* 2) Max length as specified in the ToString operator
* 3) Length of input buffer up to a zero byte (null terminator)
*
* NOTE: A length of zero is ok, and will create a zero-length, null
* terminated string.
*/
while ((Length < Operand[0]->Buffer.Length) &&
(Length < Operand[1]->Integer.Value) &&
(Operand[0]->Buffer.Pointer[Length]))
{
Length++;
}
/* Allocate a new string object */
ReturnDesc = AcpiUtCreateStringObject (Length);
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/*
* Copy the raw buffer data with no transform.
* (NULL terminated already)
*/
ACPI_MEMCPY (ReturnDesc->String.Pointer,
Operand[0]->Buffer.Pointer, Length);
break;
case AML_CONCAT_RES_OP:
//.........这里部分代码省略.........
示例14: AcpiExOpcode_3A_0T_0R
ACPI_STATUS
AcpiExOpcode_3A_0T_0R (
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_SIGNAL_FATAL_INFO *Fatal;
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE_STR (ExOpcode_3A_0T_0R,
AcpiPsGetOpcodeName (WalkState->Opcode));
switch (WalkState->Opcode)
{
case AML_FATAL_OP: /* Fatal (FatalType FatalCode FatalArg) */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"FatalOp: Type %X Code %X Arg %X "
"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
(UINT32) Operand[0]->Integer.Value,
(UINT32) Operand[1]->Integer.Value,
(UINT32) Operand[2]->Integer.Value));
Fatal = ACPI_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO));
if (Fatal)
{
Fatal->Type = (UINT32) Operand[0]->Integer.Value;
Fatal->Code = (UINT32) Operand[1]->Integer.Value;
Fatal->Argument = (UINT32) Operand[2]->Integer.Value;
}
/* Always signal the OS! */
Status = AcpiOsSignal (ACPI_SIGNAL_FATAL, Fatal);
/* Might return while OS is shutting down, just continue */
ACPI_FREE (Fatal);
goto Cleanup;
case AML_EXTERNAL_OP:
/*
* If the interpreter sees this opcode, just ignore it. The External
* op is intended for use by disassemblers in order to properly
* disassemble control method invocations. The opcode or group of
* opcodes should be surrounded by an "if (0)" clause to ensure that
* AML interpreters never see the opcode. Thus, something is
* wrong if an external opcode ever gets here.
*/
ACPI_ERROR ((AE_INFO, "Executed External Op"));
Status = AE_OK;
goto Cleanup;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
Cleanup:
return_ACPI_STATUS (Status);
}
示例15: AcpiExOpcode_2A_0T_1R
ACPI_STATUS
AcpiExOpcode_2A_0T_1R (
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
ACPI_STATUS Status = AE_OK;
BOOLEAN LogicalResult = FALSE;
ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_0T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
/* Create the internal return object */
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/* Execute the Opcode */
if (WalkState->OpInfo->Flags & AML_LOGICAL_NUMERIC)
{
/* LogicalOp (Operand0, Operand1) */
Status = AcpiExDoLogicalNumericOp (WalkState->Opcode,
Operand[0]->Integer.Value, Operand[1]->Integer.Value,
&LogicalResult);
goto StoreLogicalResult;
}
else if (WalkState->OpInfo->Flags & AML_LOGICAL)
{
/* LogicalOp (Operand0, Operand1) */
Status = AcpiExDoLogicalOp (WalkState->Opcode, Operand[0],
Operand[1], &LogicalResult);
goto StoreLogicalResult;
}
switch (WalkState->Opcode)
{
case AML_ACQUIRE_OP: /* Acquire (MutexObject, Timeout) */
Status = AcpiExAcquireMutex (Operand[1], Operand[0], WalkState);
if (Status == AE_TIME)
{
LogicalResult = TRUE; /* TRUE = Acquire timed out */
Status = AE_OK;
}
break;
case AML_WAIT_OP: /* Wait (EventObject, Timeout) */
Status = AcpiExSystemWaitEvent (Operand[1], Operand[0]);
if (Status == AE_TIME)
{
LogicalResult = TRUE; /* TRUE, Wait timed out */
Status = AE_OK;
}
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
StoreLogicalResult:
/*
* Set return value to according to LogicalResult. logical TRUE (all ones)
* Default is FALSE (zero)
*/
if (LogicalResult)
{
ReturnDesc->Integer.Value = ACPI_UINT64_MAX;
}
Cleanup:
/* Delete return object on error */
if (ACPI_FAILURE (Status))
{
AcpiUtRemoveReference (ReturnDesc);
}
/* Save return object on success */
else
{
WalkState->ResultObj = ReturnDesc;
}
//.........这里部分代码省略.........