xref: /haiku/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxfmutex.c (revision 6dde014f768e0ee49bae871ed857cf433837b9ff)
16822cda0SFredrik Holmqvist /*******************************************************************************
26822cda0SFredrik Holmqvist  *
36822cda0SFredrik Holmqvist  * Module Name: utxfmutex - external AML mutex access functions
46822cda0SFredrik Holmqvist  *
56822cda0SFredrik Holmqvist  ******************************************************************************/
66822cda0SFredrik Holmqvist 
76822cda0SFredrik Holmqvist /******************************************************************************
86822cda0SFredrik Holmqvist  *
96822cda0SFredrik Holmqvist  * 1. Copyright Notice
106822cda0SFredrik Holmqvist  *
11*6dde014fSPulkoMandy  * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
126822cda0SFredrik Holmqvist  * All rights reserved.
136822cda0SFredrik Holmqvist  *
146822cda0SFredrik Holmqvist  * 2. License
156822cda0SFredrik Holmqvist  *
166822cda0SFredrik Holmqvist  * 2.1. This is your license from Intel Corp. under its intellectual property
176822cda0SFredrik Holmqvist  * rights. You may have additional license terms from the party that provided
186822cda0SFredrik Holmqvist  * you this software, covering your right to use that party's intellectual
196822cda0SFredrik Holmqvist  * property rights.
206822cda0SFredrik Holmqvist  *
216822cda0SFredrik Holmqvist  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
226822cda0SFredrik Holmqvist  * copy of the source code appearing in this file ("Covered Code") an
236822cda0SFredrik Holmqvist  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
246822cda0SFredrik Holmqvist  * base code distributed originally by Intel ("Original Intel Code") to copy,
256822cda0SFredrik Holmqvist  * make derivatives, distribute, use and display any portion of the Covered
266822cda0SFredrik Holmqvist  * Code in any form, with the right to sublicense such rights; and
276822cda0SFredrik Holmqvist  *
286822cda0SFredrik Holmqvist  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
296822cda0SFredrik Holmqvist  * license (with the right to sublicense), under only those claims of Intel
306822cda0SFredrik Holmqvist  * patents that are infringed by the Original Intel Code, to make, use, sell,
316822cda0SFredrik Holmqvist  * offer to sell, and import the Covered Code and derivative works thereof
326822cda0SFredrik Holmqvist  * solely to the minimum extent necessary to exercise the above copyright
336822cda0SFredrik Holmqvist  * license, and in no event shall the patent license extend to any additions
346822cda0SFredrik Holmqvist  * to or modifications of the Original Intel Code. No other license or right
356822cda0SFredrik Holmqvist  * is granted directly or by implication, estoppel or otherwise;
366822cda0SFredrik Holmqvist  *
376822cda0SFredrik Holmqvist  * The above copyright and patent license is granted only if the following
386822cda0SFredrik Holmqvist  * conditions are met:
396822cda0SFredrik Holmqvist  *
406822cda0SFredrik Holmqvist  * 3. Conditions
416822cda0SFredrik Holmqvist  *
426822cda0SFredrik Holmqvist  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
436822cda0SFredrik Holmqvist  * Redistribution of source code of any substantial portion of the Covered
446822cda0SFredrik Holmqvist  * Code or modification with rights to further distribute source must include
456822cda0SFredrik Holmqvist  * the above Copyright Notice, the above License, this list of Conditions,
466822cda0SFredrik Holmqvist  * and the following Disclaimer and Export Compliance provision. In addition,
476822cda0SFredrik Holmqvist  * Licensee must cause all Covered Code to which Licensee contributes to
486822cda0SFredrik Holmqvist  * contain a file documenting the changes Licensee made to create that Covered
496822cda0SFredrik Holmqvist  * Code and the date of any change. Licensee must include in that file the
506822cda0SFredrik Holmqvist  * documentation of any changes made by any predecessor Licensee. Licensee
516822cda0SFredrik Holmqvist  * must include a prominent statement that the modification is derived,
526822cda0SFredrik Holmqvist  * directly or indirectly, from Original Intel Code.
536822cda0SFredrik Holmqvist  *
546822cda0SFredrik Holmqvist  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
556822cda0SFredrik Holmqvist  * Redistribution of source code of any substantial portion of the Covered
566822cda0SFredrik Holmqvist  * Code or modification without rights to further distribute source must
576822cda0SFredrik Holmqvist  * include the following Disclaimer and Export Compliance provision in the
586822cda0SFredrik Holmqvist  * documentation and/or other materials provided with distribution. In
596822cda0SFredrik Holmqvist  * addition, Licensee may not authorize further sublicense of source of any
606822cda0SFredrik Holmqvist  * portion of the Covered Code, and must include terms to the effect that the
616822cda0SFredrik Holmqvist  * license from Licensee to its licensee is limited to the intellectual
626822cda0SFredrik Holmqvist  * property embodied in the software Licensee provides to its licensee, and
636822cda0SFredrik Holmqvist  * not to intellectual property embodied in modifications its licensee may
646822cda0SFredrik Holmqvist  * make.
656822cda0SFredrik Holmqvist  *
666822cda0SFredrik Holmqvist  * 3.3. Redistribution of Executable. Redistribution in executable form of any
676822cda0SFredrik Holmqvist  * substantial portion of the Covered Code or modification must reproduce the
686822cda0SFredrik Holmqvist  * above Copyright Notice, and the following Disclaimer and Export Compliance
696822cda0SFredrik Holmqvist  * provision in the documentation and/or other materials provided with the
706822cda0SFredrik Holmqvist  * distribution.
716822cda0SFredrik Holmqvist  *
726822cda0SFredrik Holmqvist  * 3.4. Intel retains all right, title, and interest in and to the Original
736822cda0SFredrik Holmqvist  * Intel Code.
746822cda0SFredrik Holmqvist  *
756822cda0SFredrik Holmqvist  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
766822cda0SFredrik Holmqvist  * Intel shall be used in advertising or otherwise to promote the sale, use or
776822cda0SFredrik Holmqvist  * other dealings in products derived from or relating to the Covered Code
786822cda0SFredrik Holmqvist  * without prior written authorization from Intel.
796822cda0SFredrik Holmqvist  *
806822cda0SFredrik Holmqvist  * 4. Disclaimer and Export Compliance
816822cda0SFredrik Holmqvist  *
826822cda0SFredrik Holmqvist  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
836822cda0SFredrik Holmqvist  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
846822cda0SFredrik Holmqvist  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
856822cda0SFredrik Holmqvist  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
866822cda0SFredrik Holmqvist  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
876822cda0SFredrik Holmqvist  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
886822cda0SFredrik Holmqvist  * PARTICULAR PURPOSE.
896822cda0SFredrik Holmqvist  *
906822cda0SFredrik Holmqvist  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
916822cda0SFredrik Holmqvist  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
926822cda0SFredrik Holmqvist  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
936822cda0SFredrik Holmqvist  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
946822cda0SFredrik Holmqvist  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
956822cda0SFredrik Holmqvist  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
966822cda0SFredrik Holmqvist  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
976822cda0SFredrik Holmqvist  * LIMITED REMEDY.
986822cda0SFredrik Holmqvist  *
996822cda0SFredrik Holmqvist  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1006822cda0SFredrik Holmqvist  * software or system incorporating such software without first obtaining any
1016822cda0SFredrik Holmqvist  * required license or other approval from the U. S. Department of Commerce or
1026822cda0SFredrik Holmqvist  * any other agency or department of the United States Government. In the
1036822cda0SFredrik Holmqvist  * event Licensee exports any such software from the United States or
1046822cda0SFredrik Holmqvist  * re-exports any such software from a foreign destination, Licensee shall
1056822cda0SFredrik Holmqvist  * ensure that the distribution and export/re-export of the software is in
1066822cda0SFredrik Holmqvist  * compliance with all laws, regulations, orders, or other restrictions of the
1076822cda0SFredrik Holmqvist  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1086822cda0SFredrik Holmqvist  * any of its subsidiaries will export/re-export any technical data, process,
1096822cda0SFredrik Holmqvist  * software, or service, directly or indirectly, to any country for which the
1106822cda0SFredrik Holmqvist  * United States government or any agency thereof requires an export license,
1116822cda0SFredrik Holmqvist  * other governmental approval, or letter of assurance, without first obtaining
1126822cda0SFredrik Holmqvist  * such license, approval or letter.
1136822cda0SFredrik Holmqvist  *
114ff2e2f81SFredrik Holmqvist  *****************************************************************************
115ff2e2f81SFredrik Holmqvist  *
116ff2e2f81SFredrik Holmqvist  * Alternatively, you may choose to be licensed under the terms of the
117ff2e2f81SFredrik Holmqvist  * following license:
118ff2e2f81SFredrik Holmqvist  *
119ff2e2f81SFredrik Holmqvist  * Redistribution and use in source and binary forms, with or without
120ff2e2f81SFredrik Holmqvist  * modification, are permitted provided that the following conditions
121ff2e2f81SFredrik Holmqvist  * are met:
122ff2e2f81SFredrik Holmqvist  * 1. Redistributions of source code must retain the above copyright
123ff2e2f81SFredrik Holmqvist  *    notice, this list of conditions, and the following disclaimer,
124ff2e2f81SFredrik Holmqvist  *    without modification.
125ff2e2f81SFredrik Holmqvist  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126ff2e2f81SFredrik Holmqvist  *    substantially similar to the "NO WARRANTY" disclaimer below
127ff2e2f81SFredrik Holmqvist  *    ("Disclaimer") and any redistribution must be conditioned upon
128ff2e2f81SFredrik Holmqvist  *    including a substantially similar Disclaimer requirement for further
129ff2e2f81SFredrik Holmqvist  *    binary redistribution.
130ff2e2f81SFredrik Holmqvist  * 3. Neither the names of the above-listed copyright holders nor the names
131ff2e2f81SFredrik Holmqvist  *    of any contributors may be used to endorse or promote products derived
132ff2e2f81SFredrik Holmqvist  *    from this software without specific prior written permission.
133ff2e2f81SFredrik Holmqvist  *
134ff2e2f81SFredrik Holmqvist  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135ff2e2f81SFredrik Holmqvist  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136ff2e2f81SFredrik Holmqvist  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137ff2e2f81SFredrik Holmqvist  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138ff2e2f81SFredrik Holmqvist  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139ff2e2f81SFredrik Holmqvist  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140ff2e2f81SFredrik Holmqvist  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141ff2e2f81SFredrik Holmqvist  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142ff2e2f81SFredrik Holmqvist  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143ff2e2f81SFredrik Holmqvist  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144ff2e2f81SFredrik Holmqvist  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145ff2e2f81SFredrik Holmqvist  *
146ff2e2f81SFredrik Holmqvist  * Alternatively, you may choose to be licensed under the terms of the
147ff2e2f81SFredrik Holmqvist  * GNU General Public License ("GPL") version 2 as published by the Free
148ff2e2f81SFredrik Holmqvist  * Software Foundation.
149ff2e2f81SFredrik Holmqvist  *
1506822cda0SFredrik Holmqvist  *****************************************************************************/
1516822cda0SFredrik Holmqvist 
1526822cda0SFredrik Holmqvist #include "acpi.h"
1536822cda0SFredrik Holmqvist #include "accommon.h"
1546822cda0SFredrik Holmqvist #include "acnamesp.h"
1556822cda0SFredrik Holmqvist 
1566822cda0SFredrik Holmqvist 
1576822cda0SFredrik Holmqvist #define _COMPONENT          ACPI_UTILITIES
1586822cda0SFredrik Holmqvist         ACPI_MODULE_NAME    ("utxfmutex")
1596822cda0SFredrik Holmqvist 
1606822cda0SFredrik Holmqvist 
1616822cda0SFredrik Holmqvist /* Local prototypes */
1626822cda0SFredrik Holmqvist 
1636822cda0SFredrik Holmqvist static ACPI_STATUS
1646822cda0SFredrik Holmqvist AcpiUtGetMutexObject (
1656822cda0SFredrik Holmqvist     ACPI_HANDLE             Handle,
1666822cda0SFredrik Holmqvist     ACPI_STRING             Pathname,
1676822cda0SFredrik Holmqvist     ACPI_OPERAND_OBJECT     **RetObj);
1686822cda0SFredrik Holmqvist 
1696822cda0SFredrik Holmqvist 
1706822cda0SFredrik Holmqvist /*******************************************************************************
1716822cda0SFredrik Holmqvist  *
1726822cda0SFredrik Holmqvist  * FUNCTION:    AcpiUtGetMutexObject
1736822cda0SFredrik Holmqvist  *
1746822cda0SFredrik Holmqvist  * PARAMETERS:  Handle              - Mutex or prefix handle (optional)
1756822cda0SFredrik Holmqvist  *              Pathname            - Mutex pathname (optional)
1766822cda0SFredrik Holmqvist  *              RetObj              - Where the mutex object is returned
1776822cda0SFredrik Holmqvist  *
1786822cda0SFredrik Holmqvist  * RETURN:      Status
1796822cda0SFredrik Holmqvist  *
1806822cda0SFredrik Holmqvist  * DESCRIPTION: Get an AML mutex object. The mutex node is pointed to by
1816822cda0SFredrik Holmqvist  *              Handle:Pathname. Either Handle or Pathname can be NULL, but
1826822cda0SFredrik Holmqvist  *              not both.
1836822cda0SFredrik Holmqvist  *
1846822cda0SFredrik Holmqvist  ******************************************************************************/
1856822cda0SFredrik Holmqvist 
1866822cda0SFredrik Holmqvist static ACPI_STATUS
AcpiUtGetMutexObject(ACPI_HANDLE Handle,ACPI_STRING Pathname,ACPI_OPERAND_OBJECT ** RetObj)1876822cda0SFredrik Holmqvist AcpiUtGetMutexObject (
1886822cda0SFredrik Holmqvist     ACPI_HANDLE             Handle,
1896822cda0SFredrik Holmqvist     ACPI_STRING             Pathname,
1906822cda0SFredrik Holmqvist     ACPI_OPERAND_OBJECT     **RetObj)
1916822cda0SFredrik Holmqvist {
1926822cda0SFredrik Holmqvist     ACPI_NAMESPACE_NODE     *MutexNode;
1936822cda0SFredrik Holmqvist     ACPI_OPERAND_OBJECT     *MutexObj;
1946822cda0SFredrik Holmqvist     ACPI_STATUS             Status;
1956822cda0SFredrik Holmqvist 
1966822cda0SFredrik Holmqvist 
1976822cda0SFredrik Holmqvist     /* Parameter validation */
1986822cda0SFredrik Holmqvist 
1996822cda0SFredrik Holmqvist     if (!RetObj || (!Handle && !Pathname))
2006822cda0SFredrik Holmqvist     {
2016822cda0SFredrik Holmqvist         return (AE_BAD_PARAMETER);
2026822cda0SFredrik Holmqvist     }
2036822cda0SFredrik Holmqvist 
2046822cda0SFredrik Holmqvist     /* Get a the namespace node for the mutex */
2056822cda0SFredrik Holmqvist 
2066822cda0SFredrik Holmqvist     MutexNode = Handle;
2076822cda0SFredrik Holmqvist     if (Pathname != NULL)
2086822cda0SFredrik Holmqvist     {
209b64e8511SFredrik Holmqvist         Status = AcpiGetHandle (
210b64e8511SFredrik Holmqvist             Handle, Pathname, ACPI_CAST_PTR (ACPI_HANDLE, &MutexNode));
2116822cda0SFredrik Holmqvist         if (ACPI_FAILURE (Status))
2126822cda0SFredrik Holmqvist         {
2136822cda0SFredrik Holmqvist             return (Status);
2146822cda0SFredrik Holmqvist         }
2156822cda0SFredrik Holmqvist     }
2166822cda0SFredrik Holmqvist 
2176822cda0SFredrik Holmqvist     /* Ensure that we actually have a Mutex object */
2186822cda0SFredrik Holmqvist 
2196822cda0SFredrik Holmqvist     if (!MutexNode ||
2206822cda0SFredrik Holmqvist         (MutexNode->Type != ACPI_TYPE_MUTEX))
2216822cda0SFredrik Holmqvist     {
2226822cda0SFredrik Holmqvist         return (AE_TYPE);
2236822cda0SFredrik Holmqvist     }
2246822cda0SFredrik Holmqvist 
2256822cda0SFredrik Holmqvist     /* Get the low-level mutex object */
2266822cda0SFredrik Holmqvist 
2276822cda0SFredrik Holmqvist     MutexObj = AcpiNsGetAttachedObject (MutexNode);
2286822cda0SFredrik Holmqvist     if (!MutexObj)
2296822cda0SFredrik Holmqvist     {
2306822cda0SFredrik Holmqvist         return (AE_NULL_OBJECT);
2316822cda0SFredrik Holmqvist     }
2326822cda0SFredrik Holmqvist 
2336822cda0SFredrik Holmqvist     *RetObj = MutexObj;
2346822cda0SFredrik Holmqvist     return (AE_OK);
2356822cda0SFredrik Holmqvist }
2366822cda0SFredrik Holmqvist 
2376822cda0SFredrik Holmqvist 
2386822cda0SFredrik Holmqvist /*******************************************************************************
2396822cda0SFredrik Holmqvist  *
2406822cda0SFredrik Holmqvist  * FUNCTION:    AcpiAcquireMutex
2416822cda0SFredrik Holmqvist  *
2426822cda0SFredrik Holmqvist  * PARAMETERS:  Handle              - Mutex or prefix handle (optional)
2436822cda0SFredrik Holmqvist  *              Pathname            - Mutex pathname (optional)
2446822cda0SFredrik Holmqvist  *              Timeout             - Max time to wait for the lock (millisec)
2456822cda0SFredrik Holmqvist  *
2466822cda0SFredrik Holmqvist  * RETURN:      Status
2476822cda0SFredrik Holmqvist  *
2486822cda0SFredrik Holmqvist  * DESCRIPTION: Acquire an AML mutex. This is a device driver interface to
2496822cda0SFredrik Holmqvist  *              AML mutex objects, and allows for transaction locking between
2506822cda0SFredrik Holmqvist  *              drivers and AML code. The mutex node is pointed to by
2516822cda0SFredrik Holmqvist  *              Handle:Pathname. Either Handle or Pathname can be NULL, but
2526822cda0SFredrik Holmqvist  *              not both.
2536822cda0SFredrik Holmqvist  *
2546822cda0SFredrik Holmqvist  ******************************************************************************/
2556822cda0SFredrik Holmqvist 
2566822cda0SFredrik Holmqvist ACPI_STATUS
AcpiAcquireMutex(ACPI_HANDLE Handle,ACPI_STRING Pathname,UINT16 Timeout)2576822cda0SFredrik Holmqvist AcpiAcquireMutex (
2586822cda0SFredrik Holmqvist     ACPI_HANDLE             Handle,
2596822cda0SFredrik Holmqvist     ACPI_STRING             Pathname,
2606822cda0SFredrik Holmqvist     UINT16                  Timeout)
2616822cda0SFredrik Holmqvist {
2626822cda0SFredrik Holmqvist     ACPI_STATUS             Status;
2636822cda0SFredrik Holmqvist     ACPI_OPERAND_OBJECT     *MutexObj;
2646822cda0SFredrik Holmqvist 
2656822cda0SFredrik Holmqvist 
2666822cda0SFredrik Holmqvist     /* Get the low-level mutex associated with Handle:Pathname */
2676822cda0SFredrik Holmqvist 
2686822cda0SFredrik Holmqvist     Status = AcpiUtGetMutexObject (Handle, Pathname, &MutexObj);
2696822cda0SFredrik Holmqvist     if (ACPI_FAILURE (Status))
2706822cda0SFredrik Holmqvist     {
2716822cda0SFredrik Holmqvist         return (Status);
2726822cda0SFredrik Holmqvist     }
2736822cda0SFredrik Holmqvist 
2746822cda0SFredrik Holmqvist     /* Acquire the OS mutex */
2756822cda0SFredrik Holmqvist 
2766822cda0SFredrik Holmqvist     Status = AcpiOsAcquireMutex (MutexObj->Mutex.OsMutex, Timeout);
2776822cda0SFredrik Holmqvist     return (Status);
2786822cda0SFredrik Holmqvist }
2796822cda0SFredrik Holmqvist 
ACPI_EXPORT_SYMBOL(AcpiAcquireMutex)280ff2e2f81SFredrik Holmqvist ACPI_EXPORT_SYMBOL (AcpiAcquireMutex)
281ff2e2f81SFredrik Holmqvist 
2826822cda0SFredrik Holmqvist 
2836822cda0SFredrik Holmqvist /*******************************************************************************
2846822cda0SFredrik Holmqvist  *
2856822cda0SFredrik Holmqvist  * FUNCTION:    AcpiReleaseMutex
2866822cda0SFredrik Holmqvist  *
2876822cda0SFredrik Holmqvist  * PARAMETERS:  Handle              - Mutex or prefix handle (optional)
2886822cda0SFredrik Holmqvist  *              Pathname            - Mutex pathname (optional)
2896822cda0SFredrik Holmqvist  *
2906822cda0SFredrik Holmqvist  * RETURN:      Status
2916822cda0SFredrik Holmqvist  *
2926822cda0SFredrik Holmqvist  * DESCRIPTION: Release an AML mutex. This is a device driver interface to
2936822cda0SFredrik Holmqvist  *              AML mutex objects, and allows for transaction locking between
2946822cda0SFredrik Holmqvist  *              drivers and AML code. The mutex node is pointed to by
2956822cda0SFredrik Holmqvist  *              Handle:Pathname. Either Handle or Pathname can be NULL, but
2966822cda0SFredrik Holmqvist  *              not both.
2976822cda0SFredrik Holmqvist  *
2986822cda0SFredrik Holmqvist  ******************************************************************************/
2996822cda0SFredrik Holmqvist 
3006822cda0SFredrik Holmqvist ACPI_STATUS
3016822cda0SFredrik Holmqvist AcpiReleaseMutex (
3026822cda0SFredrik Holmqvist     ACPI_HANDLE             Handle,
3036822cda0SFredrik Holmqvist     ACPI_STRING             Pathname)
3046822cda0SFredrik Holmqvist {
3056822cda0SFredrik Holmqvist     ACPI_STATUS             Status;
3066822cda0SFredrik Holmqvist     ACPI_OPERAND_OBJECT     *MutexObj;
3076822cda0SFredrik Holmqvist 
3086822cda0SFredrik Holmqvist 
3096822cda0SFredrik Holmqvist     /* Get the low-level mutex associated with Handle:Pathname */
3106822cda0SFredrik Holmqvist 
3116822cda0SFredrik Holmqvist     Status = AcpiUtGetMutexObject (Handle, Pathname, &MutexObj);
3126822cda0SFredrik Holmqvist     if (ACPI_FAILURE (Status))
3136822cda0SFredrik Holmqvist     {
3146822cda0SFredrik Holmqvist         return (Status);
3156822cda0SFredrik Holmqvist     }
3166822cda0SFredrik Holmqvist 
3176822cda0SFredrik Holmqvist     /* Release the OS mutex */
3186822cda0SFredrik Holmqvist 
3196822cda0SFredrik Holmqvist     AcpiOsReleaseMutex (MutexObj->Mutex.OsMutex);
3206822cda0SFredrik Holmqvist     return (AE_OK);
3216822cda0SFredrik Holmqvist }
322ff2e2f81SFredrik Holmqvist 
323ff2e2f81SFredrik Holmqvist ACPI_EXPORT_SYMBOL (AcpiReleaseMutex)
324