Skip to content

Commit 7952d40

Browse files
acpibobrafaeljw
authored andcommitted
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: acpica/acpica@3451e6d4 Signed-off-by: Bob Moore <[email protected]> Signed-off-by: Lv Zheng <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 2a397a3 commit 7952d40

File tree

2 files changed

+89
-2
lines changed

2 files changed

+89
-2
lines changed

drivers/acpi/acpica/acpredef.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ enum acpi_return_package_types {
129129
ACPI_PTYPE2_REV_FIXED = 9,
130130
ACPI_PTYPE2_FIX_VAR = 10,
131131
ACPI_PTYPE2_VAR_VAR = 11,
132-
ACPI_PTYPE2_UUID_PAIR = 12
132+
ACPI_PTYPE2_UUID_PAIR = 12,
133+
ACPI_PTYPE_CUSTOM = 13
133134
};
134135

135136
/* Support macros for users of the predefined info table */
@@ -340,7 +341,7 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
340341

341342
{{"_BIX", METHOD_0ARGS,
342343
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,
344345
ACPI_RTYPE_STRING, 4, 0),
345346

346347
{{"_BLT",

drivers/acpi/acpica/nsprepkg.c

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
6262
u32 count1,
6363
u8 type2, u32 count2, u32 start_index);
6464

65+
static acpi_status
66+
acpi_ns_custom_package(struct acpi_evaluate_info *info,
67+
union acpi_operand_object **elements, u32 count);
68+
6569
/*******************************************************************************
6670
*
6771
* FUNCTION: acpi_ns_check_package
@@ -135,6 +139,11 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,
135139
* PTYPE2 packages contain subpackages
136140
*/
137141
switch (package->ret_info.type) {
142+
case ACPI_PTYPE_CUSTOM:
143+
144+
status = acpi_ns_custom_package(info, elements, count);
145+
break;
146+
138147
case ACPI_PTYPE1_FIXED:
139148
/*
140149
* The package count is fixed and there are no subpackages
@@ -624,6 +633,83 @@ acpi_ns_check_package_list(struct acpi_evaluate_info *info,
624633
return (AE_AML_OPERAND_VALUE);
625634
}
626635

636+
/*******************************************************************************
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+
654+
static acpi_status
655+
acpi_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+
627713
/*******************************************************************************
628714
*
629715
* FUNCTION: acpi_ns_check_package_elements

0 commit comments

Comments
 (0)