本文整理汇总了C++中ACPI_ADD_PTR函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_ADD_PTR函数的具体用法?C++ ACPI_ADD_PTR怎么用?C++ ACPI_ADD_PTR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACPI_ADD_PTR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)));
}
}
}
示例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);
}
}
示例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));
}
示例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);
}
}
示例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));
}
}
示例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;
}
}
示例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);
}
示例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);
}
示例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");
}
}
示例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));
}
}
示例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));
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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 (", ");
}