TianoCore EDK2 master
Loading...
Searching...
No Matches
CapsuleDump.c File Reference
#include "CapsuleApp.h"

Go to the source code of this file.

Functions

BOOLEAN IsValidCapsuleHeader (IN EFI_CAPSULE_HEADER *CapsuleHeader, IN UINT64 CapsuleSize)
 
VOID DumpUxCapsule (IN EFI_CAPSULE_HEADER *CapsuleHeader)
 
VOID DumpFmpCapsule (IN EFI_CAPSULE_HEADER *CapsuleHeader)
 
BOOLEAN IsNestedFmpCapsule (IN EFI_CAPSULE_HEADER *CapsuleHeader)
 
EFI_STATUS DumpCapsule (IN CHAR16 *CapsuleName)
 
EFI_STATUS DumpCapsuleStatusVariable (VOID)
 
CHAR8 * FwTypeToString (IN UINT32 FwType)
 
CHAR8 * LastAttemptStatusToString (IN UINT32 LastAttemptStatus)
 
VOID DumpEsrtEntry (IN EFI_SYSTEM_RESOURCE_ENTRY *EsrtEntry)
 
VOID DumpEsrt (IN EFI_SYSTEM_RESOURCE_TABLE *Esrt)
 
VOID DumpEsrtData (VOID)
 
EFI_STATUS DumpCapsuleFromBuffer (IN EFI_CAPSULE_HEADER *CapsuleHeader)
 
STATIC CHAR16 * UpperCaseString (IN CHAR16 *Str)
 
STATIC VOID GetSubStringBeforePeriod (IN CHAR16 *Str, OUT CHAR16 *SubStr, OUT UINTN *SubStrLen)
 
STATIC VOID PadStrInTail (IN CHAR16 *StrBuf, IN UINTN PadLen, IN CHAR16 Character)
 
STATIC VOID SplitFileNameExtension (IN CHAR16 *FileName, OUT CHAR16 *FileNameFirst, OUT CHAR16 *FileNameExtension)
 
INTN EFIAPI CompareFileNameInAlphabet (IN VOID *Left, IN VOID *Right)
 
EFI_STATUS DumpCapsuleFromDisk (IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Fs, IN BOOLEAN DumpCapsuleInfo)
 
VOID DumpBlockDescriptors (IN EFI_CAPSULE_BLOCK_DESCRIPTOR *BlockDescriptors, IN BOOLEAN DumpCapsuleInfo)
 
VOID DumpProvisionedCapsule (IN BOOLEAN DumpCapsuleInfo)
 
VOID DumpFmpImageInfo (IN UINTN ImageInfoSize, IN EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo, IN UINT32 DescriptorVersion, IN UINT8 DescriptorCount, IN UINTN DescriptorSize, IN UINT32 PackageVersion, IN CHAR16 *PackageVersionName)
 
VOID DumpFmpPackageInfo (IN UINT32 PackageVersion, IN CHAR16 *PackageVersionName, IN UINT32 PackageVersionNameMaxLen, IN UINT64 AttributesSupported, IN UINT64 AttributesSetting)
 
VOID DumpFmpData (VOID)
 
BOOLEAN IsThisFmpImageInfo (IN EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo, IN UINT8 DescriptorCount, IN UINTN DescriptorSize, IN EFI_GUID *ImageTypeId)
 
EFI_FIRMWARE_MANAGEMENT_PROTOCOLFindFmpFromImageTypeId (IN EFI_GUID *ImageTypeId)
 
VOID DumpFmpImage (IN EFI_GUID *ImageTypeId, IN UINTN ImageIndex, IN CHAR16 *ImageName)
 

Variables

CHAR8 * mFwTypeString []
 
CHAR8 * mLastAttemptStatusString []
 

Detailed Description

Dump Capsule image information.

Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file CapsuleDump.c.

Function Documentation

◆ CompareFileNameInAlphabet()

INTN EFIAPI CompareFileNameInAlphabet ( IN VOID *  Left,
IN VOID *  Right 
)

The function is called by PerformQuickSort to sort file name in alphabet.

Parameters
[in]LeftThe pointer to first buffer.
[in]RightThe pointer to second buffer.
Return values
0Buffer1 equal to Buffer2.
Returns
<0 Buffer1 is less than Buffer2.
>0 Buffer1 is greater than Buffer2.

Definition at line 636 of file CapsuleDump.c.

◆ DumpBlockDescriptors()

VOID DumpBlockDescriptors ( IN EFI_CAPSULE_BLOCK_DESCRIPTOR BlockDescriptors,
IN BOOLEAN  DumpCapsuleInfo 
)

Dump capsule inforomation form Gather list.

Parameters
[in]BlockDescriptorsThe block descriptors for the capsule images
[in]DumpCapsuleInfoThe flag to indicate whether to dump the capsule inforomation.

Definition at line 872 of file CapsuleDump.c.

◆ DumpCapsule()

EFI_STATUS DumpCapsule ( IN CHAR16 *  CapsuleName)

Dump capsule information

Parameters
[in]CapsuleNameThe name of the capsule image.
Return values
EFI_SUCCESSThe capsule information is dumped.
EFI_UNSUPPORTEDInput parameter is not valid.

Definition at line 175 of file CapsuleDump.c.

◆ DumpCapsuleFromBuffer()

EFI_STATUS DumpCapsuleFromBuffer ( IN EFI_CAPSULE_HEADER CapsuleHeader)

Dump capsule information from CapsuleHeader

Parameters
[in]CapsuleHeaderThe CapsuleHeader of the capsule image.
Return values
EFI_SUCCESSThe capsule information is dumped.

Definition at line 474 of file CapsuleDump.c.

◆ DumpCapsuleFromDisk()

EFI_STATUS DumpCapsuleFromDisk ( IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL Fs,
IN BOOLEAN  DumpCapsuleInfo 
)

Dump capsule information from disk.

Parameters
[in]FsThe device path of disk.
[in]DumpCapsuleInfoThe flag to indicate whether to dump the capsule inforomation.
Return values
EFI_SUCCESSThe capsule information is dumped.

Definition at line 698 of file CapsuleDump.c.

◆ DumpCapsuleStatusVariable()

EFI_STATUS DumpCapsuleStatusVariable ( VOID  )

Dump capsule status variable.

Return values
EFI_SUCCESSThe capsule status variable is dumped.
EFI_UNSUPPORTEDInput parameter is not valid.

Definition at line 233 of file CapsuleDump.c.

◆ DumpEsrt()

VOID DumpEsrt ( IN EFI_SYSTEM_RESOURCE_TABLE Esrt)

Dump ESRT table.

Parameters
[in]EsrtESRT table

Definition at line 416 of file CapsuleDump.c.

◆ DumpEsrtData()

VOID DumpEsrtData ( VOID  )

Dump ESRT info.

Definition at line 444 of file CapsuleDump.c.

◆ DumpEsrtEntry()

VOID DumpEsrtEntry ( IN EFI_SYSTEM_RESOURCE_ENTRY EsrtEntry)

Dump ESRT entry.

Parameters
[in]EsrtEntryESRT entry

Definition at line 397 of file CapsuleDump.c.

◆ DumpFmpCapsule()

VOID DumpFmpCapsule ( IN EFI_CAPSULE_HEADER CapsuleHeader)

Dump a non-nested FMP capsule.

Parameters
[in]CapsuleHeaderA pointer to CapsuleHeader

Definition at line 63 of file CapsuleDump.c.

◆ DumpFmpData()

VOID DumpFmpData ( VOID  )

Dump FMP protocol info.

Definition at line 1125 of file CapsuleDump.c.

◆ DumpFmpImage()

VOID DumpFmpImage ( IN EFI_GUID ImageTypeId,
IN UINTN  ImageIndex,
IN CHAR16 *  ImageName 
)

Dump FMP image data.

Parameters
[in]ImageTypeIdThe ImageTypeId of the FMP image. It is used to identify the FMP protocol.
[in]ImageIndexThe ImageIndex of the FMP image. It is the input parameter for FMP->GetImage().
[in]ImageNameThe file name to hold the output FMP image.

Definition at line 1420 of file CapsuleDump.c.

◆ DumpFmpImageInfo()

VOID DumpFmpImageInfo ( IN UINTN  ImageInfoSize,
IN EFI_FIRMWARE_IMAGE_DESCRIPTOR ImageInfo,
IN UINT32  DescriptorVersion,
IN UINT8  DescriptorCount,
IN UINTN  DescriptorSize,
IN UINT32  PackageVersion,
IN CHAR16 *  PackageVersionName 
)

Dump FMP information.

Parameters
[in]ImageInfoSizeThe size of ImageInfo, in bytes.
[in]ImageInfoA pointer to EFI_FIRMWARE_IMAGE_DESCRIPTOR.
[in]DescriptorVersionThe version of EFI_FIRMWARE_IMAGE_DESCRIPTOR.
[in]DescriptorCountThe count of EFI_FIRMWARE_IMAGE_DESCRIPTOR.
[in]DescriptorSizeThe size of an individual EFI_FIRMWARE_IMAGE_DESCRIPTOR, in bytes.
[in]PackageVersionThe version of package.
[in]PackageVersionNameThe version name of package.

Definition at line 1018 of file CapsuleDump.c.

◆ DumpFmpPackageInfo()

VOID DumpFmpPackageInfo ( IN UINT32  PackageVersion,
IN CHAR16 *  PackageVersionName,
IN UINT32  PackageVersionNameMaxLen,
IN UINT64  AttributesSupported,
IN UINT64  AttributesSetting 
)

Dump FMP package information.

Parameters
[in]PackageVersionThe version of package.
[in]PackageVersionNameThe version name of package.
[in]PackageVersionNameMaxLenThe maximum length of PackageVersionName.
[in]AttributesSupportedPackage attributes that are supported by this device.
[in]AttributesSettingPackage attributes.

Definition at line 1100 of file CapsuleDump.c.

◆ DumpProvisionedCapsule()

VOID DumpProvisionedCapsule ( IN BOOLEAN  DumpCapsuleInfo)

Dump Provisioned Capsule.

Parameters
[in]DumpCapsuleInfoThe flag to indicate whether to dump the capsule inforomation.

Definition at line 911 of file CapsuleDump.c.

◆ DumpUxCapsule()

VOID DumpUxCapsule ( IN EFI_CAPSULE_HEADER CapsuleHeader)

Dump UX capsule information.

Parameters
[in]CapsuleHeaderThe UX capsule header

Definition at line 35 of file CapsuleDump.c.

◆ FindFmpFromImageTypeId()

EFI_FIRMWARE_MANAGEMENT_PROTOCOL * FindFmpFromImageTypeId ( IN EFI_GUID ImageTypeId)

return the FMP whoes ImageInfo includes the ImageTypeId.

Parameters
[in]ImageTypeIdA unique GUID identifying the firmware image type.
Returns
The FMP whoes ImageInfo includes the ImageTypeId

Definition at line 1308 of file CapsuleDump.c.

◆ FwTypeToString()

CHAR8 * FwTypeToString ( IN UINT32  FwType)

Convert FwType to a string.

Parameters
[in]FwTypeFwType in ESRT
Returns
a string for FwType.

Definition at line 361 of file CapsuleDump.c.

◆ GetSubStringBeforePeriod()

STATIC VOID GetSubStringBeforePeriod ( IN CHAR16 *  Str,
OUT CHAR16 *  SubStr,
OUT UINTN SubStrLen 
)

This routine is used to return substring before period '.' or '\0' Caller should respsonsible of substr space allocation & free

Parameters
[in]StrString to check
[out]SubStrFirst part of string before period or '\0'
[out]SubStrLenLength of first part of string

Definition at line 536 of file CapsuleDump.c.

◆ IsNestedFmpCapsule()

BOOLEAN IsNestedFmpCapsule ( IN EFI_CAPSULE_HEADER CapsuleHeader)

Return if there is a FMP header below capsule header.

Parameters
[in]CapsuleHeaderA pointer to EFI_CAPSULE_HEADER
Return values
TRUEThere is a FMP header below capsule header.
FALSEThere is not a FMP header below capsule header

Definition at line 117 of file CapsuleDump.c.

◆ IsThisFmpImageInfo()

BOOLEAN IsThisFmpImageInfo ( IN EFI_FIRMWARE_IMAGE_DESCRIPTOR ImageInfo,
IN UINT8  DescriptorCount,
IN UINTN  DescriptorSize,
IN EFI_GUID ImageTypeId 
)

Check if the ImageInfo includes the ImageTypeId.

Parameters
[in]ImageInfoA pointer to EFI_FIRMWARE_IMAGE_DESCRIPTOR.
[in]DescriptorCountThe count of EFI_FIRMWARE_IMAGE_DESCRIPTOR.
[in]DescriptorSizeThe size of an individual EFI_FIRMWARE_IMAGE_DESCRIPTOR, in bytes.
[in]ImageTypeIdA unique GUID identifying the firmware image type.
Returns
TRUE This ImageInfo includes the ImageTypeId
FALSE This ImageInfo does not include the ImageTypeId

Definition at line 1278 of file CapsuleDump.c.

◆ IsValidCapsuleHeader()

BOOLEAN IsValidCapsuleHeader ( IN EFI_CAPSULE_HEADER CapsuleHeader,
IN UINT64  CapsuleSize 
)

Validate if it is valid capsule header

This function assumes the caller provided correct CapsuleHeader pointer and CapsuleSize.

This function validates the fields in EFI_CAPSULE_HEADER.

Parameters
[in]CapsuleHeaderPoints to a capsule header.
[in]CapsuleSizeSize of the whole capsule image.

Validate if it is valid capsule header

Caution: This function may receive untrusted input.

This function assumes the caller provided correct CapsuleHeader pointer and CapsuleSize.

This function validates the fields in EFI_CAPSULE_HEADER.

Parameters
[in]CapsuleHeaderPoints to a capsule header.
[in]CapsuleSizeSize of the whole capsule image.

Definition at line 247 of file CapsuleApp.c.

◆ LastAttemptStatusToString()

CHAR8 * LastAttemptStatusToString ( IN UINT32  LastAttemptStatus)

Convert LastAttemptStatus to a string.

Parameters
[in]LastAttemptStatusLastAttemptStatus in FMP or ESRT
Returns
a string for LastAttemptStatus.

Definition at line 380 of file CapsuleDump.c.

◆ PadStrInTail()

STATIC VOID PadStrInTail ( IN CHAR16 *  StrBuf,
IN UINTN  PadLen,
IN CHAR16  Character 
)

This routine pad the string in tail with input character.

Parameters
[in]StrBufStr buffer to be padded, should be enough room for
[in]PadLenExpected padding length
[in]CharacterCharacter used to pad

Definition at line 562 of file CapsuleDump.c.

◆ SplitFileNameExtension()

STATIC VOID SplitFileNameExtension ( IN CHAR16 *  FileName,
OUT CHAR16 *  FileNameFirst,
OUT CHAR16 *  FileNameExtension 
)

This routine find the offset of the last period '.' of string. if No period exists function FileNameExtension is set to L'\0'

Parameters
[in]FileNameFile name to split between last period
[out]FileNameFirstFirst FileName before last period
[out]FileNameExtensionFileName after last period

Definition at line 593 of file CapsuleDump.c.

◆ UpperCaseString()

STATIC CHAR16 * UpperCaseString ( IN CHAR16 *  Str)

This routine is called to upper case given unicode string.

Parameters
[in]StrString to upper case
Return values
uppercased string after process

Definition at line 510 of file CapsuleDump.c.

Variable Documentation

◆ mFwTypeString

CHAR8* mFwTypeString[]
Initial value:
= {
"Unknown",
"SystemFirmware",
"DeviceFirmware",
"UefiDriver",
}

Definition at line 334 of file CapsuleDump.c.

◆ mLastAttemptStatusString

CHAR8* mLastAttemptStatusString[]
Initial value:
= {
"Success",
"Error: Unsuccessful",
"Error: Insufficient Resources",
"Error: Incorrect Version",
"Error: Invalid Format",
"Error: Auth Error",
"Error: Power Event AC",
"Error: Power Event Battery",
"Error: Unsatisfied Dependencies",
}

Definition at line 341 of file CapsuleDump.c.