void acpi_ut_terminate (void) { struct acpi_gpe_block_info *gpe_block; struct acpi_gpe_block_info *next_gpe_block; struct acpi_gpe_xrupt_info *gpe_xrupt_info; struct acpi_gpe_xrupt_info *next_gpe_xrupt_info; ACPI_FUNCTION_TRACE ("ut_terminate"); /* Free global tables, etc. */ /* Free global GPE blocks and related info structures */ gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; while (gpe_xrupt_info) { gpe_block = gpe_xrupt_info->gpe_block_list_head; while (gpe_block) { next_gpe_block = gpe_block->next; ACPI_MEM_FREE (gpe_block->event_info); ACPI_MEM_FREE (gpe_block->register_info); ACPI_MEM_FREE (gpe_block); gpe_block = next_gpe_block; } next_gpe_xrupt_info = gpe_xrupt_info->next; ACPI_MEM_FREE (gpe_xrupt_info); gpe_xrupt_info = next_gpe_xrupt_info; } return_VOID; }
acpi_status acpi_ev_delete_gpe_block ( struct acpi_gpe_block_info *gpe_block) { acpi_status status; ACPI_FUNCTION_TRACE ("ev_install_gpe_block"); status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } /* Disable all GPEs in this block */ status = acpi_hw_disable_gpe_block (gpe_block->xrupt_block, gpe_block); if (!gpe_block->previous && !gpe_block->next) { /* This is the last gpe_block on this interrupt */ status = acpi_ev_delete_gpe_xrupt (gpe_block->xrupt_block); if (ACPI_FAILURE (status)) { goto unlock_and_exit; } } else { /* Remove the block on this interrupt with lock */ acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); if (gpe_block->previous) { gpe_block->previous->next = gpe_block->next; } else { gpe_block->xrupt_block->gpe_block_list_head = gpe_block->next; } if (gpe_block->next) { gpe_block->next->previous = gpe_block->previous; } acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); } /* Free the gpe_block */ ACPI_MEM_FREE (gpe_block->register_info); ACPI_MEM_FREE (gpe_block->event_info); ACPI_MEM_FREE (gpe_block); unlock_and_exit: status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); return_ACPI_STATUS (status); }
void acpi_ut_release_to_cache ( u32 list_id, void *object) { struct acpi_memory_list *cache_info; ACPI_FUNCTION_ENTRY (); cache_info = &acpi_gbl_memory_lists[list_id]; #ifdef ACPI_ENABLE_OBJECT_CACHE /* If walk cache is full, just free this wallkstate object */ if (cache_info->cache_depth >= cache_info->max_cache_depth) { ACPI_MEM_FREE (object); ACPI_MEM_TRACKING (cache_info->total_freed++); } /* Otherwise put this object back into the cache */ else { if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) { return; } /* Mark the object as cached */ ACPI_MEMSET (object, 0xCA, cache_info->object_size); ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_CACHED); /* Put the object at the head of the cache list */ * (ACPI_CAST_INDIRECT_PTR (char, &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head; cache_info->list_head = object; cache_info->cache_depth++; (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); } #else /* Object cache is disabled; just free the object */ ACPI_MEM_FREE (object); ACPI_MEM_TRACKING (cache_info->total_freed++); #endif }
void acpi_ns_print_node_pathname ( struct acpi_namespace_node *node, char *msg) { struct acpi_buffer buffer; acpi_status status; if (!node) { acpi_os_printf ("[NULL NAME]"); return; } /* Convert handle to full pathname and print it (with supplied message) */ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; status = acpi_ns_handle_to_pathname (node, &buffer); if (ACPI_SUCCESS (status)) { if (msg) { acpi_os_printf ("%s ", msg); } acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node); ACPI_MEM_FREE (buffer.pointer); } }
ACPI_STATUS AcpiNsDumpPathname ( ACPI_HANDLE Handle, NATIVE_CHAR *Msg, UINT32 Level, UINT32 Component) { ACPI_BUFFER Buffer; ACPI_STATUS Status; ACPI_FUNCTION_TRACE ("NsDumpPathname"); /* Do this only if the requested debug level and component are enabled */ if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component)) { return_ACPI_STATUS (AE_OK); } /* Convert handle to a full pathname and print it (with supplied message) */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; Status = AcpiNsHandleToPathname (Handle, &Buffer); if (ACPI_SUCCESS (Status)) { AcpiOsPrintf ("%s %s (Node %p)\n", Msg, (char *) Buffer.Pointer, Handle); ACPI_MEM_FREE (Buffer.Pointer); } return_ACPI_STATUS (Status); }
void acpi_tb_delete_single_table ( struct acpi_table_desc *table_desc) { /* Must have a valid table descriptor and pointer */ if ((!table_desc) || (!table_desc->pointer)) { return; } /* Valid table, determine type of memory allocation */ switch (table_desc->allocation) { case ACPI_MEM_NOT_ALLOCATED: break; case ACPI_MEM_ALLOCATED: ACPI_MEM_FREE (table_desc->pointer); break; case ACPI_MEM_MAPPED: acpi_os_unmap_memory (table_desc->pointer, table_desc->length); break; default: break; } }
acpi_status acpi_ns_dump_one_device ( acpi_handle obj_handle, u32 level, void *context, void **return_value) { struct acpi_buffer buffer; struct acpi_device_info *info; acpi_status status; u32 i; ACPI_FUNCTION_NAME ("ns_dump_one_device"); status = acpi_ns_dump_one_object (obj_handle, level, context, return_value); buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; status = acpi_get_object_info (obj_handle, &buffer); if (ACPI_SUCCESS (status)) { info = buffer.pointer; for (i = 0; i < level; i++) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ")); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", info->hardware_id.value, ACPI_FORMAT_UINT64 (info->address), info->current_status)); ACPI_MEM_FREE (info); } return (status); }
acpi_status acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, struct acpi_gpe_block_info *gpe_block) { struct acpi_gpe_event_info *gpe_event_info; acpi_native_uint i; acpi_native_uint j; ACPI_FUNCTION_TRACE("ev_delete_gpe_handlers"); /* Examine each GPE Register within the block */ for (i = 0; i < gpe_block->register_count; i++) { /* Now look at the individual GPEs in this byte register */ for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { gpe_event_info = &gpe_block-> event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) { ACPI_MEM_FREE(gpe_event_info->dispatch.handler); gpe_event_info->dispatch.handler = NULL; gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; } } } return_ACPI_STATUS(AE_OK); }
void acpi_tb_delete_single_table ( acpi_table_desc *table_desc) { if (!table_desc) { return; } if (table_desc->pointer) { /* Valid table, determine type of memory allocation */ switch (table_desc->allocation) { case ACPI_MEM_NOT_ALLOCATED: break; case ACPI_MEM_ALLOCATED: ACPI_MEM_FREE (table_desc->base_pointer); break; case ACPI_MEM_MAPPED: acpi_os_unmap_memory (table_desc->base_pointer, table_desc->length); break; } } }
acpi_status acpi_ns_search_node(u32 target_name, struct acpi_namespace_node *node, acpi_object_type type, struct acpi_namespace_node **return_node) { struct acpi_namespace_node *next_node; ACPI_FUNCTION_TRACE("ns_search_node"); #ifdef ACPI_DEBUG_OUTPUT if (ACPI_LV_NAMES & acpi_dbg_level) { char *scope_name; scope_name = acpi_ns_get_external_pathname(node); if (scope_name) { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Searching %s (%p) For [%4.4s] (%s)\n", scope_name, node, ACPI_CAST_PTR(char, &target_name), acpi_ut_get_type_name(type))); ACPI_MEM_FREE(scope_name); } }
acpi_status acpi_ns_evaluate_by_name ( NATIVE_CHAR *pathname, acpi_operand_object **params, acpi_operand_object **return_object) { acpi_status status; acpi_namespace_node *node = NULL; NATIVE_CHAR *internal_path = NULL; FUNCTION_TRACE ("Ns_evaluate_by_name"); /* Build an internal name string for the method */ status = acpi_ns_internalize_name (pathname, &internal_path); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); /* Lookup the name in the namespace */ status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY, IMODE_EXECUTE, NS_NO_UPSEARCH, NULL, &node); acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object at [%s] was not found, status=%.4X\n", pathname, status)); goto cleanup; } /* * Now that we have a handle to the object, we can attempt * to evaluate it. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s [%p] Value %p\n", pathname, node, node->object)); status = acpi_ns_evaluate_by_handle (node, params, return_object); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*** Completed eval of object %s ***\n", pathname)); cleanup: /* Cleanup */ if (internal_path) { ACPI_MEM_FREE (internal_path); } return_ACPI_STATUS (status); }
acpi_status acpi_ns_get_node ( NATIVE_CHAR *pathname, acpi_namespace_node *start_node, acpi_namespace_node **return_node) { acpi_generic_state scope_info; acpi_status status; NATIVE_CHAR *internal_path = NULL; FUNCTION_TRACE_PTR ("Ns_get_node", pathname); /* Ensure that the namespace has been initialized */ if (!acpi_gbl_root_node) { return_ACPI_STATUS (AE_NO_NAMESPACE); } if (!pathname) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Convert path to internal representation */ status = acpi_ns_internalize_name (pathname, &internal_path); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); /* Setup lookup scope (search starting point) */ scope_info.scope.node = start_node; /* Lookup the name in the namespace */ status = acpi_ns_lookup (&scope_info, internal_path, ACPI_TYPE_ANY, IMODE_EXECUTE, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, NULL, return_node); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n", internal_path, acpi_format_exception (status))); } acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); /* Cleanup */ ACPI_MEM_FREE (internal_path); return_ACPI_STATUS (status); }
acpi_status acpi_ex_store_string_to_string ( union acpi_operand_object *source_desc, union acpi_operand_object *target_desc) { u32 length; u8 *buffer; ACPI_FUNCTION_TRACE_PTR ("ex_store_string_to_string", source_desc); /* * We know that source_desc is a string by now. */ buffer = (u8 *) source_desc->string.pointer; length = source_desc->string.length; /* * Replace existing string value if it will fit and the string * pointer is not a static pointer (part of an ACPI table) */ if ((length < target_desc->string.length) && (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { /* * String will fit in existing non-static buffer. * Clear old string and copy in the new one */ ACPI_MEMSET (target_desc->string.pointer, 0, (acpi_size) target_desc->string.length + 1); ACPI_MEMCPY (target_desc->string.pointer, buffer, length); } else { /* * Free the current buffer, then allocate a new buffer * large enough to hold the value */ if (target_desc->string.pointer && (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { /* * Only free if not a pointer into the DSDT */ ACPI_MEM_FREE (target_desc->string.pointer); } target_desc->string.pointer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1); if (!target_desc->string.pointer) { return_ACPI_STATUS (AE_NO_MEMORY); } target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER; ACPI_MEMCPY (target_desc->string.pointer, buffer, length); } /* Set the new target length */ target_desc->string.length = length; return_ACPI_STATUS (AE_OK); }
acpi_status acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info) { acpi_status status; char *internal_path = NULL; ACPI_FUNCTION_TRACE("ns_evaluate_by_name"); /* Build an internal name string for the method */ status = acpi_ns_internalize_name(pathname, &internal_path); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { goto cleanup; } /* Lookup the name in the namespace */ status = acpi_ns_lookup(NULL, internal_path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, &info->node); (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Object at [%s] was not found, status=%.4X\n", pathname, status)); goto cleanup; } /* * Now that we have a handle to the object, we can attempt to evaluate it. */ ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", pathname, info->node, acpi_ns_get_attached_object(info->node))); status = acpi_ns_evaluate_by_handle(info); ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n", pathname)); cleanup: /* Cleanup */ if (internal_path) { ACPI_MEM_FREE(internal_path); } return_ACPI_STATUS(status); }
void acpi_ns_delete_node ( struct acpi_namespace_node *node) { struct acpi_namespace_node *parent_node; struct acpi_namespace_node *prev_node; struct acpi_namespace_node *next_node; ACPI_FUNCTION_TRACE_PTR ("ns_delete_node", node); parent_node = acpi_ns_get_parent_node (node); prev_node = NULL; next_node = parent_node->child; /* Find the node that is the previous peer in the parent's child list */ while (next_node != node) { prev_node = next_node; next_node = prev_node->peer; } if (prev_node) { /* Node is not first child, unlink it */ prev_node->peer = next_node->peer; if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { prev_node->flags |= ANOBJ_END_OF_PEER_LIST; } } else { /* Node is first child (has no previous peer) */ if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { /* No peers at all */ parent_node->child = NULL; } else { /* Link peer list to parent */ parent_node->child = next_node->peer; } } ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++); /* * Detach an object if there is one then delete the node */ acpi_ns_detach_object (node); ACPI_MEM_FREE (node); return_VOID; }
void AcpiUtDisplayInitPathname ( UINT8 Type, ACPI_NAMESPACE_NODE *ObjHandle, char *Path) { ACPI_STATUS Status; ACPI_BUFFER Buffer; ACPI_FUNCTION_ENTRY (); /* Only print the path if the appropriate debug level is enabled */ if (!(AcpiDbgLevel & ACPI_LV_INIT_NAMES)) { return; } /* Get the full pathname to the node */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); if (ACPI_FAILURE (Status)) { return; } /* Print what we're doing */ switch (Type) { case ACPI_TYPE_METHOD: AcpiOsPrintf ("Executing "); break; default: AcpiOsPrintf ("Initializing "); break; } /* Print the object type and pathname */ AcpiOsPrintf ("%-12s %s", AcpiUtGetTypeName (Type), (char *) Buffer.Pointer); /* Extra path is used to append names like _STA, _INI, etc. */ if (Path) { AcpiOsPrintf (".%s", Path); } AcpiOsPrintf ("\n"); ACPI_MEM_FREE (Buffer.Pointer); }
acpi_table_desc * acpi_tb_uninstall_table ( acpi_table_desc *table_desc) { acpi_table_desc *next_desc; FUNCTION_TRACE_PTR ("Tb_delete_single_table", table_desc); if (!table_desc) { return_PTR (NULL); } /* Unlink the descriptor */ if (table_desc->prev) { table_desc->prev->next = table_desc->next; } if (table_desc->next) { table_desc->next->prev = table_desc->prev; } /* Free the memory allocated for the table itself */ acpi_tb_delete_single_table (table_desc); /* Free the table descriptor (Don't delete the list head, tho) */ if ((table_desc->prev) == (table_desc->next)) { next_desc = NULL; /* Clear the list head */ table_desc->pointer = NULL; table_desc->length = 0; table_desc->count = 0; } else { /* Free the table descriptor */ next_desc = table_desc->next; ACPI_MEM_FREE (table_desc); } return_PTR (next_desc); }
acpi_status acpi_ns_get_node_by_path ( char *pathname, struct acpi_namespace_node *start_node, u32 flags, struct acpi_namespace_node **return_node) { union acpi_generic_state scope_info; acpi_status status; char *internal_path = NULL; ACPI_FUNCTION_TRACE_PTR ("ns_get_node_by_path", pathname); if (pathname) { /* Convert path to internal representation */ status = acpi_ns_internalize_name (pathname, &internal_path); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } } /* Must lock namespace during lookup */ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (status)) { goto cleanup; } /* Setup lookup scope (search starting point) */ scope_info.scope.node = start_node; /* Lookup the name in the namespace */ status = acpi_ns_lookup (&scope_info, internal_path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, (flags | ACPI_NS_DONT_OPEN_SCOPE), NULL, return_node); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n", internal_path, acpi_format_exception (status))); } (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); cleanup: /* Cleanup */ if (internal_path) { ACPI_MEM_FREE (internal_path); } return_ACPI_STATUS (status); }
void acpi_ev_terminate (void) { FUNCTION_TRACE ("Ev_terminate"); /* * Free global tables, etc. */ if (acpi_gbl_gpe_registers) { ACPI_MEM_FREE (acpi_gbl_gpe_registers); } if (acpi_gbl_gpe_info) { ACPI_MEM_FREE (acpi_gbl_gpe_info); } return_VOID; }
void acpi_ut_display_init_pathname ( u8 type, struct acpi_namespace_node *obj_handle, char *path) { acpi_status status; struct acpi_buffer buffer; ACPI_FUNCTION_ENTRY (); /* Only print the path if the appropriate debug level is enabled */ if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { return; } /* Get the full pathname to the node */ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; status = acpi_ns_handle_to_pathname (obj_handle, &buffer); if (ACPI_FAILURE (status)) { return; } /* Print what we're doing */ switch (type) { case ACPI_TYPE_METHOD: acpi_os_printf ("Executing "); break; default: acpi_os_printf ("Initializing "); break; } /* Print the object type and pathname */ acpi_os_printf ("%-12s %s", acpi_ut_get_type_name (type), (char *) buffer.pointer); /* Extra path is used to append names like _STA, _INI, etc. */ if (path) { acpi_os_printf (".%s", path); } acpi_os_printf ("\n"); ACPI_MEM_FREE (buffer.pointer); }
static acpi_status __init zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret) { acpi_handle handle, parent; acpi_status status; struct acpi_buffer buffer; struct acpi_device_info *info; u64 lba_hpa, sba_hpa, length; int match; status = hp_acpi_csr_space(obj, &lba_hpa, &length); if (ACPI_FAILURE(status)) return AE_OK; /* keep looking for another bridge */ /* Look for an enclosing IOC scope and find its CSR space */ handle = obj; do { buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; status = acpi_get_object_info(handle, &buffer); if (ACPI_SUCCESS(status)) { /* TBD check _CID also */ info = buffer.pointer; info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0'; match = (strcmp(info->hardware_id.value, "HWP0001") == 0); ACPI_MEM_FREE(info); if (match) { status = hp_acpi_csr_space(handle, &sba_hpa, &length); if (ACPI_SUCCESS(status)) break; else { printk(KERN_ERR PFX "Detected HP ZX1 " "AGP LBA but no IOC.\n"); return AE_OK; } } } status = acpi_get_parent(handle, &parent); handle = parent; } while (ACPI_SUCCESS(status)); if (hp_zx1_setup(sba_hpa + HP_ZX1_IOC_OFFSET, lba_hpa)) return AE_OK; printk(KERN_INFO PFX "Detected HP ZX1 %s AGP chipset (ioc=%lx, lba=%lx)\n", (char *) context, sba_hpa + HP_ZX1_IOC_OFFSET, lba_hpa); hp_zx1_gart_found = 1; return AE_CTRL_TERMINATE; /* we only support one bridge; quit looking */ }
/******************************************************************************* * * 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, "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", (u32) operand[0]->integer.value, (u32) operand[1]->integer.value, (u32) operand[2]->integer.value)); fatal = ACPI_MEM_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_MEM_FREE(fatal); break; default: ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } cleanup: return_ACPI_STATUS(status); }
acpi_status acpi_ns_internalize_name ( NATIVE_CHAR *external_name, NATIVE_CHAR **converted_name) { NATIVE_CHAR *internal_name; acpi_namestring_info info; acpi_status status; FUNCTION_TRACE ("Ns_internalize_name"); if ((!external_name) || (*external_name == 0) || (!converted_name)) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Get the length of the new internal name */ info.external_name = external_name; acpi_ns_get_internal_name_length (&info); /* We need a segment to store the internal name */ internal_name = ACPI_MEM_CALLOCATE (info.length); if (!internal_name) { return_ACPI_STATUS (AE_NO_MEMORY); } /* Build the name */ info.internal_name = internal_name; status = acpi_ns_build_internal_name (&info); if (ACPI_FAILURE (status)) { ACPI_MEM_FREE (internal_name); return_ACPI_STATUS (status); } *converted_name = internal_name; return_ACPI_STATUS (AE_OK); }
void acpi_ns_report_error ( char *module_name, u32 line_number, u32 component_id, char *internal_name, acpi_status lookup_status) { acpi_status status; char *name = NULL; acpi_os_printf ("%8s-%04d: *** Error: Looking up ", module_name, line_number); if (lookup_status == AE_BAD_CHARACTER) { /* There is a non-ascii character in the name */ acpi_os_printf ("[0x%4.4X] (NON-ASCII)\n", *(ACPI_CAST_PTR (u32, internal_name))); } else { /* Convert path to external format */ status = acpi_ns_externalize_name (ACPI_UINT32_MAX, internal_name, NULL, &name); /* Print target name */ if (ACPI_SUCCESS (status)) { acpi_os_printf ("[%s]", name); } else { acpi_os_printf ("[COULD NOT EXTERNALIZE NAME]"); } if (name) { ACPI_MEM_FREE (name); } } acpi_os_printf (" in namespace, %s\n", acpi_format_exception (lookup_status)); }
void AcpiUtReleaseToCache ( UINT32 ListId, void *Object) { ACPI_MEMORY_LIST *CacheInfo; ACPI_FUNCTION_ENTRY (); /* If walk cache is full, just free this wallkstate object */ CacheInfo = &AcpiGbl_MemoryLists[ListId]; if (CacheInfo->CacheDepth >= CacheInfo->MaxCacheDepth) { ACPI_MEM_FREE (Object); ACPI_MEM_TRACKING (CacheInfo->TotalFreed++); } /* Otherwise put this object back into the cache */ else { if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES))) { return; } /* Mark the object as cached */ ACPI_MEMSET (Object, 0xCA, CacheInfo->ObjectSize); ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED); /* Put the object at the head of the cache list */ * (ACPI_CAST_INDIRECT_PTR (char, &(((char *) Object)[CacheInfo->LinkOffset]))) = CacheInfo->ListHead; CacheInfo->ListHead = Object; CacheInfo->CacheDepth++; (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES); } }
static acpi_status acpi_ev_delete_gpe_xrupt ( struct acpi_gpe_xrupt_info *gpe_xrupt) { acpi_status status; ACPI_FUNCTION_TRACE ("ev_delete_gpe_xrupt"); /* We never want to remove the SCI interrupt handler */ if (gpe_xrupt->interrupt_level == acpi_gbl_FADT->sci_int) { gpe_xrupt->gpe_block_list_head = NULL; return_ACPI_STATUS (AE_OK); } /* Disable this interrupt */ status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_level, acpi_ev_gpe_xrupt_handler); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } /* Unlink the interrupt block with lock */ acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); if (gpe_xrupt->previous) { gpe_xrupt->previous->next = gpe_xrupt->next; } if (gpe_xrupt->next) { gpe_xrupt->next->previous = gpe_xrupt->previous; } acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); /* Free the block */ ACPI_MEM_FREE (gpe_xrupt); return_ACPI_STATUS (AE_OK); }
struct acpi_table_desc * acpi_tb_uninstall_table ( struct acpi_table_desc *table_desc) { struct acpi_table_desc *next_desc; ACPI_FUNCTION_TRACE_PTR ("tb_uninstall_table", table_desc); if (!table_desc) { return_PTR (NULL); } /* Unlink the descriptor from the doubly linked list */ if (table_desc->prev) { table_desc->prev->next = table_desc->next; } else { /* Is first on list, update list head */ acpi_gbl_table_lists[table_desc->type].next = table_desc->next; } if (table_desc->next) { table_desc->next->prev = table_desc->prev; } /* Free the memory allocated for the table itself */ acpi_tb_delete_single_table (table_desc); /* Free the table descriptor */ next_desc = table_desc->next; ACPI_MEM_FREE (table_desc); /* Return pointer to the next descriptor */ return_PTR (next_desc); }
ACPI_STATUS AcpiEvSystemMemoryRegionSetup ( ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext) { ACPI_OPERAND_OBJECT *RegionDesc = (ACPI_OPERAND_OBJECT *) Handle; ACPI_MEM_SPACE_CONTEXT *LocalRegionContext; ACPI_FUNCTION_TRACE ("EvSystemMemoryRegionSetup"); if (Function == ACPI_REGION_DEACTIVATE) { if (*RegionContext) { ACPI_MEM_FREE (*RegionContext); *RegionContext = NULL; } return_ACPI_STATUS (AE_OK); } /* Create a new context */ LocalRegionContext = ACPI_MEM_CALLOCATE (sizeof (ACPI_MEM_SPACE_CONTEXT)); if (!(LocalRegionContext)) { return_ACPI_STATUS (AE_NO_MEMORY); } /* Save the region length and address for use in the handler */ LocalRegionContext->Length = RegionDesc->Region.Length; LocalRegionContext->Address = RegionDesc->Region.Address; *RegionContext = LocalRegionContext; return_ACPI_STATUS (AE_OK); }
void AcpiUtReleaseToCache ( UINT32 ListId, void *Object) { ACPI_MEMORY_LIST *CacheInfo; FUNCTION_ENTRY (); /* If walk cache is full, just free this wallkstate object */ CacheInfo = &AcpiGbl_MemoryLists[ListId]; if (CacheInfo->CacheDepth >= CacheInfo->MaxCacheDepth) { ACPI_MEM_FREE (Object); ACPI_MEM_TRACKING (CacheInfo->TotalFreed++); } /* Otherwise put this object back into the cache */ else { AcpiUtAcquireMutex (ACPI_MTX_CACHES); /* Mark the object as cached */ MEMSET (Object, 0xCA, CacheInfo->ObjectSize); /* Put the object at the head of the cache list */ * (char **) (((char *) Object) + CacheInfo->LinkOffset) = CacheInfo->ListHead; CacheInfo->ListHead = Object; CacheInfo->CacheDepth++; AcpiUtReleaseMutex (ACPI_MTX_CACHES); } }
ACPI_STATUS AcpiNsDumpPathname ( ACPI_HANDLE Handle, NATIVE_CHAR *Msg, UINT32 Level, UINT32 Component) { NATIVE_CHAR *Buffer; UINT32 Length; FUNCTION_TRACE ("NsDumpPathname"); /* Do this only if the requested debug level and component are enabled */ if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component)) { return_ACPI_STATUS (AE_OK); } Buffer = ACPI_MEM_ALLOCATE (PATHNAME_MAX); if (!Buffer) { return_ACPI_STATUS (AE_NO_MEMORY); } /* Convert handle to a full pathname and print it (with supplied message) */ Length = PATHNAME_MAX; if (ACPI_SUCCESS (AcpiNsHandleToPathname (Handle, &Length, Buffer))) { AcpiOsPrintf ("%s %s (%p)\n", Msg, Buffer, Handle); } ACPI_MEM_FREE (Buffer); return_ACPI_STATUS (AE_OK); }