Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / drivers / acpi / acpica / dsfield.c
blob95ea639a942422429d626a5669f425ce5c07c801
1 /******************************************************************************
3 * Module Name: dsfield - Dispatcher field routines
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2018, Intel Corp.
9 * All rights reserved.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
44 #include <acpi/acpi.h>
45 #include "accommon.h"
46 #include "amlcode.h"
47 #include "acdispat.h"
48 #include "acinterp.h"
49 #include "acnamesp.h"
50 #include "acparser.h"
52 #define _COMPONENT ACPI_DISPATCHER
53 ACPI_MODULE_NAME("dsfield")
55 /* Local prototypes */
56 #ifdef ACPI_ASL_COMPILER
57 #include "acdisasm.h"
58 static acpi_status
59 acpi_ds_create_external_region(acpi_status lookup_status,
60 union acpi_parse_object *op,
61 char *path,
62 struct acpi_walk_state *walk_state,
63 struct acpi_namespace_node **node);
64 #endif
66 static acpi_status
67 acpi_ds_get_field_names(struct acpi_create_field_info *info,
68 struct acpi_walk_state *walk_state,
69 union acpi_parse_object *arg);
71 #ifdef ACPI_ASL_COMPILER
72 /*******************************************************************************
74 * FUNCTION: acpi_ds_create_external_region (iASL Disassembler only)
76 * PARAMETERS: lookup_status - Status from ns_lookup operation
77 * op - Op containing the Field definition and args
78 * path - Pathname of the region
79 * ` walk_state - Current method state
80 * node - Where the new region node is returned
82 * RETURN: Status
84 * DESCRIPTION: Add region to the external list if NOT_FOUND. Create a new
85 * region node/object.
87 ******************************************************************************/
89 static acpi_status
90 acpi_ds_create_external_region(acpi_status lookup_status,
91 union acpi_parse_object *op,
92 char *path,
93 struct acpi_walk_state *walk_state,
94 struct acpi_namespace_node **node)
96 acpi_status status;
97 union acpi_operand_object *obj_desc;
99 if (lookup_status != AE_NOT_FOUND) {
100 return (lookup_status);
104 * Table disassembly:
105 * operation_region not found. Generate an External for it, and
106 * insert the name into the namespace.
108 acpi_dm_add_op_to_external_list(op, path, ACPI_TYPE_REGION, 0, 0);
110 status = acpi_ns_lookup(walk_state->scope_info, path, ACPI_TYPE_REGION,
111 ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
112 walk_state, node);
113 if (ACPI_FAILURE(status)) {
114 return (status);
117 /* Must create and install a region object for the new node */
119 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION);
120 if (!obj_desc) {
121 return (AE_NO_MEMORY);
124 obj_desc->region.node = *node;
125 status = acpi_ns_attach_object(*node, obj_desc, ACPI_TYPE_REGION);
126 return (status);
128 #endif
130 /*******************************************************************************
132 * FUNCTION: acpi_ds_create_buffer_field
134 * PARAMETERS: op - Current parse op (create_XXField)
135 * walk_state - Current state
137 * RETURN: Status
139 * DESCRIPTION: Execute the create_field operators:
140 * create_bit_field_op,
141 * create_byte_field_op,
142 * create_word_field_op,
143 * create_dword_field_op,
144 * create_qword_field_op,
145 * create_field_op (all of which define a field in a buffer)
147 ******************************************************************************/
149 acpi_status
150 acpi_ds_create_buffer_field(union acpi_parse_object *op,
151 struct acpi_walk_state *walk_state)
153 union acpi_parse_object *arg;
154 struct acpi_namespace_node *node;
155 acpi_status status;
156 union acpi_operand_object *obj_desc;
157 union acpi_operand_object *second_desc = NULL;
158 u32 flags;
160 ACPI_FUNCTION_TRACE(ds_create_buffer_field);
163 * Get the name_string argument (name of the new buffer_field)
165 if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
167 /* For create_field, name is the 4th argument */
169 arg = acpi_ps_get_arg(op, 3);
170 } else {
171 /* For all other create_XXXField operators, name is the 3rd argument */
173 arg = acpi_ps_get_arg(op, 2);
176 if (!arg) {
177 return_ACPI_STATUS(AE_AML_NO_OPERAND);
180 if (walk_state->deferred_node) {
181 node = walk_state->deferred_node;
182 status = AE_OK;
183 } else {
184 /* Execute flag should always be set when this function is entered */
186 if (!(walk_state->parse_flags & ACPI_PARSE_EXECUTE)) {
187 ACPI_ERROR((AE_INFO, "Parse execute mode is not set"));
188 return_ACPI_STATUS(AE_AML_INTERNAL);
191 /* Creating new namespace node, should not already exist */
193 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
194 ACPI_NS_ERROR_IF_FOUND;
197 * Mark node temporary if we are executing a normal control
198 * method. (Don't mark if this is a module-level code method)
200 if (walk_state->method_node &&
201 !(walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
202 flags |= ACPI_NS_TEMPORARY;
205 /* Enter the name_string into the namespace */
207 status = acpi_ns_lookup(walk_state->scope_info,
208 arg->common.value.string, ACPI_TYPE_ANY,
209 ACPI_IMODE_LOAD_PASS1, flags,
210 walk_state, &node);
211 if (ACPI_FAILURE(status)) {
212 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
213 arg->common.value.string, status);
214 return_ACPI_STATUS(status);
219 * We could put the returned object (Node) on the object stack for later,
220 * but for now, we will put it in the "op" object that the parser uses,
221 * so we can get it again at the end of this scope.
223 op->common.node = node;
226 * If there is no object attached to the node, this node was just created
227 * and we need to create the field object. Otherwise, this was a lookup
228 * of an existing node and we don't want to create the field object again.
230 obj_desc = acpi_ns_get_attached_object(node);
231 if (obj_desc) {
232 return_ACPI_STATUS(AE_OK);
236 * The Field definition is not fully parsed at this time.
237 * (We must save the address of the AML for the buffer and index operands)
240 /* Create the buffer field object */
242 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER_FIELD);
243 if (!obj_desc) {
244 status = AE_NO_MEMORY;
245 goto cleanup;
249 * Remember location in AML stream of the field unit opcode and operands
250 * -- since the buffer and index operands must be evaluated.
252 second_desc = obj_desc->common.next_object;
253 second_desc->extra.aml_start = op->named.data;
254 second_desc->extra.aml_length = op->named.length;
255 obj_desc->buffer_field.node = node;
257 /* Attach constructed field descriptors to parent node */
259 status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_BUFFER_FIELD);
260 if (ACPI_FAILURE(status)) {
261 goto cleanup;
264 cleanup:
266 /* Remove local reference to the object */
268 acpi_ut_remove_reference(obj_desc);
269 return_ACPI_STATUS(status);
272 /*******************************************************************************
274 * FUNCTION: acpi_ds_get_field_names
276 * PARAMETERS: info - create_field info structure
277 * ` walk_state - Current method state
278 * arg - First parser arg for the field name list
280 * RETURN: Status
282 * DESCRIPTION: Process all named fields in a field declaration. Names are
283 * entered into the namespace.
285 ******************************************************************************/
287 static acpi_status
288 acpi_ds_get_field_names(struct acpi_create_field_info *info,
289 struct acpi_walk_state *walk_state,
290 union acpi_parse_object *arg)
292 acpi_status status;
293 u64 position;
294 union acpi_parse_object *child;
296 ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info);
298 /* First field starts at bit zero */
300 info->field_bit_position = 0;
302 /* Process all elements in the field list (of parse nodes) */
304 while (arg) {
306 * Four types of field elements are handled:
307 * 1) name - Enters a new named field into the namespace
308 * 2) offset - specifies a bit offset
309 * 3) access_as - changes the access mode/attributes
310 * 4) connection - Associate a resource template with the field
312 switch (arg->common.aml_opcode) {
313 case AML_INT_RESERVEDFIELD_OP:
315 position = (u64)info->field_bit_position +
316 (u64)arg->common.value.size;
318 if (position > ACPI_UINT32_MAX) {
319 ACPI_ERROR((AE_INFO,
320 "Bit offset within field too large (> 0xFFFFFFFF)"));
321 return_ACPI_STATUS(AE_SUPPORT);
324 info->field_bit_position = (u32) position;
325 break;
327 case AML_INT_ACCESSFIELD_OP:
328 case AML_INT_EXTACCESSFIELD_OP:
330 * Get new access_type, access_attribute, and access_length fields
331 * -- to be used for all field units that follow, until the
332 * end-of-field or another access_as keyword is encountered.
333 * NOTE. These three bytes are encoded in the integer value
334 * of the parseop for convenience.
336 * In field_flags, preserve the flag bits other than the
337 * ACCESS_TYPE bits.
340 /* access_type (byte_acc, word_acc, etc.) */
342 info->field_flags = (u8)
343 ((info->
344 field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
345 ((u8)((u32)(arg->common.value.integer & 0x07))));
347 /* access_attribute (attrib_quick, attrib_byte, etc.) */
349 info->attribute = (u8)
350 ((arg->common.value.integer >> 8) & 0xFF);
352 /* access_length (for serial/buffer protocols) */
354 info->access_length = (u8)
355 ((arg->common.value.integer >> 16) & 0xFF);
356 break;
358 case AML_INT_CONNECTION_OP:
360 * Clear any previous connection. New connection is used for all
361 * fields that follow, similar to access_as
363 info->resource_buffer = NULL;
364 info->connection_node = NULL;
365 info->pin_number_index = 0;
368 * A Connection() is either an actual resource descriptor (buffer)
369 * or a named reference to a resource template
371 child = arg->common.value.arg;
372 if (child->common.aml_opcode == AML_INT_BYTELIST_OP) {
373 info->resource_buffer = child->named.data;
374 info->resource_length =
375 (u16)child->named.value.integer;
376 } else {
377 /* Lookup the Connection() namepath, it should already exist */
379 status = acpi_ns_lookup(walk_state->scope_info,
380 child->common.value.
381 name, ACPI_TYPE_ANY,
382 ACPI_IMODE_EXECUTE,
383 ACPI_NS_DONT_OPEN_SCOPE,
384 walk_state,
385 &info->connection_node);
386 if (ACPI_FAILURE(status)) {
387 ACPI_ERROR_NAMESPACE(walk_state->
388 scope_info,
389 child->common.
390 value.name,
391 status);
392 return_ACPI_STATUS(status);
395 break;
397 case AML_INT_NAMEDFIELD_OP:
399 /* Lookup the name, it should already exist */
401 status = acpi_ns_lookup(walk_state->scope_info,
402 (char *)&arg->named.name,
403 info->field_type,
404 ACPI_IMODE_EXECUTE,
405 ACPI_NS_DONT_OPEN_SCOPE,
406 walk_state, &info->field_node);
407 if (ACPI_FAILURE(status)) {
408 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
409 (char *)&arg->named.name,
410 status);
411 return_ACPI_STATUS(status);
412 } else {
413 arg->common.node = info->field_node;
414 info->field_bit_length = arg->common.value.size;
417 * If there is no object attached to the node, this node was
418 * just created and we need to create the field object.
419 * Otherwise, this was a lookup of an existing node and we
420 * don't want to create the field object again.
422 if (!acpi_ns_get_attached_object
423 (info->field_node)) {
424 status = acpi_ex_prep_field_value(info);
425 if (ACPI_FAILURE(status)) {
426 return_ACPI_STATUS(status);
431 /* Keep track of bit position for the next field */
433 position = (u64)info->field_bit_position +
434 (u64)arg->common.value.size;
436 if (position > ACPI_UINT32_MAX) {
437 ACPI_ERROR((AE_INFO,
438 "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
439 ACPI_CAST_PTR(char,
440 &info->field_node->
441 name)));
442 return_ACPI_STATUS(AE_SUPPORT);
445 info->field_bit_position += info->field_bit_length;
446 info->pin_number_index++; /* Index relative to previous Connection() */
447 break;
449 default:
451 ACPI_ERROR((AE_INFO,
452 "Invalid opcode in field list: 0x%X",
453 arg->common.aml_opcode));
454 return_ACPI_STATUS(AE_AML_BAD_OPCODE);
457 arg = arg->common.next;
460 return_ACPI_STATUS(AE_OK);
463 /*******************************************************************************
465 * FUNCTION: acpi_ds_create_field
467 * PARAMETERS: op - Op containing the Field definition and args
468 * region_node - Object for the containing Operation Region
469 * ` walk_state - Current method state
471 * RETURN: Status
473 * DESCRIPTION: Create a new field in the specified operation region
475 ******************************************************************************/
477 acpi_status
478 acpi_ds_create_field(union acpi_parse_object *op,
479 struct acpi_namespace_node *region_node,
480 struct acpi_walk_state *walk_state)
482 acpi_status status;
483 union acpi_parse_object *arg;
484 struct acpi_create_field_info info;
486 ACPI_FUNCTION_TRACE_PTR(ds_create_field, op);
488 /* First arg is the name of the parent op_region (must already exist) */
490 arg = op->common.value.arg;
492 if (!region_node) {
493 status =
494 acpi_ns_lookup(walk_state->scope_info,
495 arg->common.value.name, ACPI_TYPE_REGION,
496 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
497 walk_state, &region_node);
498 #ifdef ACPI_ASL_COMPILER
499 status = acpi_ds_create_external_region(status, arg,
500 arg->common.value.name,
501 walk_state,
502 &region_node);
503 #endif
504 if (ACPI_FAILURE(status)) {
505 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
506 arg->common.value.name, status);
507 return_ACPI_STATUS(status);
511 memset(&info, 0, sizeof(struct acpi_create_field_info));
513 /* Second arg is the field flags */
515 arg = arg->common.next;
516 info.field_flags = (u8) arg->common.value.integer;
517 info.attribute = 0;
519 /* Each remaining arg is a Named Field */
521 info.field_type = ACPI_TYPE_LOCAL_REGION_FIELD;
522 info.region_node = region_node;
524 status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
525 return_ACPI_STATUS(status);
528 /*******************************************************************************
530 * FUNCTION: acpi_ds_init_field_objects
532 * PARAMETERS: op - Op containing the Field definition and args
533 * ` walk_state - Current method state
535 * RETURN: Status
537 * DESCRIPTION: For each "Field Unit" name in the argument list that is
538 * part of the field declaration, enter the name into the
539 * namespace.
541 ******************************************************************************/
543 acpi_status
544 acpi_ds_init_field_objects(union acpi_parse_object *op,
545 struct acpi_walk_state *walk_state)
547 acpi_status status;
548 union acpi_parse_object *arg = NULL;
549 struct acpi_namespace_node *node;
550 u8 type = 0;
551 u32 flags;
553 ACPI_FUNCTION_TRACE_PTR(ds_init_field_objects, op);
555 /* Execute flag should always be set when this function is entered */
557 if (!(walk_state->parse_flags & ACPI_PARSE_EXECUTE)) {
558 if (walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP) {
560 /* bank_field Op is deferred, just return OK */
562 return_ACPI_STATUS(AE_OK);
565 ACPI_ERROR((AE_INFO, "Parse deferred mode is not set"));
566 return_ACPI_STATUS(AE_AML_INTERNAL);
570 * Get the field_list argument for this opcode. This is the start of the
571 * list of field elements.
573 switch (walk_state->opcode) {
574 case AML_FIELD_OP:
576 arg = acpi_ps_get_arg(op, 2);
577 type = ACPI_TYPE_LOCAL_REGION_FIELD;
578 break;
580 case AML_BANK_FIELD_OP:
582 arg = acpi_ps_get_arg(op, 4);
583 type = ACPI_TYPE_LOCAL_BANK_FIELD;
584 break;
586 case AML_INDEX_FIELD_OP:
588 arg = acpi_ps_get_arg(op, 3);
589 type = ACPI_TYPE_LOCAL_INDEX_FIELD;
590 break;
592 default:
594 return_ACPI_STATUS(AE_BAD_PARAMETER);
597 /* Creating new namespace node(s), should not already exist */
599 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
600 ACPI_NS_ERROR_IF_FOUND;
603 * Mark node(s) temporary if we are executing a normal control
604 * method. (Don't mark if this is a module-level code method)
606 if (walk_state->method_node &&
607 !(walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
608 flags |= ACPI_NS_TEMPORARY;
612 * Walk the list of entries in the field_list
613 * Note: field_list can be of zero length. In this case, Arg will be NULL.
615 while (arg) {
617 * Ignore OFFSET/ACCESSAS/CONNECTION terms here; we are only interested
618 * in the field names in order to enter them into the namespace.
620 if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
621 status = acpi_ns_lookup(walk_state->scope_info,
622 (char *)&arg->named.name, type,
623 ACPI_IMODE_LOAD_PASS1, flags,
624 walk_state, &node);
625 if (ACPI_FAILURE(status)) {
626 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
627 (char *)&arg->named.name,
628 status);
629 if (status != AE_ALREADY_EXISTS) {
630 return_ACPI_STATUS(status);
633 /* Name already exists, just ignore this error */
635 status = AE_OK;
638 arg->common.node = node;
641 /* Get the next field element in the list */
643 arg = arg->common.next;
646 return_ACPI_STATUS(AE_OK);
649 /*******************************************************************************
651 * FUNCTION: acpi_ds_create_bank_field
653 * PARAMETERS: op - Op containing the Field definition and args
654 * region_node - Object for the containing Operation Region
655 * walk_state - Current method state
657 * RETURN: Status
659 * DESCRIPTION: Create a new bank field in the specified operation region
661 ******************************************************************************/
663 acpi_status
664 acpi_ds_create_bank_field(union acpi_parse_object *op,
665 struct acpi_namespace_node *region_node,
666 struct acpi_walk_state *walk_state)
668 acpi_status status;
669 union acpi_parse_object *arg;
670 struct acpi_create_field_info info;
672 ACPI_FUNCTION_TRACE_PTR(ds_create_bank_field, op);
674 /* First arg is the name of the parent op_region (must already exist) */
676 arg = op->common.value.arg;
677 if (!region_node) {
678 status =
679 acpi_ns_lookup(walk_state->scope_info,
680 arg->common.value.name, ACPI_TYPE_REGION,
681 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
682 walk_state, &region_node);
683 #ifdef ACPI_ASL_COMPILER
684 status = acpi_ds_create_external_region(status, arg,
685 arg->common.value.name,
686 walk_state,
687 &region_node);
688 #endif
689 if (ACPI_FAILURE(status)) {
690 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
691 arg->common.value.name, status);
692 return_ACPI_STATUS(status);
696 /* Second arg is the Bank Register (Field) (must already exist) */
698 arg = arg->common.next;
699 status =
700 acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
701 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
702 ACPI_NS_SEARCH_PARENT, walk_state,
703 &info.register_node);
704 if (ACPI_FAILURE(status)) {
705 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
706 arg->common.value.string, status);
707 return_ACPI_STATUS(status);
711 * Third arg is the bank_value
712 * This arg is a term_arg, not a constant
713 * It will be evaluated later, by acpi_ds_eval_bank_field_operands
715 arg = arg->common.next;
717 /* Fourth arg is the field flags */
719 arg = arg->common.next;
720 info.field_flags = (u8) arg->common.value.integer;
722 /* Each remaining arg is a Named Field */
724 info.field_type = ACPI_TYPE_LOCAL_BANK_FIELD;
725 info.region_node = region_node;
728 * Use Info.data_register_node to store bank_field Op
729 * It's safe because data_register_node will never be used when create
730 * bank field \we store aml_start and aml_length in the bank_field Op for
731 * late evaluation. Used in acpi_ex_prep_field_value(Info)
733 * TBD: Or, should we add a field in struct acpi_create_field_info, like
734 * "void *ParentOp"?
736 info.data_register_node = (struct acpi_namespace_node *)op;
738 status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
739 return_ACPI_STATUS(status);
742 /*******************************************************************************
744 * FUNCTION: acpi_ds_create_index_field
746 * PARAMETERS: op - Op containing the Field definition and args
747 * region_node - Object for the containing Operation Region
748 * ` walk_state - Current method state
750 * RETURN: Status
752 * DESCRIPTION: Create a new index field in the specified operation region
754 ******************************************************************************/
756 acpi_status
757 acpi_ds_create_index_field(union acpi_parse_object *op,
758 struct acpi_namespace_node *region_node,
759 struct acpi_walk_state *walk_state)
761 acpi_status status;
762 union acpi_parse_object *arg;
763 struct acpi_create_field_info info;
765 ACPI_FUNCTION_TRACE_PTR(ds_create_index_field, op);
767 /* First arg is the name of the Index register (must already exist) */
769 arg = op->common.value.arg;
770 status =
771 acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
772 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
773 ACPI_NS_SEARCH_PARENT, walk_state,
774 &info.register_node);
775 if (ACPI_FAILURE(status)) {
776 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
777 arg->common.value.string, status);
778 return_ACPI_STATUS(status);
781 /* Second arg is the data register (must already exist) */
783 arg = arg->common.next;
784 status =
785 acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
786 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
787 ACPI_NS_SEARCH_PARENT, walk_state,
788 &info.data_register_node);
789 if (ACPI_FAILURE(status)) {
790 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
791 arg->common.value.string, status);
792 return_ACPI_STATUS(status);
795 /* Next arg is the field flags */
797 arg = arg->common.next;
798 info.field_flags = (u8) arg->common.value.integer;
800 /* Each remaining arg is a Named Field */
802 info.field_type = ACPI_TYPE_LOCAL_INDEX_FIELD;
803 info.region_node = region_node;
805 status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
806 return_ACPI_STATUS(status);