[ACPICA]
[reactos.git] / reactos / drivers / bus / acpi / acpica / namespace / nsprepkg.c
1 /******************************************************************************
2 *
3 * Module Name: nsprepkg - Validation of package objects for predefined names
4 *
5 *****************************************************************************/
6
7 /******************************************************************************
8 *
9 * 1. Copyright Notice
10 *
11 * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp.
12 * All rights reserved.
13 *
14 * 2. License
15 *
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
19 * property rights.
20 *
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
27 *
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;
36 *
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
39 *
40 * 3. Conditions
41 *
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.
53 *
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
64 * make.
65 *
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
70 * distribution.
71 *
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
74 *
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.
79 *
80 * 4. Disclaimer and Export Compliance
81 *
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
88 * PARTICULAR PURPOSE.
89 *
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
97 * LIMITED REMEDY.
98 *
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.
113 *
114 *****************************************************************************/
115
116 #include "acpi.h"
117 #include "accommon.h"
118 #include "acnamesp.h"
119 #include "acpredef.h"
120
121
122 #define _COMPONENT ACPI_NAMESPACE
123 ACPI_MODULE_NAME ("nsprepkg")
124
125
126 /* Local prototypes */
127
128 static ACPI_STATUS
129 AcpiNsCheckPackageList (
130 ACPI_EVALUATE_INFO *Info,
131 const ACPI_PREDEFINED_INFO *Package,
132 ACPI_OPERAND_OBJECT **Elements,
133 UINT32 Count);
134
135 static ACPI_STATUS
136 AcpiNsCheckPackageElements (
137 ACPI_EVALUATE_INFO *Info,
138 ACPI_OPERAND_OBJECT **Elements,
139 UINT8 Type1,
140 UINT32 Count1,
141 UINT8 Type2,
142 UINT32 Count2,
143 UINT32 StartIndex);
144
145
146 /*******************************************************************************
147 *
148 * FUNCTION: AcpiNsCheckPackage
149 *
150 * PARAMETERS: Info - Method execution information block
151 * ReturnObjectPtr - Pointer to the object returned from the
152 * evaluation of a method or object
153 *
154 * RETURN: Status
155 *
156 * DESCRIPTION: Check a returned package object for the correct count and
157 * correct type of all sub-objects.
158 *
159 ******************************************************************************/
160
161 ACPI_STATUS
162 AcpiNsCheckPackage (
163 ACPI_EVALUATE_INFO *Info,
164 ACPI_OPERAND_OBJECT **ReturnObjectPtr)
165 {
166 ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
167 const ACPI_PREDEFINED_INFO *Package;
168 ACPI_OPERAND_OBJECT **Elements;
169 ACPI_STATUS Status = AE_OK;
170 UINT32 ExpectedCount;
171 UINT32 Count;
172 UINT32 i;
173
174
175 ACPI_FUNCTION_NAME (NsCheckPackage);
176
177
178 /* The package info for this name is in the next table entry */
179
180 Package = Info->Predefined + 1;
181
182 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
183 "%s Validating return Package of Type %X, Count %X\n",
184 Info->FullPathname, Package->RetInfo.Type,
185 ReturnObject->Package.Count));
186
187 /*
188 * For variable-length Packages, we can safely remove all embedded
189 * and trailing NULL package elements
190 */
191 AcpiNsRemoveNullElements (Info, Package->RetInfo.Type, ReturnObject);
192
193 /* Extract package count and elements array */
194
195 Elements = ReturnObject->Package.Elements;
196 Count = ReturnObject->Package.Count;
197
198 /*
199 * Most packages must have at least one element. The only exception
200 * is the variable-length package (ACPI_PTYPE1_VAR).
201 */
202 if (!Count)
203 {
204 if (Package->RetInfo.Type == ACPI_PTYPE1_VAR)
205 {
206 return (AE_OK);
207 }
208
209 ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
210 "Return Package has no elements (empty)"));
211
212 return (AE_AML_OPERAND_VALUE);
213 }
214
215 /*
216 * Decode the type of the expected package contents
217 *
218 * PTYPE1 packages contain no subpackages
219 * PTYPE2 packages contain subpackages
220 */
221 switch (Package->RetInfo.Type)
222 {
223 case ACPI_PTYPE1_FIXED:
224 /*
225 * The package count is fixed and there are no subpackages
226 *
227 * If package is too small, exit.
228 * If package is larger than expected, issue warning but continue
229 */
230 ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
231 if (Count < ExpectedCount)
232 {
233 goto PackageTooSmall;
234 }
235 else if (Count > ExpectedCount)
236 {
237 ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
238 "%s: Return Package is larger than needed - "
239 "found %u, expected %u\n",
240 Info->FullPathname, Count, ExpectedCount));
241 }
242
243 /* Validate all elements of the returned package */
244
245 Status = AcpiNsCheckPackageElements (Info, Elements,
246 Package->RetInfo.ObjectType1, Package->RetInfo.Count1,
247 Package->RetInfo.ObjectType2, Package->RetInfo.Count2, 0);
248 break;
249
250 case ACPI_PTYPE1_VAR:
251 /*
252 * The package count is variable, there are no subpackages, and all
253 * elements must be of the same type
254 */
255 for (i = 0; i < Count; i++)
256 {
257 Status = AcpiNsCheckObjectType (Info, Elements,
258 Package->RetInfo.ObjectType1, i);
259 if (ACPI_FAILURE (Status))
260 {
261 return (Status);
262 }
263 Elements++;
264 }
265 break;
266
267 case ACPI_PTYPE1_OPTION:
268 /*
269 * The package count is variable, there are no subpackages. There are
270 * a fixed number of required elements, and a variable number of
271 * optional elements.
272 *
273 * Check if package is at least as large as the minimum required
274 */
275 ExpectedCount = Package->RetInfo3.Count;
276 if (Count < ExpectedCount)
277 {
278 goto PackageTooSmall;
279 }
280
281 /* Variable number of sub-objects */
282
283 for (i = 0; i < Count; i++)
284 {
285 if (i < Package->RetInfo3.Count)
286 {
287 /* These are the required package elements (0, 1, or 2) */
288
289 Status = AcpiNsCheckObjectType (Info, Elements,
290 Package->RetInfo3.ObjectType[i], i);
291 if (ACPI_FAILURE (Status))
292 {
293 return (Status);
294 }
295 }
296 else
297 {
298 /* These are the optional package elements */
299
300 Status = AcpiNsCheckObjectType (Info, Elements,
301 Package->RetInfo3.TailObjectType, i);
302 if (ACPI_FAILURE (Status))
303 {
304 return (Status);
305 }
306 }
307 Elements++;
308 }
309 break;
310
311 case ACPI_PTYPE2_REV_FIXED:
312
313 /* First element is the (Integer) revision */
314
315 Status = AcpiNsCheckObjectType (Info, Elements,
316 ACPI_RTYPE_INTEGER, 0);
317 if (ACPI_FAILURE (Status))
318 {
319 return (Status);
320 }
321
322 Elements++;
323 Count--;
324
325 /* Examine the subpackages */
326
327 Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);
328 break;
329
330 case ACPI_PTYPE2_PKG_COUNT:
331
332 /* First element is the (Integer) count of subpackages to follow */
333
334 Status = AcpiNsCheckObjectType (Info, Elements,
335 ACPI_RTYPE_INTEGER, 0);
336 if (ACPI_FAILURE (Status))
337 {
338 return (Status);
339 }
340
341 /*
342 * Count cannot be larger than the parent package length, but allow it
343 * to be smaller. The >= accounts for the Integer above.
344 */
345 ExpectedCount = (UINT32) (*Elements)->Integer.Value;
346 if (ExpectedCount >= Count)
347 {
348 goto PackageTooSmall;
349 }
350
351 Count = ExpectedCount;
352 Elements++;
353
354 /* Examine the subpackages */
355
356 Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);
357 break;
358
359 case ACPI_PTYPE2:
360 case ACPI_PTYPE2_FIXED:
361 case ACPI_PTYPE2_MIN:
362 case ACPI_PTYPE2_COUNT:
363 case ACPI_PTYPE2_FIX_VAR:
364 /*
365 * These types all return a single Package that consists of a
366 * variable number of subpackages.
367 *
368 * First, ensure that the first element is a subpackage. If not,
369 * the BIOS may have incorrectly returned the object as a single
370 * package instead of a Package of Packages (a common error if
371 * there is only one entry). We may be able to repair this by
372 * wrapping the returned Package with a new outer Package.
373 */
374 if (*Elements && ((*Elements)->Common.Type != ACPI_TYPE_PACKAGE))
375 {
376 /* Create the new outer package and populate it */
377
378 Status = AcpiNsWrapWithPackage (Info, ReturnObject, ReturnObjectPtr);
379 if (ACPI_FAILURE (Status))
380 {
381 return (Status);
382 }
383
384 /* Update locals to point to the new package (of 1 element) */
385
386 ReturnObject = *ReturnObjectPtr;
387 Elements = ReturnObject->Package.Elements;
388 Count = 1;
389 }
390
391 /* Examine the subpackages */
392
393 Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);
394 break;
395
396 case ACPI_PTYPE2_UUID_PAIR:
397
398 /* The package must contain pairs of (UUID + type) */
399
400 if (Count & 1)
401 {
402 ExpectedCount = Count + 1;
403 goto PackageTooSmall;
404 }
405
406 while (Count > 0)
407 {
408 Status = AcpiNsCheckObjectType(Info, Elements,
409 Package->RetInfo.ObjectType1, 0);
410 if (ACPI_FAILURE(Status))
411 {
412 return (Status);
413 }
414
415 /* Validate length of the UUID buffer */
416
417 if ((*Elements)->Buffer.Length != 16)
418 {
419 ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,
420 Info->NodeFlags, "Invalid length for UUID Buffer"));
421 return (AE_AML_OPERAND_VALUE);
422 }
423
424 Status = AcpiNsCheckObjectType(Info, Elements + 1,
425 Package->RetInfo.ObjectType2, 0);
426 if (ACPI_FAILURE(Status))
427 {
428 return (Status);
429 }
430
431 Elements += 2;
432 Count -= 2;
433 }
434 break;
435
436 default:
437
438 /* Should not get here if predefined info table is correct */
439
440 ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
441 "Invalid internal return type in table entry: %X",
442 Package->RetInfo.Type));
443
444 return (AE_AML_INTERNAL);
445 }
446
447 return (Status);
448
449
450 PackageTooSmall:
451
452 /* Error exit for the case with an incorrect package count */
453
454 ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
455 "Return Package is too small - found %u elements, expected %u",
456 Count, ExpectedCount));
457
458 return (AE_AML_OPERAND_VALUE);
459 }
460
461
462 /*******************************************************************************
463 *
464 * FUNCTION: AcpiNsCheckPackageList
465 *
466 * PARAMETERS: Info - Method execution information block
467 * Package - Pointer to package-specific info for method
468 * Elements - Element list of parent package. All elements
469 * of this list should be of type Package.
470 * Count - Count of subpackages
471 *
472 * RETURN: Status
473 *
474 * DESCRIPTION: Examine a list of subpackages
475 *
476 ******************************************************************************/
477
478 static ACPI_STATUS
479 AcpiNsCheckPackageList (
480 ACPI_EVALUATE_INFO *Info,
481 const ACPI_PREDEFINED_INFO *Package,
482 ACPI_OPERAND_OBJECT **Elements,
483 UINT32 Count)
484 {
485 ACPI_OPERAND_OBJECT *SubPackage;
486 ACPI_OPERAND_OBJECT **SubElements;
487 ACPI_STATUS Status;
488 UINT32 ExpectedCount;
489 UINT32 i;
490 UINT32 j;
491
492
493 /*
494 * Validate each subpackage in the parent Package
495 *
496 * NOTE: assumes list of subpackages contains no NULL elements.
497 * Any NULL elements should have been removed by earlier call
498 * to AcpiNsRemoveNullElements.
499 */
500 for (i = 0; i < Count; i++)
501 {
502 SubPackage = *Elements;
503 SubElements = SubPackage->Package.Elements;
504 Info->ParentPackage = SubPackage;
505
506 /* Each sub-object must be of type Package */
507
508 Status = AcpiNsCheckObjectType (Info, &SubPackage,
509 ACPI_RTYPE_PACKAGE, i);
510 if (ACPI_FAILURE (Status))
511 {
512 return (Status);
513 }
514
515 /* Examine the different types of expected subpackages */
516
517 Info->ParentPackage = SubPackage;
518 switch (Package->RetInfo.Type)
519 {
520 case ACPI_PTYPE2:
521 case ACPI_PTYPE2_PKG_COUNT:
522 case ACPI_PTYPE2_REV_FIXED:
523
524 /* Each subpackage has a fixed number of elements */
525
526 ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
527 if (SubPackage->Package.Count < ExpectedCount)
528 {
529 goto PackageTooSmall;
530 }
531
532 Status = AcpiNsCheckPackageElements (Info, SubElements,
533 Package->RetInfo.ObjectType1,
534 Package->RetInfo.Count1,
535 Package->RetInfo.ObjectType2,
536 Package->RetInfo.Count2, 0);
537 if (ACPI_FAILURE (Status))
538 {
539 return (Status);
540 }
541 break;
542
543 case ACPI_PTYPE2_FIX_VAR:
544 /*
545 * Each subpackage has a fixed number of elements and an
546 * optional element
547 */
548 ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
549 if (SubPackage->Package.Count < ExpectedCount)
550 {
551 goto PackageTooSmall;
552 }
553
554 Status = AcpiNsCheckPackageElements (Info, SubElements,
555 Package->RetInfo.ObjectType1,
556 Package->RetInfo.Count1,
557 Package->RetInfo.ObjectType2,
558 SubPackage->Package.Count - Package->RetInfo.Count1, 0);
559 if (ACPI_FAILURE (Status))
560 {
561 return (Status);
562 }
563 break;
564
565 case ACPI_PTYPE2_FIXED:
566
567 /* Each subpackage has a fixed length */
568
569 ExpectedCount = Package->RetInfo2.Count;
570 if (SubPackage->Package.Count < ExpectedCount)
571 {
572 goto PackageTooSmall;
573 }
574
575 /* Check the type of each subpackage element */
576
577 for (j = 0; j < ExpectedCount; j++)
578 {
579 Status = AcpiNsCheckObjectType (Info, &SubElements[j],
580 Package->RetInfo2.ObjectType[j], j);
581 if (ACPI_FAILURE (Status))
582 {
583 return (Status);
584 }
585 }
586 break;
587
588 case ACPI_PTYPE2_MIN:
589
590 /* Each subpackage has a variable but minimum length */
591
592 ExpectedCount = Package->RetInfo.Count1;
593 if (SubPackage->Package.Count < ExpectedCount)
594 {
595 goto PackageTooSmall;
596 }
597
598 /* Check the type of each subpackage element */
599
600 Status = AcpiNsCheckPackageElements (Info, SubElements,
601 Package->RetInfo.ObjectType1,
602 SubPackage->Package.Count, 0, 0, 0);
603 if (ACPI_FAILURE (Status))
604 {
605 return (Status);
606 }
607 break;
608
609 case ACPI_PTYPE2_COUNT:
610 /*
611 * First element is the (Integer) count of elements, including
612 * the count field (the ACPI name is NumElements)
613 */
614 Status = AcpiNsCheckObjectType (Info, SubElements,
615 ACPI_RTYPE_INTEGER, 0);
616 if (ACPI_FAILURE (Status))
617 {
618 return (Status);
619 }
620
621 /*
622 * Make sure package is large enough for the Count and is
623 * is as large as the minimum size
624 */
625 ExpectedCount = (UINT32) (*SubElements)->Integer.Value;
626 if (SubPackage->Package.Count < ExpectedCount)
627 {
628 goto PackageTooSmall;
629 }
630 if (SubPackage->Package.Count < Package->RetInfo.Count1)
631 {
632 ExpectedCount = Package->RetInfo.Count1;
633 goto PackageTooSmall;
634 }
635 if (ExpectedCount == 0)
636 {
637 /*
638 * Either the NumEntries element was originally zero or it was
639 * a NULL element and repaired to an Integer of value zero.
640 * In either case, repair it by setting NumEntries to be the
641 * actual size of the subpackage.
642 */
643 ExpectedCount = SubPackage->Package.Count;
644 (*SubElements)->Integer.Value = ExpectedCount;
645 }
646
647 /* Check the type of each subpackage element */
648
649 Status = AcpiNsCheckPackageElements (Info, (SubElements + 1),
650 Package->RetInfo.ObjectType1,
651 (ExpectedCount - 1), 0, 0, 1);
652 if (ACPI_FAILURE (Status))
653 {
654 return (Status);
655 }
656 break;
657
658 default: /* Should not get here, type was validated by caller */
659
660 return (AE_AML_INTERNAL);
661 }
662
663 Elements++;
664 }
665
666 return (AE_OK);
667
668
669 PackageTooSmall:
670
671 /* The subpackage count was smaller than required */
672
673 ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
674 "Return SubPackage[%u] is too small - found %u elements, expected %u",
675 i, SubPackage->Package.Count, ExpectedCount));
676
677 return (AE_AML_OPERAND_VALUE);
678 }
679
680
681 /*******************************************************************************
682 *
683 * FUNCTION: AcpiNsCheckPackageElements
684 *
685 * PARAMETERS: Info - Method execution information block
686 * Elements - Pointer to the package elements array
687 * Type1 - Object type for first group
688 * Count1 - Count for first group
689 * Type2 - Object type for second group
690 * Count2 - Count for second group
691 * StartIndex - Start of the first group of elements
692 *
693 * RETURN: Status
694 *
695 * DESCRIPTION: Check that all elements of a package are of the correct object
696 * type. Supports up to two groups of different object types.
697 *
698 ******************************************************************************/
699
700 static ACPI_STATUS
701 AcpiNsCheckPackageElements (
702 ACPI_EVALUATE_INFO *Info,
703 ACPI_OPERAND_OBJECT **Elements,
704 UINT8 Type1,
705 UINT32 Count1,
706 UINT8 Type2,
707 UINT32 Count2,
708 UINT32 StartIndex)
709 {
710 ACPI_OPERAND_OBJECT **ThisElement = Elements;
711 ACPI_STATUS Status;
712 UINT32 i;
713
714
715 /*
716 * Up to two groups of package elements are supported by the data
717 * structure. All elements in each group must be of the same type.
718 * The second group can have a count of zero.
719 */
720 for (i = 0; i < Count1; i++)
721 {
722 Status = AcpiNsCheckObjectType (Info, ThisElement,
723 Type1, i + StartIndex);
724 if (ACPI_FAILURE (Status))
725 {
726 return (Status);
727 }
728 ThisElement++;
729 }
730
731 for (i = 0; i < Count2; i++)
732 {
733 Status = AcpiNsCheckObjectType (Info, ThisElement,
734 Type2, (i + Count1 + StartIndex));
735 if (ACPI_FAILURE (Status))
736 {
737 return (Status);
738 }
739 ThisElement++;
740 }
741
742 return (AE_OK);
743 }