@@ -62,6 +62,10 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
62
62
u32 count1 ,
63
63
u8 type2 , u32 count2 , u32 start_index );
64
64
65
+ static acpi_status
66
+ acpi_ns_custom_package (struct acpi_evaluate_info * info ,
67
+ union acpi_operand_object * * elements , u32 count );
68
+
65
69
/*******************************************************************************
66
70
*
67
71
* FUNCTION: acpi_ns_check_package
@@ -135,6 +139,11 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,
135
139
* PTYPE2 packages contain subpackages
136
140
*/
137
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
147
case ACPI_PTYPE1_FIXED :
139
148
/*
140
149
* The package count is fixed and there are no subpackages
@@ -624,6 +633,83 @@ acpi_ns_check_package_list(struct acpi_evaluate_info *info,
624
633
return (AE_AML_OPERAND_VALUE );
625
634
}
626
635
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
+
627
713
/*******************************************************************************
628
714
*
629
715
* FUNCTION: acpi_ns_check_package_elements
0 commit comments