acpi_status acpi_ds_scope_stack_push(struct acpi_namespace_node *node, acpi_object_type type, struct acpi_walk_state *walk_state) { union acpi_generic_state *scope_info; union acpi_generic_state *old_scope_info; ACPI_FUNCTION_TRACE(ds_scope_stack_push); if (!node) { /* Invalid scope */ ACPI_ERROR((AE_INFO, "Null scope parameter")); return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Make sure object type is valid */ if (!acpi_ut_valid_object_type(type)) { ACPI_WARNING((AE_INFO, "Invalid object type: 0x%X", type)); } /* Allocate a new scope object */ scope_info = acpi_ut_create_generic_state(); if (!scope_info) { return_ACPI_STATUS(AE_NO_MEMORY); } /* Init new scope object */ scope_info->common.descriptor_type = ACPI_DESC_TYPE_STATE_WSCOPE; scope_info->scope.node = node; scope_info->common.value = (u16) type; walk_state->scope_depth++; ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%.2d] Pushed scope ", (u32) walk_state->scope_depth)); old_scope_info = walk_state->scope_info; if (old_scope_info) { ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "[%4.4s] (%s)", acpi_ut_get_node_name(old_scope_info-> scope.node), acpi_ut_get_type_name(old_scope_info-> common.value))); } else { ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "[\\___] (%s)", "ROOT")); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, ", New scope -> [%4.4s] (%s)\n", acpi_ut_get_node_name(scope_info->scope.node), acpi_ut_get_type_name(scope_info->common.value))); /* Push new scope object onto stack */ acpi_ut_push_generic_state(&walk_state->scope_info, scope_info); return_ACPI_STATUS(AE_OK); }
acpi_status acpi_ns_evaluate_relative ( char *pathname, struct acpi_parameter_info *info) { acpi_status status; struct acpi_namespace_node *node = NULL; union acpi_generic_state *scope_info; char *internal_path = NULL; ACPI_FUNCTION_TRACE ("ns_evaluate_relative"); /* * Must have a valid object handle */ if (!info || !info->node) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Build an internal name string for the method */ status = acpi_ns_internalize_name (pathname, &internal_path); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } scope_info = acpi_ut_create_generic_state (); if (!scope_info) { goto cleanup1; } /* Get the prefix handle and Node */ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (status)) { goto cleanup; } info->node = acpi_ns_map_handle_to_node (info->node); if (!info->node) { (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); status = AE_BAD_PARAMETER; goto cleanup; } /* Lookup the name in the namespace */ scope_info->scope.node = info->node; status = acpi_ns_lookup (scope_info, internal_path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, &node); (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object [%s] not found [%s]\n", pathname, acpi_format_exception (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, node, acpi_ns_get_attached_object (node))); info->node = node; status = acpi_ns_evaluate_by_handle (info); ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n", pathname)); cleanup: acpi_ut_delete_generic_state (scope_info); cleanup1: ACPI_MEM_FREE (internal_path); return_ACPI_STATUS (status); }
acpi_status acpi_ev_queue_notify_request(struct acpi_namespace_node * node, u32 notify_value) { union acpi_operand_object *obj_desc; union acpi_operand_object *handler_obj = NULL; union acpi_generic_state *notify_info; acpi_status status = AE_OK; ACPI_FUNCTION_NAME(ev_queue_notify_request); /* * For value 3 (Ejection Request), some device method may need to be run. * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need * to be run. * For value 0x80 (Status Change) on the power button or sleep button, * initiate soft-off or sleep operation? */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Dispatching Notify on [%4.4s] Node %p Value 0x%2.2X (%s)\n", acpi_ut_get_node_name(node), node, notify_value, acpi_ut_get_notify_name(notify_value))); /* Get the notify object attached to the NS Node */ obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { /* We have the notify object, Get the right handler */ switch (node->type) { /* Notify allowed only on these types */ case ACPI_TYPE_DEVICE: case ACPI_TYPE_THERMAL: case ACPI_TYPE_PROCESSOR: if (notify_value <= ACPI_MAX_SYS_NOTIFY) { handler_obj = obj_desc->common_notify.system_notify; } else { handler_obj = obj_desc->common_notify.device_notify; } break; default: /* All other types are not supported */ return (AE_TYPE); } } /* * If there is any handler to run, schedule the dispatcher. * Check for: * 1) Global system notify handler * 2) Global device notify handler * 3) Per-device notify handler */ if ((acpi_gbl_system_notify.handler && (notify_value <= ACPI_MAX_SYS_NOTIFY)) || (acpi_gbl_device_notify.handler && (notify_value > ACPI_MAX_SYS_NOTIFY)) || handler_obj) { notify_info = acpi_ut_create_generic_state(); if (!notify_info) { return (AE_NO_MEMORY); } if (!handler_obj) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Executing system notify handler for Notify (%4.4s, %X) " "node %p\n", acpi_ut_get_node_name(node), notify_value, node)); } notify_info->common.descriptor_type = ACPI_DESC_TYPE_STATE_NOTIFY; notify_info->notify.node = node; notify_info->notify.value = (u16) notify_value; notify_info->notify.handler_obj = handler_obj; status = acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch, notify_info); if (ACPI_FAILURE(status)) { acpi_ut_delete_generic_state(notify_info); } } else { /* There is no notify handler (per-device or system) for this device */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No notify handler for Notify (%4.4s, %X) node %p\n", acpi_ut_get_node_name(node), notify_value, node)); } return (status); }
acpi_status acpi_ev_queue_notify_request(struct acpi_namespace_node *node, u32 notify_value) { union acpi_operand_object *obj_desc; union acpi_operand_object *handler_list_head = NULL; union acpi_generic_state *info; u8 handler_list_id = 0; acpi_status status = AE_OK; ACPI_FUNCTION_NAME(ev_queue_notify_request); /* Are Notifies allowed on this object? */ if (!acpi_ev_is_notify_object(node)) { return (AE_TYPE); } /* Get the correct notify list type (System or Device) */ if (notify_value <= ACPI_MAX_SYS_NOTIFY) { handler_list_id = ACPI_SYSTEM_HANDLER_LIST; } else { handler_list_id = ACPI_DEVICE_HANDLER_LIST; } /* Get the notify object attached to the namespace Node */ obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { /* We have an attached object, Get the correct handler list */ handler_list_head = obj_desc->common_notify.notify_list[handler_list_id]; } /* * If there is no notify handler (Global or Local) * for this object, just ignore the notify */ if (!acpi_gbl_global_notify[handler_list_id].handler && !handler_list_head) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No notify handler for Notify, ignoring (%4.4s, %X) node %p\n", acpi_ut_get_node_name(node), notify_value, node)); return (AE_OK); } /* Setup notify info and schedule the notify dispatcher */ info = acpi_ut_create_generic_state(); if (!info) { return (AE_NO_MEMORY); } info->common.descriptor_type = ACPI_DESC_TYPE_STATE_NOTIFY; info->notify.node = node; info->notify.value = (u16)notify_value; info->notify.handler_list_id = handler_list_id; info->notify.handler_list_head = handler_list_head; info->notify.global = &acpi_gbl_global_notify[handler_list_id]; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Dispatching Notify on [%4.4s] (%s) Value 0x%2.2X (%s) Node %p\n", acpi_ut_get_node_name(node), acpi_ut_get_type_name(node->type), notify_value, acpi_ut_get_notify_name(notify_value, ACPI_TYPE_ANY), node)); status = acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch, info); if (ACPI_FAILURE(status)) { acpi_ut_delete_generic_state(info); } return (status); }
acpi_status acpi_ev_queue_notify_request ( struct acpi_namespace_node *node, u32 notify_value) { union acpi_operand_object *obj_desc; union acpi_operand_object *handler_obj = NULL; union acpi_generic_state *notify_info; acpi_status status = AE_OK; ACPI_FUNCTION_NAME ("ev_queue_notify_request"); /* * For value 1 (Ejection Request), some device method may need to be run. * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need to be run. * For value 0x80 (Status Change) on the power button or sleep button, * initiate soft-off or sleep operation? */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Dispatching Notify(%X) on node %p\n", notify_value, node)); switch (notify_value) { case 0: ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Re-enumerate Devices\n")); break; case 1: ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Ejection Request\n")); break; case 2: ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Device Wake\n")); break; case 0x80: ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Status Change\n")); break; default: ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unknown Notify Value: %X \n", notify_value)); break; } /* * Get the notify object attached to the NS Node */ obj_desc = acpi_ns_get_attached_object (node); if (obj_desc) { /* We have the notify object, Get the right handler */ switch (node->type) { case ACPI_TYPE_DEVICE: case ACPI_TYPE_THERMAL: case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_POWER: if (notify_value <= ACPI_MAX_SYS_NOTIFY) { handler_obj = obj_desc->common_notify.system_notify; } else { handler_obj = obj_desc->common_notify.device_notify; } break; default: /* All other types are not supported */ return (AE_TYPE); } } /* If there is any handler to run, schedule the dispatcher */ if ((acpi_gbl_system_notify.handler && (notify_value <= ACPI_MAX_SYS_NOTIFY)) || (acpi_gbl_device_notify.handler && (notify_value > ACPI_MAX_SYS_NOTIFY)) || handler_obj) { notify_info = acpi_ut_create_generic_state (); if (!notify_info) { return (AE_NO_MEMORY); } notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY; notify_info->notify.node = node; notify_info->notify.value = (u16) notify_value; notify_info->notify.handler_obj = handler_obj; status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH, acpi_ev_notify_dispatch, notify_info); if (ACPI_FAILURE (status)) { acpi_ut_delete_generic_state (notify_info); } } if (!handler_obj) { /* There is no per-device notify handler for this device */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "No notify handler for [%4.4s] node %p\n", node->name.ascii, node)); } return (status); }
acpi_status acpi_ev_queue_notify_request(struct acpi_namespace_node * node, u32 notify_value) { union acpi_operand_object *obj_desc; union acpi_operand_object *handler_obj = NULL; union acpi_generic_state *notify_info; acpi_status status = AE_OK; ACPI_FUNCTION_NAME(ev_queue_notify_request); /* * For value 3 (Ejection Request), some device method may need to be run. * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need * to be run. * For value 0x80 (Status Change) on the power button or sleep button, * initiate soft-off or sleep operation? */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Dispatching Notify(%X) on node %p\n", notify_value, node)); if (notify_value <= 7) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notify value: %s\n", acpi_notify_value_names[notify_value])); } else { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notify value: 0x%2.2X **Device Specific**\n", notify_value)); } /* Get the notify object attached to the NS Node */ obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { /* We have the notify object, Get the right handler */ switch (node->type) { case ACPI_TYPE_DEVICE: case ACPI_TYPE_THERMAL: case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_POWER: if (notify_value <= ACPI_MAX_SYS_NOTIFY) { handler_obj = obj_desc->common_notify.system_notify; } else { handler_obj = obj_desc->common_notify.device_notify; } break; default: /* All other types are not supported */ return (AE_TYPE); } } /* If there is any handler to run, schedule the dispatcher */ if ((acpi_gbl_system_notify.handler && (notify_value <= ACPI_MAX_SYS_NOTIFY)) || (acpi_gbl_device_notify.handler && (notify_value > ACPI_MAX_SYS_NOTIFY)) || handler_obj) { notify_info = acpi_ut_create_generic_state(); if (!notify_info) { return (AE_NO_MEMORY); } notify_info->common.descriptor_type = ACPI_DESC_TYPE_STATE_NOTIFY; notify_info->notify.node = node; notify_info->notify.value = (u16) notify_value; notify_info->notify.handler_obj = handler_obj; acpi_ex_relinquish_interpreter(); acpi_ev_notify_dispatch(notify_info); acpi_ex_reacquire_interpreter(); } if (!handler_obj) { /* * There is no per-device notify handler for this device. * This may or may not be a problem. */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No notify handler for Notify(%4.4s, %X) node %p\n", acpi_ut_get_node_name(node), notify_value, node)); } return (status); }