/* The input arguments Length and PkgLen represent, for the DefDevice: DefDevice := DeviceOp PkgLength NameString TermList |--- */
EFI_STATUS EFIAPI AmlComputePkgLength(IN UINT32 Length, OUT UINT32 *PkgLen)
/* The input arguments Length and PkgLen represent, for the DefDevice: DefDevice := DeviceOp PkgLength NameString TermList |--- */
EFI_STATUS EFIAPI AmlComputePkgLength(IN UINT32 Length, OUT UINT32 *PkgLen)
{
  UINT32  PkgLenWidth;
  UINT32  ReComputedPkgLenWidth;
  if (PkgLen == NULL) {
    ASSERT (0);
    return EFI_INVALID_PARAMETER;
  }
  PkgLenWidth = AmlComputePkgLengthWidth (Length);
  if (PkgLenWidth == 0) {
    ASSERT (0);
    return EFI_INVALID_PARAMETER;
  }
  Length += PkgLenWidth;
  ReComputedPkgLenWidth = AmlComputePkgLengthWidth (Length);
  if (ReComputedPkgLenWidth != PkgLenWidth) {
    if ((ReComputedPkgLenWidth != 0)   &&
        (ReComputedPkgLenWidth < 4))
    {
      Length += 1;
    } else {
      ASSERT (0);
      return EFI_INVALID_PARAMETER;
    }
  }
  *PkgLen = Length;
  return EFI_SUCCESS;
}