|
ReactOS 0.4.17-dev-684-ga6524ef
|
#include <uacpi/namespace.h>#include <uacpi/internal/namespace.h>#include <uacpi/internal/types.h>#include <uacpi/internal/stdlib.h>#include <uacpi/internal/interpreter.h>#include <uacpi/internal/opregion.h>#include <uacpi/internal/log.h>#include <uacpi/internal/utilities.h>#include <uacpi/internal/mutex.h>#include <uacpi/kernel_api.h>
Go to the source code of this file.
Macros | |
| #define | UACPI_REV_VALUE 2 |
| #define | UACPI_OS_VALUE "Microsoft Windows NT" |
| #define | MAKE_PREDEFINED(c0, c1, c2, c3) { .name.text = { c0, c1, c2, c3 } } |
Enumerations | |
| enum | action { ACTION_REACQUIRE , ACTION_PUT } |
Variables | |
| static uacpi_namespace_node | predefined_namespaces [UACPI_PREDEFINED_NAMESPACE_MAX+1] |
| static struct uacpi_rw_lock | namespace_lock |
Definition at line 17 of file namespace.c.
| #define UACPI_OS_VALUE "Microsoft Windows NT" |
Definition at line 15 of file namespace.c.
| #define UACPI_REV_VALUE 2 |
Definition at line 14 of file namespace.c.
| Enumerator | |
|---|---|
| ACTION_REACQUIRE | |
| ACTION_PUT | |
Definition at line 707 of file namespace.c.
|
static |
Definition at line 140 of file namespace.c.
Referenced by uacpi_deinitialize_namespace(), and uacpi_namespace_node_unref().
|
static |
Definition at line 56 of file namespace.c.
Referenced by uacpi_initialize_namespace().
|
static |
Definition at line 126 of file namespace.c.
Referenced by uacpi_deinitialize_namespace(), and uacpi_namespace_node_uninstall().
|
static |
Definition at line 712 of file namespace.c.
Referenced by uacpi_namespace_node_reacquire_object(), and uacpi_namespace_node_release_object().
|
static |
Definition at line 468 of file namespace.c.
Referenced by uacpi_namespace_node_resolve().
Definition at line 205 of file namespace.c.
Referenced by uacpi_state_reset().
| void uacpi_free_absolute_path | ( | const uacpi_char * | path | ) |
Definition at line 1074 of file namespace.c.
Referenced by exec_op().
| uacpi_status uacpi_initialize_namespace | ( | void | ) |
Definition at line 156 of file namespace.c.
Referenced by uacpi_initialize().
| uacpi_status uacpi_namespace_do_for_each_child | ( | uacpi_namespace_node * | node, |
| uacpi_iteration_callback | descending_callback, | ||
| uacpi_iteration_callback | ascending_callback, | ||
| uacpi_object_type_bits | type_mask, | ||
| uacpi_u32 | max_depth, | ||
| enum uacpi_should_lock | should_lock, | ||
| enum uacpi_permanent_only | permanent_only, | ||
| void * | user | ||
| ) |
Definition at line 834 of file namespace.c.
Referenced by create_gpe_block(), object_replace_child(), reg_or_unreg_all_opregions(), uacpi_events_match_post_dynamic_table_load(), uacpi_install_address_space_handler_with_flags(), uacpi_namespace_for_each_child(), uacpi_namespace_for_each_child_simple(), and uacpi_uninstall_address_space_handler().
| uacpi_status uacpi_namespace_for_each_child | ( | uacpi_namespace_node * | parent, |
| uacpi_iteration_callback | descending_callback, | ||
| uacpi_iteration_callback | ascending_callback, | ||
| uacpi_object_type_bits | type_mask, | ||
| uacpi_u32 | max_depth, | ||
| void * | user | ||
| ) |
Depth-first iterate the namespace starting at the first child of 'parent'.
'descending_callback' is invoked the first time a node is visited when walking down. 'ascending_callback' is invoked the second time a node is visited after we reach the leaf node without children and start walking up. Either of the callbacks may be NULL, but not both at the same time.
Only nodes matching 'type_mask' are passed to the callbacks.
'max_depth' is used to limit the maximum reachable depth from 'parent', where 1 is only direct children of 'parent', 2 is children of first-level children etc. Use UACPI_MAX_DEPTH_ANY or -1 to specify infinite depth.
Definition at line 948 of file namespace.c.
Referenced by uacpi_find_devices_at(), and uacpi_namespace_initialize().
| uacpi_status uacpi_namespace_for_each_child_simple | ( | uacpi_namespace_node * | parent, |
| uacpi_iteration_callback | callback, | ||
| void * | user | ||
| ) |
Depth-first iterate the namespace starting at the first child of 'parent'.
Definition at line 938 of file namespace.c.
| uacpi_namespace_node * uacpi_namespace_get_predefined | ( | enum uacpi_predefined_namespace | ns | ) |
Definition at line 269 of file namespace.c.
Referenced by do_sta_ini(), eval_sst(), initialize_gpes(), sanitize_device_and_find_gpe(), and uacpi_namespace_initialize().
| uacpi_status uacpi_namespace_node_acquire_object | ( | const uacpi_namespace_node * | node, |
| uacpi_object ** | out_obj | ||
| ) |
Definition at line 698 of file namespace.c.
| uacpi_status uacpi_namespace_node_acquire_object_typed | ( | const uacpi_namespace_node * | node, |
| uacpi_object_type_bits | type_mask, | ||
| uacpi_object ** | out_obj | ||
| ) |
Definition at line 670 of file namespace.c.
Referenced by uacpi_install_notify_handler(), uacpi_namespace_node_acquire_object(), and uacpi_uninstall_notify_handler().
| uacpi_namespace_node * uacpi_namespace_node_alloc | ( | uacpi_object_name | name | ) |
| uacpi_size uacpi_namespace_node_depth | ( | const uacpi_namespace_node * | node | ) |
Definition at line 1015 of file namespace.c.
Referenced by uacpi_namespace_node_generate_absolute_path().
| uacpi_status uacpi_namespace_node_find | ( | uacpi_namespace_node * | parent, |
| const uacpi_char * | path, | ||
| uacpi_namespace_node ** | out_node | ||
| ) |
Definition at line 623 of file namespace.c.
| uacpi_namespace_node * uacpi_namespace_node_find_sub_node | ( | uacpi_namespace_node * | parent, |
| uacpi_object_name | name | ||
| ) |
Definition at line 446 of file namespace.c.
Referenced by resolve_name_string(), and uacpi_namespace_node_resolve().
| const uacpi_char * uacpi_namespace_node_generate_absolute_path | ( | const uacpi_namespace_node * | node | ) |
Definition at line 1034 of file namespace.c.
Referenced by exec_op(), handle_notify(), trace_invalid_return_type(), trace_method_abort(), trace_named_object_lookup_or_creation_failure(), trace_region_io(), uacpi_dispatch_opregion_io(), uacpi_eval_dstate_method_template(), and uacpi_trace_region_error().
| uacpi_object * uacpi_namespace_node_get_object | ( | const uacpi_namespace_node * | node | ) |
Definition at line 646 of file namespace.c.
Referenced by do_install_or_uninstall_handler(), do_run_reg(), ensure_is_a_field_unit(), ensure_is_an_op_region(), exec_op(), handle_field_read(), namespace_node_detach_object(), region_install_handler(), region_run_reg(), uacpi_eval(), uacpi_get_namespace_node_info(), uacpi_get_pci_routing_table(), uacpi_initialize_opregion_node(), uacpi_namespace_node_acquire_object_typed(), uacpi_namespace_node_get_object_typed(), uacpi_namespace_node_is_one_of_unlocked(), uacpi_namespace_node_type_unlocked(), uacpi_node_get_address_space_handlers(), and uacpi_notify_all().
| uacpi_object * uacpi_namespace_node_get_object_typed | ( | const uacpi_namespace_node * | node, |
| uacpi_object_type_bits | type_mask | ||
| ) |
Definition at line 654 of file namespace.c.
Referenced by async_run_gpe_handler(), extract_handlers(), handle_special_field(), region_run_reg(), region_uninstall_handler(), uacpi_dispatch_opregion_io(), uacpi_field_unit_get_bit_length(), uacpi_field_unit_get_read_type(), uacpi_notify_all(), uacpi_opregion_attach(), and uacpi_trace_region_error().
| uacpi_status uacpi_namespace_node_install | ( | uacpi_namespace_node * | parent, |
| uacpi_namespace_node * | node | ||
| ) |
Definition at line 299 of file namespace.c.
Referenced by do_install_node_item(), and uacpi_initialize_namespace().
| uacpi_status uacpi_namespace_node_is | ( | const uacpi_namespace_node * | node, |
| uacpi_object_type | type, | ||
| uacpi_bool * | out | ||
| ) |
Returns UACPI_TRUE via 'out' if the type of the object stored at the namespace node matches the provided value, UACPI_FALSE otherwise.
NOTE: due to the existance of the CopyObject operator in AML, the return value of this function is subject to TOCTOU bugs.
Definition at line 825 of file namespace.c.
Referenced by eval_resource_helper(), uacpi_install_gpe_block(), uacpi_setup_gpe_for_wake(), and uacpi_uninstall_gpe_block().
| uacpi_bool uacpi_namespace_node_is_alias | ( | uacpi_namespace_node * | node | ) |
Returns UACPI_TRUE if the provided 'node' is an alias.
Definition at line 328 of file namespace.c.
Referenced by do_sta_ini().
| uacpi_bool uacpi_namespace_node_is_dangling | ( | uacpi_namespace_node * | node | ) |
Definition at line 333 of file namespace.c.
Referenced by uacpi_namespace_node_install(), uacpi_namespace_node_uninstall(), and uacpi_opregion_attach().
| uacpi_status uacpi_namespace_node_is_one_of | ( | const uacpi_namespace_node * | node, |
| uacpi_object_type_bits | type_mask, | ||
| uacpi_bool * | out | ||
| ) |
Returns UACPI_TRUE via 'out' if the type of the object stored at the namespace node matches any of the type bits in the provided value, UACPI_FALSE otherwise.
NOTE: due to the existance of the CopyObject operator in AML, the return value of this function is subject to TOCTOU bugs.
Definition at line 808 of file namespace.c.
Referenced by uacpi_namespace_node_is().
| uacpi_status uacpi_namespace_node_is_one_of_unlocked | ( | const uacpi_namespace_node * | node, |
| uacpi_object_type_bits | type_mask, | ||
| uacpi_bool * | out | ||
| ) |
Definition at line 790 of file namespace.c.
Referenced by uacpi_namespace_do_for_each_child(), uacpi_namespace_node_is_one_of(), and uacpi_namespace_node_next_typed().
| uacpi_bool uacpi_namespace_node_is_predefined | ( | uacpi_namespace_node * | node | ) |
| uacpi_bool uacpi_namespace_node_is_temporary | ( | uacpi_namespace_node * | node | ) |
Definition at line 338 of file namespace.c.
Referenced by uacpi_namespace_do_for_each_child(), uacpi_namespace_node_next_typed(), and uacpi_namespace_node_resolve().
| uacpi_object_name uacpi_namespace_node_name | ( | const uacpi_namespace_node * | node | ) |
Definition at line 752 of file namespace.c.
Referenced by async_run_gpe_handler(), uacpi_eval_cid(), uacpi_eval_hid(), uacpi_eval_uid(), and uacpi_get_namespace_node_info().
| uacpi_status uacpi_namespace_node_next | ( | uacpi_namespace_node * | parent, |
| uacpi_namespace_node ** | iter | ||
| ) |
Retrieve the next peer namespace node of '*iter', or, if '*iter' is UACPI_NULL, retrieve the first child of 'parent' instead. The resulting namespace node is stored at '*iter'.
This API can be used to implement an "iterator" version of the for_each_child helpers.
Example usage: void recurse(uacpi_namespace_node *parent) { uacpi_namespace_node *iter = UACPI_NULL;
while (uacpi_namespace_node_next(parent, &iter) == UACPI_STATUS_OK) { // Do something with iter... descending_callback(iter);
// Recurse down to walk over the children of iter recurse(iter); } }
Prefer the for_each_child family of helpers if possible instead of this API as they avoid recursion and/or the need to use dynamic data structures entirely.
Definition at line 1006 of file namespace.c.
| uacpi_status uacpi_namespace_node_next_typed | ( | uacpi_namespace_node * | parent, |
| uacpi_namespace_node ** | iter, | ||
| uacpi_object_type_bits | type_mask | ||
| ) |
Retrieve the next peer namespace node of '*iter', or, if '*iter' is UACPI_NULL, retrieve the first child of 'parent' instead. The resulting namespace node is stored at '*iter'. Only nodes which type matches one of the types set in 'type_mask' are returned.
See comment above 'uacpi_namespace_node_next' for usage examples.
Prefer the for_each_child family of helpers if possible instead of this API as they avoid recursion and/or the need to use dynamic data structures entirely.
Definition at line 960 of file namespace.c.
Referenced by uacpi_namespace_node_next().
| uacpi_namespace_node * uacpi_namespace_node_parent | ( | uacpi_namespace_node * | node | ) |
Definition at line 1027 of file namespace.c.
| uacpi_status uacpi_namespace_node_reacquire_object | ( | uacpi_object * | obj | ) |
Definition at line 740 of file namespace.c.
| uacpi_status uacpi_namespace_node_release_object | ( | uacpi_object * | obj | ) |
Definition at line 747 of file namespace.c.
Referenced by free_notification_ctx().
| uacpi_status uacpi_namespace_node_resolve | ( | uacpi_namespace_node * | parent, |
| const uacpi_char * | path, | ||
| enum uacpi_should_lock | should_lock, | ||
| enum uacpi_may_search_above_parent | may_search_above_parent, | ||
| enum uacpi_permanent_only | permanent_only, | ||
| uacpi_namespace_node ** | out_node | ||
| ) |
Definition at line 491 of file namespace.c.
Referenced by handle_load_table(), region_run_reg(), uacpi_eval(), uacpi_namespace_node_find(), and uacpi_namespace_node_resolve_from_aml_namepath().
| uacpi_status uacpi_namespace_node_resolve_from_aml_namepath | ( | uacpi_namespace_node * | scope, |
| const uacpi_char * | path, | ||
| uacpi_namespace_node ** | out_node | ||
| ) |
Same as uacpi_namespace_node_find, except the search recurses upwards when the namepath consists of only a single nameseg. Usually, this behavior is only desired if resolving a namepath specified in an aml-provided object, such as a package element.
Definition at line 634 of file namespace.c.
Referenced by uacpi_object_resolve_as_aml_namepath().
| uacpi_status uacpi_namespace_node_type | ( | const uacpi_namespace_node * | node, |
| uacpi_object_type * | out_type | ||
| ) |
Returns the type of object stored at the namespace node.
NOTE: due to the existance of the CopyObject operator in AML, the return value of this function is subject to TOCTOU bugs.
Definition at line 774 of file namespace.c.
Referenced by do_sta_ini(), and pci_region_attach().
| uacpi_status uacpi_namespace_node_type_unlocked | ( | const uacpi_namespace_node * | node, |
| uacpi_object_type * | out_type | ||
| ) |
Definition at line 757 of file namespace.c.
Referenced by uacpi_namespace_node_type().
| uacpi_status uacpi_namespace_node_uninstall | ( | uacpi_namespace_node * | node | ) |
Definition at line 349 of file namespace.c.
Referenced by call_frame_clear(), and uacpi_deinitialize_namespace().
| void uacpi_namespace_node_unref | ( | uacpi_namespace_node * | node | ) |
Definition at line 294 of file namespace.c.
Referenced by free_field_unit(), free_notification_ctx(), pop_item(), region_uninstall_handler(), and uacpi_namespace_node_uninstall().
| uacpi_status uacpi_namespace_read_lock | ( | void | ) |
Definition at line 36 of file namespace.c.
Referenced by object_mutate_refcount(), uacpi_eval(), uacpi_namespace_do_for_each_child(), uacpi_namespace_node_acquire_object_typed(), uacpi_namespace_node_is_one_of(), uacpi_namespace_node_next_typed(), uacpi_namespace_node_resolve(), and uacpi_namespace_node_type().
| uacpi_status uacpi_namespace_read_unlock | ( | void | ) |
Definition at line 41 of file namespace.c.
Referenced by object_mutate_refcount(), uacpi_eval(), uacpi_namespace_do_for_each_child(), uacpi_namespace_node_acquire_object_typed(), uacpi_namespace_node_is_one_of(), uacpi_namespace_node_next_typed(), uacpi_namespace_node_resolve(), and uacpi_namespace_node_type().
| uacpi_namespace_node * uacpi_namespace_root | ( | void | ) |
Definition at line 264 of file namespace.c.
Referenced by eval_pts(), eval_wak(), extract_handlers(), find_pci_root(), frame_reset_post_end_block(), get_slp_type_for_state(), handle_load(), handle_load_table(), object_replace_child(), resolve_name_string(), uacpi_deinitialize_namespace(), uacpi_execute_table(), uacpi_find_devices(), uacpi_initialize_namespace(), uacpi_install_default_address_space_handlers(), uacpi_install_notify_handler(), uacpi_namespace_initialize(), uacpi_namespace_node_find_sub_node(), uacpi_namespace_node_generate_absolute_path(), uacpi_namespace_node_install(), uacpi_namespace_node_resolve(), uacpi_node_get_address_space_handlers(), uacpi_set_interrupt_model(), uacpi_setup_gpe_for_wake(), and uacpi_uninstall_notify_handler().
| uacpi_status uacpi_namespace_write_lock | ( | void | ) |
Definition at line 46 of file namespace.c.
Referenced by async_run_gpe_handler(), handle_event_ctl(), handle_firmware_request(), handle_stall_or_sleep(), region_uninstall_handler(), uacpi_acquire_aml_mutex(), uacpi_deinitialize_namespace(), uacpi_dispatch_opregion_io(), uacpi_eval(), uacpi_events_match_post_dynamic_table_load(), uacpi_execute_table(), uacpi_install_address_space_handler_with_flags(), uacpi_opregion_attach(), uacpi_reg_all_opregions(), uacpi_uninstall_address_space_handler(), and uacpi_upgrade_to_opregion_lock().
| uacpi_status uacpi_namespace_write_unlock | ( | void | ) |
Definition at line 51 of file namespace.c.
Referenced by async_run_gpe_handler(), handle_event_ctl(), handle_firmware_request(), handle_stall_or_sleep(), region_uninstall_handler(), uacpi_acquire_aml_mutex(), uacpi_deinitialize_namespace(), uacpi_dispatch_opregion_io(), uacpi_eval(), uacpi_events_match_post_dynamic_table_load(), uacpi_execute_table(), uacpi_install_address_space_handler_with_flags(), uacpi_opregion_attach(), uacpi_reg_all_opregions(), uacpi_uninstall_address_space_handler(), and uacpi_upgrade_to_opregion_lock().
|
static |
Definition at line 34 of file namespace.c.
Referenced by uacpi_deinitialize_namespace(), uacpi_initialize_namespace(), uacpi_namespace_read_lock(), uacpi_namespace_read_unlock(), uacpi_namespace_write_lock(), and uacpi_namespace_write_unlock().
|
static |
Definition at line 21 of file namespace.c.
Referenced by uacpi_initialize_namespace(), uacpi_namespace_get_predefined(), uacpi_namespace_node_is_predefined(), and uacpi_namespace_root().