1/****************************************************************************** 2 * 3 * Module Name: excreate - Named object creation
| 1/****************************************************************************** 2 * 3 * Module Name: excreate - Named object creation
|
4 * $Revision: 89 $
| 4 * $Revision: 92 $
|
5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp. 13 * All rights reserved. 14 * 15 * 2. License 16 * 17 * 2.1. This is your license from Intel Corp. under its intellectual property 18 * rights. You may have additional license terms from the party that provided 19 * you this software, covering your right to use that party's intellectual 20 * property rights. 21 * 22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23 * copy of the source code appearing in this file ("Covered Code") an 24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25 * base code distributed originally by Intel ("Original Intel Code") to copy, 26 * make derivatives, distribute, use and display any portion of the Covered 27 * Code in any form, with the right to sublicense such rights; and 28 * 29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30 * license (with the right to sublicense), under only those claims of Intel 31 * patents that are infringed by the Original Intel Code, to make, use, sell, 32 * offer to sell, and import the Covered Code and derivative works thereof 33 * solely to the minimum extent necessary to exercise the above copyright 34 * license, and in no event shall the patent license extend to any additions 35 * to or modifications of the Original Intel Code. No other license or right 36 * is granted directly or by implication, estoppel or otherwise; 37 * 38 * The above copyright and patent license is granted only if the following 39 * conditions are met: 40 * 41 * 3. Conditions 42 * 43 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44 * Redistribution of source code of any substantial portion of the Covered 45 * Code or modification with rights to further distribute source must include 46 * the above Copyright Notice, the above License, this list of Conditions, 47 * and the following Disclaimer and Export Compliance provision. In addition, 48 * Licensee must cause all Covered Code to which Licensee contributes to 49 * contain a file documenting the changes Licensee made to create that Covered 50 * Code and the date of any change. Licensee must include in that file the 51 * documentation of any changes made by any predecessor Licensee. Licensee 52 * must include a prominent statement that the modification is derived, 53 * directly or indirectly, from Original Intel Code. 54 * 55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56 * Redistribution of source code of any substantial portion of the Covered 57 * Code or modification without rights to further distribute source must 58 * include the following Disclaimer and Export Compliance provision in the 59 * documentation and/or other materials provided with distribution. In 60 * addition, Licensee may not authorize further sublicense of source of any 61 * portion of the Covered Code, and must include terms to the effect that the 62 * license from Licensee to its licensee is limited to the intellectual 63 * property embodied in the software Licensee provides to its licensee, and 64 * not to intellectual property embodied in modifications its licensee may 65 * make. 66 * 67 * 3.3. Redistribution of Executable. Redistribution in executable form of any 68 * substantial portion of the Covered Code or modification must reproduce the 69 * above Copyright Notice, and the following Disclaimer and Export Compliance 70 * provision in the documentation and/or other materials provided with the 71 * distribution. 72 * 73 * 3.4. Intel retains all right, title, and interest in and to the Original 74 * Intel Code. 75 * 76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77 * Intel shall be used in advertising or otherwise to promote the sale, use or 78 * other dealings in products derived from or relating to the Covered Code 79 * without prior written authorization from Intel. 80 * 81 * 4. Disclaimer and Export Compliance 82 * 83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87 88 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 89 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 90 * PARTICULAR PURPOSE. 91 * 92 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 93 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 94 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 95 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 96 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 97 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 98 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 99 * LIMITED REMEDY. 100 * 101 * 4.3. Licensee shall not export, either directly or indirectly, any of this 102 * software or system incorporating such software without first obtaining any 103 * required license or other approval from the U. S. Department of Commerce or 104 * any other agency or department of the United States Government. In the 105 * event Licensee exports any such software from the United States or 106 * re-exports any such software from a foreign destination, Licensee shall 107 * ensure that the distribution and export/re-export of the software is in 108 * compliance with all laws, regulations, orders, or other restrictions of the 109 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 110 * any of its subsidiaries will export/re-export any technical data, process, 111 * software, or service, directly or indirectly, to any country for which the 112 * United States government or any agency thereof requires an export license, 113 * other governmental approval, or letter of assurance, without first obtaining 114 * such license, approval or letter. 115 * 116 *****************************************************************************/ 117 118#define __EXCREATE_C__ 119 120#include "acpi.h"
| 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp. 13 * All rights reserved. 14 * 15 * 2. License 16 * 17 * 2.1. This is your license from Intel Corp. under its intellectual property 18 * rights. You may have additional license terms from the party that provided 19 * you this software, covering your right to use that party's intellectual 20 * property rights. 21 * 22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23 * copy of the source code appearing in this file ("Covered Code") an 24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25 * base code distributed originally by Intel ("Original Intel Code") to copy, 26 * make derivatives, distribute, use and display any portion of the Covered 27 * Code in any form, with the right to sublicense such rights; and 28 * 29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30 * license (with the right to sublicense), under only those claims of Intel 31 * patents that are infringed by the Original Intel Code, to make, use, sell, 32 * offer to sell, and import the Covered Code and derivative works thereof 33 * solely to the minimum extent necessary to exercise the above copyright 34 * license, and in no event shall the patent license extend to any additions 35 * to or modifications of the Original Intel Code. No other license or right 36 * is granted directly or by implication, estoppel or otherwise; 37 * 38 * The above copyright and patent license is granted only if the following 39 * conditions are met: 40 * 41 * 3. Conditions 42 * 43 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44 * Redistribution of source code of any substantial portion of the Covered 45 * Code or modification with rights to further distribute source must include 46 * the above Copyright Notice, the above License, this list of Conditions, 47 * and the following Disclaimer and Export Compliance provision. In addition, 48 * Licensee must cause all Covered Code to which Licensee contributes to 49 * contain a file documenting the changes Licensee made to create that Covered 50 * Code and the date of any change. Licensee must include in that file the 51 * documentation of any changes made by any predecessor Licensee. Licensee 52 * must include a prominent statement that the modification is derived, 53 * directly or indirectly, from Original Intel Code. 54 * 55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56 * Redistribution of source code of any substantial portion of the Covered 57 * Code or modification without rights to further distribute source must 58 * include the following Disclaimer and Export Compliance provision in the 59 * documentation and/or other materials provided with distribution. In 60 * addition, Licensee may not authorize further sublicense of source of any 61 * portion of the Covered Code, and must include terms to the effect that the 62 * license from Licensee to its licensee is limited to the intellectual 63 * property embodied in the software Licensee provides to its licensee, and 64 * not to intellectual property embodied in modifications its licensee may 65 * make. 66 * 67 * 3.3. Redistribution of Executable. Redistribution in executable form of any 68 * substantial portion of the Covered Code or modification must reproduce the 69 * above Copyright Notice, and the following Disclaimer and Export Compliance 70 * provision in the documentation and/or other materials provided with the 71 * distribution. 72 * 73 * 3.4. Intel retains all right, title, and interest in and to the Original 74 * Intel Code. 75 * 76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77 * Intel shall be used in advertising or otherwise to promote the sale, use or 78 * other dealings in products derived from or relating to the Covered Code 79 * without prior written authorization from Intel. 80 * 81 * 4. Disclaimer and Export Compliance 82 * 83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87 88 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 89 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 90 * PARTICULAR PURPOSE. 91 * 92 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 93 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 94 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 95 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 96 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 97 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 98 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 99 * LIMITED REMEDY. 100 * 101 * 4.3. Licensee shall not export, either directly or indirectly, any of this 102 * software or system incorporating such software without first obtaining any 103 * required license or other approval from the U. S. Department of Commerce or 104 * any other agency or department of the United States Government. In the 105 * event Licensee exports any such software from the United States or 106 * re-exports any such software from a foreign destination, Licensee shall 107 * ensure that the distribution and export/re-export of the software is in 108 * compliance with all laws, regulations, orders, or other restrictions of the 109 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 110 * any of its subsidiaries will export/re-export any technical data, process, 111 * software, or service, directly or indirectly, to any country for which the 112 * United States government or any agency thereof requires an export license, 113 * other governmental approval, or letter of assurance, without first obtaining 114 * such license, approval or letter. 115 * 116 *****************************************************************************/ 117 118#define __EXCREATE_C__ 119 120#include "acpi.h"
|
121#include "acparser.h"
| |
122#include "acinterp.h" 123#include "amlcode.h" 124#include "acnamesp.h" 125#include "acevents.h"
| 121#include "acinterp.h" 122#include "amlcode.h" 123#include "acnamesp.h" 124#include "acevents.h"
|
126#include "acdispat.h"
| |
127#include "actables.h" 128 129 130#define _COMPONENT ACPI_EXECUTER 131 ACPI_MODULE_NAME ("excreate") 132 133 134/***************************************************************************** 135 * 136 * FUNCTION: AcpiExCreateAlias 137 *
| 125#include "actables.h" 126 127 128#define _COMPONENT ACPI_EXECUTER 129 ACPI_MODULE_NAME ("excreate") 130 131 132/***************************************************************************** 133 * 134 * FUNCTION: AcpiExCreateAlias 135 *
|
138 * PARAMETERS: WalkState - Current state, contains List of 139 * operands for the opcode
| 136 * PARAMETERS: WalkState - Current state, contains operands
|
140 * 141 * RETURN: Status 142 * 143 * DESCRIPTION: Create a new named alias 144 * 145 ****************************************************************************/ 146 147ACPI_STATUS 148AcpiExCreateAlias ( 149 ACPI_WALK_STATE *WalkState) 150{ 151 ACPI_NAMESPACE_NODE *SourceNode; 152 ACPI_STATUS Status; 153 154 155 ACPI_FUNCTION_TRACE ("ExCreateAlias"); 156 157 158 /* Get the source/alias operands (both namespace nodes) */ 159 160 SourceNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[1]; 161 162 163 /* Attach the original source object to the new Alias Node */ 164 165 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0], 166 AcpiNsGetAttachedObject (SourceNode), 167 SourceNode->Type); 168 169 /* 170 * The new alias assumes the type of the source, but it points 171 * to the same object. The reference count of the object has an 172 * additional reference to prevent deletion out from under either the 173 * source or the alias Node 174 */ 175 176 /* Since both operands are Nodes, we don't need to delete them */ 177 178 return_ACPI_STATUS (Status); 179} 180 181 182/***************************************************************************** 183 * 184 * FUNCTION: AcpiExCreateEvent 185 * 186 * PARAMETERS: WalkState - Current state 187 * 188 * RETURN: Status 189 * 190 * DESCRIPTION: Create a new event object 191 * 192 ****************************************************************************/ 193 194ACPI_STATUS 195AcpiExCreateEvent ( 196 ACPI_WALK_STATE *WalkState) 197{ 198 ACPI_STATUS Status; 199 ACPI_OPERAND_OBJECT *ObjDesc; 200 201 202 ACPI_FUNCTION_TRACE ("ExCreateEvent"); 203 204 205 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_EVENT); 206 if (!ObjDesc) 207 { 208 Status = AE_NO_MEMORY; 209 goto Cleanup; 210 } 211 212 /* 213 * Create the actual OS semaphore, with zero initial units -- meaning 214 * that the event is created in an unsignalled state 215 */ 216 Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, 217 &ObjDesc->Event.Semaphore); 218 if (ACPI_FAILURE (Status)) 219 { 220 goto Cleanup; 221 } 222 223 /* Attach object to the Node */ 224 225 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0], 226 ObjDesc, ACPI_TYPE_EVENT); 227 228Cleanup: 229 /* 230 * Remove local reference to the object (on error, will cause deletion 231 * of both object and semaphore if present.) 232 */ 233 AcpiUtRemoveReference (ObjDesc); 234 return_ACPI_STATUS (Status); 235} 236 237 238/***************************************************************************** 239 * 240 * FUNCTION: AcpiExCreateMutex 241 * 242 * PARAMETERS: WalkState - Current state 243 * 244 * RETURN: Status 245 * 246 * DESCRIPTION: Create a new mutex object 247 * 248 * Mutex (Name[0], SyncLevel[1]) 249 * 250 ****************************************************************************/ 251 252ACPI_STATUS 253AcpiExCreateMutex ( 254 ACPI_WALK_STATE *WalkState) 255{ 256 ACPI_STATUS Status = AE_OK; 257 ACPI_OPERAND_OBJECT *ObjDesc; 258 259 260 ACPI_FUNCTION_TRACE_PTR ("ExCreateMutex", ACPI_WALK_OPERANDS); 261 262 263 /* Create the new mutex object */ 264 265 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_MUTEX); 266 if (!ObjDesc) 267 { 268 Status = AE_NO_MEMORY; 269 goto Cleanup; 270 } 271 272 /* 273 * Create the actual OS semaphore. 274 * One unit max to make it a mutex, with one initial unit to allow 275 * the mutex to be acquired. 276 */ 277 Status = AcpiOsCreateSemaphore (1, 1, &ObjDesc->Mutex.Semaphore); 278 if (ACPI_FAILURE (Status)) 279 { 280 goto Cleanup; 281 } 282 283 /* Init object and attach to NS node */ 284 285 ObjDesc->Mutex.SyncLevel = (UINT8) WalkState->Operands[1]->Integer.Value; 286 287 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0], 288 ObjDesc, ACPI_TYPE_MUTEX); 289 290 291Cleanup: 292 /* 293 * Remove local reference to the object (on error, will cause deletion 294 * of both object and semaphore if present.) 295 */ 296 AcpiUtRemoveReference (ObjDesc); 297 return_ACPI_STATUS (Status); 298} 299 300 301/***************************************************************************** 302 * 303 * FUNCTION: AcpiExCreateRegion 304 * 305 * PARAMETERS: AmlStart - Pointer to the region declaration AML 306 * AmlLength - Max length of the declaration AML 307 * Operands - List of operands for the opcode 308 * WalkState - Current state 309 * 310 * RETURN: Status 311 * 312 * DESCRIPTION: Create a new operation region object 313 * 314 ****************************************************************************/ 315 316ACPI_STATUS 317AcpiExCreateRegion ( 318 UINT8 *AmlStart, 319 UINT32 AmlLength, 320 UINT8 RegionSpace, 321 ACPI_WALK_STATE *WalkState) 322{ 323 ACPI_STATUS Status; 324 ACPI_OPERAND_OBJECT *ObjDesc; 325 ACPI_NAMESPACE_NODE *Node; 326 ACPI_OPERAND_OBJECT *RegionObj2; 327 328 329 ACPI_FUNCTION_TRACE ("ExCreateRegion"); 330 331 332 /* Get the Node from the object stack */ 333
| 137 * 138 * RETURN: Status 139 * 140 * DESCRIPTION: Create a new named alias 141 * 142 ****************************************************************************/ 143 144ACPI_STATUS 145AcpiExCreateAlias ( 146 ACPI_WALK_STATE *WalkState) 147{ 148 ACPI_NAMESPACE_NODE *SourceNode; 149 ACPI_STATUS Status; 150 151 152 ACPI_FUNCTION_TRACE ("ExCreateAlias"); 153 154 155 /* Get the source/alias operands (both namespace nodes) */ 156 157 SourceNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[1]; 158 159 160 /* Attach the original source object to the new Alias Node */ 161 162 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0], 163 AcpiNsGetAttachedObject (SourceNode), 164 SourceNode->Type); 165 166 /* 167 * The new alias assumes the type of the source, but it points 168 * to the same object. The reference count of the object has an 169 * additional reference to prevent deletion out from under either the 170 * source or the alias Node 171 */ 172 173 /* Since both operands are Nodes, we don't need to delete them */ 174 175 return_ACPI_STATUS (Status); 176} 177 178 179/***************************************************************************** 180 * 181 * FUNCTION: AcpiExCreateEvent 182 * 183 * PARAMETERS: WalkState - Current state 184 * 185 * RETURN: Status 186 * 187 * DESCRIPTION: Create a new event object 188 * 189 ****************************************************************************/ 190 191ACPI_STATUS 192AcpiExCreateEvent ( 193 ACPI_WALK_STATE *WalkState) 194{ 195 ACPI_STATUS Status; 196 ACPI_OPERAND_OBJECT *ObjDesc; 197 198 199 ACPI_FUNCTION_TRACE ("ExCreateEvent"); 200 201 202 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_EVENT); 203 if (!ObjDesc) 204 { 205 Status = AE_NO_MEMORY; 206 goto Cleanup; 207 } 208 209 /* 210 * Create the actual OS semaphore, with zero initial units -- meaning 211 * that the event is created in an unsignalled state 212 */ 213 Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, 214 &ObjDesc->Event.Semaphore); 215 if (ACPI_FAILURE (Status)) 216 { 217 goto Cleanup; 218 } 219 220 /* Attach object to the Node */ 221 222 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0], 223 ObjDesc, ACPI_TYPE_EVENT); 224 225Cleanup: 226 /* 227 * Remove local reference to the object (on error, will cause deletion 228 * of both object and semaphore if present.) 229 */ 230 AcpiUtRemoveReference (ObjDesc); 231 return_ACPI_STATUS (Status); 232} 233 234 235/***************************************************************************** 236 * 237 * FUNCTION: AcpiExCreateMutex 238 * 239 * PARAMETERS: WalkState - Current state 240 * 241 * RETURN: Status 242 * 243 * DESCRIPTION: Create a new mutex object 244 * 245 * Mutex (Name[0], SyncLevel[1]) 246 * 247 ****************************************************************************/ 248 249ACPI_STATUS 250AcpiExCreateMutex ( 251 ACPI_WALK_STATE *WalkState) 252{ 253 ACPI_STATUS Status = AE_OK; 254 ACPI_OPERAND_OBJECT *ObjDesc; 255 256 257 ACPI_FUNCTION_TRACE_PTR ("ExCreateMutex", ACPI_WALK_OPERANDS); 258 259 260 /* Create the new mutex object */ 261 262 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_MUTEX); 263 if (!ObjDesc) 264 { 265 Status = AE_NO_MEMORY; 266 goto Cleanup; 267 } 268 269 /* 270 * Create the actual OS semaphore. 271 * One unit max to make it a mutex, with one initial unit to allow 272 * the mutex to be acquired. 273 */ 274 Status = AcpiOsCreateSemaphore (1, 1, &ObjDesc->Mutex.Semaphore); 275 if (ACPI_FAILURE (Status)) 276 { 277 goto Cleanup; 278 } 279 280 /* Init object and attach to NS node */ 281 282 ObjDesc->Mutex.SyncLevel = (UINT8) WalkState->Operands[1]->Integer.Value; 283 284 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0], 285 ObjDesc, ACPI_TYPE_MUTEX); 286 287 288Cleanup: 289 /* 290 * Remove local reference to the object (on error, will cause deletion 291 * of both object and semaphore if present.) 292 */ 293 AcpiUtRemoveReference (ObjDesc); 294 return_ACPI_STATUS (Status); 295} 296 297 298/***************************************************************************** 299 * 300 * FUNCTION: AcpiExCreateRegion 301 * 302 * PARAMETERS: AmlStart - Pointer to the region declaration AML 303 * AmlLength - Max length of the declaration AML 304 * Operands - List of operands for the opcode 305 * WalkState - Current state 306 * 307 * RETURN: Status 308 * 309 * DESCRIPTION: Create a new operation region object 310 * 311 ****************************************************************************/ 312 313ACPI_STATUS 314AcpiExCreateRegion ( 315 UINT8 *AmlStart, 316 UINT32 AmlLength, 317 UINT8 RegionSpace, 318 ACPI_WALK_STATE *WalkState) 319{ 320 ACPI_STATUS Status; 321 ACPI_OPERAND_OBJECT *ObjDesc; 322 ACPI_NAMESPACE_NODE *Node; 323 ACPI_OPERAND_OBJECT *RegionObj2; 324 325 326 ACPI_FUNCTION_TRACE ("ExCreateRegion"); 327 328 329 /* Get the Node from the object stack */ 330
|
334 Node = WalkState->Op->Node;
| 331 Node = WalkState->Op->Common.Node;
|
335 336 /* 337 * If the region object is already attached to this node, 338 * just return 339 */ 340 if (AcpiNsGetAttachedObject (Node)) 341 { 342 return_ACPI_STATUS (AE_OK); 343 } 344 345 /* 346 * Space ID must be one of the predefined IDs, or in the user-defined 347 * range 348 */ 349 if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) && 350 (RegionSpace < ACPI_USER_REGION_BEGIN)) 351 { 352 ACPI_REPORT_ERROR (("Invalid AddressSpace type %X\n", RegionSpace)); 353 return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); 354 } 355 356 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n", 357 AcpiUtGetRegionName (RegionSpace), RegionSpace)); 358 359 360 /* Create the region descriptor */ 361 362 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); 363 if (!ObjDesc) 364 { 365 Status = AE_NO_MEMORY; 366 goto Cleanup; 367 } 368 369 /* 370 * Remember location in AML stream of address & length 371 * operands since they need to be evaluated at run time. 372 */ 373 RegionObj2 = ObjDesc->Common.NextObject; 374 RegionObj2->Extra.AmlStart = AmlStart; 375 RegionObj2->Extra.AmlLength = AmlLength; 376 377 /* Init the region from the operands */ 378 379 ObjDesc->Region.SpaceId = RegionSpace; 380 ObjDesc->Region.Address = 0; 381 ObjDesc->Region.Length = 0; 382 ObjDesc->Region.Node = Node; 383 384 /* Install the new region object in the parent Node */ 385 386 Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION); 387 388 389Cleanup: 390 391 /* Remove local reference to the object */ 392 393 AcpiUtRemoveReference (ObjDesc); 394 return_ACPI_STATUS (Status); 395} 396 397 398/***************************************************************************** 399 * 400 * FUNCTION: AcpiExCreateTableRegion 401 * 402 * PARAMETERS: WalkState - Current state 403 * 404 * RETURN: Status 405 * 406 * DESCRIPTION: Create a new DataTableRegion object 407 * 408 ****************************************************************************/ 409 410ACPI_STATUS 411AcpiExCreateTableRegion ( 412 ACPI_WALK_STATE *WalkState) 413{ 414 ACPI_STATUS Status; 415 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; 416 ACPI_OPERAND_OBJECT *ObjDesc; 417 ACPI_NAMESPACE_NODE *Node; 418 ACPI_TABLE_HEADER *Table; 419 ACPI_OPERAND_OBJECT *RegionObj2; 420 421 422 ACPI_FUNCTION_TRACE ("ExCreateTableRegion"); 423 424 /* Get the Node from the object stack */ 425
| 332 333 /* 334 * If the region object is already attached to this node, 335 * just return 336 */ 337 if (AcpiNsGetAttachedObject (Node)) 338 { 339 return_ACPI_STATUS (AE_OK); 340 } 341 342 /* 343 * Space ID must be one of the predefined IDs, or in the user-defined 344 * range 345 */ 346 if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) && 347 (RegionSpace < ACPI_USER_REGION_BEGIN)) 348 { 349 ACPI_REPORT_ERROR (("Invalid AddressSpace type %X\n", RegionSpace)); 350 return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); 351 } 352 353 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n", 354 AcpiUtGetRegionName (RegionSpace), RegionSpace)); 355 356 357 /* Create the region descriptor */ 358 359 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); 360 if (!ObjDesc) 361 { 362 Status = AE_NO_MEMORY; 363 goto Cleanup; 364 } 365 366 /* 367 * Remember location in AML stream of address & length 368 * operands since they need to be evaluated at run time. 369 */ 370 RegionObj2 = ObjDesc->Common.NextObject; 371 RegionObj2->Extra.AmlStart = AmlStart; 372 RegionObj2->Extra.AmlLength = AmlLength; 373 374 /* Init the region from the operands */ 375 376 ObjDesc->Region.SpaceId = RegionSpace; 377 ObjDesc->Region.Address = 0; 378 ObjDesc->Region.Length = 0; 379 ObjDesc->Region.Node = Node; 380 381 /* Install the new region object in the parent Node */ 382 383 Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION); 384 385 386Cleanup: 387 388 /* Remove local reference to the object */ 389 390 AcpiUtRemoveReference (ObjDesc); 391 return_ACPI_STATUS (Status); 392} 393 394 395/***************************************************************************** 396 * 397 * FUNCTION: AcpiExCreateTableRegion 398 * 399 * PARAMETERS: WalkState - Current state 400 * 401 * RETURN: Status 402 * 403 * DESCRIPTION: Create a new DataTableRegion object 404 * 405 ****************************************************************************/ 406 407ACPI_STATUS 408AcpiExCreateTableRegion ( 409 ACPI_WALK_STATE *WalkState) 410{ 411 ACPI_STATUS Status; 412 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; 413 ACPI_OPERAND_OBJECT *ObjDesc; 414 ACPI_NAMESPACE_NODE *Node; 415 ACPI_TABLE_HEADER *Table; 416 ACPI_OPERAND_OBJECT *RegionObj2; 417 418 419 ACPI_FUNCTION_TRACE ("ExCreateTableRegion"); 420 421 /* Get the Node from the object stack */ 422
|
426 Node = WalkState->Op->Node;
| 423 Node = WalkState->Op->Common.Node;
|
427 428 /* 429 * If the region object is already attached to this node, 430 * just return 431 */ 432 if (AcpiNsGetAttachedObject (Node)) 433 { 434 return_ACPI_STATUS (AE_OK); 435 } 436 437 /* Find the ACPI table */ 438 439 Status = AcpiTbFindTable (Operand[1]->String.Pointer, 440 Operand[2]->String.Pointer, 441 Operand[3]->String.Pointer, &Table); 442 443 if (ACPI_FAILURE (Status)) 444 { 445 return_ACPI_STATUS (Status); 446 } 447 448 /* Create the region descriptor */ 449 450 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); 451 if (!ObjDesc) 452 { 453 return_ACPI_STATUS (AE_NO_MEMORY); 454 } 455 456 RegionObj2 = ObjDesc->Common.NextObject; 457 RegionObj2->Extra.RegionContext = NULL; 458 459 /* Init the region from the operands */ 460 461 ObjDesc->Region.SpaceId = REGION_DATA_TABLE; 462 ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table); 463 ObjDesc->Region.Length = Table->Length; 464 ObjDesc->Region.Node = Node; 465 ObjDesc->Region.Flags = AOPOBJ_DATA_VALID; 466 467 /* Install the new region object in the parent Node */ 468 469 Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION); 470 if (ACPI_FAILURE (Status)) 471 { 472 goto Cleanup; 473 } 474 475 Status = AcpiEvInitializeRegion (ObjDesc, FALSE); 476 if (ACPI_FAILURE (Status)) 477 { 478 if (Status == AE_NOT_EXIST) 479 { 480 Status = AE_OK; 481 } 482 else 483 { 484 goto Cleanup; 485 } 486 } 487 488 ObjDesc->Region.Flags |= AOPOBJ_SETUP_COMPLETE; 489 490 491Cleanup: 492 493 /* Remove local reference to the object */ 494 495 AcpiUtRemoveReference (ObjDesc); 496 return_ACPI_STATUS (Status); 497} 498 499 500/***************************************************************************** 501 * 502 * FUNCTION: AcpiExCreateProcessor 503 *
| 424 425 /* 426 * If the region object is already attached to this node, 427 * just return 428 */ 429 if (AcpiNsGetAttachedObject (Node)) 430 { 431 return_ACPI_STATUS (AE_OK); 432 } 433 434 /* Find the ACPI table */ 435 436 Status = AcpiTbFindTable (Operand[1]->String.Pointer, 437 Operand[2]->String.Pointer, 438 Operand[3]->String.Pointer, &Table); 439 440 if (ACPI_FAILURE (Status)) 441 { 442 return_ACPI_STATUS (Status); 443 } 444 445 /* Create the region descriptor */ 446 447 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); 448 if (!ObjDesc) 449 { 450 return_ACPI_STATUS (AE_NO_MEMORY); 451 } 452 453 RegionObj2 = ObjDesc->Common.NextObject; 454 RegionObj2->Extra.RegionContext = NULL; 455 456 /* Init the region from the operands */ 457 458 ObjDesc->Region.SpaceId = REGION_DATA_TABLE; 459 ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table); 460 ObjDesc->Region.Length = Table->Length; 461 ObjDesc->Region.Node = Node; 462 ObjDesc->Region.Flags = AOPOBJ_DATA_VALID; 463 464 /* Install the new region object in the parent Node */ 465 466 Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION); 467 if (ACPI_FAILURE (Status)) 468 { 469 goto Cleanup; 470 } 471 472 Status = AcpiEvInitializeRegion (ObjDesc, FALSE); 473 if (ACPI_FAILURE (Status)) 474 { 475 if (Status == AE_NOT_EXIST) 476 { 477 Status = AE_OK; 478 } 479 else 480 { 481 goto Cleanup; 482 } 483 } 484 485 ObjDesc->Region.Flags |= AOPOBJ_SETUP_COMPLETE; 486 487 488Cleanup: 489 490 /* Remove local reference to the object */ 491 492 AcpiUtRemoveReference (ObjDesc); 493 return_ACPI_STATUS (Status); 494} 495 496 497/***************************************************************************** 498 * 499 * FUNCTION: AcpiExCreateProcessor 500 *
|
504 * PARAMETERS: Op - Op containing the Processor definition and 505 * args 506 * ProcessorNode - Parent Node for the processor object
| 501 * PARAMETERS: WalkState - Current state
|
507 * 508 * RETURN: Status 509 * 510 * DESCRIPTION: Create a new processor object and populate the fields 511 * 512 * Processor (Name[0], CpuID[1], PblockAddr[2], PblockLength[3]) 513 * 514 ****************************************************************************/ 515 516ACPI_STATUS 517AcpiExCreateProcessor ( 518 ACPI_WALK_STATE *WalkState) 519{ 520 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; 521 ACPI_OPERAND_OBJECT *ObjDesc; 522 ACPI_STATUS Status; 523 524 525 ACPI_FUNCTION_TRACE_PTR ("ExCreateProcessor", WalkState); 526 527 528 /* Create the processor object */ 529 530 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PROCESSOR); 531 if (!ObjDesc) 532 { 533 return_ACPI_STATUS (AE_NO_MEMORY); 534 } 535 536 /* 537 * Initialize the processor object from the operands 538 */ 539 ObjDesc->Processor.ProcId = (UINT8) Operand[1]->Integer.Value; 540 ObjDesc->Processor.Address = (ACPI_IO_ADDRESS) Operand[2]->Integer.Value; 541 ObjDesc->Processor.Length = (UINT8) Operand[3]->Integer.Value; 542 543 /* Install the processor object in the parent Node */ 544 545 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], 546 ObjDesc, ACPI_TYPE_PROCESSOR); 547 548 549 /* Remove local reference to the object */ 550 551 AcpiUtRemoveReference (ObjDesc); 552 return_ACPI_STATUS (Status); 553} 554 555 556/***************************************************************************** 557 * 558 * FUNCTION: AcpiExCreatePowerResource 559 *
| 502 * 503 * RETURN: Status 504 * 505 * DESCRIPTION: Create a new processor object and populate the fields 506 * 507 * Processor (Name[0], CpuID[1], PblockAddr[2], PblockLength[3]) 508 * 509 ****************************************************************************/ 510 511ACPI_STATUS 512AcpiExCreateProcessor ( 513 ACPI_WALK_STATE *WalkState) 514{ 515 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; 516 ACPI_OPERAND_OBJECT *ObjDesc; 517 ACPI_STATUS Status; 518 519 520 ACPI_FUNCTION_TRACE_PTR ("ExCreateProcessor", WalkState); 521 522 523 /* Create the processor object */ 524 525 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PROCESSOR); 526 if (!ObjDesc) 527 { 528 return_ACPI_STATUS (AE_NO_MEMORY); 529 } 530 531 /* 532 * Initialize the processor object from the operands 533 */ 534 ObjDesc->Processor.ProcId = (UINT8) Operand[1]->Integer.Value; 535 ObjDesc->Processor.Address = (ACPI_IO_ADDRESS) Operand[2]->Integer.Value; 536 ObjDesc->Processor.Length = (UINT8) Operand[3]->Integer.Value; 537 538 /* Install the processor object in the parent Node */ 539 540 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], 541 ObjDesc, ACPI_TYPE_PROCESSOR); 542 543 544 /* Remove local reference to the object */ 545 546 AcpiUtRemoveReference (ObjDesc); 547 return_ACPI_STATUS (Status); 548} 549 550 551/***************************************************************************** 552 * 553 * FUNCTION: AcpiExCreatePowerResource 554 *
|
560 * PARAMETERS: Op - Op containing the PowerResource definition 561 * and args 562 * PowerNode - Parent Node for the power object
| 555 * PARAMETERS: WalkState - Current state
|
563 * 564 * RETURN: Status 565 * 566 * DESCRIPTION: Create a new PowerResource object and populate the fields 567 * 568 * PowerResource (Name[0], SystemLevel[1], ResourceOrder[2]) 569 * 570 ****************************************************************************/ 571 572ACPI_STATUS 573AcpiExCreatePowerResource ( 574 ACPI_WALK_STATE *WalkState) 575{ 576 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; 577 ACPI_STATUS Status; 578 ACPI_OPERAND_OBJECT *ObjDesc; 579 580 581 ACPI_FUNCTION_TRACE_PTR ("ExCreatePowerResource", WalkState); 582 583 584 /* Create the power resource object */ 585 586 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_POWER); 587 if (!ObjDesc) 588 { 589 return_ACPI_STATUS (AE_NO_MEMORY); 590 } 591 592 /* Initialize the power object from the operands */ 593 594 ObjDesc->PowerResource.SystemLevel = (UINT8) Operand[1]->Integer.Value; 595 ObjDesc->PowerResource.ResourceOrder = (UINT16) Operand[2]->Integer.Value; 596 597 /* Install the power resource object in the parent Node */ 598 599 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], 600 ObjDesc, ACPI_TYPE_POWER); 601 602 603 /* Remove local reference to the object */ 604 605 AcpiUtRemoveReference (ObjDesc); 606 return_ACPI_STATUS (Status); 607} 608 609 610/***************************************************************************** 611 * 612 * FUNCTION: AcpiExCreateMethod 613 * 614 * PARAMETERS: AmlStart - First byte of the method's AML 615 * AmlLength - AML byte count for this method
| 556 * 557 * RETURN: Status 558 * 559 * DESCRIPTION: Create a new PowerResource object and populate the fields 560 * 561 * PowerResource (Name[0], SystemLevel[1], ResourceOrder[2]) 562 * 563 ****************************************************************************/ 564 565ACPI_STATUS 566AcpiExCreatePowerResource ( 567 ACPI_WALK_STATE *WalkState) 568{ 569 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; 570 ACPI_STATUS Status; 571 ACPI_OPERAND_OBJECT *ObjDesc; 572 573 574 ACPI_FUNCTION_TRACE_PTR ("ExCreatePowerResource", WalkState); 575 576 577 /* Create the power resource object */ 578 579 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_POWER); 580 if (!ObjDesc) 581 { 582 return_ACPI_STATUS (AE_NO_MEMORY); 583 } 584 585 /* Initialize the power object from the operands */ 586 587 ObjDesc->PowerResource.SystemLevel = (UINT8) Operand[1]->Integer.Value; 588 ObjDesc->PowerResource.ResourceOrder = (UINT16) Operand[2]->Integer.Value; 589 590 /* Install the power resource object in the parent Node */ 591 592 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], 593 ObjDesc, ACPI_TYPE_POWER); 594 595 596 /* Remove local reference to the object */ 597 598 AcpiUtRemoveReference (ObjDesc); 599 return_ACPI_STATUS (Status); 600} 601 602 603/***************************************************************************** 604 * 605 * FUNCTION: AcpiExCreateMethod 606 * 607 * PARAMETERS: AmlStart - First byte of the method's AML 608 * AmlLength - AML byte count for this method
|
616 * MethodFlags - AML method flag byte 617 * Method - Method Node
| 609 * WalkState - Current state
|
618 * 619 * RETURN: Status 620 * 621 * DESCRIPTION: Create a new method object 622 * 623 ****************************************************************************/ 624 625ACPI_STATUS 626AcpiExCreateMethod ( 627 UINT8 *AmlStart, 628 UINT32 AmlLength, 629 ACPI_WALK_STATE *WalkState) 630{ 631 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; 632 ACPI_OPERAND_OBJECT *ObjDesc; 633 ACPI_STATUS Status; 634 UINT8 MethodFlags; 635 636 637 ACPI_FUNCTION_TRACE_PTR ("ExCreateMethod", WalkState); 638 639 640 /* Create a new method object */ 641 642 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); 643 if (!ObjDesc) 644 { 645 return_ACPI_STATUS (AE_NO_MEMORY); 646 } 647 648 /* Save the method's AML pointer and length */ 649 650 ObjDesc->Method.AmlStart = AmlStart; 651 ObjDesc->Method.AmlLength = AmlLength; 652 653 /* disassemble the method flags */ 654 655 MethodFlags = (UINT8) Operand[1]->Integer.Value; 656 657 ObjDesc->Method.MethodFlags = MethodFlags; 658 ObjDesc->Method.ParamCount = (UINT8) (MethodFlags & METHOD_FLAGS_ARG_COUNT); 659 660 /* 661 * Get the concurrency count. If required, a semaphore will be 662 * created for this method when it is parsed. 663 */ 664 if (MethodFlags & METHOD_FLAGS_SERIALIZED) 665 { 666 /* 667 * ACPI 1.0: Concurrency = 1 668 * ACPI 2.0: Concurrency = (SyncLevel (in method declaration) + 1) 669 */ 670 ObjDesc->Method.Concurrency = (UINT8) 671 (((MethodFlags & METHOD_FLAGS_SYNCH_LEVEL) >> 4) + 1); 672 } 673 674 else 675 { 676 ObjDesc->Method.Concurrency = INFINITE_CONCURRENCY; 677 } 678 679 /* Attach the new object to the method Node */ 680 681 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], 682 ObjDesc, ACPI_TYPE_METHOD); 683 684 /* Remove local reference to the object */ 685 686 AcpiUtRemoveReference (ObjDesc); 687 688 /* Remove a reference to the operand */ 689 690 AcpiUtRemoveReference (Operand[1]); 691 return_ACPI_STATUS (Status); 692} 693 694
| 610 * 611 * RETURN: Status 612 * 613 * DESCRIPTION: Create a new method object 614 * 615 ****************************************************************************/ 616 617ACPI_STATUS 618AcpiExCreateMethod ( 619 UINT8 *AmlStart, 620 UINT32 AmlLength, 621 ACPI_WALK_STATE *WalkState) 622{ 623 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; 624 ACPI_OPERAND_OBJECT *ObjDesc; 625 ACPI_STATUS Status; 626 UINT8 MethodFlags; 627 628 629 ACPI_FUNCTION_TRACE_PTR ("ExCreateMethod", WalkState); 630 631 632 /* Create a new method object */ 633 634 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); 635 if (!ObjDesc) 636 { 637 return_ACPI_STATUS (AE_NO_MEMORY); 638 } 639 640 /* Save the method's AML pointer and length */ 641 642 ObjDesc->Method.AmlStart = AmlStart; 643 ObjDesc->Method.AmlLength = AmlLength; 644 645 /* disassemble the method flags */ 646 647 MethodFlags = (UINT8) Operand[1]->Integer.Value; 648 649 ObjDesc->Method.MethodFlags = MethodFlags; 650 ObjDesc->Method.ParamCount = (UINT8) (MethodFlags & METHOD_FLAGS_ARG_COUNT); 651 652 /* 653 * Get the concurrency count. If required, a semaphore will be 654 * created for this method when it is parsed. 655 */ 656 if (MethodFlags & METHOD_FLAGS_SERIALIZED) 657 { 658 /* 659 * ACPI 1.0: Concurrency = 1 660 * ACPI 2.0: Concurrency = (SyncLevel (in method declaration) + 1) 661 */ 662 ObjDesc->Method.Concurrency = (UINT8) 663 (((MethodFlags & METHOD_FLAGS_SYNCH_LEVEL) >> 4) + 1); 664 } 665 666 else 667 { 668 ObjDesc->Method.Concurrency = INFINITE_CONCURRENCY; 669 } 670 671 /* Attach the new object to the method Node */ 672 673 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], 674 ObjDesc, ACPI_TYPE_METHOD); 675 676 /* Remove local reference to the object */ 677 678 AcpiUtRemoveReference (ObjDesc); 679 680 /* Remove a reference to the operand */ 681 682 AcpiUtRemoveReference (Operand[1]); 683 return_ACPI_STATUS (Status); 684} 685 686
|