1a159c266SJung-uk Kim /******************************************************************************
2a159c266SJung-uk Kim *
3efcc2a30SJung-uk Kim * Module Name: evregion - Operation Region support
4a159c266SJung-uk Kim *
5a159c266SJung-uk Kim *****************************************************************************/
6a159c266SJung-uk Kim
70d84335fSJung-uk Kim /******************************************************************************
80d84335fSJung-uk Kim *
90d84335fSJung-uk Kim * 1. Copyright Notice
100d84335fSJung-uk Kim *
11*58308fadSJung-uk Kim * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.
12a159c266SJung-uk Kim * All rights reserved.
13a159c266SJung-uk Kim *
140d84335fSJung-uk Kim * 2. License
150d84335fSJung-uk Kim *
160d84335fSJung-uk Kim * 2.1. This is your license from Intel Corp. under its intellectual property
170d84335fSJung-uk Kim * rights. You may have additional license terms from the party that provided
180d84335fSJung-uk Kim * you this software, covering your right to use that party's intellectual
190d84335fSJung-uk Kim * property rights.
200d84335fSJung-uk Kim *
210d84335fSJung-uk Kim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
220d84335fSJung-uk Kim * copy of the source code appearing in this file ("Covered Code") an
230d84335fSJung-uk Kim * irrevocable, perpetual, worldwide license under Intel's copyrights in the
240d84335fSJung-uk Kim * base code distributed originally by Intel ("Original Intel Code") to copy,
250d84335fSJung-uk Kim * make derivatives, distribute, use and display any portion of the Covered
260d84335fSJung-uk Kim * Code in any form, with the right to sublicense such rights; and
270d84335fSJung-uk Kim *
280d84335fSJung-uk Kim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
290d84335fSJung-uk Kim * license (with the right to sublicense), under only those claims of Intel
300d84335fSJung-uk Kim * patents that are infringed by the Original Intel Code, to make, use, sell,
310d84335fSJung-uk Kim * offer to sell, and import the Covered Code and derivative works thereof
320d84335fSJung-uk Kim * solely to the minimum extent necessary to exercise the above copyright
330d84335fSJung-uk Kim * license, and in no event shall the patent license extend to any additions
340d84335fSJung-uk Kim * to or modifications of the Original Intel Code. No other license or right
350d84335fSJung-uk Kim * is granted directly or by implication, estoppel or otherwise;
360d84335fSJung-uk Kim *
370d84335fSJung-uk Kim * The above copyright and patent license is granted only if the following
380d84335fSJung-uk Kim * conditions are met:
390d84335fSJung-uk Kim *
400d84335fSJung-uk Kim * 3. Conditions
410d84335fSJung-uk Kim *
420d84335fSJung-uk Kim * 3.1. Redistribution of Source with Rights to Further Distribute Source.
430d84335fSJung-uk Kim * Redistribution of source code of any substantial portion of the Covered
440d84335fSJung-uk Kim * Code or modification with rights to further distribute source must include
450d84335fSJung-uk Kim * the above Copyright Notice, the above License, this list of Conditions,
460d84335fSJung-uk Kim * and the following Disclaimer and Export Compliance provision. In addition,
470d84335fSJung-uk Kim * Licensee must cause all Covered Code to which Licensee contributes to
480d84335fSJung-uk Kim * contain a file documenting the changes Licensee made to create that Covered
490d84335fSJung-uk Kim * Code and the date of any change. Licensee must include in that file the
500d84335fSJung-uk Kim * documentation of any changes made by any predecessor Licensee. Licensee
510d84335fSJung-uk Kim * must include a prominent statement that the modification is derived,
520d84335fSJung-uk Kim * directly or indirectly, from Original Intel Code.
530d84335fSJung-uk Kim *
540d84335fSJung-uk Kim * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
550d84335fSJung-uk Kim * Redistribution of source code of any substantial portion of the Covered
560d84335fSJung-uk Kim * Code or modification without rights to further distribute source must
570d84335fSJung-uk Kim * include the following Disclaimer and Export Compliance provision in the
580d84335fSJung-uk Kim * documentation and/or other materials provided with distribution. In
590d84335fSJung-uk Kim * addition, Licensee may not authorize further sublicense of source of any
600d84335fSJung-uk Kim * portion of the Covered Code, and must include terms to the effect that the
610d84335fSJung-uk Kim * license from Licensee to its licensee is limited to the intellectual
620d84335fSJung-uk Kim * property embodied in the software Licensee provides to its licensee, and
630d84335fSJung-uk Kim * not to intellectual property embodied in modifications its licensee may
640d84335fSJung-uk Kim * make.
650d84335fSJung-uk Kim *
660d84335fSJung-uk Kim * 3.3. Redistribution of Executable. Redistribution in executable form of any
670d84335fSJung-uk Kim * substantial portion of the Covered Code or modification must reproduce the
680d84335fSJung-uk Kim * above Copyright Notice, and the following Disclaimer and Export Compliance
690d84335fSJung-uk Kim * provision in the documentation and/or other materials provided with the
700d84335fSJung-uk Kim * distribution.
710d84335fSJung-uk Kim *
720d84335fSJung-uk Kim * 3.4. Intel retains all right, title, and interest in and to the Original
730d84335fSJung-uk Kim * Intel Code.
740d84335fSJung-uk Kim *
750d84335fSJung-uk Kim * 3.5. Neither the name Intel nor any other trademark owned or controlled by
760d84335fSJung-uk Kim * Intel shall be used in advertising or otherwise to promote the sale, use or
770d84335fSJung-uk Kim * other dealings in products derived from or relating to the Covered Code
780d84335fSJung-uk Kim * without prior written authorization from Intel.
790d84335fSJung-uk Kim *
800d84335fSJung-uk Kim * 4. Disclaimer and Export Compliance
810d84335fSJung-uk Kim *
820d84335fSJung-uk Kim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
830d84335fSJung-uk Kim * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
840d84335fSJung-uk Kim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
850d84335fSJung-uk Kim * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
860d84335fSJung-uk Kim * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
870d84335fSJung-uk Kim * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
880d84335fSJung-uk Kim * PARTICULAR PURPOSE.
890d84335fSJung-uk Kim *
900d84335fSJung-uk Kim * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
910d84335fSJung-uk Kim * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
920d84335fSJung-uk Kim * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
930d84335fSJung-uk Kim * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
940d84335fSJung-uk Kim * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
950d84335fSJung-uk Kim * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
960d84335fSJung-uk Kim * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
970d84335fSJung-uk Kim * LIMITED REMEDY.
980d84335fSJung-uk Kim *
990d84335fSJung-uk Kim * 4.3. Licensee shall not export, either directly or indirectly, any of this
1000d84335fSJung-uk Kim * software or system incorporating such software without first obtaining any
1010d84335fSJung-uk Kim * required license or other approval from the U. S. Department of Commerce or
1020d84335fSJung-uk Kim * any other agency or department of the United States Government. In the
1030d84335fSJung-uk Kim * event Licensee exports any such software from the United States or
1040d84335fSJung-uk Kim * re-exports any such software from a foreign destination, Licensee shall
1050d84335fSJung-uk Kim * ensure that the distribution and export/re-export of the software is in
1060d84335fSJung-uk Kim * compliance with all laws, regulations, orders, or other restrictions of the
1070d84335fSJung-uk Kim * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1080d84335fSJung-uk Kim * any of its subsidiaries will export/re-export any technical data, process,
1090d84335fSJung-uk Kim * software, or service, directly or indirectly, to any country for which the
1100d84335fSJung-uk Kim * United States government or any agency thereof requires an export license,
1110d84335fSJung-uk Kim * other governmental approval, or letter of assurance, without first obtaining
1120d84335fSJung-uk Kim * such license, approval or letter.
1130d84335fSJung-uk Kim *
1140d84335fSJung-uk Kim *****************************************************************************
1150d84335fSJung-uk Kim *
1160d84335fSJung-uk Kim * Alternatively, you may choose to be licensed under the terms of the
1170d84335fSJung-uk Kim * following license:
1180d84335fSJung-uk Kim *
119a159c266SJung-uk Kim * Redistribution and use in source and binary forms, with or without
120a159c266SJung-uk Kim * modification, are permitted provided that the following conditions
121a159c266SJung-uk Kim * are met:
122a159c266SJung-uk Kim * 1. Redistributions of source code must retain the above copyright
123a159c266SJung-uk Kim * notice, this list of conditions, and the following disclaimer,
124a159c266SJung-uk Kim * without modification.
125a159c266SJung-uk Kim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126a159c266SJung-uk Kim * substantially similar to the "NO WARRANTY" disclaimer below
127a159c266SJung-uk Kim * ("Disclaimer") and any redistribution must be conditioned upon
128a159c266SJung-uk Kim * including a substantially similar Disclaimer requirement for further
129a159c266SJung-uk Kim * binary redistribution.
130a159c266SJung-uk Kim * 3. Neither the names of the above-listed copyright holders nor the names
131a159c266SJung-uk Kim * of any contributors may be used to endorse or promote products derived
132a159c266SJung-uk Kim * from this software without specific prior written permission.
133a159c266SJung-uk Kim *
1340d84335fSJung-uk Kim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1350d84335fSJung-uk Kim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1360d84335fSJung-uk Kim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1370d84335fSJung-uk Kim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1380d84335fSJung-uk Kim * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1390d84335fSJung-uk Kim * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1400d84335fSJung-uk Kim * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1410d84335fSJung-uk Kim * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1420d84335fSJung-uk Kim * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1430d84335fSJung-uk Kim * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1440d84335fSJung-uk Kim * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1450d84335fSJung-uk Kim *
1460d84335fSJung-uk Kim * Alternatively, you may choose to be licensed under the terms of the
147a159c266SJung-uk Kim * GNU General Public License ("GPL") version 2 as published by the Free
148a159c266SJung-uk Kim * Software Foundation.
149a159c266SJung-uk Kim *
1500d84335fSJung-uk Kim *****************************************************************************/
151a159c266SJung-uk Kim
152a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acpi.h>
153a159c266SJung-uk Kim #include <contrib/dev/acpica/include/accommon.h>
154a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acevents.h>
155a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acnamesp.h>
156a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acinterp.h>
157a159c266SJung-uk Kim
158a159c266SJung-uk Kim #define _COMPONENT ACPI_EVENTS
159a159c266SJung-uk Kim ACPI_MODULE_NAME ("evregion")
160a159c266SJung-uk Kim
161a159c266SJung-uk Kim
162efcc2a30SJung-uk Kim extern UINT8 AcpiGbl_DefaultAddressSpaces[];
163a159c266SJung-uk Kim
164efcc2a30SJung-uk Kim /* Local prototypes */
165a159c266SJung-uk Kim
166a159c266SJung-uk Kim static void
167fbde3477SJung-uk Kim AcpiEvExecuteOrphanRegMethod (
168fbde3477SJung-uk Kim ACPI_NAMESPACE_NODE *DeviceNode,
169fbde3477SJung-uk Kim ACPI_ADR_SPACE_TYPE SpaceId);
170fbde3477SJung-uk Kim
171a159c266SJung-uk Kim
172a159c266SJung-uk Kim static ACPI_STATUS
173a159c266SJung-uk Kim AcpiEvRegRun (
174a159c266SJung-uk Kim ACPI_HANDLE ObjHandle,
175a159c266SJung-uk Kim UINT32 Level,
176a159c266SJung-uk Kim void *Context,
177a159c266SJung-uk Kim void **ReturnValue);
178a159c266SJung-uk Kim
179a159c266SJung-uk Kim
180a159c266SJung-uk Kim /*******************************************************************************
181a159c266SJung-uk Kim *
182a159c266SJung-uk Kim * FUNCTION: AcpiEvInitializeOpRegions
183a159c266SJung-uk Kim *
184a159c266SJung-uk Kim * PARAMETERS: None
185a159c266SJung-uk Kim *
186a159c266SJung-uk Kim * RETURN: Status
187a159c266SJung-uk Kim *
188a159c266SJung-uk Kim * DESCRIPTION: Execute _REG methods for all Operation Regions that have
189a159c266SJung-uk Kim * an installed default region handler.
190a159c266SJung-uk Kim *
191a159c266SJung-uk Kim ******************************************************************************/
192a159c266SJung-uk Kim
193a159c266SJung-uk Kim ACPI_STATUS
AcpiEvInitializeOpRegions(void)194a159c266SJung-uk Kim AcpiEvInitializeOpRegions (
195a159c266SJung-uk Kim void)
196a159c266SJung-uk Kim {
197a159c266SJung-uk Kim ACPI_STATUS Status;
198a159c266SJung-uk Kim UINT32 i;
199a159c266SJung-uk Kim
200a159c266SJung-uk Kim
201a159c266SJung-uk Kim ACPI_FUNCTION_TRACE (EvInitializeOpRegions);
202a159c266SJung-uk Kim
203a159c266SJung-uk Kim
204a159c266SJung-uk Kim Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
205a159c266SJung-uk Kim if (ACPI_FAILURE (Status))
206a159c266SJung-uk Kim {
207a159c266SJung-uk Kim return_ACPI_STATUS (Status);
208a159c266SJung-uk Kim }
209a159c266SJung-uk Kim
210a159c266SJung-uk Kim /* Run the _REG methods for OpRegions in each default address space */
211a159c266SJung-uk Kim
212a159c266SJung-uk Kim for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
213a159c266SJung-uk Kim {
214a159c266SJung-uk Kim /*
215a159c266SJung-uk Kim * Make sure the installed handler is the DEFAULT handler. If not the
216a159c266SJung-uk Kim * default, the _REG methods will have already been run (when the
217a159c266SJung-uk Kim * handler was installed)
218a159c266SJung-uk Kim */
219a159c266SJung-uk Kim if (AcpiEvHasDefaultHandler (AcpiGbl_RootNode,
220a159c266SJung-uk Kim AcpiGbl_DefaultAddressSpaces[i]))
221a159c266SJung-uk Kim {
222f8146b88SJung-uk Kim AcpiEvExecuteRegMethods (AcpiGbl_RootNode,
223f8146b88SJung-uk Kim AcpiGbl_DefaultAddressSpaces[i], ACPI_REG_CONNECT);
224a159c266SJung-uk Kim }
225a159c266SJung-uk Kim }
226a159c266SJung-uk Kim
227a159c266SJung-uk Kim (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
228a159c266SJung-uk Kim return_ACPI_STATUS (Status);
229a159c266SJung-uk Kim }
230a159c266SJung-uk Kim
231a159c266SJung-uk Kim
232a159c266SJung-uk Kim /*******************************************************************************
233a159c266SJung-uk Kim *
234a159c266SJung-uk Kim * FUNCTION: AcpiEvAddressSpaceDispatch
235a159c266SJung-uk Kim *
236a159c266SJung-uk Kim * PARAMETERS: RegionObj - Internal region object
237a159c266SJung-uk Kim * FieldObj - Corresponding field. Can be NULL.
238a159c266SJung-uk Kim * Function - Read or Write operation
239a159c266SJung-uk Kim * RegionOffset - Where in the region to read or write
240a159c266SJung-uk Kim * BitWidth - Field width in bits (8, 16, 32, or 64)
241a159c266SJung-uk Kim * Value - Pointer to in or out value, must be
242a159c266SJung-uk Kim * a full 64-bit integer
243a159c266SJung-uk Kim *
244a159c266SJung-uk Kim * RETURN: Status
245a159c266SJung-uk Kim *
246a159c266SJung-uk Kim * DESCRIPTION: Dispatch an address space or operation region access to
247a159c266SJung-uk Kim * a previously installed handler.
248a159c266SJung-uk Kim *
249f8146b88SJung-uk Kim * NOTE: During early initialization, we always install the default region
250f8146b88SJung-uk Kim * handlers for Memory, I/O and PCI_Config. This ensures that these operation
251f8146b88SJung-uk Kim * region address spaces are always available as per the ACPI specification.
252f8146b88SJung-uk Kim * This is especially needed in order to support the execution of
253f8146b88SJung-uk Kim * module-level AML code during loading of the ACPI tables.
254f8146b88SJung-uk Kim *
255a159c266SJung-uk Kim ******************************************************************************/
256a159c266SJung-uk Kim
257a159c266SJung-uk Kim ACPI_STATUS
AcpiEvAddressSpaceDispatch(ACPI_OPERAND_OBJECT * RegionObj,ACPI_OPERAND_OBJECT * FieldObj,UINT32 Function,UINT32 RegionOffset,UINT32 BitWidth,UINT64 * Value)258a159c266SJung-uk Kim AcpiEvAddressSpaceDispatch (
259a159c266SJung-uk Kim ACPI_OPERAND_OBJECT *RegionObj,
260a159c266SJung-uk Kim ACPI_OPERAND_OBJECT *FieldObj,
261a159c266SJung-uk Kim UINT32 Function,
262a159c266SJung-uk Kim UINT32 RegionOffset,
263a159c266SJung-uk Kim UINT32 BitWidth,
264a159c266SJung-uk Kim UINT64 *Value)
265a159c266SJung-uk Kim {
266a159c266SJung-uk Kim ACPI_STATUS Status;
267a159c266SJung-uk Kim ACPI_ADR_SPACE_HANDLER Handler;
268a159c266SJung-uk Kim ACPI_ADR_SPACE_SETUP RegionSetup;
269a159c266SJung-uk Kim ACPI_OPERAND_OBJECT *HandlerDesc;
270a159c266SJung-uk Kim ACPI_OPERAND_OBJECT *RegionObj2;
271a159c266SJung-uk Kim void *RegionContext = NULL;
272a159c266SJung-uk Kim ACPI_CONNECTION_INFO *Context;
273cfd1ed46SJung-uk Kim ACPI_MUTEX ContextMutex;
274cfd1ed46SJung-uk Kim BOOLEAN ContextLocked;
275313a0c13SJung-uk Kim ACPI_PHYSICAL_ADDRESS Address;
276a159c266SJung-uk Kim
277a159c266SJung-uk Kim
278a159c266SJung-uk Kim ACPI_FUNCTION_TRACE (EvAddressSpaceDispatch);
279a159c266SJung-uk Kim
280a159c266SJung-uk Kim
281a159c266SJung-uk Kim RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
282a159c266SJung-uk Kim if (!RegionObj2)
283a159c266SJung-uk Kim {
284a159c266SJung-uk Kim return_ACPI_STATUS (AE_NOT_EXIST);
285a159c266SJung-uk Kim }
286a159c266SJung-uk Kim
287a159c266SJung-uk Kim /* Ensure that there is a handler associated with this region */
288a159c266SJung-uk Kim
289a159c266SJung-uk Kim HandlerDesc = RegionObj->Region.Handler;
290a159c266SJung-uk Kim if (!HandlerDesc)
291a159c266SJung-uk Kim {
292a159c266SJung-uk Kim ACPI_ERROR ((AE_INFO,
293a159c266SJung-uk Kim "No handler for Region [%4.4s] (%p) [%s]",
294a159c266SJung-uk Kim AcpiUtGetNodeName (RegionObj->Region.Node),
295a159c266SJung-uk Kim RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
296a159c266SJung-uk Kim
297a159c266SJung-uk Kim return_ACPI_STATUS (AE_NOT_EXIST);
298a159c266SJung-uk Kim }
299a159c266SJung-uk Kim
300a159c266SJung-uk Kim Context = HandlerDesc->AddressSpace.Context;
301cfd1ed46SJung-uk Kim ContextMutex = HandlerDesc->AddressSpace.ContextMutex;
302cfd1ed46SJung-uk Kim ContextLocked = FALSE;
303a159c266SJung-uk Kim
304a159c266SJung-uk Kim /*
305a159c266SJung-uk Kim * It may be the case that the region has never been initialized.
306a159c266SJung-uk Kim * Some types of regions require special init code
307a159c266SJung-uk Kim */
308a159c266SJung-uk Kim if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE))
309a159c266SJung-uk Kim {
310a159c266SJung-uk Kim /* This region has not been initialized yet, do it */
311a159c266SJung-uk Kim
312a159c266SJung-uk Kim RegionSetup = HandlerDesc->AddressSpace.Setup;
313a159c266SJung-uk Kim if (!RegionSetup)
314a159c266SJung-uk Kim {
315a159c266SJung-uk Kim /* No initialization routine, exit with error */
316a159c266SJung-uk Kim
317a159c266SJung-uk Kim ACPI_ERROR ((AE_INFO,
318a159c266SJung-uk Kim "No init routine for region(%p) [%s]",
319a159c266SJung-uk Kim RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
320a159c266SJung-uk Kim return_ACPI_STATUS (AE_NOT_EXIST);
321a159c266SJung-uk Kim }
322a159c266SJung-uk Kim
323ab71bbb7SJung-uk Kim if (RegionObj->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_COMM)
324ab71bbb7SJung-uk Kim {
325ab71bbb7SJung-uk Kim ACPI_PCC_INFO *Ctx = HandlerDesc->AddressSpace.Context;
326ab71bbb7SJung-uk Kim
327ab71bbb7SJung-uk Kim Ctx->InternalBuffer = FieldObj->Field.InternalPccBuffer;
328ab71bbb7SJung-uk Kim Ctx->Length = (UINT16) RegionObj->Region.Length;
329ab71bbb7SJung-uk Kim Ctx->SubspaceId = (UINT8) RegionObj->Region.Address;
330ab71bbb7SJung-uk Kim }
331ab71bbb7SJung-uk Kim
3329a4bc520SJung-uk Kim if (RegionObj->Region.SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE)
3339a4bc520SJung-uk Kim {
3349a4bc520SJung-uk Kim ACPI_FFH_INFO *Ctx = HandlerDesc->AddressSpace.Context;
3359a4bc520SJung-uk Kim
3369a4bc520SJung-uk Kim Ctx->Length = RegionObj->Region.Length;
3379a4bc520SJung-uk Kim Ctx->Offset = RegionObj->Region.Address;
3389a4bc520SJung-uk Kim }
3399a4bc520SJung-uk Kim
340a159c266SJung-uk Kim /*
341a159c266SJung-uk Kim * We must exit the interpreter because the region setup will
342a159c266SJung-uk Kim * potentially execute control methods (for example, the _REG method
343a159c266SJung-uk Kim * for this region)
344a159c266SJung-uk Kim */
345a159c266SJung-uk Kim AcpiExExitInterpreter ();
346a159c266SJung-uk Kim
347a159c266SJung-uk Kim Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE,
348a159c266SJung-uk Kim Context, &RegionContext);
349a159c266SJung-uk Kim
350a159c266SJung-uk Kim /* Re-enter the interpreter */
351a159c266SJung-uk Kim
352a159c266SJung-uk Kim AcpiExEnterInterpreter ();
353a159c266SJung-uk Kim
354a159c266SJung-uk Kim /* Check for failure of the Region Setup */
355a159c266SJung-uk Kim
356a159c266SJung-uk Kim if (ACPI_FAILURE (Status))
357a159c266SJung-uk Kim {
358a159c266SJung-uk Kim ACPI_EXCEPTION ((AE_INFO, Status,
359a159c266SJung-uk Kim "During region initialization: [%s]",
360a159c266SJung-uk Kim AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
361a159c266SJung-uk Kim return_ACPI_STATUS (Status);
362a159c266SJung-uk Kim }
363a159c266SJung-uk Kim
364a159c266SJung-uk Kim /* Region initialization may have been completed by RegionSetup */
365a159c266SJung-uk Kim
366a159c266SJung-uk Kim if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE))
367a159c266SJung-uk Kim {
368a159c266SJung-uk Kim RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
369a159c266SJung-uk Kim
370a159c266SJung-uk Kim /*
371a159c266SJung-uk Kim * Save the returned context for use in all accesses to
37279c6d946SJung-uk Kim * the handler for this particular region
373a159c266SJung-uk Kim */
37479c6d946SJung-uk Kim if (!(RegionObj2->Extra.RegionContext))
37579c6d946SJung-uk Kim {
376a159c266SJung-uk Kim RegionObj2->Extra.RegionContext = RegionContext;
377a159c266SJung-uk Kim }
378a159c266SJung-uk Kim }
379a159c266SJung-uk Kim }
380a159c266SJung-uk Kim
381a159c266SJung-uk Kim /* We have everything we need, we can invoke the address space handler */
382a159c266SJung-uk Kim
383a159c266SJung-uk Kim Handler = HandlerDesc->AddressSpace.Handler;
384313a0c13SJung-uk Kim Address = (RegionObj->Region.Address + RegionOffset);
385a159c266SJung-uk Kim
386313a0c13SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
387313a0c13SJung-uk Kim "Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
388313a0c13SJung-uk Kim &RegionObj->Region.Handler->AddressSpace, Handler,
3897cf3e94aSJung-uk Kim ACPI_FORMAT_UINT64 (Address),
390313a0c13SJung-uk Kim AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
391a159c266SJung-uk Kim
392a159c266SJung-uk Kim if (!(HandlerDesc->AddressSpace.HandlerFlags &
393a159c266SJung-uk Kim ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
394a159c266SJung-uk Kim {
395a159c266SJung-uk Kim /*
396a159c266SJung-uk Kim * For handlers other than the default (supplied) handlers, we must
397a159c266SJung-uk Kim * exit the interpreter because the handler *might* block -- we don't
398cd6518c7SJung-uk Kim * know what it will do, so we can't hold the lock on the interpreter.
399a159c266SJung-uk Kim */
400a159c266SJung-uk Kim AcpiExExitInterpreter();
401a159c266SJung-uk Kim }
402a159c266SJung-uk Kim
403cfd1ed46SJung-uk Kim /*
404cfd1ed46SJung-uk Kim * Special handling for GenericSerialBus and GeneralPurposeIo:
405cfd1ed46SJung-uk Kim * There are three extra parameters that must be passed to the
406cfd1ed46SJung-uk Kim * handler via the context:
407cfd1ed46SJung-uk Kim * 1) Connection buffer, a resource template from Connection() op
408cfd1ed46SJung-uk Kim * 2) Length of the above buffer
409cfd1ed46SJung-uk Kim * 3) Actual access length from the AccessAs() op
410cfd1ed46SJung-uk Kim *
411cfd1ed46SJung-uk Kim * Since we pass these extra parameters via the context, which is
412cfd1ed46SJung-uk Kim * shared between threads, we must lock the context to avoid these
413cfd1ed46SJung-uk Kim * parameters being changed from another thread before the handler
414cfd1ed46SJung-uk Kim * has completed running.
415cfd1ed46SJung-uk Kim *
416cfd1ed46SJung-uk Kim * In addition, for GeneralPurposeIo, the Address and BitWidth fields
417cfd1ed46SJung-uk Kim * are defined as follows:
418cfd1ed46SJung-uk Kim * 1) Address is the pin number index of the field (bit offset from
419cfd1ed46SJung-uk Kim * the previous Connection)
420cfd1ed46SJung-uk Kim * 2) BitWidth is the actual bit length of the field (number of pins)
421cfd1ed46SJung-uk Kim */
422cfd1ed46SJung-uk Kim if ((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS ||
423cfd1ed46SJung-uk Kim RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO) &&
424cfd1ed46SJung-uk Kim Context &&
425cfd1ed46SJung-uk Kim FieldObj)
426cfd1ed46SJung-uk Kim {
427cfd1ed46SJung-uk Kim
428cfd1ed46SJung-uk Kim Status = AcpiOsAcquireMutex (ContextMutex, ACPI_WAIT_FOREVER);
429cfd1ed46SJung-uk Kim if (ACPI_FAILURE (Status))
430cfd1ed46SJung-uk Kim {
431cfd1ed46SJung-uk Kim goto ReEnterInterpreter;
432cfd1ed46SJung-uk Kim }
433cfd1ed46SJung-uk Kim
434cfd1ed46SJung-uk Kim ContextLocked = TRUE;
435cfd1ed46SJung-uk Kim
436cfd1ed46SJung-uk Kim /* Get the Connection (ResourceTemplate) buffer */
437cfd1ed46SJung-uk Kim
438cfd1ed46SJung-uk Kim Context->Connection = FieldObj->Field.ResourceBuffer;
439cfd1ed46SJung-uk Kim Context->Length = FieldObj->Field.ResourceLength;
440cfd1ed46SJung-uk Kim Context->AccessLength = FieldObj->Field.AccessLength;
441cfd1ed46SJung-uk Kim
442cfd1ed46SJung-uk Kim if (RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)
443cfd1ed46SJung-uk Kim {
444cfd1ed46SJung-uk Kim Address = FieldObj->Field.PinNumberIndex;
445cfd1ed46SJung-uk Kim BitWidth = FieldObj->Field.BitLength;
446cfd1ed46SJung-uk Kim }
447cfd1ed46SJung-uk Kim }
448cfd1ed46SJung-uk Kim
449a159c266SJung-uk Kim /* Call the handler */
450a159c266SJung-uk Kim
451313a0c13SJung-uk Kim Status = Handler (Function, Address, BitWidth, Value, Context,
452313a0c13SJung-uk Kim RegionObj2->Extra.RegionContext);
453a159c266SJung-uk Kim
454cfd1ed46SJung-uk Kim if (ContextLocked)
455cfd1ed46SJung-uk Kim {
456cfd1ed46SJung-uk Kim AcpiOsReleaseMutex (ContextMutex);
457cfd1ed46SJung-uk Kim }
458cfd1ed46SJung-uk Kim
459a159c266SJung-uk Kim if (ACPI_FAILURE (Status))
460a159c266SJung-uk Kim {
461a159c266SJung-uk Kim ACPI_EXCEPTION ((AE_INFO, Status, "Returned by Handler for [%s]",
462a159c266SJung-uk Kim AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
463b7b7e711SJung-uk Kim
464b7b7e711SJung-uk Kim /*
465b7b7e711SJung-uk Kim * Special case for an EC timeout. These are seen so frequently
466b7b7e711SJung-uk Kim * that an additional error message is helpful
467b7b7e711SJung-uk Kim */
468b7b7e711SJung-uk Kim if ((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) &&
469b7b7e711SJung-uk Kim (Status == AE_TIME))
470b7b7e711SJung-uk Kim {
471b7b7e711SJung-uk Kim ACPI_ERROR ((AE_INFO,
472b7b7e711SJung-uk Kim "Timeout from EC hardware or EC device driver"));
473b7b7e711SJung-uk Kim }
474a159c266SJung-uk Kim }
475a159c266SJung-uk Kim
476cfd1ed46SJung-uk Kim ReEnterInterpreter:
477a159c266SJung-uk Kim if (!(HandlerDesc->AddressSpace.HandlerFlags &
478a159c266SJung-uk Kim ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
479a159c266SJung-uk Kim {
480a159c266SJung-uk Kim /*
481a159c266SJung-uk Kim * We just returned from a non-default handler, we must re-enter the
482a159c266SJung-uk Kim * interpreter
483a159c266SJung-uk Kim */
484a159c266SJung-uk Kim AcpiExEnterInterpreter ();
485a159c266SJung-uk Kim }
486a159c266SJung-uk Kim
487a159c266SJung-uk Kim return_ACPI_STATUS (Status);
488a159c266SJung-uk Kim }
489a159c266SJung-uk Kim
490a159c266SJung-uk Kim
491a159c266SJung-uk Kim /*******************************************************************************
492a159c266SJung-uk Kim *
493a159c266SJung-uk Kim * FUNCTION: AcpiEvDetachRegion
494a159c266SJung-uk Kim *
495a159c266SJung-uk Kim * PARAMETERS: RegionObj - Region Object
496a159c266SJung-uk Kim * AcpiNsIsLocked - Namespace Region Already Locked?
497a159c266SJung-uk Kim *
498a159c266SJung-uk Kim * RETURN: None
499a159c266SJung-uk Kim *
500a159c266SJung-uk Kim * DESCRIPTION: Break the association between the handler and the region
501a159c266SJung-uk Kim * this is a two way association.
502a159c266SJung-uk Kim *
503a159c266SJung-uk Kim ******************************************************************************/
504a159c266SJung-uk Kim
505a159c266SJung-uk Kim void
AcpiEvDetachRegion(ACPI_OPERAND_OBJECT * RegionObj,BOOLEAN AcpiNsIsLocked)506a159c266SJung-uk Kim AcpiEvDetachRegion (
507a159c266SJung-uk Kim ACPI_OPERAND_OBJECT *RegionObj,
508a159c266SJung-uk Kim BOOLEAN AcpiNsIsLocked)
509a159c266SJung-uk Kim {
510a159c266SJung-uk Kim ACPI_OPERAND_OBJECT *HandlerObj;
511a159c266SJung-uk Kim ACPI_OPERAND_OBJECT *ObjDesc;
512313a0c13SJung-uk Kim ACPI_OPERAND_OBJECT *StartDesc;
513a159c266SJung-uk Kim ACPI_OPERAND_OBJECT **LastObjPtr;
514a159c266SJung-uk Kim ACPI_ADR_SPACE_SETUP RegionSetup;
515a159c266SJung-uk Kim void **RegionContext;
516a159c266SJung-uk Kim ACPI_OPERAND_OBJECT *RegionObj2;
517a159c266SJung-uk Kim ACPI_STATUS Status;
518a159c266SJung-uk Kim
519a159c266SJung-uk Kim
520a159c266SJung-uk Kim ACPI_FUNCTION_TRACE (EvDetachRegion);
521a159c266SJung-uk Kim
522a159c266SJung-uk Kim
523a159c266SJung-uk Kim RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
524a159c266SJung-uk Kim if (!RegionObj2)
525a159c266SJung-uk Kim {
526a159c266SJung-uk Kim return_VOID;
527a159c266SJung-uk Kim }
528a159c266SJung-uk Kim RegionContext = &RegionObj2->Extra.RegionContext;
529a159c266SJung-uk Kim
530a159c266SJung-uk Kim /* Get the address handler from the region object */
531a159c266SJung-uk Kim
532a159c266SJung-uk Kim HandlerObj = RegionObj->Region.Handler;
533a159c266SJung-uk Kim if (!HandlerObj)
534a159c266SJung-uk Kim {
535a159c266SJung-uk Kim /* This region has no handler, all done */
536a159c266SJung-uk Kim
537a159c266SJung-uk Kim return_VOID;
538a159c266SJung-uk Kim }
539a159c266SJung-uk Kim
540a159c266SJung-uk Kim /* Find this region in the handler's list */
541a159c266SJung-uk Kim
542a159c266SJung-uk Kim ObjDesc = HandlerObj->AddressSpace.RegionList;
543313a0c13SJung-uk Kim StartDesc = ObjDesc;
544a159c266SJung-uk Kim LastObjPtr = &HandlerObj->AddressSpace.RegionList;
545a159c266SJung-uk Kim
546a159c266SJung-uk Kim while (ObjDesc)
547a159c266SJung-uk Kim {
548a159c266SJung-uk Kim /* Is this the correct Region? */
549a159c266SJung-uk Kim
550a159c266SJung-uk Kim if (ObjDesc == RegionObj)
551a159c266SJung-uk Kim {
552a159c266SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
553a159c266SJung-uk Kim "Removing Region %p from address handler %p\n",
554a159c266SJung-uk Kim RegionObj, HandlerObj));
555a159c266SJung-uk Kim
556a159c266SJung-uk Kim /* This is it, remove it from the handler's list */
557a159c266SJung-uk Kim
558a159c266SJung-uk Kim *LastObjPtr = ObjDesc->Region.Next;
559a159c266SJung-uk Kim ObjDesc->Region.Next = NULL; /* Must clear field */
560a159c266SJung-uk Kim
561a159c266SJung-uk Kim if (AcpiNsIsLocked)
562a159c266SJung-uk Kim {
563a159c266SJung-uk Kim Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
564a159c266SJung-uk Kim if (ACPI_FAILURE (Status))
565a159c266SJung-uk Kim {
566a159c266SJung-uk Kim return_VOID;
567a159c266SJung-uk Kim }
568a159c266SJung-uk Kim }
569a159c266SJung-uk Kim
570a159c266SJung-uk Kim /* Now stop region accesses by executing the _REG method */
571a159c266SJung-uk Kim
572a159c266SJung-uk Kim Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_DISCONNECT);
573a159c266SJung-uk Kim if (ACPI_FAILURE (Status))
574a159c266SJung-uk Kim {
575a159c266SJung-uk Kim ACPI_EXCEPTION ((AE_INFO, Status, "from region _REG, [%s]",
576a159c266SJung-uk Kim AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
577a159c266SJung-uk Kim }
578a159c266SJung-uk Kim
579a159c266SJung-uk Kim if (AcpiNsIsLocked)
580a159c266SJung-uk Kim {
581a159c266SJung-uk Kim Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
582a159c266SJung-uk Kim if (ACPI_FAILURE (Status))
583a159c266SJung-uk Kim {
584a159c266SJung-uk Kim return_VOID;
585a159c266SJung-uk Kim }
586a159c266SJung-uk Kim }
587a159c266SJung-uk Kim
588a159c266SJung-uk Kim /*
589a159c266SJung-uk Kim * If the region has been activated, call the setup handler with
590a159c266SJung-uk Kim * the deactivate notification
591a159c266SJung-uk Kim */
592a159c266SJung-uk Kim if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)
593a159c266SJung-uk Kim {
594a159c266SJung-uk Kim RegionSetup = HandlerObj->AddressSpace.Setup;
595a159c266SJung-uk Kim Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE,
596a159c266SJung-uk Kim HandlerObj->AddressSpace.Context, RegionContext);
597a159c266SJung-uk Kim
59879c6d946SJung-uk Kim /*
59979c6d946SJung-uk Kim * RegionContext should have been released by the deactivate
60079c6d946SJung-uk Kim * operation. We don't need access to it anymore here.
60179c6d946SJung-uk Kim */
60279c6d946SJung-uk Kim if (RegionContext)
60379c6d946SJung-uk Kim {
60479c6d946SJung-uk Kim *RegionContext = NULL;
60579c6d946SJung-uk Kim }
60679c6d946SJung-uk Kim
607a159c266SJung-uk Kim /* Init routine may fail, Just ignore errors */
608a159c266SJung-uk Kim
609a159c266SJung-uk Kim if (ACPI_FAILURE (Status))
610a159c266SJung-uk Kim {
611a159c266SJung-uk Kim ACPI_EXCEPTION ((AE_INFO, Status,
612a159c266SJung-uk Kim "from region handler - deactivate, [%s]",
613a159c266SJung-uk Kim AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
614a159c266SJung-uk Kim }
615a159c266SJung-uk Kim
616a159c266SJung-uk Kim RegionObj->Region.Flags &= ~(AOPOBJ_SETUP_COMPLETE);
617a159c266SJung-uk Kim }
618a159c266SJung-uk Kim
619a159c266SJung-uk Kim /*
620a159c266SJung-uk Kim * Remove handler reference in the region
621a159c266SJung-uk Kim *
622a159c266SJung-uk Kim * NOTE: this doesn't mean that the region goes away, the region
623a159c266SJung-uk Kim * is just inaccessible as indicated to the _REG method
624a159c266SJung-uk Kim *
625a159c266SJung-uk Kim * If the region is on the handler's list, this must be the
626a159c266SJung-uk Kim * region's handler
627a159c266SJung-uk Kim */
628a159c266SJung-uk Kim RegionObj->Region.Handler = NULL;
629a159c266SJung-uk Kim AcpiUtRemoveReference (HandlerObj);
630a159c266SJung-uk Kim
631a159c266SJung-uk Kim return_VOID;
632a159c266SJung-uk Kim }
633a159c266SJung-uk Kim
634a159c266SJung-uk Kim /* Walk the linked list of handlers */
635a159c266SJung-uk Kim
636a159c266SJung-uk Kim LastObjPtr = &ObjDesc->Region.Next;
637a159c266SJung-uk Kim ObjDesc = ObjDesc->Region.Next;
638313a0c13SJung-uk Kim
639313a0c13SJung-uk Kim /* Prevent infinite loop if list is corrupted */
640313a0c13SJung-uk Kim
641313a0c13SJung-uk Kim if (ObjDesc == StartDesc)
642313a0c13SJung-uk Kim {
643313a0c13SJung-uk Kim ACPI_ERROR ((AE_INFO,
644313a0c13SJung-uk Kim "Circular handler list in region object %p",
645313a0c13SJung-uk Kim RegionObj));
646313a0c13SJung-uk Kim return_VOID;
647313a0c13SJung-uk Kim }
648a159c266SJung-uk Kim }
649a159c266SJung-uk Kim
650a159c266SJung-uk Kim /* If we get here, the region was not in the handler's region list */
651a159c266SJung-uk Kim
652a159c266SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
653a159c266SJung-uk Kim "Cannot remove region %p from address handler %p\n",
654a159c266SJung-uk Kim RegionObj, HandlerObj));
655a159c266SJung-uk Kim
656a159c266SJung-uk Kim return_VOID;
657a159c266SJung-uk Kim }
658a159c266SJung-uk Kim
659a159c266SJung-uk Kim
660a159c266SJung-uk Kim /*******************************************************************************
661a159c266SJung-uk Kim *
662a159c266SJung-uk Kim * FUNCTION: AcpiEvAttachRegion
663a159c266SJung-uk Kim *
664a159c266SJung-uk Kim * PARAMETERS: HandlerObj - Handler Object
665a159c266SJung-uk Kim * RegionObj - Region Object
666a159c266SJung-uk Kim * AcpiNsIsLocked - Namespace Region Already Locked?
667a159c266SJung-uk Kim *
668a159c266SJung-uk Kim * RETURN: None
669a159c266SJung-uk Kim *
670a159c266SJung-uk Kim * DESCRIPTION: Create the association between the handler and the region
671a159c266SJung-uk Kim * this is a two way association.
672a159c266SJung-uk Kim *
673a159c266SJung-uk Kim ******************************************************************************/
674a159c266SJung-uk Kim
675a159c266SJung-uk Kim ACPI_STATUS
AcpiEvAttachRegion(ACPI_OPERAND_OBJECT * HandlerObj,ACPI_OPERAND_OBJECT * RegionObj,BOOLEAN AcpiNsIsLocked)676a159c266SJung-uk Kim AcpiEvAttachRegion (
677a159c266SJung-uk Kim ACPI_OPERAND_OBJECT *HandlerObj,
678a159c266SJung-uk Kim ACPI_OPERAND_OBJECT *RegionObj,
679a159c266SJung-uk Kim BOOLEAN AcpiNsIsLocked)
680a159c266SJung-uk Kim {
681a159c266SJung-uk Kim
682a159c266SJung-uk Kim ACPI_FUNCTION_TRACE (EvAttachRegion);
683a159c266SJung-uk Kim
684a159c266SJung-uk Kim
685f8146b88SJung-uk Kim /* Install the region's handler */
686f8146b88SJung-uk Kim
687f8146b88SJung-uk Kim if (RegionObj->Region.Handler)
688f8146b88SJung-uk Kim {
689f8146b88SJung-uk Kim return_ACPI_STATUS (AE_ALREADY_EXISTS);
690f8146b88SJung-uk Kim }
691f8146b88SJung-uk Kim
692a159c266SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
693a159c266SJung-uk Kim "Adding Region [%4.4s] %p to address handler %p [%s]\n",
694a159c266SJung-uk Kim AcpiUtGetNodeName (RegionObj->Region.Node),
695a159c266SJung-uk Kim RegionObj, HandlerObj,
696a159c266SJung-uk Kim AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
697a159c266SJung-uk Kim
698a159c266SJung-uk Kim /* Link this region to the front of the handler's list */
699a159c266SJung-uk Kim
700a159c266SJung-uk Kim RegionObj->Region.Next = HandlerObj->AddressSpace.RegionList;
701a159c266SJung-uk Kim HandlerObj->AddressSpace.RegionList = RegionObj;
702a159c266SJung-uk Kim RegionObj->Region.Handler = HandlerObj;
703a159c266SJung-uk Kim AcpiUtAddReference (HandlerObj);
704a159c266SJung-uk Kim
705a159c266SJung-uk Kim return_ACPI_STATUS (AE_OK);
706a159c266SJung-uk Kim }
707a159c266SJung-uk Kim
708a159c266SJung-uk Kim
709a159c266SJung-uk Kim /*******************************************************************************
710a159c266SJung-uk Kim *
711efcc2a30SJung-uk Kim * FUNCTION: AcpiEvExecuteRegMethod
712a159c266SJung-uk Kim *
713efcc2a30SJung-uk Kim * PARAMETERS: RegionObj - Region object
714efcc2a30SJung-uk Kim * Function - Passed to _REG: On (1) or Off (0)
715a159c266SJung-uk Kim *
716a159c266SJung-uk Kim * RETURN: Status
717a159c266SJung-uk Kim *
718efcc2a30SJung-uk Kim * DESCRIPTION: Execute _REG method for a region
719a159c266SJung-uk Kim *
720a159c266SJung-uk Kim ******************************************************************************/
721a159c266SJung-uk Kim
722a159c266SJung-uk Kim ACPI_STATUS
AcpiEvExecuteRegMethod(ACPI_OPERAND_OBJECT * RegionObj,UINT32 Function)723efcc2a30SJung-uk Kim AcpiEvExecuteRegMethod (
724efcc2a30SJung-uk Kim ACPI_OPERAND_OBJECT *RegionObj,
725efcc2a30SJung-uk Kim UINT32 Function)
726a159c266SJung-uk Kim {
727efcc2a30SJung-uk Kim ACPI_EVALUATE_INFO *Info;
728efcc2a30SJung-uk Kim ACPI_OPERAND_OBJECT *Args[3];
729efcc2a30SJung-uk Kim ACPI_OPERAND_OBJECT *RegionObj2;
730f8146b88SJung-uk Kim const ACPI_NAME *RegNamePtr = ACPI_CAST_PTR (ACPI_NAME, METHOD_NAME__REG);
731f8146b88SJung-uk Kim ACPI_NAMESPACE_NODE *MethodNode;
732f8146b88SJung-uk Kim ACPI_NAMESPACE_NODE *Node;
733a159c266SJung-uk Kim ACPI_STATUS Status;
734a159c266SJung-uk Kim
735a159c266SJung-uk Kim
736efcc2a30SJung-uk Kim ACPI_FUNCTION_TRACE (EvExecuteRegMethod);
737a159c266SJung-uk Kim
738a159c266SJung-uk Kim
739f8146b88SJung-uk Kim if (!AcpiGbl_NamespaceInitialized ||
740f8146b88SJung-uk Kim RegionObj->Region.Handler == NULL)
741f8146b88SJung-uk Kim {
742f8146b88SJung-uk Kim return_ACPI_STATUS (AE_OK);
743f8146b88SJung-uk Kim }
744f8146b88SJung-uk Kim
745efcc2a30SJung-uk Kim RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
746efcc2a30SJung-uk Kim if (!RegionObj2)
747efcc2a30SJung-uk Kim {
748efcc2a30SJung-uk Kim return_ACPI_STATUS (AE_NOT_EXIST);
749efcc2a30SJung-uk Kim }
750efcc2a30SJung-uk Kim
751f8146b88SJung-uk Kim /*
752f8146b88SJung-uk Kim * Find any "_REG" method associated with this region definition.
753f8146b88SJung-uk Kim * The method should always be updated as this function may be
754f8146b88SJung-uk Kim * invoked after a namespace change.
755f8146b88SJung-uk Kim */
756f8146b88SJung-uk Kim Node = RegionObj->Region.Node->Parent;
757f8146b88SJung-uk Kim Status = AcpiNsSearchOneScope (
758f8146b88SJung-uk Kim *RegNamePtr, Node, ACPI_TYPE_METHOD, &MethodNode);
759f8146b88SJung-uk Kim if (ACPI_SUCCESS (Status))
760f8146b88SJung-uk Kim {
761f8146b88SJung-uk Kim /*
762f8146b88SJung-uk Kim * The _REG method is optional and there can be only one per
763f8146b88SJung-uk Kim * region definition. This will be executed when the handler is
764f8146b88SJung-uk Kim * attached or removed.
765f8146b88SJung-uk Kim */
766f8146b88SJung-uk Kim RegionObj2->Extra.Method_REG = MethodNode;
767f8146b88SJung-uk Kim }
768efcc2a30SJung-uk Kim if (RegionObj2->Extra.Method_REG == NULL)
769efcc2a30SJung-uk Kim {
770efcc2a30SJung-uk Kim return_ACPI_STATUS (AE_OK);
771efcc2a30SJung-uk Kim }
772efcc2a30SJung-uk Kim
773f8146b88SJung-uk Kim /* _REG(DISCONNECT) should be paired with _REG(CONNECT) */
774f8146b88SJung-uk Kim
775f8146b88SJung-uk Kim if ((Function == ACPI_REG_CONNECT &&
776f8146b88SJung-uk Kim RegionObj->Common.Flags & AOPOBJ_REG_CONNECTED) ||
777f8146b88SJung-uk Kim (Function == ACPI_REG_DISCONNECT &&
778f8146b88SJung-uk Kim !(RegionObj->Common.Flags & AOPOBJ_REG_CONNECTED)))
779f8146b88SJung-uk Kim {
780f8146b88SJung-uk Kim return_ACPI_STATUS (AE_OK);
781f8146b88SJung-uk Kim }
782f8146b88SJung-uk Kim
783efcc2a30SJung-uk Kim /* Allocate and initialize the evaluation information block */
784efcc2a30SJung-uk Kim
785efcc2a30SJung-uk Kim Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
786efcc2a30SJung-uk Kim if (!Info)
787efcc2a30SJung-uk Kim {
788efcc2a30SJung-uk Kim return_ACPI_STATUS (AE_NO_MEMORY);
789efcc2a30SJung-uk Kim }
790efcc2a30SJung-uk Kim
791efcc2a30SJung-uk Kim Info->PrefixNode = RegionObj2->Extra.Method_REG;
792895f26a9SJung-uk Kim Info->RelativePathname = NULL;
793efcc2a30SJung-uk Kim Info->Parameters = Args;
794efcc2a30SJung-uk Kim Info->Flags = ACPI_IGNORE_RETURN_VALUE;
795efcc2a30SJung-uk Kim
796a159c266SJung-uk Kim /*
797efcc2a30SJung-uk Kim * The _REG method has two arguments:
798efcc2a30SJung-uk Kim *
799efcc2a30SJung-uk Kim * Arg0 - Integer:
800efcc2a30SJung-uk Kim * Operation region space ID Same value as RegionObj->Region.SpaceId
801efcc2a30SJung-uk Kim *
802efcc2a30SJung-uk Kim * Arg1 - Integer:
803efcc2a30SJung-uk Kim * connection status 1 for connecting the handler, 0 for disconnecting
804efcc2a30SJung-uk Kim * the handler (Passed as a parameter)
805a159c266SJung-uk Kim */
806efcc2a30SJung-uk Kim Args[0] = AcpiUtCreateIntegerObject ((UINT64) RegionObj->Region.SpaceId);
807efcc2a30SJung-uk Kim if (!Args[0])
808a159c266SJung-uk Kim {
809a159c266SJung-uk Kim Status = AE_NO_MEMORY;
810efcc2a30SJung-uk Kim goto Cleanup1;
811a159c266SJung-uk Kim }
812a159c266SJung-uk Kim
813efcc2a30SJung-uk Kim Args[1] = AcpiUtCreateIntegerObject ((UINT64) Function);
814efcc2a30SJung-uk Kim if (!Args[1])
815a159c266SJung-uk Kim {
816a159c266SJung-uk Kim Status = AE_NO_MEMORY;
817efcc2a30SJung-uk Kim goto Cleanup2;
818a159c266SJung-uk Kim }
819a159c266SJung-uk Kim
820efcc2a30SJung-uk Kim Args[2] = NULL; /* Terminate list */
821a159c266SJung-uk Kim
822efcc2a30SJung-uk Kim /* Execute the method, no return value */
823a159c266SJung-uk Kim
824efcc2a30SJung-uk Kim ACPI_DEBUG_EXEC (
825efcc2a30SJung-uk Kim AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Info->PrefixNode, NULL));
826a159c266SJung-uk Kim
827efcc2a30SJung-uk Kim Status = AcpiNsEvaluate (Info);
828efcc2a30SJung-uk Kim AcpiUtRemoveReference (Args[1]);
829a159c266SJung-uk Kim
830f8146b88SJung-uk Kim if (ACPI_FAILURE (Status))
831f8146b88SJung-uk Kim {
832f8146b88SJung-uk Kim goto Cleanup2;
833f8146b88SJung-uk Kim }
834f8146b88SJung-uk Kim
835f8146b88SJung-uk Kim if (Function == ACPI_REG_CONNECT)
836f8146b88SJung-uk Kim {
837f8146b88SJung-uk Kim RegionObj->Common.Flags |= AOPOBJ_REG_CONNECTED;
838f8146b88SJung-uk Kim }
839f8146b88SJung-uk Kim else
840f8146b88SJung-uk Kim {
841f8146b88SJung-uk Kim RegionObj->Common.Flags &= ~AOPOBJ_REG_CONNECTED;
842f8146b88SJung-uk Kim }
843f8146b88SJung-uk Kim
844efcc2a30SJung-uk Kim Cleanup2:
845efcc2a30SJung-uk Kim AcpiUtRemoveReference (Args[0]);
846a159c266SJung-uk Kim
847efcc2a30SJung-uk Kim Cleanup1:
848efcc2a30SJung-uk Kim ACPI_FREE (Info);
849a159c266SJung-uk Kim return_ACPI_STATUS (Status);
850a159c266SJung-uk Kim }
851a159c266SJung-uk Kim
852a159c266SJung-uk Kim
853a159c266SJung-uk Kim /*******************************************************************************
854a159c266SJung-uk Kim *
855a159c266SJung-uk Kim * FUNCTION: AcpiEvExecuteRegMethods
856a159c266SJung-uk Kim *
857a159c266SJung-uk Kim * PARAMETERS: Node - Namespace node for the device
858a159c266SJung-uk Kim * SpaceId - The address space ID
859f8146b88SJung-uk Kim * Function - Passed to _REG: On (1) or Off (0)
860a159c266SJung-uk Kim *
861f8146b88SJung-uk Kim * RETURN: None
862a159c266SJung-uk Kim *
863a159c266SJung-uk Kim * DESCRIPTION: Run all _REG methods for the input Space ID;
864a159c266SJung-uk Kim * Note: assumes namespace is locked, or system init time.
865a159c266SJung-uk Kim *
866a159c266SJung-uk Kim ******************************************************************************/
867a159c266SJung-uk Kim
868f8146b88SJung-uk Kim void
AcpiEvExecuteRegMethods(ACPI_NAMESPACE_NODE * Node,ACPI_ADR_SPACE_TYPE SpaceId,UINT32 Function)869a159c266SJung-uk Kim AcpiEvExecuteRegMethods (
870a159c266SJung-uk Kim ACPI_NAMESPACE_NODE *Node,
871f8146b88SJung-uk Kim ACPI_ADR_SPACE_TYPE SpaceId,
872f8146b88SJung-uk Kim UINT32 Function)
873a159c266SJung-uk Kim {
87470e6ab8fSJung-uk Kim ACPI_REG_WALK_INFO Info;
875a159c266SJung-uk Kim
876a159c266SJung-uk Kim
877a159c266SJung-uk Kim ACPI_FUNCTION_TRACE (EvExecuteRegMethods);
878a159c266SJung-uk Kim
8796f1f1a63SJung-uk Kim /*
8806f1f1a63SJung-uk Kim * These address spaces do not need a call to _REG, since the ACPI
8816f1f1a63SJung-uk Kim * specification defines them as: "must always be accessible". Since
8826f1f1a63SJung-uk Kim * they never change state (never become unavailable), no need to ever
8836f1f1a63SJung-uk Kim * call _REG on them. Also, a DataTable is not a "real" address space,
8846f1f1a63SJung-uk Kim * so do not call _REG. September 2018.
8856f1f1a63SJung-uk Kim */
8866f1f1a63SJung-uk Kim if ((SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) ||
8876f1f1a63SJung-uk Kim (SpaceId == ACPI_ADR_SPACE_SYSTEM_IO) ||
8886f1f1a63SJung-uk Kim (SpaceId == ACPI_ADR_SPACE_DATA_TABLE))
8896f1f1a63SJung-uk Kim {
8906f1f1a63SJung-uk Kim return_VOID;
8916f1f1a63SJung-uk Kim }
8926f1f1a63SJung-uk Kim
89370e6ab8fSJung-uk Kim Info.SpaceId = SpaceId;
894f8146b88SJung-uk Kim Info.Function = Function;
89570e6ab8fSJung-uk Kim Info.RegRunCount = 0;
89670e6ab8fSJung-uk Kim
89770e6ab8fSJung-uk Kim ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES,
89870e6ab8fSJung-uk Kim " Running _REG methods for SpaceId %s\n",
89970e6ab8fSJung-uk Kim AcpiUtGetRegionName (Info.SpaceId)));
900a159c266SJung-uk Kim
901a159c266SJung-uk Kim /*
902a159c266SJung-uk Kim * Run all _REG methods for all Operation Regions for this space ID. This
903a159c266SJung-uk Kim * is a separate walk in order to handle any interdependencies between
904a159c266SJung-uk Kim * regions and _REG methods. (i.e. handlers must be installed for all
905a159c266SJung-uk Kim * regions of this Space ID before we can run any _REG methods)
906a159c266SJung-uk Kim */
907f8146b88SJung-uk Kim (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
90870e6ab8fSJung-uk Kim ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, &Info, NULL);
909a159c266SJung-uk Kim
910fbde3477SJung-uk Kim /*
911fbde3477SJung-uk Kim * Special case for EC and GPIO: handle "orphan" _REG methods with
912fbde3477SJung-uk Kim * no region.
913fbde3477SJung-uk Kim */
914fbde3477SJung-uk Kim if (SpaceId == ACPI_ADR_SPACE_EC || SpaceId == ACPI_ADR_SPACE_GPIO)
915a159c266SJung-uk Kim {
916fbde3477SJung-uk Kim AcpiEvExecuteOrphanRegMethod (Node, SpaceId);
917a159c266SJung-uk Kim }
918a159c266SJung-uk Kim
91970e6ab8fSJung-uk Kim ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES,
92070e6ab8fSJung-uk Kim " Executed %u _REG methods for SpaceId %s\n",
92170e6ab8fSJung-uk Kim Info.RegRunCount, AcpiUtGetRegionName (Info.SpaceId)));
92270e6ab8fSJung-uk Kim
923f8146b88SJung-uk Kim return_VOID;
924a159c266SJung-uk Kim }
925a159c266SJung-uk Kim
926a159c266SJung-uk Kim
927a159c266SJung-uk Kim /*******************************************************************************
928a159c266SJung-uk Kim *
929a159c266SJung-uk Kim * FUNCTION: AcpiEvRegRun
930a159c266SJung-uk Kim *
931a159c266SJung-uk Kim * PARAMETERS: WalkNamespace callback
932a159c266SJung-uk Kim *
933a159c266SJung-uk Kim * DESCRIPTION: Run _REG method for region objects of the requested spaceID
934a159c266SJung-uk Kim *
935a159c266SJung-uk Kim ******************************************************************************/
936a159c266SJung-uk Kim
937a159c266SJung-uk Kim static ACPI_STATUS
AcpiEvRegRun(ACPI_HANDLE ObjHandle,UINT32 Level,void * Context,void ** ReturnValue)938a159c266SJung-uk Kim AcpiEvRegRun (
939a159c266SJung-uk Kim ACPI_HANDLE ObjHandle,
940a159c266SJung-uk Kim UINT32 Level,
941a159c266SJung-uk Kim void *Context,
942a159c266SJung-uk Kim void **ReturnValue)
943a159c266SJung-uk Kim {
944a159c266SJung-uk Kim ACPI_OPERAND_OBJECT *ObjDesc;
945a159c266SJung-uk Kim ACPI_NAMESPACE_NODE *Node;
946a159c266SJung-uk Kim ACPI_STATUS Status;
94770e6ab8fSJung-uk Kim ACPI_REG_WALK_INFO *Info;
948a159c266SJung-uk Kim
949a159c266SJung-uk Kim
95070e6ab8fSJung-uk Kim Info = ACPI_CAST_PTR (ACPI_REG_WALK_INFO, Context);
951a159c266SJung-uk Kim
952a159c266SJung-uk Kim /* Convert and validate the device handle */
953a159c266SJung-uk Kim
954a159c266SJung-uk Kim Node = AcpiNsValidateHandle (ObjHandle);
955a159c266SJung-uk Kim if (!Node)
956a159c266SJung-uk Kim {
957a159c266SJung-uk Kim return (AE_BAD_PARAMETER);
958a159c266SJung-uk Kim }
959a159c266SJung-uk Kim
960a159c266SJung-uk Kim /*
9616f1f1a63SJung-uk Kim * We only care about regions and objects that are allowed to have
9626f1f1a63SJung-uk Kim * address space handlers
963a159c266SJung-uk Kim */
964a159c266SJung-uk Kim if ((Node->Type != ACPI_TYPE_REGION) &&
965a159c266SJung-uk Kim (Node != AcpiGbl_RootNode))
966a159c266SJung-uk Kim {
967a159c266SJung-uk Kim return (AE_OK);
968a159c266SJung-uk Kim }
969a159c266SJung-uk Kim
970a159c266SJung-uk Kim /* Check for an existing internal object */
971a159c266SJung-uk Kim
972a159c266SJung-uk Kim ObjDesc = AcpiNsGetAttachedObject (Node);
973a159c266SJung-uk Kim if (!ObjDesc)
974a159c266SJung-uk Kim {
975a159c266SJung-uk Kim /* No object, just exit */
976a159c266SJung-uk Kim
977a159c266SJung-uk Kim return (AE_OK);
978a159c266SJung-uk Kim }
979a159c266SJung-uk Kim
980a159c266SJung-uk Kim /* Object is a Region */
981a159c266SJung-uk Kim
98270e6ab8fSJung-uk Kim if (ObjDesc->Region.SpaceId != Info->SpaceId)
983a159c266SJung-uk Kim {
984a159c266SJung-uk Kim /* This region is for a different address space, just ignore it */
985a159c266SJung-uk Kim
986a159c266SJung-uk Kim return (AE_OK);
987a159c266SJung-uk Kim }
988a159c266SJung-uk Kim
98970e6ab8fSJung-uk Kim Info->RegRunCount++;
990f8146b88SJung-uk Kim Status = AcpiEvExecuteRegMethod (ObjDesc, Info->Function);
991a159c266SJung-uk Kim return (Status);
992a159c266SJung-uk Kim }
993a159c266SJung-uk Kim
994a159c266SJung-uk Kim
995a159c266SJung-uk Kim /*******************************************************************************
996a159c266SJung-uk Kim *
997fbde3477SJung-uk Kim * FUNCTION: AcpiEvExecuteOrphanRegMethod
998a159c266SJung-uk Kim *
999fbde3477SJung-uk Kim * PARAMETERS: DeviceNode - Namespace node for an ACPI device
1000fbde3477SJung-uk Kim * SpaceId - The address space ID
1001a159c266SJung-uk Kim *
1002a159c266SJung-uk Kim * RETURN: None
1003a159c266SJung-uk Kim *
1004fbde3477SJung-uk Kim * DESCRIPTION: Execute an "orphan" _REG method that appears under an ACPI
1005a159c266SJung-uk Kim * device. This is a _REG method that has no corresponding region
1006fbde3477SJung-uk Kim * within the device's scope. ACPI tables depending on these
1007fbde3477SJung-uk Kim * "orphan" _REG methods have been seen for both EC and GPIO
1008fbde3477SJung-uk Kim * Operation Regions. Presumably the Windows ACPI implementation
1009fbde3477SJung-uk Kim * always calls the _REG method independent of the presence of
1010fbde3477SJung-uk Kim * an actual Operation Region with the correct address space ID.
1011895f26a9SJung-uk Kim *
1012895f26a9SJung-uk Kim * MUTEX: Assumes the namespace is locked
1013a159c266SJung-uk Kim *
1014a159c266SJung-uk Kim ******************************************************************************/
1015a159c266SJung-uk Kim
1016a159c266SJung-uk Kim static void
AcpiEvExecuteOrphanRegMethod(ACPI_NAMESPACE_NODE * DeviceNode,ACPI_ADR_SPACE_TYPE SpaceId)1017fbde3477SJung-uk Kim AcpiEvExecuteOrphanRegMethod (
1018fbde3477SJung-uk Kim ACPI_NAMESPACE_NODE *DeviceNode,
1019fbde3477SJung-uk Kim ACPI_ADR_SPACE_TYPE SpaceId)
1020a159c266SJung-uk Kim {
1021895f26a9SJung-uk Kim ACPI_HANDLE RegMethod;
1022895f26a9SJung-uk Kim ACPI_NAMESPACE_NODE *NextNode;
1023a159c266SJung-uk Kim ACPI_STATUS Status;
1024a159c266SJung-uk Kim ACPI_OBJECT_LIST Args;
1025a159c266SJung-uk Kim ACPI_OBJECT Objects[2];
1026a159c266SJung-uk Kim
1027a159c266SJung-uk Kim
1028fbde3477SJung-uk Kim ACPI_FUNCTION_TRACE (EvExecuteOrphanRegMethod);
1029a159c266SJung-uk Kim
1030a159c266SJung-uk Kim
1031fbde3477SJung-uk Kim if (!DeviceNode)
1032a159c266SJung-uk Kim {
1033a159c266SJung-uk Kim return_VOID;
1034a159c266SJung-uk Kim }
1035a159c266SJung-uk Kim
1036a159c266SJung-uk Kim /* Namespace is currently locked, must release */
1037a159c266SJung-uk Kim
1038a159c266SJung-uk Kim (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
1039a159c266SJung-uk Kim
1040a159c266SJung-uk Kim /* Get a handle to a _REG method immediately under the EC device */
1041a159c266SJung-uk Kim
1042fbde3477SJung-uk Kim Status = AcpiGetHandle (DeviceNode, METHOD_NAME__REG, &RegMethod);
1043a159c266SJung-uk Kim if (ACPI_FAILURE (Status))
1044a159c266SJung-uk Kim {
1045895f26a9SJung-uk Kim goto Exit; /* There is no _REG method present */
1046a159c266SJung-uk Kim }
1047a159c266SJung-uk Kim
1048a159c266SJung-uk Kim /*
1049a159c266SJung-uk Kim * Execute the _REG method only if there is no Operation Region in
1050a159c266SJung-uk Kim * this scope with the Embedded Controller space ID. Otherwise, it
1051a159c266SJung-uk Kim * will already have been executed. Note, this allows for Regions
1052a159c266SJung-uk Kim * with other space IDs to be present; but the code below will then
1053895f26a9SJung-uk Kim * execute the _REG method with the EmbeddedControl SpaceID argument.
1054a159c266SJung-uk Kim */
1055fbde3477SJung-uk Kim NextNode = AcpiNsGetNextNode (DeviceNode, NULL);
1056a159c266SJung-uk Kim while (NextNode)
1057a159c266SJung-uk Kim {
1058a159c266SJung-uk Kim if ((NextNode->Type == ACPI_TYPE_REGION) &&
1059a159c266SJung-uk Kim (NextNode->Object) &&
1060fbde3477SJung-uk Kim (NextNode->Object->Region.SpaceId == SpaceId))
1061a159c266SJung-uk Kim {
1062895f26a9SJung-uk Kim goto Exit; /* Do not execute the _REG */
1063a159c266SJung-uk Kim }
1064895f26a9SJung-uk Kim
1065fbde3477SJung-uk Kim NextNode = AcpiNsGetNextNode (DeviceNode, NextNode);
1066a159c266SJung-uk Kim }
1067a159c266SJung-uk Kim
1068fbde3477SJung-uk Kim /* Evaluate the _REG(SpaceId,Connect) method */
1069a159c266SJung-uk Kim
1070a159c266SJung-uk Kim Args.Count = 2;
1071a159c266SJung-uk Kim Args.Pointer = Objects;
1072a159c266SJung-uk Kim Objects[0].Type = ACPI_TYPE_INTEGER;
1073fbde3477SJung-uk Kim Objects[0].Integer.Value = SpaceId;
1074a159c266SJung-uk Kim Objects[1].Type = ACPI_TYPE_INTEGER;
1075a159c266SJung-uk Kim Objects[1].Integer.Value = ACPI_REG_CONNECT;
1076a159c266SJung-uk Kim
1077a009b7dcSJung-uk Kim (void) AcpiEvaluateObject (RegMethod, NULL, &Args, NULL);
1078a159c266SJung-uk Kim
1079a159c266SJung-uk Kim Exit:
1080a159c266SJung-uk Kim /* We ignore all errors from above, don't care */
1081a159c266SJung-uk Kim
1082a009b7dcSJung-uk Kim (void) AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
1083a159c266SJung-uk Kim return_VOID;
1084a159c266SJung-uk Kim }
1085