WIP FPC-III support
[linux/fpc-iii.git] / drivers / acpi / acpica / evregion.c
bloba8a4c8c9b9efaa5d0c274f9c1de12f285ba0fb58
1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2 /******************************************************************************
4 * Module Name: evregion - Operation Region support
6 * Copyright (C) 2000 - 2020, Intel Corp.
8 *****************************************************************************/
10 #include <acpi/acpi.h>
11 #include "accommon.h"
12 #include "acevents.h"
13 #include "acnamesp.h"
14 #include "acinterp.h"
16 #define _COMPONENT ACPI_EVENTS
17 ACPI_MODULE_NAME("evregion")
19 extern u8 acpi_gbl_default_address_spaces[];
21 /* Local prototypes */
23 static void
24 acpi_ev_execute_orphan_reg_method(struct acpi_namespace_node *device_node,
25 acpi_adr_space_type space_id);
27 static acpi_status
28 acpi_ev_reg_run(acpi_handle obj_handle,
29 u32 level, void *context, void **return_value);
31 /*******************************************************************************
33 * FUNCTION: acpi_ev_initialize_op_regions
35 * PARAMETERS: None
37 * RETURN: Status
39 * DESCRIPTION: Execute _REG methods for all Operation Regions that have
40 * an installed default region handler.
42 ******************************************************************************/
44 acpi_status acpi_ev_initialize_op_regions(void)
46 acpi_status status;
47 u32 i;
49 ACPI_FUNCTION_TRACE(ev_initialize_op_regions);
51 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
52 if (ACPI_FAILURE(status)) {
53 return_ACPI_STATUS(status);
56 /* Run the _REG methods for op_regions in each default address space */
58 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
60 * Make sure the installed handler is the DEFAULT handler. If not the
61 * default, the _REG methods will have already been run (when the
62 * handler was installed)
64 if (acpi_ev_has_default_handler(acpi_gbl_root_node,
65 acpi_gbl_default_address_spaces
66 [i])) {
67 acpi_ev_execute_reg_methods(acpi_gbl_root_node,
68 acpi_gbl_default_address_spaces
69 [i], ACPI_REG_CONNECT);
73 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
74 return_ACPI_STATUS(status);
77 /*******************************************************************************
79 * FUNCTION: acpi_ev_address_space_dispatch
81 * PARAMETERS: region_obj - Internal region object
82 * field_obj - Corresponding field. Can be NULL.
83 * function - Read or Write operation
84 * region_offset - Where in the region to read or write
85 * bit_width - Field width in bits (8, 16, 32, or 64)
86 * value - Pointer to in or out value, must be
87 * a full 64-bit integer
89 * RETURN: Status
91 * DESCRIPTION: Dispatch an address space or operation region access to
92 * a previously installed handler.
94 * NOTE: During early initialization, we always install the default region
95 * handlers for Memory, I/O and PCI_Config. This ensures that these operation
96 * region address spaces are always available as per the ACPI specification.
97 * This is especially needed in order to support the execution of
98 * module-level AML code during loading of the ACPI tables.
100 ******************************************************************************/
102 acpi_status
103 acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
104 union acpi_operand_object *field_obj,
105 u32 function,
106 u32 region_offset, u32 bit_width, u64 *value)
108 acpi_status status;
109 acpi_adr_space_handler handler;
110 acpi_adr_space_setup region_setup;
111 union acpi_operand_object *handler_desc;
112 union acpi_operand_object *region_obj2;
113 void *region_context = NULL;
114 struct acpi_connection_info *context;
115 acpi_physical_address address;
117 ACPI_FUNCTION_TRACE(ev_address_space_dispatch);
119 region_obj2 = acpi_ns_get_secondary_object(region_obj);
120 if (!region_obj2) {
121 return_ACPI_STATUS(AE_NOT_EXIST);
124 /* Ensure that there is a handler associated with this region */
126 handler_desc = region_obj->region.handler;
127 if (!handler_desc) {
128 ACPI_ERROR((AE_INFO,
129 "No handler for Region [%4.4s] (%p) [%s]",
130 acpi_ut_get_node_name(region_obj->region.node),
131 region_obj,
132 acpi_ut_get_region_name(region_obj->region.
133 space_id)));
135 return_ACPI_STATUS(AE_NOT_EXIST);
138 context = handler_desc->address_space.context;
141 * It may be the case that the region has never been initialized.
142 * Some types of regions require special init code
144 if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) {
146 /* This region has not been initialized yet, do it */
148 region_setup = handler_desc->address_space.setup;
149 if (!region_setup) {
151 /* No initialization routine, exit with error */
153 ACPI_ERROR((AE_INFO,
154 "No init routine for region(%p) [%s]",
155 region_obj,
156 acpi_ut_get_region_name(region_obj->region.
157 space_id)));
158 return_ACPI_STATUS(AE_NOT_EXIST);
162 * We must exit the interpreter because the region setup will
163 * potentially execute control methods (for example, the _REG method
164 * for this region)
166 acpi_ex_exit_interpreter();
168 status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
169 context, &region_context);
171 /* Re-enter the interpreter */
173 acpi_ex_enter_interpreter();
175 /* Check for failure of the Region Setup */
177 if (ACPI_FAILURE(status)) {
178 ACPI_EXCEPTION((AE_INFO, status,
179 "During region initialization: [%s]",
180 acpi_ut_get_region_name(region_obj->
181 region.
182 space_id)));
183 return_ACPI_STATUS(status);
186 /* Region initialization may have been completed by region_setup */
188 if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) {
189 region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE;
192 * Save the returned context for use in all accesses to
193 * the handler for this particular region
195 if (!(region_obj2->extra.region_context)) {
196 region_obj2->extra.region_context =
197 region_context;
202 /* We have everything we need, we can invoke the address space handler */
204 handler = handler_desc->address_space.handler;
205 address = (region_obj->region.address + region_offset);
208 * Special handling for generic_serial_bus and general_purpose_io:
209 * There are three extra parameters that must be passed to the
210 * handler via the context:
211 * 1) Connection buffer, a resource template from Connection() op
212 * 2) Length of the above buffer
213 * 3) Actual access length from the access_as() op
215 * In addition, for general_purpose_io, the Address and bit_width fields
216 * are defined as follows:
217 * 1) Address is the pin number index of the field (bit offset from
218 * the previous Connection)
219 * 2) bit_width is the actual bit length of the field (number of pins)
221 if ((region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) &&
222 context && field_obj) {
224 /* Get the Connection (resource_template) buffer */
226 context->connection = field_obj->field.resource_buffer;
227 context->length = field_obj->field.resource_length;
228 context->access_length = field_obj->field.access_length;
230 if ((region_obj->region.space_id == ACPI_ADR_SPACE_GPIO) &&
231 context && field_obj) {
233 /* Get the Connection (resource_template) buffer */
235 context->connection = field_obj->field.resource_buffer;
236 context->length = field_obj->field.resource_length;
237 context->access_length = field_obj->field.access_length;
238 address = field_obj->field.pin_number_index;
239 bit_width = field_obj->field.bit_length;
242 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
243 "Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
244 &region_obj->region.handler->address_space, handler,
245 ACPI_FORMAT_UINT64(address),
246 acpi_ut_get_region_name(region_obj->region.
247 space_id)));
249 if (!(handler_desc->address_space.handler_flags &
250 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
252 * For handlers other than the default (supplied) handlers, we must
253 * exit the interpreter because the handler *might* block -- we don't
254 * know what it will do, so we can't hold the lock on the interpreter.
256 acpi_ex_exit_interpreter();
259 /* Call the handler */
261 status = handler(function, address, bit_width, value, context,
262 region_obj2->extra.region_context);
264 if (ACPI_FAILURE(status)) {
265 ACPI_EXCEPTION((AE_INFO, status, "Returned by Handler for [%s]",
266 acpi_ut_get_region_name(region_obj->region.
267 space_id)));
270 * Special case for an EC timeout. These are seen so frequently
271 * that an additional error message is helpful
273 if ((region_obj->region.space_id == ACPI_ADR_SPACE_EC) &&
274 (status == AE_TIME)) {
275 ACPI_ERROR((AE_INFO,
276 "Timeout from EC hardware or EC device driver"));
280 if (!(handler_desc->address_space.handler_flags &
281 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
283 * We just returned from a non-default handler, we must re-enter the
284 * interpreter
286 acpi_ex_enter_interpreter();
289 return_ACPI_STATUS(status);
292 /*******************************************************************************
294 * FUNCTION: acpi_ev_detach_region
296 * PARAMETERS: region_obj - Region Object
297 * acpi_ns_is_locked - Namespace Region Already Locked?
299 * RETURN: None
301 * DESCRIPTION: Break the association between the handler and the region
302 * this is a two way association.
304 ******************************************************************************/
306 void
307 acpi_ev_detach_region(union acpi_operand_object *region_obj,
308 u8 acpi_ns_is_locked)
310 union acpi_operand_object *handler_obj;
311 union acpi_operand_object *obj_desc;
312 union acpi_operand_object *start_desc;
313 union acpi_operand_object **last_obj_ptr;
314 acpi_adr_space_setup region_setup;
315 void **region_context;
316 union acpi_operand_object *region_obj2;
317 acpi_status status;
319 ACPI_FUNCTION_TRACE(ev_detach_region);
321 region_obj2 = acpi_ns_get_secondary_object(region_obj);
322 if (!region_obj2) {
323 return_VOID;
325 region_context = &region_obj2->extra.region_context;
327 /* Get the address handler from the region object */
329 handler_obj = region_obj->region.handler;
330 if (!handler_obj) {
332 /* This region has no handler, all done */
334 return_VOID;
337 /* Find this region in the handler's list */
339 obj_desc = handler_obj->address_space.region_list;
340 start_desc = obj_desc;
341 last_obj_ptr = &handler_obj->address_space.region_list;
343 while (obj_desc) {
345 /* Is this the correct Region? */
347 if (obj_desc == region_obj) {
348 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
349 "Removing Region %p from address handler %p\n",
350 region_obj, handler_obj));
352 /* This is it, remove it from the handler's list */
354 *last_obj_ptr = obj_desc->region.next;
355 obj_desc->region.next = NULL; /* Must clear field */
357 if (acpi_ns_is_locked) {
358 status =
359 acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
360 if (ACPI_FAILURE(status)) {
361 return_VOID;
365 /* Now stop region accesses by executing the _REG method */
367 status =
368 acpi_ev_execute_reg_method(region_obj,
369 ACPI_REG_DISCONNECT);
370 if (ACPI_FAILURE(status)) {
371 ACPI_EXCEPTION((AE_INFO, status,
372 "from region _REG, [%s]",
373 acpi_ut_get_region_name
374 (region_obj->region.space_id)));
377 if (acpi_ns_is_locked) {
378 status =
379 acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
380 if (ACPI_FAILURE(status)) {
381 return_VOID;
386 * If the region has been activated, call the setup handler with
387 * the deactivate notification
389 if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) {
390 region_setup = handler_obj->address_space.setup;
391 status =
392 region_setup(region_obj,
393 ACPI_REGION_DEACTIVATE,
394 handler_obj->address_space.
395 context, region_context);
398 * region_context should have been released by the deactivate
399 * operation. We don't need access to it anymore here.
401 if (region_context) {
402 *region_context = NULL;
405 /* Init routine may fail, Just ignore errors */
407 if (ACPI_FAILURE(status)) {
408 ACPI_EXCEPTION((AE_INFO, status,
409 "from region handler - deactivate, [%s]",
410 acpi_ut_get_region_name
411 (region_obj->region.
412 space_id)));
415 region_obj->region.flags &=
416 ~(AOPOBJ_SETUP_COMPLETE);
420 * Remove handler reference in the region
422 * NOTE: this doesn't mean that the region goes away, the region
423 * is just inaccessible as indicated to the _REG method
425 * If the region is on the handler's list, this must be the
426 * region's handler
428 region_obj->region.handler = NULL;
429 acpi_ut_remove_reference(handler_obj);
431 return_VOID;
434 /* Walk the linked list of handlers */
436 last_obj_ptr = &obj_desc->region.next;
437 obj_desc = obj_desc->region.next;
439 /* Prevent infinite loop if list is corrupted */
441 if (obj_desc == start_desc) {
442 ACPI_ERROR((AE_INFO,
443 "Circular handler list in region object %p",
444 region_obj));
445 return_VOID;
449 /* If we get here, the region was not in the handler's region list */
451 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
452 "Cannot remove region %p from address handler %p\n",
453 region_obj, handler_obj));
455 return_VOID;
458 /*******************************************************************************
460 * FUNCTION: acpi_ev_attach_region
462 * PARAMETERS: handler_obj - Handler Object
463 * region_obj - Region Object
464 * acpi_ns_is_locked - Namespace Region Already Locked?
466 * RETURN: None
468 * DESCRIPTION: Create the association between the handler and the region
469 * this is a two way association.
471 ******************************************************************************/
473 acpi_status
474 acpi_ev_attach_region(union acpi_operand_object *handler_obj,
475 union acpi_operand_object *region_obj,
476 u8 acpi_ns_is_locked)
479 ACPI_FUNCTION_TRACE(ev_attach_region);
481 /* Install the region's handler */
483 if (region_obj->region.handler) {
484 return_ACPI_STATUS(AE_ALREADY_EXISTS);
487 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
488 "Adding Region [%4.4s] %p to address handler %p [%s]\n",
489 acpi_ut_get_node_name(region_obj->region.node),
490 region_obj, handler_obj,
491 acpi_ut_get_region_name(region_obj->region.
492 space_id)));
494 /* Link this region to the front of the handler's list */
496 region_obj->region.next = handler_obj->address_space.region_list;
497 handler_obj->address_space.region_list = region_obj;
498 region_obj->region.handler = handler_obj;
499 acpi_ut_add_reference(handler_obj);
501 return_ACPI_STATUS(AE_OK);
504 /*******************************************************************************
506 * FUNCTION: acpi_ev_execute_reg_method
508 * PARAMETERS: region_obj - Region object
509 * function - Passed to _REG: On (1) or Off (0)
511 * RETURN: Status
513 * DESCRIPTION: Execute _REG method for a region
515 ******************************************************************************/
517 acpi_status
518 acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
520 struct acpi_evaluate_info *info;
521 union acpi_operand_object *args[3];
522 union acpi_operand_object *region_obj2;
523 const acpi_name *reg_name_ptr =
524 ACPI_CAST_PTR(acpi_name, METHOD_NAME__REG);
525 struct acpi_namespace_node *method_node;
526 struct acpi_namespace_node *node;
527 acpi_status status;
529 ACPI_FUNCTION_TRACE(ev_execute_reg_method);
531 if (!acpi_gbl_namespace_initialized ||
532 region_obj->region.handler == NULL) {
533 return_ACPI_STATUS(AE_OK);
536 region_obj2 = acpi_ns_get_secondary_object(region_obj);
537 if (!region_obj2) {
538 return_ACPI_STATUS(AE_NOT_EXIST);
542 * Find any "_REG" method associated with this region definition.
543 * The method should always be updated as this function may be
544 * invoked after a namespace change.
546 node = region_obj->region.node->parent;
547 status =
548 acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD,
549 &method_node);
550 if (ACPI_SUCCESS(status)) {
552 * The _REG method is optional and there can be only one per
553 * region definition. This will be executed when the handler is
554 * attached or removed.
556 region_obj2->extra.method_REG = method_node;
558 if (region_obj2->extra.method_REG == NULL) {
559 return_ACPI_STATUS(AE_OK);
562 /* _REG(DISCONNECT) should be paired with _REG(CONNECT) */
564 if ((function == ACPI_REG_CONNECT &&
565 region_obj->common.flags & AOPOBJ_REG_CONNECTED) ||
566 (function == ACPI_REG_DISCONNECT &&
567 !(region_obj->common.flags & AOPOBJ_REG_CONNECTED))) {
568 return_ACPI_STATUS(AE_OK);
571 /* Allocate and initialize the evaluation information block */
573 info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
574 if (!info) {
575 return_ACPI_STATUS(AE_NO_MEMORY);
578 info->prefix_node = region_obj2->extra.method_REG;
579 info->relative_pathname = NULL;
580 info->parameters = args;
581 info->flags = ACPI_IGNORE_RETURN_VALUE;
584 * The _REG method has two arguments:
586 * arg0 - Integer:
587 * Operation region space ID Same value as region_obj->Region.space_id
589 * arg1 - Integer:
590 * connection status 1 for connecting the handler, 0 for disconnecting
591 * the handler (Passed as a parameter)
593 args[0] =
594 acpi_ut_create_integer_object((u64)region_obj->region.space_id);
595 if (!args[0]) {
596 status = AE_NO_MEMORY;
597 goto cleanup1;
600 args[1] = acpi_ut_create_integer_object((u64)function);
601 if (!args[1]) {
602 status = AE_NO_MEMORY;
603 goto cleanup2;
606 args[2] = NULL; /* Terminate list */
608 /* Execute the method, no return value */
610 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
611 (ACPI_TYPE_METHOD, info->prefix_node, NULL));
613 status = acpi_ns_evaluate(info);
614 acpi_ut_remove_reference(args[1]);
616 if (ACPI_FAILURE(status)) {
617 goto cleanup2;
620 if (function == ACPI_REG_CONNECT) {
621 region_obj->common.flags |= AOPOBJ_REG_CONNECTED;
622 } else {
623 region_obj->common.flags &= ~AOPOBJ_REG_CONNECTED;
626 cleanup2:
627 acpi_ut_remove_reference(args[0]);
629 cleanup1:
630 ACPI_FREE(info);
631 return_ACPI_STATUS(status);
634 /*******************************************************************************
636 * FUNCTION: acpi_ev_execute_reg_methods
638 * PARAMETERS: node - Namespace node for the device
639 * space_id - The address space ID
640 * function - Passed to _REG: On (1) or Off (0)
642 * RETURN: None
644 * DESCRIPTION: Run all _REG methods for the input Space ID;
645 * Note: assumes namespace is locked, or system init time.
647 ******************************************************************************/
649 void
650 acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
651 acpi_adr_space_type space_id, u32 function)
653 struct acpi_reg_walk_info info;
655 ACPI_FUNCTION_TRACE(ev_execute_reg_methods);
658 * These address spaces do not need a call to _REG, since the ACPI
659 * specification defines them as: "must always be accessible". Since
660 * they never change state (never become unavailable), no need to ever
661 * call _REG on them. Also, a data_table is not a "real" address space,
662 * so do not call _REG. September 2018.
664 if ((space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) ||
665 (space_id == ACPI_ADR_SPACE_SYSTEM_IO) ||
666 (space_id == ACPI_ADR_SPACE_DATA_TABLE)) {
667 return_VOID;
670 info.space_id = space_id;
671 info.function = function;
672 info.reg_run_count = 0;
674 ACPI_DEBUG_PRINT_RAW((ACPI_DB_NAMES,
675 " Running _REG methods for SpaceId %s\n",
676 acpi_ut_get_region_name(info.space_id)));
679 * Run all _REG methods for all Operation Regions for this space ID. This
680 * is a separate walk in order to handle any interdependencies between
681 * regions and _REG methods. (i.e. handlers must be installed for all
682 * regions of this Space ID before we can run any _REG methods)
684 (void)acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
685 ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, NULL,
686 &info, NULL);
689 * Special case for EC and GPIO: handle "orphan" _REG methods with
690 * no region.
692 if (space_id == ACPI_ADR_SPACE_EC || space_id == ACPI_ADR_SPACE_GPIO) {
693 acpi_ev_execute_orphan_reg_method(node, space_id);
696 ACPI_DEBUG_PRINT_RAW((ACPI_DB_NAMES,
697 " Executed %u _REG methods for SpaceId %s\n",
698 info.reg_run_count,
699 acpi_ut_get_region_name(info.space_id)));
701 return_VOID;
704 /*******************************************************************************
706 * FUNCTION: acpi_ev_reg_run
708 * PARAMETERS: walk_namespace callback
710 * DESCRIPTION: Run _REG method for region objects of the requested spaceID
712 ******************************************************************************/
714 static acpi_status
715 acpi_ev_reg_run(acpi_handle obj_handle,
716 u32 level, void *context, void **return_value)
718 union acpi_operand_object *obj_desc;
719 struct acpi_namespace_node *node;
720 acpi_status status;
721 struct acpi_reg_walk_info *info;
723 info = ACPI_CAST_PTR(struct acpi_reg_walk_info, context);
725 /* Convert and validate the device handle */
727 node = acpi_ns_validate_handle(obj_handle);
728 if (!node) {
729 return (AE_BAD_PARAMETER);
733 * We only care about regions and objects that are allowed to have
734 * address space handlers
736 if ((node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) {
737 return (AE_OK);
740 /* Check for an existing internal object */
742 obj_desc = acpi_ns_get_attached_object(node);
743 if (!obj_desc) {
745 /* No object, just exit */
747 return (AE_OK);
750 /* Object is a Region */
752 if (obj_desc->region.space_id != info->space_id) {
754 /* This region is for a different address space, just ignore it */
756 return (AE_OK);
759 info->reg_run_count++;
760 status = acpi_ev_execute_reg_method(obj_desc, info->function);
761 return (status);
764 /*******************************************************************************
766 * FUNCTION: acpi_ev_execute_orphan_reg_method
768 * PARAMETERS: device_node - Namespace node for an ACPI device
769 * space_id - The address space ID
771 * RETURN: None
773 * DESCRIPTION: Execute an "orphan" _REG method that appears under an ACPI
774 * device. This is a _REG method that has no corresponding region
775 * within the device's scope. ACPI tables depending on these
776 * "orphan" _REG methods have been seen for both EC and GPIO
777 * Operation Regions. Presumably the Windows ACPI implementation
778 * always calls the _REG method independent of the presence of
779 * an actual Operation Region with the correct address space ID.
781 * MUTEX: Assumes the namespace is locked
783 ******************************************************************************/
785 static void
786 acpi_ev_execute_orphan_reg_method(struct acpi_namespace_node *device_node,
787 acpi_adr_space_type space_id)
789 acpi_handle reg_method;
790 struct acpi_namespace_node *next_node;
791 acpi_status status;
792 struct acpi_object_list args;
793 union acpi_object objects[2];
795 ACPI_FUNCTION_TRACE(ev_execute_orphan_reg_method);
797 if (!device_node) {
798 return_VOID;
801 /* Namespace is currently locked, must release */
803 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
805 /* Get a handle to a _REG method immediately under the EC device */
807 status = acpi_get_handle(device_node, METHOD_NAME__REG, &reg_method);
808 if (ACPI_FAILURE(status)) {
809 goto exit; /* There is no _REG method present */
813 * Execute the _REG method only if there is no Operation Region in
814 * this scope with the Embedded Controller space ID. Otherwise, it
815 * will already have been executed. Note, this allows for Regions
816 * with other space IDs to be present; but the code below will then
817 * execute the _REG method with the embedded_control space_ID argument.
819 next_node = acpi_ns_get_next_node(device_node, NULL);
820 while (next_node) {
821 if ((next_node->type == ACPI_TYPE_REGION) &&
822 (next_node->object) &&
823 (next_node->object->region.space_id == space_id)) {
824 goto exit; /* Do not execute the _REG */
827 next_node = acpi_ns_get_next_node(device_node, next_node);
830 /* Evaluate the _REG(space_id,Connect) method */
832 args.count = 2;
833 args.pointer = objects;
834 objects[0].type = ACPI_TYPE_INTEGER;
835 objects[0].integer.value = space_id;
836 objects[1].type = ACPI_TYPE_INTEGER;
837 objects[1].integer.value = ACPI_REG_CONNECT;
839 (void)acpi_evaluate_object(reg_method, NULL, &args, NULL);
841 exit:
842 /* We ignore all errors from above, don't care */
844 (void)acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
845 return_VOID;