1 | #pragma once |
2 | |
3 | #include <uacpi/types.h> |
4 | #include <uacpi/status.h> |
5 | |
6 | #ifdef __cplusplus |
7 | extern "C" { |
8 | #endif |
9 | |
10 | typedef struct uacpi_namespace_node uacpi_namespace_node; |
11 | |
12 | uacpi_namespace_node *uacpi_namespace_root(void); |
13 | |
14 | typedef enum uacpi_predefined_namespace { |
15 | UACPI_PREDEFINED_NAMESPACE_ROOT = 0, |
16 | UACPI_PREDEFINED_NAMESPACE_GPE, |
17 | UACPI_PREDEFINED_NAMESPACE_PR, |
18 | UACPI_PREDEFINED_NAMESPACE_SB, |
19 | UACPI_PREDEFINED_NAMESPACE_SI, |
20 | UACPI_PREDEFINED_NAMESPACE_TZ, |
21 | UACPI_PREDEFINED_NAMESPACE_GL, |
22 | UACPI_PREDEFINED_NAMESPACE_OS, |
23 | UACPI_PREDEFINED_NAMESPACE_OSI, |
24 | UACPI_PREDEFINED_NAMESPACE_REV, |
25 | UACPI_PREDEFINED_NAMESPACE_MAX = UACPI_PREDEFINED_NAMESPACE_REV, |
26 | } uacpi_predefined_namespace; |
27 | uacpi_namespace_node *uacpi_namespace_get_predefined( |
28 | uacpi_predefined_namespace |
29 | ); |
30 | |
31 | uacpi_object *uacpi_namespace_node_get_object(const uacpi_namespace_node *node); |
32 | uacpi_object_name uacpi_namespace_node_name(const uacpi_namespace_node *node); |
33 | |
34 | uacpi_size uacpi_namespace_node_depth(const uacpi_namespace_node *node); |
35 | |
36 | uacpi_namespace_node *uacpi_namespace_node_find( |
37 | uacpi_namespace_node *parent, |
38 | const uacpi_char *path |
39 | ); |
40 | |
41 | /* |
42 | * Same as uacpi_namespace_node_find, except the search recurses upwards when |
43 | * the namepath consists of only a single nameseg. Usually, this behavior is |
44 | * only desired if resolving a namepath specified in an aml-provided object, |
45 | * such as a package element. |
46 | */ |
47 | uacpi_namespace_node *uacpi_namespace_node_resolve_from_aml_namepath( |
48 | uacpi_namespace_node *scope, |
49 | const uacpi_char *path |
50 | ); |
51 | |
52 | typedef enum uacpi_ns_iteration_decision { |
53 | // Continue to the next child of this node |
54 | UACPI_NS_ITERATION_DECISION_CONTINUE, |
55 | |
56 | /* |
57 | * Don't go any deeper, instead continue to the next peer of the |
58 | * parent node currently being iterated. |
59 | */ |
60 | UACPI_NS_ITERATION_DECISION_NEXT_PEER, |
61 | |
62 | // Abort iteration |
63 | UACPI_NS_ITERATION_DECISION_BREAK, |
64 | } uacpi_ns_iteration_decision; |
65 | |
66 | typedef uacpi_ns_iteration_decision |
67 | (*uacpi_iteration_callback)(void *user, uacpi_namespace_node *node); |
68 | |
69 | void uacpi_namespace_for_each_node_depth_first( |
70 | uacpi_namespace_node *parent, |
71 | uacpi_iteration_callback callback, |
72 | void *user |
73 | ); |
74 | |
75 | const uacpi_char *uacpi_namespace_node_generate_absolute_path( |
76 | const uacpi_namespace_node *node |
77 | ); |
78 | void uacpi_free_absolute_path(const uacpi_char *path); |
79 | |
80 | #ifdef __cplusplus |
81 | } |
82 | #endif |
83 | |