/* acpi_root_bridge - check to see if this acpi object is a root bridge * * @handle - the acpi object in question. */ int acpi_root_bridge(acpi_handle handle) { acpi_status status; struct acpi_device_info *info; struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; int i; status = acpi_get_object_info(handle, &buffer); if (ACPI_SUCCESS(status)) { info = buffer.pointer; if ((info->valid & ACPI_VALID_HID) && !strcmp(PCI_ROOT_HID_STRING, info->hardware_id.value)) { acpi_os_free(buffer.pointer); return 1; } if (info->valid & ACPI_VALID_CID) { for (i=0; i < info->compatibility_id.count; i++) { if (!strcmp(PCI_ROOT_HID_STRING, info->compatibility_id.id[i].value)) { acpi_os_free(buffer.pointer); return 1; } } } acpi_os_free(buffer.pointer); } return 0; }
acpi_status acpi_ut_delete_caches(void) { #ifdef ACPI_DBG_TRACK_ALLOCATIONS char buffer[7]; if (acpi_gbl_display_final_mem_stats) { strcpy(buffer, "MEMORY"); (void)acpi_db_display_statistics(buffer); } #endif (void)acpi_os_delete_cache(acpi_gbl_namespace_cache); acpi_gbl_namespace_cache = NULL; (void)acpi_os_delete_cache(acpi_gbl_state_cache); acpi_gbl_state_cache = NULL; (void)acpi_os_delete_cache(acpi_gbl_operand_cache); acpi_gbl_operand_cache = NULL; (void)acpi_os_delete_cache(acpi_gbl_ps_node_cache); acpi_gbl_ps_node_cache = NULL; (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache); acpi_gbl_ps_node_ext_cache = NULL; #ifdef ACPI_ASL_COMPILER (void)acpi_os_delete_cache(acpi_gbl_reg_comment_cache); acpi_gbl_reg_comment_cache = NULL; (void)acpi_os_delete_cache(acpi_gbl_comment_addr_cache); acpi_gbl_comment_addr_cache = NULL; (void)acpi_os_delete_cache(acpi_gbl_file_cache); acpi_gbl_file_cache = NULL; #endif #ifdef ACPI_DBG_TRACK_ALLOCATIONS /* Debug only - display leftover memory allocation, if any */ acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL); /* Free memory lists */ acpi_os_free(acpi_gbl_global_list); acpi_gbl_global_list = NULL; acpi_os_free(acpi_gbl_ns_node_list); acpi_gbl_ns_node_list = NULL; #endif return (AE_OK); }
void acpi_db_terminate (void) { if (acpi_gbl_db_table_ptr) { acpi_os_free (acpi_gbl_db_table_ptr); } if (acpi_gbl_db_buffer) { acpi_os_free (acpi_gbl_db_buffer); } }
acpi_status __init acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret) { struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; union acpi_object *obj; struct acpi_table_iosapic *iosapic; unsigned int gsi_base; int pxm, node; /* Only care about objects w/ a method that returns the MADT */ if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) return AE_OK; if (!buffer.length || !buffer.pointer) return AE_OK; obj = buffer.pointer; if (obj->type != ACPI_TYPE_BUFFER || obj->buffer.length < sizeof(*iosapic)) { acpi_os_free(buffer.pointer); return AE_OK; } iosapic = (struct acpi_table_iosapic *)obj->buffer.pointer; if (iosapic->header.type != ACPI_MADT_IOSAPIC) { acpi_os_free(buffer.pointer); return AE_OK; } gsi_base = iosapic->global_irq_base; acpi_os_free(buffer.pointer); /* * OK, it's an IOSAPIC MADT entry, look for a _PXM value to tell * us which node to associate this with. */ pxm = acpi_get_pxm(handle); if (pxm < 0) return AE_OK; node = pxm_to_nid_map[pxm]; if (node >= MAX_NUMNODES || !node_online(node) || cpus_empty(node_to_cpumask(node))) return AE_OK; /* We know a gsi to node mapping! */ map_iosapic_to_node(gsi_base, node); return AE_OK; }
int acpi_map_lsapic(acpi_handle handle, int *pcpu) { struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; union acpi_object *obj; struct acpi_table_lsapic *lsapic; cpumask_t tmp_map; long physid; int cpu; if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) return -EINVAL; if (!buffer.length || !buffer.pointer) return -EINVAL; obj = buffer.pointer; if (obj->type != ACPI_TYPE_BUFFER || obj->buffer.length < sizeof(*lsapic)) { acpi_os_free(buffer.pointer); return -EINVAL; } lsapic = (struct acpi_table_lsapic *)obj->buffer.pointer; if ((lsapic->header.type != ACPI_MADT_LSAPIC) || (!lsapic->flags.enabled)) { acpi_os_free(buffer.pointer); return -EINVAL; } physid = ((lsapic->id <<8) | (lsapic->eid)); acpi_os_free(buffer.pointer); buffer.length = ACPI_ALLOCATE_BUFFER; buffer.pointer = NULL; cpus_complement(tmp_map, cpu_present_map); cpu = first_cpu(tmp_map); if(cpu >= NR_CPUS) return -EINVAL; acpi_map_cpu2node(handle, cpu, physid); cpu_set(cpu, cpu_present_map); ia64_cpu_to_sapicid[cpu] = physid; ia64_acpiid_to_sapicid[lsapic->acpi_id] = ia64_cpu_to_sapicid[cpu]; *pcpu = cpu; return(0); }
static int acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) { acpi_status status; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_resource *resource = NULL; struct acpi_resource_address64 address64; ACPI_FUNCTION_TRACE("acpi_memory_get_device_resources"); /* Get the range from the _CRS */ status = acpi_get_current_resources(mem_device->handle, &buffer); if (ACPI_FAILURE(status)) return_VALUE(-EINVAL); resource = (struct acpi_resource *)buffer.pointer; status = acpi_resource_to_address64(resource, &address64); if (ACPI_SUCCESS(status)) { if (address64.resource_type == ACPI_MEMORY_RANGE) { /* Populate the structure */ mem_device->cache_attribute = address64.attribute.memory.cache_attribute; mem_device->read_write_attribute = address64.attribute.memory.read_write_attribute; mem_device->start_addr = address64.min_address_range; mem_device->end_addr = address64.max_address_range; } } acpi_os_free(buffer.pointer); return_VALUE(0); }
acpi_status ac_remove_device ( void **context) { acpi_status status = AE_OK; AC_CONTEXT *ac_adapter = NULL; FUNCTION_TRACE("ac_remove_device"); if (!context || !*context) { return_ACPI_STATUS(AE_BAD_PARAMETER); } ac_adapter = (AC_CONTEXT*)*context; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing ac_adapter device [%02x].\n", ac_adapter->device_handle)); ac_osl_remove_device(ac_adapter); acpi_os_free(ac_adapter); *context = NULL; return_ACPI_STATUS(status); }
/******************************************************************************* * * FUNCTION: acpi_terminate_debugger * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Stop debugger * ******************************************************************************/ void acpi_terminate_debugger(void) { /* Terminate the AML Debugger */ acpi_gbl_db_terminate_loop = TRUE; if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED) { acpi_os_release_mutex(acpi_gbl_db_command_ready); /* Wait the AML Debugger threads */ while (!acpi_gbl_db_threads_terminated) { acpi_os_sleep(100); } } if (acpi_gbl_db_buffer) { acpi_os_free(acpi_gbl_db_buffer); acpi_gbl_db_buffer = NULL; } /* Ensure that debug output is now disabled */ acpi_gbl_db_output_flags = ACPI_DB_DISABLE_OUTPUT; }
static int acpi_battery_get_status ( struct acpi_battery *battery, struct acpi_battery_status **bst) { int result = 0; acpi_status status = 0; struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; struct acpi_buffer format = {sizeof(ACPI_BATTERY_FORMAT_BST), ACPI_BATTERY_FORMAT_BST}; struct acpi_buffer data = {0, NULL}; union acpi_object *package = NULL; ACPI_FUNCTION_TRACE("acpi_battery_get_status"); if (!battery || !bst) return_VALUE(-EINVAL); /* Evalute _BST */ status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _BST\n")); return_VALUE(-ENODEV); } package = (union acpi_object *) buffer.pointer; /* Extract Package Data */ status = acpi_extract_package(package, &format, &data); if (status != AE_BUFFER_OVERFLOW) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BST\n")); result = -ENODEV; goto end; } data.pointer = kmalloc(data.length, GFP_KERNEL); if (!data.pointer) { result = -ENOMEM; goto end; } memset(data.pointer, 0, data.length); status = acpi_extract_package(package, &format, &data); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BST\n")); kfree(data.pointer); result = -ENODEV; goto end; } end: acpi_os_free(buffer.pointer); if (!result) (*bst) = (struct acpi_battery_status *) data.pointer; return_VALUE(result); }
void acpi_ut_free_and_track(void *allocation, u32 component, const char *module, u32 line) { struct acpi_debug_mem_block *debug_block; acpi_status status; ACPI_FUNCTION_TRACE_PTR(ut_free, allocation); if (NULL == allocation) { ACPI_ERROR((module, line, "Attempt to delete a NULL address")); return_VOID; } debug_block = ACPI_CAST_PTR(struct acpi_debug_mem_block, (((char *)allocation) - sizeof(struct acpi_debug_mem_header))); acpi_gbl_global_list->total_freed++; acpi_gbl_global_list->current_total_size -= debug_block->size; status = acpi_ut_remove_allocation(debug_block, component, module, line); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Could not free memory")); } acpi_os_free(debug_block); ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed (block %p)\n", allocation, debug_block)); return_VOID; }
acpi_status tz_remove_device ( void **context) { acpi_status status = AE_OK; TZ_CONTEXT *tz = NULL; FUNCTION_TRACE("tz_remove_device"); if (!context || !*context) { return_ACPI_STATUS(AE_BAD_PARAMETER); } tz = (TZ_CONTEXT*)(*context); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing thermal zone [%02x].\n", tz->device_handle)); status = tz_osl_remove_device(tz); /* * Remove Policy: * -------------- * TBD: Move all thermal zone policy to user-mode daemon... */ status = tz_policy_remove_device(tz); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } acpi_os_free(tz); return_ACPI_STATUS(status); }
acpi_status pr_remove_device ( void **context) { acpi_status status = AE_OK; PR_CONTEXT *processor= NULL; FUNCTION_TRACE("pr_remove_device"); if (!context || !*context) { return_ACPI_STATUS(AE_BAD_PARAMETER); } processor = (PR_CONTEXT*)(*context); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing processor device [%02x].\n", processor->device_handle)); pr_osl_remove_device(processor); pr_perf_remove_device(processor); pr_power_remove_device(processor); acpi_os_free(processor); return_ACPI_STATUS(status); }
void pr_print ( PR_CONTEXT *processor) { #ifdef ACPI_DEBUG acpi_buffer buffer; FUNCTION_TRACE("pr_print"); buffer.length = 256; buffer.pointer = acpi_os_callocate(buffer.length); if (!buffer.pointer) { return; } /* * Get the full pathname for this ACPI object. */ acpi_get_name(processor->acpi_handle, ACPI_FULL_PATHNAME, &buffer); /* * Print out basic processor information. */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Processor[%02x]:[%p] uid[%02x] %s\n", processor->device_handle, processor->acpi_handle, processor->uid, (char*)buffer.pointer)); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| power: %cC0 %cC1 %cC2[%d] %cC3[%d]\n", (processor->power.state[0].is_valid?'+':'-'), (processor->power.state[1].is_valid?'+':'-'), (processor->power.state[2].is_valid?'+':'-'), processor->power.state[2].latency, (processor->power.state[3].is_valid?'+':'-'), processor->power.state[3].latency)); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| performance: states[%d]\n", processor->performance.state_count)); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n")); acpi_os_free(buffer.pointer); #endif /* ACPI_DEBUG */ return; }
acpi_status bm_pr_print ( BM_POWER_RESOURCE *pr) { acpi_buffer buffer; PROC_NAME("bm_pr_print"); if (!pr) { return(AE_BAD_PARAMETER); } buffer.length = 256; buffer.pointer = acpi_os_callocate(buffer.length); if (!buffer.pointer) { return(AE_NO_MEMORY); } acpi_get_name(pr->acpi_handle, ACPI_FULL_PATHNAME, &buffer); acpi_os_printf("Power Resource: found\n"); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Power_resource[%02x]:[%p] %s\n", pr->device_handle, pr->acpi_handle, (char*)buffer.pointer)); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| system_level[S%d] resource_order[%d]\n", pr->system_level, pr->resource_order)); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| state[D%d] reference_count[%d]\n", pr->state, pr->reference_count)); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n")); acpi_os_free(buffer.pointer); return(AE_OK); }
acpi_status ec_remove_device( void **context) { acpi_status status = AE_OK; EC_CONTEXT *ec = NULL; FUNCTION_TRACE("ec_remove_device"); if (!context || !*context) { return_ACPI_STATUS(AE_BAD_PARAMETER); } ec = (EC_CONTEXT*)*context; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing EC device [%02x].\n", ec->device_handle)); ec_remove_space_handler(ec); ec_remove_gpe_handler(ec); if (ec->mutex) { acpi_os_delete_semaphore(ec->mutex); } acpi_os_free(ec); *context = NULL; return_ACPI_STATUS(status); }
acpi_status bm_evaluate_object ( acpi_handle handle, acpi_string pathname, acpi_object_list *arguments, acpi_buffer *buffer) { acpi_status status = AE_OK; FUNCTION_TRACE("bm_evaluate_object"); /* If caller provided a buffer it must be unallocated/zero'd. */ if ((buffer) && (buffer->length != 0 || buffer->pointer)) { return_ACPI_STATUS(AE_BAD_PARAMETER); } /* * Evalute Object: * --------------- * The first attempt is just to get the size of the object data * (that is unless there's no return data, e.g. _INI); the second * gets the data. */ status = acpi_evaluate_object(handle, pathname, arguments, buffer); if (ACPI_SUCCESS(status)) { return_ACPI_STATUS(status); } else if ((buffer) && (status == AE_BUFFER_OVERFLOW)) { /* Gotta allocate -- CALLER MUST FREE! */ buffer->pointer = acpi_os_callocate(buffer->length); if (!buffer->pointer) { return_ACPI_STATUS(AE_NO_MEMORY); } /* Re-evaluate -- this time it should work */ status = acpi_evaluate_object(handle, pathname, arguments, buffer); } if (ACPI_FAILURE(status)) { if (status != AE_NOT_FOUND) { DEBUG_EVAL_ERROR(ACPI_LV_WARN, handle, pathname, status); } if (buffer && buffer->pointer) { acpi_os_free(buffer->pointer); buffer->pointer = NULL; buffer->length = 0; } } return_ACPI_STATUS(status); }
/* * Deallocate the memory for a spinlock. */ void acpi_os_delete_lock ( acpi_handle handle) { ACPI_FUNCTION_TRACE ("os_create_lock"); ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Deleting spinlock[%p].\n", handle)); acpi_os_free(handle); return_VOID; }
void bn_print ( BN_CONTEXT *button) { #ifdef ACPI_DEBUG acpi_buffer buffer; PROC_NAME("bn_print"); if (!button) { return; } buffer.length = 256; buffer.pointer = acpi_os_callocate(buffer.length); if (!buffer.pointer) { return; } /* * Get the full pathname for this ACPI object. */ acpi_get_name(button->acpi_handle, ACPI_FULL_PATHNAME, &buffer); /* * Print out basic button information. */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n")); switch (button->type) { case BN_TYPE_POWER_BUTTON: case BN_TYPE_POWER_BUTTON_FIXED: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Power_button[%02x]:[%p] %s\n", button->device_handle, button->acpi_handle, (char*)buffer.pointer)); break; case BN_TYPE_SLEEP_BUTTON: case BN_TYPE_SLEEP_BUTTON_FIXED: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Sleep_button[%02x]:[%p] %s\n", button->device_handle, button->acpi_handle, (char*)buffer.pointer)); break; case BN_TYPE_LID_SWITCH: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Lid_switch[%02x]:[%p] %s\n", button->device_handle, button->acpi_handle, (char*)buffer.pointer)); break; } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n")); acpi_os_free(buffer.pointer); #endif /*ACPI_DEBUG*/ return; }
static acpi_status container_walk_namespace_cb(acpi_handle handle, u32 lvl, void *context, void **rv) { char *hid = NULL; struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; struct acpi_device_info *info; acpi_status status; int *action = context; ACPI_FUNCTION_TRACE("container_walk_namespace_cb"); status = acpi_get_object_info(handle, &buffer); if (ACPI_FAILURE(status) || !buffer.pointer) { return_ACPI_STATUS(AE_OK); } info = buffer.pointer; if (info->valid & ACPI_VALID_HID) hid = info->hardware_id.value; if (hid == NULL) { goto end; } if (strcmp(hid, "ACPI0004") && strcmp(hid, "PNP0A05") && strcmp(hid, "PNP0A06")) { goto end; } switch(*action) { case INSTALL_NOTIFY_HANDLER: acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, container_notify_cb, NULL); break; case UNINSTALL_NOTIFY_HANDLER: acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY, container_notify_cb); break; default: break; } end: acpi_os_free(buffer.pointer); return_ACPI_STATUS(AE_OK); }
acpi_status bm_evaluate_simple_integer ( acpi_handle handle, acpi_string pathname, u32 *data) { acpi_status status = AE_OK; acpi_object *element = NULL; acpi_buffer buffer; FUNCTION_TRACE("bm_evaluate_simple_integer"); if (!data) { return_ACPI_STATUS(AE_BAD_PARAMETER); } MEMSET(&buffer, 0, sizeof(acpi_buffer)); /* * Evaluate Object: * ---------------- */ status = bm_evaluate_object(handle, pathname, NULL, &buffer); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "failed to evaluate object (%s)\n", acpi_format_exception(status))); goto end; } /* * Validate Data: * -------------- */ status = bm_cast_buffer(&buffer, (void**)&element, sizeof(acpi_object)); if (ACPI_FAILURE(status)) { DEBUG_EVAL_ERROR(ACPI_LV_WARN, handle, pathname, status); goto end; } if (element->type != ACPI_TYPE_INTEGER) { status = AE_BAD_DATA; DEBUG_EVAL_ERROR(ACPI_LV_WARN, handle, pathname, status); goto end; } *data = element->integer.value; end: acpi_os_free(buffer.pointer); return_ACPI_STATUS(status); }
void *acpi_ut_allocate_zeroed_and_track(acpi_size size, u32 component, const char *module, u32 line) { struct acpi_debug_mem_block *allocation; acpi_status status; /* Check for an inadvertent size of zero bytes */ if (!size) { ACPI_WARNING((module, line, "Attempt to allocate zero bytes, allocating 1 byte")); size = 1; } allocation = acpi_os_allocate_zeroed(size + sizeof(struct acpi_debug_mem_header)); if (!allocation) { /* Report allocation error */ ACPI_ERROR((module, line, "Could not allocate size %u", (u32)size)); return (NULL); } status = acpi_ut_track_allocation(allocation, size, ACPI_MEM_CALLOC, component, module, line); if (ACPI_FAILURE(status)) { acpi_os_free(allocation); return (NULL); } acpi_gbl_global_list->total_allocated++; acpi_gbl_global_list->total_size += (u32)size; acpi_gbl_global_list->current_total_size += (u32)size; if (acpi_gbl_global_list->current_total_size > acpi_gbl_global_list->max_occupied) { acpi_gbl_global_list->max_occupied = acpi_gbl_global_list->current_total_size; } return ((void *)&allocation->user_space); }
acpi_status acpi_evaluate_string ( acpi_handle handle, acpi_string pathname, acpi_object_list *arguments, acpi_string *data) { acpi_status status = AE_OK; acpi_object *element = NULL; acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; ACPI_FUNCTION_TRACE("acpi_evaluate_string"); if (!data) return_ACPI_STATUS(AE_BAD_PARAMETER); status = acpi_evaluate_object(handle, pathname, arguments, &buffer); if (ACPI_FAILURE(status)) { acpi_util_eval_error(handle, pathname, status); return_ACPI_STATUS(status); } element = (acpi_object *) buffer.pointer; if ((element->type != ACPI_TYPE_STRING) || (element->type != ACPI_TYPE_BUFFER) || !element->string.length) { acpi_util_eval_error(handle, pathname, AE_BAD_DATA); return_ACPI_STATUS(AE_BAD_DATA); } *data = kmalloc(element->string.length + 1, GFP_KERNEL); if (!data) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Memory allocation error\n")); return_VALUE(-ENOMEM); } memset(*data, 0, element->string.length + 1); memcpy(*data, element->string.pointer, element->string.length); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%s]\n", *data)); acpi_os_free(buffer.pointer); return_ACPI_STATUS(AE_OK); }
acpi_status acpi_os_delete_semaphore( acpi_handle handle) { struct semaphore *sem = (struct semaphore*) handle; ACPI_FUNCTION_TRACE ("os_delete_semaphore"); if (!sem) return_ACPI_STATUS (AE_BAD_PARAMETER); ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); acpi_os_free(sem); sem = NULL; return_ACPI_STATUS (AE_OK); }
acpi_status hp_acpi_csr_space(acpi_handle obj, u64 *csr_base, u64 *csr_length) { acpi_status status; u8 *data; u32 length; status = acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length); if (ACPI_FAILURE(status) || length != 16) return AE_NOT_FOUND; memcpy(csr_base, data, sizeof(*csr_base)); memcpy(csr_length, data + 8, sizeof(*csr_length)); acpi_os_free(data); return AE_OK; }
acpi_status acpi_os_delete_semaphore( acpi_handle handle) { struct semaphore *sem = (struct semaphore*) handle; PROC_NAME("acpi_os_delete_semaphore"); if (!sem) return AE_BAD_PARAMETER; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting semaphore[%p].\n", handle)); acpi_os_free(sem); sem = NULL; return AE_OK; }
acpi_status acpi_os_delete_cache(struct acpi_memory_list * cache) { acpi_status status; ACPI_FUNCTION_ENTRY(); /* Purge all objects in the cache */ status = acpi_os_purge_cache(cache); if (ACPI_FAILURE(status)) { return (status); } /* Now we can delete the cache object */ acpi_os_free(cache); return (AE_OK); }
acpi_status bm_terminate (void) { acpi_status status = AE_OK; u32 i = 0; FUNCTION_TRACE("bm_terminate"); /* * Terminate built-in power resource driver. */ bm_pr_terminate(); /* * Unregister for all notifications. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unregistering for device notifications.\n")); status = acpi_remove_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, &bm_notify); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to un-register for standard notifications.\n")); } status = acpi_remove_notify_handler(ACPI_ROOT_OBJECT, ACPI_DEVICE_NOTIFY, &bm_notify); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to un-register for device-specific notifications.\n")); } /* * Parse through the device array, freeing all entries. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing device hierarchy.\n")); for (i = 0; i < node_list.count; i++) { if (node_list.nodes[i]) { acpi_os_free(node_list.nodes[i]); } } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Bus Manager disabled.\n")); return_ACPI_STATUS(AE_OK); }
acpi_status ec_get_port_values( EC_CONTEXT *ec) { acpi_status status = AE_OK; acpi_buffer buffer; acpi_resource *resource = NULL; FUNCTION_TRACE("ec_get_port_values"); if (!ec) { return_ACPI_STATUS(AE_BAD_PARAMETER); } buffer.length = 0; buffer.pointer = NULL; status = acpi_get_current_resources(ec->acpi_handle, &buffer); if (status != AE_BUFFER_OVERFLOW) { return_ACPI_STATUS(status); } buffer.pointer = acpi_os_callocate(buffer.length); if (!buffer.pointer) { return_ACPI_STATUS(AE_NO_MEMORY); } status = acpi_get_current_resources(ec->acpi_handle, &buffer); if (ACPI_FAILURE(status)) { goto end; } resource = (acpi_resource *) buffer.pointer; ec->data_port = resource->data.io.min_base_address; resource = NEXT_RESOURCE(resource); ec->status_port = ec->command_port = resource->data.io.min_base_address; end: acpi_os_free(buffer.pointer); return_ACPI_STATUS(status); }
/* acpi_run_oshp - get control of hotplug from the firmware * * @handle - the handle of the hotplug controller. */ acpi_status acpi_run_oshp(acpi_handle handle) { acpi_status status; struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL }; acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); /* run OSHP */ status = acpi_evaluate_object(handle, METHOD_NAME_OSHP, NULL, NULL); if (ACPI_FAILURE(status)) printk(KERN_ERR "%s:%s OSHP fails=0x%x\n", __FUNCTION__, (char *)string.pointer, status); else pr_debug("%s:%s OSHP passes\n", __FUNCTION__, (char *)string.pointer); acpi_os_free(string.pointer); return status; }
static ssize_t acpi_system_read_dsdt(struct file *file, char __user * buffer, size_t count, loff_t * ppos) { acpi_status status = AE_OK; struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; ssize_t res; ACPI_FUNCTION_TRACE("acpi_system_read_dsdt"); status = acpi_get_table(ACPI_TABLE_DSDT, 1, &dsdt); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); res = simple_read_from_buffer(buffer, count, ppos, dsdt.pointer, dsdt.length); acpi_os_free(dsdt.pointer); return_VALUE(res); }