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

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

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

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

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

示例1: AcpiTbValidateFadt

static voidAcpiTbValidateFadt (    void){    UINT32                  *Address32;    ACPI_GENERIC_ADDRESS    *Address64;    UINT8                   Length;    ACPI_NATIVE_UINT        i;    /* Examine all of the 64-bit extended address fields (X fields) */    for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)    {        /* Generate pointers to the 32-bit and 64-bit addresses and get the length */        Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT, FadtInfoTable[i].Target);        Address32 = ACPI_ADD_PTR (UINT32, &AcpiGbl_FADT, FadtInfoTable[i].Source);        Length = *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length);        if (FadtInfoTable[i].Type & ACPI_FADT_REQUIRED)        {            /*             * Field is required (PM1aEvent, PM1aControl, PmTimer).             * Both the address and length must be non-zero.             */            if (!Address64->Address || !Length)            {                ACPI_ERROR ((AE_INFO,                    "Required field /"%s/" has zero address and/or length: %8.8X%8.8X/%X",                    FadtInfoTable[i].Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));            }        }        else if (FadtInfoTable[i].Type & ACPI_FADT_SEPARATE_LENGTH)        {            /*             * Field is optional (PM2Control, GPE0, GPE1) AND has its own             * length field. If present, both the address and length must be valid.             */            if ((Address64->Address && !Length) || (!Address64->Address && Length))            {                ACPI_WARNING ((AE_INFO,                    "Optional field /"%s/" has zero address or length: %8.8X%8.8X/%X",                    FadtInfoTable[i].Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));            }        }        /* If both 32- and 64-bit addresses are valid (non-zero), they must match */        if (Address64->Address && *Address32 &&           (Address64->Address != (UINT64) *Address32))        {            ACPI_ERROR ((AE_INFO,                "32/64X address mismatch in /"%s/": [%8.8X] [%8.8X%8.8X], using 64X",                FadtInfoTable[i].Name, *Address32, ACPI_FORMAT_UINT64 (Address64->Address)));        }    }}
开发者ID:oza,项目名称:FreeBSD-7.3-dyntick,代码行数:58,


示例2: AcpiRsDumpIrqList

voidAcpiRsDumpIrqList (    UINT8                   *RouteTable){    ACPI_PCI_ROUTING_TABLE  *PrtElement;    UINT8                   Count;    ACPI_FUNCTION_ENTRY ();    /* Check if debug output enabled */    if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_RESOURCES, _COMPONENT))    {        return;    }    PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, RouteTable);    /* Dump all table elements, Exit on zero length element */    for (Count = 0; PrtElement->Length; Count++)    {        AcpiOsPrintf ("/n[%02X] PCI IRQ Routing Table Package/n", Count);        AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt);        PrtElement = ACPI_ADD_PTR (ACPI_PCI_ROUTING_TABLE,            PrtElement, PrtElement->Length);    }}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:31,


示例3: acpi_rs_get_resource_source

acpi_rs_lengthacpi_rs_get_resource_source(acpi_rs_length resource_length,			    acpi_rs_length minimum_length,			    struct acpi_resource_source * resource_source,			    union aml_resource * aml, char *string_ptr){	acpi_rsdesc_size total_length;	u8 *aml_resource_source;	ACPI_FUNCTION_ENTRY();	total_length =	    resource_length + sizeof(struct aml_resource_large_header);	aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length);	if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) {				resource_source->index = aml_resource_source[0];		resource_source->string_ptr = string_ptr;		if (!string_ptr) {			resource_source->string_ptr =			    ACPI_ADD_PTR(char, resource_source,					 sizeof(struct acpi_resource_source));		}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:27,


示例4: AcpiRsDumpIrqList

voidAcpiRsDumpIrqList (    UINT8                   *RouteTable){    ACPI_PCI_ROUTING_TABLE  *PrtElement;    UINT8                   Count;    ACPI_FUNCTION_ENTRY ();    if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer))    {        return;    }    PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, RouteTable);    /* Dump all table elements, Exit on zero length element */    for (Count = 0; PrtElement->Length; Count++)    {        AcpiOsPrintf ("/n[%02X] PCI IRQ Routing Table Package/n", Count);        AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt);        PrtElement = ACPI_ADD_PTR (ACPI_PCI_ROUTING_TABLE,                        PrtElement, PrtElement->Length);    }}
开发者ID:BillTheBest,项目名称:libuinet,代码行数:29,


示例5: AcpiDmDumpMcfg

voidAcpiDmDumpMcfg (    ACPI_TABLE_HEADER       *Table){    ACPI_STATUS             Status;    UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);    ACPI_MCFG_ALLOCATION    *SubTable;    /* Main table */    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);    if (ACPI_FAILURE (Status))    {        return;    }    /* Sub-tables */    SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);    while (Offset < Table->Length)    {        if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)        {            AcpiOsPrintf ("Warning: there are %d invalid trailing bytes/n",                          sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));            return;        }        AcpiOsPrintf ("/n");        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,                                  sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);        if (ACPI_FAILURE (Status))        {            return;        }        /* Point to next sub-table (each subtable is of fixed length) */        Offset += sizeof (ACPI_MCFG_ALLOCATION);        SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable,                                 sizeof (ACPI_MCFG_ALLOCATION));    }}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:44,


示例6: AcpiDmDumpTpm2

voidAcpiDmDumpTpm2 (    ACPI_TABLE_HEADER       *Table){    UINT32                  Offset = sizeof (ACPI_TABLE_TPM2);    ACPI_TABLE_TPM2         *CommonHeader = ACPI_CAST_PTR (ACPI_TABLE_TPM2, Table);    ACPI_TPM2_TRAILER       *Subtable = ACPI_ADD_PTR (ACPI_TPM2_TRAILER, Table, Offset);    ACPI_TPM2_ARM_SMC       *ArmSubtable;    ACPI_STATUS             Status;    /* Main table */    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm2);    if (ACPI_FAILURE (Status))    {        return;    }    AcpiOsPrintf ("/n");    Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,        Table->Length - Offset, AcpiDmTableInfoTpm2a);    if (ACPI_FAILURE (Status))    {        return;    }    switch (CommonHeader->StartMethod)    {    case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC:        ArmSubtable = ACPI_ADD_PTR (ACPI_TPM2_ARM_SMC, Subtable,            sizeof (ACPI_TPM2_TRAILER));        Offset += sizeof (ACPI_TPM2_TRAILER);        AcpiOsPrintf ("/n");        Status = AcpiDmDumpTable (Table->Length, Offset, ArmSubtable,            Table->Length - Offset, AcpiDmTableInfoTpm211);        break;    default:        break;    }}
开发者ID:9elements,项目名称:fwts,代码行数:44,


示例7: AcpiDmVendorLargeDescriptor

voidAcpiDmVendorLargeDescriptor (    AML_RESOURCE            *Resource,    UINT32                  Length,    UINT32                  Level){    AcpiDmVendorCommon ("Long ",        ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)),        Length, Level);}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:11,


示例8: AcpiDmVendorSmallDescriptor

voidAcpiDmVendorSmallDescriptor (    AML_RESOURCE            *Resource,    UINT32                  Length,    UINT32                  Level){    AcpiDmVendorCommon ("Short",        ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_SMALL_HEADER)),        Length, Level);}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:11,


示例9: AcpiDmDumpTcpa

voidAcpiDmDumpTcpa (    ACPI_TABLE_HEADER       *Table){    UINT32                  Offset = sizeof (ACPI_TABLE_TCPA_HDR);    ACPI_TABLE_TCPA_HDR     *CommonHeader = ACPI_CAST_PTR (                                ACPI_TABLE_TCPA_HDR, Table);    ACPI_TABLE_TCPA_HDR     *Subtable = ACPI_ADD_PTR (                                ACPI_TABLE_TCPA_HDR, Table, Offset);    ACPI_STATUS             Status;    /* Main table */    Status = AcpiDmDumpTable (Table->Length, 0, Table,        0, AcpiDmTableInfoTcpaHdr);    if (ACPI_FAILURE (Status))    {        return;    }    /*     * Examine the PlatformClass field to determine the table type.     * Either a client or server table. Only one.     */    switch (CommonHeader->PlatformClass)    {    case ACPI_TCPA_CLIENT_TABLE:        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,            Table->Length - Offset, AcpiDmTableInfoTcpaClient);        break;    case ACPI_TCPA_SERVER_TABLE:        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,            Table->Length - Offset, AcpiDmTableInfoTcpaServer);        break;    default:        AcpiOsPrintf ("/n**** Unknown TCPA Platform Class 0x%X/n",            CommonHeader->PlatformClass);        Status = AE_ERROR;        break;    }    if (ACPI_FAILURE (Status))    {        AcpiOsPrintf ("/n**** Cannot disassemble TCPA table/n");    }}
开发者ID:9elements,项目名称:fwts,代码行数:52,


示例10: AcpiDmDumpWdat

voidAcpiDmDumpWdat (    ACPI_TABLE_HEADER       *Table){    ACPI_STATUS             Status;    UINT32                  Offset = sizeof (ACPI_TABLE_WDAT);    ACPI_WDAT_ENTRY         *Subtable;    /* Main table */    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);    if (ACPI_FAILURE (Status))    {        return;    }    /* Subtables */    Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);    while (Offset < Table->Length)    {        /* Common subtable header */        AcpiOsPrintf ("/n");        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,            sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);        if (ACPI_FAILURE (Status))        {            return;        }        /* Point to next subtable */        Offset += sizeof (ACPI_WDAT_ENTRY);        Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Subtable,            sizeof (ACPI_WDAT_ENTRY));    }}
开发者ID:9elements,项目名称:fwts,代码行数:39,


示例11: AcpiDmDumpErst

voidAcpiDmDumpErst (    ACPI_TABLE_HEADER       *Table){    ACPI_STATUS             Status;    ACPI_WHEA_HEADER        *SubTable;    UINT32                  Length = Table->Length;    UINT32                  Offset = sizeof (ACPI_TABLE_ERST);    /* Main table */    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);    if (ACPI_FAILURE (Status))    {        return;    }    /* Sub-tables */    SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);    while (Offset < Table->Length)    {        AcpiOsPrintf ("/n");        Status = AcpiDmDumpTable (Length, Offset, SubTable,                                  sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);        if (ACPI_FAILURE (Status))        {            return;        }        /* Point to next sub-table (each subtable is of fixed length) */        Offset += sizeof (ACPI_WHEA_HEADER);        SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,                                 sizeof (ACPI_WHEA_HEADER));    }}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:38,


示例12: ACPI_ADD_PTR

static struct acpi_subtable_header *acpi_get_pptt_resource(struct acpi_table_header *table_hdr,							   struct acpi_pptt_processor *node,							   int resource){	u32 *ref;	if (resource >= node->number_of_priv_resources)		return NULL;	ref = ACPI_ADD_PTR(u32, node, sizeof(struct acpi_pptt_processor));	ref += resource;	return fetch_pptt_subtable(table_hdr, *ref);}
开发者ID:avagin,项目名称:linux,代码行数:14,


示例13: AcpiDmDumpCpep

voidAcpiDmDumpCpep (    ACPI_TABLE_HEADER       *Table){    ACPI_STATUS             Status;    ACPI_CPEP_POLLING       *SubTable;    UINT32                  Length = Table->Length;    UINT32                  Offset = sizeof (ACPI_TABLE_CPEP);    /* Main table */    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);    if (ACPI_FAILURE (Status))    {        return;    }    /* Sub-tables */    SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);    while (Offset < Table->Length)    {        AcpiOsPrintf ("/n");        Status = AcpiDmDumpTable (Length, Offset, SubTable,                                  SubTable->Length, AcpiDmTableInfoCpep0);        if (ACPI_FAILURE (Status))        {            return;        }        /* Point to next sub-table */        Offset += SubTable->Length;        SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, SubTable->Length);    }}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:37,


示例14: AcpiRsDumpResourceList

voidAcpiRsDumpResourceList (    ACPI_RESOURCE           *ResourceList){    UINT32                  Count = 0;    UINT32                  Type;    ACPI_FUNCTION_ENTRY ();    if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer))    {        return;    }    /* Walk list and dump all resource descriptors (END_TAG terminates) */    do    {        AcpiOsPrintf ("/n[%02X] ", Count);        Count++;        /* Validate Type before dispatch */        Type = ResourceList->Type;        if (Type > ACPI_RESOURCE_TYPE_MAX)        {            AcpiOsPrintf (                "Invalid descriptor type (%X) in resource list/n",                ResourceList->Type);            return;        }        /* Dump the resource descriptor */        AcpiRsDumpDescriptor (&ResourceList->Data,            AcpiGbl_DumpResourceDispatch[Type]);        /* Point to the next resource structure */        ResourceList = ACPI_ADD_PTR (ACPI_RESOURCE, ResourceList,                            ResourceList->Length);        /* Exit when END_TAG descriptor is reached */    } while (Type != ACPI_RESOURCE_TYPE_END_TAG);}
开发者ID:BillTheBest,项目名称:libuinet,代码行数:48,


示例15: AcpiDmResourceSource

static voidAcpiDmResourceSource (    AML_RESOURCE            *Resource,    ACPI_SIZE               MinimumTotalLength,    UINT32                  ResourceLength){    UINT8                   *AmlResourceSource;    UINT32                  TotalLength;    TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);    /* Check if the optional ResourceSource fields are present */    if (TotalLength <= MinimumTotalLength)    {        /* The two optional fields are not used */        AcpiOsPrintf (",, ");        return;    }    /* Get a pointer to the ResourceSource */    AmlResourceSource = ACPI_ADD_PTR (UINT8, Resource, MinimumTotalLength);    /*     * Always emit the ResourceSourceIndex (Byte)     *     * NOTE: Some ASL compilers always create a 0 byte (in the AML) for the     * Index even if the String does not exist. Although this is in violation     * of the ACPI specification, it is very important to emit ASL code that     * can be compiled back to the identical AML. There may be fields and/or     * indexes into the resource template buffer that are compiled to absolute     * offsets, and these will be broken if the AML length is changed.     */    AcpiOsPrintf ("0x%2.2X,", (UINT32) AmlResourceSource[0]);    /* Make sure that the ResourceSource string exists before dumping it */    if (TotalLength > (MinimumTotalLength + 1))    {        AcpiOsPrintf (" ");        AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT16_MAX);    }    AcpiOsPrintf (", ");}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:48,


示例16: AcpiRsGetResourceSource

ACPI_RS_LENGTHAcpiRsGetResourceSource (    ACPI_RS_LENGTH          ResourceLength,    ACPI_RS_LENGTH          MinimumLength,    ACPI_RESOURCE_SOURCE    *ResourceSource,    AML_RESOURCE            *Aml,    char                    *StringPtr){    ACPI_RSDESC_SIZE        TotalLength;    UINT8                   *AmlResourceSource;    ACPI_FUNCTION_ENTRY ();    TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);    AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength);    /*     * ResourceSource is present if the length of the descriptor is longer than     * the minimum length.     *     * Note: Some resource descriptors will have an additional null, so     * we add 1 to the minimum length.     */    if (TotalLength > (ACPI_RSDESC_SIZE) (MinimumLength + 1))    {        /* Get the ResourceSourceIndex */        ResourceSource->Index = AmlResourceSource[0];        ResourceSource->StringPtr = StringPtr;        if (!StringPtr)        {            /*             * String destination pointer is not specified; Set the String             * pointer to the end of the current ResourceSource structure.             */            ResourceSource->StringPtr = ACPI_ADD_PTR (char, ResourceSource,                sizeof (ACPI_RESOURCE_SOURCE));        }
开发者ID:maosi66,项目名称:illumos-joyent,代码行数:41,


示例17: acpi_rs_get_resource_source

acpi_rs_lengthacpi_rs_get_resource_source(acpi_rs_length resource_length,			    acpi_rs_length minimum_length,			    struct acpi_resource_source * resource_source,			    union aml_resource * aml, char *string_ptr){	acpi_rsdesc_size total_length;	u8 *aml_resource_source;	ACPI_FUNCTION_ENTRY();	total_length =	    resource_length + sizeof(struct aml_resource_large_header);	aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length);	/*	 * resource_source is present if the length of the descriptor is longer than	 * the minimum length.	 *	 * Note: Some resource descriptors will have an additional null, so	 * we add 1 to the minimum length.	 */	if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) {		/* Get the resource_source_index */		resource_source->index = aml_resource_source[0];		resource_source->string_ptr = string_ptr;		if (!string_ptr) {			/*			 * String destination pointer is not specified; Set the String			 * pointer to the end of the current resource_source structure.			 */			resource_source->string_ptr =			    ACPI_ADD_PTR(char, resource_source,					 sizeof(struct acpi_resource_source));		}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:38,


示例18: RsDoInterruptDescriptor

//.........这里部分代码省略.........             * be invalid             */            else if (HasResSourceIndex)            {                AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,                    InitializerOp, NULL);            }#endif            break;        case 6: /* ResourceTag */            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);            break;        default:            /*             * Interrupt Numbers come through here, repeatedly             */            /* Maximum 255 interrupts allowed for this descriptor */            if (Descriptor->ExtendedIrq.InterruptCount == 255)            {                AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST,                    InitializerOp, NULL);                return (Rnode);            }            /* Each interrupt number must be a 32-bit value */            if (InitializerOp->Asl.Value.Integer > ACPI_UINT32_MAX)            {                AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_NUMBER,                    InitializerOp, NULL);            }            /* Save the integer and move pointer to the next one */            Rover->DwordItem = (UINT32) InitializerOp->Asl.Value.Integer;            Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->DwordItem), 4);            Descriptor->ExtendedIrq.InterruptCount++;            Descriptor->ExtendedIrq.ResourceLength += 4;            /* Case 7: First interrupt number in list */            if (i == 7)            {                if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)                {                    /* Must be at least one interrupt */                    AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,                        InitializerOp, NULL);                }                /* Check now for duplicates in list */                RsCheckListForDuplicates (InitializerOp);                /* Create a named field at the start of the list */                RsCreateDwordField (InitializerOp, ACPI_RESTAG_INTERRUPT,                    CurrentByteOffset +                    ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]));            }        }        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);    }    /* Add optional ResSourceIndex if present */    if (HasResSourceIndex)    {        Rover->ByteItem = ResSourceIndex;        Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->ByteItem), 1);        Descriptor->ExtendedIrq.ResourceLength += 1;    }    /* Add optional ResSource string if present */    if (StringLength && ResSourceString)    {        strcpy ((char *) Rover, (char *) ResSourceString);        Rover = ACPI_ADD_PTR (                    AML_RESOURCE, &(Rover->ByteItem), StringLength);        Descriptor->ExtendedIrq.ResourceLength = (UINT16)            (Descriptor->ExtendedIrq.ResourceLength + StringLength);    }    Rnode->BufferLength =        (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) -        ASL_RESDESC_OFFSET (ExtendedIrq.DescriptorType))        + OptionIndex + StringLength;    return (Rnode);}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:101,


示例19: AcpiTbSetupFadtRegisters

static voidAcpiTbSetupFadtRegisters (    void){    ACPI_GENERIC_ADDRESS    *Target64;    ACPI_GENERIC_ADDRESS    *Source64;    UINT8                   Pm1RegisterByteWidth;    UINT32                  i;    /*     * Optionally check all register lengths against the default values and     * update them if they are incorrect.     */    if (AcpiGbl_UseDefaultRegisterWidths)    {        for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)        {            Target64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,                                     FadtInfoTable[i].Address64);            /*             * If a valid register (Address != 0) and the (DefaultLength > 0)             * (Not a GPE register), then check the width against the default.             */            if ((Target64->Address) &&                    (FadtInfoTable[i].DefaultLength > 0) &&                    (FadtInfoTable[i].DefaultLength != Target64->BitWidth))            {                ACPI_WARNING ((AE_INFO,                               "Invalid length for %s: %u, using default %u",                               FadtInfoTable[i].Name, Target64->BitWidth,                               FadtInfoTable[i].DefaultLength));                /* Incorrect size, set width to the default */                Target64->BitWidth = FadtInfoTable[i].DefaultLength;            }        }    }    /*     * Get the length of the individual PM1 registers (enable and status).     * Each register is defined to be (event block length / 2). Extra divide     * by 8 converts bits to bytes.     */    Pm1RegisterByteWidth = (UINT8)                           ACPI_DIV_16 (AcpiGbl_FADT.XPm1aEventBlock.BitWidth);    /*     * Calculate separate GAS structs for the PM1x (A/B) Status and Enable     * registers. These addresses do not appear (directly) in the FADT, so it     * is useful to pre-calculate them from the PM1 Event Block definitions.     *     * The PM event blocks are split into two register blocks, first is the     * PM Status Register block, followed immediately by the PM Enable     * Register block. Each is of length (Pm1EventLength/2)     *     * Note: The PM1A event block is required by the ACPI specification.     * However, the PM1B event block is optional and is rarely, if ever,     * used.     */    for (i = 0; i < ACPI_FADT_PM_INFO_ENTRIES; i++)    {        Source64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,                                 FadtPmInfoTable[i].Source);        if (Source64->Address)        {            AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target,                                      Source64->SpaceId, Pm1RegisterByteWidth,                                      Source64->Address +                                      (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth));        }    }}
开发者ID:mikess,项目名称:illumos-gate,代码行数:77,


示例20: RsDoSpiSerialBusDescriptor

ASL_RESOURCE_NODE *RsDoSpiSerialBusDescriptor (    ASL_RESOURCE_INFO       *Info){    AML_RESOURCE            *Descriptor;    ACPI_PARSE_OBJECT       *InitializerOp;    ASL_RESOURCE_NODE       *Rnode;    char                    *ResourceSource = NULL;    UINT8                   *VendorData = NULL;    UINT16                  ResSourceLength;    UINT16                  VendorLength;    UINT16                  DescriptorSize;    UINT32                  CurrentByteOffset;    UINT32                  i;    InitializerOp = Info->DescriptorTypeOp->Asl.Child;    CurrentByteOffset = Info->CurrentByteOffset;    /*     * Calculate lengths for fields that have variable length:     * 1) Resource Source string     * 2) Vendor Data buffer     */    ResSourceLength = RsGetStringDataLength (InitializerOp);    VendorLength = RsGetBufferDataLength (InitializerOp);    DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_SPI_SERIALBUS) +        ResSourceLength + VendorLength;    /* Allocate the local resource node and initialize */    Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER));    Descriptor = Rnode->Buffer;    Descriptor->SpiSerialBus.ResourceLength = DescriptorSize;    Descriptor->SpiSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;    Descriptor->SpiSerialBus.RevisionId     = AML_RESOURCE_SPI_REVISION;    Descriptor->SpiSerialBus.TypeRevisionId = AML_RESOURCE_SPI_TYPE_REVISION;    Descriptor->SpiSerialBus.Type           = AML_RESOURCE_SPI_SERIALBUSTYPE;    Descriptor->SpiSerialBus.TypeDataLength = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength;    /* Build pointers to optional areas */    VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_SPI_SERIALBUS));    ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);    DbgPrint (ASL_DEBUG_OUTPUT,        "%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, TypLen: %.2X/n",        "SpiSerialBus", Descriptor->SpiSerialBus.ResourceLength,        (UINT16) sizeof (AML_RESOURCE_SPI_SERIALBUS), ResSourceLength,        VendorLength, Descriptor->SpiSerialBus.TypeDataLength);    /* Process all child initialization nodes */    for (i = 0; InitializerOp; i++)    {        switch (i)        {        case 0: /* Device Selection [WORD] (_ADR) */            Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer;            RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,                CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DeviceSelection));            break;        case 1: /* Device Polarity [Flag] (_DPL) */            RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0);            RsCreateBitField (InitializerOp, ACPI_RESTAG_DEVICEPOLARITY,                CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 1);            break;        case 2: /* Wire Mode [Flag] (_MOD) */            RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);            RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,                CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 0);            break;        case 3: /* Device Bit Length [BYTE] (_LEN) */            Descriptor->SpiSerialBus.DataBitLength = (UINT8) InitializerOp->Asl.Value.Integer;            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,                CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DataBitLength));            break;        case 4: /* Slave Mode [Flag] (_SLV) */            RsSetFlagBits (&Descriptor->SpiSerialBus.Flags, InitializerOp, 0, 0);            RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE,                CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.Flags), 0);            break;        case 5: /* Connection Speed [DWORD] (_SPE) */            Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;            RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,                CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ConnectionSpeed));            break;//.........这里部分代码省略.........
开发者ID:JasonFord53,项目名称:freebsd,代码行数:101,


示例21: AcpiTbConvertFadt

static voidAcpiTbConvertFadt (    void){    ACPI_GENERIC_ADDRESS    *Address64;    UINT32                  Address32;    UINT32                  i;    /* Update the local FADT table header length */    AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);    /*     * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary.     * Later code will always use the X 64-bit field.     */    if (!AcpiGbl_FADT.XFacs)    {        AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs;    }    if (!AcpiGbl_FADT.XDsdt)    {        AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt;    }    /*     * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which     * should be zero are indeed zero. This will workaround BIOSs that     * inadvertently place values in these fields.     *     * The ACPI 1.0 reserved fields that will be zeroed are the bytes located     * at offset 45, 55, 95, and the word located at offset 109, 110.     *     * Note: The FADT revision value is unreliable. Only the length can be     * trusted.     */    if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE)    {        AcpiGbl_FADT.PreferredProfile = 0;        AcpiGbl_FADT.PstateControl = 0;        AcpiGbl_FADT.CstControl = 0;        AcpiGbl_FADT.BootFlags = 0;    }    /*     * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X"     * generic address structures as necessary. Later code will always use     * the 64-bit address structures.     *     * March 2009:     * We now always use the 32-bit address if it is valid (non-null). This     * is not in accordance with the ACPI specification which states that     * the 64-bit address supersedes the 32-bit version, but we do this for     * compatibility with other ACPI implementations. Most notably, in the     * case where both the 32 and 64 versions are non-null, we use the 32-bit     * version. This is the only address that is guaranteed to have been     * tested by the BIOS manufacturer.     */    for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)    {        Address32 = *ACPI_ADD_PTR (UINT32,                                   &AcpiGbl_FADT, FadtInfoTable[i].Address32);        Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS,                                  &AcpiGbl_FADT, FadtInfoTable[i].Address64);        /*         * If both 32- and 64-bit addresses are valid (non-zero),         * they must match.         */        if (Address64->Address && Address32 &&                (Address64->Address != (UINT64) Address32))        {            ACPI_ERROR ((AE_INFO,                         "32/64X address mismatch in %s: 0x%8.8X/0x%8.8X%8.8X, using 32",                         FadtInfoTable[i].Name, Address32,                         ACPI_FORMAT_UINT64 (Address64->Address)));        }        /* Always use 32-bit address if it is valid (non-null) */        if (Address32)        {            /*             * Copy the 32-bit address to the 64-bit GAS structure. The             * Space ID is always I/O for 32-bit legacy address fields             */            AcpiTbInitGenericAddress (Address64, ACPI_ADR_SPACE_SYSTEM_IO,                                      *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length),                                      (UINT64) Address32);        }    }}
开发者ID:mikess,项目名称:illumos-gate,代码行数:94,


示例22: AcpiTbValidateFadt

static voidAcpiTbValidateFadt (    void){    char                    *Name;    ACPI_GENERIC_ADDRESS    *Address64;    UINT8                   Length;    UINT32                  i;    /*     * Check for FACS and DSDT address mismatches. An address mismatch between     * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and     * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables.     */    if (AcpiGbl_FADT.Facs &&            (AcpiGbl_FADT.XFacs != (UINT64) AcpiGbl_FADT.Facs))    {        ACPI_WARNING ((AE_INFO,                       "32/64X FACS address mismatch in FADT - "                       "0x%8.8X/0x%8.8X%8.8X, using 32",                       AcpiGbl_FADT.Facs, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XFacs)));        AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs;    }    if (AcpiGbl_FADT.Dsdt &&            (AcpiGbl_FADT.XDsdt != (UINT64) AcpiGbl_FADT.Dsdt))    {        ACPI_WARNING ((AE_INFO,                       "32/64X DSDT address mismatch in FADT - "                       "0x%8.8X/0x%8.8X%8.8X, using 32",                       AcpiGbl_FADT.Dsdt, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XDsdt)));        AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt;    }    /* Examine all of the 64-bit extended address fields (X fields) */    for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)    {        /*         * Generate pointer to the 64-bit address, get the register         * length (width) and the register name         */        Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS,                                  &AcpiGbl_FADT, FadtInfoTable[i].Address64);        Length = *ACPI_ADD_PTR (UINT8,                                &AcpiGbl_FADT, FadtInfoTable[i].Length);        Name = FadtInfoTable[i].Name;        /*         * For each extended field, check for length mismatch between the         * legacy length field and the corresponding 64-bit X length field.         */        if (Address64->Address &&                (Address64->BitWidth != ACPI_MUL_8 (Length)))        {            ACPI_WARNING ((AE_INFO,                           "32/64X length mismatch in %s: %u/%u",                           Name, ACPI_MUL_8 (Length), Address64->BitWidth));        }        if (FadtInfoTable[i].Type & ACPI_FADT_REQUIRED)        {            /*             * Field is required (PM1aEvent, PM1aControl, PmTimer).             * Both the address and length must be non-zero.             */            if (!Address64->Address || !Length)            {                ACPI_ERROR ((AE_INFO,                             "Required field %s has zero address and/or length:"                             " 0x%8.8X%8.8X/0x%X",                             Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));            }        }        else if (FadtInfoTable[i].Type & ACPI_FADT_SEPARATE_LENGTH)        {            /*             * Field is optional (PM2Control, GPE0, GPE1) AND has its own             * length field. If present, both the address and length must             * be valid.             */            if ((Address64->Address && !Length) ||                    (!Address64->Address && Length))            {                ACPI_WARNING ((AE_INFO,                               "Optional field %s has zero address or length: "                               "0x%8.8X%8.8X/0x%X",                               Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));            }        }    }}
开发者ID:mikess,项目名称:illumos-gate,代码行数:95,


示例23: AcpiWalkResourceBuffer

ACPI_STATUSAcpiWalkResourceBuffer (    ACPI_BUFFER                 *Buffer,    ACPI_WALK_RESOURCE_CALLBACK UserFunction,    void                        *Context){    ACPI_STATUS                 Status = AE_OK;    ACPI_RESOURCE               *Resource;    ACPI_RESOURCE               *ResourceEnd;    ACPI_FUNCTION_TRACE (AcpiWalkResourceBuffer);    /* Parameter validation */    if (!Buffer || !Buffer->Pointer || !UserFunction)    {        return_ACPI_STATUS (AE_BAD_PARAMETER);    }    /* Buffer contains the resource list and length */    Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer->Pointer);    ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Buffer->Pointer, Buffer->Length);    /* Walk the resource list until the EndTag is found (or buffer end) */    while (Resource < ResourceEnd)    {        /* Sanity check the resource type */        if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)        {            Status = AE_AML_INVALID_RESOURCE_TYPE;            break;        }        /* Sanity check the length. It must not be zero, or we loop forever */        if (!Resource->Length)        {            return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);        }        /* Invoke the user function, abort on any error returned */        Status = UserFunction (Resource, Context);        if (ACPI_FAILURE (Status))        {            if (Status == AE_CTRL_TERMINATE)            {                /* This is an OK termination by the user function */                Status = AE_OK;            }            break;        }        /* EndTag indicates end-of-list */        if (Resource->Type == ACPI_RESOURCE_TYPE_END_TAG)        {            break;        }        /* Get the next resource descriptor */        Resource = ACPI_NEXT_RESOURCE (Resource);    }    return_ACPI_STATUS (Status);}
开发者ID:CSharpLover,项目名称:MosquitOS,代码行数:73,


示例24: acpi_ex_dump_object

static voidacpi_ex_dump_object(union acpi_operand_object *obj_desc,		    struct acpi_exdump_info *info){	u8 *target;	char *name;	u8 count;	if (!info) {		acpi_os_printf		    ("ExDumpObject: Display not implemented for object type %s/n",		     acpi_ut_get_object_type_name(obj_desc));		return;	}	/* First table entry must contain the table length (# of table entries) */	count = info->offset;	while (count) {		target = ACPI_ADD_PTR(u8, obj_desc, info->offset);		name = info->name;		switch (info->opcode) {		case ACPI_EXD_INIT:			break;		case ACPI_EXD_TYPE:			acpi_ex_out_string("Type",					   acpi_ut_get_object_type_name					   (obj_desc));			break;		case ACPI_EXD_UINT8:			acpi_os_printf("%20s : %2.2X/n", name, *target);			break;		case ACPI_EXD_UINT16:			acpi_os_printf("%20s : %4.4X/n", name,				       ACPI_GET16(target));			break;		case ACPI_EXD_UINT32:			acpi_os_printf("%20s : %8.8X/n", name,				       ACPI_GET32(target));			break;		case ACPI_EXD_UINT64:			acpi_os_printf("%20s : %8.8X%8.8X/n", "Value",				       ACPI_FORMAT_UINT64(ACPI_GET64(target)));			break;		case ACPI_EXD_POINTER:			acpi_ex_out_pointer(name,					    *ACPI_CAST_PTR(void *, target));			break;		case ACPI_EXD_ADDRESS:			acpi_ex_out_address(name,					    *ACPI_CAST_PTR					    (acpi_physical_address, target));			break;		case ACPI_EXD_STRING:			acpi_ut_print_string(obj_desc->string.pointer,					     ACPI_UINT8_MAX);			acpi_os_printf("/n");			break;		case ACPI_EXD_BUFFER:			ACPI_DUMP_BUFFER(obj_desc->buffer.pointer,					 obj_desc->buffer.length);			break;		case ACPI_EXD_PACKAGE:			/* Dump the package contents */			acpi_os_printf("/nPackage Contents:/n");			acpi_ex_dump_package_obj(obj_desc, 0, 0);			break;		case ACPI_EXD_FIELD:			acpi_ex_dump_object(obj_desc,					    acpi_ex_dump_field_common);			break;		case ACPI_EXD_REFERENCE:			acpi_ex_out_string("Opcode",					   (acpi_ps_get_opcode_info//.........这里部分代码省略.........
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:101,


示例25: AcpiRsDumpDescriptor

static voidAcpiRsDumpDescriptor (    void                    *Resource,    ACPI_RSDUMP_INFO        *Table){    UINT8                   *Target = NULL;    UINT8                   *PreviousTarget;    const char              *Name;    UINT8                   Count;    /* First table entry must contain the table length (# of table entries) */    Count = Table->Offset;    while (Count)    {        PreviousTarget = Target;        Target = ACPI_ADD_PTR (UINT8, Resource, Table->Offset);        Name = Table->Name;        switch (Table->Opcode)        {        case ACPI_RSD_TITLE:            /*             * Optional resource title             */            if (Table->Name)            {                AcpiOsPrintf ("%s Resource/n", Name);            }            break;        /* Strings */        case ACPI_RSD_LITERAL:            AcpiRsOutString (Name, ACPI_CAST_PTR (char, Table->Pointer));            break;        case ACPI_RSD_STRING:            AcpiRsOutString (Name, ACPI_CAST_PTR (char, Target));            break;        /* Data items, 8/16/32/64 bit */        case ACPI_RSD_UINT8:            if (Table->Pointer)            {                AcpiRsOutString (Name, Table->Pointer [*Target]);            }            else            {                AcpiRsOutInteger8 (Name, ACPI_GET8 (Target));            }            break;        case ACPI_RSD_UINT16:            AcpiRsOutInteger16 (Name, ACPI_GET16 (Target));            break;        case ACPI_RSD_UINT32:            AcpiRsOutInteger32 (Name, ACPI_GET32 (Target));            break;        case ACPI_RSD_UINT64:            AcpiRsOutInteger64 (Name, ACPI_GET64 (Target));            break;        /* Flags: 1-bit and 2-bit flags supported */        case ACPI_RSD_1BITFLAG:            AcpiRsOutString (Name, Table->Pointer [*Target & 0x01]);            break;        case ACPI_RSD_2BITFLAG:            AcpiRsOutString (Name, Table->Pointer [*Target & 0x03]);            break;        case ACPI_RSD_3BITFLAG:            AcpiRsOutString (Name, Table->Pointer [*Target & 0x07]);            break;        case ACPI_RSD_SHORTLIST:            /*             * Short byte list (single line output) for DMA and IRQ resources             * Note: The list length is obtained from the previous table entry             */            if (PreviousTarget)            {                AcpiRsOutTitle (Name);                AcpiRsDumpShortByteList (*PreviousTarget, Target);//.........这里部分代码省略.........
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:101,


示例26: AcpiRsGetAmlLength

ACPI_STATUSAcpiRsGetAmlLength (    ACPI_RESOURCE           *Resource,    ACPI_SIZE               ResourceListSize,    ACPI_SIZE               *SizeNeeded){    ACPI_SIZE               AmlSizeNeeded = 0;    ACPI_RESOURCE           *ResourceEnd;    ACPI_RS_LENGTH          TotalSize;    ACPI_FUNCTION_TRACE (RsGetAmlLength);    /* Traverse entire list of internal resource descriptors */    ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, ResourceListSize);    while (Resource < ResourceEnd)    {        /* Validate the descriptor type */        if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)        {            return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);        }        /* Sanity check the length. It must not be zero, or we loop forever */        if (!Resource->Length)        {            return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);        }        /* Get the base size of the (external stream) resource descriptor */        TotalSize = AcpiGbl_AmlResourceSizes [Resource->Type];        /*         * Augment the base size for descriptors with optional and/or         * variable-length fields         */        switch (Resource->Type)        {        case ACPI_RESOURCE_TYPE_IRQ:            /* Length can be 3 or 2 */            if (Resource->Data.Irq.DescriptorLength == 2)            {                TotalSize--;            }            break;        case ACPI_RESOURCE_TYPE_START_DEPENDENT:            /* Length can be 1 or 0 */            if (Resource->Data.Irq.DescriptorLength == 0)            {                TotalSize--;            }            break;        case ACPI_RESOURCE_TYPE_VENDOR:            /*             * Vendor Defined Resource:             * For a Vendor Specific resource, if the Length is between 1 and 7             * it will be created as a Small Resource data type, otherwise it             * is a Large Resource data type.             */            if (Resource->Data.Vendor.ByteLength > 7)            {                /* Base size of a Large resource descriptor */                TotalSize = sizeof (AML_RESOURCE_LARGE_HEADER);            }            /* Add the size of the vendor-specific data */            TotalSize = (ACPI_RS_LENGTH)                (TotalSize + Resource->Data.Vendor.ByteLength);            break;        case ACPI_RESOURCE_TYPE_END_TAG:            /*             * End Tag:             * We are done -- return the accumulated total size.             */            *SizeNeeded = AmlSizeNeeded + TotalSize;            /* Normal exit */            return_ACPI_STATUS (AE_OK);        case ACPI_RESOURCE_TYPE_ADDRESS16:            /*//.........这里部分代码省略.........
开发者ID:JamesLinus,项目名称:ChaiOS,代码行数:101,


示例27: AcpiTbParseRootTable

//.........这里部分代码省略.........         * the XSDT if the revision is > 1 and the XSDT pointer is present,         * as per the ACPI specification.         */        Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->XsdtPhysicalAddress;        TableEntrySize = ACPI_XSDT_ENTRY_SIZE;    }    else    {        /* Root table is an RSDT (32-bit physical addresses) */        Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->RsdtPhysicalAddress;        TableEntrySize = ACPI_RSDT_ENTRY_SIZE;    }    /*     * It is not possible to map more than one entry in some environments,     * so unmap the RSDP here before mapping other tables     */    AcpiOsUnmapMemory (Rsdp, sizeof (ACPI_TABLE_RSDP));    /* Map the RSDT/XSDT table header to get the full table length */    Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));    if (!Table)    {        return_ACPI_STATUS (AE_NO_MEMORY);    }    AcpiTbPrintTableHeader (Address, Table);    /*     * Validate length of the table, and map entire table.     * Minimum length table must contain at least one entry.     */    Length = Table->Length;    AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));    if (Length < (sizeof (ACPI_TABLE_HEADER) + TableEntrySize))    {        ACPI_BIOS_ERROR ((AE_INFO,            "Invalid table length 0x%X in RSDT/XSDT", Length));        return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);    }    Table = AcpiOsMapMemory (Address, Length);    if (!Table)    {        return_ACPI_STATUS (AE_NO_MEMORY);    }    /* Validate the root table checksum */    Status = AcpiTbVerifyChecksum (Table, Length);    if (ACPI_FAILURE (Status))    {        AcpiOsUnmapMemory (Table, Length);        return_ACPI_STATUS (Status);    }    /* Get the number of entries and pointer to first entry */    TableCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) /        TableEntrySize);    TableEntry = ACPI_ADD_PTR (UINT8, Table, sizeof (ACPI_TABLE_HEADER));    /* Initialize the root table array from the RSDT/XSDT */    for (i = 0; i < TableCount; i++)    {        /* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */        Address = AcpiTbGetRootTableEntry (TableEntry, TableEntrySize);        /* Skip NULL entries in RSDT/XSDT */        if (!Address)        {            goto NextTable;        }        Status = AcpiTbInstallStandardTable (Address,            ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, &TableIndex);        if (ACPI_SUCCESS (Status) &&            ACPI_COMPARE_NAME (                &AcpiGbl_RootTableList.Tables[TableIndex].Signature,                ACPI_SIG_FADT))        {            AcpiGbl_FadtIndex = TableIndex;            AcpiTbParseFadt ();        }NextTable:        TableEntry += TableEntrySize;    }    AcpiOsUnmapMemory (Table, Length);    return_ACPI_STATUS (AE_OK);}
开发者ID:benevo,项目名称:acpica,代码行数:101,


示例28: acpi_rs_dump_descriptor

static voidacpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table){	u8 *target = NULL;	u8 *previous_target;	char *name;	u8 count;	/* First table entry must contain the table length (# of table entries) */	count = table->offset;	while (count) {		previous_target = target;		target = ACPI_ADD_PTR(u8, resource, table->offset);		name = table->name;		switch (table->opcode) {		case ACPI_RSD_TITLE:			/*			 * Optional resource title			 */			if (table->name) {				acpi_os_printf("%s Resource/n", name);			}			break;			/* Strings */		case ACPI_RSD_LITERAL:			acpi_rs_out_string(name,					   ACPI_CAST_PTR(char, table->pointer));			break;		case ACPI_RSD_STRING:			acpi_rs_out_string(name, ACPI_CAST_PTR(char, target));			break;			/* Data items, 8/16/32/64 bit */		case ACPI_RSD_UINT8:			if (table->pointer) {				acpi_rs_out_string(name, ACPI_CAST_PTR(char,								       table->								       pointer								       [*target]));			} else {				acpi_rs_out_integer8(name, ACPI_GET8(target));			}			break;		case ACPI_RSD_UINT16:			acpi_rs_out_integer16(name, ACPI_GET16(target));			break;		case ACPI_RSD_UINT32:			acpi_rs_out_integer32(name, ACPI_GET32(target));			break;		case ACPI_RSD_UINT64:			acpi_rs_out_integer64(name, ACPI_GET64(target));			break;			/* Flags: 1-bit and 2-bit flags supported */		case ACPI_RSD_1BITFLAG:			acpi_rs_out_string(name, ACPI_CAST_PTR(char,							       table->							       pointer[*target &								       0x01]));			break;		case ACPI_RSD_2BITFLAG:			acpi_rs_out_string(name, ACPI_CAST_PTR(char,							       table->							       pointer[*target &								       0x03]));			break;		case ACPI_RSD_3BITFLAG:			acpi_rs_out_string(name, ACPI_CAST_PTR(char,							       table->							       pointer[*target &								       0x07]));			break;		case ACPI_RSD_SHORTLIST:			/*			 * Short byte list (single line output) for DMA and IRQ resources			 * Note: The list length is obtained from the previous table entry			 *///.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:ps4-linux,代码行数:101,



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


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