Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendsfield.c
Go to the documentation of this file.
00001 /****************************************************************************** 00002 * 00003 * Module Name: dsfield - Dispatcher field routines 00004 * 00005 *****************************************************************************/ 00006 00007 /****************************************************************************** 00008 * 00009 * 1. Copyright Notice 00010 * 00011 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. 00012 * All rights reserved. 00013 * 00014 * 2. License 00015 * 00016 * 2.1. This is your license from Intel Corp. under its intellectual property 00017 * rights. You may have additional license terms from the party that provided 00018 * you this software, covering your right to use that party's intellectual 00019 * property rights. 00020 * 00021 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 00022 * copy of the source code appearing in this file ("Covered Code") an 00023 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 00024 * base code distributed originally by Intel ("Original Intel Code") to copy, 00025 * make derivatives, distribute, use and display any portion of the Covered 00026 * Code in any form, with the right to sublicense such rights; and 00027 * 00028 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 00029 * license (with the right to sublicense), under only those claims of Intel 00030 * patents that are infringed by the Original Intel Code, to make, use, sell, 00031 * offer to sell, and import the Covered Code and derivative works thereof 00032 * solely to the minimum extent necessary to exercise the above copyright 00033 * license, and in no event shall the patent license extend to any additions 00034 * to or modifications of the Original Intel Code. No other license or right 00035 * is granted directly or by implication, estoppel or otherwise; 00036 * 00037 * The above copyright and patent license is granted only if the following 00038 * conditions are met: 00039 * 00040 * 3. Conditions 00041 * 00042 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 00043 * Redistribution of source code of any substantial portion of the Covered 00044 * Code or modification with rights to further distribute source must include 00045 * the above Copyright Notice, the above License, this list of Conditions, 00046 * and the following Disclaimer and Export Compliance provision. In addition, 00047 * Licensee must cause all Covered Code to which Licensee contributes to 00048 * contain a file documenting the changes Licensee made to create that Covered 00049 * Code and the date of any change. Licensee must include in that file the 00050 * documentation of any changes made by any predecessor Licensee. Licensee 00051 * must include a prominent statement that the modification is derived, 00052 * directly or indirectly, from Original Intel Code. 00053 * 00054 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 00055 * Redistribution of source code of any substantial portion of the Covered 00056 * Code or modification without rights to further distribute source must 00057 * include the following Disclaimer and Export Compliance provision in the 00058 * documentation and/or other materials provided with distribution. In 00059 * addition, Licensee may not authorize further sublicense of source of any 00060 * portion of the Covered Code, and must include terms to the effect that the 00061 * license from Licensee to its licensee is limited to the intellectual 00062 * property embodied in the software Licensee provides to its licensee, and 00063 * not to intellectual property embodied in modifications its licensee may 00064 * make. 00065 * 00066 * 3.3. Redistribution of Executable. Redistribution in executable form of any 00067 * substantial portion of the Covered Code or modification must reproduce the 00068 * above Copyright Notice, and the following Disclaimer and Export Compliance 00069 * provision in the documentation and/or other materials provided with the 00070 * distribution. 00071 * 00072 * 3.4. Intel retains all right, title, and interest in and to the Original 00073 * Intel Code. 00074 * 00075 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 00076 * Intel shall be used in advertising or otherwise to promote the sale, use or 00077 * other dealings in products derived from or relating to the Covered Code 00078 * without prior written authorization from Intel. 00079 * 00080 * 4. Disclaimer and Export Compliance 00081 * 00082 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 00083 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 00084 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 00085 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 00086 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 00087 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 00088 * PARTICULAR PURPOSE. 00089 * 00090 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 00091 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 00092 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 00093 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 00094 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 00095 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 00096 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 00097 * LIMITED REMEDY. 00098 * 00099 * 4.3. Licensee shall not export, either directly or indirectly, any of this 00100 * software or system incorporating such software without first obtaining any 00101 * required license or other approval from the U. S. Department of Commerce or 00102 * any other agency or department of the United States Government. In the 00103 * event Licensee exports any such software from the United States or 00104 * re-exports any such software from a foreign destination, Licensee shall 00105 * ensure that the distribution and export/re-export of the software is in 00106 * compliance with all laws, regulations, orders, or other restrictions of the 00107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 00108 * any of its subsidiaries will export/re-export any technical data, process, 00109 * software, or service, directly or indirectly, to any country for which the 00110 * United States government or any agency thereof requires an export license, 00111 * other governmental approval, or letter of assurance, without first obtaining 00112 * such license, approval or letter. 00113 * 00114 *****************************************************************************/ 00115 00116 #define __DSFIELD_C__ 00117 00118 #include "acpi.h" 00119 #include "accommon.h" 00120 #include "amlcode.h" 00121 #include "acdispat.h" 00122 #include "acinterp.h" 00123 #include "acnamesp.h" 00124 #include "acparser.h" 00125 00126 00127 #define _COMPONENT ACPI_DISPATCHER 00128 ACPI_MODULE_NAME ("dsfield") 00129 00130 /* Local prototypes */ 00131 00132 static ACPI_STATUS 00133 AcpiDsGetFieldNames ( 00134 ACPI_CREATE_FIELD_INFO *Info, 00135 ACPI_WALK_STATE *WalkState, 00136 ACPI_PARSE_OBJECT *Arg); 00137 00138 00139 /******************************************************************************* 00140 * 00141 * FUNCTION: AcpiDsCreateBufferField 00142 * 00143 * PARAMETERS: Op - Current parse op (CreateXXField) 00144 * WalkState - Current state 00145 * 00146 * RETURN: Status 00147 * 00148 * DESCRIPTION: Execute the CreateField operators: 00149 * CreateBitFieldOp, 00150 * CreateByteFieldOp, 00151 * CreateWordFieldOp, 00152 * CreateDWordFieldOp, 00153 * CreateQWordFieldOp, 00154 * CreateFieldOp (all of which define a field in a buffer) 00155 * 00156 ******************************************************************************/ 00157 00158 ACPI_STATUS 00159 AcpiDsCreateBufferField ( 00160 ACPI_PARSE_OBJECT *Op, 00161 ACPI_WALK_STATE *WalkState) 00162 { 00163 ACPI_PARSE_OBJECT *Arg; 00164 ACPI_NAMESPACE_NODE *Node; 00165 ACPI_STATUS Status; 00166 ACPI_OPERAND_OBJECT *ObjDesc; 00167 ACPI_OPERAND_OBJECT *SecondDesc = NULL; 00168 UINT32 Flags; 00169 00170 00171 ACPI_FUNCTION_TRACE (DsCreateBufferField); 00172 00173 00174 /* 00175 * Get the NameString argument (name of the new BufferField) 00176 */ 00177 if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) 00178 { 00179 /* For CreateField, name is the 4th argument */ 00180 00181 Arg = AcpiPsGetArg (Op, 3); 00182 } 00183 else 00184 { 00185 /* For all other CreateXXXField operators, name is the 3rd argument */ 00186 00187 Arg = AcpiPsGetArg (Op, 2); 00188 } 00189 00190 if (!Arg) 00191 { 00192 return_ACPI_STATUS (AE_AML_NO_OPERAND); 00193 } 00194 00195 if (WalkState->DeferredNode) 00196 { 00197 Node = WalkState->DeferredNode; 00198 Status = AE_OK; 00199 } 00200 else 00201 { 00202 /* Execute flag should always be set when this function is entered */ 00203 00204 if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE)) 00205 { 00206 return_ACPI_STATUS (AE_AML_INTERNAL); 00207 } 00208 00209 /* Creating new namespace node, should not already exist */ 00210 00211 Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | 00212 ACPI_NS_ERROR_IF_FOUND; 00213 00214 /* 00215 * Mark node temporary if we are executing a normal control 00216 * method. (Don't mark if this is a module-level code method) 00217 */ 00218 if (WalkState->MethodNode && 00219 !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) 00220 { 00221 Flags |= ACPI_NS_TEMPORARY; 00222 } 00223 00224 /* Enter the NameString into the namespace */ 00225 00226 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, 00227 ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, 00228 Flags, WalkState, &Node); 00229 if (ACPI_FAILURE (Status)) 00230 { 00231 ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); 00232 return_ACPI_STATUS (Status); 00233 } 00234 } 00235 00236 /* 00237 * We could put the returned object (Node) on the object stack for later, 00238 * but for now, we will put it in the "op" object that the parser uses, 00239 * so we can get it again at the end of this scope. 00240 */ 00241 Op->Common.Node = Node; 00242 00243 /* 00244 * If there is no object attached to the node, this node was just created 00245 * and we need to create the field object. Otherwise, this was a lookup 00246 * of an existing node and we don't want to create the field object again. 00247 */ 00248 ObjDesc = AcpiNsGetAttachedObject (Node); 00249 if (ObjDesc) 00250 { 00251 return_ACPI_STATUS (AE_OK); 00252 } 00253 00254 /* 00255 * The Field definition is not fully parsed at this time. 00256 * (We must save the address of the AML for the buffer and index operands) 00257 */ 00258 00259 /* Create the buffer field object */ 00260 00261 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER_FIELD); 00262 if (!ObjDesc) 00263 { 00264 Status = AE_NO_MEMORY; 00265 goto Cleanup; 00266 } 00267 00268 /* 00269 * Remember location in AML stream of the field unit opcode and operands -- 00270 * since the buffer and index operands must be evaluated. 00271 */ 00272 SecondDesc = ObjDesc->Common.NextObject; 00273 SecondDesc->Extra.AmlStart = Op->Named.Data; 00274 SecondDesc->Extra.AmlLength = Op->Named.Length; 00275 ObjDesc->BufferField.Node = Node; 00276 00277 /* Attach constructed field descriptors to parent node */ 00278 00279 Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_BUFFER_FIELD); 00280 if (ACPI_FAILURE (Status)) 00281 { 00282 goto Cleanup; 00283 } 00284 00285 00286 Cleanup: 00287 00288 /* Remove local reference to the object */ 00289 00290 AcpiUtRemoveReference (ObjDesc); 00291 return_ACPI_STATUS (Status); 00292 } 00293 00294 00295 /******************************************************************************* 00296 * 00297 * FUNCTION: AcpiDsGetFieldNames 00298 * 00299 * PARAMETERS: Info - CreateField info structure 00300 * ` WalkState - Current method state 00301 * Arg - First parser arg for the field name list 00302 * 00303 * RETURN: Status 00304 * 00305 * DESCRIPTION: Process all named fields in a field declaration. Names are 00306 * entered into the namespace. 00307 * 00308 ******************************************************************************/ 00309 00310 static ACPI_STATUS 00311 AcpiDsGetFieldNames ( 00312 ACPI_CREATE_FIELD_INFO *Info, 00313 ACPI_WALK_STATE *WalkState, 00314 ACPI_PARSE_OBJECT *Arg) 00315 { 00316 ACPI_STATUS Status; 00317 UINT64 Position; 00318 00319 00320 ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info); 00321 00322 00323 /* First field starts at bit zero */ 00324 00325 Info->FieldBitPosition = 0; 00326 00327 /* Process all elements in the field list (of parse nodes) */ 00328 00329 while (Arg) 00330 { 00331 /* 00332 * Three types of field elements are handled: 00333 * 1) Offset - specifies a bit offset 00334 * 2) AccessAs - changes the access mode 00335 * 3) Name - Enters a new named field into the namespace 00336 */ 00337 switch (Arg->Common.AmlOpcode) 00338 { 00339 case AML_INT_RESERVEDFIELD_OP: 00340 00341 Position = (UINT64) Info->FieldBitPosition 00342 + (UINT64) Arg->Common.Value.Size; 00343 00344 if (Position > ACPI_UINT32_MAX) 00345 { 00346 ACPI_ERROR ((AE_INFO, 00347 "Bit offset within field too large (> 0xFFFFFFFF)")); 00348 return_ACPI_STATUS (AE_SUPPORT); 00349 } 00350 00351 Info->FieldBitPosition = (UINT32) Position; 00352 break; 00353 00354 00355 case AML_INT_ACCESSFIELD_OP: 00356 00357 /* 00358 * Get a new AccessType and AccessAttribute -- to be used for all 00359 * field units that follow, until field end or another AccessAs 00360 * keyword. 00361 * 00362 * In FieldFlags, preserve the flag bits other than the 00363 * ACCESS_TYPE bits 00364 */ 00365 Info->FieldFlags = (UINT8) 00366 ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | 00367 ((UINT8) ((UINT32) Arg->Common.Value.Integer >> 8))); 00368 00369 Info->Attribute = (UINT8) (Arg->Common.Value.Integer); 00370 break; 00371 00372 00373 case AML_INT_NAMEDFIELD_OP: 00374 00375 /* Lookup the name, it should already exist */ 00376 00377 Status = AcpiNsLookup (WalkState->ScopeInfo, 00378 (char *) &Arg->Named.Name, Info->FieldType, 00379 ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, 00380 WalkState, &Info->FieldNode); 00381 if (ACPI_FAILURE (Status)) 00382 { 00383 ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); 00384 return_ACPI_STATUS (Status); 00385 } 00386 else 00387 { 00388 Arg->Common.Node = Info->FieldNode; 00389 Info->FieldBitLength = Arg->Common.Value.Size; 00390 00391 /* 00392 * If there is no object attached to the node, this node was 00393 * just created and we need to create the field object. 00394 * Otherwise, this was a lookup of an existing node and we 00395 * don't want to create the field object again. 00396 */ 00397 if (!AcpiNsGetAttachedObject (Info->FieldNode)) 00398 { 00399 Status = AcpiExPrepFieldValue (Info); 00400 if (ACPI_FAILURE (Status)) 00401 { 00402 return_ACPI_STATUS (Status); 00403 } 00404 } 00405 } 00406 00407 /* Keep track of bit position for the next field */ 00408 00409 Position = (UINT64) Info->FieldBitPosition 00410 + (UINT64) Arg->Common.Value.Size; 00411 00412 if (Position > ACPI_UINT32_MAX) 00413 { 00414 ACPI_ERROR ((AE_INFO, 00415 "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)", 00416 ACPI_CAST_PTR (char, &Info->FieldNode->Name))); 00417 return_ACPI_STATUS (AE_SUPPORT); 00418 } 00419 00420 Info->FieldBitPosition += Info->FieldBitLength; 00421 break; 00422 00423 00424 default: 00425 00426 ACPI_ERROR ((AE_INFO, 00427 "Invalid opcode in field list: 0x%X", Arg->Common.AmlOpcode)); 00428 return_ACPI_STATUS (AE_AML_BAD_OPCODE); 00429 } 00430 00431 Arg = Arg->Common.Next; 00432 } 00433 00434 return_ACPI_STATUS (AE_OK); 00435 } 00436 00437 00438 /******************************************************************************* 00439 * 00440 * FUNCTION: AcpiDsCreateField 00441 * 00442 * PARAMETERS: Op - Op containing the Field definition and args 00443 * RegionNode - Object for the containing Operation Region 00444 * ` WalkState - Current method state 00445 * 00446 * RETURN: Status 00447 * 00448 * DESCRIPTION: Create a new field in the specified operation region 00449 * 00450 ******************************************************************************/ 00451 00452 ACPI_STATUS 00453 AcpiDsCreateField ( 00454 ACPI_PARSE_OBJECT *Op, 00455 ACPI_NAMESPACE_NODE *RegionNode, 00456 ACPI_WALK_STATE *WalkState) 00457 { 00458 ACPI_STATUS Status; 00459 ACPI_PARSE_OBJECT *Arg; 00460 ACPI_CREATE_FIELD_INFO Info; 00461 00462 00463 ACPI_FUNCTION_TRACE_PTR (DsCreateField, Op); 00464 00465 00466 /* First arg is the name of the parent OpRegion (must already exist) */ 00467 00468 Arg = Op->Common.Value.Arg; 00469 if (!RegionNode) 00470 { 00471 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, 00472 ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, 00473 ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); 00474 if (ACPI_FAILURE (Status)) 00475 { 00476 ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status); 00477 return_ACPI_STATUS (Status); 00478 } 00479 } 00480 00481 /* Second arg is the field flags */ 00482 00483 Arg = Arg->Common.Next; 00484 Info.FieldFlags = (UINT8) Arg->Common.Value.Integer; 00485 Info.Attribute = 0; 00486 00487 /* Each remaining arg is a Named Field */ 00488 00489 Info.FieldType = ACPI_TYPE_LOCAL_REGION_FIELD; 00490 Info.RegionNode = RegionNode; 00491 00492 Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); 00493 00494 return_ACPI_STATUS (Status); 00495 } 00496 00497 00498 /******************************************************************************* 00499 * 00500 * FUNCTION: AcpiDsInitFieldObjects 00501 * 00502 * PARAMETERS: Op - Op containing the Field definition and args 00503 * ` WalkState - Current method state 00504 * 00505 * RETURN: Status 00506 * 00507 * DESCRIPTION: For each "Field Unit" name in the argument list that is 00508 * part of the field declaration, enter the name into the 00509 * namespace. 00510 * 00511 ******************************************************************************/ 00512 00513 ACPI_STATUS 00514 AcpiDsInitFieldObjects ( 00515 ACPI_PARSE_OBJECT *Op, 00516 ACPI_WALK_STATE *WalkState) 00517 { 00518 ACPI_STATUS Status; 00519 ACPI_PARSE_OBJECT *Arg = NULL; 00520 ACPI_NAMESPACE_NODE *Node; 00521 UINT8 Type = 0; 00522 UINT32 Flags; 00523 00524 00525 ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects, Op); 00526 00527 00528 /* Execute flag should always be set when this function is entered */ 00529 00530 if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE)) 00531 { 00532 if (WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP) 00533 { 00534 /* BankField Op is deferred, just return OK */ 00535 00536 return_ACPI_STATUS (AE_OK); 00537 } 00538 00539 return_ACPI_STATUS (AE_AML_INTERNAL); 00540 } 00541 00542 /* 00543 * Get the FieldList argument for this opcode. This is the start of the 00544 * list of field elements. 00545 */ 00546 switch (WalkState->Opcode) 00547 { 00548 case AML_FIELD_OP: 00549 Arg = AcpiPsGetArg (Op, 2); 00550 Type = ACPI_TYPE_LOCAL_REGION_FIELD; 00551 break; 00552 00553 case AML_BANK_FIELD_OP: 00554 Arg = AcpiPsGetArg (Op, 4); 00555 Type = ACPI_TYPE_LOCAL_BANK_FIELD; 00556 break; 00557 00558 case AML_INDEX_FIELD_OP: 00559 Arg = AcpiPsGetArg (Op, 3); 00560 Type = ACPI_TYPE_LOCAL_INDEX_FIELD; 00561 break; 00562 00563 default: 00564 return_ACPI_STATUS (AE_BAD_PARAMETER); 00565 } 00566 00567 /* Creating new namespace node(s), should not already exist */ 00568 00569 Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | 00570 ACPI_NS_ERROR_IF_FOUND; 00571 00572 /* 00573 * Mark node(s) temporary if we are executing a normal control 00574 * method. (Don't mark if this is a module-level code method) 00575 */ 00576 if (WalkState->MethodNode && 00577 !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) 00578 { 00579 Flags |= ACPI_NS_TEMPORARY; 00580 } 00581 00582 /* 00583 * Walk the list of entries in the FieldList 00584 * Note: FieldList can be of zero length. In this case, Arg will be NULL. 00585 */ 00586 while (Arg) 00587 { 00588 /* 00589 * Ignore OFFSET and ACCESSAS terms here; we are only interested in the 00590 * field names in order to enter them into the namespace. 00591 */ 00592 if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) 00593 { 00594 Status = AcpiNsLookup (WalkState->ScopeInfo, 00595 (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1, 00596 Flags, WalkState, &Node); 00597 if (ACPI_FAILURE (Status)) 00598 { 00599 ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); 00600 if (Status != AE_ALREADY_EXISTS) 00601 { 00602 return_ACPI_STATUS (Status); 00603 } 00604 00605 /* Name already exists, just ignore this error */ 00606 00607 Status = AE_OK; 00608 } 00609 00610 Arg->Common.Node = Node; 00611 } 00612 00613 /* Get the next field element in the list */ 00614 00615 Arg = Arg->Common.Next; 00616 } 00617 00618 return_ACPI_STATUS (AE_OK); 00619 } 00620 00621 00622 /******************************************************************************* 00623 * 00624 * FUNCTION: AcpiDsCreateBankField 00625 * 00626 * PARAMETERS: Op - Op containing the Field definition and args 00627 * RegionNode - Object for the containing Operation Region 00628 * WalkState - Current method state 00629 * 00630 * RETURN: Status 00631 * 00632 * DESCRIPTION: Create a new bank field in the specified operation region 00633 * 00634 ******************************************************************************/ 00635 00636 ACPI_STATUS 00637 AcpiDsCreateBankField ( 00638 ACPI_PARSE_OBJECT *Op, 00639 ACPI_NAMESPACE_NODE *RegionNode, 00640 ACPI_WALK_STATE *WalkState) 00641 { 00642 ACPI_STATUS Status; 00643 ACPI_PARSE_OBJECT *Arg; 00644 ACPI_CREATE_FIELD_INFO Info; 00645 00646 00647 ACPI_FUNCTION_TRACE_PTR (DsCreateBankField, Op); 00648 00649 00650 /* First arg is the name of the parent OpRegion (must already exist) */ 00651 00652 Arg = Op->Common.Value.Arg; 00653 if (!RegionNode) 00654 { 00655 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, 00656 ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, 00657 ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); 00658 if (ACPI_FAILURE (Status)) 00659 { 00660 ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status); 00661 return_ACPI_STATUS (Status); 00662 } 00663 } 00664 00665 /* Second arg is the Bank Register (Field) (must already exist) */ 00666 00667 Arg = Arg->Common.Next; 00668 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, 00669 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 00670 ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); 00671 if (ACPI_FAILURE (Status)) 00672 { 00673 ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); 00674 return_ACPI_STATUS (Status); 00675 } 00676 00677 /* 00678 * Third arg is the BankValue 00679 * This arg is a TermArg, not a constant 00680 * It will be evaluated later, by AcpiDsEvalBankFieldOperands 00681 */ 00682 Arg = Arg->Common.Next; 00683 00684 /* Fourth arg is the field flags */ 00685 00686 Arg = Arg->Common.Next; 00687 Info.FieldFlags = (UINT8) Arg->Common.Value.Integer; 00688 00689 /* Each remaining arg is a Named Field */ 00690 00691 Info.FieldType = ACPI_TYPE_LOCAL_BANK_FIELD; 00692 Info.RegionNode = RegionNode; 00693 00694 /* 00695 * Use Info.DataRegisterNode to store BankField Op 00696 * It's safe because DataRegisterNode will never be used when create bank field 00697 * We store AmlStart and AmlLength in the BankField Op for late evaluation 00698 * Used in AcpiExPrepFieldValue(Info) 00699 * 00700 * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like "void *ParentOp"? 00701 */ 00702 Info.DataRegisterNode = (ACPI_NAMESPACE_NODE*) Op; 00703 00704 Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); 00705 return_ACPI_STATUS (Status); 00706 } 00707 00708 00709 /******************************************************************************* 00710 * 00711 * FUNCTION: AcpiDsCreateIndexField 00712 * 00713 * PARAMETERS: Op - Op containing the Field definition and args 00714 * RegionNode - Object for the containing Operation Region 00715 * ` WalkState - Current method state 00716 * 00717 * RETURN: Status 00718 * 00719 * DESCRIPTION: Create a new index field in the specified operation region 00720 * 00721 ******************************************************************************/ 00722 00723 ACPI_STATUS 00724 AcpiDsCreateIndexField ( 00725 ACPI_PARSE_OBJECT *Op, 00726 ACPI_NAMESPACE_NODE *RegionNode, 00727 ACPI_WALK_STATE *WalkState) 00728 { 00729 ACPI_STATUS Status; 00730 ACPI_PARSE_OBJECT *Arg; 00731 ACPI_CREATE_FIELD_INFO Info; 00732 00733 00734 ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField, Op); 00735 00736 00737 /* First arg is the name of the Index register (must already exist) */ 00738 00739 Arg = Op->Common.Value.Arg; 00740 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, 00741 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 00742 ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); 00743 if (ACPI_FAILURE (Status)) 00744 { 00745 ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); 00746 return_ACPI_STATUS (Status); 00747 } 00748 00749 /* Second arg is the data register (must already exist) */ 00750 00751 Arg = Arg->Common.Next; 00752 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, 00753 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 00754 ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode); 00755 if (ACPI_FAILURE (Status)) 00756 { 00757 ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); 00758 return_ACPI_STATUS (Status); 00759 } 00760 00761 /* Next arg is the field flags */ 00762 00763 Arg = Arg->Common.Next; 00764 Info.FieldFlags = (UINT8) Arg->Common.Value.Integer; 00765 00766 /* Each remaining arg is a Named Field */ 00767 00768 Info.FieldType = ACPI_TYPE_LOCAL_INDEX_FIELD; 00769 Info.RegionNode = RegionNode; 00770 00771 Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); 00772 00773 return_ACPI_STATUS (Status); 00774 } 00775 00776 Generated on Fri May 25 2012 04:25:26 for ReactOS by
1.7.6.1
|