本文整理汇总了C++中ACPI_MOVE_NAME函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_MOVE_NAME函数的具体用法?C++ ACPI_MOVE_NAME怎么用?C++ ACPI_MOVE_NAME使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACPI_MOVE_NAME函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acpi_ns_handle_to_name
acpi_status
acpi_ns_handle_to_name(acpi_handle target_handle, struct acpi_buffer *buffer)
{
acpi_status status;
struct acpi_namespace_node *node;
const char *node_name;
ACPI_FUNCTION_TRACE_PTR(ns_handle_to_name, target_handle);
node = acpi_ns_validate_handle(target_handle);
if (!node) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/* Validate/Allocate/Clear caller buffer */
status = acpi_ut_initialize_buffer(buffer, ACPI_PATH_SEGMENT_LENGTH);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Just copy the ACPI name from the Node and zero terminate it */
node_name = acpi_ut_get_node_name(node);
ACPI_MOVE_NAME(buffer->pointer, node_name);
((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0;
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%4.4s\n", (char *)buffer->pointer));
return_ACPI_STATUS(AE_OK);
}
示例2: osl_table_name_from_file
static acpi_status
osl_table_name_from_file(char *filename, char *signature, u32 *instance)
{
/* Ignore meaningless files */
if (strlen(filename) < ACPI_NAME_SIZE) {
return (AE_BAD_SIGNATURE);
}
/* Extract instance number */
if (isdigit((int)filename[ACPI_NAME_SIZE])) {
sscanf(&filename[ACPI_NAME_SIZE], "%d", instance);
} else if (strlen(filename) != ACPI_NAME_SIZE) {
return (AE_BAD_SIGNATURE);
} else {
*instance = 0;
}
/* Extract signature */
ACPI_MOVE_NAME(signature, filename);
return (AE_OK);
}
示例3: AcpiUtRepairName
void
AcpiUtRepairName (
char *Name)
{
UINT32 i;
BOOLEAN FoundBadChar = FALSE;
UINT32 OriginalName;
ACPI_FUNCTION_NAME (UtRepairName);
/*
* Special case for the root node. This can happen if we get an
* error during the execution of module-level code.
*/
if (ACPI_COMPARE_NAME (Name, "\\___"))
{
return;
}
ACPI_MOVE_NAME (&OriginalName, Name);
/* Check each character in the name */
for (i = 0; i < ACPI_NAME_SIZE; i++)
{
if (AcpiUtValidAcpiChar (Name[i], i))
{
continue;
}
/*
* Replace a bad character with something printable, yet technically
* still invalid. This prevents any collisions with existing "good"
* names in the namespace.
*/
Name[i] = '*';
FoundBadChar = TRUE;
}
if (FoundBadChar)
{
/* Report warning only if in strict mode or debug mode */
if (!AcpiGbl_EnableInterpreterSlack)
{
ACPI_WARNING ((AE_INFO,
"Invalid character(s) in name (0x%.8X), repaired: [%4.4s]",
OriginalName, Name));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Invalid character(s) in name (0x%.8X), repaired: [%4.4s]",
OriginalName, Name));
}
}
}
示例4: osl_add_table_to_list
static acpi_status osl_add_table_to_list(char *signature, u32 instance)
{
struct osl_table_info *new_info;
struct osl_table_info *next;
u32 next_instance = 0;
u8 found = FALSE;
new_info = calloc(1, sizeof(struct osl_table_info));
if (!new_info) {
return (AE_NO_MEMORY);
}
ACPI_MOVE_NAME(new_info->signature, signature);
if (!gbl_table_list_head) {
gbl_table_list_head = new_info;
} else {
next = gbl_table_list_head;
while (1) {
if (ACPI_COMPARE_NAME(next->signature, signature)) {
if (next->instance == instance) {
found = TRUE;
}
if (next->instance >= next_instance) {
next_instance = next->instance + 1;
}
}
if (!next->next) {
break;
}
next = next->next;
}
next->next = new_info;
}
if (found) {
if (instance) {
fprintf(stderr,
"%4.4s: Warning unmatched table instance %d, expected %d\n",
signature, instance, next_instance);
}
instance = next_instance;
}
new_info->instance = instance;
gbl_table_count++;
return (AE_OK);
}
示例5: AcpiOsTableOverride
ACPI_STATUS
AcpiOsTableOverride (
ACPI_TABLE_HEADER *ExistingTable,
ACPI_TABLE_HEADER **NewTable)
{
#ifdef ACPI_ASL_COMPILER
ACPI_STATUS Status;
ACPI_PHYSICAL_ADDRESS Address;
#endif
if (!ExistingTable || !NewTable)
{
return (AE_BAD_PARAMETER);
}
*NewTable = NULL;
#ifdef ACPI_EXEC_APP
/* Call back up to AcpiExec */
AeTableOverride (ExistingTable, NewTable);
#endif
#ifdef ACPI_ASL_COMPILER
/* Attempt to get the table from the registry */
/* Construct a null-terminated string from table signature */
ACPI_MOVE_NAME (TableName, ExistingTable->Signature);
TableName[ACPI_NAME_SIZE] = 0;
Status = AcpiOsGetTableByName (TableName, 0, NewTable, &Address);
if (ACPI_SUCCESS (Status))
{
AcpiOsPrintf ("Table [%s] obtained from registry, %u bytes\n",
TableName, (*NewTable)->Length);
}
else
{
AcpiOsPrintf ("Could not read table %s from registry (%s)\n",
TableName, AcpiFormatException (Status));
}
#endif
return (AE_OK);
}
示例6: acpi_ut_repair_name
void acpi_ut_repair_name(char *name)
{
u32 i;
u8 found_bad_char = FALSE;
u32 original_name;
ACPI_FUNCTION_NAME(ut_repair_name);
/*
* Special case for the root node. This can happen if we get an
* error during the execution of module-level code.
*/
if (ACPI_COMPARE_NAME(name, ACPI_ROOT_PATHNAME)) {
return;
}
ACPI_MOVE_NAME(&original_name, name);
/* Check each character in the name */
for (i = 0; i < ACPI_NAME_SIZE; i++) {
if (acpi_ut_valid_name_char(name[i], i)) {
continue;
}
/*
* Replace a bad character with something printable, yet technically
* still invalid. This prevents any collisions with existing "good"
* names in the namespace.
*/
name[i] = '*';
found_bad_char = TRUE;
}
if (found_bad_char) {
/* Report warning only if in strict mode or debug mode */
if (!acpi_gbl_enable_interpreter_slack) {
ACPI_WARNING((AE_INFO,
"Invalid character(s) in name (0x%.8X), repaired: [%4.4s]",
original_name, name));
} else {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Invalid character(s) in name (0x%.8X), repaired: [%4.4s]",
original_name, name));
}
}
}
示例7: AeInitializeTableHeader
static void
AeInitializeTableHeader (
ACPI_TABLE_HEADER *Header,
char *Signature,
UINT32 Length)
{
ACPI_MOVE_NAME (Header->Signature, Signature);
Header->Length = Length;
Header->OemRevision = 0x1001;
ACPI_STRNCPY (Header->OemId, "Intel", ACPI_OEM_ID_SIZE);
ACPI_STRNCPY (Header->OemTableId, "AcpiExec", ACPI_OEM_TABLE_ID_SIZE);
ACPI_STRNCPY (Header->AslCompilerId, "INTL", ACPI_NAME_SIZE);
Header->AslCompilerRevision = 0x20131218;
}
示例8: UtAttachNameseg
static void
UtAttachNameseg (
ACPI_PARSE_OBJECT *Op,
char *Name)
{
char *NameSeg;
char PaddedNameSeg[4];
if (!Name)
{
return;
}
/* Look for the last dot in the namepath */
NameSeg = strrchr (Name, '.');
if (NameSeg)
{
/* Found last dot, we have also found the final nameseg */
NameSeg++;
UtPadNameWithUnderscores (NameSeg, PaddedNameSeg);
}
else
{
/* No dots in the namepath, there is only a single nameseg. */
/* Handle prefixes */
while (ACPI_IS_ROOT_PREFIX (*Name) ||
ACPI_IS_PARENT_PREFIX (*Name))
{
Name++;
}
/* Remaining string should be one single nameseg */
UtPadNameWithUnderscores (Name, PaddedNameSeg);
}
ACPI_MOVE_NAME (Op->Asl.NameSeg, PaddedNameSeg);
}
示例9: AeInitializeTableHeader
static void
AeInitializeTableHeader (
ACPI_TABLE_HEADER *Header,
char *Signature,
UINT32 Length)
{
ACPI_MOVE_NAME (Header->Signature, Signature);
Header->Length = Length;
Header->OemRevision = 0x1001;
strncpy (Header->OemId, "Intel", ACPI_OEM_ID_SIZE);
strncpy (Header->OemTableId, "AcpiExec", ACPI_OEM_TABLE_ID_SIZE);
strncpy (Header->AslCompilerId, "INTL", ACPI_NAME_SIZE);
Header->AslCompilerRevision = ACPI_CA_VERSION;
/* Set the checksum, must set to zero first */
Header->Checksum = 0;
Header->Checksum = (UINT8) -AcpiTbChecksum (
(void *) Header, Header->Length);
}
示例10: AcpiNsHandleToName
ACPI_STATUS
AcpiNsHandleToName (
ACPI_HANDLE TargetHandle,
ACPI_BUFFER *Buffer)
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
const char *NodeName;
ACPI_FUNCTION_TRACE_PTR (NsHandleToName, TargetHandle);
Node = AcpiNsValidateHandle (TargetHandle);
if (!Node)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (Buffer, ACPI_PATH_SEGMENT_LENGTH);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Just copy the ACPI name from the Node and zero terminate it */
NodeName = AcpiUtGetNodeName (Node);
ACPI_MOVE_NAME (Buffer->Pointer, NodeName);
((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%4.4s\n", (char *) Buffer->Pointer));
return_ACPI_STATUS (AE_OK);
}
示例11: ApWriteToBinaryFile
int
ApWriteToBinaryFile (
ACPI_TABLE_HEADER *Table,
UINT32 Instance)
{
char Filename[ACPI_NAME_SIZE + 16];
char InstanceStr [16];
ACPI_FILE File;
size_t Actual;
UINT32 TableLength;
/* Obtain table length */
TableLength = ApGetTableLength (Table);
/* Construct lower-case filename from the table local signature */
if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
{
ACPI_MOVE_NAME (Filename, ACPI_RSDP_NAME);
}
else
{
ACPI_MOVE_NAME (Filename, Table->Signature);
}
Filename[0] = (char) ACPI_TOLOWER (Filename[0]);
Filename[1] = (char) ACPI_TOLOWER (Filename[1]);
Filename[2] = (char) ACPI_TOLOWER (Filename[2]);
Filename[3] = (char) ACPI_TOLOWER (Filename[3]);
Filename[ACPI_NAME_SIZE] = 0;
/* Handle multiple SSDTs - create different filenames for each */
if (Instance > 0)
{
AcpiUtSnprintf (InstanceStr, sizeof (InstanceStr), "%u", Instance);
ACPI_STRCAT (Filename, InstanceStr);
}
ACPI_STRCAT (Filename, ACPI_TABLE_FILE_SUFFIX);
if (Gbl_VerboseMode)
{
AcpiLogError (
"Writing [%4.4s] to binary file: %s 0x%X (%u) bytes\n",
Table->Signature, Filename, Table->Length, Table->Length);
}
/* Open the file and dump the entire table in binary mode */
File = AcpiOsOpenFile (Filename,
ACPI_FILE_WRITING | ACPI_FILE_BINARY);
if (!File)
{
AcpiLogError ("Could not open output file: %s\n", Filename);
return (-1);
}
Actual = AcpiOsWriteFile (File, Table, 1, TableLength);
if (Actual != TableLength)
{
AcpiLogError ("Error writing binary output file: %s\n", Filename);
AcpiOsCloseFile (File);
return (-1);
}
AcpiOsCloseFile (File);
return (0);
}
示例12: AcpiTbFindTable
ACPI_STATUS
AcpiTbFindTable (
char *Signature,
char *OemId,
char *OemTableId,
UINT32 *TableIndex)
{
UINT32 i;
ACPI_STATUS Status;
ACPI_TABLE_HEADER Header;
ACPI_FUNCTION_TRACE (TbFindTable);
/* Normalize the input strings */
ACPI_MEMSET (&Header, 0, sizeof (ACPI_TABLE_HEADER));
ACPI_MOVE_NAME (Header.Signature, Signature);
ACPI_STRNCPY (Header.OemId, OemId, ACPI_OEM_ID_SIZE);
ACPI_STRNCPY (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE);
/* Search for the table */
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
{
if (ACPI_MEMCMP (&(AcpiGbl_RootTableList.Tables[i].Signature),
Header.Signature, ACPI_NAME_SIZE))
{
/* Not the requested table */
continue;
}
/* Table with matching signature has been found */
if (!AcpiGbl_RootTableList.Tables[i].Pointer)
{
/* Table is not currently mapped, map it */
Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
if (!AcpiGbl_RootTableList.Tables[i].Pointer)
{
continue;
}
}
/* Check for table match on all IDs */
if (!ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->Signature,
Header.Signature, ACPI_NAME_SIZE) &&
(!OemId[0] ||
!ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemId,
Header.OemId, ACPI_OEM_ID_SIZE)) &&
(!OemTableId[0] ||
!ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemTableId,
Header.OemTableId, ACPI_OEM_TABLE_ID_SIZE)))
{
*TableIndex = i;
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n",
Header.Signature));
return_ACPI_STATUS (AE_OK);
}
}
return_ACPI_STATUS (AE_NOT_FOUND);
}
示例13: ap_write_to_binary_file
int ap_write_to_binary_file(struct acpi_table_header *table, u32 instance)
{
char filename[ACPI_NAME_SIZE + 16];
char instance_str[16];
ACPI_FILE file;
size_t actual;
u32 table_length;
/* Obtain table length */
table_length = ap_get_table_length(table);
/* Construct lower-case filename from the table local signature */
if (ACPI_VALIDATE_RSDP_SIG(table->signature)) {
ACPI_MOVE_NAME(filename, ACPI_RSDP_NAME);
} else {
ACPI_MOVE_NAME(filename, table->signature);
}
filename[0] = (char)ACPI_TOLOWER(filename[0]);
filename[1] = (char)ACPI_TOLOWER(filename[1]);
filename[2] = (char)ACPI_TOLOWER(filename[2]);
filename[3] = (char)ACPI_TOLOWER(filename[3]);
filename[ACPI_NAME_SIZE] = 0;
/* Handle multiple SSDts - create different filenames for each */
if (instance > 0) {
acpi_ut_snprintf(instance_str, sizeof(instance_str), "%u",
instance);
ACPI_STRCAT(filename, instance_str);
}
ACPI_STRCAT(filename, ACPI_TABLE_FILE_SUFFIX);
if (gbl_verbose_mode) {
acpi_log_error
("Writing [%4.4s] to binary file: %s 0x%X (%u) bytes\n",
table->signature, filename, table->length, table->length);
}
/* Open the file and dump the entire table in binary mode */
file = acpi_os_open_file(filename,
ACPI_FILE_WRITING | ACPI_FILE_BINARY);
if (!file) {
acpi_log_error("Could not open output file: %s\n", filename);
return (-1);
}
actual = acpi_os_write_file(file, table, 1, table_length);
if (actual != table_length) {
acpi_log_error("Error writing binary output file: %s\n",
filename);
acpi_os_close_file(file);
return (-1);
}
acpi_os_close_file(file);
return (0);
}
示例14: OslAddTablesToList
static ACPI_STATUS
OslAddTablesToList(
void)
{
ACPI_PHYSICAL_ADDRESS TableAddress;
OSL_TABLE_INFO *Info = NULL;
OSL_TABLE_INFO *NewInfo;
ACPI_TABLE_HEADER *Table;
UINT8 Instance;
UINT8 NumberOfTables;
int i;
/* Initialize the table list on first invocation */
if (Gbl_TableListInitialized)
{
return (AE_OK);
}
/* Add mandatory tables to global table list first */
for (i = 0; i < 4; i++)
{
NewInfo = calloc (1, sizeof (*NewInfo));
if (!NewInfo)
{
return (AE_NO_MEMORY);
}
switch (i) {
case 0:
Gbl_TableListHead = Info = NewInfo;
continue;
case 1:
ACPI_MOVE_NAME (NewInfo->Signature,
Gbl_Revision ? ACPI_SIG_XSDT : ACPI_SIG_RSDT);
break;
case 2:
ACPI_MOVE_NAME (NewInfo->Signature, ACPI_SIG_FACS);
break;
default:
ACPI_MOVE_NAME (NewInfo->Signature, ACPI_SIG_DSDT);
}
Info->Next = NewInfo;
Info = NewInfo;
Gbl_TableListHead->Instance++;
}
/* Add normal tables from RSDT/XSDT to global list */
if (Gbl_Revision)
{
NumberOfTables =
(Gbl_Xsdt->Header.Length - sizeof (Gbl_Xsdt->Header))
/ sizeof (Gbl_Xsdt->TableOffsetEntry[0]);
}
else
{
NumberOfTables =
(Gbl_Rsdt->Header.Length - sizeof (Gbl_Rsdt->Header))
/ sizeof (Gbl_Rsdt->TableOffsetEntry[0]);
}
for (i = 0; i < NumberOfTables; i++)
{
if (Gbl_Revision)
{
TableAddress = Gbl_Xsdt->TableOffsetEntry[i];
}
else
{
TableAddress = Gbl_Rsdt->TableOffsetEntry[i];
}
Table = AcpiOsMapMemory (TableAddress, sizeof (*Table));
if (!Table)
{
return (AE_BAD_ADDRESS);
}
Instance = 0;
NewInfo = Gbl_TableListHead;
while (NewInfo->Next != NULL)
{
NewInfo = NewInfo->Next;
if (ACPI_COMPARE_NAME (Table->Signature, NewInfo->Signature))
{
Instance++;
}
}
//.........这里部分代码省略.........
示例15: AeBuildLocalTables
ACPI_STATUS
AeBuildLocalTables (
UINT32 TableCount,
AE_TABLE_DESC *TableList)
{
ACPI_PHYSICAL_ADDRESS DsdtAddress = 0;
UINT32 XsdtSize;
AE_TABLE_DESC *NextTable;
UINT32 NextIndex;
ACPI_TABLE_FADT *ExternalFadt = NULL;
/*
* Update the table count. For DSDT, it is not put into the XSDT. For
* FADT, this is already accounted for since we usually install a
* local FADT.
*/
NextTable = TableList;
while (NextTable)
{
if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT) ||
ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT))
{
TableCount--;
}
NextTable = NextTable->Next;
}
XsdtSize = BASE_XSDT_SIZE + (TableCount * sizeof (UINT64));
/* Build an XSDT */
LocalXSDT = AcpiOsAllocate (XsdtSize);
if (!LocalXSDT)
{
return (AE_NO_MEMORY);
}
ACPI_MEMSET (LocalXSDT, 0, XsdtSize);
ACPI_MOVE_NAME (LocalXSDT->Header.Signature, ACPI_SIG_XSDT);
LocalXSDT->Header.Length = XsdtSize;
LocalXSDT->Header.Revision = 1;
LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalFADT);
/*
* Install the user tables. The DSDT must be installed in the FADT.
* All other tables are installed directly into the XSDT.
*/
NextIndex = BASE_XSDT_TABLES;
NextTable = TableList;
while (NextTable)
{
/*
* Incoming DSDT or FADT are special cases. All other tables are
* just immediately installed into the XSDT.
*/
if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT))
{
if (DsdtAddress)
{
printf ("Already found a DSDT, only one allowed\n");
return (AE_ALREADY_EXISTS);
}
/* The incoming user table is a DSDT */
DsdtAddress = ACPI_PTR_TO_PHYSADDR (NextTable->Table);
}
else if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT))
{
ExternalFadt = ACPI_CAST_PTR (ACPI_TABLE_FADT, NextTable->Table);
LocalXSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (NextTable->Table);
}
else
{
/* Install the table in the XSDT */
LocalXSDT->TableOffsetEntry[NextIndex] = ACPI_PTR_TO_PHYSADDR (NextTable->Table);
NextIndex++;
}
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);
//.........这里部分代码省略.........