![]() |
|
|||
File indexing completed on 2025-05-11 08:24:02
0001 /****************************************************************************** 0002 * 0003 * Module Name: excreate - Named object creation 0004 * 0005 *****************************************************************************/ 0006 0007 /****************************************************************************** 0008 * 0009 * 1. Copyright Notice 0010 * 0011 * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp. 0012 * All rights reserved. 0013 * 0014 * 2. License 0015 * 0016 * 2.1. This is your license from Intel Corp. under its intellectual property 0017 * rights. You may have additional license terms from the party that provided 0018 * you this software, covering your right to use that party's intellectual 0019 * property rights. 0020 * 0021 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 0022 * copy of the source code appearing in this file ("Covered Code") an 0023 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 0024 * base code distributed originally by Intel ("Original Intel Code") to copy, 0025 * make derivatives, distribute, use and display any portion of the Covered 0026 * Code in any form, with the right to sublicense such rights; and 0027 * 0028 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 0029 * license (with the right to sublicense), under only those claims of Intel 0030 * patents that are infringed by the Original Intel Code, to make, use, sell, 0031 * offer to sell, and import the Covered Code and derivative works thereof 0032 * solely to the minimum extent necessary to exercise the above copyright 0033 * license, and in no event shall the patent license extend to any additions 0034 * to or modifications of the Original Intel Code. No other license or right 0035 * is granted directly or by implication, estoppel or otherwise; 0036 * 0037 * The above copyright and patent license is granted only if the following 0038 * conditions are met: 0039 * 0040 * 3. Conditions 0041 * 0042 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 0043 * Redistribution of source code of any substantial portion of the Covered 0044 * Code or modification with rights to further distribute source must include 0045 * the above Copyright Notice, the above License, this list of Conditions, 0046 * and the following Disclaimer and Export Compliance provision. In addition, 0047 * Licensee must cause all Covered Code to which Licensee contributes to 0048 * contain a file documenting the changes Licensee made to create that Covered 0049 * Code and the date of any change. Licensee must include in that file the 0050 * documentation of any changes made by any predecessor Licensee. Licensee 0051 * must include a prominent statement that the modification is derived, 0052 * directly or indirectly, from Original Intel Code. 0053 * 0054 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 0055 * Redistribution of source code of any substantial portion of the Covered 0056 * Code or modification without rights to further distribute source must 0057 * include the following Disclaimer and Export Compliance provision in the 0058 * documentation and/or other materials provided with distribution. In 0059 * addition, Licensee may not authorize further sublicense of source of any 0060 * portion of the Covered Code, and must include terms to the effect that the 0061 * license from Licensee to its licensee is limited to the intellectual 0062 * property embodied in the software Licensee provides to its licensee, and 0063 * not to intellectual property embodied in modifications its licensee may 0064 * make. 0065 * 0066 * 3.3. Redistribution of Executable. Redistribution in executable form of any 0067 * substantial portion of the Covered Code or modification must reproduce the 0068 * above Copyright Notice, and the following Disclaimer and Export Compliance 0069 * provision in the documentation and/or other materials provided with the 0070 * distribution. 0071 * 0072 * 3.4. Intel retains all right, title, and interest in and to the Original 0073 * Intel Code. 0074 * 0075 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 0076 * Intel shall be used in advertising or otherwise to promote the sale, use or 0077 * other dealings in products derived from or relating to the Covered Code 0078 * without prior written authorization from Intel. 0079 * 0080 * 4. Disclaimer and Export Compliance 0081 * 0082 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 0083 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 0084 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 0085 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 0086 0087 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 0088 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 0089 * PARTICULAR PURPOSE. 0090 * 0091 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 0092 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 0093 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 0094 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 0095 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 0096 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 0097 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 0098 * LIMITED REMEDY. 0099 * 0100 * 4.3. Licensee shall not export, either directly or indirectly, any of this 0101 * software or system incorporating such software without first obtaining any 0102 * required license or other approval from the U. S. Department of Commerce or 0103 * any other agency or department of the United States Government. In the 0104 * event Licensee exports any such software from the United States or 0105 * re-exports any such software from a foreign destination, Licensee shall 0106 * ensure that the distribution and export/re-export of the software is in 0107 * compliance with all laws, regulations, orders, or other restrictions of the 0108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 0109 * any of its subsidiaries will export/re-export any technical data, process, 0110 * software, or service, directly or indirectly, to any country for which the 0111 * United States government or any agency thereof requires an export license, 0112 * other governmental approval, or letter of assurance, without first obtaining 0113 * such license, approval or letter. 0114 * 0115 ***************************************************************************** 0116 * 0117 * Alternatively, you may choose to be licensed under the terms of the 0118 * following license: 0119 * 0120 * Redistribution and use in source and binary forms, with or without 0121 * modification, are permitted provided that the following conditions 0122 * are met: 0123 * 1. Redistributions of source code must retain the above copyright 0124 * notice, this list of conditions, and the following disclaimer, 0125 * without modification. 0126 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 0127 * substantially similar to the "NO WARRANTY" disclaimer below 0128 * ("Disclaimer") and any redistribution must be conditioned upon 0129 * including a substantially similar Disclaimer requirement for further 0130 * binary redistribution. 0131 * 3. Neither the names of the above-listed copyright holders nor the names 0132 * of any contributors may be used to endorse or promote products derived 0133 * from this software without specific prior written permission. 0134 * 0135 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 0136 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 0137 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 0138 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 0139 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 0140 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 0141 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0142 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0143 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0144 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 0145 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0146 * 0147 * Alternatively, you may choose to be licensed under the terms of the 0148 * GNU General Public License ("GPL") version 2 as published by the Free 0149 * Software Foundation. 0150 * 0151 *****************************************************************************/ 0152 0153 #include "acpi.h" 0154 #include "accommon.h" 0155 #include "acinterp.h" 0156 #include "amlcode.h" 0157 #include "acnamesp.h" 0158 0159 0160 #define _COMPONENT ACPI_EXECUTER 0161 ACPI_MODULE_NAME ("excreate") 0162 0163 0164 /******************************************************************************* 0165 * 0166 * FUNCTION: AcpiExCreateAlias 0167 * 0168 * PARAMETERS: WalkState - Current state, contains operands 0169 * 0170 * RETURN: Status 0171 * 0172 * DESCRIPTION: Create a new named alias 0173 * 0174 ******************************************************************************/ 0175 0176 ACPI_STATUS 0177 AcpiExCreateAlias ( 0178 ACPI_WALK_STATE *WalkState) 0179 { 0180 ACPI_NAMESPACE_NODE *TargetNode; 0181 ACPI_NAMESPACE_NODE *AliasNode; 0182 ACPI_STATUS Status = AE_OK; 0183 0184 0185 ACPI_FUNCTION_TRACE (ExCreateAlias); 0186 0187 0188 /* Get the source/alias operands (both namespace nodes) */ 0189 0190 AliasNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0]; 0191 TargetNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[1]; 0192 0193 if ((TargetNode->Type == ACPI_TYPE_LOCAL_ALIAS) || 0194 (TargetNode->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) 0195 { 0196 /* 0197 * Dereference an existing alias so that we don't create a chain 0198 * of aliases. With this code, we guarantee that an alias is 0199 * always exactly one level of indirection away from the 0200 * actual aliased name. 0201 */ 0202 TargetNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, TargetNode->Object); 0203 } 0204 0205 /* Ensure that the target node is valid */ 0206 0207 if (!TargetNode) 0208 { 0209 return_ACPI_STATUS (AE_NULL_OBJECT); 0210 } 0211 0212 /* Construct the alias object (a namespace node) */ 0213 0214 switch (TargetNode->Type) 0215 { 0216 case ACPI_TYPE_METHOD: 0217 /* 0218 * Control method aliases need to be differentiated with 0219 * a special type 0220 */ 0221 AliasNode->Type = ACPI_TYPE_LOCAL_METHOD_ALIAS; 0222 break; 0223 0224 default: 0225 /* 0226 * All other object types. 0227 * 0228 * The new alias has the type ALIAS and points to the original 0229 * NS node, not the object itself. 0230 */ 0231 AliasNode->Type = ACPI_TYPE_LOCAL_ALIAS; 0232 AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); 0233 break; 0234 } 0235 0236 /* Since both operands are Nodes, we don't need to delete them */ 0237 0238 AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); 0239 return_ACPI_STATUS (Status); 0240 } 0241 0242 0243 /******************************************************************************* 0244 * 0245 * FUNCTION: AcpiExCreateEvent 0246 * 0247 * PARAMETERS: WalkState - Current state 0248 * 0249 * RETURN: Status 0250 * 0251 * DESCRIPTION: Create a new event object 0252 * 0253 ******************************************************************************/ 0254 0255 ACPI_STATUS 0256 AcpiExCreateEvent ( 0257 ACPI_WALK_STATE *WalkState) 0258 { 0259 ACPI_STATUS Status; 0260 ACPI_OPERAND_OBJECT *ObjDesc; 0261 0262 0263 ACPI_FUNCTION_TRACE (ExCreateEvent); 0264 0265 0266 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_EVENT); 0267 if (!ObjDesc) 0268 { 0269 Status = AE_NO_MEMORY; 0270 goto Cleanup; 0271 } 0272 0273 /* 0274 * Create the actual OS semaphore, with zero initial units -- meaning 0275 * that the event is created in an unsignalled state 0276 */ 0277 Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, 0278 &ObjDesc->Event.OsSemaphore); 0279 if (ACPI_FAILURE (Status)) 0280 { 0281 goto Cleanup; 0282 } 0283 0284 /* Attach object to the Node */ 0285 0286 Status = AcpiNsAttachObject ( 0287 (ACPI_NAMESPACE_NODE *) WalkState->Operands[0], 0288 ObjDesc, ACPI_TYPE_EVENT); 0289 0290 Cleanup: 0291 /* 0292 * Remove local reference to the object (on error, will cause deletion 0293 * of both object and semaphore if present.) 0294 */ 0295 AcpiUtRemoveReference (ObjDesc); 0296 return_ACPI_STATUS (Status); 0297 } 0298 0299 0300 /******************************************************************************* 0301 * 0302 * FUNCTION: AcpiExCreateMutex 0303 * 0304 * PARAMETERS: WalkState - Current state 0305 * 0306 * RETURN: Status 0307 * 0308 * DESCRIPTION: Create a new mutex object 0309 * 0310 * Mutex (Name[0], SyncLevel[1]) 0311 * 0312 ******************************************************************************/ 0313 0314 ACPI_STATUS 0315 AcpiExCreateMutex ( 0316 ACPI_WALK_STATE *WalkState) 0317 { 0318 ACPI_STATUS Status = AE_OK; 0319 ACPI_OPERAND_OBJECT *ObjDesc; 0320 0321 0322 ACPI_FUNCTION_TRACE_PTR (ExCreateMutex, ACPI_WALK_OPERANDS); 0323 0324 0325 /* Create the new mutex object */ 0326 0327 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_MUTEX); 0328 if (!ObjDesc) 0329 { 0330 Status = AE_NO_MEMORY; 0331 goto Cleanup; 0332 } 0333 0334 /* Create the actual OS Mutex */ 0335 0336 Status = AcpiOsCreateMutex (&ObjDesc->Mutex.OsMutex); 0337 if (ACPI_FAILURE (Status)) 0338 { 0339 goto Cleanup; 0340 } 0341 0342 /* Init object and attach to NS node */ 0343 0344 ObjDesc->Mutex.SyncLevel = (UINT8) WalkState->Operands[1]->Integer.Value; 0345 ObjDesc->Mutex.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0]; 0346 0347 Status = AcpiNsAttachObject ( 0348 ObjDesc->Mutex.Node, ObjDesc, ACPI_TYPE_MUTEX); 0349 0350 0351 Cleanup: 0352 /* 0353 * Remove local reference to the object (on error, will cause deletion 0354 * of both object and semaphore if present.) 0355 */ 0356 AcpiUtRemoveReference (ObjDesc); 0357 return_ACPI_STATUS (Status); 0358 } 0359 0360 0361 /******************************************************************************* 0362 * 0363 * FUNCTION: AcpiExCreateRegion 0364 * 0365 * PARAMETERS: AmlStart - Pointer to the region declaration AML 0366 * AmlLength - Max length of the declaration AML 0367 * SpaceId - Address space ID for the region 0368 * WalkState - Current state 0369 * 0370 * RETURN: Status 0371 * 0372 * DESCRIPTION: Create a new operation region object 0373 * 0374 ******************************************************************************/ 0375 0376 ACPI_STATUS 0377 AcpiExCreateRegion ( 0378 UINT8 *AmlStart, 0379 UINT32 AmlLength, 0380 UINT8 SpaceId, 0381 ACPI_WALK_STATE *WalkState) 0382 { 0383 ACPI_STATUS Status; 0384 ACPI_OPERAND_OBJECT *ObjDesc; 0385 ACPI_NAMESPACE_NODE *Node; 0386 ACPI_OPERAND_OBJECT *RegionObj2; 0387 0388 0389 ACPI_FUNCTION_TRACE (ExCreateRegion); 0390 0391 0392 /* Get the Namespace Node */ 0393 0394 Node = WalkState->Op->Common.Node; 0395 0396 /* 0397 * If the region object is already attached to this node, 0398 * just return 0399 */ 0400 if (AcpiNsGetAttachedObject (Node)) 0401 { 0402 return_ACPI_STATUS (AE_OK); 0403 } 0404 0405 /* 0406 * Space ID must be one of the predefined IDs, or in the user-defined 0407 * range 0408 */ 0409 if (!AcpiIsValidSpaceId (SpaceId)) 0410 { 0411 /* 0412 * Print an error message, but continue. We don't want to abort 0413 * a table load for this exception. Instead, if the region is 0414 * actually used at runtime, abort the executing method. 0415 */ 0416 ACPI_ERROR ((AE_INFO, 0417 "Invalid/unknown Address Space ID: 0x%2.2X", SpaceId)); 0418 } 0419 0420 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n", 0421 AcpiUtGetRegionName (SpaceId), SpaceId)); 0422 0423 /* Create the region descriptor */ 0424 0425 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); 0426 if (!ObjDesc) 0427 { 0428 Status = AE_NO_MEMORY; 0429 goto Cleanup; 0430 } 0431 0432 /* 0433 * Remember location in AML stream of address & length 0434 * operands since they need to be evaluated at run time. 0435 */ 0436 RegionObj2 = AcpiNsGetSecondaryObject (ObjDesc); 0437 RegionObj2->Extra.AmlStart = AmlStart; 0438 RegionObj2->Extra.AmlLength = AmlLength; 0439 RegionObj2->Extra.Method_REG = NULL; 0440 if (WalkState->ScopeInfo) 0441 { 0442 RegionObj2->Extra.ScopeNode = WalkState->ScopeInfo->Scope.Node; 0443 } 0444 else 0445 { 0446 RegionObj2->Extra.ScopeNode = Node; 0447 } 0448 0449 /* Init the region from the operands */ 0450 0451 ObjDesc->Region.SpaceId = SpaceId; 0452 ObjDesc->Region.Address = 0; 0453 ObjDesc->Region.Length = 0; 0454 ObjDesc->Region.Pointer = NULL; 0455 ObjDesc->Region.Node = Node; 0456 ObjDesc->Region.Handler = NULL; 0457 ObjDesc->Common.Flags &= 0458 ~(AOPOBJ_SETUP_COMPLETE | AOPOBJ_REG_CONNECTED | 0459 AOPOBJ_OBJECT_INITIALIZED); 0460 0461 /* Install the new region object in the parent Node */ 0462 0463 Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION); 0464 0465 0466 Cleanup: 0467 0468 /* Remove local reference to the object */ 0469 0470 AcpiUtRemoveReference (ObjDesc); 0471 return_ACPI_STATUS (Status); 0472 } 0473 0474 0475 /******************************************************************************* 0476 * 0477 * FUNCTION: AcpiExCreateProcessor 0478 * 0479 * PARAMETERS: WalkState - Current state 0480 * 0481 * RETURN: Status 0482 * 0483 * DESCRIPTION: Create a new processor object and populate the fields 0484 * 0485 * Processor (Name[0], CpuID[1], PblockAddr[2], PblockLength[3]) 0486 * 0487 ******************************************************************************/ 0488 0489 ACPI_STATUS 0490 AcpiExCreateProcessor ( 0491 ACPI_WALK_STATE *WalkState) 0492 { 0493 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; 0494 ACPI_OPERAND_OBJECT *ObjDesc; 0495 ACPI_STATUS Status; 0496 0497 0498 ACPI_FUNCTION_TRACE_PTR (ExCreateProcessor, WalkState); 0499 0500 0501 /* Create the processor object */ 0502 0503 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PROCESSOR); 0504 if (!ObjDesc) 0505 { 0506 return_ACPI_STATUS (AE_NO_MEMORY); 0507 } 0508 0509 /* Initialize the processor object from the operands */ 0510 0511 ObjDesc->Processor.ProcId = (UINT8) Operand[1]->Integer.Value; 0512 ObjDesc->Processor.Length = (UINT8) Operand[3]->Integer.Value; 0513 ObjDesc->Processor.Address = (ACPI_IO_ADDRESS) Operand[2]->Integer.Value; 0514 0515 /* Install the processor object in the parent Node */ 0516 0517 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], 0518 ObjDesc, ACPI_TYPE_PROCESSOR); 0519 0520 /* Remove local reference to the object */ 0521 0522 AcpiUtRemoveReference (ObjDesc); 0523 return_ACPI_STATUS (Status); 0524 } 0525 0526 0527 /******************************************************************************* 0528 * 0529 * FUNCTION: AcpiExCreatePowerResource 0530 * 0531 * PARAMETERS: WalkState - Current state 0532 * 0533 * RETURN: Status 0534 * 0535 * DESCRIPTION: Create a new PowerResource object and populate the fields 0536 * 0537 * PowerResource (Name[0], SystemLevel[1], ResourceOrder[2]) 0538 * 0539 ******************************************************************************/ 0540 0541 ACPI_STATUS 0542 AcpiExCreatePowerResource ( 0543 ACPI_WALK_STATE *WalkState) 0544 { 0545 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; 0546 ACPI_STATUS Status; 0547 ACPI_OPERAND_OBJECT *ObjDesc; 0548 0549 0550 ACPI_FUNCTION_TRACE_PTR (ExCreatePowerResource, WalkState); 0551 0552 0553 /* Create the power resource object */ 0554 0555 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_POWER); 0556 if (!ObjDesc) 0557 { 0558 return_ACPI_STATUS (AE_NO_MEMORY); 0559 } 0560 0561 /* Initialize the power object from the operands */ 0562 0563 ObjDesc->PowerResource.SystemLevel = (UINT8) Operand[1]->Integer.Value; 0564 ObjDesc->PowerResource.ResourceOrder = (UINT16) Operand[2]->Integer.Value; 0565 0566 /* Install the power resource object in the parent Node */ 0567 0568 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], 0569 ObjDesc, ACPI_TYPE_POWER); 0570 0571 /* Remove local reference to the object */ 0572 0573 AcpiUtRemoveReference (ObjDesc); 0574 return_ACPI_STATUS (Status); 0575 } 0576 0577 0578 /******************************************************************************* 0579 * 0580 * FUNCTION: AcpiExCreateMethod 0581 * 0582 * PARAMETERS: AmlStart - First byte of the method's AML 0583 * AmlLength - AML byte count for this method 0584 * WalkState - Current state 0585 * 0586 * RETURN: Status 0587 * 0588 * DESCRIPTION: Create a new method object 0589 * 0590 ******************************************************************************/ 0591 0592 ACPI_STATUS 0593 AcpiExCreateMethod ( 0594 UINT8 *AmlStart, 0595 UINT32 AmlLength, 0596 ACPI_WALK_STATE *WalkState) 0597 { 0598 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; 0599 ACPI_OPERAND_OBJECT *ObjDesc; 0600 ACPI_STATUS Status; 0601 UINT8 MethodFlags; 0602 0603 0604 ACPI_FUNCTION_TRACE_PTR (ExCreateMethod, WalkState); 0605 0606 0607 /* Create a new method object */ 0608 0609 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); 0610 if (!ObjDesc) 0611 { 0612 Status = AE_NO_MEMORY; 0613 goto Exit; 0614 } 0615 0616 /* Save the method's AML pointer and length */ 0617 0618 ObjDesc->Method.AmlStart = AmlStart; 0619 ObjDesc->Method.AmlLength = AmlLength; 0620 ObjDesc->Method.Node = Operand[0]; 0621 0622 /* 0623 * Disassemble the method flags. Split off the ArgCount, Serialized 0624 * flag, and SyncLevel for efficiency. 0625 */ 0626 MethodFlags = (UINT8) Operand[1]->Integer.Value; 0627 ObjDesc->Method.ParamCount = (UINT8) 0628 (MethodFlags & AML_METHOD_ARG_COUNT); 0629 0630 /* 0631 * Get the SyncLevel. If method is serialized, a mutex will be 0632 * created for this method when it is parsed. 0633 */ 0634 if (MethodFlags & AML_METHOD_SERIALIZED) 0635 { 0636 ObjDesc->Method.InfoFlags = ACPI_METHOD_SERIALIZED; 0637 0638 /* 0639 * ACPI 1.0: SyncLevel = 0 0640 * ACPI 2.0: SyncLevel = SyncLevel in method declaration 0641 */ 0642 ObjDesc->Method.SyncLevel = (UINT8) 0643 ((MethodFlags & AML_METHOD_SYNC_LEVEL) >> 4); 0644 } 0645 0646 /* Attach the new object to the method Node */ 0647 0648 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], 0649 ObjDesc, ACPI_TYPE_METHOD); 0650 0651 /* Remove local reference to the object */ 0652 0653 AcpiUtRemoveReference (ObjDesc); 0654 0655 Exit: 0656 /* Remove a reference to the operand */ 0657 0658 AcpiUtRemoveReference (Operand[1]); 0659 return_ACPI_STATUS (Status); 0660 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |