ReactOS  0.4.15-dev-5112-g22d8c0f
nsprepkg.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acpredef.h"
Include dependency graph for nsprepkg.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_NAMESPACE
 

Functions

static ACPI_STATUS AcpiNsCheckPackageList (ACPI_EVALUATE_INFO *Info, const ACPI_PREDEFINED_INFO *Package, ACPI_OPERAND_OBJECT **Elements, UINT32 Count)
 
static ACPI_STATUS AcpiNsCheckPackageElements (ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **Elements, UINT8 Type1, UINT32 Count1, UINT8 Type2, UINT32 Count2, UINT32 StartIndex)
 
static ACPI_STATUS AcpiNsCustomPackage (ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **Elements, UINT32 Count)
 
ACPI_STATUS AcpiNsCheckPackage (ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_NAMESPACE

Definition at line 50 of file nsprepkg.c.

Function Documentation

◆ AcpiNsCheckPackage()

ACPI_STATUS AcpiNsCheckPackage ( ACPI_EVALUATE_INFO Info,
ACPI_OPERAND_OBJECT **  ReturnObjectPtr 
)

Definition at line 96 of file nsprepkg.c.

99 {
100  ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
102  ACPI_OPERAND_OBJECT **Elements;
104  UINT32 ExpectedCount;
105  UINT32 Count;
106  UINT32 i;
107 
108 
109  ACPI_FUNCTION_TRACE (NsCheckPackage);
110 
111 
112  /* The package info for this name is in the next table entry */
113 
114  Package = Info->Predefined + 1;
115 
117  "%s Validating return Package of Type %X, Count %X\n",
118  Info->FullPathname, Package->RetInfo.Type,
119  ReturnObject->Package.Count));
120 
121  /*
122  * For variable-length Packages, we can safely remove all embedded
123  * and trailing NULL package elements
124  */
125  AcpiNsRemoveNullElements (Info, Package->RetInfo.Type, ReturnObject);
126 
127  /* Extract package count and elements array */
128 
129  Elements = ReturnObject->Package.Elements;
130  Count = ReturnObject->Package.Count;
131 
132  /*
133  * Most packages must have at least one element. The only exception
134  * is the variable-length package (ACPI_PTYPE1_VAR).
135  */
136  if (!Count)
137  {
138  if (Package->RetInfo.Type == ACPI_PTYPE1_VAR)
139  {
141  }
142 
143  ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
144  "Return Package has no elements (empty)"));
145 
147  }
148 
149  /*
150  * Decode the type of the expected package contents
151  *
152  * PTYPE1 packages contain no subpackages
153  * PTYPE2 packages contain subpackages
154  */
155  switch (Package->RetInfo.Type)
156  {
157  case ACPI_PTYPE_CUSTOM:
158 
159  Status = AcpiNsCustomPackage (Info, Elements, Count);
160  break;
161 
162  case ACPI_PTYPE1_FIXED:
163  /*
164  * The package count is fixed and there are no subpackages
165  *
166  * If package is too small, exit.
167  * If package is larger than expected, issue warning but continue
168  */
169  ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
170  if (Count < ExpectedCount)
171  {
172  goto PackageTooSmall;
173  }
174  else if (Count > ExpectedCount)
175  {
177  "%s: Return Package is larger than needed - "
178  "found %u, expected %u\n",
179  Info->FullPathname, Count, ExpectedCount));
180  }
181 
182  /* Validate all elements of the returned package */
183 
185  Package->RetInfo.ObjectType1, Package->RetInfo.Count1,
186  Package->RetInfo.ObjectType2, Package->RetInfo.Count2, 0);
187  break;
188 
189  case ACPI_PTYPE1_VAR:
190  /*
191  * The package count is variable, there are no subpackages, and all
192  * elements must be of the same type
193  */
194  for (i = 0; i < Count; i++)
195  {
196  Status = AcpiNsCheckObjectType (Info, Elements,
197  Package->RetInfo.ObjectType1, i);
198  if (ACPI_FAILURE (Status))
199  {
201  }
202 
203  Elements++;
204  }
205  break;
206 
207  case ACPI_PTYPE1_OPTION:
208  /*
209  * The package count is variable, there are no subpackages. There are
210  * a fixed number of required elements, and a variable number of
211  * optional elements.
212  *
213  * Check if package is at least as large as the minimum required
214  */
215  ExpectedCount = Package->RetInfo3.Count;
216  if (Count < ExpectedCount)
217  {
218  goto PackageTooSmall;
219  }
220 
221  /* Variable number of sub-objects */
222 
223  for (i = 0; i < Count; i++)
224  {
225  if (i < Package->RetInfo3.Count)
226  {
227  /* These are the required package elements (0, 1, or 2) */
228 
229  Status = AcpiNsCheckObjectType (Info, Elements,
230  Package->RetInfo3.ObjectType[i], i);
231  if (ACPI_FAILURE (Status))
232  {
234  }
235  }
236  else
237  {
238  /* These are the optional package elements */
239 
240  Status = AcpiNsCheckObjectType (Info, Elements,
241  Package->RetInfo3.TailObjectType, i);
242  if (ACPI_FAILURE (Status))
243  {
245  }
246  }
247 
248  Elements++;
249  }
250  break;
251 
253 
254  /* First element is the (Integer) revision */
255 
257  Info, Elements, ACPI_RTYPE_INTEGER, 0);
258  if (ACPI_FAILURE (Status))
259  {
261  }
262 
263  Elements++;
264  Count--;
265 
266  /* Examine the subpackages */
267 
269  break;
270 
272 
273  /* First element is the (Integer) count of subpackages to follow */
274 
276  Info, Elements, ACPI_RTYPE_INTEGER, 0);
277  if (ACPI_FAILURE (Status))
278  {
280  }
281 
282  /*
283  * Count cannot be larger than the parent package length, but allow it
284  * to be smaller. The >= accounts for the Integer above.
285  */
286  ExpectedCount = (UINT32) (*Elements)->Integer.Value;
287  if (ExpectedCount >= Count)
288  {
289  goto PackageTooSmall;
290  }
291 
292  Count = ExpectedCount;
293  Elements++;
294 
295  /* Examine the subpackages */
296 
298  break;
299 
300  case ACPI_PTYPE2:
301  case ACPI_PTYPE2_FIXED:
302  case ACPI_PTYPE2_MIN:
303  case ACPI_PTYPE2_COUNT:
304  case ACPI_PTYPE2_FIX_VAR:
305  /*
306  * These types all return a single Package that consists of a
307  * variable number of subpackages.
308  *
309  * First, ensure that the first element is a subpackage. If not,
310  * the BIOS may have incorrectly returned the object as a single
311  * package instead of a Package of Packages (a common error if
312  * there is only one entry). We may be able to repair this by
313  * wrapping the returned Package with a new outer Package.
314  */
315  if (*Elements && ((*Elements)->Common.Type != ACPI_TYPE_PACKAGE))
316  {
317  /* Create the new outer package and populate it */
318 
320  Info, ReturnObject, ReturnObjectPtr);
321  if (ACPI_FAILURE (Status))
322  {
324  }
325 
326  /* Update locals to point to the new package (of 1 element) */
327 
328  ReturnObject = *ReturnObjectPtr;
329  Elements = ReturnObject->Package.Elements;
330  Count = 1;
331  }
332 
333  /* Examine the subpackages */
334 
336  break;
337 
338  case ACPI_PTYPE2_VAR_VAR:
339  /*
340  * Returns a variable list of packages, each with a variable list
341  * of objects.
342  */
343  break;
344 
346 
347  /* The package must contain pairs of (UUID + type) */
348 
349  if (Count & 1)
350  {
351  ExpectedCount = Count + 1;
352  goto PackageTooSmall;
353  }
354 
355  while (Count > 0)
356  {
357  Status = AcpiNsCheckObjectType(Info, Elements,
358  Package->RetInfo.ObjectType1, 0);
359  if (ACPI_FAILURE(Status))
360  {
362  }
363 
364  /* Validate length of the UUID buffer */
365 
366  if ((*Elements)->Buffer.Length != 16)
367  {
368  ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,
369  Info->NodeFlags, "Invalid length for UUID Buffer"));
371  }
372 
373  Status = AcpiNsCheckObjectType(Info, Elements + 1,
374  Package->RetInfo.ObjectType2, 0);
375  if (ACPI_FAILURE(Status))
376  {
378  }
379 
380  Elements += 2;
381  Count -= 2;
382  }
383  break;
384 
385  default:
386 
387  /* Should not get here if predefined info table is correct */
388 
389  ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
390  "Invalid internal return type in table entry: %X",
391  Package->RetInfo.Type));
392 
394  }
395 
397 
398 
399 PackageTooSmall:
400 
401  /* Error exit for the case with an incorrect package count */
402 
403  ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
404  "Return Package is too small - found %u elements, expected %u",
405  Count, ExpectedCount));
406 
408 }
#define ACPI_RTYPE_INTEGER
Definition: aclocal.h:478
ACPI_STATUS AcpiNsCheckObjectType(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr, UINT32 ExpectedBtypes, UINT32 PackageIndex)
Definition: nspredef.c:245
ACPI_OBJECT_PACKAGE Package
Definition: acobject.h:522
#define AE_AML_OPERAND_VALUE
Definition: acexcep.h:183
#define AE_AML_INTERNAL
Definition: acexcep.h:194
void AcpiNsRemoveNullElements(ACPI_EVALUATE_INFO *Info, UINT8 PackageType, ACPI_OPERAND_OBJECT *ObjDesc)
Definition: nsrepair.c:494
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_DB_REPAIR
Definition: acoutput.h:154
if(dx==0 &&dy==0)
Definition: linetemp.h:174
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:683
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
unsigned int UINT32
static ACPI_STATUS AcpiNsCustomPackage(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **Elements, UINT32 Count)
Definition: nsprepkg.c:659
#define ACPI_WARN_PREDEFINED(plist)
Definition: acmacros.h:464
#define AE_INFO
Definition: acoutput.h:230
ACPI_STATUS AcpiNsWrapWithPackage(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ObjDescPtr)
Definition: nsrepair.c:597
Status
Definition: gdiplustypes.h:24
int Count
Definition: noreturn.cpp:7
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
static ACPI_STATUS AcpiNsCheckPackageList(ACPI_EVALUATE_INFO *Info, const ACPI_PREDEFINED_INFO *Package, ACPI_OPERAND_OBJECT **Elements, UINT32 Count)
Definition: nsprepkg.c:428
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_DB_NAMES
Definition: acoutput.h:166
static ACPI_STATUS AcpiNsCheckPackageElements(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **Elements, UINT8 Type1, UINT32 Count1, UINT8 Type2, UINT32 Count2, UINT32 StartIndex)
Definition: nsprepkg.c:746
#define AE_OK
Definition: acexcep.h:97
union acpi_operand_object ** Elements
Definition: acobject.h:161

Referenced by AcpiNsCheckReturnValue().

◆ AcpiNsCheckPackageElements()

static ACPI_STATUS AcpiNsCheckPackageElements ( ACPI_EVALUATE_INFO Info,
ACPI_OPERAND_OBJECT **  Elements,
UINT8  Type1,
UINT32  Count1,
UINT8  Type2,
UINT32  Count2,
UINT32  StartIndex 
)
static

Definition at line 746 of file nsprepkg.c.

754 {
755  ACPI_OPERAND_OBJECT **ThisElement = Elements;
757  UINT32 i;
758 
759 
760  ACPI_FUNCTION_TRACE (NsCheckPackageElements);
761 
762  /*
763  * Up to two groups of package elements are supported by the data
764  * structure. All elements in each group must be of the same type.
765  * The second group can have a count of zero.
766  */
767  for (i = 0; i < Count1; i++)
768  {
769  Status = AcpiNsCheckObjectType (Info, ThisElement,
770  Type1, i + StartIndex);
771  if (ACPI_FAILURE (Status))
772  {
774  }
775 
776  ThisElement++;
777  }
778 
779  for (i = 0; i < Count2; i++)
780  {
781  Status = AcpiNsCheckObjectType (Info, ThisElement,
782  Type2, (i + Count1 + StartIndex));
783  if (ACPI_FAILURE (Status))
784  {
786  }
787 
788  ThisElement++;
789  }
790 
792 }
ACPI_STATUS AcpiNsCheckObjectType(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr, UINT32 ExpectedBtypes, UINT32 PackageIndex)
Definition: nspredef.c:245
UINT32 ACPI_STATUS
Definition: actypes.h:460
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
unsigned int UINT32
Status
Definition: gdiplustypes.h:24
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiNsCheckPackage(), AcpiNsCheckPackageList(), and AcpiNsCustomPackage().

◆ AcpiNsCheckPackageList()

static ACPI_STATUS AcpiNsCheckPackageList ( ACPI_EVALUATE_INFO Info,
const ACPI_PREDEFINED_INFO Package,
ACPI_OPERAND_OBJECT **  Elements,
UINT32  Count 
)
static

Definition at line 428 of file nsprepkg.c.

433 {
434  ACPI_OPERAND_OBJECT *SubPackage;
435  ACPI_OPERAND_OBJECT **SubElements;
437  UINT32 ExpectedCount;
438  UINT32 i;
439  UINT32 j;
440 
441 
442  /*
443  * Validate each subpackage in the parent Package
444  *
445  * NOTE: assumes list of subpackages contains no NULL elements.
446  * Any NULL elements should have been removed by earlier call
447  * to AcpiNsRemoveNullElements.
448  */
449  for (i = 0; i < Count; i++)
450  {
451  SubPackage = *Elements;
452  SubElements = SubPackage->Package.Elements;
453  Info->ParentPackage = SubPackage;
454 
455  /* Each sub-object must be of type Package */
456 
457  Status = AcpiNsCheckObjectType (Info, &SubPackage,
459  if (ACPI_FAILURE (Status))
460  {
461  return (Status);
462  }
463 
464  /* Examine the different types of expected subpackages */
465 
466  Info->ParentPackage = SubPackage;
467  switch (Package->RetInfo.Type)
468  {
469  case ACPI_PTYPE2:
472 
473  /* Each subpackage has a fixed number of elements */
474 
475  ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
476  if (SubPackage->Package.Count < ExpectedCount)
477  {
478  goto PackageTooSmall;
479  }
480 
481  Status = AcpiNsCheckPackageElements (Info, SubElements,
482  Package->RetInfo.ObjectType1,
483  Package->RetInfo.Count1,
484  Package->RetInfo.ObjectType2,
485  Package->RetInfo.Count2, 0);
486  if (ACPI_FAILURE (Status))
487  {
488  return (Status);
489  }
490  break;
491 
492  case ACPI_PTYPE2_FIX_VAR:
493  /*
494  * Each subpackage has a fixed number of elements and an
495  * optional element
496  */
497  ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
498  if (SubPackage->Package.Count < ExpectedCount)
499  {
500  goto PackageTooSmall;
501  }
502 
503  Status = AcpiNsCheckPackageElements (Info, SubElements,
504  Package->RetInfo.ObjectType1,
505  Package->RetInfo.Count1,
506  Package->RetInfo.ObjectType2,
507  SubPackage->Package.Count - Package->RetInfo.Count1, 0);
508  if (ACPI_FAILURE (Status))
509  {
510  return (Status);
511  }
512  break;
513 
514  case ACPI_PTYPE2_VAR_VAR:
515  /*
516  * Each subpackage has a fixed or variable number of elements
517  */
518  break;
519 
520  case ACPI_PTYPE2_FIXED:
521 
522  /* Each subpackage has a fixed length */
523 
524  ExpectedCount = Package->RetInfo2.Count;
525  if (SubPackage->Package.Count < ExpectedCount)
526  {
527  goto PackageTooSmall;
528  }
529 
530  /* Check the type of each subpackage element */
531 
532  for (j = 0; j < ExpectedCount; j++)
533  {
534  Status = AcpiNsCheckObjectType (Info, &SubElements[j],
535  Package->RetInfo2.ObjectType[j], j);
536  if (ACPI_FAILURE (Status))
537  {
538  return (Status);
539  }
540  }
541  break;
542 
543  case ACPI_PTYPE2_MIN:
544 
545  /* Each subpackage has a variable but minimum length */
546 
547  ExpectedCount = Package->RetInfo.Count1;
548  if (SubPackage->Package.Count < ExpectedCount)
549  {
550  goto PackageTooSmall;
551  }
552 
553  /* Check the type of each subpackage element */
554 
555  Status = AcpiNsCheckPackageElements (Info, SubElements,
556  Package->RetInfo.ObjectType1,
557  SubPackage->Package.Count, 0, 0, 0);
558  if (ACPI_FAILURE (Status))
559  {
560  return (Status);
561  }
562  break;
563 
564  case ACPI_PTYPE2_COUNT:
565  /*
566  * First element is the (Integer) count of elements, including
567  * the count field (the ACPI name is NumElements)
568  */
569  Status = AcpiNsCheckObjectType (Info, SubElements,
570  ACPI_RTYPE_INTEGER, 0);
571  if (ACPI_FAILURE (Status))
572  {
573  return (Status);
574  }
575 
576  /*
577  * Make sure package is large enough for the Count and is
578  * is as large as the minimum size
579  */
580  ExpectedCount = (UINT32) (*SubElements)->Integer.Value;
581  if (SubPackage->Package.Count < ExpectedCount)
582  {
583  goto PackageTooSmall;
584  }
585 
586  if (SubPackage->Package.Count < Package->RetInfo.Count1)
587  {
588  ExpectedCount = Package->RetInfo.Count1;
589  goto PackageTooSmall;
590  }
591 
592  if (ExpectedCount == 0)
593  {
594  /*
595  * Either the NumEntries element was originally zero or it was
596  * a NULL element and repaired to an Integer of value zero.
597  * In either case, repair it by setting NumEntries to be the
598  * actual size of the subpackage.
599  */
600  ExpectedCount = SubPackage->Package.Count;
601  (*SubElements)->Integer.Value = ExpectedCount;
602  }
603 
604  /* Check the type of each subpackage element */
605 
606  Status = AcpiNsCheckPackageElements (Info, (SubElements + 1),
607  Package->RetInfo.ObjectType1,
608  (ExpectedCount - 1), 0, 0, 1);
609  if (ACPI_FAILURE (Status))
610  {
611  return (Status);
612  }
613  break;
614 
615  default: /* Should not get here, type was validated by caller */
616 
617  ACPI_ERROR ((AE_INFO, "Invalid Package type: %X",
618  Package->RetInfo.Type));
619  return (AE_AML_INTERNAL);
620  }
621 
622  Elements++;
623  }
624 
625  return (AE_OK);
626 
627 
628 PackageTooSmall:
629 
630  /* The subpackage count was smaller than required */
631 
632  ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
633  "Return SubPackage[%u] is too small - found %u elements, expected %u",
634  i, SubPackage->Package.Count, ExpectedCount));
635 
636  return (AE_AML_OPERAND_VALUE);
637 }
#define ACPI_RTYPE_INTEGER
Definition: aclocal.h:478
ACPI_STATUS AcpiNsCheckObjectType(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr, UINT32 ExpectedBtypes, UINT32 PackageIndex)
Definition: nspredef.c:245
ACPI_OBJECT_PACKAGE Package
Definition: acobject.h:522
#define AE_AML_OPERAND_VALUE
Definition: acexcep.h:183
#define AE_AML_INTERNAL
Definition: acexcep.h:194
UINT32 ACPI_STATUS
Definition: actypes.h:460
if(dx==0 &&dy==0)
Definition: linetemp.h:174
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
unsigned int UINT32
#define ACPI_WARN_PREDEFINED(plist)
Definition: acmacros.h:464
#define AE_INFO
Definition: acoutput.h:230
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
Status
Definition: gdiplustypes.h:24
int Count
Definition: noreturn.cpp:7
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
static ACPI_STATUS AcpiNsCheckPackageElements(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **Elements, UINT8 Type1, UINT32 Count1, UINT8 Type2, UINT32 Count2, UINT32 StartIndex)
Definition: nsprepkg.c:746
#define ACPI_RTYPE_PACKAGE
Definition: aclocal.h:481
#define AE_OK
Definition: acexcep.h:97
union acpi_operand_object ** Elements
Definition: acobject.h:161

Referenced by AcpiNsCheckPackage().

◆ AcpiNsCustomPackage()

static ACPI_STATUS AcpiNsCustomPackage ( ACPI_EVALUATE_INFO Info,
ACPI_OPERAND_OBJECT **  Elements,
UINT32  Count 
)
static

Definition at line 659 of file nsprepkg.c.

663 {
664  UINT32 ExpectedCount;
665  UINT32 Version;
667 
668 
669  ACPI_FUNCTION_NAME (NsCustomPackage);
670 
671 
672  /* Get version number, must be Integer */
673 
674  if ((*Elements)->Common.Type != ACPI_TYPE_INTEGER)
675  {
676  ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
677  "Return Package has invalid object type for version number"));
679  }
680 
681  Version = (UINT32) (*Elements)->Integer.Value;
682  ExpectedCount = 21; /* Version 1 */
683 
684  if (Version == 0)
685  {
686  ExpectedCount = 20; /* Version 0 */
687  }
688 
689  if (Count < ExpectedCount)
690  {
691  ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
692  "Return Package is too small - found %u elements, expected %u",
693  Count, ExpectedCount));
695  }
696  else if (Count > ExpectedCount)
697  {
699  "%s: Return Package is larger than needed - "
700  "found %u, expected %u\n",
701  Info->FullPathname, Count, ExpectedCount));
702  }
703 
704  /* Validate all elements of the returned package */
705 
707  ACPI_RTYPE_INTEGER, 16,
708  ACPI_RTYPE_STRING, 4, 0);
709  if (ACPI_FAILURE (Status))
710  {
712  }
713 
714  /* Version 1 has a single trailing integer */
715 
716  if (Version > 0)
717  {
718  Status = AcpiNsCheckPackageElements (Info, Elements + 20,
719  ACPI_RTYPE_INTEGER, 1, 0, 0, 20);
720  }
721 
723 }
#define ACPI_RTYPE_INTEGER
Definition: aclocal.h:478
#define ACPI_TYPE_INTEGER
Definition: actypes.h:680
#define AE_AML_OPERAND_VALUE
Definition: acexcep.h:183
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_DB_REPAIR
Definition: acoutput.h:154
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
unsigned int UINT32
#define ACPI_WARN_PREDEFINED(plist)
Definition: acmacros.h:464
#define AE_INFO
Definition: acoutput.h:230
Status
Definition: gdiplustypes.h:24
#define ACPI_RTYPE_STRING
Definition: aclocal.h:479
int Count
Definition: noreturn.cpp:7
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:361
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
static ACPI_STATUS AcpiNsCheckPackageElements(ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **Elements, UINT8 Type1, UINT32 Count1, UINT8 Type2, UINT32 Count2, UINT32 StartIndex)
Definition: nsprepkg.c:746
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiNsCheckPackage().