ReactOS 0.4.17-dev-683-g0dafdc5
opregion.c
Go to the documentation of this file.
1#include <uacpi/kernel_api.h>
2
10
11#ifndef UACPI_BAREBONES_MODE
12
14
16{
18}
19
21{
23}
24
27)
28{
29 const uacpi_char *path, *space_string = "<unknown>";
31
33
36 );
38 space_string = uacpi_address_space_to_string(obj->op_region->space);
39
41 "%s (%s) operation region %s: %s",
42 message, space_string, path, uacpi_status_to_string(ret)
43 );
45}
46
47static void trace_region_io(
50)
51{
52 const uacpi_char *path;
53 const uacpi_char *type_str;
54
56 return;
57
58 switch (op) {
60 type_str = "read from";
61 break;
63 type_str = "write to";
64 break;
65 default:
66 type_str = "<INVALID-OP>";
67 }
68
70
71 switch (space) {
76 "write-then-read from [%s] %s[0x%016"UACPI_PRIX64"] = "
77 "<buffer of %zu bytes>", path,
79 UACPI_FMT64(offset), data.buffer.length
80 );
81 break;
85 "%s [%s] %s[0x%016"UACPI_PRIX64"] = "
86 "<buffer of %zu bytes>", type_str, path,
88 UACPI_FMT64(offset), data.buffer.length
89 );
90 break;
93 "%s [%s] %s pins[%u..%u] = 0x%"UACPI_PRIX64,
95 field->pin_offset, (field->pin_offset + field->bit_length) - 1,
96 UACPI_FMT64(*data.integer)
97 );
98 break;
99 default:
101 "%s [%s] (%d bytes) %s[0x%016"UACPI_PRIX64"] = 0x%"UACPI_PRIX64,
102 type_str, path, field->access_width_bytes,
105 );
106 break;
107 }
108
110}
111
113{
117 return UACPI_FALSE;
118
119 return UACPI_TRUE;
120}
121
123 uacpi_namespace_node *node, uacpi_u8 connection_code
124)
125{
127 uacpi_namespace_node *reg_node;
128 uacpi_object_array method_args;
129 uacpi_object *reg_obj, *args[2];
130
132 node->parent, "_REG", UACPI_SHOULD_LOCK_NO,
134 );
136 return ret;
137
140 );
141 if (uacpi_unlikely(reg_obj == UACPI_NULL))
142 return UACPI_STATUS_OK;
143
145 if (uacpi_unlikely(args[0] == UACPI_NULL))
147
149 if (uacpi_unlikely(args[1] == UACPI_NULL)) {
152 }
153
155 args[1]->integer = connection_code;
156 method_args.objects = args;
157 method_args.count = 2;
158
160 reg_node, reg_obj->method, &method_args, UACPI_NULL
161 );
163 uacpi_trace_region_error(node, "error during _REG execution for", ret);
164
167 return ret;
168}
169
172)
173{
175
176 if (node == uacpi_namespace_root())
177 return g_uacpi_rt_ctx.root_object->address_space_handlers;
178
180 if (uacpi_unlikely(object == UACPI_NULL))
181 return UACPI_NULL;
182
183 switch (object->type) {
187 return object->address_space_handlers;
188 default:
189 return UACPI_NULL;
190 }
191}
192
196)
197{
199
200 while (handler) {
201 if (handler->space == space)
202 return handler;
203
204 handler = handler->next;
205 }
206
207 return UACPI_NULL;
208}
209
212)
213{
216
217 if (parent == region)
218 // This is the last attached region, it has no previous link
219 return region;
220
221 while (parent->next != region) {
222 parent = parent->next;
223
225 return UACPI_NULL;
226 }
227
228 return parent;
229}
230
232{
237 uacpi_region_attach_data attach_data = { 0 };
238
241
244 );
247
248 region = obj->op_region;
249
250 if (region->handler == UACPI_NULL)
253 return UACPI_STATUS_OK;
254
255 handler = region->handler;
256 attach_data.region_node = node;
257
258 switch (region->space) {
260 if (region->length) {
264 }
265
266 attach_data.pcc_info.buffer.bytes = region->internal_buffer;
267 attach_data.pcc_info.buffer.length = region->length;
268 attach_data.pcc_info.subspace_id = region->offset;
269 break;
271 attach_data.gpio_info.num_pins = region->length;
272 break;
273 default:
274 attach_data.generic_info.base = region->offset;
275 attach_data.generic_info.length = region->length;
276 break;
277 }
278
279 attach_data.handler_context = handler->user_context;
280
283 ret = handler->callback(UACPI_REGION_OP_ATTACH, &attach_data);
285
288 return ret;
289 }
290
292 region->user_context = attach_data.out_region_context;
294 return ret;
295}
296
299)
300{
302
304 region->handler = handler;
306
307 region->next = handler->regions;
308 handler->regions = region;
309}
310
311enum unreg {
314};
315
318)
319{
324
327 );
329 return;
330
331 region = obj->op_region;
332
333 handler = region->handler;
334 if (handler == UACPI_NULL)
335 return;
336
339 uacpi_error("operation region @%p not in the handler@%p list(?)",
340 region, handler);
341 goto out;
342 } else if (link == region) {
343 link = link->next;
344 handler->regions = link;
345 } else {
346 link->next = region->next;
347 }
348
349out:
351 uacpi_region_detach_data detach_data = { 0 };
352
353 detach_data.region_node = node;
354 detach_data.region_context = region->user_context;
355 detach_data.handler_context = handler->user_context;
356
359
360 ret = handler->callback(UACPI_REGION_OP_DETACH, &detach_data);
361
364
367 node, "error during handler detach for", ret
368 );
369 }
370 }
371
373 unreg == UNREG_YES) {
375 region->state_flags &= ~UACPI_OP_REGION_STATE_REG_EXECUTED;
376 }
377
379 region->handler = UACPI_NULL;
380 region->state_flags &= ~UACPI_OP_REGION_STATE_ATTACHED;
381}
382
384{
386
387 /*
388 * Drop the namespace lock, and reacquire it after the opregion lock
389 * so we keep the ordering with user API.
390 */
392
395 return ret;
396}
397
399{
401}
402
404{
406 return;
407
409
411}
412
415)
416{
418}
419
423};
424
428};
429
432)
433{
434 struct opregion_iter_ctx *ctx = opaque;
437
439
442 uacpi_operation_region *region = object->op_region;
443
444 if (region->space != ctx->handler->space)
446
447 if (ctx->action == OPREGION_ITER_ACTION_INSTALL) {
448 if (region->handler)
450
452 } else {
453 if (uacpi_unlikely(region->handler != ctx->handler)) {
455 node, "handler mismatch for",
457 );
459 }
460
462 }
463
465 }
466
468 if (handlers == UACPI_NULL)
470
471 // Device already has a handler for this space installed
472 if (find_handler(handlers, ctx->handler->space) != UACPI_NULL)
474
476}
477
483};
484
487)
488{
489 struct reg_run_ctx *ctx = opaque;
492 uacpi_bool was_regged;
493
495
497
498 if (region->space != ctx->space)
500
501 was_regged = region->state_flags & UACPI_OP_REGION_STATE_REG_EXECUTED;
502 if (was_regged == (ctx->connection_code == ACPI_REG_CONNECT))
504
505 ret = region_run_reg(node, ctx->connection_code);
506 if (ctx->connection_code == ACPI_REG_DISCONNECT)
507 region->state_flags &= ~UACPI_OP_REGION_STATE_REG_EXECUTED;
508
511
512 if (ctx->connection_code == ACPI_REG_CONNECT)
514
515 ctx->reg_executed++;
516
518 ctx->reg_errors++;
520 }
521
523}
524
528)
529{
531 uacpi_bool is_connect;
532 enum uacpi_permanent_only perm_only;
533 struct reg_run_ctx ctx = { 0 };
534
535 ctx.space = space;
536 ctx.connection_code = connection_code;
537
541
542 is_connect = connection_code == ACPI_REG_CONNECT;
543 if (uacpi_unlikely(is_connect &&
546
547 /*
548 * We want to unreg non-permanent opregions as well, however,
549 * registering them is handled separately and should not be
550 * done by us.
551 */
552 perm_only = is_connect ? UACPI_PERMANENT_ONLY_YES : UACPI_PERMANENT_ONLY_NO;
553
555 device_node, do_run_reg, UACPI_NULL,
557 UACPI_SHOULD_LOCK_NO, perm_only, &ctx
558 );
559
561 "%sactivated all '%s' opregions controlled by '%.4s', "
562 "%zu _REG() calls (%zu errors)",
563 connection_code == ACPI_REG_CONNECT ? "" : "de",
565 device_node->name.text, ctx.reg_executed, ctx.reg_errors
566 );
567 return UACPI_STATUS_OK;
568}
569
572)
573{
574 uacpi_object *handlers_obj;
575
576 if (node == uacpi_namespace_root())
577 return g_uacpi_rt_ctx.root_object->address_space_handlers;
578
580 node,
583 );
584 if (uacpi_unlikely(handlers_obj == UACPI_NULL))
585 return UACPI_NULL;
586
587 return handlers_obj->address_space_handlers;
588}
589
591 uacpi_namespace_node *device_node,
593)
594{
596
598
600 return UACPI_STATUS_OK;
601
604 return ret;
605
609 return ret;
610 }
611
612 if (uacpi_unlikely(extract_handlers(device_node) == UACPI_NULL)) {
614 goto out;
615 }
616
618
619out:
622 return ret;
623}
624
629)
630{
633 uacpi_address_space_handler *this_handler, *new_handler;
634 struct opregion_iter_ctx iter_ctx;
635
638 return ret;
639
643 return ret;
644 }
645
646 handlers = extract_handlers(device_node);
649 goto out;
650 }
651
652 this_handler = find_handler(handlers, space);
653 if (this_handler != UACPI_NULL) {
655 goto out;
656 }
657
658 new_handler = uacpi_kernel_alloc(sizeof(*new_handler));
659 if (new_handler == UACPI_NULL) {
661 goto out;
662 }
663 uacpi_shareable_init(new_handler);
664
665 new_handler->next = handlers->head;
666 new_handler->space = space;
667 new_handler->user_context = handler_context;
668 new_handler->callback = handler;
669 new_handler->regions = UACPI_NULL;
670 new_handler->flags = flags;
671 handlers->head = new_handler;
672
673 iter_ctx.handler = new_handler;
675
679 UACPI_PERMANENT_ONLY_YES, &iter_ctx
680 );
681
683 goto out;
684
685 /*
686 * Installing an early address space handler, obviously not possible to
687 * execute any _REG methods here. Just return and hope that it is either
688 * a global address space handler, or a handler installed by a user who
689 * will run uacpi_reg_all_opregions manually after loading/initializing
690 * the namespace.
691 */
693 goto out;
694
695 // Init level is NAMESPACE_INITIALIZED, so we can safely run _REG now
697 device_node, space, ACPI_REG_CONNECT
698 );
699
700out:
703 return ret;
704}
705
709)
710{
712 device_node, space, handler, handler_context, 0
713 );
714}
715
717 uacpi_namespace_node *device_node,
719)
720{
724 struct opregion_iter_ctx iter_ctx;
725
728 return ret;
729
733 return ret;
734 }
735
736 handlers = extract_handlers(device_node);
739 goto out;
740 }
741
745 goto out;
746 }
747
748 iter_ctx.handler = handler;
750
754 UACPI_PERMANENT_ONLY_NO, &iter_ctx
755 );
756
757 prev_handler = handlers->head;
758
759 // Are we the last linked handler?
760 if (prev_handler == handler) {
761 handlers->head = handler->next;
762 goto out_unreg;
763 }
764
765 // Nope, we're somewhere in the middle. Do a search.
766 while (prev_handler) {
767 if (prev_handler->next == handler) {
768 prev_handler->next = handler->next;
769 goto out;
770 }
771
772 prev_handler = prev_handler->next;
773 }
774
775out_unreg:
778
779out:
780 if (handler != UACPI_NULL)
782
785 return ret;
786}
787
789{
795
798 return ret;
799
802
803 while (parent) {
805 if (handlers != UACPI_NULL) {
807
808 if (handler != UACPI_NULL) {
811 break;
812 }
813 }
814
815 parent = parent->parent;
816 }
817
818 if (ret != UACPI_STATUS_OK)
819 goto out;
820 if (!space_needs_reg(region->space))
821 goto out;
823 goto out;
824
827
828out:
830 return ret;
831}
832
834{
835 switch (space) {
841 return UACPI_TRUE;
842 default:
843 return UACPI_FALSE;
844 }
845}
846
848{
851}
852
856)
857{
863 uacpi_u64 abs_offset, offset_end = offset;
864 uacpi_bool is_oob = UACPI_FALSE;
865 uacpi_region_op orig_op = op;
866
867 union {
875 } handler_data;
876
880 field->region, "unable to attach", ret
881 );
882 return ret;
883 }
884
887 );
890
891 region = obj->op_region;
892 space = region->space;
893 handler = region->handler;
894
895 abs_offset = region->offset + offset;
896 offset_end += field->access_width_bytes;
897
899 is_oob = region->length < offset_end || abs_offset < offset;
900 if (uacpi_unlikely(is_oob)) {
901 const uacpi_char *path;
902
905 "out-of-bounds access to opregion %s[0x%"UACPI_PRIX64"->"
906 "0x%"UACPI_PRIX64"] at 0x%"UACPI_PRIX64" (idx=%u, width=%d)",
907 path, UACPI_FMT64(region->offset),
908 UACPI_FMT64(region->offset + region->length),
909 UACPI_FMT64(abs_offset), offset, field->access_width_bytes
910 );
913 }
914
915 handler_data.rw.region_context = region->user_context;
916 handler_data.rw.handler_context = handler->user_context;
917
918 switch (region->space) {
921
922 cursor = region->internal_buffer + offset;
923
924 /*
925 * Reads from PCC just return the current contents of the internal
926 * buffer.
927 */
928 if (op == UACPI_REGION_OP_READ) {
930 data.integer, cursor, sizeof(*data.integer),
931 field->access_width_bytes
932 );
933 goto io_done;
934 }
935
936 uacpi_memcpy(cursor, data.integer, field->access_width_bytes);
937
938 /*
939 * Dispatch a PCC send command if this was a write to the command field
940 *
941 * ACPI 6.5: 14.3. Extended PCC Subspace Shared Memory Region
942 */
943 if (offset >= 12 && offset < 16) {
944 uacpi_memzero(&handler_data.pcc.buffer, sizeof(handler_data.pcc.buffer));
945 handler_data.pcc.buffer.bytes = region->internal_buffer;
946 handler_data.pcc.buffer.length = region->length;
947
949 break;
950 }
951
952 // No dispatch needed, IO is done
953 goto io_done;
954 }
956 handler_data.gpio.pin_offset = field->pin_offset;
957 handler_data.gpio.num_pins = field->bit_length;
958 handler_data.gpio.value = *data.integer;
959
961 field->connection, &handler_data.gpio.connection
962 );
964 goto io_done;
965
968 break;
970 handler_data.ipmi.in_out_message = data.buffer;
971 handler_data.ipmi.command = abs_offset;
973 break;
975 handler_data.ffixedhw.in_out_message = data.buffer;
976 handler_data.ffixedhw.command = abs_offset;
978 break;
980 handler_data.prm.in_out_message = data.buffer;
982 break;
986 field->connection, &handler_data.serial.connection
987 );
989 goto io_done;
990
991 handler_data.serial.command = abs_offset;
992 handler_data.serial.in_out_buffer = data.buffer;
993 handler_data.serial.access_attribute = field->attributes;
994
995 switch (field->attributes) {
999 handler_data.serial.access_length = field->access_length;
1000 break;
1001 default:
1002 handler_data.serial.access_length = 0;
1003 }
1004
1007 break;
1008 default:
1009 handler_data.rw.byte_width = field->access_width_bytes;
1010 handler_data.rw.offset = abs_offset;
1011 handler_data.rw.value = *data.integer;
1012 break;
1013 }
1014
1017
1018 ret = handler->callback(op, &handler_data);
1019
1022
1023io_done:
1025 uacpi_trace_region_error(field->region, "unable to perform IO", ret);
1026 return ret;
1027 }
1028
1029 if (orig_op == UACPI_REGION_OP_READ) {
1030 switch (region->space) {
1037 break;
1039 *data.integer = handler_data.gpio.value;
1040 break;
1041 default:
1042 *data.integer = handler_data.rw.value;
1043 break;
1044 }
1045 }
1046
1047 trace_region_io(field, space, abs_offset, orig_op, data);
1048 return ret;
1049}
1050
1051#endif // !UACPI_BAREBONES_MODE
#define ACPI_REG_CONNECT
Definition: actypes.h:890
#define ACPI_REG_DISCONNECT
Definition: actypes.h:889
uacpi_status uacpi_recursive_lock_deinit(struct uacpi_recursive_lock *lock)
Definition: mutex.c:268
uacpi_status uacpi_recursive_lock_init(struct uacpi_recursive_lock *lock)
Definition: mutex.c:256
uacpi_status uacpi_recursive_lock_acquire(struct uacpi_recursive_lock *lock)
Definition: mutex.c:288
uacpi_status uacpi_recursive_lock_release(struct uacpi_recursive_lock *lock)
Definition: mutex.c:308
const WCHAR * link
Definition: db.cpp:998
UINT op
Definition: effect.c:236
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7512
#define UACPI_ENSURE_INIT_LEVEL_AT_LEAST(lvl)
Definition: context.h:127
struct uacpi_runtime_context g_uacpi_rt_ctx
Definition: uacpi.c:17
static uacpi_bool uacpi_should_log(enum uacpi_log_level lvl)
Definition: context.h:95
#define UACPI_UNUSED(x)
Definition: helpers.h:7
#define uacpi_trace(...)
Definition: log.h:33
#define uacpi_error(...)
Definition: log.h:36
void uacpi_namespace_node_unref(uacpi_namespace_node *node)
Definition: namespace.c:294
uacpi_status uacpi_namespace_do_for_each_child(uacpi_namespace_node *parent, uacpi_iteration_callback descending_callback, uacpi_iteration_callback ascending_callback, uacpi_object_type_bits, uacpi_u32 max_depth, enum uacpi_should_lock, enum uacpi_permanent_only, void *user)
Definition: namespace.c:834
uacpi_status uacpi_namespace_write_unlock(void)
Definition: namespace.c:51
uacpi_object * uacpi_namespace_node_get_object_typed(const uacpi_namespace_node *node, uacpi_object_type_bits type_mask)
Definition: namespace.c:654
uacpi_permanent_only
Definition: namespace.h:88
@ UACPI_PERMANENT_ONLY_YES
Definition: namespace.h:90
@ UACPI_PERMANENT_ONLY_NO
Definition: namespace.h:89
uacpi_bool uacpi_namespace_node_is_dangling(uacpi_namespace_node *node)
Definition: namespace.c:333
uacpi_object * uacpi_namespace_node_get_object(const uacpi_namespace_node *node)
Definition: namespace.c:646
@ UACPI_SHOULD_LOCK_NO
Definition: namespace.h:94
uacpi_status uacpi_namespace_write_lock(void)
Definition: namespace.c:46
@ UACPI_MAY_SEARCH_ABOVE_PARENT_NO
Definition: namespace.h:84
uacpi_status uacpi_namespace_node_resolve(uacpi_namespace_node *scope, const uacpi_char *path, enum uacpi_should_lock, enum uacpi_may_search_above_parent, enum uacpi_permanent_only, uacpi_namespace_node **out_node)
Definition: namespace.c:491
#define uacpi_memzero(ptr, size)
Definition: stdlib.h:99
#define uacpi_kernel_alloc_zeroed
Definition: stdlib.h:127
#define uacpi_memcpy
Definition: stdlib.h:34
void uacpi_memcpy_zerout(void *dst, const void *src, uacpi_size dst_size, uacpi_size src_size)
Definition: stdlib.c:112
uacpi_object * uacpi_create_object(uacpi_object_type type)
Definition: types.c:327
#define UACPI_OP_REGION_STATE_REG_EXECUTED
Definition: types.h:111
void uacpi_address_space_handler_unref(uacpi_address_space_handler *handler)
Definition: types.c:551
#define UACPI_ADDRESS_SPACE_HANDLER_DEFAULT
Definition: types.h:73
#define UACPI_OP_REGION_STATE_ATTACHED
Definition: types.h:114
@ UACPI_LOG_TRACE
Definition: log.h:18
#define UACPI_MAX_DEPTH_ANY
Definition: namespace.h:102
const uacpi_char * uacpi_namespace_node_generate_absolute_path(const uacpi_namespace_node *node)
Definition: namespace.c:1034
uacpi_namespace_node * uacpi_namespace_root(void)
Definition: namespace.c:264
#define uacpi_likely(expr)
Definition: compiler.h:89
#define uacpi_unlikely(expr)
Definition: compiler.h:88
#define UACPI_PRIX64
Definition: types.h:61
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
uint64_t uacpi_u64
Definition: types.h:22
char uacpi_char
Definition: types.h:44
uint16_t uacpi_u16
Definition: types.h:20
#define UACPI_NULL
Definition: types.h:33
uint8_t uacpi_u8
Definition: types.h:19
#define UACPI_FMT64(val)
Definition: types.h:62
#define UACPI_TRUE
Definition: types.h:29
#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_AML_OUT_OF_BOUNDS_INDEX
Definition: status.h:40
@ 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_ALREADY_EXISTS
Definition: status.h:20
@ UACPI_STATUS_OK
Definition: status.h:11
@ UACPI_STATUS_NO_HANDLER
Definition: status.h:25
const uacpi_char * uacpi_status_to_string(uacpi_status)
Definition: uacpi.c:60
void uacpi_object_ref(uacpi_object *obj)
Definition: types.c:734
const uacpi_char * uacpi_address_space_to_string(uacpi_address_space space)
Definition: types.c:11
uacpi_iteration_decision
Definition: types.h:28
@ UACPI_ITERATION_DECISION_NEXT_PEER
Definition: types.h:39
@ UACPI_ITERATION_DECISION_CONTINUE
Definition: types.h:29
@ UACPI_OBJECT_METHOD_BIT
Definition: types.h:142
@ UACPI_OBJECT_PROCESSOR_BIT
Definition: types.h:146
@ UACPI_OBJECT_OPERATION_REGION_BIT
Definition: types.h:144
@ UACPI_OBJECT_THERMAL_ZONE_BIT
Definition: types.h:147
@ UACPI_OBJECT_ANY_BIT
Definition: types.h:152
@ UACPI_OBJECT_DEVICE_BIT
Definition: types.h:140
@ UACPI_ACCESS_ATTRIBUTE_RAW_BYTES
Definition: types.h:483
@ UACPI_ACCESS_ATTRIBUTE_RAW_PROCESS_BYTES
Definition: types.h:484
@ UACPI_ACCESS_ATTRIBUTE_BYTES
Definition: types.h:480
@ UACPI_INIT_LEVEL_NAMESPACE_LOADED
Definition: types.h:78
uacpi_status(* uacpi_region_handler)(uacpi_region_op op, uacpi_handle op_data)
Definition: types.h:511
@ UACPI_OBJECT_PROCESSOR
Definition: types.h:123
@ UACPI_OBJECT_DEVICE
Definition: types.h:117
@ UACPI_OBJECT_INTEGER
Definition: types.h:112
@ UACPI_OBJECT_OPERATION_REGION
Definition: types.h:121
@ UACPI_OBJECT_THERMAL_ZONE
Definition: types.h:124
uacpi_region_op
Definition: types.h:373
@ UACPI_REGION_OP_FFIXEDHW_COMMAND
Definition: types.h:394
@ UACPI_REGION_OP_PCC_SEND
Definition: types.h:384
@ UACPI_REGION_OP_GPIO_READ
Definition: types.h:387
@ UACPI_REGION_OP_SERIAL_WRITE
Definition: types.h:401
@ UACPI_REGION_OP_PRM_COMMAND
Definition: types.h:397
@ UACPI_REGION_OP_DETACH
Definition: types.h:377
@ UACPI_REGION_OP_GPIO_WRITE
Definition: types.h:388
@ UACPI_REGION_OP_SERIAL_READ
Definition: types.h:400
@ UACPI_REGION_OP_WRITE
Definition: types.h:381
@ UACPI_REGION_OP_READ
Definition: types.h:380
@ UACPI_REGION_OP_IPMI_COMMAND
Definition: types.h:391
@ UACPI_REGION_OP_ATTACH
Definition: types.h:375
uacpi_address_space
Definition: types.h:42
@ UACPI_ADDRESS_SPACE_IPMI
Definition: types.h:50
@ UACPI_ADDRESS_SPACE_PRM
Definition: types.h:54
@ UACPI_ADDRESS_SPACE_SYSTEM_MEMORY
Definition: types.h:43
@ UACPI_ADDRESS_SPACE_GENERAL_PURPOSE_IO
Definition: types.h:51
@ UACPI_ADDRESS_SPACE_FFIXEDHW
Definition: types.h:55
@ UACPI_ADDRESS_SPACE_TABLE_DATA
Definition: types.h:58
@ UACPI_ADDRESS_SPACE_GENERIC_SERIAL_BUS
Definition: types.h:52
@ UACPI_ADDRESS_SPACE_SYSTEM_IO
Definition: types.h:44
@ UACPI_ADDRESS_SPACE_SMBUS
Definition: types.h:47
@ UACPI_ADDRESS_SPACE_PCC
Definition: types.h:53
uacpi_status uacpi_object_get_string_or_buffer(uacpi_object *, uacpi_data_view *out)
Definition: types.c:1059
void uacpi_object_unref(uacpi_object *obj)
Definition: types.c:762
return ret
Definition: mutex.c:147
r parent
Definition: btrfs.c:3010
static xmlCharEncodingHandlerPtr * handlers
Definition: encoding.c:1380
uint32_t serial
Definition: fsck.fat.h:29
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLintptr offset
Definition: glext.h:5920
GLbitfield flags
Definition: glext.h:7161
const char cursor[]
Definition: icontest.c:13
void uacpi_free_dynamic_string(const uacpi_char *str)
Definition: utilities.c:1148
uacpi_status uacpi_execute_control_method(uacpi_namespace_node *scope, uacpi_control_method *method, const uacpi_object_array *args, uacpi_object **ret)
Definition: interpreter.c:6150
void * uacpi_kernel_alloc(uacpi_size size)
Definition: uacpiosl.c:111
static uacpi_operation_region * find_previous_region_link(uacpi_operation_region *region)
Definition: opregion.c:210
uacpi_status uacpi_install_address_space_handler_with_flags(uacpi_namespace_node *device_node, enum uacpi_address_space space, uacpi_region_handler handler, uacpi_handle handler_context, uacpi_u16 flags)
Definition: opregion.c:625
void uacpi_release_opregion_lock(void)
Definition: opregion.c:398
uacpi_status uacpi_install_address_space_handler(uacpi_namespace_node *device_node, enum uacpi_address_space space, uacpi_region_handler handler, uacpi_handle handler_context)
Definition: opregion.c:706
static void trace_region_io(uacpi_field_unit *field, uacpi_address_space space, uacpi_u64 offset, uacpi_region_op op, union uacpi_opregion_io_data data)
Definition: opregion.c:47
static uacpi_address_space_handler * find_handler(uacpi_address_space_handlers *handlers, enum uacpi_address_space space)
Definition: opregion.c:193
void uacpi_trace_region_error(uacpi_namespace_node *node, uacpi_char *message, uacpi_status ret)
Definition: opregion.c:25
uacpi_status uacpi_upgrade_to_opregion_lock(void)
Definition: opregion.c:383
uacpi_status uacpi_initialize_opregion(void)
Definition: opregion.c:15
static void region_uninstall_handler(uacpi_namespace_node *node, enum unreg unreg)
Definition: opregion.c:316
static uacpi_status reg_or_unreg_all_opregions(uacpi_namespace_node *device_node, enum uacpi_address_space space, uacpi_u8 connection_code)
Definition: opregion.c:525
static uacpi_iteration_decision do_install_or_uninstall_handler(uacpi_handle opaque, uacpi_namespace_node *node, uacpi_u32 depth)
Definition: opregion.c:430
static uacpi_bool space_needs_reg(enum uacpi_address_space space)
Definition: opregion.c:112
static uacpi_bool space_needs_bounds_checking(uacpi_address_space space)
Definition: opregion.c:847
static uacpi_address_space_handlers * extract_handlers(uacpi_namespace_node *node)
Definition: opregion.c:570
void uacpi_opregion_uninstall_handler(uacpi_namespace_node *node)
Definition: opregion.c:403
static void region_install_handler(uacpi_namespace_node *node, uacpi_address_space_handler *handler)
Definition: opregion.c:297
uacpi_status uacpi_reg_all_opregions(uacpi_namespace_node *device_node, enum uacpi_address_space space)
Definition: opregion.c:590
uacpi_status uacpi_opregion_attach(uacpi_namespace_node *node)
Definition: opregion.c:231
unreg
Definition: opregion.c:311
@ UNREG_YES
Definition: opregion.c:313
@ UNREG_NO
Definition: opregion.c:312
uacpi_address_space_handlers * uacpi_node_get_address_space_handlers(uacpi_namespace_node *node)
Definition: opregion.c:170
opregion_iter_action
Definition: opregion.c:420
@ OPREGION_ITER_ACTION_UNINSTALL
Definition: opregion.c:421
@ OPREGION_ITER_ACTION_INSTALL
Definition: opregion.c:422
static uacpi_iteration_decision do_run_reg(void *opaque, uacpi_namespace_node *node, uacpi_u32 depth)
Definition: opregion.c:485
uacpi_status uacpi_uninstall_address_space_handler(uacpi_namespace_node *device_node, enum uacpi_address_space space)
Definition: opregion.c:716
uacpi_bool uacpi_address_space_handler_is_default(uacpi_address_space_handler *handler)
Definition: opregion.c:413
struct uacpi_recursive_lock g_opregion_lock
Definition: opregion.c:13
uacpi_bool uacpi_is_buffer_access_address_space(uacpi_address_space space)
Definition: opregion.c:833
void uacpi_deinitialize_opregion(void)
Definition: opregion.c:20
static uacpi_status region_run_reg(uacpi_namespace_node *node, uacpi_u8 connection_code)
Definition: opregion.c:122
uacpi_status uacpi_dispatch_opregion_io(uacpi_field_unit *field, uacpi_u32 offset, uacpi_region_op op, union uacpi_opregion_io_data data)
Definition: opregion.c:853
uacpi_status uacpi_initialize_opregion_node(uacpi_namespace_node *node)
Definition: opregion.c:788
#define rw
Definition: rosglue.h:38
#define args
Definition: format.c:66
void uacpi_shareable_init(uacpi_handle)
Definition: shareable.c:9
uacpi_u32 uacpi_shareable_ref(uacpi_handle)
Definition: shareable.c:31
Definition: match.c:390
Definition: parser.c:44
Definition: tftpd.h:60
enum opregion_iter_action action
Definition: opregion.c:426
uacpi_address_space_handler * handler
Definition: opregion.c:427
uacpi_u8 space
Definition: opregion.c:479
uacpi_size reg_errors
Definition: opregion.c:482
uacpi_size reg_executed
Definition: opregion.c:481
uacpi_u8 connection_code
Definition: opregion.c:480
uacpi_region_handler callback
Definition: types.h:67
uacpi_handle user_context
Definition: types.h:68
struct uacpi_address_space_handler * next
Definition: types.h:69
struct uacpi_operation_region * regions
Definition: types.h:70
uacpi_size length
Definition: types.h:105
uacpi_u8 * bytes
Definition: types.h:96
uacpi_u64 num_pins
Definition: types.h:416
uacpi_object_name name
Definition: namespace.h:29
uacpi_object ** objects
Definition: types.h:290
uacpi_size count
Definition: types.h:291
uacpi_address_space_handlers * address_space_handlers
Definition: types.h:266
uacpi_control_method * method
Definition: types.h:257
uacpi_operation_region * op_region
Definition: types.h:262
uacpi_u64 offset
Definition: types.h:122
struct uacpi_operation_region * next
Definition: types.h:134
uacpi_u8 * internal_buffer
Definition: types.h:130
uacpi_u8 state_flags
Definition: types.h:121
uacpi_u16 space
Definition: types.h:120
uacpi_u64 length
Definition: types.h:123
uacpi_address_space_handler * handler
Definition: types.h:118
uacpi_handle user_context
Definition: types.h:119
uacpi_data_view buffer
Definition: types.h:410
uacpi_u8 subspace_id
Definition: types.h:411
void * out_region_context
Definition: types.h:427
uacpi_gpio_region_info gpio_info
Definition: types.h:425
uacpi_pcc_region_info pcc_info
Definition: types.h:424
uacpi_namespace_node * region_node
Definition: types.h:421
uacpi_generic_region_info generic_info
Definition: types.h:423
uacpi_namespace_node * region_node
Definition: types.h:507
uacpi_init_level uacpi_get_current_init_level(void)
Definition: uacpi.c:310
Definition: dlist.c:348
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