本文整理汇总了C++中ACPI_PTR_DIFF函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_PTR_DIFF函数的具体用法?C++ ACPI_PTR_DIFF怎么用?C++ ACPI_PTR_DIFF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACPI_PTR_DIFF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AcpiExConcatTemplate
ACPI_STATUS
AcpiExConcatTemplate (
ACPI_OPERAND_OBJECT *ObjDesc1,
ACPI_OPERAND_OBJECT *ObjDesc2,
ACPI_OPERAND_OBJECT **ActualReturnDesc,
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT *ReturnDesc;
UINT8 *NewBuf;
UINT8 *EndTag1;
UINT8 *EndTag2;
ACPI_SIZE Length1;
ACPI_SIZE Length2;
ACPI_FUNCTION_TRACE ("ExConcatTemplate");
/* Find the EndTags in each resource template */
EndTag1 = AcpiUtGetResourceEndTag (ObjDesc1);
EndTag2 = AcpiUtGetResourceEndTag (ObjDesc2);
if (!EndTag1 || !EndTag2)
{
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Compute the length of each part */
Length1 = ACPI_PTR_DIFF (EndTag1, ObjDesc1->Buffer.Pointer);
Length2 = ACPI_PTR_DIFF (EndTag2, ObjDesc2->Buffer.Pointer) +
2; /* Size of END_TAG */
/* Create a new buffer object for the result */
ReturnDesc = AcpiUtCreateBufferObject (Length1 + Length2);
if (!ReturnDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Copy the templates to the new descriptor */
NewBuf = ReturnDesc->Buffer.Pointer;
ACPI_MEMCPY (NewBuf, ObjDesc1->Buffer.Pointer, Length1);
ACPI_MEMCPY (NewBuf + Length1, ObjDesc2->Buffer.Pointer, Length2);
/* Compute the new checksum */
NewBuf[ReturnDesc->Buffer.Length - 1] =
AcpiUtGenerateChecksum (ReturnDesc->Buffer.Pointer,
(ReturnDesc->Buffer.Length - 1));
/* Return the completed template descriptor */
*ActualReturnDesc = ReturnDesc;
return_ACPI_STATUS (AE_OK);
}
示例2: acpi_ex_concat_template
acpi_status
acpi_ex_concat_template (
union acpi_operand_object *obj_desc1,
union acpi_operand_object *obj_desc2,
union acpi_operand_object **actual_return_desc,
struct acpi_walk_state *walk_state)
{
union acpi_operand_object *return_desc;
u8 *new_buf;
u8 *end_tag1;
u8 *end_tag2;
acpi_size length1;
acpi_size length2;
ACPI_FUNCTION_TRACE ("ex_concat_template");
/* Find the end_tags in each resource template */
end_tag1 = acpi_ut_get_resource_end_tag (obj_desc1);
end_tag2 = acpi_ut_get_resource_end_tag (obj_desc2);
if (!end_tag1 || !end_tag2) {
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Compute the length of each part */
length1 = ACPI_PTR_DIFF (end_tag1, obj_desc1->buffer.pointer);
length2 = ACPI_PTR_DIFF (end_tag2, obj_desc2->buffer.pointer) +
2; /* Size of END_TAG */
/* Create a new buffer object for the result */
return_desc = acpi_ut_create_buffer_object (length1 + length2);
if (!return_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Copy the templates to the new descriptor */
new_buf = return_desc->buffer.pointer;
ACPI_MEMCPY (new_buf, obj_desc1->buffer.pointer, length1);
ACPI_MEMCPY (new_buf + length1, obj_desc2->buffer.pointer, length2);
/* Compute the new checksum */
new_buf[return_desc->buffer.length - 1] =
acpi_ut_generate_checksum (return_desc->buffer.pointer,
(return_desc->buffer.length - 1));
/* Return the completed template descriptor */
*actual_return_desc = return_desc;
return_ACPI_STATUS (AE_OK);
}
示例3: acpi_pptt_leaf_node
/**
* acpi_pptt_leaf_node() - Given a processor node, determine if its a leaf
* @table_hdr: Pointer to the head of the PPTT table
* @node: passed node is checked to see if its a leaf
*
* Determine if the *node parameter is a leaf node by iterating the
* PPTT table, looking for nodes which reference it.
*
* Return: 0 if we find a node referencing the passed node (or table error),
* or 1 if we don't.
*/
static int acpi_pptt_leaf_node(struct acpi_table_header *table_hdr,
struct acpi_pptt_processor *node)
{
struct acpi_subtable_header *entry;
unsigned long table_end;
u32 node_entry;
struct acpi_pptt_processor *cpu_node;
u32 proc_sz;
if (table_hdr->revision > 1)
return (node->flags & ACPI_PPTT_ACPI_LEAF_NODE);
table_end = (unsigned long)table_hdr + table_hdr->length;
node_entry = ACPI_PTR_DIFF(node, table_hdr);
entry = ACPI_ADD_PTR(struct acpi_subtable_header, table_hdr,
sizeof(struct acpi_table_pptt));
proc_sz = sizeof(struct acpi_pptt_processor *);
while ((unsigned long)entry + proc_sz < table_end) {
cpu_node = (struct acpi_pptt_processor *)entry;
if (entry->type == ACPI_PPTT_TYPE_PROCESSOR &&
cpu_node->parent == node_entry)
return 0;
if (entry->length == 0)
return 0;
entry = ACPI_ADD_PTR(struct acpi_subtable_header, entry,
entry->length);
}
return 1;
}
示例4: topology_get_acpi_cpu_tag
/**
* topology_get_acpi_cpu_tag() - Find a unique topology value for a feature
* @table: Pointer to the head of the PPTT table
* @cpu: Kernel logical CPU number
* @level: A level that terminates the search
* @flag: A flag which terminates the search
*
* Get a unique value given a CPU, and a topology level, that can be
* matched to determine which cpus share common topological features
* at that level.
*
* Return: Unique value, or -ENOENT if unable to locate CPU
*/
static int topology_get_acpi_cpu_tag(struct acpi_table_header *table,
unsigned int cpu, int level, int flag)
{
struct acpi_pptt_processor *cpu_node;
u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
if (cpu_node) {
cpu_node = acpi_find_processor_package_id(table, cpu_node,
level, flag);
/*
* As per specification if the processor structure represents
* an actual processor, then ACPI processor ID must be valid.
* For processor containers ACPI_PPTT_ACPI_PROCESSOR_ID_VALID
* should be set if the UID is valid
*/
if (level == 0 ||
cpu_node->flags & ACPI_PPTT_ACPI_PROCESSOR_ID_VALID)
return cpu_node->acpi_processor_id;
return ACPI_PTR_DIFF(cpu_node, table);
}
pr_warn_once("PPTT table found, but unable to locate core %d (%d)\n",
cpu, acpi_cpu_id);
return -ENOENT;
}
示例5: AcpiDbSetMethodBreakpoint
void
AcpiDbSetMethodBreakpoint (
char *Location,
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
{
UINT32 Address;
UINT32 AmlOffset;
if (!Op)
{
AcpiOsPrintf ("There is no method currently executing\n");
return;
}
/* Get and verify the breakpoint address */
Address = strtoul (Location, NULL, 16);
AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml,
WalkState->ParserState.AmlStart);
if (Address <= AmlOffset)
{
AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n",
Address, AmlOffset);
}
/* Save breakpoint in current walk */
WalkState->UserBreakpoint = Address;
AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address);
}
示例6: find_acpi_cpu_cache_topology
/**
* find_acpi_cpu_cache_topology() - Determine a unique cache topology value
* @cpu: Kernel logical CPU number
* @level: The cache level for which we would like a unique ID
*
* Determine a unique ID for each unified cache in the system
*
* Return: -ENOENT if the PPTT doesn't exist, or the CPU cannot be found.
* Otherwise returns a value which represents a unique topological feature.
*/
int find_acpi_cpu_cache_topology(unsigned int cpu, int level)
{
struct acpi_table_header *table;
struct acpi_pptt_cache *found_cache;
acpi_status status;
u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
struct acpi_pptt_processor *cpu_node = NULL;
int ret = -1;
status = acpi_get_table(ACPI_SIG_PPTT, 0, &table);
if (ACPI_FAILURE(status)) {
acpi_pptt_warn_missing();
return -ENOENT;
}
found_cache = acpi_find_cache_node(table, acpi_cpu_id,
CACHE_TYPE_UNIFIED,
level,
&cpu_node);
if (found_cache)
ret = ACPI_PTR_DIFF(cpu_node, table);
acpi_put_table(table);
return ret;
}
示例7: AcpiRsVendorStream
ACPI_STATUS
AcpiRsVendorStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer = *OutputBuffer;
UINT16 Temp16 = 0;
UINT8 Temp8 = 0;
UINT8 Index;
ACPI_FUNCTION_TRACE ("RsVendorStream");
/*
* Dereference the length to find if this is a large or small item.
*/
if(LinkedList->Data.VendorSpecific.Length > 7)
{
/*
* Large Item, Set the descriptor field and length bytes
*/
*Buffer = 0x84;
Buffer += 1;
Temp16 = (UINT16) LinkedList->Data.VendorSpecific.Length;
ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
Buffer += 2;
}
else
{
/*
* Small Item, Set the descriptor field
*/
Temp8 = 0x70;
Temp8 |= (UINT8) LinkedList->Data.VendorSpecific.Length;
*Buffer = Temp8;
Buffer += 1;
}
/*
* Loop through all of the Vendor Specific fields
*/
for (Index = 0; Index < LinkedList->Data.VendorSpecific.Length; Index++)
{
Temp8 = LinkedList->Data.VendorSpecific.Reserved[Index];
*Buffer = Temp8;
Buffer += 1;
}
/*
* Return the number of bytes consumed in this operation
*/
*BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
示例8: AcpiRsEndTagStream
ACPI_STATUS
AcpiRsEndTagStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer = *OutputBuffer;
UINT8 Temp8 = 0;
ACPI_FUNCTION_TRACE ("RsEndTagStream");
/*
* The descriptor field is static
*/
*Buffer = 0x79;
Buffer += 1;
/*
* Set the Checksum - zero means that the resource data is treated as if
* the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8)
*/
Temp8 = 0;
*Buffer = Temp8;
Buffer += 1;
/*
* Return the number of bytes consumed in this operation
*/
*BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
示例9: AcpiPsGetAmlOpcode
static ACPI_STATUS
AcpiPsGetAmlOpcode (
ACPI_WALK_STATE *WalkState)
{
ACPI_FUNCTION_TRACE_PTR (PsGetAmlOpcode, WalkState);
WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->ParserState.Aml,
WalkState->ParserState.AmlStart);
WalkState->Opcode = AcpiPsPeekOpcode (&(WalkState->ParserState));
/*
* First cut to determine what we have found:
* 1) A valid AML opcode
* 2) A name string
* 3) An unknown/invalid opcode
*/
WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
switch (WalkState->OpInfo->Class)
{
case AML_CLASS_ASCII:
case AML_CLASS_PREFIX:
/*
* Starts with a valid prefix or ASCII char, this is a name
* string. Convert the bare name string to a namepath.
*/
WalkState->Opcode = AML_INT_NAMEPATH_OP;
WalkState->ArgTypes = ARGP_NAMESTRING;
break;
case AML_CLASS_UNKNOWN:
/* The opcode is unrecognized. Just skip unknown opcodes */
ACPI_ERROR ((AE_INFO,
"Found unknown opcode 0x%X at AML address %p offset 0x%X, ignoring",
WalkState->Opcode, WalkState->ParserState.Aml, WalkState->AmlOffset));
ACPI_DUMP_BUFFER (WalkState->ParserState.Aml, 128);
/* Assume one-byte bad opcode */
WalkState->ParserState.Aml++;
return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
default:
/* Found opcode info, this is a normal opcode */
WalkState->ParserState.Aml += AcpiPsGetOpcodeSize (WalkState->Opcode);
WalkState->ArgTypes = WalkState->OpInfo->ParseArgs;
break;
}
return_ACPI_STATUS (AE_OK);
}
示例10: AcpiUtInitStackPtrTrace
void
AcpiUtInitStackPtrTrace (
void)
{
UINT32 CurrentSp;
AcpiGbl_EntryStackPointer = ACPI_PTR_DIFF (&CurrentSp, NULL);
}
示例11: acpi_ut_init_stack_ptr_trace
void
acpi_ut_init_stack_ptr_trace (
void)
{
u32 current_sp;
acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF (¤t_sp, NULL);
}
示例12: AcpiDsMethodError
ACPI_STATUS
AcpiDsMethodError (
ACPI_STATUS Status,
ACPI_WALK_STATE *WalkState)
{
UINT32 AmlOffset;
ACPI_FUNCTION_ENTRY ();
/* Ignore AE_OK and control exception codes */
if (ACPI_SUCCESS (Status) ||
(Status & AE_CODE_CONTROL))
{
return (Status);
}
/* Invoke the global exception handler */
if (AcpiGbl_ExceptionHandler)
{
/* Exit the interpreter, allow handler to execute methods */
AcpiExExitInterpreter ();
/*
* Handler can map the exception code to anything it wants, including
* AE_OK, in which case the executing method will not be aborted.
*/
AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml,
WalkState->ParserState.AmlStart);
Status = AcpiGbl_ExceptionHandler (Status,
WalkState->MethodNode ?
WalkState->MethodNode->Name.Integer : 0,
WalkState->Opcode, AmlOffset, NULL);
AcpiExEnterInterpreter ();
}
AcpiDsClearImplicitReturn (WalkState);
if (ACPI_FAILURE (Status))
{
AcpiDsDumpMethodStack (Status, WalkState, WalkState->Op);
/* Display method locals/args if debugger is present */
#ifdef ACPI_DEBUGGER
AcpiDbDumpMethodInfo (Status, WalkState);
#endif
}
return (Status);
}
示例13: acpi_ds_method_error
acpi_status
acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
{
u32 aml_offset;
acpi_name name = 0;
ACPI_FUNCTION_ENTRY();
/* Ignore AE_OK and control exception codes */
if (ACPI_SUCCESS(status) || (status & AE_CODE_CONTROL)) {
return (status);
}
/* Invoke the global exception handler */
if (acpi_gbl_exception_handler) {
/* Exit the interpreter, allow handler to execute methods */
acpi_ex_exit_interpreter();
/*
* Handler can map the exception code to anything it wants, including
* AE_OK, in which case the executing method will not be aborted.
*/
aml_offset = (u32)ACPI_PTR_DIFF(walk_state->aml,
walk_state->parser_state.
aml_start);
if (walk_state->method_node) {
name = walk_state->method_node->name.integer;
} else if (walk_state->deferred_node) {
name = walk_state->deferred_node->name.integer;
}
status = acpi_gbl_exception_handler(status, name,
walk_state->opcode,
aml_offset, NULL);
acpi_ex_enter_interpreter();
}
acpi_ds_clear_implicit_return(walk_state);
if (ACPI_FAILURE(status)) {
acpi_ds_dump_method_stack(status, walk_state, walk_state->op);
/* Display method locals/args if debugger is present */
#ifdef ACPI_DEBUGGER
acpi_db_dump_method_info(status, walk_state);
#endif
}
return (status);
}
示例14: acpi_rs_fixed_memory32_stream
acpi_status
acpi_rs_fixed_memory32_stream (
struct acpi_resource *linked_list,
u8 **output_buffer,
acpi_size *bytes_consumed)
{
u8 *buffer = *output_buffer;
u16 temp16 = 0;
u8 temp8 = 0;
ACPI_FUNCTION_TRACE ("rs_fixed_memory32_stream");
/*
* The descriptor field is static
*/
*buffer = 0x86;
buffer += 1;
/*
* The length field is static
*/
temp16 = 0x09;
ACPI_MOVE_16_TO_16 (buffer, &temp16);
buffer += 2;
/*
* Set the Information Byte
*/
temp8 = (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01);
*buffer = temp8;
buffer += 1;
/*
* Set the Range base address
*/
ACPI_MOVE_32_TO_32 (buffer,
&linked_list->data.fixed_memory32.range_base_address);
buffer += 4;
/*
* Set the range length
*/
ACPI_MOVE_32_TO_32 (buffer,
&linked_list->data.fixed_memory32.range_length);
buffer += 4;
/*
* Return the number of bytes consumed in this operation
*/
*bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
return_ACPI_STATUS (AE_OK);
}
示例15: acpi_ut_track_stack_ptr
void acpi_ut_track_stack_ptr(void)
{
acpi_size current_sp;
current_sp = ACPI_PTR_DIFF(¤t_sp, NULL);
if (current_sp < acpi_gbl_lowest_stack_pointer) {
acpi_gbl_lowest_stack_pointer = current_sp;
}
if (acpi_gbl_nesting_level > acpi_gbl_deepest_nesting) {
acpi_gbl_deepest_nesting = acpi_gbl_nesting_level;
}
}