Indentation fix, cleanup.
[AROS.git] / arch / all-pc / acpica / source / components / events / evregion.c
blob278c685dae8fea8b132695fcb078d2976750c5c9
1 /******************************************************************************
3 * Module Name: evregion - Operation Region support
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
45 #define __EVREGION_C__
47 #include "acpi.h"
48 #include "accommon.h"
49 #include "acevents.h"
50 #include "acnamesp.h"
51 #include "acinterp.h"
53 #define _COMPONENT ACPI_EVENTS
54 ACPI_MODULE_NAME ("evregion")
57 extern UINT8 AcpiGbl_DefaultAddressSpaces[];
59 /* Local prototypes */
61 static void
62 AcpiEvOrphanEcRegMethod (
63 ACPI_NAMESPACE_NODE *EcDeviceNode);
65 static ACPI_STATUS
66 AcpiEvRegRun (
67 ACPI_HANDLE ObjHandle,
68 UINT32 Level,
69 void *Context,
70 void **ReturnValue);
73 /*******************************************************************************
75 * FUNCTION: AcpiEvInitializeOpRegions
77 * PARAMETERS: None
79 * RETURN: Status
81 * DESCRIPTION: Execute _REG methods for all Operation Regions that have
82 * an installed default region handler.
84 ******************************************************************************/
86 ACPI_STATUS
87 AcpiEvInitializeOpRegions (
88 void)
90 ACPI_STATUS Status;
91 UINT32 i;
94 ACPI_FUNCTION_TRACE (EvInitializeOpRegions);
97 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
98 if (ACPI_FAILURE (Status))
100 return_ACPI_STATUS (Status);
103 /* Run the _REG methods for OpRegions in each default address space */
105 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
108 * Make sure the installed handler is the DEFAULT handler. If not the
109 * default, the _REG methods will have already been run (when the
110 * handler was installed)
112 if (AcpiEvHasDefaultHandler (AcpiGbl_RootNode,
113 AcpiGbl_DefaultAddressSpaces[i]))
115 Status = AcpiEvExecuteRegMethods (AcpiGbl_RootNode,
116 AcpiGbl_DefaultAddressSpaces[i]);
120 AcpiGbl_RegMethodsExecuted = TRUE;
122 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
123 return_ACPI_STATUS (Status);
127 /*******************************************************************************
129 * FUNCTION: AcpiEvAddressSpaceDispatch
131 * PARAMETERS: RegionObj - Internal region object
132 * FieldObj - Corresponding field. Can be NULL.
133 * Function - Read or Write operation
134 * RegionOffset - Where in the region to read or write
135 * BitWidth - Field width in bits (8, 16, 32, or 64)
136 * Value - Pointer to in or out value, must be
137 * a full 64-bit integer
139 * RETURN: Status
141 * DESCRIPTION: Dispatch an address space or operation region access to
142 * a previously installed handler.
144 ******************************************************************************/
146 ACPI_STATUS
147 AcpiEvAddressSpaceDispatch (
148 ACPI_OPERAND_OBJECT *RegionObj,
149 ACPI_OPERAND_OBJECT *FieldObj,
150 UINT32 Function,
151 UINT32 RegionOffset,
152 UINT32 BitWidth,
153 UINT64 *Value)
155 ACPI_STATUS Status;
156 ACPI_ADR_SPACE_HANDLER Handler;
157 ACPI_ADR_SPACE_SETUP RegionSetup;
158 ACPI_OPERAND_OBJECT *HandlerDesc;
159 ACPI_OPERAND_OBJECT *RegionObj2;
160 void *RegionContext = NULL;
161 ACPI_CONNECTION_INFO *Context;
164 ACPI_FUNCTION_TRACE (EvAddressSpaceDispatch);
167 RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
168 if (!RegionObj2)
170 return_ACPI_STATUS (AE_NOT_EXIST);
173 /* Ensure that there is a handler associated with this region */
175 HandlerDesc = RegionObj->Region.Handler;
176 if (!HandlerDesc)
178 ACPI_ERROR ((AE_INFO,
179 "No handler for Region [%4.4s] (%p) [%s]",
180 AcpiUtGetNodeName (RegionObj->Region.Node),
181 RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
183 return_ACPI_STATUS (AE_NOT_EXIST);
186 Context = HandlerDesc->AddressSpace.Context;
189 * It may be the case that the region has never been initialized.
190 * Some types of regions require special init code
192 if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE))
194 /* This region has not been initialized yet, do it */
196 RegionSetup = HandlerDesc->AddressSpace.Setup;
197 if (!RegionSetup)
199 /* No initialization routine, exit with error */
201 ACPI_ERROR ((AE_INFO,
202 "No init routine for region(%p) [%s]",
203 RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
204 return_ACPI_STATUS (AE_NOT_EXIST);
208 * We must exit the interpreter because the region setup will
209 * potentially execute control methods (for example, the _REG method
210 * for this region)
212 AcpiExExitInterpreter ();
214 Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE,
215 Context, &RegionContext);
217 /* Re-enter the interpreter */
219 AcpiExEnterInterpreter ();
221 /* Check for failure of the Region Setup */
223 if (ACPI_FAILURE (Status))
225 ACPI_EXCEPTION ((AE_INFO, Status,
226 "During region initialization: [%s]",
227 AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
228 return_ACPI_STATUS (Status);
231 /* Region initialization may have been completed by RegionSetup */
233 if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE))
235 RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
238 * Save the returned context for use in all accesses to
239 * the handler for this particular region
241 if (!(RegionObj2->Extra.RegionContext))
243 RegionObj2->Extra.RegionContext = RegionContext;
248 /* We have everything we need, we can invoke the address space handler */
250 Handler = HandlerDesc->AddressSpace.Handler;
252 ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
253 "Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
254 &RegionObj->Region.Handler->AddressSpace, Handler,
255 ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset),
256 AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
259 * Special handling for GenericSerialBus and GeneralPurposeIo:
260 * There are three extra parameters that must be passed to the
261 * handler via the context:
262 * 1) Connection buffer, a resource template from Connection() op.
263 * 2) Length of the above buffer.
264 * 3) Actual access length from the AccessAs() op.
266 if (((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS) ||
267 (RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) &&
268 Context &&
269 FieldObj)
271 /* Get the Connection (ResourceTemplate) buffer */
273 Context->Connection = FieldObj->Field.ResourceBuffer;
274 Context->Length = FieldObj->Field.ResourceLength;
275 Context->AccessLength = FieldObj->Field.AccessLength;
278 if (!(HandlerDesc->AddressSpace.HandlerFlags &
279 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
282 * For handlers other than the default (supplied) handlers, we must
283 * exit the interpreter because the handler *might* block -- we don't
284 * know what it will do, so we can't hold the lock on the intepreter.
286 AcpiExExitInterpreter();
289 /* Call the handler */
291 Status = Handler (Function,
292 (RegionObj->Region.Address + RegionOffset), BitWidth, Value,
293 Context, RegionObj2->Extra.RegionContext);
295 if (ACPI_FAILURE (Status))
297 ACPI_EXCEPTION ((AE_INFO, Status, "Returned by Handler for [%s]",
298 AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
301 if (!(HandlerDesc->AddressSpace.HandlerFlags &
302 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
305 * We just returned from a non-default handler, we must re-enter the
306 * interpreter
308 AcpiExEnterInterpreter ();
311 return_ACPI_STATUS (Status);
315 /*******************************************************************************
317 * FUNCTION: AcpiEvDetachRegion
319 * PARAMETERS: RegionObj - Region Object
320 * AcpiNsIsLocked - Namespace Region Already Locked?
322 * RETURN: None
324 * DESCRIPTION: Break the association between the handler and the region
325 * this is a two way association.
327 ******************************************************************************/
329 void
330 AcpiEvDetachRegion(
331 ACPI_OPERAND_OBJECT *RegionObj,
332 BOOLEAN AcpiNsIsLocked)
334 ACPI_OPERAND_OBJECT *HandlerObj;
335 ACPI_OPERAND_OBJECT *ObjDesc;
336 ACPI_OPERAND_OBJECT **LastObjPtr;
337 ACPI_ADR_SPACE_SETUP RegionSetup;
338 void **RegionContext;
339 ACPI_OPERAND_OBJECT *RegionObj2;
340 ACPI_STATUS Status;
343 ACPI_FUNCTION_TRACE (EvDetachRegion);
346 RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
347 if (!RegionObj2)
349 return_VOID;
351 RegionContext = &RegionObj2->Extra.RegionContext;
353 /* Get the address handler from the region object */
355 HandlerObj = RegionObj->Region.Handler;
356 if (!HandlerObj)
358 /* This region has no handler, all done */
360 return_VOID;
363 /* Find this region in the handler's list */
365 ObjDesc = HandlerObj->AddressSpace.RegionList;
366 LastObjPtr = &HandlerObj->AddressSpace.RegionList;
368 while (ObjDesc)
370 /* Is this the correct Region? */
372 if (ObjDesc == RegionObj)
374 ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
375 "Removing Region %p from address handler %p\n",
376 RegionObj, HandlerObj));
378 /* This is it, remove it from the handler's list */
380 *LastObjPtr = ObjDesc->Region.Next;
381 ObjDesc->Region.Next = NULL; /* Must clear field */
383 if (AcpiNsIsLocked)
385 Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
386 if (ACPI_FAILURE (Status))
388 return_VOID;
392 /* Now stop region accesses by executing the _REG method */
394 Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_DISCONNECT);
395 if (ACPI_FAILURE (Status))
397 ACPI_EXCEPTION ((AE_INFO, Status, "from region _REG, [%s]",
398 AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
401 if (AcpiNsIsLocked)
403 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
404 if (ACPI_FAILURE (Status))
406 return_VOID;
411 * If the region has been activated, call the setup handler with
412 * the deactivate notification
414 if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)
416 RegionSetup = HandlerObj->AddressSpace.Setup;
417 Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE,
418 HandlerObj->AddressSpace.Context, RegionContext);
421 * RegionContext should have been released by the deactivate
422 * operation. We don't need access to it anymore here.
424 if (RegionContext)
426 *RegionContext = NULL;
429 /* Init routine may fail, Just ignore errors */
431 if (ACPI_FAILURE (Status))
433 ACPI_EXCEPTION ((AE_INFO, Status,
434 "from region handler - deactivate, [%s]",
435 AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
438 RegionObj->Region.Flags &= ~(AOPOBJ_SETUP_COMPLETE);
442 * Remove handler reference in the region
444 * NOTE: this doesn't mean that the region goes away, the region
445 * is just inaccessible as indicated to the _REG method
447 * If the region is on the handler's list, this must be the
448 * region's handler
450 RegionObj->Region.Handler = NULL;
451 AcpiUtRemoveReference (HandlerObj);
453 return_VOID;
456 /* Walk the linked list of handlers */
458 LastObjPtr = &ObjDesc->Region.Next;
459 ObjDesc = ObjDesc->Region.Next;
462 /* If we get here, the region was not in the handler's region list */
464 ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
465 "Cannot remove region %p from address handler %p\n",
466 RegionObj, HandlerObj));
468 return_VOID;
472 /*******************************************************************************
474 * FUNCTION: AcpiEvAttachRegion
476 * PARAMETERS: HandlerObj - Handler Object
477 * RegionObj - Region Object
478 * AcpiNsIsLocked - Namespace Region Already Locked?
480 * RETURN: None
482 * DESCRIPTION: Create the association between the handler and the region
483 * this is a two way association.
485 ******************************************************************************/
487 ACPI_STATUS
488 AcpiEvAttachRegion (
489 ACPI_OPERAND_OBJECT *HandlerObj,
490 ACPI_OPERAND_OBJECT *RegionObj,
491 BOOLEAN AcpiNsIsLocked)
494 ACPI_FUNCTION_TRACE (EvAttachRegion);
497 ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
498 "Adding Region [%4.4s] %p to address handler %p [%s]\n",
499 AcpiUtGetNodeName (RegionObj->Region.Node),
500 RegionObj, HandlerObj,
501 AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
503 /* Link this region to the front of the handler's list */
505 RegionObj->Region.Next = HandlerObj->AddressSpace.RegionList;
506 HandlerObj->AddressSpace.RegionList = RegionObj;
508 /* Install the region's handler */
510 if (RegionObj->Region.Handler)
512 return_ACPI_STATUS (AE_ALREADY_EXISTS);
515 RegionObj->Region.Handler = HandlerObj;
516 AcpiUtAddReference (HandlerObj);
518 return_ACPI_STATUS (AE_OK);
522 /*******************************************************************************
524 * FUNCTION: AcpiEvExecuteRegMethod
526 * PARAMETERS: RegionObj - Region object
527 * Function - Passed to _REG: On (1) or Off (0)
529 * RETURN: Status
531 * DESCRIPTION: Execute _REG method for a region
533 ******************************************************************************/
535 ACPI_STATUS
536 AcpiEvExecuteRegMethod (
537 ACPI_OPERAND_OBJECT *RegionObj,
538 UINT32 Function)
540 ACPI_EVALUATE_INFO *Info;
541 ACPI_OPERAND_OBJECT *Args[3];
542 ACPI_OPERAND_OBJECT *RegionObj2;
543 ACPI_STATUS Status;
546 ACPI_FUNCTION_TRACE (EvExecuteRegMethod);
549 RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
550 if (!RegionObj2)
552 return_ACPI_STATUS (AE_NOT_EXIST);
555 if (RegionObj2->Extra.Method_REG == NULL)
557 return_ACPI_STATUS (AE_OK);
560 /* Allocate and initialize the evaluation information block */
562 Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
563 if (!Info)
565 return_ACPI_STATUS (AE_NO_MEMORY);
568 Info->PrefixNode = RegionObj2->Extra.Method_REG;
569 Info->RelativePathname = NULL;
570 Info->Parameters = Args;
571 Info->Flags = ACPI_IGNORE_RETURN_VALUE;
574 * The _REG method has two arguments:
576 * Arg0 - Integer:
577 * Operation region space ID Same value as RegionObj->Region.SpaceId
579 * Arg1 - Integer:
580 * connection status 1 for connecting the handler, 0 for disconnecting
581 * the handler (Passed as a parameter)
583 Args[0] = AcpiUtCreateIntegerObject ((UINT64) RegionObj->Region.SpaceId);
584 if (!Args[0])
586 Status = AE_NO_MEMORY;
587 goto Cleanup1;
590 Args[1] = AcpiUtCreateIntegerObject ((UINT64) Function);
591 if (!Args[1])
593 Status = AE_NO_MEMORY;
594 goto Cleanup2;
597 Args[2] = NULL; /* Terminate list */
599 /* Execute the method, no return value */
601 ACPI_DEBUG_EXEC (
602 AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Info->PrefixNode, NULL));
604 Status = AcpiNsEvaluate (Info);
605 AcpiUtRemoveReference (Args[1]);
607 Cleanup2:
608 AcpiUtRemoveReference (Args[0]);
610 Cleanup1:
611 ACPI_FREE (Info);
612 return_ACPI_STATUS (Status);
616 /*******************************************************************************
618 * FUNCTION: AcpiEvExecuteRegMethods
620 * PARAMETERS: Node - Namespace node for the device
621 * SpaceId - The address space ID
623 * RETURN: Status
625 * DESCRIPTION: Run all _REG methods for the input Space ID;
626 * Note: assumes namespace is locked, or system init time.
628 ******************************************************************************/
630 ACPI_STATUS
631 AcpiEvExecuteRegMethods (
632 ACPI_NAMESPACE_NODE *Node,
633 ACPI_ADR_SPACE_TYPE SpaceId)
635 ACPI_STATUS Status;
638 ACPI_FUNCTION_TRACE (EvExecuteRegMethods);
642 * Run all _REG methods for all Operation Regions for this space ID. This
643 * is a separate walk in order to handle any interdependencies between
644 * regions and _REG methods. (i.e. handlers must be installed for all
645 * regions of this Space ID before we can run any _REG methods)
647 Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
648 ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL,
649 &SpaceId, NULL);
651 /* Special case for EC: handle "orphan" _REG methods with no region */
653 if (SpaceId == ACPI_ADR_SPACE_EC)
655 AcpiEvOrphanEcRegMethod (Node);
658 return_ACPI_STATUS (Status);
662 /*******************************************************************************
664 * FUNCTION: AcpiEvRegRun
666 * PARAMETERS: WalkNamespace callback
668 * DESCRIPTION: Run _REG method for region objects of the requested spaceID
670 ******************************************************************************/
672 static ACPI_STATUS
673 AcpiEvRegRun (
674 ACPI_HANDLE ObjHandle,
675 UINT32 Level,
676 void *Context,
677 void **ReturnValue)
679 ACPI_OPERAND_OBJECT *ObjDesc;
680 ACPI_NAMESPACE_NODE *Node;
681 ACPI_ADR_SPACE_TYPE SpaceId;
682 ACPI_STATUS Status;
685 SpaceId = *ACPI_CAST_PTR (ACPI_ADR_SPACE_TYPE, Context);
687 /* Convert and validate the device handle */
689 Node = AcpiNsValidateHandle (ObjHandle);
690 if (!Node)
692 return (AE_BAD_PARAMETER);
696 * We only care about regions.and objects that are allowed to have address
697 * space handlers
699 if ((Node->Type != ACPI_TYPE_REGION) &&
700 (Node != AcpiGbl_RootNode))
702 return (AE_OK);
705 /* Check for an existing internal object */
707 ObjDesc = AcpiNsGetAttachedObject (Node);
708 if (!ObjDesc)
710 /* No object, just exit */
712 return (AE_OK);
715 /* Object is a Region */
717 if (ObjDesc->Region.SpaceId != SpaceId)
719 /* This region is for a different address space, just ignore it */
721 return (AE_OK);
724 Status = AcpiEvExecuteRegMethod (ObjDesc, ACPI_REG_CONNECT);
725 return (Status);
729 /*******************************************************************************
731 * FUNCTION: AcpiEvOrphanEcRegMethod
733 * PARAMETERS: EcDeviceNode - Namespace node for an EC device
735 * RETURN: None
737 * DESCRIPTION: Execute an "orphan" _REG method that appears under the EC
738 * device. This is a _REG method that has no corresponding region
739 * within the EC device scope. The orphan _REG method appears to
740 * have been enabled by the description of the ECDT in the ACPI
741 * specification: "The availability of the region space can be
742 * detected by providing a _REG method object underneath the
743 * Embedded Controller device."
745 * To quickly access the EC device, we use the EcDeviceNode used
746 * during EC handler installation. Otherwise, we would need to
747 * perform a time consuming namespace walk, executing _HID
748 * methods to find the EC device.
750 * MUTEX: Assumes the namespace is locked
752 ******************************************************************************/
754 static void
755 AcpiEvOrphanEcRegMethod (
756 ACPI_NAMESPACE_NODE *EcDeviceNode)
758 ACPI_HANDLE RegMethod;
759 ACPI_NAMESPACE_NODE *NextNode;
760 ACPI_STATUS Status;
761 ACPI_OBJECT_LIST Args;
762 ACPI_OBJECT Objects[2];
765 ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod);
768 if (!EcDeviceNode)
770 return_VOID;
773 /* Namespace is currently locked, must release */
775 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
777 /* Get a handle to a _REG method immediately under the EC device */
779 Status = AcpiGetHandle (EcDeviceNode, METHOD_NAME__REG, &RegMethod);
780 if (ACPI_FAILURE (Status))
782 goto Exit; /* There is no _REG method present */
786 * Execute the _REG method only if there is no Operation Region in
787 * this scope with the Embedded Controller space ID. Otherwise, it
788 * will already have been executed. Note, this allows for Regions
789 * with other space IDs to be present; but the code below will then
790 * execute the _REG method with the EmbeddedControl SpaceID argument.
792 NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL);
793 while (NextNode)
795 if ((NextNode->Type == ACPI_TYPE_REGION) &&
796 (NextNode->Object) &&
797 (NextNode->Object->Region.SpaceId == ACPI_ADR_SPACE_EC))
799 goto Exit; /* Do not execute the _REG */
802 NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode);
805 /* Evaluate the _REG(EmbeddedControl,Connect) method */
807 Args.Count = 2;
808 Args.Pointer = Objects;
809 Objects[0].Type = ACPI_TYPE_INTEGER;
810 Objects[0].Integer.Value = ACPI_ADR_SPACE_EC;
811 Objects[1].Type = ACPI_TYPE_INTEGER;
812 Objects[1].Integer.Value = ACPI_REG_CONNECT;
814 Status = AcpiEvaluateObject (RegMethod, NULL, &Args, NULL);
816 Exit:
817 /* We ignore all errors from above, don't care */
819 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
820 return_VOID;