ReactOS 0.4.17-dev-684-ga6524ef
namespace.c
Go to the documentation of this file.
1#include <uacpi/namespace.h>
10#include <uacpi/kernel_api.h>
11
12#ifndef UACPI_BAREBONES_MODE
13
14#define UACPI_REV_VALUE 2
15#define UACPI_OS_VALUE "Microsoft Windows NT"
16
17#define MAKE_PREDEFINED(c0, c1, c2, c3) \
18 { .name.text = { c0, c1, c2, c3 } }
19
23 [UACPI_PREDEFINED_NAMESPACE_GPE] = MAKE_PREDEFINED('_', 'G', 'P', 'E'),
24 [UACPI_PREDEFINED_NAMESPACE_PR] = MAKE_PREDEFINED('_', 'P', 'R', '_'),
25 [UACPI_PREDEFINED_NAMESPACE_SB] = MAKE_PREDEFINED('_', 'S', 'B', '_'),
26 [UACPI_PREDEFINED_NAMESPACE_SI] = MAKE_PREDEFINED('_', 'S', 'I', '_'),
27 [UACPI_PREDEFINED_NAMESPACE_TZ] = MAKE_PREDEFINED('_', 'T', 'Z', '_'),
28 [UACPI_PREDEFINED_NAMESPACE_GL] = MAKE_PREDEFINED('_', 'G', 'L', '_'),
29 [UACPI_PREDEFINED_NAMESPACE_OS] = MAKE_PREDEFINED('_', 'O', 'S', '_'),
30 [UACPI_PREDEFINED_NAMESPACE_OSI] = MAKE_PREDEFINED('_', 'O', 'S', 'I'),
31 [UACPI_PREDEFINED_NAMESPACE_REV] = MAKE_PREDEFINED('_', 'R', 'E', 'V'),
32};
33
35
37{
39}
40
42{
44}
45
47{
49}
50
52{
54}
55
58)
59{
61
62 switch (ns) {
64 /*
65 * The real root object is stored in the global context, whereas the \
66 * node gets a placeholder uninitialized object instead. This is to
67 * protect against CopyObject(JUNK, \‍), so that all of the opregion and
68 * notify handlers are preserved if AML decides to do that.
69 */
71 if (uacpi_unlikely(g_uacpi_rt_ctx.root_object == UACPI_NULL))
72 return UACPI_NULL;
73
75 break;
76
80 return obj;
81
82 obj->buffer->text = uacpi_kernel_alloc(sizeof(UACPI_OS_VALUE));
83 if (uacpi_unlikely(obj->buffer->text == UACPI_NULL)) {
85 return UACPI_NULL;
86 }
87
88 obj->buffer->size = sizeof(UACPI_OS_VALUE);
89 uacpi_memcpy(obj->buffer->text, UACPI_OS_VALUE, obj->buffer->size);
90 break;
91
95 return obj;
96
97 obj->integer = UACPI_REV_VALUE;
98 break;
99
102 if (uacpi_likely(obj != UACPI_NULL)) {
103 uacpi_shareable_ref(obj->mutex);
104 g_uacpi_rt_ctx.global_lock_mutex = obj->mutex;
105 }
106 break;
107
111 return obj;
112
113 obj->method->native_call = UACPI_TRUE;
114 obj->method->handler = uacpi_osi;
115 obj->method->args = 1;
116 break;
117
118 default:
120 break;
121 }
122
123 return obj;
124}
125
127{
129
131 if (object != UACPI_NULL) {
134
135 uacpi_object_unref(node->object);
136 node->object = UACPI_NULL;
137 }
138}
139
141{
143
145 uacpi_free(node, sizeof(*node));
146 return;
147 }
148
149 node->flags = 0;
150 node->object = UACPI_NULL;
151 node->parent = UACPI_NULL;
152 node->child = UACPI_NULL;
154}
155
157{
162
165 return ret;
166
167 for (ns = 0; ns <= UACPI_PREDEFINED_NAMESPACE_MAX; ns++) {
170
174
177 );
178 if (uacpi_unlikely(node->object == UACPI_NULL)) {
181 }
182
184 }
185
188
189 /*
190 * Skip the installation of \_OSI if it was disabled by user.
191 * We still create the object, but it's not attached to the namespace.
192 */
195 continue;
196
199 );
200 }
201
202 return UACPI_STATUS_OK;
203}
204
206{
209 uacpi_u32 depth = 1;
210
212
214
215 while (depth) {
216 next = next == UACPI_NULL ? current->child : next->next;
217
218 /*
219 * The previous value of 'next' was the last child of this subtree,
220 * we can now remove the entire scope of 'current->child'
221 */
222 if (next == UACPI_NULL) {
223 depth--;
224
225 // Wipe the subtree
226 while (current->child != UACPI_NULL)
228
229 // Reset the pointers back as if this iteration never happened
230 next = current;
231 current = current->parent;
232
233 continue;
234 }
235
236 /*
237 * We have more nodes to process, proceed to the next one, either the
238 * child of the 'next' node, if one exists, or its peer
239 */
240 if (next->child) {
241 depth++;
242 current = next;
244 }
245
246 // This node has no children, move on to its peer
247 }
248
251
252 if (ret == UACPI_STATUS_OK)
254
256 g_uacpi_rt_ctx.root_object = UACPI_NULL;
257
258 uacpi_mutex_unref(g_uacpi_rt_ctx.global_lock_mutex);
259 g_uacpi_rt_ctx.global_lock_mutex = UACPI_NULL;
260
262}
263
265{
267}
268
271)
272{
274 uacpi_warn("requested invalid predefined namespace %d", ns);
275 return UACPI_NULL;
276 }
277
278 return &predefined_namespaces[ns];
279}
280
282{
284
287 return ret;
288
290 ret->name = name;
291 return ret;
292}
293
295{
297}
298
302)
303{
304 if (parent == UACPI_NULL)
306
308 uacpi_warn("attempting to install a dangling namespace node %.4s",
309 node->name.text);
311 }
312
313 if (parent->child == UACPI_NULL) {
314 parent->child = node;
315 } else {
316 uacpi_namespace_node *prev = parent->child;
317
318 while (prev->next != UACPI_NULL)
319 prev = prev->next;
320
321 prev->next = node;
322 }
323
324 node->parent = parent;
325 return UACPI_STATUS_OK;
326}
327
329{
331}
332
334{
336}
337
339{
341}
342
344{
345 return node >= &predefined_namespaces[0] &&
347}
348
350{
352
354 uacpi_warn("attempting to uninstall a dangling namespace node %.4s",
355 node->name.text);
357 }
358
359 /*
360 * The way to trigger this is as follows:
361 *
362 * Method (FOO) {
363 * // Temporary device, will be deleted upon returning from FOO
364 * Device (\BAR) {
365 * }
366 *
367 * //
368 * // Load TBL where TBL is:
369 * // Scope (\BAR) {
370 * // Name (TEST, 123)
371 * // }
372 * //
373 * Load(TBL)
374 * }
375 *
376 * In the above example, TEST is a permanent node attached by bad AML to a
377 * temporary node created inside the FOO method at \BAR. The cleanup code
378 * will attempt to remove the \BAR device upon exit from FOO, but that is
379 * no longer possible as there's now a permanent child attached to it.
380 */
381 if (uacpi_unlikely(node->child != UACPI_NULL)) {
383 "refusing to uninstall node %.4s with a child (%.4s)",
384 node->name.text, node->child->name.text
385 );
386 return UACPI_STATUS_DENIED;
387 }
388
389 /*
390 * Even though namespace_node is reference-counted it still has an 'invalid'
391 * state that is entered after it is uninstalled from the global namespace.
392 *
393 * Reference counting is only needed to combat dangling pointer issues
394 * whereas bad AML might try to prolong a local object lifetime by
395 * returning it from a method, or CopyObject it somewhere. In that case the
396 * namespace node object itself is still alive, but no longer has a valid
397 * object associated with it.
398 *
399 * Example:
400 * Method (BAD) {
401 * OperationRegion(REG, SystemMemory, 0xDEADBEEF, 4)
402 * Field (REG, AnyAcc, NoLock) {
403 * FILD, 8,
404 * }
405 *
406 * Return (RefOf(FILD))
407 * }
408 *
409 * // Local0 is now the sole owner of the 'FILD' object that under the
410 * // hood is still referencing the 'REG' operation region object from
411 * // the 'BAD' method.
412 * Local0 = DerefOf(BAD())
413 *
414 * This is done to prevent potential very deep recursion where an object
415 * frees a namespace node that frees an attached object that frees a
416 * namespace node as well as potential infinite cycles between a namespace
417 * node and an object.
418 */
420
421 prev = node->parent ? node->parent->child : UACPI_NULL;
422
423 if (prev == node) {
424 node->parent->child = node->next;
425 } else {
426 while (uacpi_likely(prev != UACPI_NULL) && prev->next != node)
427 prev = prev->next;
428
429 if (uacpi_unlikely(prev == UACPI_NULL)) {
431 "trying to uninstall a node %.4s (%p) not linked to any peer",
432 node->name.text, node
433 );
435 }
436
437 prev->next = node->next;
438 }
439
442
443 return UACPI_STATUS_OK;
444}
445
449)
450{
452
453 if (parent == UACPI_NULL)
455
456 node = parent->child;
457
458 while (node) {
459 if (node->name.id == name.id)
460 return node;
461
462 node = node->next;
463 }
464
465 return UACPI_NULL;
466}
467
469 const uacpi_char **string, uacpi_size *in_out_size
470)
471{
472 uacpi_object_name out_name;
473 const uacpi_char *cursor = *string;
474 uacpi_size offset, bytes_left = *in_out_size;
475
476 for (offset = 0; offset < 4; offset++) {
477 if (bytes_left < 1 || *cursor == '.') {
478 out_name.text[offset] = '_';
479 continue;
480 }
481
482 out_name.text[offset] = *cursor++;
483 bytes_left--;
484 }
485
486 *string = cursor;
487 *in_out_size = bytes_left;
488 return out_name;
489}
490
493 enum uacpi_should_lock should_lock,
494 enum uacpi_may_search_above_parent may_search_above_parent,
495 enum uacpi_permanent_only permanent_only,
496 uacpi_namespace_node **out_node
497)
498{
499 uacpi_namespace_node *cur_node = parent;
501 const uacpi_char *cursor = path;
502 uacpi_size bytes_left;
503 uacpi_char prev_char = 0;
504 uacpi_bool single_nameseg = UACPI_TRUE;
505
506 if (cur_node == UACPI_NULL)
507 cur_node = uacpi_namespace_root();
508
509 bytes_left = uacpi_strlen(path);
510
511 if (should_lock == UACPI_SHOULD_LOCK_YES) {
514 return ret;
515 }
516
517 for (;;) {
518 if (bytes_left == 0)
519 goto out;
520
521 switch (*cursor) {
522 case '\\':
523 single_nameseg = UACPI_FALSE;
524
525 if (prev_char == '^') {
527 goto out;
528 }
529
530 cur_node = uacpi_namespace_root();
531 break;
532 case '^':
533 single_nameseg = UACPI_FALSE;
534
535 // Tried to go behind root
536 if (uacpi_unlikely(cur_node == uacpi_namespace_root())) {
538 goto out;
539 }
540
541 cur_node = cur_node->parent;
542 break;
543 default:
544 break;
545 }
546
547 prev_char = *cursor;
548
549 switch (prev_char) {
550 case '^':
551 case '\\':
552 cursor++;
553 bytes_left--;
554 break;
555 default:
556 break;
557 }
558
559 if (prev_char != '^')
560 break;
561 }
562
563 while (bytes_left != 0) {
564 uacpi_object_name nameseg;
565
566 if (*cursor == '.') {
567 cursor++;
568 bytes_left--;
569 }
570
571 nameseg = segment_to_name(&cursor, &bytes_left);
572 if (bytes_left != 0 && single_nameseg)
573 single_nameseg = UACPI_FALSE;
574
575 cur_node = uacpi_namespace_node_find_sub_node(cur_node, nameseg);
576 if (cur_node == UACPI_NULL) {
577 if (may_search_above_parent == UACPI_MAY_SEARCH_ABOVE_PARENT_NO ||
578 !single_nameseg)
579 goto out;
580
581 parent = parent->parent;
582
583 while (parent) {
584 cur_node = uacpi_namespace_node_find_sub_node(parent, nameseg);
585 if (cur_node != UACPI_NULL)
586 goto out;
587
588 parent = parent->parent;
589 }
590
591 goto out;
592 }
593 }
594
595out:
597 uacpi_warn("invalid path '%s'", path);
598 goto out_read_unlock;
599 }
600
601 if (cur_node == UACPI_NULL) {
603 goto out_read_unlock;
604 }
605
606 if (uacpi_namespace_node_is_temporary(cur_node) &&
607 permanent_only == UACPI_PERMANENT_ONLY_YES) {
608 uacpi_warn("denying access to temporary namespace node '%.4s'",
609 cur_node->name.text);
611 goto out_read_unlock;
612 }
613
614 if (out_node != UACPI_NULL)
615 *out_node = cur_node;
616
617out_read_unlock:
618 if (should_lock == UACPI_SHOULD_LOCK_YES)
620 return ret;
621}
622
625 uacpi_namespace_node **out_node
626)
627{
631 );
632}
633
636 const uacpi_char *path,
637 uacpi_namespace_node **out_node
638)
639{
643 );
644}
645
647{
648 if (node == UACPI_NULL || node->object == UACPI_NULL)
649 return UACPI_NULL;
650
652}
653
656)
657{
659
662 return obj;
663
664 if (!uacpi_object_is_one_of(obj, type_mask))
665 return UACPI_NULL;
666
667 return obj;
668}
669
672 uacpi_object **out_obj
673)
674{
677
680 return ret;
681
683
684 if (uacpi_unlikely(obj == UACPI_NULL) ||
685 !uacpi_object_is_one_of(obj, type_mask)) {
687 goto out;
688 }
689
691 *out_obj = obj;
692
693out:
695 return ret;
696}
697
699 const uacpi_namespace_node *node, uacpi_object **out_obj
700)
701{
703 node, UACPI_OBJECT_ANY_BIT, out_obj
704 );
705}
706
707enum action {
710};
711
713 uacpi_object *obj, void (*cb)(uacpi_object*)
714)
715{
717
719 cb(obj);
720 return ret;
721 }
722
723 /*
724 * Reference objects must be (un)referenced under at least a read lock, as
725 * this requires walking down the entire reference chain and dropping each
726 * object ref-count by 1. This might race with the interpreter and
727 * object_replace_child in case an object in the chain is CopyObject'ed
728 * into.
729 */
732 return ret;
733
734 cb(obj);
735
737 return ret;
738}
739
742)
743{
745}
746
748{
750}
751
753{
754 return node->name;
755}
756
759)
760{
762
765
769
770 *out_type = obj->type;
771 return UACPI_STATUS_OK;
772}
773
776)
777{
779
782 return ret;
783
785
787 return ret;
788}
789
792)
793{
795
798
802
803 *out = uacpi_object_is_one_of(obj, type_mask);
804
805 return UACPI_STATUS_OK;
806}
807
811)
812{
814
817 return ret;
818
820
822 return ret;
823}
824
827)
828{
830 node, 1u << type, out
831 );
832}
833
836 uacpi_iteration_callback ascending_callback,
837 uacpi_object_type_bits type_mask, uacpi_u32 max_depth,
838 enum uacpi_should_lock should_lock,
839 enum uacpi_permanent_only permanent_only, void *user
840)
841{
846 uacpi_u32 depth = 1;
847
849
850 if (uacpi_unlikely(descending_callback == UACPI_NULL &&
851 ascending_callback == UACPI_NULL))
853
854 if (uacpi_unlikely(node == UACPI_NULL || max_depth == 0))
856
857 if (should_lock == UACPI_SHOULD_LOCK_YES) {
860 return ret;
861 }
862
863 if (node->child == UACPI_NULL)
864 goto out;
865
866 node = node->child;
867
868 while (depth) {
870 if (!matches) {
872 goto do_next;
873 }
874
875 if (permanent_only == UACPI_PERMANENT_ONLY_YES &&
878 goto do_next;
879 }
880
881 cb = walking_up ? ascending_callback : descending_callback;
882 if (cb != UACPI_NULL) {
883 if (should_lock == UACPI_SHOULD_LOCK_YES) {
886 return ret;
887 }
888
889 decision = cb(user, node, depth);
890 if (decision == UACPI_ITERATION_DECISION_BREAK)
891 return ret;
892
893 if (should_lock == UACPI_SHOULD_LOCK_YES) {
896 return ret;
897 }
898 } else {
900 }
901
902 do_next:
903 if (walking_up) {
904 if (node->next) {
905 node = node->next;
906 walking_up = UACPI_FALSE;
907 continue;
908 }
909
910 depth--;
911 node = node->parent;
912 continue;
913 }
914
915 switch (decision) {
917 if ((depth != max_depth) && (node->child != UACPI_NULL)) {
918 node = node->child;
919 depth++;
920 continue;
921 }
924 walking_up = UACPI_TRUE;
925 continue;
926 default:
928 goto out;
929 }
930 }
931
932out:
933 if (should_lock == UACPI_SHOULD_LOCK_YES)
935 return ret;
936}
937
940)
941{
945 );
946}
947
950 uacpi_iteration_callback ascending_callback,
951 uacpi_object_type_bits type_mask, uacpi_u32 max_depth, void *user
952)
953{
955 parent, descending_callback, ascending_callback, type_mask, max_depth,
957 );
958}
959
962 uacpi_object_type_bits type_mask
963)
964{
968
970
971 if (uacpi_unlikely(parent == UACPI_NULL && *iter == UACPI_NULL))
973
976 return ret;
977
978 node = *iter;
979 if (node == UACPI_NULL)
980 node = parent->child;
981 else
982 node = node->next;
983
984 for (; node != UACPI_NULL; node = node->next) {
986 continue;
987
989 node, type_mask, &is_one_of
990 );
992 break;
993 if (is_one_of)
994 break;
995 }
996
998 if (node == UACPI_NULL)
1000
1002 *iter = node;
1003 return ret;
1004}
1005
1008)
1009{
1012 );
1013}
1014
1016{
1017 uacpi_size depth = 0;
1018
1019 while (node->parent) {
1020 depth++;
1021 node = node->parent;
1022 }
1023
1024 return depth;
1025}
1026
1029)
1030{
1031 return node->parent;
1032}
1033
1036)
1037{
1039 uacpi_size bytes_needed;
1041
1043
1044 // \ only needs 1 byte, the rest is 4 bytes
1045 bytes_needed = 1 + (depth - 1) * sizeof(uacpi_object_name);
1046
1047 // \ and the first NAME don't need a '.', every other segment does
1048 bytes_needed += depth > 2 ? depth - 2 : 0;
1049
1050 // Null terminator
1051 bytes_needed += 1;
1052
1053 path = uacpi_kernel_alloc(bytes_needed);
1055 return path;
1056
1057 path[0] = '\\';
1058
1059 offset = bytes_needed - 1;
1060 path[offset] = '\0';
1061
1062 while (node != uacpi_namespace_root()) {
1063 offset -= sizeof(uacpi_object_name);
1064 uacpi_memcpy(&path[offset], node->name.text, sizeof(uacpi_object_name));
1065
1066 node = node->parent;
1067 if (node != uacpi_namespace_root())
1068 path[--offset] = '.';
1069 }
1070
1071 return path;
1072}
1073
1075{
1077}
1078
1079#endif // !UACPI_BAREBONES_MODE
void user(int argc, const char *argv[])
Definition: cmds.c:1350
uacpi_status uacpi_rw_lock_deinit(struct uacpi_rw_lock *lock)
Definition: mutex.c:334
uacpi_status uacpi_rw_lock_init(struct uacpi_rw_lock *lock)
Definition: mutex.c:317
uacpi_status uacpi_rw_unlock_read(struct uacpi_rw_lock *lock)
Definition: mutex.c:372
uacpi_status uacpi_rw_unlock_write(struct uacpi_rw_lock *lock)
Definition: mutex.c:392
uacpi_status uacpi_rw_lock_read(struct uacpi_rw_lock *lock)
Definition: mutex.c:354
uacpi_status uacpi_rw_lock_write(struct uacpi_rw_lock *lock)
Definition: mutex.c:387
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
#define UACPI_ENSURE_INIT_LEVEL_AT_LEAST(lvl)
Definition: context.h:127
static uacpi_bool uacpi_check_flag(uacpi_u64 flag)
Definition: context.h:90
struct uacpi_runtime_context g_uacpi_rt_ctx
Definition: uacpi.c:17
#define uacpi_warn(...)
Definition: log.h:35
#define UACPI_NAMESPACE_NODE_FLAG_TEMPORARY
Definition: namespace.h:25
uacpi_permanent_only
Definition: namespace.h:88
@ UACPI_PERMANENT_ONLY_YES
Definition: namespace.h:90
#define UACPI_NAMESPACE_NODE_FLAG_DANGLING
Definition: namespace.h:19
#define UACPI_NAMESPACE_NODE_FLAG_ALIAS
Definition: namespace.h:10
uacpi_should_lock
Definition: namespace.h:93
@ UACPI_SHOULD_LOCK_YES
Definition: namespace.h:95
uacpi_may_search_above_parent
Definition: namespace.h:83
@ UACPI_MAY_SEARCH_ABOVE_PARENT_NO
Definition: namespace.h:84
@ UACPI_MAY_SEARCH_ABOVE_PARENT_YES
Definition: namespace.h:85
#define uacpi_kernel_alloc_zeroed
Definition: stdlib.h:127
#define uacpi_memcpy
Definition: stdlib.h:34
#define uacpi_free(mem, _)
Definition: stdlib.h:96
uacpi_size uacpi_strlen(const uacpi_char *str)
Definition: stdlib.c:72
struct uacpi_object * uacpi_create_internal_reference(enum uacpi_reference_kind kind, uacpi_object *child)
Definition: types.c:1471
uacpi_object * uacpi_create_object(uacpi_object_type type)
Definition: types.c:327
@ UACPI_REFERENCE_KIND_NAMED
Definition: types.h:14
void uacpi_mutex_unref(uacpi_mutex *)
Definition: types.c:495
uacpi_object * uacpi_unwrap_internal_reference(uacpi_object *object)
Definition: types.c:1486
uacpi_iteration_decision(* uacpi_iteration_callback)(void *user, uacpi_namespace_node *node, uacpi_u32 node_depth)
Definition: namespace.h:98
#define UACPI_MAX_DEPTH_ANY
Definition: namespace.h:102
uacpi_predefined_namespace
Definition: namespace.h:16
@ UACPI_PREDEFINED_NAMESPACE_GPE
Definition: namespace.h:18
@ UACPI_PREDEFINED_NAMESPACE_PR
Definition: namespace.h:19
@ UACPI_PREDEFINED_NAMESPACE_REV
Definition: namespace.h:26
@ UACPI_PREDEFINED_NAMESPACE_MAX
Definition: namespace.h:27
@ UACPI_PREDEFINED_NAMESPACE_ROOT
Definition: namespace.h:17
@ UACPI_PREDEFINED_NAMESPACE_OSI
Definition: namespace.h:25
@ UACPI_PREDEFINED_NAMESPACE_SB
Definition: namespace.h:20
@ UACPI_PREDEFINED_NAMESPACE_SI
Definition: namespace.h:21
@ UACPI_PREDEFINED_NAMESPACE_GL
Definition: namespace.h:23
@ UACPI_PREDEFINED_NAMESPACE_TZ
Definition: namespace.h:22
@ UACPI_PREDEFINED_NAMESPACE_OS
Definition: namespace.h:24
#define UACPI_FALLTHROUGH
Definition: compiler.h:100
#define uacpi_likely(expr)
Definition: compiler.h:89
#define uacpi_unlikely(expr)
Definition: compiler.h:88
size_t uacpi_size
Definition: types.h:37
uint32_t uacpi_u32
Definition: types.h:21
bool uacpi_bool
Definition: types.h:31
#define UACPI_FALSE
Definition: types.h:30
char uacpi_char
Definition: types.h:44
#define UACPI_NULL
Definition: types.h:33
#define UACPI_TRUE
Definition: types.h:29
#define uacpi_likely_success(expr)
Definition: status.h:53
#define uacpi_unlikely_error(expr)
Definition: status.h:49
uacpi_status
Definition: status.h:10
@ UACPI_STATUS_INVALID_ARGUMENT
Definition: status.h:18
@ UACPI_STATUS_INTERNAL_ERROR
Definition: status.h:21
@ UACPI_STATUS_NOT_FOUND
Definition: status.h:17
@ UACPI_STATUS_NAMESPACE_NODE_DANGLING
Definition: status.h:24
@ UACPI_STATUS_OUT_OF_MEMORY
Definition: status.h:13
@ UACPI_STATUS_OK
Definition: status.h:11
@ UACPI_STATUS_DENIED
Definition: status.h:31
void uacpi_object_ref(uacpi_object *obj)
Definition: types.c:734
uacpi_bool uacpi_object_is_one_of(uacpi_object *, uacpi_object_type_bits type_mask)
Definition: types.c:997
uacpi_iteration_decision
Definition: types.h:28
@ UACPI_ITERATION_DECISION_BREAK
Definition: types.h:30
@ UACPI_ITERATION_DECISION_NEXT_PEER
Definition: types.h:39
@ UACPI_ITERATION_DECISION_CONTINUE
Definition: types.h:29
uacpi_object_type_bits
Definition: types.h:134
@ UACPI_OBJECT_ANY_BIT
Definition: types.h:152
@ UACPI_INIT_LEVEL_SUBSYSTEM_INITIALIZED
Definition: types.h:72
uacpi_object_type
Definition: types.h:110
@ UACPI_OBJECT_METHOD
Definition: types.h:119
@ UACPI_OBJECT_STRING
Definition: types.h:113
@ UACPI_OBJECT_DEVICE
Definition: types.h:117
@ UACPI_OBJECT_UNINITIALIZED
Definition: types.h:111
@ UACPI_OBJECT_REFERENCE
Definition: types.h:128
@ UACPI_OBJECT_MUTEX
Definition: types.h:120
@ UACPI_OBJECT_INTEGER
Definition: types.h:112
@ UACPI_OBJECT_OPERATION_REGION
Definition: types.h:121
uacpi_bool uacpi_object_is(uacpi_object *, uacpi_object_type)
Definition: types.c:992
void uacpi_object_unref(uacpi_object *obj)
Definition: types.c:762
return ret
Definition: mutex.c:147
static uacpi_object * make_object_for_predefined(enum uacpi_predefined_namespace ns)
Definition: namespace.c:56
uacpi_bool uacpi_namespace_node_is_alias(uacpi_namespace_node *node)
Definition: namespace.c:328
void uacpi_namespace_node_unref(uacpi_namespace_node *node)
Definition: namespace.c:294
uacpi_status uacpi_namespace_write_unlock(void)
Definition: namespace.c:51
static uacpi_status object_mutate_refcount(uacpi_object *obj, void(*cb)(uacpi_object *))
Definition: namespace.c:712
uacpi_namespace_node * uacpi_namespace_node_parent(uacpi_namespace_node *node)
Definition: namespace.c:1027
uacpi_status uacpi_namespace_node_is(const uacpi_namespace_node *node, uacpi_object_type type, uacpi_bool *out)
Definition: namespace.c:825
static uacpi_object_name segment_to_name(const uacpi_char **string, uacpi_size *in_out_size)
Definition: namespace.c:468
uacpi_object * uacpi_namespace_node_get_object_typed(const uacpi_namespace_node *node, uacpi_object_type_bits type_mask)
Definition: namespace.c:654
uacpi_status uacpi_namespace_for_each_child_simple(uacpi_namespace_node *parent, uacpi_iteration_callback callback, void *user)
Definition: namespace.c:938
uacpi_namespace_node * uacpi_namespace_node_find_sub_node(uacpi_namespace_node *parent, uacpi_object_name name)
Definition: namespace.c:446
action
Definition: namespace.c:707
@ ACTION_REACQUIRE
Definition: namespace.c:708
@ ACTION_PUT
Definition: namespace.c:709
uacpi_status uacpi_namespace_node_type_unlocked(const uacpi_namespace_node *node, uacpi_object_type *out_type)
Definition: namespace.c:757
uacpi_status uacpi_namespace_node_type(const uacpi_namespace_node *node, uacpi_object_type *out_type)
Definition: namespace.c:774
void uacpi_free_absolute_path(const uacpi_char *path)
Definition: namespace.c:1074
uacpi_status uacpi_namespace_read_unlock(void)
Definition: namespace.c:41
uacpi_bool uacpi_namespace_node_is_dangling(uacpi_namespace_node *node)
Definition: namespace.c:333
const uacpi_char * uacpi_namespace_node_generate_absolute_path(const uacpi_namespace_node *node)
Definition: namespace.c:1034
uacpi_namespace_node * uacpi_namespace_get_predefined(enum uacpi_predefined_namespace ns)
Definition: namespace.c:269
#define UACPI_OS_VALUE
Definition: namespace.c:15
#define MAKE_PREDEFINED(c0, c1, c2, c3)
Definition: namespace.c:17
static void free_namespace_node(uacpi_handle handle)
Definition: namespace.c:140
uacpi_status uacpi_namespace_node_reacquire_object(uacpi_object *obj)
Definition: namespace.c:740
uacpi_object * uacpi_namespace_node_get_object(const uacpi_namespace_node *node)
Definition: namespace.c:646
uacpi_status uacpi_initialize_namespace(void)
Definition: namespace.c:156
uacpi_bool uacpi_namespace_node_is_temporary(uacpi_namespace_node *node)
Definition: namespace.c:338
uacpi_namespace_node * uacpi_namespace_node_alloc(uacpi_object_name name)
Definition: namespace.c:281
#define UACPI_REV_VALUE
Definition: namespace.c:14
uacpi_status uacpi_namespace_read_lock(void)
Definition: namespace.c:36
uacpi_size uacpi_namespace_node_depth(const uacpi_namespace_node *node)
Definition: namespace.c:1015
static struct uacpi_rw_lock namespace_lock
Definition: namespace.c:34
uacpi_status uacpi_namespace_node_release_object(uacpi_object *obj)
Definition: namespace.c:747
uacpi_status uacpi_namespace_node_is_one_of(const uacpi_namespace_node *node, uacpi_object_type_bits type_mask, uacpi_bool *out)
Definition: namespace.c:808
void uacpi_deinitialize_namespace(void)
Definition: namespace.c:205
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: namespace.c:491
uacpi_status uacpi_namespace_node_acquire_object(const uacpi_namespace_node *node, uacpi_object **out_obj)
Definition: namespace.c:698
uacpi_status uacpi_namespace_node_install(uacpi_namespace_node *parent, uacpi_namespace_node *node)
Definition: namespace.c:299
uacpi_bool uacpi_namespace_node_is_predefined(uacpi_namespace_node *node)
Definition: namespace.c:343
uacpi_status uacpi_namespace_node_uninstall(uacpi_namespace_node *node)
Definition: namespace.c:349
uacpi_status uacpi_namespace_node_is_one_of_unlocked(const uacpi_namespace_node *node, uacpi_object_type_bits type_mask, uacpi_bool *out)
Definition: namespace.c:790
uacpi_namespace_node * uacpi_namespace_root(void)
Definition: namespace.c:264
uacpi_status uacpi_namespace_node_resolve_from_aml_namepath(uacpi_namespace_node *scope, const uacpi_char *path, uacpi_namespace_node **out_node)
Definition: namespace.c:634
uacpi_status uacpi_namespace_node_next(uacpi_namespace_node *parent, uacpi_namespace_node **iter)
Definition: namespace.c:1006
uacpi_status uacpi_namespace_node_next_typed(uacpi_namespace_node *parent, uacpi_namespace_node **iter, uacpi_object_type_bits type_mask)
Definition: namespace.c:960
uacpi_status uacpi_namespace_write_lock(void)
Definition: namespace.c:46
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: namespace.c:834
uacpi_object_name uacpi_namespace_node_name(const uacpi_namespace_node *node)
Definition: namespace.c:752
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)
Definition: namespace.c:948
static void namespace_node_detach_object(uacpi_namespace_node *node)
Definition: namespace.c:126
uacpi_status uacpi_namespace_node_acquire_object_typed(const uacpi_namespace_node *node, uacpi_object_type_bits type_mask, uacpi_object **out_obj)
Definition: namespace.c:670
uacpi_status uacpi_namespace_node_find(uacpi_namespace_node *parent, const uacpi_char *path, uacpi_namespace_node **out_node)
Definition: namespace.c:623
static uacpi_namespace_node predefined_namespaces[UACPI_PREDEFINED_NAMESPACE_MAX+1]
Definition: namespace.c:21
r parent
Definition: btrfs.c:3010
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLintptr offset
Definition: glext.h:5920
const char cursor[]
Definition: icontest.c:13
void uacpi_opregion_uninstall_handler(uacpi_namespace_node *node)
Definition: opregion.c:403
void uacpi_free_dynamic_string(const uacpi_char *str)
Definition: utilities.c:1148
uacpi_status uacpi_osi(uacpi_handle handle, uacpi_object *retval)
Definition: interpreter.c:6237
void * uacpi_kernel_alloc(uacpi_size size)
Definition: uacpiosl.c:111
#define matches(FN)
Definition: match.h:70
struct task_struct * current
Definition: linux.c:32
char string[160]
Definition: util.h:11
static IPrintDialogCallback callback
Definition: printdlg.c:326
static unsigned __int64 next
Definition: rand_nt.c:6
void uacpi_shareable_init(uacpi_handle)
Definition: shareable.c:9
void uacpi_shareable_unref_and_delete_if_last(uacpi_handle, void(*do_free)(uacpi_handle))
Definition: shareable.c:51
uacpi_u32 uacpi_shareable_ref(uacpi_handle)
Definition: shareable.c:31
static uacpi_bool is_one_of(uacpi_char c, const uacpi_char *list)
Definition: stdlib.c:436
Definition: name.c:39
Definition: mxnamespace.c:38
uacpi_object_name name
Definition: namespace.h:29
struct uacpi_namespace_node * parent
Definition: namespace.h:32
struct uacpi_namespace_node * next
Definition: namespace.h:34
#define UACPI_FLAG_NO_OSI
Definition: uacpi.h:100
Definition: dlist.c:348
void * next
Definition: dlist.c:360
uacpi_char text[4]
Definition: types.h:24
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383