这篇教程C++ ACPI_MOVE_NAME函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ACPI_MOVE_NAME函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_MOVE_NAME函数的具体用法?C++ ACPI_MOVE_NAME怎么用?C++ ACPI_MOVE_NAME使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ACPI_MOVE_NAME函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: acpi_ns_handle_to_nameacpi_statusacpi_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);}
开发者ID:01org,项目名称:thunderbolt-software-kernel-tree,代码行数:30,
示例2: osl_table_name_from_filestatic acpi_statusosl_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);}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:25,
示例3: AcpiUtRepairNamevoidAcpiUtRepairName ( 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)); } }}
开发者ID:CSRedRat,项目名称:reactos,代码行数:59,
示例4: osl_add_table_to_liststatic 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);}
开发者ID:020gzh,项目名称:linux,代码行数:50,
示例5: AcpiOsTableOverrideACPI_STATUSAcpiOsTableOverride ( 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);}
开发者ID:liangqi,项目名称:acpica,代码行数:50,
示例6: acpi_ut_repair_namevoid 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)); } }}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:49,
示例7: AeInitializeTableHeaderstatic voidAeInitializeTableHeader ( 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;}
开发者ID:macmade,项目名称:acpica,代码行数:16,
示例8: UtAttachNamesegstatic voidUtAttachNameseg ( 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);}
开发者ID:eaglexmw,项目名称:acpica,代码行数:42,
示例9: AeInitializeTableHeaderstatic voidAeInitializeTableHeader ( 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);}
开发者ID:BarrelfishOS,项目名称:barrelfish,代码行数:22,
示例10: AcpiNsHandleToNameACPI_STATUSAcpiNsHandleToName ( 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);}
开发者ID:Lekensteyn,项目名称:acpica,代码行数:36,
示例11: ApWriteToBinaryFileintApWriteToBinaryFile ( 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);}
开发者ID:Lianguocheng,项目名称:acpica,代码行数:70,
示例12: AcpiTbFindTableACPI_STATUSAcpiTbFindTable ( 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);}
开发者ID:queer1,项目名称:acpica,代码行数:73,
示例13: ap_write_to_binary_fileint 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);}
开发者ID:19Dan01,项目名称:linux,代码行数:61,
示例14: OslAddTablesToListstatic ACPI_STATUSOslAddTablesToList( 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++; } }//.........这里部分代码省略.........
开发者ID:victoredwardocallaghan,项目名称:DragonFlyBSD,代码行数:101,
示例15: AeBuildLocalTablesACPI_STATUSAeBuildLocalTables ( 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);//.........这里部分代码省略.........
开发者ID:zenny,项目名称:DragonFlyBSD,代码行数:101,
示例16: AeBuildLocalTables//.........这里部分代码省略......... ExternalFadt->Header.Checksum = (UINT8) -AcpiTbChecksum ( (void *) ExternalFadt, ExternalFadt->Header.Length); } else if (AcpiGbl_UseHwReducedFadt) { memcpy (&LocalFADT, HwReducedFadtCode, ACPI_FADT_V5_SIZE); LocalFADT.Dsdt = 0; LocalFADT.XDsdt = DsdtAddress; } else { /* * Build a local FADT so we can test the hardware/event init */ LocalFADT.Header.Revision = 5; /* Setup FADT header and DSDT/FACS addresses */ LocalFADT.Dsdt = 0; LocalFADT.Facs = 0; LocalFADT.XDsdt = DsdtAddress; LocalFADT.XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); /* Miscellaneous FADT fields */ LocalFADT.Gpe0BlockLength = 0x08; LocalFADT.Gpe0Block = 0x00001234; LocalFADT.Gpe1BlockLength = 0x80; LocalFADT.Gpe1Block = 0x00005678; LocalFADT.Gpe1Base = 100; LocalFADT.Pm1EventLength = 4; LocalFADT.Pm1aEventBlock = 0x00001aaa; LocalFADT.Pm1bEventBlock = 0x00001bbb; LocalFADT.Pm1ControlLength = 2; LocalFADT.Pm1aControlBlock = 0xB0; LocalFADT.PmTimerLength = 4; LocalFADT.PmTimerBlock = 0xA0; LocalFADT.Pm2ControlBlock = 0xC0; LocalFADT.Pm2ControlLength = 1; /* Setup one example X-64 GAS field */ LocalFADT.XPm1bEventBlock.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO; LocalFADT.XPm1bEventBlock.Address = LocalFADT.Pm1bEventBlock; LocalFADT.XPm1bEventBlock.BitWidth = (UINT8) ACPI_MUL_8 (LocalFADT.Pm1EventLength); } AeInitializeTableHeader ((void *) &LocalFADT, ACPI_SIG_FADT, sizeof (ACPI_TABLE_FADT)); /* Build a FACS */ memset (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS)); ACPI_MOVE_NAME (LocalFACS.Signature, ACPI_SIG_FACS); LocalFACS.Length = sizeof (ACPI_TABLE_FACS); LocalFACS.GlobalLock = 0x11AA0011; /* Build the optional local tables */ if (AcpiGbl_LoadTestTables) { /* * Build a fake table [TEST] so that we make sure that the * ACPICA core ignores it */ memset (&LocalTEST, 0, sizeof (ACPI_TABLE_HEADER)); ACPI_MOVE_NAME (LocalTEST.Signature, "TEST"); LocalTEST.Revision = 1; LocalTEST.Length = sizeof (ACPI_TABLE_HEADER); LocalTEST.Checksum = 0; LocalTEST.Checksum = (UINT8) -AcpiTbChecksum ( (void *) &LocalTEST, LocalTEST.Length); /* * Build a fake table with a bad signature [BAD!] so that we make * sure that the ACPICA core ignores it */ memset (&LocalBADTABLE, 0, sizeof (ACPI_TABLE_HEADER)); ACPI_MOVE_NAME (LocalBADTABLE.Signature, "BAD!"); LocalBADTABLE.Revision = 1; LocalBADTABLE.Length = sizeof (ACPI_TABLE_HEADER); LocalBADTABLE.Checksum = 0; LocalBADTABLE.Checksum = (UINT8) -AcpiTbChecksum ( (void *) &LocalBADTABLE, LocalBADTABLE.Length); } return (AE_OK);}
开发者ID:BarrelfishOS,项目名称:barrelfish,代码行数:101,
示例17: ApWriteToBinaryFileintApWriteToBinaryFile ( ACPI_TABLE_HEADER *Table, UINT32 Instance){ char Filename[ACPI_NAME_SIZE + 16]; char InstanceStr [16]; ACPI_FILE File; ACPI_SIZE 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) tolower ((int) Filename[0]); Filename[1] = (char) tolower ((int) Filename[1]); Filename[2] = (char) tolower ((int) Filename[2]); Filename[3] = (char) tolower ((int) Filename[3]); Filename[ACPI_NAME_SIZE] = 0; /* Handle multiple SSDTs - create different filenames for each */ if (Instance > 0) { snprintf (InstanceStr, sizeof (InstanceStr), "%u", Instance); strcat (Filename, InstanceStr); } strcat (Filename, FILE_SUFFIX_BINARY_TABLE); if (Gbl_VerboseMode) { fprintf (stderr, "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 = fopen (Filename, "wb"); if (!File) { fprintf (stderr, "Could not open output file: %s/n", Filename); return (-1); } Actual = fwrite (Table, 1, TableLength, File); if (Actual != TableLength) { fprintf (stderr, "Error writing binary output file: %s/n", Filename); fclose (File); return (-1); } fclose (File); return (0);}
开发者ID:ryo,项目名称:netbsd-src,代码行数:70,
示例18: AxExtractTablesintAxExtractTables ( char *InputPathname, char *Signature, unsigned int MinimumInstances){ FILE *InputFile; FILE *OutputFile = NULL; unsigned int BytesConverted; unsigned int ThisTableBytesWritten = 0; unsigned int FoundTable = 0; unsigned int Instances = 0; unsigned int ThisInstance; char ThisSignature[5]; char UpperSignature[5]; int Status = 0; unsigned int State = AX_STATE_FIND_HEADER; /* Open input in text mode, output is in binary mode */ InputFile = fopen (InputPathname, "rt"); if (!InputFile) { printf ("Could not open input file %s/n", InputPathname); return (-1); } if (!AxIsFileAscii (InputFile)) { fclose (InputFile); return (-1); } if (Signature) { strncpy (UpperSignature, Signature, 4); UpperSignature[4] = 0; AcpiUtStrupr (UpperSignature); /* Are there enough instances of the table to continue? */ AxNormalizeSignature (UpperSignature); Instances = AxCountTableInstances (InputPathname, UpperSignature); if (Instances < MinimumInstances) { printf ("Table [%s] was not found in %s/n", UpperSignature, InputPathname); fclose (InputFile); return (-1); } if (Instances == 0) { fclose (InputFile); return (-1); } } /* Convert all instances of the table to binary */ while (fgets (Gbl_LineBuffer, AX_LINE_BUFFER_SIZE, InputFile)) { switch (State) { case AX_STATE_FIND_HEADER: if (!AxIsDataBlockHeader ()) { continue; } ACPI_MOVE_NAME (ThisSignature, Gbl_LineBuffer); if (Signature) { /* Ignore signatures that don't match */ if (!ACPI_COMPARE_NAME (ThisSignature, UpperSignature)) { continue; } } /* * Get the instance number for this signature. Only the * SSDT and PSDT tables can have multiple instances. */ ThisInstance = AxGetNextInstance (InputPathname, ThisSignature); /* Build an output filename and create/open the output file */ if (ThisInstance > 0) { /* Add instance number to the output filename */ sprintf (Gbl_OutputFilename, "%4.4s%u.dat", ThisSignature, ThisInstance); } else//.........这里部分代码省略.........
开发者ID:Raphine,项目名称:Raph_Kernel,代码行数:101,
示例19: AxExtractToMultiAmlFileintAxExtractToMultiAmlFile ( char *InputPathname){ FILE *InputFile; FILE *OutputFile; int Status = 0; unsigned int TotalBytesWritten = 0; unsigned int ThisTableBytesWritten = 0; unsigned int BytesConverted; char ThisSignature[4]; unsigned int State = AX_STATE_FIND_HEADER; strcpy (Gbl_OutputFilename, AX_MULTI_TABLE_FILENAME); /* Open the input file in text mode */ InputFile = fopen (InputPathname, "rt"); if (!InputFile) { printf ("Could not open input file %s/n", InputPathname); return (-1); } if (!AxIsFileAscii (InputFile)) { fclose (InputFile); return (-1); } /* Open the output file in binary mode */ OutputFile = fopen (Gbl_OutputFilename, "w+b"); if (!OutputFile) { printf ("Could not open output file %s/n", Gbl_OutputFilename); fclose (InputFile); return (-1); } /* Convert the DSDT and all SSDTs to binary */ while (fgets (Gbl_LineBuffer, AX_LINE_BUFFER_SIZE, InputFile)) { switch (State) { case AX_STATE_FIND_HEADER: if (!AxIsDataBlockHeader ()) { continue; } ACPI_MOVE_NAME (ThisSignature, Gbl_LineBuffer); /* Only want DSDT and SSDTs */ if (!ACPI_COMPARE_NAME (ThisSignature, ACPI_SIG_DSDT) && !ACPI_COMPARE_NAME (ThisSignature, ACPI_SIG_SSDT)) { continue; } /* * Toss this block header of the form "<sig> @ <addr>" line * and move on to the actual data block */ Gbl_TableCount++; ThisTableBytesWritten = 0; State = AX_STATE_EXTRACT_DATA; continue; case AX_STATE_EXTRACT_DATA: /* Empty line or non-data line terminates the data block */ BytesConverted = AxProcessOneTextLine ( OutputFile, ThisSignature, ThisTableBytesWritten); switch (BytesConverted) { case 0: State = AX_STATE_FIND_HEADER; /* No more data block lines */ continue; case -1: goto CleanupAndExit; /* There was a write error */ default: /* Normal case, get next line */ ThisTableBytesWritten += BytesConverted; TotalBytesWritten += BytesConverted; continue; } default: Status = -1;//.........这里部分代码省略.........
开发者ID:Raphine,项目名称:Raph_Kernel,代码行数:101,
示例20: AcpiNsExternalizeName//.........这里部分代码省略......... */ if (PrefixLength < InternalNameLength) { switch (InternalName[PrefixLength]) { case AML_MULTI_NAME_PREFIX: /* <count> 4-byte names */ NamesIndex = PrefixLength + 2; NumSegments = (UINT8) InternalName[(ACPI_SIZE) PrefixLength + 1]; break; case AML_DUAL_NAME_PREFIX: /* Two 4-byte names */ NamesIndex = PrefixLength + 1; NumSegments = 2; break; case 0: /* NullName */ NamesIndex = 0; NumSegments = 0; break; default: /* one 4-byte name */ NamesIndex = PrefixLength; NumSegments = 1; break; } } /* * Calculate the length of ConvertedName, which equals the length * of the prefix, length of all object names, length of any required * punctuation ('.') between object names, plus the NULL terminator. */ RequiredLength = PrefixLength + (4 * NumSegments) + ((NumSegments > 0) ? (NumSegments - 1) : 0) + 1; /* * Check to see if we're still in bounds. If not, there's a problem * with InternalName (invalid format). */ if (RequiredLength > InternalNameLength) { ACPI_ERROR ((AE_INFO, "Invalid internal name")); return_ACPI_STATUS (AE_BAD_PATHNAME); } /* Build the ConvertedName */ *ConvertedName = ACPI_ALLOCATE_ZEROED (RequiredLength); if (!(*ConvertedName)) { return_ACPI_STATUS (AE_NO_MEMORY); } j = 0; for (i = 0; i < PrefixLength; i++) { (*ConvertedName)[j++] = InternalName[i]; } if (NumSegments > 0) { for (i = 0; i < NumSegments; i++) { if (i > 0) { (*ConvertedName)[j++] = '.'; } /* Copy and validate the 4-char name segment */ ACPI_MOVE_NAME (&(*ConvertedName)[j], &InternalName[NamesIndex]); AcpiUtRepairName (&(*ConvertedName)[j]); j += ACPI_NAME_SIZE; NamesIndex += ACPI_NAME_SIZE; } } if (ConvertedNameLength) { *ConvertedNameLength = (UINT32) RequiredLength; } return_ACPI_STATUS (AE_OK);}
开发者ID:ariscop,项目名称:reactos,代码行数:101,
示例21: acpi_tb_find_table/******************************************************************************* * * FUNCTION: acpi_tb_find_table * * PARAMETERS: signature - String with ACPI table signature * oem_id - String with the table OEM ID * oem_table_id - String with the OEM Table ID * table_index - Where the table index is returned * * RETURN: Status and table index * * DESCRIPTION: Find an ACPI table (in the RSDT/XSDT) that matches the * Signature, OEM ID and OEM Table ID. Returns an index that can * be used to get the table header or entire table. * ******************************************************************************/acpi_statusacpi_tb_find_table(char *signature, char *oem_id, char *oem_table_id, u32 *table_index){ u32 i; acpi_status status; struct acpi_table_header header; ACPI_FUNCTION_TRACE(tb_find_table); /* Normalize the input strings */ ACPI_MEMSET(&header, 0, sizeof(struct acpi_table_header)); ACPI_MOVE_NAME(header.signature, signature); ACPI_STRNCPY(header.oem_id, oem_id, ACPI_OEM_ID_SIZE); ACPI_STRNCPY(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE); /* Search for the table */ for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) { if (ACPI_MEMCMP(&(acpi_gbl_root_table_list.tables[i].signature), header.signature, ACPI_NAME_SIZE)) { /* Not the requested table */ continue; } /* Table with matching signature has been found */ if (!acpi_gbl_root_table_list.tables[i].pointer) { /* Table is not currently mapped, map it */ status = acpi_tb_validate_table(&acpi_gbl_root_table_list. tables[i]); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } if (!acpi_gbl_root_table_list.tables[i].pointer) { continue; } } /* Check for table match on all IDs */ if (!ACPI_MEMCMP (acpi_gbl_root_table_list.tables[i].pointer->signature, header.signature, ACPI_NAME_SIZE) && (!oem_id[0] || !ACPI_MEMCMP (acpi_gbl_root_table_list. tables[i].pointer-> oem_id, header.oem_id, ACPI_OEM_ID_SIZE)) && (!oem_table_id[0] || !ACPI_MEMCMP(acpi_gbl_root_table_list.tables[i]. pointer->oem_table_id, header.oem_table_id, ACPI_OEM_TABLE_ID_SIZE))) { *table_index = 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);}
开发者ID:0x000000FF,项目名称:edison-linux,代码行数:90,
示例22: acpi_get_name/****************************************************************************** * * FUNCTION: acpi_get_name * * PARAMETERS: handle - Handle to be converted to a pathname * name_type - Full pathname or single segment * buffer - Buffer for returned path * * RETURN: Pointer to a string containing the fully qualified Name. * * DESCRIPTION: This routine returns the fully qualified name associated with * the Handle parameter. This and the acpi_pathname_to_handle are * complementary functions. * ******************************************************************************/acpi_statusacpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer){ acpi_status status; struct acpi_namespace_node *node; char *node_name; /* Parameter validation */ if (name_type > ACPI_NAME_TYPE_MAX) { return (AE_BAD_PARAMETER); } status = acpi_ut_validate_buffer(buffer); if (ACPI_FAILURE(status)) { return (status); } if (name_type == ACPI_FULL_PATHNAME || name_type == ACPI_FULL_PATHNAME_NO_TRAILING) { /* Get the full pathname (From the namespace root) */ status = acpi_ns_handle_to_pathname(handle, buffer, name_type == ACPI_FULL_PATHNAME ? FALSE : TRUE); return (status); } /* * Wants the single segment ACPI name. * Validate handle and convert to a namespace Node */ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { return (status); } node = acpi_ns_validate_handle(handle); if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } /* Validate/Allocate/Clear caller buffer */ status = acpi_ut_initialize_buffer(buffer, ACPI_PATH_SEGMENT_LENGTH); if (ACPI_FAILURE(status)) { goto unlock_and_exit; } /* 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; status = AE_OK;unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status);}
开发者ID:Ersel16,项目名称:linux,代码行数:79,
示例23: AnBuildLocalTables//.........这里部分代码省略......... LocalRSDP.Checksum = (UINT8) -AcpiTbChecksum ( (void *) &LocalRSDP, ACPI_RSDP_CHECKSUM_LENGTH); if (!DsdtAddress) { return (AE_SUPPORT); } /* * Build an FADT. There are two options for the FADT: * 1) Incoming external FADT specified on the command line * 2) A fully featured local FADT */ memset (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); if (ExternalFadt) { /* * Use the external FADT, but we must update the DSDT/FACS * addresses as well as the checksum */ ExternalFadt->Dsdt = (UINT32) DsdtAddress; ExternalFadt->Facs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); /* * If there room in the FADT for the XDsdt and XFacs 64-bit * pointers, use them. */ if (ExternalFadt->Header.Length > ACPI_PTR_DIFF ( &ExternalFadt->XDsdt, ExternalFadt)) { ExternalFadt->Dsdt = 0; ExternalFadt->Facs = 0; ExternalFadt->XDsdt = DsdtAddress; ExternalFadt->XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); } /* Complete the external FADT with the checksum */ ExternalFadt->Header.Checksum = 0; ExternalFadt->Header.Checksum = (UINT8) -AcpiTbChecksum ( (void *) ExternalFadt, ExternalFadt->Header.Length); } else { /* * Build a local FADT so we can test the hardware/event init */ LocalFADT.Header.Revision = 5; /* Setup FADT header and DSDT/FACS addresses */ LocalFADT.Dsdt = 0; LocalFADT.Facs = 0; LocalFADT.XDsdt = DsdtAddress; LocalFADT.XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); /* Miscellaneous FADT fields */ LocalFADT.Gpe0BlockLength = 16; LocalFADT.Gpe0Block = 0x00001234; LocalFADT.Gpe1BlockLength = 6; LocalFADT.Gpe1Block = 0x00005678; LocalFADT.Gpe1Base = 96; LocalFADT.Pm1EventLength = 4; LocalFADT.Pm1aEventBlock = 0x00001aaa; LocalFADT.Pm1bEventBlock = 0x00001bbb; LocalFADT.Pm1ControlLength = 2; LocalFADT.Pm1aControlBlock = 0xB0; LocalFADT.PmTimerLength = 4; LocalFADT.PmTimerBlock = 0xA0; LocalFADT.Pm2ControlBlock = 0xC0; LocalFADT.Pm2ControlLength = 1; /* Setup one example X-64 field */ LocalFADT.XPm1bEventBlock.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO; LocalFADT.XPm1bEventBlock.Address = LocalFADT.Pm1bEventBlock; LocalFADT.XPm1bEventBlock.BitWidth = (UINT8) ACPI_MUL_8 (LocalFADT.Pm1EventLength); } AnInitializeTableHeader ((void *) &LocalFADT, ACPI_SIG_FADT, sizeof (ACPI_TABLE_FADT)); /* Build a FACS */ memset (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS)); ACPI_MOVE_NAME (LocalFACS.Signature, ACPI_SIG_FACS); LocalFACS.Length = sizeof (ACPI_TABLE_FACS); LocalFACS.GlobalLock = 0x11AA0011; return (AE_OK);}
开发者ID:SchmErik,项目名称:acpica,代码行数:101,
示例24: acpi_ns_externalize_name//.........这里部分代码省略......... break; default: break; } /* * Check for object names. Note that there could be 0-255 of these * 4-byte elements. */ if (prefix_length < internal_name_length) { switch (internal_name[prefix_length]) { case AML_MULTI_NAME_PREFIX_OP: /* <count> 4-byte names */ names_index = prefix_length + 2; num_segments = (u8) internal_name[(acpi_size) prefix_length + 1]; break; case AML_DUAL_NAME_PREFIX: /* Two 4-byte names */ names_index = prefix_length + 1; num_segments = 2; break; case 0: /* null_name */ names_index = 0; num_segments = 0; break; default: /* one 4-byte name */ names_index = prefix_length; num_segments = 1; break; } } /* * Calculate the length of converted_name, which equals the length * of the prefix, length of all object names, length of any required * punctuation ('.') between object names, plus the NULL terminator. */ required_length = prefix_length + (4 * num_segments) + ((num_segments > 0) ? (num_segments - 1) : 0) + 1; /* * Check to see if we're still in bounds. If not, there's a problem * with internal_name (invalid format). */ if (required_length > internal_name_length) { ACPI_ERROR((AE_INFO, "Invalid internal name")); return_ACPI_STATUS(AE_BAD_PATHNAME); } /* Build the converted_name */ *converted_name = ACPI_ALLOCATE_ZEROED(required_length); if (!(*converted_name)) { return_ACPI_STATUS(AE_NO_MEMORY); } j = 0; for (i = 0; i < prefix_length; i++) { (*converted_name)[j++] = internal_name[i]; } if (num_segments > 0) { for (i = 0; i < num_segments; i++) { if (i > 0) { (*converted_name)[j++] = '.'; } /* Copy and validate the 4-char name segment */ ACPI_MOVE_NAME(&(*converted_name)[j], &internal_name[names_index]); acpi_ut_repair_name(&(*converted_name)[j]); j += ACPI_NAME_SIZE; names_index += ACPI_NAME_SIZE; } } if (converted_name_length) { *converted_name_length = (u32) required_length; } return_ACPI_STATUS(AE_OK);}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:101,
示例25: AxExtractTablesintAxExtractTables ( char *InputPathname, char *Signature, unsigned int MinimumInstances){ FILE *InputFile; FILE *OutputFile = NULL; size_t BytesWritten; size_t TotalBytesWritten = 0; size_t BytesConverted; unsigned int State = AX_STATE_FIND_HEADER; unsigned int FoundTable = 0; unsigned int Instances = 0; unsigned int ThisInstance; char ThisSignature[4]; int Status = 0; /* Open input in text mode, output is in binary mode */ InputFile = fopen (InputPathname, "rt"); if (!InputFile) { printf ("Could not open file %s/n", InputPathname); return (-1); } if (Signature) { /* Are there enough instances of the table to continue? */ AxNormalizeSignature (Signature); Instances = AxCountTableInstances (InputPathname, Signature); if (Instances < MinimumInstances) { printf ("Table %s was not found in %s/n", Signature, InputPathname); Status = -1; goto CleanupAndExit; } if (Instances == 0) { goto CleanupAndExit; } } /* Convert all instances of the table to binary */ while (fgets (LineBuffer, AX_LINE_BUFFER_SIZE, InputFile)) { switch (State) { case AX_STATE_FIND_HEADER: /* Ignore lines that are too short to be header lines */ if (strlen (LineBuffer) < AX_MIN_TABLE_NAME_LENGTH) { continue; } /* Ignore empty lines and lines that start with a space */ if (AxIsEmptyLine (LineBuffer) || (LineBuffer[0] == ' ')) { continue; } /* * Ignore lines that are not of the form <sig> @ <addr>. * Examples of lines that must be supported: * * DSDT @ 0x737e4000 * XSDT @ 0x737f2fff * RSD PTR @ 0xf6cd0 * SSDT @ (nil) */ if (!strstr (LineBuffer, " @ ")) { continue; } AxNormalizeSignature (LineBuffer); ACPI_MOVE_NAME (ThisSignature, LineBuffer); if (Signature) { /* Ignore signatures that don't match */ if (!ACPI_COMPARE_NAME (ThisSignature, Signature)) { continue; } } /* * Get the instance number for this signature. Only the//.........这里部分代码省略.........
开发者ID:alexandermerritt,项目名称:dragonfly,代码行数:101,
示例26: AcpiTbFindTableACPI_STATUSAcpiTbFindTable ( char *Signature, char *OemId, char *OemTableId, UINT32 *TableIndex){ ACPI_STATUS Status; ACPI_TABLE_HEADER Header; UINT32 i; ACPI_FUNCTION_TRACE (TbFindTable); /* Validate the input table signature */ if (!AcpiIsValidSignature (Signature)) { return_ACPI_STATUS (AE_BAD_SIGNATURE); } /* Don't allow the OEM strings to be too long */ if ((strlen (OemId) > ACPI_OEM_ID_SIZE) || (strlen (OemTableId) > ACPI_OEM_TABLE_ID_SIZE)) { return_ACPI_STATUS (AE_AML_STRING_LIMIT); } /* Normalize the input strings */ memset (&Header, 0, sizeof (ACPI_TABLE_HEADER)); ACPI_MOVE_NAME (Header.Signature, Signature); strncpy (Header.OemId, OemId, ACPI_OEM_ID_SIZE); strncpy (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE); /* Search for the table */ for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) { if (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 = AcpiTbValidateTable (&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 (!memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->Signature, Header.Signature, ACPI_NAME_SIZE) && (!OemId[0] || !memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->OemId, Header.OemId, ACPI_OEM_ID_SIZE)) && (!OemTableId[0] || !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);}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:88,
示例27: acpi_tb_find_table/******************************************************************************* * * FUNCTION: acpi_tb_find_table * * PARAMETERS: signature - String with ACPI table signature * oem_id - String with the table OEM ID * oem_table_id - String with the OEM Table ID * table_index - Where the table index is returned * * RETURN: Status and table index * * DESCRIPTION: Find an ACPI table (in the RSDT/XSDT) that matches the * Signature, OEM ID and OEM Table ID. Returns an index that can * be used to get the table header or entire table. * ******************************************************************************/acpi_statusacpi_tb_find_table(char *signature, char *oem_id, char *oem_table_id, u32 *table_index){ acpi_status status; struct acpi_table_header header; u32 i; ACPI_FUNCTION_TRACE(tb_find_table); /* Validate the input table signature */ if (!acpi_is_valid_signature(signature)) { return_ACPI_STATUS(AE_BAD_SIGNATURE); } /* Don't allow the OEM strings to be too long */ if ((strlen(oem_id) > ACPI_OEM_ID_SIZE) || (strlen(oem_table_id) > ACPI_OEM_TABLE_ID_SIZE)) { return_ACPI_STATUS(AE_AML_STRING_LIMIT); } /* Normalize the input strings */ memset(&header, 0, sizeof(struct acpi_table_header)); ACPI_MOVE_NAME(header.signature, signature); strncpy(header.oem_id, oem_id, ACPI_OEM_ID_SIZE); strncpy(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE); /* Search for the table */ for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) { if (memcmp(&(acpi_gbl_root_table_list.tables[i].signature), header.signature, ACPI_NAME_SIZE)) { /* Not the requested table */ continue; } /* Table with matching signature has been found */ if (!acpi_gbl_root_table_list.tables[i].pointer) { /* Table is not currently mapped, map it */ status = acpi_tb_validate_table(&acpi_gbl_root_table_list. tables[i]); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } if (!acpi_gbl_root_table_list.tables[i].pointer) { continue; } } /* Check for table match on all IDs */ if (!memcmp (acpi_gbl_root_table_list.tables[i].pointer->signature, header.signature, ACPI_NAME_SIZE) && (!oem_id[0] || !memcmp (acpi_gbl_root_table_list. tables[i].pointer-> oem_id, header.oem_id, ACPI_OEM_ID_SIZE)) && (!oem_table_id[0] || !memcmp(acpi_gbl_root_table_list.tables[i].pointer-> oem_table_id, header.oem_table_id, ACPI_OEM_TABLE_ID_SIZE))) { *table_index = i; ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "Found table [%4.4s]/n", header.signature)); return_ACPI_STATUS(AE_OK); } }//.........这里部分代码省略.........
开发者ID:020gzh,项目名称:linux,代码行数:101,
注:本文中的ACPI_MOVE_NAME函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ACPI_PTR函数代码示例 C++ ACPI_MOVE_64_TO_64函数代码示例 |