1 /******************************************************************************
3 * Module Name: nspredef - Validation of ACPI predefined methods and objects
6 *****************************************************************************/
9 * Copyright (C) 2000 - 2008, Intel Corp.
10 * All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
45 #include <acpi/acpi.h>
50 #define _COMPONENT ACPI_NAMESPACE
51 ACPI_MODULE_NAME("nspredef")
53 /*******************************************************************************
55 * This module validates predefined ACPI objects that appear in the namespace,
56 * at the time they are evaluated (via acpi_evaluate_object). The purpose of this
57 * validation is to detect problems with BIOS-exposed predefined ACPI objects
58 * before the results are returned to the ACPI-related drivers.
60 * There are several areas that are validated:
62 * 1) The number of input arguments as defined by the method/object in the
63 * ASL is validated against the ACPI specification.
64 * 2) The type of the return object (if any) is validated against the ACPI
66 * 3) For returned package objects, the count of package elements is
67 * validated, as well as the type of each package element. Nested
68 * packages are supported.
70 * For any problems found, a warning message is issued.
72 ******************************************************************************/
73 /* Local prototypes */
75 acpi_ns_check_package(struct acpi_predefined_data *data,
76 union acpi_operand_object **return_object_ptr);
79 acpi_ns_check_package_list(struct acpi_predefined_data *data,
80 const union acpi_predefined_info *package,
81 union acpi_operand_object **elements, u32 count);
84 acpi_ns_check_package_elements(struct acpi_predefined_data *data,
85 union acpi_operand_object **elements,
88 u8 type2, u32 count2, u32 start_index);
91 acpi_ns_check_object_type(struct acpi_predefined_data *data,
92 union acpi_operand_object **return_object_ptr,
93 u32 expected_btypes, u32 package_index);
96 acpi_ns_check_reference(struct acpi_predefined_data *data,
97 union acpi_operand_object *return_object);
99 static void acpi_ns_get_expected_types(char *buffer, u32 expected_btypes);
102 * Names for the types that can be returned by the predefined objects.
103 * Used for warning messages. Must be in the same order as the ACPI_RTYPEs
105 static const char *acpi_rtype_names[] = {
113 /*******************************************************************************
115 * FUNCTION: acpi_ns_check_predefined_names
117 * PARAMETERS: Node - Namespace node for the method/object
118 * user_param_count - Number of parameters actually passed
119 * return_status - Status from the object evaluation
120 * return_object_ptr - Pointer to the object returned from the
121 * evaluation of a method or object
125 * DESCRIPTION: Check an ACPI name for a match in the predefined name list.
127 ******************************************************************************/
130 acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
131 u32 user_param_count,
132 acpi_status return_status,
133 union acpi_operand_object **return_object_ptr)
135 union acpi_operand_object *return_object = *return_object_ptr;
136 acpi_status status = AE_OK;
137 const union acpi_predefined_info *predefined;
139 struct acpi_predefined_data *data;
141 /* Match the name for this method/object against the predefined list */
143 predefined = acpi_ns_check_for_predefined_name(node);
145 /* Get the full pathname to the object, for use in warning messages */
147 pathname = acpi_ns_get_external_pathname(node);
149 return AE_OK; /* Could not get pathname, ignore */
153 * Check that the parameter count for this method matches the ASL
154 * definition. For predefined names, ensure that both the caller and
155 * the method itself are in accordance with the ACPI specification.
157 acpi_ns_check_parameter_count(pathname, node, user_param_count,
160 /* If not a predefined name, we cannot validate the return object */
167 * If the method failed or did not actually return an object, we cannot
168 * validate the return object
170 if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) {
175 * If there is no return value, check if we require a return value for
176 * this predefined name. Either one return value is expected, or none,
177 * for both methods and other objects.
179 * Exit now if there is no return object. Warning if one was expected.
181 if (!return_object) {
182 if ((predefined->info.expected_btypes) &&
183 (!(predefined->info.expected_btypes & ACPI_RTYPE_NONE))) {
184 ACPI_WARN_PREDEFINED((AE_INFO, pathname,
186 "Missing expected return value"));
188 status = AE_AML_NO_RETURN_VALUE;
194 * We have a return value, but if one wasn't expected, just exit, this is
195 * not a problem. For example, if the "Implicit Return" feature is
196 * enabled, methods will always return a value.
198 if (!predefined->info.expected_btypes) {
202 /* Create the parameter data block for object validation */
204 data = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_predefined_data));
208 data->predefined = predefined;
209 data->node_flags = node->flags;
210 data->pathname = pathname;
213 * Check that the type of the return object is what is expected for
214 * this predefined name
216 status = acpi_ns_check_object_type(data, return_object_ptr,
217 predefined->info.expected_btypes,
218 ACPI_NOT_PACKAGE_ELEMENT);
219 if (ACPI_FAILURE(status)) {
220 goto check_validation_status;
223 /* For returned Package objects, check the type of all sub-objects */
225 if (return_object->common.type == ACPI_TYPE_PACKAGE) {
226 status = acpi_ns_check_package(data, return_object_ptr);
229 check_validation_status:
231 * If the object validation failed or if we successfully repaired one
232 * or more objects, mark the parent node to suppress further warning
233 * messages during the next evaluation of the same method/object.
235 if (ACPI_FAILURE(status) || (data->flags & ACPI_OBJECT_REPAIRED)) {
236 node->flags |= ANOBJ_EVALUATED;
245 /*******************************************************************************
247 * FUNCTION: acpi_ns_check_parameter_count
249 * PARAMETERS: Pathname - Full pathname to the node (for error msgs)
250 * Node - Namespace node for the method/object
251 * user_param_count - Number of args passed in by the caller
252 * Predefined - Pointer to entry in predefined name table
256 * DESCRIPTION: Check that the declared (in ASL/AML) parameter count for a
257 * predefined name is what is expected (i.e., what is defined in
258 * the ACPI specification for this predefined name.)
260 ******************************************************************************/
263 acpi_ns_check_parameter_count(char *pathname,
264 struct acpi_namespace_node *node,
265 u32 user_param_count,
266 const union acpi_predefined_info *predefined)
269 u32 required_params_current;
270 u32 required_params_old;
272 /* Methods have 0-7 parameters. All other types have zero. */
275 if (node->type == ACPI_TYPE_METHOD) {
276 param_count = node->object->method.param_count;
281 * Check the parameter count for non-predefined methods/objects.
283 * Warning if too few or too many arguments have been passed by the
284 * caller. An incorrect number of arguments may not cause the method
285 * to fail. However, the method will fail if there are too few
286 * arguments and the method attempts to use one of the missing ones.
288 if (user_param_count < param_count) {
289 ACPI_WARN_PREDEFINED((AE_INFO, pathname,
291 "Insufficient arguments - needs %u, found %u",
292 param_count, user_param_count));
293 } else if (user_param_count > param_count) {
294 ACPI_WARN_PREDEFINED((AE_INFO, pathname,
296 "Excess arguments - needs %u, found %u",
297 param_count, user_param_count));
303 * Validate the user-supplied parameter count.
304 * Allow two different legal argument counts (_SCP, etc.)
306 required_params_current = predefined->info.param_count & 0x0F;
307 required_params_old = predefined->info.param_count >> 4;
309 if (user_param_count != ACPI_UINT32_MAX) {
310 if ((user_param_count != required_params_current) &&
311 (user_param_count != required_params_old)) {
312 ACPI_WARN_PREDEFINED((AE_INFO, pathname,
314 "Parameter count mismatch - "
315 "caller passed %u, ACPI requires %u",
317 required_params_current));
322 * Check that the ASL-defined parameter count is what is expected for
323 * this predefined name (parameter count as defined by the ACPI
326 if ((param_count != required_params_current) &&
327 (param_count != required_params_old)) {
328 ACPI_WARN_PREDEFINED((AE_INFO, pathname, node->flags,
329 "Parameter count mismatch - ASL declared %u, ACPI requires %u",
330 param_count, required_params_current));
334 /*******************************************************************************
336 * FUNCTION: acpi_ns_check_for_predefined_name
338 * PARAMETERS: Node - Namespace node for the method/object
340 * RETURN: Pointer to entry in predefined table. NULL indicates not found.
342 * DESCRIPTION: Check an object name against the predefined object list.
344 ******************************************************************************/
346 const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
350 const union acpi_predefined_info *this_name;
352 /* Quick check for a predefined name, first character must be underscore */
354 if (node->name.ascii[0] != '_') {
358 /* Search info table for a predefined method/object name */
360 this_name = predefined_names;
361 while (this_name->info.name[0]) {
362 if (ACPI_COMPARE_NAME(node->name.ascii, this_name->info.name)) {
367 * Skip next entry in the table if this name returns a Package
368 * (next entry contains the package info)
370 if (this_name->info.expected_btypes & ACPI_RTYPE_PACKAGE) {
377 return (NULL); /* Not found */
380 /*******************************************************************************
382 * FUNCTION: acpi_ns_check_package
384 * PARAMETERS: Data - Pointer to validation data structure
385 * return_object_ptr - Pointer to the object returned from the
386 * evaluation of a method or object
390 * DESCRIPTION: Check a returned package object for the correct count and
391 * correct type of all sub-objects.
393 ******************************************************************************/
396 acpi_ns_check_package(struct acpi_predefined_data *data,
397 union acpi_operand_object **return_object_ptr)
399 union acpi_operand_object *return_object = *return_object_ptr;
400 const union acpi_predefined_info *package;
401 union acpi_operand_object **elements;
402 acpi_status status = AE_OK;
407 ACPI_FUNCTION_NAME(ns_check_package);
409 /* The package info for this name is in the next table entry */
411 package = data->predefined + 1;
413 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
414 "%s Validating return Package of Type %X, Count %X\n",
415 data->pathname, package->ret_info.type,
416 return_object->package.count));
418 /* Extract package count and elements array */
420 elements = return_object->package.elements;
421 count = return_object->package.count;
423 /* The package must have at least one element, else invalid */
426 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
427 "Return Package has no elements (empty)"));
429 return (AE_AML_OPERAND_VALUE);
433 * Decode the type of the expected package contents
435 * PTYPE1 packages contain no subpackages
436 * PTYPE2 packages contain sub-packages
438 switch (package->ret_info.type) {
439 case ACPI_PTYPE1_FIXED:
442 * The package count is fixed and there are no sub-packages
444 * If package is too small, exit.
445 * If package is larger than expected, issue warning but continue
448 package->ret_info.count1 + package->ret_info.count2;
449 if (count < expected_count) {
450 goto package_too_small;
451 } else if (count > expected_count) {
452 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
454 "Return Package is larger than needed - "
455 "found %u, expected %u", count,
459 /* Validate all elements of the returned package */
461 status = acpi_ns_check_package_elements(data, elements,
472 case ACPI_PTYPE1_VAR:
475 * The package count is variable, there are no sub-packages, and all
476 * elements must be of the same type
478 for (i = 0; i < count; i++) {
479 status = acpi_ns_check_object_type(data, elements,
482 if (ACPI_FAILURE(status)) {
489 case ACPI_PTYPE1_OPTION:
492 * The package count is variable, there are no sub-packages. There are
493 * a fixed number of required elements, and a variable number of
496 * Check if package is at least as large as the minimum required
498 expected_count = package->ret_info3.count;
499 if (count < expected_count) {
500 goto package_too_small;
503 /* Variable number of sub-objects */
505 for (i = 0; i < count; i++) {
506 if (i < package->ret_info3.count) {
508 /* These are the required package elements (0, 1, or 2) */
511 acpi_ns_check_object_type(data, elements,
516 if (ACPI_FAILURE(status)) {
520 /* These are the optional package elements */
523 acpi_ns_check_object_type(data, elements,
528 if (ACPI_FAILURE(status)) {
536 case ACPI_PTYPE2_REV_FIXED:
538 /* First element is the (Integer) revision */
540 status = acpi_ns_check_object_type(data, elements,
541 ACPI_RTYPE_INTEGER, 0);
542 if (ACPI_FAILURE(status)) {
549 /* Examine the sub-packages */
552 acpi_ns_check_package_list(data, package, elements, count);
555 case ACPI_PTYPE2_PKG_COUNT:
557 /* First element is the (Integer) count of sub-packages to follow */
559 status = acpi_ns_check_object_type(data, elements,
560 ACPI_RTYPE_INTEGER, 0);
561 if (ACPI_FAILURE(status)) {
566 * Count cannot be larger than the parent package length, but allow it
567 * to be smaller. The >= accounts for the Integer above.
569 expected_count = (u32) (*elements)->integer.value;
570 if (expected_count >= count) {
571 goto package_too_small;
574 count = expected_count;
577 /* Examine the sub-packages */
580 acpi_ns_check_package_list(data, package, elements, count);
584 case ACPI_PTYPE2_FIXED:
585 case ACPI_PTYPE2_MIN:
586 case ACPI_PTYPE2_COUNT:
589 * These types all return a single Package that consists of a
590 * variable number of sub-Packages.
592 * First, ensure that the first element is a sub-Package. If not,
593 * the BIOS may have incorrectly returned the object as a single
594 * package instead of a Package of Packages (a common error if
595 * there is only one entry). We may be able to repair this by
596 * wrapping the returned Package with a new outer Package.
598 if ((*elements)->common.type != ACPI_TYPE_PACKAGE) {
600 /* Create the new outer package and populate it */
603 acpi_ns_repair_package_list(data,
605 if (ACPI_FAILURE(status)) {
609 /* Update locals to point to the new package (of 1 element) */
611 return_object = *return_object_ptr;
612 elements = return_object->package.elements;
616 /* Examine the sub-packages */
619 acpi_ns_check_package_list(data, package, elements, count);
624 /* Should not get here if predefined info table is correct */
626 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
627 "Invalid internal return type in table entry: %X",
628 package->ret_info.type));
630 return (AE_AML_INTERNAL);
637 /* Error exit for the case with an incorrect package count */
639 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
640 "Return Package is too small - found %u elements, expected %u",
641 count, expected_count));
643 return (AE_AML_OPERAND_VALUE);
646 /*******************************************************************************
648 * FUNCTION: acpi_ns_check_package_list
650 * PARAMETERS: Data - Pointer to validation data structure
651 * Package - Pointer to package-specific info for method
652 * Elements - Element list of parent package. All elements
653 * of this list should be of type Package.
654 * Count - Count of subpackages
658 * DESCRIPTION: Examine a list of subpackages
660 ******************************************************************************/
663 acpi_ns_check_package_list(struct acpi_predefined_data *data,
664 const union acpi_predefined_info *package,
665 union acpi_operand_object **elements, u32 count)
667 union acpi_operand_object *sub_package;
668 union acpi_operand_object **sub_elements;
674 /* Validate each sub-Package in the parent Package */
676 for (i = 0; i < count; i++) {
677 sub_package = *elements;
678 sub_elements = sub_package->package.elements;
680 /* Each sub-object must be of type Package */
682 status = acpi_ns_check_object_type(data, &sub_package,
683 ACPI_RTYPE_PACKAGE, i);
684 if (ACPI_FAILURE(status)) {
688 /* Examine the different types of expected sub-packages */
690 switch (package->ret_info.type) {
692 case ACPI_PTYPE2_PKG_COUNT:
693 case ACPI_PTYPE2_REV_FIXED:
695 /* Each subpackage has a fixed number of elements */
698 package->ret_info.count1 + package->ret_info.count2;
699 if (sub_package->package.count < expected_count) {
700 goto package_too_small;
704 acpi_ns_check_package_elements(data, sub_elements,
713 if (ACPI_FAILURE(status)) {
718 case ACPI_PTYPE2_FIXED:
720 /* Each sub-package has a fixed length */
722 expected_count = package->ret_info2.count;
723 if (sub_package->package.count < expected_count) {
724 goto package_too_small;
727 /* Check the type of each sub-package element */
729 for (j = 0; j < expected_count; j++) {
731 acpi_ns_check_object_type(data,
737 if (ACPI_FAILURE(status)) {
743 case ACPI_PTYPE2_MIN:
745 /* Each sub-package has a variable but minimum length */
747 expected_count = package->ret_info.count1;
748 if (sub_package->package.count < expected_count) {
749 goto package_too_small;
752 /* Check the type of each sub-package element */
755 acpi_ns_check_package_elements(data, sub_elements,
758 sub_package->package.
760 if (ACPI_FAILURE(status)) {
765 case ACPI_PTYPE2_COUNT:
768 * First element is the (Integer) count of elements, including
771 status = acpi_ns_check_object_type(data, sub_elements,
774 if (ACPI_FAILURE(status)) {
779 * Make sure package is large enough for the Count and is
780 * is as large as the minimum size
782 expected_count = (u32)(*sub_elements)->integer.value;
783 if (sub_package->package.count < expected_count) {
784 goto package_too_small;
786 if (sub_package->package.count <
787 package->ret_info.count1) {
788 expected_count = package->ret_info.count1;
789 goto package_too_small;
792 /* Check the type of each sub-package element */
795 acpi_ns_check_package_elements(data,
799 (expected_count - 1),
801 if (ACPI_FAILURE(status)) {
806 default: /* Should not get here, type was validated by caller */
808 return (AE_AML_INTERNAL);
818 /* The sub-package count was smaller than required */
820 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
821 "Return Sub-Package[%u] is too small - found %u elements, expected %u",
822 i, sub_package->package.count, expected_count));
824 return (AE_AML_OPERAND_VALUE);
827 /*******************************************************************************
829 * FUNCTION: acpi_ns_check_package_elements
831 * PARAMETERS: Data - Pointer to validation data structure
832 * Elements - Pointer to the package elements array
833 * Type1 - Object type for first group
834 * Count1 - Count for first group
835 * Type2 - Object type for second group
836 * Count2 - Count for second group
837 * start_index - Start of the first group of elements
841 * DESCRIPTION: Check that all elements of a package are of the correct object
842 * type. Supports up to two groups of different object types.
844 ******************************************************************************/
847 acpi_ns_check_package_elements(struct acpi_predefined_data *data,
848 union acpi_operand_object **elements,
851 u8 type2, u32 count2, u32 start_index)
853 union acpi_operand_object **this_element = elements;
858 * Up to two groups of package elements are supported by the data
859 * structure. All elements in each group must be of the same type.
860 * The second group can have a count of zero.
862 for (i = 0; i < count1; i++) {
863 status = acpi_ns_check_object_type(data, this_element,
864 type1, i + start_index);
865 if (ACPI_FAILURE(status)) {
871 for (i = 0; i < count2; i++) {
872 status = acpi_ns_check_object_type(data, this_element,
874 (i + count1 + start_index));
875 if (ACPI_FAILURE(status)) {
884 /*******************************************************************************
886 * FUNCTION: acpi_ns_check_object_type
888 * PARAMETERS: Data - Pointer to validation data structure
889 * return_object_ptr - Pointer to the object returned from the
890 * evaluation of a method or object
891 * expected_btypes - Bitmap of expected return type(s)
892 * package_index - Index of object within parent package (if
893 * applicable - ACPI_NOT_PACKAGE_ELEMENT
898 * DESCRIPTION: Check the type of the return object against the expected object
899 * type(s). Use of Btype allows multiple expected object types.
901 ******************************************************************************/
904 acpi_ns_check_object_type(struct acpi_predefined_data *data,
905 union acpi_operand_object **return_object_ptr,
906 u32 expected_btypes, u32 package_index)
908 union acpi_operand_object *return_object = *return_object_ptr;
909 acpi_status status = AE_OK;
911 char type_buffer[48]; /* Room for 5 types */
914 * If we get a NULL return_object here, it is a NULL package element,
915 * and this is always an error.
917 if (!return_object) {
918 goto type_error_exit;
921 /* A Namespace node should not get here, but make sure */
923 if (ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) {
924 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
925 "Invalid return type - Found a Namespace node [%4.4s] type %s",
926 return_object->node.name.ascii,
927 acpi_ut_get_type_name(return_object->node.
929 return (AE_AML_OPERAND_TYPE);
933 * Convert the object type (ACPI_TYPE_xxx) to a bitmapped object type.
934 * The bitmapped type allows multiple possible return types.
936 * Note, the cases below must handle all of the possible types returned
937 * from all of the predefined names (including elements of returned
940 switch (return_object->common.type) {
941 case ACPI_TYPE_INTEGER:
942 return_btype = ACPI_RTYPE_INTEGER;
945 case ACPI_TYPE_BUFFER:
946 return_btype = ACPI_RTYPE_BUFFER;
949 case ACPI_TYPE_STRING:
950 return_btype = ACPI_RTYPE_STRING;
953 case ACPI_TYPE_PACKAGE:
954 return_btype = ACPI_RTYPE_PACKAGE;
957 case ACPI_TYPE_LOCAL_REFERENCE:
958 return_btype = ACPI_RTYPE_REFERENCE;
962 /* Not one of the supported objects, must be incorrect */
964 goto type_error_exit;
967 /* Is the object one of the expected types? */
969 if (!(return_btype & expected_btypes)) {
971 /* Type mismatch -- attempt repair of the returned object */
973 status = acpi_ns_repair_object(data, expected_btypes,
976 if (ACPI_SUCCESS(status)) {
977 return (AE_OK); /* Repair was successful */
979 goto type_error_exit;
982 /* For reference objects, check that the reference type is correct */
984 if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) {
985 status = acpi_ns_check_reference(data, return_object);
992 /* Create a string with all expected types for this predefined object */
994 acpi_ns_get_expected_types(type_buffer, expected_btypes);
996 if (package_index == ACPI_NOT_PACKAGE_ELEMENT) {
997 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
998 "Return type mismatch - found %s, expected %s",
999 acpi_ut_get_object_type_name
1000 (return_object), type_buffer));
1002 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
1003 "Return Package type mismatch at index %u - "
1004 "found %s, expected %s", package_index,
1005 acpi_ut_get_object_type_name
1006 (return_object), type_buffer));
1009 return (AE_AML_OPERAND_TYPE);
1012 /*******************************************************************************
1014 * FUNCTION: acpi_ns_check_reference
1016 * PARAMETERS: Data - Pointer to validation data structure
1017 * return_object - Object returned from the evaluation of a
1022 * DESCRIPTION: Check a returned reference object for the correct reference
1023 * type. The only reference type that can be returned from a
1024 * predefined method is a named reference. All others are invalid.
1026 ******************************************************************************/
1029 acpi_ns_check_reference(struct acpi_predefined_data *data,
1030 union acpi_operand_object *return_object)
1034 * Check the reference object for the correct reference type (opcode).
1035 * The only type of reference that can be converted to an union acpi_object is
1036 * a reference to a named object (reference class: NAME)
1038 if (return_object->reference.class == ACPI_REFCLASS_NAME) {
1042 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
1043 "Return type mismatch - unexpected reference object type [%s] %2.2X",
1044 acpi_ut_get_reference_name(return_object),
1045 return_object->reference.class));
1047 return (AE_AML_OPERAND_TYPE);
1050 /*******************************************************************************
1052 * FUNCTION: acpi_ns_get_expected_types
1054 * PARAMETERS: Buffer - Pointer to where the string is returned
1055 * expected_btypes - Bitmap of expected return type(s)
1057 * RETURN: Buffer is populated with type names.
1059 * DESCRIPTION: Translate the expected types bitmap into a string of ascii
1060 * names of expected types, for use in warning messages.
1062 ******************************************************************************/
1064 static void acpi_ns_get_expected_types(char *buffer, u32 expected_btypes)
1072 this_rtype = ACPI_RTYPE_INTEGER;
1074 for (i = 0; i < ACPI_NUM_RTYPES; i++) {
1076 /* If one of the expected types, concatenate the name of this type */
1078 if (expected_btypes & this_rtype) {
1079 ACPI_STRCAT(buffer, &acpi_rtype_names[i][j]);
1080 j = 0; /* Use name separator from now on */
1082 this_rtype <<= 1; /* Next Rtype */