Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygennsxfobj.c
Go to the documentation of this file.
00001 /******************************************************************************* 00002 * 00003 * Module Name: nsxfobj - Public interfaces to the ACPI subsystem 00004 * ACPI Object oriented interfaces 00005 * 00006 ******************************************************************************/ 00007 00008 /****************************************************************************** 00009 * 00010 * 1. Copyright Notice 00011 * 00012 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. 00013 * All rights reserved. 00014 * 00015 * 2. License 00016 * 00017 * 2.1. This is your license from Intel Corp. under its intellectual property 00018 * rights. You may have additional license terms from the party that provided 00019 * you this software, covering your right to use that party's intellectual 00020 * property rights. 00021 * 00022 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 00023 * copy of the source code appearing in this file ("Covered Code") an 00024 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 00025 * base code distributed originally by Intel ("Original Intel Code") to copy, 00026 * make derivatives, distribute, use and display any portion of the Covered 00027 * Code in any form, with the right to sublicense such rights; and 00028 * 00029 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 00030 * license (with the right to sublicense), under only those claims of Intel 00031 * patents that are infringed by the Original Intel Code, to make, use, sell, 00032 * offer to sell, and import the Covered Code and derivative works thereof 00033 * solely to the minimum extent necessary to exercise the above copyright 00034 * license, and in no event shall the patent license extend to any additions 00035 * to or modifications of the Original Intel Code. No other license or right 00036 * is granted directly or by implication, estoppel or otherwise; 00037 * 00038 * The above copyright and patent license is granted only if the following 00039 * conditions are met: 00040 * 00041 * 3. Conditions 00042 * 00043 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 00044 * Redistribution of source code of any substantial portion of the Covered 00045 * Code or modification with rights to further distribute source must include 00046 * the above Copyright Notice, the above License, this list of Conditions, 00047 * and the following Disclaimer and Export Compliance provision. In addition, 00048 * Licensee must cause all Covered Code to which Licensee contributes to 00049 * contain a file documenting the changes Licensee made to create that Covered 00050 * Code and the date of any change. Licensee must include in that file the 00051 * documentation of any changes made by any predecessor Licensee. Licensee 00052 * must include a prominent statement that the modification is derived, 00053 * directly or indirectly, from Original Intel Code. 00054 * 00055 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 00056 * Redistribution of source code of any substantial portion of the Covered 00057 * Code or modification without rights to further distribute source must 00058 * include the following Disclaimer and Export Compliance provision in the 00059 * documentation and/or other materials provided with distribution. In 00060 * addition, Licensee may not authorize further sublicense of source of any 00061 * portion of the Covered Code, and must include terms to the effect that the 00062 * license from Licensee to its licensee is limited to the intellectual 00063 * property embodied in the software Licensee provides to its licensee, and 00064 * not to intellectual property embodied in modifications its licensee may 00065 * make. 00066 * 00067 * 3.3. Redistribution of Executable. Redistribution in executable form of any 00068 * substantial portion of the Covered Code or modification must reproduce the 00069 * above Copyright Notice, and the following Disclaimer and Export Compliance 00070 * provision in the documentation and/or other materials provided with the 00071 * distribution. 00072 * 00073 * 3.4. Intel retains all right, title, and interest in and to the Original 00074 * Intel Code. 00075 * 00076 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 00077 * Intel shall be used in advertising or otherwise to promote the sale, use or 00078 * other dealings in products derived from or relating to the Covered Code 00079 * without prior written authorization from Intel. 00080 * 00081 * 4. Disclaimer and Export Compliance 00082 * 00083 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 00084 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 00085 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 00086 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 00087 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 00088 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 00089 * PARTICULAR PURPOSE. 00090 * 00091 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 00092 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 00093 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 00094 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 00095 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 00096 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 00097 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 00098 * LIMITED REMEDY. 00099 * 00100 * 4.3. Licensee shall not export, either directly or indirectly, any of this 00101 * software or system incorporating such software without first obtaining any 00102 * required license or other approval from the U. S. Department of Commerce or 00103 * any other agency or department of the United States Government. In the 00104 * event Licensee exports any such software from the United States or 00105 * re-exports any such software from a foreign destination, Licensee shall 00106 * ensure that the distribution and export/re-export of the software is in 00107 * compliance with all laws, regulations, orders, or other restrictions of the 00108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 00109 * any of its subsidiaries will export/re-export any technical data, process, 00110 * software, or service, directly or indirectly, to any country for which the 00111 * United States government or any agency thereof requires an export license, 00112 * other governmental approval, or letter of assurance, without first obtaining 00113 * such license, approval or letter. 00114 * 00115 *****************************************************************************/ 00116 00117 00118 #define __NSXFOBJ_C__ 00119 00120 #include "acpi.h" 00121 #include "accommon.h" 00122 #include "acnamesp.h" 00123 00124 00125 #define _COMPONENT ACPI_NAMESPACE 00126 ACPI_MODULE_NAME ("nsxfobj") 00127 00128 /******************************************************************************* 00129 * 00130 * FUNCTION: AcpiGetType 00131 * 00132 * PARAMETERS: Handle - Handle of object whose type is desired 00133 * RetType - Where the type will be placed 00134 * 00135 * RETURN: Status 00136 * 00137 * DESCRIPTION: This routine returns the type associatd with a particular handle 00138 * 00139 ******************************************************************************/ 00140 00141 ACPI_STATUS 00142 AcpiGetType ( 00143 ACPI_HANDLE Handle, 00144 ACPI_OBJECT_TYPE *RetType) 00145 { 00146 ACPI_NAMESPACE_NODE *Node; 00147 ACPI_STATUS Status; 00148 00149 00150 /* Parameter Validation */ 00151 00152 if (!RetType) 00153 { 00154 return (AE_BAD_PARAMETER); 00155 } 00156 00157 /* 00158 * Special case for the predefined Root Node 00159 * (return type ANY) 00160 */ 00161 if (Handle == ACPI_ROOT_OBJECT) 00162 { 00163 *RetType = ACPI_TYPE_ANY; 00164 return (AE_OK); 00165 } 00166 00167 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); 00168 if (ACPI_FAILURE (Status)) 00169 { 00170 return (Status); 00171 } 00172 00173 /* Convert and validate the handle */ 00174 00175 Node = AcpiNsValidateHandle (Handle); 00176 if (!Node) 00177 { 00178 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); 00179 return (AE_BAD_PARAMETER); 00180 } 00181 00182 *RetType = Node->Type; 00183 00184 00185 Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); 00186 return (Status); 00187 } 00188 00189 ACPI_EXPORT_SYMBOL (AcpiGetType) 00190 00191 00192 /******************************************************************************* 00193 * 00194 * FUNCTION: AcpiGetParent 00195 * 00196 * PARAMETERS: Handle - Handle of object whose parent is desired 00197 * RetHandle - Where the parent handle will be placed 00198 * 00199 * RETURN: Status 00200 * 00201 * DESCRIPTION: Returns a handle to the parent of the object represented by 00202 * Handle. 00203 * 00204 ******************************************************************************/ 00205 00206 ACPI_STATUS 00207 AcpiGetParent ( 00208 ACPI_HANDLE Handle, 00209 ACPI_HANDLE *RetHandle) 00210 { 00211 ACPI_NAMESPACE_NODE *Node; 00212 ACPI_NAMESPACE_NODE *ParentNode; 00213 ACPI_STATUS Status; 00214 00215 00216 if (!RetHandle) 00217 { 00218 return (AE_BAD_PARAMETER); 00219 } 00220 00221 /* Special case for the predefined Root Node (no parent) */ 00222 00223 if (Handle == ACPI_ROOT_OBJECT) 00224 { 00225 return (AE_NULL_ENTRY); 00226 } 00227 00228 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); 00229 if (ACPI_FAILURE (Status)) 00230 { 00231 return (Status); 00232 } 00233 00234 /* Convert and validate the handle */ 00235 00236 Node = AcpiNsValidateHandle (Handle); 00237 if (!Node) 00238 { 00239 Status = AE_BAD_PARAMETER; 00240 goto UnlockAndExit; 00241 } 00242 00243 /* Get the parent entry */ 00244 00245 ParentNode = Node->Parent; 00246 *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, ParentNode); 00247 00248 /* Return exception if parent is null */ 00249 00250 if (!ParentNode) 00251 { 00252 Status = AE_NULL_ENTRY; 00253 } 00254 00255 00256 UnlockAndExit: 00257 00258 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); 00259 return (Status); 00260 } 00261 00262 ACPI_EXPORT_SYMBOL (AcpiGetParent) 00263 00264 00265 /******************************************************************************* 00266 * 00267 * FUNCTION: AcpiGetNextObject 00268 * 00269 * PARAMETERS: Type - Type of object to be searched for 00270 * Parent - Parent object whose children we are getting 00271 * LastChild - Previous child that was found. 00272 * The NEXT child will be returned 00273 * RetHandle - Where handle to the next object is placed 00274 * 00275 * RETURN: Status 00276 * 00277 * DESCRIPTION: Return the next peer object within the namespace. If Handle is 00278 * valid, Scope is ignored. Otherwise, the first object within 00279 * Scope is returned. 00280 * 00281 ******************************************************************************/ 00282 00283 ACPI_STATUS 00284 AcpiGetNextObject ( 00285 ACPI_OBJECT_TYPE Type, 00286 ACPI_HANDLE Parent, 00287 ACPI_HANDLE Child, 00288 ACPI_HANDLE *RetHandle) 00289 { 00290 ACPI_STATUS Status; 00291 ACPI_NAMESPACE_NODE *Node; 00292 ACPI_NAMESPACE_NODE *ParentNode = NULL; 00293 ACPI_NAMESPACE_NODE *ChildNode = NULL; 00294 00295 00296 /* Parameter validation */ 00297 00298 if (Type > ACPI_TYPE_EXTERNAL_MAX) 00299 { 00300 return (AE_BAD_PARAMETER); 00301 } 00302 00303 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); 00304 if (ACPI_FAILURE (Status)) 00305 { 00306 return (Status); 00307 } 00308 00309 /* If null handle, use the parent */ 00310 00311 if (!Child) 00312 { 00313 /* Start search at the beginning of the specified scope */ 00314 00315 ParentNode = AcpiNsValidateHandle (Parent); 00316 if (!ParentNode) 00317 { 00318 Status = AE_BAD_PARAMETER; 00319 goto UnlockAndExit; 00320 } 00321 } 00322 else 00323 { 00324 /* Non-null handle, ignore the parent */ 00325 /* Convert and validate the handle */ 00326 00327 ChildNode = AcpiNsValidateHandle (Child); 00328 if (!ChildNode) 00329 { 00330 Status = AE_BAD_PARAMETER; 00331 goto UnlockAndExit; 00332 } 00333 } 00334 00335 /* Internal function does the real work */ 00336 00337 Node = AcpiNsGetNextNodeTyped (Type, ParentNode, ChildNode); 00338 if (!Node) 00339 { 00340 Status = AE_NOT_FOUND; 00341 goto UnlockAndExit; 00342 } 00343 00344 if (RetHandle) 00345 { 00346 *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, Node); 00347 } 00348 00349 00350 UnlockAndExit: 00351 00352 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); 00353 return (Status); 00354 } 00355 00356 ACPI_EXPORT_SYMBOL (AcpiGetNextObject) 00357 Generated on Fri May 25 2012 04:25:38 for ReactOS by
1.7.6.1
|