本文整理汇总了C++中ACPI_ADD_PTR函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_ADD_PTR函数的具体用法?C++ ACPI_ADD_PTR怎么用?C++ ACPI_ADD_PTR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACPI_ADD_PTR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: AcpiTbValidateFadt
static void
AcpiTbValidateFadt (
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,代码来源:tbfadt.c
示例2: AcpiRsDumpIrqList
void
AcpiRsDumpIrqList (
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,代码来源:rsdump.c
示例3: acpi_rs_get_resource_source
acpi_rs_length
acpi_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,代码来源:rsutils.c
示例4: AcpiRsDumpIrqList
void
AcpiRsDumpIrqList (
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,代码来源:rsdump.c
示例5: AcpiDmDumpMcfg
void
AcpiDmDumpMcfg (
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,代码来源:dmtbdump.c
示例6: AcpiDmDumpTpm2
void
AcpiDmDumpTpm2 (
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,代码来源:dmtbdump3.c
示例7: AcpiDmVendorLargeDescriptor
void
AcpiDmVendorLargeDescriptor (
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,代码来源:dmresrcl.c
示例8: AcpiDmVendorSmallDescriptor
void
AcpiDmVendorSmallDescriptor (
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,代码来源:dmresrcs.c
示例9: AcpiDmDumpTcpa
void
AcpiDmDumpTcpa (
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,代码来源:dmtbdump3.c
示例10: AcpiDmDumpWdat
void
AcpiDmDumpWdat (
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,代码来源:dmtbdump3.c
示例11: AcpiDmDumpErst
void
AcpiDmDumpErst (
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,代码来源:dmtbdump.c
示例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,代码来源:pptt.c
示例13: AcpiDmDumpCpep
void
AcpiDmDumpCpep (
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,代码来源:dmtbdump.c
示例14: AcpiRsDumpResourceList
void
AcpiRsDumpResourceList (
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,代码来源:rsdump.c
示例15: AcpiDmResourceSource
static void
AcpiDmResourceSource (
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,代码来源:dmresrcl.c
示例16: AcpiRsGetResourceSource
ACPI_RS_LENGTH
AcpiRsGetResourceSource (
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,代码来源:rsutils.c
示例17: acpi_rs_get_resource_source
acpi_rs_length
acpi_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,代码来源:rsutils.c
示例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,代码来源:aslrestype2.c
示例19: AcpiTbSetupFadtRegisters
static void
AcpiTbSetupFadtRegisters (
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,代码来源:tbfadt.c
示例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,代码来源:aslrestype2s.c
注:本文中的ACPI_ADD_PTR函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论