本网站可以出售:只需60000元直接拥有。QQ:939804642
您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ACPI_PTR_DIFF函数代码示例

51自学网 2021-06-01 19:32:51
  C++
这篇教程C++ ACPI_PTR_DIFF函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中ACPI_PTR_DIFF函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_PTR_DIFF函数的具体用法?C++ ACPI_PTR_DIFF怎么用?C++ ACPI_PTR_DIFF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了ACPI_PTR_DIFF函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: AcpiExConcatTemplate

ACPI_STATUSAcpiExConcatTemplate (    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);}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:58,


示例2: acpi_ex_concat_template

acpi_statusacpi_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);}
开发者ID:BackupTheBerlios,项目名称:tuxap,代码行数:56,


示例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;}
开发者ID:avagin,项目名称:linux,代码行数:42,


示例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;}
开发者ID:avagin,项目名称:linux,代码行数:38,


示例5: AcpiDbSetMethodBreakpoint

voidAcpiDbSetMethodBreakpoint (    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);}
开发者ID:iHaD,项目名称:DragonFlyBSD,代码行数:32,


示例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;}
开发者ID:avagin,项目名称:linux,代码行数:36,


示例7: AcpiRsVendorStream

ACPI_STATUSAcpiRsVendorStream (    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);}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:60,


示例8: AcpiRsEndTagStream

ACPI_STATUSAcpiRsEndTagStream (    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);}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:34,


示例9: AcpiPsGetAmlOpcode

static ACPI_STATUSAcpiPsGetAmlOpcode (    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);}
开发者ID:AgamAgarwal,项目名称:minix,代码行数:58,


示例10: AcpiUtInitStackPtrTrace

voidAcpiUtInitStackPtrTrace (    void){    UINT32                  CurrentSp;    AcpiGbl_EntryStackPointer = ACPI_PTR_DIFF (&CurrentSp, NULL);}
开发者ID:andreiw,项目名称:polaris,代码行数:9,


示例11: acpi_ut_init_stack_ptr_trace

voidacpi_ut_init_stack_ptr_trace (	void){	u32                         current_sp;	acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF (&current_sp, NULL);}
开发者ID:kzlin129,项目名称:tt-gpl,代码行数:9,


示例12: AcpiDsMethodError

ACPI_STATUSAcpiDsMethodError (    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);}
开发者ID:jaredmcneill,项目名称:freebsd,代码行数:56,


示例13: acpi_ds_method_error

acpi_statusacpi_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);}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:56,


示例14: acpi_rs_fixed_memory32_stream

acpi_statusacpi_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);}
开发者ID:Brainiarc7,项目名称:ralink_sdk,代码行数:55,


示例15: acpi_ut_track_stack_ptr

void acpi_ut_track_stack_ptr(void){    acpi_size current_sp;    current_sp = ACPI_PTR_DIFF(&current_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;    }}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:14,


示例16: AcpiUtTrackStackPtr

voidAcpiUtTrackStackPtr (    void){    ACPI_SIZE               CurrentSp;    CurrentSp = ACPI_PTR_DIFF (&CurrentSp, NULL);    if (CurrentSp < AcpiGbl_LowestStackPointer)    {        AcpiGbl_LowestStackPointer = CurrentSp;    }    if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting)    {        AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel;    }}
开发者ID:andreiw,项目名称:polaris,代码行数:19,


示例17: AcpiUtFormatNumber

static char *AcpiUtFormatNumber (    char                    *String,    char                    *End,    UINT64                  Number,    UINT8                   Base,    INT32                   Width,    INT32                   Precision,    UINT8                   Type){    char                    *Pos;    char                    Sign;    char                    Zero;    BOOLEAN                 NeedPrefix;    BOOLEAN                 Upper;    INT32                   i;    char                    ReversedString[66];    /* Parameter validation */    if (Base < 2 || Base > 16)    {        return (NULL);    }    if (Type & ACPI_FORMAT_LEFT)    {        Type &= ~ACPI_FORMAT_ZERO;    }    NeedPrefix = ((Type & ACPI_FORMAT_PREFIX) && Base != 10) ? TRUE : FALSE;    Upper = (Type & ACPI_FORMAT_UPPER) ? TRUE : FALSE;    Zero = (Type & ACPI_FORMAT_ZERO) ? '0' : ' ';    /* Calculate size according to sign and prefix */    Sign = '/0';    if (Type & ACPI_FORMAT_SIGN)    {        if ((INT64) Number < 0)        {            Sign = '-';            Number = - (INT64) Number;            Width--;        }        else if (Type & ACPI_FORMAT_SIGN_PLUS)        {            Sign = '+';            Width--;        }        else if (Type & ACPI_FORMAT_SIGN_PLUS_SPACE)        {            Sign = ' ';            Width--;        }    }    if (NeedPrefix)    {        Width--;        if (Base == 16)        {            Width--;        }    }    /* Generate full string in reverse order */    Pos = AcpiUtPutNumber (ReversedString, Number, Base, Upper);    i = ACPI_PTR_DIFF (Pos, ReversedString);    /* Printing 100 using %2d gives "100", not "00" */    if (i > Precision)    {        Precision = i;    }    Width -= Precision;    /* Output the string */    if (!(Type & (ACPI_FORMAT_ZERO | ACPI_FORMAT_LEFT)))    {        while (--Width >= 0)        {            String = AcpiUtBoundStringOutput (String, End, ' ');        }    }    if (Sign)    {        String = AcpiUtBoundStringOutput (String, End, Sign);    }    if (NeedPrefix)    {        String = AcpiUtBoundStringOutput (String, End, '0');        if (Base == 16)        {            String = AcpiUtBoundStringOutput (String, End,                        Upper ? 'X' : 'x');//.........这里部分代码省略.........
开发者ID:JasonFord53,项目名称:freebsd,代码行数:101,


示例18: AeBuildLocalTables

//.........这里部分代码省略.........    if (!DsdtAddress)    {        /* Use the local DSDT because incoming table(s) are all SSDT(s) */        DsdtAddress = ACPI_PTR_TO_PHYSADDR (LocalDsdtCode);        DsdtToInstallOverride = ACPI_CAST_PTR (ACPI_TABLE_HEADER, LocalDsdtCode);    }    /*     * Build an FADT. There are three options for the FADT:     * 1) Incoming external FADT specified on the command line     * 2) A "hardware reduced" local FADT     * 3) A fully featured local FADT     */    memset (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT));    if (ExternalFadt)    {        /*         * Use the external FADT, but we must update the DSDT/FACS         * addresses as well as the checksum         */        ExternalFadt->Dsdt = (UINT32) DsdtAddress;        if (!AcpiGbl_ReducedHardware)        {            ExternalFadt->Facs = ACPI_PTR_TO_PHYSADDR (&LocalFACS);        }        /*         * If there room in the FADT for the XDsdt and XFacs 64-bit         * pointers, use them.         */        if (ExternalFadt->Header.Length > ACPI_PTR_DIFF (            &ExternalFadt->XDsdt, ExternalFadt))        {            ExternalFadt->Dsdt = 0;            ExternalFadt->Facs = 0;            ExternalFadt->XDsdt = DsdtAddress;            if (!AcpiGbl_ReducedHardware)            {                ExternalFadt->XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS);            }        }        /* Complete the external FADT with the checksum */        ExternalFadt->Header.Checksum = 0;        ExternalFadt->Header.Checksum = (UINT8) -AcpiTbChecksum (            (void *) ExternalFadt, ExternalFadt->Header.Length);    }    else if (AcpiGbl_UseHwReducedFadt)    {        memcpy (&LocalFADT, HwReducedFadtCode, ACPI_FADT_V5_SIZE);        LocalFADT.Dsdt = 0;        LocalFADT.XDsdt = DsdtAddress;    }    else    {        /*         * Build a local FADT so we can test the hardware/event init         */        LocalFADT.Header.Revision = 5;        /* Setup FADT header and DSDT/FACS addresses */
开发者ID:BarrelfishOS,项目名称:barrelfish,代码行数:67,


示例19: AcpiDbDisplayStatistics

//.........这里部分代码省略.........            AcpiGbl_NumNodes, AcpiGbl_NumObjects);        break;    case CMD_STAT_MEMORY:#ifdef ACPI_DBG_TRACK_ALLOCATIONS        AcpiOsPrintf ("/n----Object Statistics (all in hex)---------/n");        AcpiDbListInfo (AcpiGbl_GlobalList);        AcpiDbListInfo (AcpiGbl_NsNodeList);#endif#ifdef ACPI_USE_LOCAL_CACHE        AcpiOsPrintf ("/n----Cache Statistics (all in hex)---------/n");        AcpiDbListInfo (AcpiGbl_OperandCache);        AcpiDbListInfo (AcpiGbl_PsNodeCache);        AcpiDbListInfo (AcpiGbl_PsNodeExtCache);        AcpiDbListInfo (AcpiGbl_StateCache);#endif        break;    case CMD_STAT_MISC:        AcpiOsPrintf ("/nMiscellaneous Statistics:/n/n");        AcpiOsPrintf ("Calls to AcpiPsFind:..  ........% 7ld/n",            AcpiGbl_PsFindCount);        AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld/n",            AcpiGbl_NsLookupCount);        AcpiOsPrintf ("/n");        AcpiOsPrintf ("Mutex usage:/n/n");        for (i = 0; i < ACPI_NUM_MUTEX; i++)        {            AcpiOsPrintf ("%-28s:       % 7ld/n",                AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount);        }        break;    case CMD_STAT_SIZES:        AcpiOsPrintf ("/nInternal object sizes:/n/n");        AcpiOsPrintf ("Common           %3d/n", sizeof (ACPI_OBJECT_COMMON));        AcpiOsPrintf ("Number           %3d/n", sizeof (ACPI_OBJECT_INTEGER));        AcpiOsPrintf ("String           %3d/n", sizeof (ACPI_OBJECT_STRING));        AcpiOsPrintf ("Buffer           %3d/n", sizeof (ACPI_OBJECT_BUFFER));        AcpiOsPrintf ("Package          %3d/n", sizeof (ACPI_OBJECT_PACKAGE));        AcpiOsPrintf ("BufferField      %3d/n", sizeof (ACPI_OBJECT_BUFFER_FIELD));        AcpiOsPrintf ("Device           %3d/n", sizeof (ACPI_OBJECT_DEVICE));        AcpiOsPrintf ("Event            %3d/n", sizeof (ACPI_OBJECT_EVENT));        AcpiOsPrintf ("Method           %3d/n", sizeof (ACPI_OBJECT_METHOD));        AcpiOsPrintf ("Mutex            %3d/n", sizeof (ACPI_OBJECT_MUTEX));        AcpiOsPrintf ("Region           %3d/n", sizeof (ACPI_OBJECT_REGION));        AcpiOsPrintf ("PowerResource    %3d/n", sizeof (ACPI_OBJECT_POWER_RESOURCE));        AcpiOsPrintf ("Processor        %3d/n", sizeof (ACPI_OBJECT_PROCESSOR));        AcpiOsPrintf ("ThermalZone      %3d/n", sizeof (ACPI_OBJECT_THERMAL_ZONE));        AcpiOsPrintf ("RegionField      %3d/n", sizeof (ACPI_OBJECT_REGION_FIELD));        AcpiOsPrintf ("BankField        %3d/n", sizeof (ACPI_OBJECT_BANK_FIELD));        AcpiOsPrintf ("IndexField       %3d/n", sizeof (ACPI_OBJECT_INDEX_FIELD));        AcpiOsPrintf ("Reference        %3d/n", sizeof (ACPI_OBJECT_REFERENCE));        AcpiOsPrintf ("Notify           %3d/n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));        AcpiOsPrintf ("AddressSpace     %3d/n", sizeof (ACPI_OBJECT_ADDR_HANDLER));        AcpiOsPrintf ("Extra            %3d/n", sizeof (ACPI_OBJECT_EXTRA));        AcpiOsPrintf ("Data             %3d/n", sizeof (ACPI_OBJECT_DATA));        AcpiOsPrintf ("/n");        AcpiOsPrintf ("ParseObject      %3d/n", sizeof (ACPI_PARSE_OBJ_COMMON));        AcpiOsPrintf ("ParseObjectNamed %3d/n", sizeof (ACPI_PARSE_OBJ_NAMED));        AcpiOsPrintf ("ParseObjectAsl   %3d/n", sizeof (ACPI_PARSE_OBJ_ASL));        AcpiOsPrintf ("OperandObject    %3d/n", sizeof (ACPI_OPERAND_OBJECT));        AcpiOsPrintf ("NamespaceNode    %3d/n", sizeof (ACPI_NAMESPACE_NODE));        AcpiOsPrintf ("AcpiObject       %3d/n", sizeof (ACPI_OBJECT));        break;    case CMD_STAT_STACK:#if defined(ACPI_DEBUG_OUTPUT)        Temp = (UINT32) ACPI_PTR_DIFF (AcpiGbl_EntryStackPointer, AcpiGbl_LowestStackPointer);        AcpiOsPrintf ("/nSubsystem Stack Usage:/n/n");        AcpiOsPrintf ("Entry Stack Pointer          %p/n", AcpiGbl_EntryStackPointer);        AcpiOsPrintf ("Lowest Stack Pointer         %p/n", AcpiGbl_LowestStackPointer);        AcpiOsPrintf ("Stack Use                    %X (%u)/n", Temp, Temp);        AcpiOsPrintf ("Deepest Procedure Nesting    %u/n", AcpiGbl_DeepestNesting);#endif        break;    default:        break;    }    AcpiOsPrintf ("/n");    return (AE_OK);}
开发者ID:apprisi,项目名称:illumos-gate,代码行数:101,


示例20: return

static char *acpi_ut_format_number(char *string,                                   char *end,                                   u64 number,                                   u8 base, s32 width, s32 precision, u8 type){    char *pos;    char sign;    char zero;    u8 need_prefix;    u8 upper;    s32 i;    char reversed_string[66];    /* Parameter validation */    if (base < 2 || base > 16) {        return (NULL);    }    if (type & ACPI_FORMAT_LEFT) {        type &= ~ACPI_FORMAT_ZERO;    }    need_prefix = ((type & ACPI_FORMAT_PREFIX)                   && base != 10) ? TRUE : FALSE;    upper = (type & ACPI_FORMAT_UPPER) ? TRUE : FALSE;    zero = (type & ACPI_FORMAT_ZERO) ? '0' : ' ';    /* Calculate size according to sign and prefix */    sign = '/0';    if (type & ACPI_FORMAT_SIGN) {        if ((s64) number < 0) {            sign = '-';            number = -(s64) number;            width--;        } else if (type & ACPI_FORMAT_SIGN_PLUS) {            sign = '+';            width--;        } else if (type & ACPI_FORMAT_SIGN_PLUS_SPACE) {            sign = ' ';            width--;        }    }    if (need_prefix) {        width--;        if (base == 16) {            width--;        }    }    /* Generate full string in reverse order */    pos = acpi_ut_put_number(reversed_string, number, base, upper);    i = ACPI_PTR_DIFF(pos, reversed_string);    /* Printing 100 using %2d gives "100", not "00" */    if (i > precision) {        precision = i;    }    width -= precision;    /* Output the string */    if (!(type & (ACPI_FORMAT_ZERO | ACPI_FORMAT_LEFT))) {        while (--width >= 0) {            string = acpi_ut_bound_string_output(string, end, ' ');        }    }    if (sign) {        string = acpi_ut_bound_string_output(string, end, sign);    }    if (need_prefix) {        string = acpi_ut_bound_string_output(string, end, '0');        if (base == 16) {            string = acpi_ut_bound_string_output(string, end,                                                 upper ? 'X' : 'x');        }    }    if (!(type & ACPI_FORMAT_LEFT)) {        while (--width >= 0) {            string = acpi_ut_bound_string_output(string, end, zero);        }    }    while (i <= --precision) {        string = acpi_ut_bound_string_output(string, end, '0');    }    while (--i >= 0) {        string = acpi_ut_bound_string_output(string, end,                                             reversed_string[i]);    }    while (--width >= 0) {        string = acpi_ut_bound_string_output(string, end, ' ');    }    return (string);}
开发者ID:asdlei00,项目名称:linux,代码行数:100,


示例21: AcpiPsGetArguments

static ACPI_STATUSAcpiPsGetArguments (    ACPI_WALK_STATE         *WalkState,    UINT8                   *AmlOpStart,    ACPI_PARSE_OBJECT       *Op){    ACPI_STATUS             Status = AE_OK;    ACPI_PARSE_OBJECT       *Arg = NULL;    const ACPI_OPCODE_INFO  *OpInfo;    ACPI_FUNCTION_TRACE_PTR (PsGetArguments, WalkState);    switch (Op->Common.AmlOpcode)    {    case AML_BYTE_OP:       /* AML_BYTEDATA_ARG */    case AML_WORD_OP:       /* AML_WORDDATA_ARG */    case AML_DWORD_OP:      /* AML_DWORDATA_ARG */    case AML_QWORD_OP:      /* AML_QWORDATA_ARG */    case AML_STRING_OP:     /* AML_ASCIICHARLIST_ARG */        /* Fill in constant or string argument directly */        AcpiPsGetNextSimpleArg (&(WalkState->ParserState),            GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), Op);        break;    case AML_INT_NAMEPATH_OP:   /* AML_NAMESTRING_ARG */        Status = AcpiPsGetNextNamepath (WalkState, &(WalkState->ParserState), Op, 1);        if (ACPI_FAILURE (Status))        {            return_ACPI_STATUS (Status);        }        WalkState->ArgTypes = 0;        break;    default:        /*         * Op is not a constant or string, append each argument to the Op         */        while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && !WalkState->ArgCount)        {            WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->ParserState.Aml,                WalkState->ParserState.AmlStart);            Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState),                        GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);            if (ACPI_FAILURE (Status))            {                return_ACPI_STATUS (Status);            }            if (Arg)            {                Arg->Common.AmlOffset = WalkState->AmlOffset;                AcpiPsAppendArg (Op, Arg);            }            INCREMENT_ARG_LIST (WalkState->ArgTypes);        }        /*         * Handle executable code at "module-level". This refers to         * executable opcodes that appear outside of any control method.         */        if ((WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2) &&            ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) == 0))        {            /*             * We want to skip If/Else/While constructs during Pass1 because we             * want to actually conditionally execute the code during Pass2.             *             * Except for disassembly, where we always want to walk the             * If/Else/While packages             */            switch (Op->Common.AmlOpcode)            {            case AML_IF_OP:            case AML_ELSE_OP:            case AML_WHILE_OP:                /*                 * Currently supported module-level opcodes are:                 * IF/ELSE/WHILE. These appear to be the most common,                 * and easiest to support since they open an AML                 * package.                 */                if (WalkState->PassNumber == ACPI_IMODE_LOAD_PASS1)                {                    AcpiPsLinkModuleCode (Op->Common.Parent, AmlOpStart,                        (UINT32) (WalkState->ParserState.PkgEnd - AmlOpStart),                        WalkState->OwnerId);                }                ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,                    "Pass1: Skipping an If/Else/While body/n"));//.........这里部分代码省略.........
开发者ID:Jyang772,项目名称:XEOS,代码行数:101,


示例22: AcpiPsGetAmlOpcode

static ACPI_STATUSAcpiPsGetAmlOpcode (    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. Complain and skip unknown opcodes */        if (WalkState->PassNumber == 2)        {            ACPI_ERROR ((AE_INFO,                "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",                WalkState->Opcode,                (UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER))));            ACPI_DUMP_BUFFER ((WalkState->ParserState.Aml - 16), 48);#ifdef ACPI_ASL_COMPILER            /*             * This is executed for the disassembler only. Output goes             * to the disassembled ASL output file.             */            AcpiOsPrintf (                "/*/nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:/n",                WalkState->Opcode,                (UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER)));            /* Dump the context surrounding the invalid opcode */            AcpiUtDumpBuffer (((UINT8 *) WalkState->ParserState.Aml - 16),                48, DB_BYTE_DISPLAY,                (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16));            AcpiOsPrintf (" *//n");#endif        }        /* Increment past one-byte or two-byte opcode */        WalkState->ParserState.Aml++;        if (WalkState->Opcode > 0xFF) /* Can only happen if first byte is 0x5B */        {            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);}
开发者ID:Jyang772,项目名称:XEOS,代码行数:85,


示例23: acpi_ex_concat_template

acpi_statusacpi_ex_concat_template(union acpi_operand_object *operand0,			union acpi_operand_object *operand1,			union acpi_operand_object **actual_return_desc,			struct acpi_walk_state *walk_state){	acpi_status status;	union acpi_operand_object *return_desc;	u8 *new_buf;	u8 *end_tag;	acpi_size length0;	acpi_size length1;	acpi_size new_length;	ACPI_FUNCTION_TRACE(ex_concat_template);	/*	 * Find the end_tag descriptor in each resource template.	 * Note1: returned pointers point TO the end_tag, not past it.	 * Note2: zero-length buffers are allowed; treated like one end_tag	 */	/* Get the length of the first resource template */	status = acpi_ut_get_resource_end_tag(operand0, &end_tag);	if (ACPI_FAILURE(status)) {		return_ACPI_STATUS(status);	}	length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer);	/* Get the length of the second resource template */	status = acpi_ut_get_resource_end_tag(operand1, &end_tag);	if (ACPI_FAILURE(status)) {		return_ACPI_STATUS(status);	}	length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer);	/* Combine both lengths, minimum size will be 2 for end_tag */	new_length = length0 + length1 + sizeof(struct aml_resource_end_tag);	/* Create a new buffer object for the result (with one end_tag) */	return_desc = acpi_ut_create_buffer_object(new_length);	if (!return_desc) {		return_ACPI_STATUS(AE_NO_MEMORY);	}	/*	 * Copy the templates to the new buffer, 0 first, then 1 follows. One	 * end_tag descriptor is copied from Operand1.	 */	new_buf = return_desc->buffer.pointer;	memcpy(new_buf, operand0->buffer.pointer, length0);	memcpy(new_buf + length0, operand1->buffer.pointer, length1);	/* Insert end_tag and set the checksum to zero, means "ignore checksum" */	new_buf[new_length - 1] = 0;	new_buf[new_length - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;	/* Return the completed resource template */	*actual_return_desc = return_desc;	return_ACPI_STATUS(AE_OK);}
开发者ID:1314cc,项目名称:linux,代码行数:69,


示例24: DtParseLine

static ACPI_STATUSDtParseLine (    char                    *LineBuffer,    UINT32                  Line,    UINT32                  Offset){    char                    *Start;    char                    *End;    char                    *TmpName;    char                    *TmpValue;    char                    *Name;    char                    *Value;    char                    *Colon;    UINT32                  Length;    DT_FIELD                *Field;    UINT32                  Column;    UINT32                  NameColumn;    BOOLEAN                 IsNullString = FALSE;    if (!LineBuffer)    {        return (AE_OK);    }    /* All lines after "Raw Table Data" are ingored */    if (strstr (LineBuffer, ACPI_RAW_TABLE_DATA_HEADER))    {        return (AE_NOT_FOUND);    }    Colon = strchr (LineBuffer, ':');    if (!Colon)    {        return (AE_OK);    }    Start = LineBuffer;    End = Colon;    while (Start < Colon)    {        if (*Start == ' ')        {            Start++;            continue;        }        /* Found left bracket, go to the right bracket */        if (*Start == '[')        {            while (Start < Colon && *Start != ']')            {                Start++;            }            if (Start == Colon)            {                break;            }            Start++;            continue;        }        break;    }    /*     * There are two column values. One for the field name,     * and one for the field value.     */    Column = ACPI_PTR_DIFF (Colon, LineBuffer) + 3;    NameColumn = ACPI_PTR_DIFF (Start, LineBuffer) + 1;    Length = ACPI_PTR_DIFF (End, Start);    TmpName = UtLocalCalloc (Length + 1);    ACPI_STRNCPY (TmpName, Start, Length);    Name = DtTrim (TmpName);    ACPI_FREE (TmpName);    Start = End = (Colon + 1);    while (*End)    {        /* Found left quotation, go to the right quotation and break */        if (*End == '"')        {            End++;            /* Check for an explicit null string */            if (*End == '"')            {                IsNullString = TRUE;            }            while (*End && (*End != '"'))//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:libuinet,代码行数:101,


示例25: DtTrim

static char *DtTrim (    char                    *String){    char                    *Start;    char                    *End;    char                    *ReturnString;    ACPI_SIZE               Length;    /* Skip lines that start with a space */    if (!ACPI_STRCMP (String, " "))    {        ReturnString = UtLocalCalloc (1);        return (ReturnString);    }    /* Setup pointers to start and end of input string */    Start = String;    End = String + ACPI_STRLEN (String) - 1;    /* Find first non-whitespace character */    while ((Start <= End) && ((*Start == ' ') || (*Start == '/t')))    {        Start++;    }    /* Find last non-space character */    while (End >= Start)    {        if (*End == '/r' || *End == '/n')        {            End--;            continue;        }        if (*End != ' ')        {            break;        }        End--;    }    /* Remove any quotes around the string */    if (*Start == '/"')    {        Start++;    }    if (*End == '/"')    {        End--;    }    /* Create the trimmed return string */    Length = ACPI_PTR_DIFF (End, Start) + 1;    ReturnString = UtLocalCalloc (Length + 1);    if (ACPI_STRLEN (Start))    {        ACPI_STRNCPY (ReturnString, Start, Length);    }    ReturnString[Length] = 0;    return (ReturnString);}
开发者ID:BillTheBest,项目名称:libuinet,代码行数:71,


示例26: AeBuildLocalTables

//.........这里部分代码省略.........        NextTable = NextTable->Next;    }    /* Build an RSDP */    ACPI_MEMSET (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP));    ACPI_MAKE_RSDP_SIG (LocalRSDP.Signature);    ACPI_MEMCPY (LocalRSDP.OemId, "I_TEST", 6);    LocalRSDP.Revision = 2;    LocalRSDP.XsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalXSDT);    LocalRSDP.Length = sizeof (ACPI_TABLE_XSDT);    /* Set checksums for both XSDT and RSDP */    LocalXSDT->Header.Checksum = (UINT8) -AcpiTbChecksum (        (void *) LocalXSDT, LocalXSDT->Header.Length);    LocalRSDP.Checksum = (UINT8) -AcpiTbChecksum (        (void *) &LocalRSDP, ACPI_RSDP_CHECKSUM_LENGTH);    if (!DsdtAddress)    {        return (AE_SUPPORT);    }    if (ExternalFadt)    {        /*         * Use the external FADT, but we must update the DSDT/FACS addresses         * as well as the checksum         */        ExternalFadt->Dsdt = DsdtAddress;        ExternalFadt->Facs = ACPI_PTR_TO_PHYSADDR (&LocalFACS);        if (ExternalFadt->Header.Length > ACPI_PTR_DIFF (&ExternalFadt->XDsdt, ExternalFadt))        {            ExternalFadt->XDsdt = DsdtAddress;            ExternalFadt->XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS);        }        /* Complete the FADT with the checksum */        ExternalFadt->Header.Checksum = 0;        ExternalFadt->Header.Checksum = (UINT8) -AcpiTbChecksum (            (void *) ExternalFadt, ExternalFadt->Header.Length);    }    else    {        /*         * Build a local FADT so we can test the hardware/event init         */        ACPI_MEMSET (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT));        ACPI_MOVE_NAME (LocalFADT.Header.Signature, ACPI_SIG_FADT);        /* Setup FADT header and DSDT/FACS addresses */        LocalFADT.Dsdt = 0;        LocalFADT.Facs = 0;        LocalFADT.XDsdt = DsdtAddress;        LocalFADT.XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS);        LocalFADT.Header.Revision = 3;        LocalFADT.Header.Length = sizeof (ACPI_TABLE_FADT);        /* Miscellaneous FADT fields */        LocalFADT.Gpe0BlockLength = 16;
开发者ID:zenny,项目名称:DragonFlyBSD,代码行数:67,


示例27: acpi_find_root_pointer

acpi_status acpi_find_root_pointer(acpi_size *table_address){	u8 *table_ptr;	u8 *mem_rover;	u32 physical_address;	ACPI_FUNCTION_TRACE(acpi_find_root_pointer);	/* 1a) Get the location of the Extended BIOS Data Area (EBDA) */	table_ptr = acpi_os_map_memory((acpi_physical_address)				       ACPI_EBDA_PTR_LOCATION,				       ACPI_EBDA_PTR_LENGTH);	if (!table_ptr) {		ACPI_ERROR((AE_INFO,			    "Could not map memory at 0x%8.8X for length %u",			    ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH));		return_ACPI_STATUS(AE_NO_MEMORY);	}	ACPI_MOVE_16_TO_32(&physical_address, table_ptr);	/* Convert segment part to physical address */	physical_address <<= 4;	acpi_os_unmap_memory(table_ptr, ACPI_EBDA_PTR_LENGTH);	/* EBDA present? */	if (physical_address > 0x400) {		/*		 * 1b) Search EBDA paragraphs (EBDA is required to be a		 *     minimum of 1K length)		 */		table_ptr = acpi_os_map_memory((acpi_physical_address)					       physical_address,					       ACPI_EBDA_WINDOW_SIZE);		if (!table_ptr) {			ACPI_ERROR((AE_INFO,				    "Could not map memory at 0x%8.8X for length %u",				    physical_address, ACPI_EBDA_WINDOW_SIZE));			return_ACPI_STATUS(AE_NO_MEMORY);		}		mem_rover =		    acpi_tb_scan_memory_for_rsdp(table_ptr,						 ACPI_EBDA_WINDOW_SIZE);		acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE);		if (mem_rover) {			/* Return the physical address */			physical_address +=			    (u32) ACPI_PTR_DIFF(mem_rover, table_ptr);			*table_address = physical_address;			return_ACPI_STATUS(AE_OK);		}	}	/*	 * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh	 */	table_ptr = acpi_os_map_memory((acpi_physical_address)				       ACPI_HI_RSDP_WINDOW_BASE,				       ACPI_HI_RSDP_WINDOW_SIZE);	if (!table_ptr) {		ACPI_ERROR((AE_INFO,			    "Could not map memory at 0x%8.8X for length %u",			    ACPI_HI_RSDP_WINDOW_BASE,			    ACPI_HI_RSDP_WINDOW_SIZE));		return_ACPI_STATUS(AE_NO_MEMORY);	}	mem_rover =	    acpi_tb_scan_memory_for_rsdp(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);	acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);	if (mem_rover) {		/* Return the physical address */		physical_address = (u32)		    (ACPI_HI_RSDP_WINDOW_BASE +		     ACPI_PTR_DIFF(mem_rover, table_ptr));		*table_address = physical_address;		return_ACPI_STATUS(AE_OK);	}	/* A valid RSDP was not found */	ACPI_BIOS_ERROR((AE_INFO, "A valid RSDP was not found"));	return_ACPI_STATUS(AE_NOT_FOUND);}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:100,


示例28: AcpiDmDescendingOp

static ACPI_STATUSAcpiDmDescendingOp (    ACPI_PARSE_OBJECT       *Op,    UINT32                  Level,    void                    *Context){    ACPI_OP_WALK_INFO       *Info = Context;    const ACPI_OPCODE_INFO  *OpInfo;    UINT32                  Name;    ACPI_PARSE_OBJECT       *NextOp;    UINT32                  AmlOffset;    OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);    /* Listing support to dump the AML code after the ASL statement */    if (AcpiGbl_DmOpt_Listing)    {        /* We only care about these classes of objects */        if ((OpInfo->Class == AML_CLASS_NAMED_OBJECT) ||            (OpInfo->Class == AML_CLASS_CONTROL) ||            (OpInfo->Class == AML_CLASS_CREATE) ||            ((OpInfo->Class == AML_CLASS_EXECUTE) && (!Op->Common.Next)))        {            if (AcpiGbl_DmOpt_Listing && Info->PreviousAml)            {                /* Dump the AML byte code for the previous Op */                if (Op->Common.Aml > Info->PreviousAml)                {                    AcpiOsPrintf ("/n");                    AcpiUtDumpBuffer (                        (Info->StartAml + Info->AmlOffset),                        (Op->Common.Aml - Info->PreviousAml),                        DB_BYTE_DISPLAY,                        Info->AmlOffset);                    AcpiOsPrintf ("/n");                }                Info->AmlOffset = (Op->Common.Aml - Info->StartAml);            }            Info->PreviousAml = Op->Common.Aml;        }    }    if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)    {        /* Ignore this op -- it was handled elsewhere */        return (AE_CTRL_DEPTH);    }    /* Level 0 is at the Definition Block level */    if (Level == 0)    {        /* In verbose mode, print the AML offset, opcode and depth count */        if (Info->WalkState)        {            AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml,                Info->WalkState->ParserState.AmlStart);            if (AcpiGbl_DmOpt_Verbose)            {                AcpiOsPrintf (DB_FULL_OP_INFO,                    (Info->WalkState->MethodNode ?                        Info->WalkState->MethodNode->Name.Ascii : "   "),                    AmlOffset, (UINT32) Op->Common.AmlOpcode);            }        }        if (Op->Common.AmlOpcode == AML_SCOPE_OP)        {            /* This is the beginning of the Definition Block */            AcpiOsPrintf ("{/n");            /* Emit all External() declarations here */            AcpiDmEmitExternals ();            return (AE_OK);        }    }    else if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&         (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&         (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))    {            /*             * This is a first-level element of a term list,             * indent a new line             */            switch (Op->Common.AmlOpcode)            {            case AML_NOOP_OP:                /*                 * Optionally just ignore this opcode. Some tables use                 * NoOp opcodes for "padding" out packages that the BIOS//.........这里部分代码省略.........
开发者ID:ikitayama,项目名称:acpica-tools,代码行数:101,


示例29: acpi_ps_get_aml_opcode

static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state){	u32 aml_offset;	ACPI_FUNCTION_TRACE_PTR(ps_get_aml_opcode, walk_state);	walk_state->aml = walk_state->parser_state.aml;	walk_state->opcode = acpi_ps_peek_opcode(&(walk_state->parser_state));	/*	 * First cut to determine what we have found:	 * 1) A valid AML opcode	 * 2) A name string	 * 3) An unknown/invalid opcode	 */	walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode);	switch (walk_state->op_info->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.		 */		walk_state->opcode = AML_INT_NAMEPATH_OP;		walk_state->arg_types = ARGP_NAMESTRING;		break;	case AML_CLASS_UNKNOWN:		/* The opcode is unrecognized. Complain and skip unknown opcodes */		if (walk_state->pass_number == 2) {			aml_offset = (u32)ACPI_PTR_DIFF(walk_state->aml,							walk_state->							parser_state.aml_start);			ACPI_ERROR((AE_INFO,				    "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",				    walk_state->opcode,				    (u32)(aml_offset +					  sizeof(struct acpi_table_header))));			ACPI_DUMP_BUFFER((walk_state->parser_state.aml - 16),					 48);#ifdef ACPI_ASL_COMPILER			/*			 * This is executed for the disassembler only. Output goes			 * to the disassembled ASL output file.			 */			acpi_os_printf			    ("/*/nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:/n",			     walk_state->opcode,			     (u32)(aml_offset +				   sizeof(struct acpi_table_header)));			ACPI_ERROR((AE_INFO,				    "Aborting disassembly, AML byte code is corrupt"));			/* Dump the context surrounding the invalid opcode */			acpi_ut_dump_buffer(((u8 *)walk_state->parser_state.					     aml - 16), 48, DB_BYTE_DISPLAY,					    (aml_offset +					     sizeof(struct acpi_table_header) -					     16));			acpi_os_printf(" *//n");			/*			 * Just abort the disassembly, cannot continue because the			 * parser is essentially lost. The disassembler can then			 * randomly fail because an ill-constructed parse tree			 * can result.			 */			return_ACPI_STATUS(AE_AML_BAD_OPCODE);#endif		}		/* Increment past one-byte or two-byte opcode */		walk_state->parser_state.aml++;		if (walk_state->opcode > 0xFF) {	/* Can only happen if first byte is 0x5B */			walk_state->parser_state.aml++;		}		return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);	default:		/* Found opcode info, this is a normal opcode */		walk_state->parser_state.aml +=		    acpi_ps_get_opcode_size(walk_state->opcode);		walk_state->arg_types = walk_state->op_info->parse_args;		break;	}	return_ACPI_STATUS(AE_OK);}
开发者ID:farrellpeng,项目名称:MX283Linux,代码行数:100,



注:本文中的ACPI_PTR_DIFF函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ ACPI_PTR_TO_PHYSADDR函数代码示例
C++ ACPI_PTR函数代码示例
51自学网自学EXCEL、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。
京ICP备13026421号-1