aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2016-05-05 00:58:12 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-05-05 09:22:26 -0400
commit7952d40240855932de01bbe81c02bf1416ec91d8 (patch)
treed2385ef052c3fb177cd163a1b62e12c718f920f9
parent2a397a390a90ff84cd17a6cd2275c2f19478a948 (diff)
ACPICA: ACPI 6.0: Update _BIX support for new package element
ACPICA commit 3451e6d49d37919c13ec2c0019a31534b0dfc0c0 One integer was added at the end of the _BIX method, and the version number was incremented. Link: https://github.com/acpica/acpica/commit/3451e6d4 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpica/acpredef.h5
-rw-r--r--drivers/acpi/acpica/nsprepkg.c86
2 files changed, 89 insertions, 2 deletions
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h
index 4ca426b55509..888440b2cf2e 100644
--- a/drivers/acpi/acpica/acpredef.h
+++ b/drivers/acpi/acpica/acpredef.h
@@ -129,7 +129,8 @@ enum acpi_return_package_types {
129 ACPI_PTYPE2_REV_FIXED = 9, 129 ACPI_PTYPE2_REV_FIXED = 9,
130 ACPI_PTYPE2_FIX_VAR = 10, 130 ACPI_PTYPE2_FIX_VAR = 10,
131 ACPI_PTYPE2_VAR_VAR = 11, 131 ACPI_PTYPE2_VAR_VAR = 11,
132 ACPI_PTYPE2_UUID_PAIR = 12 132 ACPI_PTYPE2_UUID_PAIR = 12,
133 ACPI_PTYPE_CUSTOM = 13
133}; 134};
134 135
135/* Support macros for users of the predefined info table */ 136/* Support macros for users of the predefined info table */
@@ -340,7 +341,7 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
340 341
341 {{"_BIX", METHOD_0ARGS, 342 {{"_BIX", METHOD_0ARGS,
342 METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int),(4 Str) */ 343 METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int),(4 Str) */
343 PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, 344 PACKAGE_INFO(ACPI_PTYPE_CUSTOM, ACPI_RTYPE_INTEGER, 16,
344 ACPI_RTYPE_STRING, 4, 0), 345 ACPI_RTYPE_STRING, 4, 0),
345 346
346 {{"_BLT", 347 {{"_BLT",
diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c
index fde5a09819e0..fbedc6e8ab36 100644
--- a/drivers/acpi/acpica/nsprepkg.c
+++ b/drivers/acpi/acpica/nsprepkg.c
@@ -62,6 +62,10 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
62 u32 count1, 62 u32 count1,
63 u8 type2, u32 count2, u32 start_index); 63 u8 type2, u32 count2, u32 start_index);
64 64
65static acpi_status
66acpi_ns_custom_package(struct acpi_evaluate_info *info,
67 union acpi_operand_object **elements, u32 count);
68
65/******************************************************************************* 69/*******************************************************************************
66 * 70 *
67 * FUNCTION: acpi_ns_check_package 71 * FUNCTION: acpi_ns_check_package
@@ -135,6 +139,11 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,
135 * PTYPE2 packages contain subpackages 139 * PTYPE2 packages contain subpackages
136 */ 140 */
137 switch (package->ret_info.type) { 141 switch (package->ret_info.type) {
142 case ACPI_PTYPE_CUSTOM:
143
144 status = acpi_ns_custom_package(info, elements, count);
145 break;
146
138 case ACPI_PTYPE1_FIXED: 147 case ACPI_PTYPE1_FIXED:
139 /* 148 /*
140 * The package count is fixed and there are no subpackages 149 * The package count is fixed and there are no subpackages
@@ -626,6 +635,83 @@ package_too_small:
626 635
627/******************************************************************************* 636/*******************************************************************************
628 * 637 *
638 * FUNCTION: acpi_ns_custom_package
639 *
640 * PARAMETERS: info - Method execution information block
641 * elements - Pointer to the package elements array
642 * count - Element count for the package
643 *
644 * RETURN: Status
645 *
646 * DESCRIPTION: Check a returned package object for the correct count and
647 * correct type of all sub-objects.
648 *
649 * NOTE: Currently used for the _BIX method only. When needed for two or more
650 * methods, probably a detect/dispatch mechanism will be required.
651 *
652 ******************************************************************************/
653
654static acpi_status
655acpi_ns_custom_package(struct acpi_evaluate_info *info,
656 union acpi_operand_object **elements, u32 count)
657{
658 u32 expected_count;
659 u32 version;
660 acpi_status status = AE_OK;
661
662 ACPI_FUNCTION_NAME(ns_custom_package);
663
664 /* Get version number, must be Integer */
665
666 if ((*elements)->common.type != ACPI_TYPE_INTEGER) {
667 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
668 info->node_flags,
669 "Return Package has invalid object type for version number"));
670 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
671 }
672
673 version = (u32)(*elements)->integer.value;
674 expected_count = 21; /* Version 1 */
675
676 if (version == 0) {
677 expected_count = 20; /* Version 0 */
678 }
679
680 if (count < expected_count) {
681 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
682 info->node_flags,
683 "Return Package is too small - found %u elements, expected %u",
684 count, expected_count));
685 return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
686 } else if (count > expected_count) {
687 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
688 "%s: Return Package is larger than needed - "
689 "found %u, expected %u\n",
690 info->full_pathname, count, expected_count));
691 }
692
693 /* Validate all elements of the returned package */
694
695 status = acpi_ns_check_package_elements(info, elements,
696 ACPI_RTYPE_INTEGER, 16,
697 ACPI_RTYPE_STRING, 4, 0);
698 if (ACPI_FAILURE(status)) {
699 return_ACPI_STATUS(status);
700 }
701
702 /* Version 1 has a single trailing integer */
703
704 if (version > 0) {
705 status = acpi_ns_check_package_elements(info, elements + 20,
706 ACPI_RTYPE_INTEGER, 1,
707 0, 0, 20);
708 }
709
710 return_ACPI_STATUS(status);
711}
712
713/*******************************************************************************
714 *
629 * FUNCTION: acpi_ns_check_package_elements 715 * FUNCTION: acpi_ns_check_package_elements
630 * 716 *
631 * PARAMETERS: info - Method execution information block 717 * PARAMETERS: info - Method execution information block