这篇教程C++ ACPI_ALLOCATE函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ACPI_ALLOCATE函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_ALLOCATE函数的具体用法?C++ ACPI_ALLOCATE怎么用?C++ ACPI_ALLOCATE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ACPI_ALLOCATE函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: acpi_ut_add_address_range/******************************************************************************* * * FUNCTION: acpi_ut_add_address_range * * PARAMETERS: space_id - Address space ID * address - op_region start address * length - op_region length * region_node - op_region namespace node * * RETURN: Status * * DESCRIPTION: Add the Operation Region address range to the global list. * The only supported Space IDs are Memory and I/O. Called when * the op_region address/length operands are fully evaluated. * * MUTEX: Locks the namespace * * NOTE: Because this interface is only called when an op_region argument * list is evaluated, there cannot be any duplicate region_nodes. * Duplicate Address/Length values are allowed, however, so that multiple * address conflicts can be detected. * ******************************************************************************/acpi_statusacpi_ut_add_address_range(acpi_adr_space_type space_id, acpi_physical_address address, u32 length, struct acpi_namespace_node *region_node){ struct acpi_address_range *range_info; acpi_status status; ACPI_FUNCTION_TRACE(ut_add_address_range); if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) && (space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { return_ACPI_STATUS(AE_OK); } /* Allocate/init a new info block, add it to the appropriate list */ range_info = ACPI_ALLOCATE(sizeof(struct acpi_address_range)); if (!range_info) { return_ACPI_STATUS(AE_NO_MEMORY); } range_info->start_address = address; range_info->end_address = (address + length - 1); range_info->region_node = region_node; status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { ACPI_FREE(range_info); return_ACPI_STATUS(status); } range_info->next = acpi_gbl_address_range_list[space_id]; acpi_gbl_address_range_list[space_id] = range_info; ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "/nAdded [%4.4s] address range: 0x%p-0x%p/n", acpi_ut_get_node_name(range_info->region_node), ACPI_CAST_PTR(void, address), ACPI_CAST_PTR(void, range_info->end_address))); (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return_ACPI_STATUS(AE_OK);}
开发者ID:03199618,项目名称:linux,代码行数:67,
示例2: acpi_hw_build_pci_liststatic acpi_statusacpi_hw_build_pci_list(acpi_handle root_pci_device, acpi_handle pci_region, struct acpi_pci_device **return_list_head){ acpi_handle current_device; acpi_handle parent_device; acpi_status status; struct acpi_pci_device *list_element; struct acpi_pci_device *list_head = NULL; /* * Ascend namespace branch until the root_pci_device is reached, building * a list of device nodes. Loop will exit when either the PCI device is * found, or the root of the namespace is reached. */ current_device = pci_region; while (1) { status = acpi_get_parent(current_device, &parent_device); if (ACPI_FAILURE(status)) { return (status); } /* Finished when we reach the PCI root device (PNP0A03 or PNP0A08) */ if (parent_device == root_pci_device) { *return_list_head = list_head; return (AE_OK); } list_element = ACPI_ALLOCATE(sizeof(struct acpi_pci_device)); if (!list_element) { return (AE_NO_MEMORY); } /* Put new element at the head of the list */ list_element->next = list_head; list_element->device = parent_device; list_head = list_element; current_device = parent_device; }}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:44,
示例3: AcpiUtAddAddressRangeACPI_STATUSAcpiUtAddAddressRange ( ACPI_ADR_SPACE_TYPE SpaceId, ACPI_PHYSICAL_ADDRESS Address, UINT32 Length, ACPI_NAMESPACE_NODE *RegionNode){ ACPI_ADDRESS_RANGE *RangeInfo; ACPI_FUNCTION_TRACE (UtAddAddressRange); if ((SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) && (SpaceId != ACPI_ADR_SPACE_SYSTEM_IO)) { return_ACPI_STATUS (AE_OK); } /* Allocate/init a new info block, add it to the appropriate list */ RangeInfo = ACPI_ALLOCATE (sizeof (ACPI_ADDRESS_RANGE)); if (!RangeInfo) { return_ACPI_STATUS (AE_NO_MEMORY); } RangeInfo->StartAddress = Address; RangeInfo->EndAddress = (Address + Length - 1); RangeInfo->RegionNode = RegionNode; RangeInfo->Next = AcpiGbl_AddressRangeList[SpaceId]; AcpiGbl_AddressRangeList[SpaceId] = RangeInfo; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "/nAdded [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X/n", AcpiUtGetNodeName (RangeInfo->RegionNode), ACPI_FORMAT_UINT64 (Address), ACPI_FORMAT_UINT64 (RangeInfo->EndAddress))); return_ACPI_STATUS (AE_OK);}
开发者ID:ryo,项目名称:netbsd-src,代码行数:42,
示例4: AcpiDmAddToExternalFileListACPI_STATUSAcpiDmAddToExternalFileList ( char *Pathname){ ACPI_EXTERNAL_FILE *ExternalFile; char *LocalPathname; if (!Pathname) { return (AE_OK); } LocalPathname = ACPI_ALLOCATE (strlen (Pathname) + 1); if (!LocalPathname) { return (AE_NO_MEMORY); } ExternalFile = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_FILE)); if (!ExternalFile) { ACPI_FREE (LocalPathname); return (AE_NO_MEMORY); } /* Take a copy of the file pathname */ strcpy (LocalPathname, Pathname); ExternalFile->Path = LocalPathname; if (AcpiGbl_ExternalFileList) { ExternalFile->Next = AcpiGbl_ExternalFileList; } AcpiGbl_ExternalFileList = ExternalFile; return (AE_OK);}
开发者ID:luo3555,项目名称:Intel-iasl,代码行数:39,
示例5: acpi_ut_add_address_range/******************************************************************************* * * FUNCTION: acpi_ut_add_address_range * * PARAMETERS: space_id - Address space ID * address - op_region start address * length - op_region length * region_node - op_region namespace node * * RETURN: Status * * DESCRIPTION: Add the Operation Region address range to the global list. * The only supported Space IDs are Memory and I/O. Called when * the op_region address/length operands are fully evaluated. * * MUTEX: Locks the namespace * * NOTE: Because this interface is only called when an op_region argument * list is evaluated, there cannot be any duplicate region_nodes. * Duplicate Address/Length values are allowed, however, so that multiple * address conflicts can be detected. * ******************************************************************************/acpi_statusacpi_ut_add_address_range(acpi_adr_space_type space_id, acpi_physical_address address, u32 length, struct acpi_namespace_node *region_node){ struct acpi_address_range *range_info; ACPI_FUNCTION_TRACE(ut_add_address_range); if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) && (space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { return_ACPI_STATUS(AE_OK); } /* Allocate/init a new info block, add it to the appropriate list */ range_info = ACPI_ALLOCATE(sizeof(struct acpi_address_range)); if (!range_info) { return_ACPI_STATUS(AE_NO_MEMORY); } range_info->start_address = address; range_info->end_address = (address + length - 1); range_info->region_node = region_node; range_info->next = acpi_gbl_address_range_list[space_id]; acpi_gbl_address_range_list[space_id] = range_info; ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "/nAdded [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X/n", acpi_ut_get_node_name(range_info->region_node), ACPI_FORMAT_UINT64(address), ACPI_FORMAT_UINT64(range_info->end_address))); return_ACPI_STATUS(AE_OK);}
开发者ID:Anjali05,项目名称:linux,代码行数:59,
示例6: FlMergePathnameschar *FlMergePathnames ( char *PrefixDir, char *FilePathname){ char *CommonPath; char *Pathname; char *LastElement; DbgPrint (ASL_PARSE_OUTPUT, "Include: Prefix path - /"%s/"/n" "Include: FilePathname - /"%s/"/n", PrefixDir, FilePathname); /* * If there is no prefix directory or if the file pathname is absolute, * just return the original file pathname */ if (!PrefixDir || (!*PrefixDir) || (*FilePathname == '/') || (FilePathname[1] == ':')) { Pathname = ACPI_ALLOCATE (strlen (FilePathname) + 1); strcpy (Pathname, FilePathname); goto ConvertBackslashes; } /* Need a local copy of the prefix directory path */ CommonPath = ACPI_ALLOCATE (strlen (PrefixDir) + 1); strcpy (CommonPath, PrefixDir); /* * Walk forward through the file path, and simultaneously backward * through the prefix directory path until there are no more * relative references at the start of the file path. */ while (*FilePathname && (!strncmp (FilePathname, "../", 3))) { /* Remove last element of the prefix directory path */ LastElement = strrchr (CommonPath, '/'); if (!LastElement) { goto ConcatenatePaths; } *LastElement = 0; /* Terminate CommonPath string */ FilePathname += 3; /* Point to next path element */ } /* * Remove the last element of the prefix directory path (it is the same as * the first element of the file pathname), and build the final merged * pathname. */ LastElement = strrchr (CommonPath, '/'); if (LastElement) { *LastElement = 0; } /* Build the final merged pathname */ConcatenatePaths: Pathname = ACPI_ALLOCATE_ZEROED (strlen (CommonPath) + strlen (FilePathname) + 2); if (LastElement && *CommonPath) { strcpy (Pathname, CommonPath); strcat (Pathname, "/"); } strcat (Pathname, FilePathname); ACPI_FREE (CommonPath); /* Convert all backslashes to normal slashes */ConvertBackslashes: UtConvertBackslashes (Pathname); DbgPrint (ASL_PARSE_OUTPUT, "Include: Merged Pathname - /"%s/"/n", Pathname); return (Pathname);}
开发者ID:cloudius-systems,项目名称:acpica,代码行数:83,
示例7: AcpiDbExecutevoidAcpiDbExecute ( char *Name, char **Args, UINT32 Flags){ ACPI_STATUS Status; ACPI_BUFFER ReturnObj; char *NameString;#ifdef ACPI_DEBUG_OUTPUT UINT32 PreviousAllocations; UINT32 Allocations; /* Memory allocation tracking */ PreviousAllocations = AcpiDbGetOutstandingAllocations ();#endif if (*Name == '*') { (void) AcpiWalkNamespace (ACPI_TYPE_METHOD, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL, NULL); return; } else { NameString = ACPI_ALLOCATE (ACPI_STRLEN (Name) + 1); if (!NameString) { return; } ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); ACPI_STRCPY (NameString, Name); AcpiUtStrupr (NameString); AcpiGbl_DbMethodInfo.Name = NameString; AcpiGbl_DbMethodInfo.Args = Args; AcpiGbl_DbMethodInfo.Flags = Flags; ReturnObj.Pointer = NULL; ReturnObj.Length = ACPI_ALLOCATE_BUFFER; AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, &ReturnObj); ACPI_FREE (NameString); } /* * Allow any handlers in separate threads to complete. * (Such as Notify handlers invoked from AML executed above). */ AcpiOsSleep ((UINT64) 10);#ifdef ACPI_DEBUG_OUTPUT /* Memory allocation tracking */ Allocations = AcpiDbGetOutstandingAllocations () - PreviousAllocations; AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); if (Allocations > 0) { AcpiOsPrintf ("Outstanding: 0x%X allocations after execution/n", Allocations); }#endif if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Execution of %s failed with status %s/n", AcpiGbl_DbMethodInfo.Pathname, AcpiFormatException (Status)); } else { /* Display a return object, if any */ if (ReturnObj.Length) { AcpiOsPrintf ("Execution of %s returned object %p Buflen %X/n", AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length); AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); } else { AcpiOsPrintf ("No return object from execution of %s/n", AcpiGbl_DbMethodInfo.Pathname); } } AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);}
开发者ID:luciang,项目名称:haiku,代码行数:98,
示例8: ACPI_FUNCTION_TRACEstatic char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs){ char *temp_ptr; char *name_string; u32 size_needed; ACPI_FUNCTION_TRACE(ex_allocate_name_string); /* * Allow room for all / and ^ prefixes, all segments and a multi_name_prefix. * Also, one byte for the null terminator. * This may actually be somewhat longer than needed. */ if (prefix_count == ACPI_UINT32_MAX) { /* Special case for root */ size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; } else { size_needed = prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; } /* * Allocate a buffer for the name. * This buffer must be deleted by the caller! */ name_string = ACPI_ALLOCATE(size_needed); if (!name_string) { ACPI_ERROR((AE_INFO, "Could not allocate size %u", size_needed)); return_PTR(NULL); } temp_ptr = name_string; /* Set up Root or Parent prefixes if needed */ if (prefix_count == ACPI_UINT32_MAX) { *temp_ptr++ = AML_ROOT_PREFIX; } else { while (prefix_count--) { *temp_ptr++ = AML_PARENT_PREFIX; } } /* Set up Dual or Multi prefixes if needed */ if (num_name_segs > 2) { /* Set up multi prefixes */ *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; *temp_ptr++ = (char)num_name_segs; } else if (2 == num_name_segs) { /* Set up dual prefixes */ *temp_ptr++ = AML_DUAL_NAME_PREFIX; } /* * Terminate string following prefixes. acpi_ex_name_segment() will * append the segment(s) */ *temp_ptr = 0; return_PTR(name_string);}
开发者ID:0-T-0,项目名称:ps4-linux,代码行数:69,
示例9: acpi_ut_initialize_bufferacpi_statusacpi_ut_initialize_buffer(struct acpi_buffer *buffer, acpi_size required_length){ acpi_size input_buffer_length; /* Parameter validation */ if (!buffer || !required_length) { return (AE_BAD_PARAMETER); } /* * Buffer->Length is used as both an input and output parameter. Get the * input actual length and set the output required buffer length. */ input_buffer_length = buffer->length; buffer->length = required_length; /* * The input buffer length contains the actual buffer length, or the type * of buffer to be allocated by this routine. */ switch (input_buffer_length) { case ACPI_NO_BUFFER: /* Return the exception (and the required buffer length) */ return (AE_BUFFER_OVERFLOW); case ACPI_ALLOCATE_BUFFER: /* * Allocate a new buffer. We directectly call acpi_os_allocate here to * purposefully bypass the (optionally enabled) internal allocation * tracking mechanism since we only want to track internal * allocations. Note: The caller should use acpi_os_free to free this * buffer created via ACPI_ALLOCATE_BUFFER. */ buffer->pointer = acpi_os_allocate(required_length); break; case ACPI_ALLOCATE_LOCAL_BUFFER: /* Allocate a new buffer with local interface to allow tracking */ buffer->pointer = ACPI_ALLOCATE(required_length); break; default: /* Existing buffer: Validate the size of the buffer */ if (input_buffer_length < required_length) { return (AE_BUFFER_OVERFLOW); } break; } /* Validate allocation from above or input buffer pointer */ if (!buffer->pointer) { return (AE_NO_MEMORY); } /* Have a valid buffer, clear it */ memset(buffer->pointer, 0, required_length); return (AE_OK);}
开发者ID:Anjali05,项目名称:linux,代码行数:68,
示例10: ACPI_FUNCTION_TRACEstatic char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs){ char *temp_ptr; char *name_string; u32 size_needed; ACPI_FUNCTION_TRACE(ex_allocate_name_string); /* */ if (prefix_count == ACPI_UINT32_MAX) { /* */ size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; } else { size_needed = prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; } /* */ name_string = ACPI_ALLOCATE(size_needed); if (!name_string) { ACPI_ERROR((AE_INFO, "Could not allocate size %u", size_needed)); return_PTR(NULL); } temp_ptr = name_string; /* */ if (prefix_count == ACPI_UINT32_MAX) { *temp_ptr++ = AML_ROOT_PREFIX; } else { while (prefix_count--) { *temp_ptr++ = AML_PARENT_PREFIX; } } /* */ if (num_name_segs > 2) { /* */ *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; *temp_ptr++ = (char)num_name_segs; } else if (2 == num_name_segs) { /* */ *temp_ptr++ = AML_DUAL_NAME_PREFIX; } /* */ *temp_ptr = 0; return_PTR(name_string);}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:69,
示例11: acpi_ex_load_opacpi_statusacpi_ex_load_op(union acpi_operand_object *obj_desc, union acpi_operand_object *target, struct acpi_walk_state *walk_state){ union acpi_operand_object *ddb_handle; struct acpi_table_desc table_desc; u32 table_index; acpi_status status; u32 length; ACPI_FUNCTION_TRACE(ex_load_op); ACPI_MEMSET(&table_desc, 0, sizeof(struct acpi_table_desc)); /* Source Object can be either an op_region or a Buffer/Field */ switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_REGION: ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s/n", obj_desc, acpi_ut_get_object_type_name(obj_desc))); /* Region must be system_memory (from ACPI spec) */ if (obj_desc->region.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) { return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* * If the Region Address and Length have not been previously evaluated, * evaluate them now and save the results. */ if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { status = acpi_ds_get_region_arguments(obj_desc); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } } /* * We will simply map the memory region for the table. However, the * memory region is technically not guaranteed to remain stable and * we may eventually have to copy the table to a local buffer. */ table_desc.address = obj_desc->region.address; table_desc.length = obj_desc->region.length; table_desc.flags = ACPI_TABLE_ORIGIN_MAPPED; break; case ACPI_TYPE_BUFFER: /* Buffer or resolved region_field */ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Buffer or Field %p %s/n", obj_desc, acpi_ut_get_object_type_name(obj_desc))); length = obj_desc->buffer.length; /* Must have at least an ACPI table header */ if (length < sizeof(struct acpi_table_header)) { return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); } /* Validate checksum here. It won't get validated in tb_add_table */ status = acpi_tb_verify_checksum(ACPI_CAST_PTR (struct acpi_table_header, obj_desc->buffer.pointer), length); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* * We need to copy the buffer since the original buffer could be * changed or deleted in the future */ table_desc.pointer = ACPI_ALLOCATE(length); if (!table_desc.pointer) { return_ACPI_STATUS(AE_NO_MEMORY); } ACPI_MEMCPY(table_desc.pointer, obj_desc->buffer.pointer, length); table_desc.length = length; table_desc.flags = ACPI_TABLE_ORIGIN_ALLOCATED; break; default: return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* * Install the new table into the local data structures */ status = acpi_tb_add_table(&table_desc, &table_index); if (ACPI_FAILURE(status)) { goto cleanup;//.........这里部分代码省略.........
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:101,
示例12: acpi_ut_copy_simple_objectstatic acpi_statusacpi_ut_copy_simple_object(union acpi_operand_object *source_desc, union acpi_operand_object *dest_desc){ u16 reference_count; union acpi_operand_object *next_object; /* Save fields from destination that we don't want to overwrite */ reference_count = dest_desc->common.reference_count; next_object = dest_desc->common.next_object; /* Copy the entire source object over the destination object */ ACPI_MEMCPY((char *)dest_desc, (char *)source_desc, sizeof(union acpi_operand_object)); /* Restore the saved fields */ dest_desc->common.reference_count = reference_count; dest_desc->common.next_object = next_object; /* New object is not static, regardless of source */ dest_desc->common.flags &= ~AOPOBJ_STATIC_POINTER; /* Handle the objects with extra data */ switch (ACPI_GET_OBJECT_TYPE(dest_desc)) { case ACPI_TYPE_BUFFER: /* * Allocate and copy the actual buffer if and only if: * 1) There is a valid buffer pointer * 2) The buffer has a length > 0 */ if ((source_desc->buffer.pointer) && (source_desc->buffer.length)) { dest_desc->buffer.pointer = ACPI_ALLOCATE(source_desc->buffer.length); if (!dest_desc->buffer.pointer) { return (AE_NO_MEMORY); } /* Copy the actual buffer data */ ACPI_MEMCPY(dest_desc->buffer.pointer, source_desc->buffer.pointer, source_desc->buffer.length); } break; case ACPI_TYPE_STRING: /* * Allocate and copy the actual string if and only if: * 1) There is a valid string pointer * (Pointer to a NULL string is allowed) */ if (source_desc->string.pointer) { dest_desc->string.pointer = ACPI_ALLOCATE((acpi_size) source_desc->string. length + 1); if (!dest_desc->string.pointer) { return (AE_NO_MEMORY); } /* Copy the actual string data */ ACPI_MEMCPY(dest_desc->string.pointer, source_desc->string.pointer, (acpi_size) source_desc->string.length + 1); } break; case ACPI_TYPE_LOCAL_REFERENCE: /* * We copied the reference object, so we now must add a reference * to the object pointed to by the reference */ acpi_ut_add_reference(source_desc->reference.object); break; default: /* Nothing to do for other simple objects */ break; } return (AE_OK);}
开发者ID:laitianli,项目名称:kernel-analyze_linux-2.6.18,代码行数:88,
示例13: AcpiInstallSciHandlerACPI_STATUSAcpiInstallSciHandler ( ACPI_SCI_HANDLER Address, void *Context){ ACPI_SCI_HANDLER_INFO *NewSciHandler; ACPI_SCI_HANDLER_INFO *SciHandler; ACPI_CPU_FLAGS Flags; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (AcpiInstallSciHandler); if (!Address) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Allocate and init a handler object */ NewSciHandler = ACPI_ALLOCATE (sizeof (ACPI_SCI_HANDLER_INFO)); if (!NewSciHandler) { return_ACPI_STATUS (AE_NO_MEMORY); } NewSciHandler->Address = Address; NewSciHandler->Context = Context; Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (Status)) { goto Exit; } /* Lock list during installation */ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); SciHandler = AcpiGbl_SciHandlerList; /* Ensure handler does not already exist */ while (SciHandler) { if (Address == SciHandler->Address) { Status = AE_ALREADY_EXISTS; goto UnlockAndExit; } SciHandler = SciHandler->Next; } /* Install the new handler into the global list (at head) */ NewSciHandler->Next = AcpiGbl_SciHandlerList; AcpiGbl_SciHandlerList = NewSciHandler;UnlockAndExit: AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);Exit: if (ACPI_FAILURE (Status)) { ACPI_FREE (NewSciHandler); } return_ACPI_STATUS (Status);}
开发者ID:ikitayama,项目名称:acpica-tools,代码行数:72,
示例14: acpi_ut_initialize_bufferacpi_statusacpi_ut_initialize_buffer(struct acpi_buffer * buffer, acpi_size required_length){ acpi_size input_buffer_length; /* Parameter validation */ if (!buffer || !required_length) { return (AE_BAD_PARAMETER); } /* * Buffer->Length is used as both an input and output parameter. Get the * input actual length and set the output required buffer length. */ input_buffer_length = buffer->length; buffer->length = required_length; /* * The input buffer length contains the actual buffer length, or the type * of buffer to be allocated by this routine. */ switch (input_buffer_length) { case ACPI_NO_BUFFER: /* Return the exception (and the required buffer length) */ return (AE_BUFFER_OVERFLOW); case ACPI_ALLOCATE_BUFFER: /* Allocate a new buffer */ buffer->pointer = acpi_os_allocate(required_length); break; case ACPI_ALLOCATE_LOCAL_BUFFER: /* Allocate a new buffer with local interface to allow tracking */ buffer->pointer = ACPI_ALLOCATE(required_length); break; default: /* Existing buffer: Validate the size of the buffer */ if (input_buffer_length < required_length) { return (AE_BUFFER_OVERFLOW); } break; } /* Validate allocation from above or input buffer pointer */ if (!buffer->pointer) { return (AE_NO_MEMORY); } /* Have a valid buffer, clear it */ ACPI_MEMSET(buffer->pointer, 0, required_length); return (AE_OK);}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:65,
示例15: acpi_ex_opcode_3A_0T_0R/******************************************************************************* * * FUNCTION: acpi_ex_opcode_3A_0T_0R * * PARAMETERS: walk_state - Current walk state * * RETURN: Status * * DESCRIPTION: Execute Triadic operator (3 operands) * ******************************************************************************/acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state){ union acpi_operand_object **operand = &walk_state->operands[0]; struct acpi_signal_fatal_info *fatal; acpi_status status = AE_OK; ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_0T_0R, acpi_ps_get_opcode_name(walk_state->opcode)); switch (walk_state->opcode) { case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "FatalOp: Type %X Code %X Arg %X " "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n", (u32)operand[0]->integer.value, (u32)operand[1]->integer.value, (u32)operand[2]->integer.value)); fatal = ACPI_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); if (fatal) { fatal->type = (u32) operand[0]->integer.value; fatal->code = (u32) operand[1]->integer.value; fatal->argument = (u32) operand[2]->integer.value; } /* Always signal the OS! */ status = acpi_os_signal(ACPI_SIGNAL_FATAL, fatal); /* Might return while OS is shutting down, just continue */ ACPI_FREE(fatal); goto cleanup; case AML_EXTERNAL_OP: /* * If the interpreter sees this opcode, just ignore it. The External * op is intended for use by disassemblers in order to properly * disassemble control method invocations. The opcode or group of * opcodes should be surrounded by an "if (0)" clause to ensure that * AML interpreters never see the opcode. Thus, something is * wrong if an external opcode ever gets here. */ ACPI_ERROR((AE_INFO, "Executed External Op")); status = AE_OK; goto cleanup; default: ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; }cleanup: return_ACPI_STATUS(status);}
开发者ID:020gzh,项目名称:linux,代码行数:72,
示例16: acpi_extract_package//.........这里部分代码省略......... sizeof(char); tail_offset += sizeof(char *); break; case 'B': size_required += sizeof(u8 *) + (element->buffer.length * sizeof(u8)); tail_offset += sizeof(u8 *); break; default: printk(KERN_WARNING PREFIX "Invalid package element" " [%d] got string/buffer," " expecting [%c]/n", i, format_string[i]); return AE_BAD_DATA; break; } break; case ACPI_TYPE_PACKAGE: default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found unsupported element at index=%d/n", i)); /* TBD: handle nested packages... */ return AE_SUPPORT; break; } } /* * Validate output buffer. */ if (buffer->length == ACPI_ALLOCATE_BUFFER) { buffer->pointer = ACPI_ALLOCATE(size_required); if (!buffer->pointer) return AE_NO_MEMORY; buffer->length = size_required; memset(buffer->pointer, 0, size_required); } else { if (buffer->length < size_required) { buffer->length = size_required; return AE_BUFFER_OVERFLOW; } else if (buffer->length != size_required || !buffer->pointer) { return AE_BAD_PARAMETER; } } head = buffer->pointer; tail = buffer->pointer + tail_offset; /* * Extract package data. */ for (i = 0; i < format_count; i++) { u8 **pointer = NULL; union acpi_object *element = &(package->package.elements[i]); if (!element) { return AE_BAD_DATA; } switch (element->type) {
开发者ID:AnadoluPanteri,项目名称:kernel-plus-harmattan,代码行数:66,
示例17: acpi_ex_store_buffer_to_buffer/******************************************************************************* * * FUNCTION: acpi_ex_store_buffer_to_buffer * * PARAMETERS: source_desc - Source object to copy * target_desc - Destination object of the copy * * RETURN: Status * * DESCRIPTION: Copy a buffer object to another buffer object. * ******************************************************************************/acpi_statusacpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, union acpi_operand_object *target_desc){ u32 length; u8 *buffer; ACPI_FUNCTION_TRACE_PTR(ex_store_buffer_to_buffer, source_desc); /* If Source and Target are the same, just return */ if (source_desc == target_desc) { return_ACPI_STATUS(AE_OK); } /* We know that source_desc is a buffer by now */ buffer = ACPI_CAST_PTR(u8, source_desc->buffer.pointer); length = source_desc->buffer.length; /* * If target is a buffer of length zero or is a static buffer, * allocate a new buffer of the proper length */ if ((target_desc->buffer.length == 0) || (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) { target_desc->buffer.pointer = ACPI_ALLOCATE(length); if (!target_desc->buffer.pointer) { return_ACPI_STATUS(AE_NO_MEMORY); } target_desc->buffer.length = length; } /* Copy source buffer to target buffer */ if (length <= target_desc->buffer.length) { /* Clear existing buffer and copy in the new one */ ACPI_MEMSET(target_desc->buffer.pointer, 0, target_desc->buffer.length); ACPI_MEMCPY(target_desc->buffer.pointer, buffer, length);#ifdef ACPI_OBSOLETE_BEHAVIOR /* * NOTE: ACPI versions up to 3.0 specified that the buffer must be * truncated if the string is smaller than the buffer. However, "other" * implementations of ACPI never did this and thus became the defacto * standard. ACPI 3.0A changes this behavior such that the buffer * is no longer truncated. */ /* * OBSOLETE BEHAVIOR: * If the original source was a string, we must truncate the buffer, * according to the ACPI spec. Integer-to-Buffer and Buffer-to-Buffer * copy must not truncate the original buffer. */ if (original_src_type == ACPI_TYPE_STRING) { /* Set the new length of the target */ target_desc->buffer.length = length; }#endif } else { /* Truncate the source, copy only what will fit */ ACPI_MEMCPY(target_desc->buffer.pointer, buffer, target_desc->buffer.length); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Truncating source buffer from %X to %X/n", length, target_desc->buffer.length)); } /* Copy flags */ target_desc->buffer.flags = source_desc->buffer.flags; target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER; return_ACPI_STATUS(AE_OK);}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:95,
示例18: AcpiUtInitializeBufferACPI_STATUSAcpiUtInitializeBuffer ( ACPI_BUFFER *Buffer, ACPI_SIZE RequiredLength){ ACPI_SIZE InputBufferLength; /* Parameter validation */ if (!Buffer || !RequiredLength) { return (AE_BAD_PARAMETER); } /* * Buffer->Length is used as both an input and output parameter. Get the * input actual length and set the output required buffer length. */ InputBufferLength = Buffer->Length; Buffer->Length = RequiredLength; /* * The input buffer length contains the actual buffer length, or the type * of buffer to be allocated by this routine. */ switch (InputBufferLength) { case ACPI_NO_BUFFER: /* Return the exception (and the required buffer length) */ return (AE_BUFFER_OVERFLOW); case ACPI_ALLOCATE_BUFFER: /* * Allocate a new buffer. We directectly call AcpiOsAllocate here to * purposefully bypass the (optionally enabled) internal allocation * tracking mechanism since we only want to track internal * allocations. Note: The caller should use AcpiOsFree to free this * buffer created via ACPI_ALLOCATE_BUFFER. */ Buffer->Pointer = AcpiOsAllocate (RequiredLength); break; case ACPI_ALLOCATE_LOCAL_BUFFER: /* Allocate a new buffer with local interface to allow tracking */ Buffer->Pointer = ACPI_ALLOCATE (RequiredLength); break; default: /* Existing buffer: Validate the size of the buffer */ if (InputBufferLength < RequiredLength) { return (AE_BUFFER_OVERFLOW); } break; } /* Validate allocation from above or input buffer pointer */ if (!Buffer->Pointer) { return (AE_NO_MEMORY); } /* Have a valid buffer, clear it */ ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength); return (AE_OK);}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:75,
示例19: AcpiExOpcode_3A_0T_0RACPI_STATUSAcpiExOpcode_3A_0T_0R ( ACPI_WALK_STATE *WalkState){ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; ACPI_SIGNAL_FATAL_INFO *Fatal; ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE_STR (ExOpcode_3A_0T_0R, AcpiPsGetOpcodeName (WalkState->Opcode)); switch (WalkState->Opcode) { case AML_FATAL_OP: /* Fatal (FatalType FatalCode FatalArg) */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "FatalOp: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n", (UINT32) Operand[0]->Integer.Value, (UINT32) Operand[1]->Integer.Value, (UINT32) Operand[2]->Integer.Value)); Fatal = ACPI_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO)); if (Fatal) { Fatal->Type = (UINT32) Operand[0]->Integer.Value; Fatal->Code = (UINT32) Operand[1]->Integer.Value; Fatal->Argument = (UINT32) Operand[2]->Integer.Value; } /* Always signal the OS! */ Status = AcpiOsSignal (ACPI_SIGNAL_FATAL, Fatal); /* Might return while OS is shutting down, just continue */ ACPI_FREE (Fatal); goto Cleanup; case AML_EXTERNAL_OP: /* * If the interpreter sees this opcode, just ignore it. The External * op is intended for use by disassemblers in order to properly * disassemble control method invocations. The opcode or group of * opcodes should be surrounded by an "if (0)" clause to ensure that * AML interpreters never see the opcode. */ Status = AE_OK; goto Cleanup; default: ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; }Cleanup: return_ACPI_STATUS (Status);}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:64,
示例20: AcpiDbTracevoidAcpiDbTrace ( char *EnableArg, char *MethodArg, char *OnceArg){ UINT32 DebugLevel = 0; UINT32 DebugLayer = 0; UINT32 Flags = 0; if (EnableArg) { AcpiUtStrupr (EnableArg); } if (OnceArg) { AcpiUtStrupr (OnceArg); } if (MethodArg) { if (AcpiDbTraceMethodName) { ACPI_FREE (AcpiDbTraceMethodName); AcpiDbTraceMethodName = NULL; } AcpiDbTraceMethodName = ACPI_ALLOCATE (strlen (MethodArg) + 1); if (!AcpiDbTraceMethodName) { AcpiOsPrintf ("Failed to allocate method name (%s)/n", MethodArg); return; } strcpy (AcpiDbTraceMethodName, MethodArg); } if (!strcmp (EnableArg, "ENABLE") || !strcmp (EnableArg, "METHOD") || !strcmp (EnableArg, "OPCODE")) { if (!strcmp (EnableArg, "ENABLE")) { /* Inherit current console settings */ DebugLevel = AcpiGbl_DbConsoleDebugLevel; DebugLayer = AcpiDbgLayer; } else { /* Restrict console output to trace points only */ DebugLevel = ACPI_LV_TRACE_POINT; DebugLayer = ACPI_EXECUTER; } Flags = ACPI_TRACE_ENABLED; if (!strcmp (EnableArg, "OPCODE")) { Flags |= ACPI_TRACE_OPCODE; } if (OnceArg && !strcmp (OnceArg, "ONCE")) { Flags |= ACPI_TRACE_ONESHOT; } } (void) AcpiDebugTrace (AcpiDbTraceMethodName, DebugLevel, DebugLayer, Flags);}
开发者ID:iHaD,项目名称:DragonFlyBSD,代码行数:75,
示例21: AcpiUtInitializeBufferACPI_STATUSAcpiUtInitializeBuffer ( ACPI_BUFFER *Buffer, ACPI_SIZE RequiredLength){ ACPI_SIZE InputBufferLength; /* Parameter validation */ if (!Buffer || !RequiredLength) { return (AE_BAD_PARAMETER); } /* * Buffer->Length is used as both an input and output parameter. Get the * input actual length and set the output required buffer length. */ InputBufferLength = Buffer->Length; Buffer->Length = RequiredLength; /* * The input buffer length contains the actual buffer length, or the type * of buffer to be allocated by this routine. */ switch (InputBufferLength) { case ACPI_NO_BUFFER: /* Return the exception (and the required buffer length) */ return (AE_BUFFER_OVERFLOW); case ACPI_ALLOCATE_BUFFER: /* Allocate a new buffer */ Buffer->Pointer = AcpiOsAllocate (RequiredLength); break; case ACPI_ALLOCATE_LOCAL_BUFFER: /* Allocate a new buffer with local interface to allow tracking */ Buffer->Pointer = ACPI_ALLOCATE (RequiredLength); break; default: /* Existing buffer: Validate the size of the buffer */ if (InputBufferLength < RequiredLength) { return (AE_BUFFER_OVERFLOW); } break; } /* Validate allocation from above or input buffer pointer */ if (!Buffer->Pointer) { return (AE_NO_MEMORY); } /* Have a valid buffer, clear it */ ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength); return (AE_OK);}
开发者ID:michas2,项目名称:l4re-snapshot,代码行数:71,
示例22: OpnDoDefinitionBlockstatic voidOpnDoDefinitionBlock ( ACPI_PARSE_OBJECT *Op){ ACPI_PARSE_OBJECT *Child; ACPI_SIZE Length; UINT32 i; char *Filename; /* * These nodes get stuffed into the table header. They are special * cased when the table is written to the output file. * * Mark all of these nodes as non-usable so they won't get output * as AML opcodes! */ /* Get AML filename. Use it if non-null */ Child = Op->Asl.Child; if (Child->Asl.Value.Buffer && *Child->Asl.Value.Buffer && (Gbl_UseDefaultAmlFilename)) { /* * We will use the AML filename that is embedded in the source file * for the output filename. */ Filename = ACPI_ALLOCATE (strlen (Gbl_DirectoryPath) + strlen ((char *) Child->Asl.Value.Buffer) + 1); /* Prepend the current directory path */ strcpy (Filename, Gbl_DirectoryPath); strcat (Filename, (char *) Child->Asl.Value.Buffer); Gbl_OutputFilenamePrefix = Filename; } Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; /* Signature */ Child = Child->Asl.Next; Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; if (Child->Asl.Value.String) { Gbl_TableSignature = Child->Asl.Value.String; if (ACPI_STRLEN (Gbl_TableSignature) != 4) { AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, "Length not exactly 4"); } for (i = 0; i < 4; i++) { if (!isalnum ((int) Gbl_TableSignature[i])) { AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, "Contains non-alphanumeric characters"); } } } /* Revision */ Child = Child->Asl.Next; Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; /* * We used the revision to set the integer width earlier */ /* OEMID */ Child = Child->Asl.Next; Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; /* OEM TableID */ Child = Child->Asl.Next; Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; if (Child->Asl.Value.String) { Length = ACPI_STRLEN (Child->Asl.Value.String); Gbl_TableId = AcpiOsAllocate (Length + 1); ACPI_STRCPY (Gbl_TableId, Child->Asl.Value.String); for (i = 0; i < Length; i++) { if (Gbl_TableId[i] == ' ') { Gbl_TableId[i] = 0; break; } } } /* OEM Revision */ Child = Child->Asl.Next;//.........这里部分代码省略.........
开发者ID:ppaeps,项目名称:freebsd-head,代码行数:101,
示例23: AcpiExLoadOpACPI_STATUSAcpiExLoadOp ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT *Target, ACPI_WALK_STATE *WalkState){ ACPI_OPERAND_OBJECT *DdbHandle; ACPI_TABLE_HEADER *Table; ACPI_TABLE_DESC TableDesc; UINT32 TableIndex; ACPI_STATUS Status; UINT32 Length; ACPI_FUNCTION_TRACE (ExLoadOp); ACPI_MEMSET (&TableDesc, 0, sizeof (ACPI_TABLE_DESC)); /* Source Object can be either an OpRegion or a Buffer/Field */ switch (ObjDesc->Common.Type) { case ACPI_TYPE_REGION: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load table from Region %p/n", ObjDesc)); /* Region must be SystemMemory (from ACPI spec) */ if (ObjDesc->Region.SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) { return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } /* * If the Region Address and Length have not been previously evaluated, * evaluate them now and save the results. */ if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) { Status = AcpiDsGetRegionArguments (ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } /* Get the table header first so we can get the table length */ Table = ACPI_ALLOCATE (sizeof (ACPI_TABLE_HEADER)); if (!Table) { return_ACPI_STATUS (AE_NO_MEMORY); } Status = AcpiExRegionRead (ObjDesc, sizeof (ACPI_TABLE_HEADER), ACPI_CAST_PTR (UINT8, Table)); Length = Table->Length; ACPI_FREE (Table); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Must have at least an ACPI table header */ if (Length < sizeof (ACPI_TABLE_HEADER)) { return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); } /* * The original implementation simply mapped the table, with no copy. * However, the memory region is not guaranteed to remain stable and * we must copy the table to a local buffer. For example, the memory * region is corrupted after suspend on some machines. Dynamically * loaded tables are usually small, so this overhead is minimal. * * The latest implementation (5/2009) does not use a mapping at all. * We use the low-level operation region interface to read the table * instead of the obvious optimization of using a direct mapping. * This maintains a consistent use of operation regions across the * entire subsystem. This is important if additional processing must * be performed in the (possibly user-installed) operation region * handler. For example, AcpiExec and ASLTS depend on this. */ /* Allocate a buffer for the table */ TableDesc.Pointer = ACPI_ALLOCATE (Length); if (!TableDesc.Pointer) { return_ACPI_STATUS (AE_NO_MEMORY); } /* Read the entire table */ Status = AcpiExRegionRead (ObjDesc, Length,//.........这里部分代码省略.........
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:101,
示例24: AcpiExStoreBufferToBufferACPI_STATUSAcpiExStoreBufferToBuffer ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc){ UINT32 Length; UINT8 *Buffer; ACPI_FUNCTION_TRACE_PTR (ExStoreBufferToBuffer, SourceDesc); /* If Source and Target are the same, just return */ if (SourceDesc == TargetDesc) { return_ACPI_STATUS (AE_OK); } /* We know that SourceDesc is a buffer by now */ Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->Buffer.Pointer); Length = SourceDesc->Buffer.Length; /* * If target is a buffer of length zero or is a static buffer, * allocate a new buffer of the proper length */ if ((TargetDesc->Buffer.Length == 0) || (TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER)) { TargetDesc->Buffer.Pointer = ACPI_ALLOCATE (Length); if (!TargetDesc->Buffer.Pointer) { return_ACPI_STATUS (AE_NO_MEMORY); } TargetDesc->Buffer.Length = Length; } /* Copy source buffer to target buffer */ if (Length <= TargetDesc->Buffer.Length) { /* Clear existing buffer and copy in the new one */ ACPI_MEMSET (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length); ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, Length);#ifdef ACPI_OBSOLETE_BEHAVIOR /* * NOTE: ACPI versions up to 3.0 specified that the buffer must be * truncated if the string is smaller than the buffer. However, "other" * implementations of ACPI never did this and thus became the defacto * standard. ACPI 3.0A changes this behavior such that the buffer * is no longer truncated. */ /* * OBSOLETE BEHAVIOR: * If the original source was a string, we must truncate the buffer, * according to the ACPI spec. Integer-to-Buffer and Buffer-to-Buffer * copy must not truncate the original buffer. */ if (OriginalSrcType == ACPI_TYPE_STRING) { /* Set the new length of the target */ TargetDesc->Buffer.Length = Length; }#endif } else { /* Truncate the source, copy only what will fit */ ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Truncating source buffer from %X to %X/n", Length, TargetDesc->Buffer.Length)); } /* Copy flags */ TargetDesc->Buffer.Flags = SourceDesc->Buffer.Flags; TargetDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER; return_ACPI_STATUS (AE_OK);}
开发者ID:ksashtekar,项目名称:Ganoid,代码行数:90,
示例25: acpi_ex_load_opacpi_statusacpi_ex_load_op(union acpi_operand_object *obj_desc, union acpi_operand_object *target, struct acpi_walk_state *walk_state){ acpi_status status; union acpi_operand_object *ddb_handle; union acpi_operand_object *buffer_desc = NULL; struct acpi_table_header *table_ptr = NULL; acpi_physical_address address; struct acpi_table_header table_header; acpi_integer temp; u32 i; ACPI_FUNCTION_TRACE(ex_load_op); /* Object can be either an op_region or a Field */ switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_REGION: ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s/n", obj_desc, acpi_ut_get_object_type_name(obj_desc))); /* * If the Region Address and Length have not been previously evaluated, * evaluate them now and save the results. */ if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { status = acpi_ds_get_region_arguments(obj_desc); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } } /* Get the base physical address of the region */ address = obj_desc->region.address; /* Get part of the table header to get the table length */ table_header.length = 0; for (i = 0; i < 8; i++) { status = acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, (acpi_physical_address) (i + address), 8, &temp); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* Get the one valid byte of the returned 64-bit value */ ACPI_CAST_PTR(u8, &table_header)[i] = (u8) temp; } /* Sanity check the table length */ if (table_header.length < sizeof(struct acpi_table_header)) { return_ACPI_STATUS(AE_BAD_HEADER); } /* Allocate a buffer for the entire table */ table_ptr = ACPI_ALLOCATE(table_header.length); if (!table_ptr) { return_ACPI_STATUS(AE_NO_MEMORY); } /* Get the entire table from the op region */ for (i = 0; i < table_header.length; i++) { status = acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, (acpi_physical_address) (i + address), 8, &temp); if (ACPI_FAILURE(status)) { goto cleanup; } /* Get the one valid byte of the returned 64-bit value */ ACPI_CAST_PTR(u8, table_ptr)[i] = (u8) temp; } break; case ACPI_TYPE_LOCAL_REGION_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD: ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Field %p %s/n", obj_desc, acpi_ut_get_object_type_name(obj_desc))); /* * The length of the field must be at least as large as the table. * Read the entire field and thus the entire table. Buffer is//.........这里部分代码省略.........
开发者ID:xf739645524,项目名称:kernel-rhel5,代码行数:101,
示例26: AcpiDbExecutevoidAcpiDbExecute ( char *Name, char **Args, ACPI_OBJECT_TYPE *Types, UINT32 Flags){ ACPI_STATUS Status; ACPI_BUFFER ReturnObj; char *NameString;#ifdef ACPI_DEBUG_OUTPUT UINT32 PreviousAllocations; UINT32 Allocations; /* Memory allocation tracking */ PreviousAllocations = AcpiDbGetOutstandingAllocations ();#endif if (*Name == '*') { (void) AcpiWalkNamespace (ACPI_TYPE_METHOD, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL, NULL); return; } else { NameString = ACPI_ALLOCATE (ACPI_STRLEN (Name) + 1); if (!NameString) { return; } ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); ACPI_STRCPY (NameString, Name); AcpiUtStrupr (NameString); AcpiGbl_DbMethodInfo.Name = NameString; AcpiGbl_DbMethodInfo.Args = Args; AcpiGbl_DbMethodInfo.Types = Types; AcpiGbl_DbMethodInfo.Flags = Flags; ReturnObj.Pointer = NULL; ReturnObj.Length = ACPI_ALLOCATE_BUFFER; Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); if (ACPI_FAILURE (Status)) { ACPI_FREE (NameString); return; } /* Get the NS node, determines existence also */ Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname, &AcpiGbl_DbMethodInfo.Method); if (ACPI_SUCCESS (Status)) { Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, &ReturnObj); } ACPI_FREE (NameString); } /* * Allow any handlers in separate threads to complete. * (Such as Notify handlers invoked from AML executed above). */ AcpiOsSleep ((UINT64) 10);#ifdef ACPI_DEBUG_OUTPUT /* Memory allocation tracking */ Allocations = AcpiDbGetOutstandingAllocations () - PreviousAllocations; AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); if (Allocations > 0) { AcpiOsPrintf ("0x%X Outstanding allocations after evaluation of %s/n", Allocations, AcpiGbl_DbMethodInfo.Pathname); }#endif if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Evaluation of %s failed with status %s/n", AcpiGbl_DbMethodInfo.Pathname, AcpiFormatException (Status)); } else { /* Display a return object, if any */ if (ReturnObj.Length) { AcpiOsPrintf ( "Evaluation of %s returned object %p, external buffer length %X/n",//.........这里部分代码省略.........
开发者ID:Lxg1582,项目名称:freebsd,代码行数:101,
注:本文中的ACPI_ALLOCATE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ACPI_ALLOCATE_ZEROED函数代码示例 C++ ACPI_ADD_PTR函数代码示例 |