1 /******************************************************************************
3 * Module Name: aslprepkg - support for ACPI predefined name package objects
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp.
12 * All rights reserved.
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
72 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************
116 * Alternatively, you may choose to be licensed under the terms of the
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
150 *****************************************************************************/
152 #include <contrib/dev/acpica/compiler/aslcompiler.h>
153 #include "aslcompiler.y.h"
154 #include <contrib/dev/acpica/include/acpredef.h>
157 #define _COMPONENT ACPI_COMPILER
158 ACPI_MODULE_NAME ("aslprepkg")
161 /* Local prototypes */
163 static ACPI_PARSE_OBJECT *
164 ApCheckPackageElements (
165 const char *PredefinedName,
166 ACPI_PARSE_OBJECT *Op,
174 const char *PredefinedName,
175 ACPI_PARSE_OBJECT *ParentOp,
176 const ACPI_PREDEFINED_INFO *Package,
182 const char *PredefinedName,
183 ACPI_PARSE_OBJECT *Op,
185 UINT32 ExpectedCount);
188 ApZeroLengthPackage (
189 const char *PredefinedName,
190 ACPI_PARSE_OBJECT *Op);
194 const char *PredefinedName,
195 ACPI_PARSE_OBJECT *Op,
197 UINT32 ExpectedCount);
201 ACPI_PARSE_OBJECT *ParentOp,
202 const ACPI_PREDEFINED_INFO *Predefined);
205 /*******************************************************************************
207 * FUNCTION: ApCheckPackage
209 * PARAMETERS: ParentOp - Parser op for the package
210 * Predefined - Pointer to package-specific info for
215 * DESCRIPTION: Top-level validation for predefined name return package
218 ******************************************************************************/
222 ACPI_PARSE_OBJECT *ParentOp,
223 const ACPI_PREDEFINED_INFO *Predefined)
225 ACPI_PARSE_OBJECT *Op;
226 const ACPI_PREDEFINED_INFO *Package;
228 UINT32 ExpectedCount;
233 /* The package info for this name is in the next table entry */
235 Package = Predefined + 1;
237 /* First child is the package length */
239 Op = ParentOp->Asl.Child;
240 Count = (UINT32) Op->Asl.Value.Integer;
243 * Many of the variable-length top-level packages are allowed to simply
244 * have zero elements. This allows the BIOS to tell the host that even
245 * though the predefined name/method exists, the feature is not supported.
246 * Other package types require one or more elements. In any case, there
247 * is no need to continue validation.
251 switch (Package->RetInfo.Type)
253 case ACPI_PTYPE1_FIXED:
254 case ACPI_PTYPE1_OPTION:
255 case ACPI_PTYPE2_PKG_COUNT:
256 case ACPI_PTYPE2_REV_FIXED:
258 ApZeroLengthPackage (Predefined->Info.Name, ParentOp);
261 case ACPI_PTYPE1_VAR:
263 case ACPI_PTYPE2_COUNT:
264 case ACPI_PTYPE2_FIXED:
265 case ACPI_PTYPE2_MIN:
266 case ACPI_PTYPE2_FIX_VAR:
267 case ACPI_PTYPE2_VAR_VAR:
276 /* Get the first element of the package */
280 /* Decode the package type */
282 switch (Package->RetInfo.Type)
284 case ACPI_PTYPE_CUSTOM:
286 ApCustomPackage (ParentOp, Predefined);
289 case ACPI_PTYPE1_FIXED:
291 * The package count is fixed and there are no subpackages
293 * If package is too small, exit.
294 * If package is larger than expected, issue warning but continue
296 ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
297 if (Count < ExpectedCount)
299 goto PackageTooSmall;
301 else if (Count > ExpectedCount)
303 ApPackageTooLarge (Predefined->Info.Name, ParentOp,
304 Count, ExpectedCount);
307 /* Validate all elements of the package */
309 ApCheckPackageElements (Predefined->Info.Name, Op,
310 Package->RetInfo.ObjectType1, Package->RetInfo.Count1,
311 Package->RetInfo.ObjectType2, Package->RetInfo.Count2);
314 case ACPI_PTYPE1_VAR:
316 * The package count is variable, there are no subpackages,
317 * and all elements must be of the same type
319 for (i = 0; i < Count; i++)
324 * If we get to this point, it means that the package length
325 * is larger than the initializer list. Stop processing the
326 * package and return because we have run out of package
327 * elements to analyze.
332 ApCheckObjectType (Predefined->Info.Name, Op,
333 Package->RetInfo.ObjectType1, i);
338 case ACPI_PTYPE1_OPTION:
340 * The package count is variable, there are no subpackages.
341 * There are a fixed number of required elements, and a variable
342 * number of optional elements.
344 * Check if package is at least as large as the minimum required
346 ExpectedCount = Package->RetInfo3.Count;
347 if (Count < ExpectedCount)
349 goto PackageTooSmall;
352 /* Variable number of sub-objects */
354 for (i = 0; i < Count; i++)
356 if (i < Package->RetInfo3.Count)
358 /* These are the required package elements (0, 1, or 2) */
360 ApCheckObjectType (Predefined->Info.Name, Op,
361 Package->RetInfo3.ObjectType[i], i);
365 /* These are the optional package elements */
367 ApCheckObjectType (Predefined->Info.Name, Op,
368 Package->RetInfo3.TailObjectType, i);
375 case ACPI_PTYPE2_REV_FIXED:
377 /* First element is the (Integer) revision */
379 ApCheckObjectType (Predefined->Info.Name, Op,
380 ACPI_RTYPE_INTEGER, 0);
385 /* Examine the subpackages */
387 ApCheckPackageList (Predefined->Info.Name, Op,
391 case ACPI_PTYPE2_PKG_COUNT:
393 /* First element is the (Integer) count of subpackages to follow */
395 Status = ApCheckObjectType (Predefined->Info.Name, Op,
396 ACPI_RTYPE_INTEGER, 0);
398 /* We must have an integer count from above (otherwise, use Count) */
400 if (ACPI_SUCCESS (Status))
403 * Count cannot be larger than the parent package length, but
404 * allow it to be smaller. The >= accounts for the Integer above.
406 ExpectedCount = (UINT32) Op->Asl.Value.Integer;
407 if (ExpectedCount >= Count)
409 goto PackageTooSmall;
412 Count = ExpectedCount;
417 /* Examine the subpackages */
419 ApCheckPackageList (Predefined->Info.Name, Op,
423 case ACPI_PTYPE2_UUID_PAIR:
425 /* The package contains a variable list of UUID Buffer/Package pairs */
427 /* The length of the package must be even */
431 sprintf (AslGbl_MsgBuffer, "%4.4s: Package length, %d, must be even.",
432 Predefined->Info.Name, Count);
434 AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH,
435 ParentOp->Asl.Child, AslGbl_MsgBuffer);
438 /* Validate the alternating types */
440 for (i = 0; i < Count; ++i)
444 ApCheckObjectType (Predefined->Info.Name, Op,
445 Package->RetInfo.ObjectType2, i);
449 ApCheckObjectType (Predefined->Info.Name, Op,
450 Package->RetInfo.ObjectType1, i);
458 case ACPI_PTYPE2_VAR_VAR:
460 /* Check for minimum size (ints at beginning + 1 subpackage) */
462 ExpectedCount = Package->RetInfo4.Count1 + 1;
463 if (Count < ExpectedCount)
465 goto PackageTooSmall;
468 /* Check the non-package elements at beginning of main package */
470 for (i = 0; i < Package->RetInfo4.Count1; ++i)
472 ApCheckObjectType (Predefined->Info.Name, Op,
473 Package->RetInfo4.ObjectType1, i);
477 /* Examine the variable-length list of subpackages */
479 ApCheckPackageList (Predefined->Info.Name, Op,
480 Package, Package->RetInfo4.Count1, Count);
485 case ACPI_PTYPE2_FIXED:
486 case ACPI_PTYPE2_MIN:
487 case ACPI_PTYPE2_COUNT:
488 case ACPI_PTYPE2_FIX_VAR:
490 * These types all return a single Package that consists of a
491 * variable number of subpackages.
494 /* Examine the subpackages */
496 ApCheckPackageList (Predefined->Info.Name, Op,
507 ApPackageTooSmall (Predefined->Info.Name, ParentOp,
508 Count, ExpectedCount);
512 /*******************************************************************************
514 * FUNCTION: ApCustomPackage
516 * PARAMETERS: ParentOp - Parse op for the package
517 * Predefined - Pointer to package-specific info for
522 * DESCRIPTION: Validate packages that don't fit into the standard model and
523 * require custom code.
525 * NOTE: Currently used for the _BIX method only. When needed for two or more
526 * methods, probably a detect/dispatch mechanism will be required.
528 ******************************************************************************/
532 ACPI_PARSE_OBJECT *ParentOp,
533 const ACPI_PREDEFINED_INFO *Predefined)
535 ACPI_PARSE_OBJECT *Op;
537 UINT32 ExpectedCount;
541 /* First child is the package length */
543 Op = ParentOp->Asl.Child;
544 Count = (UINT32) Op->Asl.Value.Integer;
546 /* Get the version number, must be Integer */
549 Version = (UINT32) Op->Asl.Value.Integer;
550 if (Op->Asl.ParseOpcode != PARSEOP_INTEGER)
552 AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, AslGbl_MsgBuffer);
556 /* Validate count (# of elements) */
558 ExpectedCount = 21; /* Version 1 */
561 ExpectedCount = 20; /* Version 0 */
564 if (Count < ExpectedCount)
566 ApPackageTooSmall (Predefined->Info.Name, ParentOp,
567 Count, ExpectedCount);
570 else if (Count > ExpectedCount)
572 ApPackageTooLarge (Predefined->Info.Name, ParentOp,
573 Count, ExpectedCount);
576 /* Validate all elements of the package */
578 Op = ApCheckPackageElements (Predefined->Info.Name, Op,
579 ACPI_RTYPE_INTEGER, 16,
580 ACPI_RTYPE_STRING, 4);
582 /* Version 1 has a single trailing integer */
586 ApCheckPackageElements (Predefined->Info.Name, Op,
587 ACPI_RTYPE_INTEGER, 1, 0, 0);
592 /*******************************************************************************
594 * FUNCTION: ApCheckPackageElements
596 * PARAMETERS: PredefinedName - Name of the predefined object
597 * Op - Parser op for the package
598 * Type1 - Object type for first group
599 * Count1 - Count for first group
600 * Type2 - Object type for second group
601 * Count2 - Count for second group
603 * RETURN: Next Op peer in the parse tree, after all specified elements
604 * have been validated. Used for multiple validations (calls
607 * DESCRIPTION: Validate all elements of a package. Works with packages that
608 * are defined to contain up to two groups of different object
611 ******************************************************************************/
613 static ACPI_PARSE_OBJECT *
614 ApCheckPackageElements (
615 const char *PredefinedName,
616 ACPI_PARSE_OBJECT *Op,
626 * Up to two groups of package elements are supported by the data
627 * structure. All elements in each group must be of the same type.
628 * The second group can have a count of zero.
630 * Aborts check upon a NULL package element, as this means (at compile
631 * time) that the remainder of the package elements are also NULL
632 * (This is the only way to create NULL package elements.)
634 for (i = 0; (i < Count1) && Op; i++)
636 ApCheckObjectType (PredefinedName, Op, Type1, i);
640 for (i = 0; (i < Count2) && Op; i++)
642 ApCheckObjectType (PredefinedName, Op, Type2, (i + Count1));
650 /*******************************************************************************
652 * FUNCTION: ApCheckPackageList
654 * PARAMETERS: PredefinedName - Name of the predefined object
655 * ParentOp - Parser op of the parent package
656 * Package - Package info for this predefined name
657 * StartIndex - Index in parent package where list begins
658 * ParentCount - Element count of parent package
662 * DESCRIPTION: Validate the individual package elements for a predefined name.
663 * Handles the cases where the predefined name is defined as a
664 * Package of Packages (subpackages). These are the types:
670 * ACPI_PTYPE2_FIX_VAR
671 * ACPI_PTYPE2_VAR_VAR
673 ******************************************************************************/
677 const char *PredefinedName,
678 ACPI_PARSE_OBJECT *ParentOp,
679 const ACPI_PREDEFINED_INFO *Package,
683 ACPI_PARSE_OBJECT *SubPackageOp = ParentOp;
684 ACPI_PARSE_OBJECT *Op;
687 UINT32 ExpectedCount;
693 * Validate each subpackage in the parent Package
695 * Note: We ignore NULL package elements on the assumption that
696 * they will be initialized by the BIOS or other ASL code.
698 for (i = 0; (i < ParentCount) && SubPackageOp; i++)
700 /* Each object in the list must be of type Package */
702 Status = ApCheckObjectType (PredefinedName, SubPackageOp,
703 ACPI_RTYPE_PACKAGE, i + StartIndex);
704 if (ACPI_FAILURE (Status))
709 /* Examine the different types of expected subpackages */
711 Op = SubPackageOp->Asl.Child;
713 /* First child is the package length */
715 Count = (UINT32) Op->Asl.Value.Integer;
719 * Most subpackage must have at least one element, with
720 * only rare exceptions. (_RDI)
723 (Package->RetInfo.Type != ACPI_PTYPE2_VAR_VAR))
725 ApZeroLengthPackage (PredefinedName, SubPackageOp);
730 * Decode the package type.
731 * PTYPE2 indicates that a "package of packages" is expected for
732 * this name. The various flavors of PTYPE2 indicate the number
733 * and format of the subpackages.
735 switch (Package->RetInfo.Type)
738 case ACPI_PTYPE2_PKG_COUNT:
739 case ACPI_PTYPE2_REV_FIXED:
741 /* Each subpackage has a fixed number of elements */
743 ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
744 if (Count < ExpectedCount)
746 ApPackageTooSmall (PredefinedName, SubPackageOp,
747 Count, ExpectedCount);
750 if (Count > ExpectedCount)
752 ApPackageTooLarge (PredefinedName, SubPackageOp,
753 Count, ExpectedCount);
757 ApCheckPackageElements (PredefinedName, Op,
758 Package->RetInfo.ObjectType1, Package->RetInfo.Count1,
759 Package->RetInfo.ObjectType2, Package->RetInfo.Count2);
762 case ACPI_PTYPE2_FIX_VAR:
764 * Each subpackage has a fixed number of elements and an
767 ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
768 if (Count < ExpectedCount)
770 ApPackageTooSmall (PredefinedName, SubPackageOp,
771 Count, ExpectedCount);
775 ApCheckPackageElements (PredefinedName, Op,
776 Package->RetInfo.ObjectType1, Package->RetInfo.Count1,
777 Package->RetInfo.ObjectType2,
778 Count - Package->RetInfo.Count1);
781 case ACPI_PTYPE2_VAR_VAR:
783 * Must have at least the minimum number elements.
784 * A zero PkgCount means the number of elements is variable.
786 ExpectedCount = Package->RetInfo4.PkgCount;
787 if (ExpectedCount && (Count < ExpectedCount))
789 ApPackageTooSmall (PredefinedName, SubPackageOp,
794 ApCheckPackageElements (PredefinedName, Op,
795 Package->RetInfo4.SubObjectTypes,
796 Package->RetInfo4.PkgCount,
800 case ACPI_PTYPE2_FIXED:
802 /* Each subpackage has a fixed length */
804 ExpectedCount = Package->RetInfo2.Count;
805 if (Count < ExpectedCount)
807 ApPackageTooSmall (PredefinedName, SubPackageOp,
808 Count, ExpectedCount);
811 if (Count > ExpectedCount)
813 ApPackageTooLarge (PredefinedName, SubPackageOp,
814 Count, ExpectedCount);
818 /* Check each object/type combination */
820 for (j = 0; j < ExpectedCount; j++)
822 ApCheckObjectType (PredefinedName, Op,
823 Package->RetInfo2.ObjectType[j], j);
829 case ACPI_PTYPE2_MIN:
831 /* Each subpackage has a variable but minimum length */
833 ExpectedCount = Package->RetInfo.Count1;
834 if (Count < ExpectedCount)
836 ApPackageTooSmall (PredefinedName, SubPackageOp,
837 Count, ExpectedCount);
841 /* Check the type of each subpackage element */
843 ApCheckPackageElements (PredefinedName, Op,
844 Package->RetInfo.ObjectType1, Count, 0, 0);
847 case ACPI_PTYPE2_COUNT:
849 * First element is the (Integer) count of elements, including
850 * the count field (the ACPI name is NumElements)
852 Status = ApCheckObjectType (PredefinedName, Op,
853 ACPI_RTYPE_INTEGER, 0);
855 /* We must have an integer count from above (otherwise, use Count) */
857 if (ACPI_SUCCESS (Status))
860 * Make sure package is large enough for the Count and is
861 * is as large as the minimum size
863 ExpectedCount = (UINT32) Op->Asl.Value.Integer;
865 if (Count < ExpectedCount)
867 ApPackageTooSmall (PredefinedName, SubPackageOp,
868 Count, ExpectedCount);
871 else if (Count > ExpectedCount)
873 ApPackageTooLarge (PredefinedName, SubPackageOp,
874 Count, ExpectedCount);
877 /* Some names of this type have a minimum length */
879 if (Count < Package->RetInfo.Count1)
881 ExpectedCount = Package->RetInfo.Count1;
882 ApPackageTooSmall (PredefinedName, SubPackageOp,
883 Count, ExpectedCount);
887 Count = ExpectedCount;
890 /* Check the type of each subpackage element */
893 ApCheckPackageElements (PredefinedName, Op,
894 Package->RetInfo.ObjectType1, (Count - 1), 0, 0);
902 SubPackageOp = SubPackageOp->Asl.Next;
907 /*******************************************************************************
909 * FUNCTION: ApPackageTooSmall
911 * PARAMETERS: PredefinedName - Name of the predefined object
912 * Op - Current parser op
913 * Count - Actual package element count
914 * ExpectedCount - Expected package element count
918 * DESCRIPTION: Issue error message for a package that is smaller than
921 ******************************************************************************/
925 const char *PredefinedName,
926 ACPI_PARSE_OBJECT *Op,
928 UINT32 ExpectedCount)
931 sprintf (AslGbl_MsgBuffer, "%4.4s: length %u, required minimum is %u",
932 PredefinedName, Count, ExpectedCount);
934 AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, AslGbl_MsgBuffer);
938 /*******************************************************************************
940 * FUNCTION: ApZeroLengthPackage
942 * PARAMETERS: PredefinedName - Name of the predefined object
943 * Op - Current parser op
947 * DESCRIPTION: Issue error message for a zero-length package (a package that
948 * is required to have a non-zero length). Variable length
949 * packages seem to be allowed to have zero length, however.
950 * Even if not allowed, BIOS code does it.
952 ******************************************************************************/
955 ApZeroLengthPackage (
956 const char *PredefinedName,
957 ACPI_PARSE_OBJECT *Op)
960 sprintf (AslGbl_MsgBuffer, "%4.4s: length is zero", PredefinedName);
962 AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, AslGbl_MsgBuffer);
966 /*******************************************************************************
968 * FUNCTION: ApPackageTooLarge
970 * PARAMETERS: PredefinedName - Name of the predefined object
971 * Op - Current parser op
972 * Count - Actual package element count
973 * ExpectedCount - Expected package element count
977 * DESCRIPTION: Issue a remark for a package that is larger than expected.
979 ******************************************************************************/
983 const char *PredefinedName,
984 ACPI_PARSE_OBJECT *Op,
986 UINT32 ExpectedCount)
989 sprintf (AslGbl_MsgBuffer, "%4.4s: length is %u, only %u required",
990 PredefinedName, Count, ExpectedCount);
992 AslError (ASL_REMARK, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, AslGbl_MsgBuffer);