FmpDevicePkg: Fix code style issue

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Star Zeng 2018-07-30 17:47:57 +08:00 committed by Kinney, Michael D
parent 559b5d5283
commit a6d73269b1
11 changed files with 75 additions and 73 deletions

View File

@ -59,17 +59,17 @@
"value of 0 disables the watchdog timer. The default value is 0 (watchdog" "value of 0 disables the watchdog timer. The default value is 0 (watchdog"
"disabled)." "disabled)."
#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdFmpDevicePkcs7CertBufferXdr_PROMPT #language en-US "One or more XDR encoded PKCS7 certificates used to verify firmware device capsule update images" #string STR_gFmpDevicePkgTokenSpaceGuid_PcdFmpDevicePkcs7CertBufferXdr_PROMPT #language en-US "One or more XDR encoded PKCS7 certificates used to verify firmware device capsule update images"
#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdFmpDevicePkcs7CertBufferXdr_HELP #language en-US "Provides one or more PKCS7 certificates used to verify a firmware device" #string STR_gFmpDevicePkgTokenSpaceGuid_PcdFmpDevicePkcs7CertBufferXdr_HELP #language en-US "Provides one or more PKCS7 certificates used to verify a firmware device"
"capsule update image. This PCD is encoded using the Variable-Length Opaque" "capsule update image. This PCD is encoded using the Variable-Length Opaque"
"Data format of RFC 4506 External Data Representation Standard (XDR)." "Data format of RFC 4506 External Data Representation Standard (XDR)."
"The default value is empty with 0 certificates." "The default value is empty with 0 certificates."
#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdFmpDeviceLockEventGuid_PROMPT #language en-US "Firmware Device Lock Event GUID." #string STR_gFmpDevicePkgTokenSpaceGuid_PcdFmpDeviceLockEventGuid_PROMPT #language en-US "Firmware Device Lock Event GUID."
#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdFmpDeviceLockEventGuid_HELP #language en-US "An event GUID that locks the firmware device when the event is signaled." #string STR_gFmpDevicePkgTokenSpaceGuid_PcdFmpDeviceLockEventGuid_HELP #language en-US "An event GUID that locks the firmware device when the event is signaled."
"If this PCD is not a valid GUID value, then the firmware device is locked" "If this PCD is not a valid GUID value, then the firmware device is locked"
"when gEfiEndOfDxeEventGroupGuid (End of DXE Phase) is signaled. The" "when gEfiEndOfDxeEventGroupGuid (End of DXE Phase) is signaled. The"
"default value is empty, so by default the firmware device is locked at the" "default value is empty, so by default the firmware device is locked at the"
"end of the DXE phase." "end of the DXE phase."

View File

@ -1,4 +1,4 @@
/** @file /** @file
Detects if PcdFmpDevicePkcs7CertBufferXdr contains a test key. Detects if PcdFmpDevicePkcs7CertBufferXdr contains a test key.
Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>

View File

@ -1,4 +1,4 @@
/** @file /** @file
Produces a Firmware Management Protocol that supports updates to a firmware Produces a Firmware Management Protocol that supports updates to a firmware
image stored in a firmware device with platform and firmware device specific image stored in a firmware device with platform and firmware device specific
information provided through PCDs and libraries. information provided through PCDs and libraries.
@ -90,7 +90,7 @@ CHAR16 *mVersionName = NULL;
EFI_EVENT mFmpDeviceLockEvent; EFI_EVENT mFmpDeviceLockEvent;
// //
// Indicates if an attempt has been made to lock a // Indicates if an attempt has been made to lock a
// FLASH storage device by calling FmpDeviceLock(). // FLASH storage device by calling FmpDeviceLock().
// A FLASH storage device may not support being locked, // A FLASH storage device may not support being locked,
// so this variable is set to TRUE even if FmpDeviceLock() // so this variable is set to TRUE even if FmpDeviceLock()
@ -474,11 +474,11 @@ cleanup:
This function allows a copy of the current firmware image to be created and saved. This function allows a copy of the current firmware image to be created and saved.
The saved copy could later been used, for example, in firmware image recovery or rollback. The saved copy could later been used, for example, in firmware image recovery or rollback.
@param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance. @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.
@param[in] ImageIndex A unique number identifying the firmware image(s) within the device. @param[in] ImageIndex A unique number identifying the firmware image(s) within the device.
The number is between 1 and DescriptorCount. The number is between 1 and DescriptorCount.
@param[out] Image Points to the buffer where the current image is copied to. @param[in, out] Image Points to the buffer where the current image is copied to.
@param[out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes. @param[in, out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes.
On return, points to the length of the image, in bytes. On return, points to the length of the image, in bytes.
@retval EFI_SUCCESS The device was successfully updated with the new image. @retval EFI_SUCCESS The device was successfully updated with the new image.
@ -646,7 +646,7 @@ CheckTheImage (
IN UINT8 ImageIndex, IN UINT8 ImageIndex,
IN CONST VOID *Image, IN CONST VOID *Image,
IN UINTN ImageSize, IN UINTN ImageSize,
OUT UINT32 *ImageUpdateable OUT UINT32 *ImageUpdatable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -677,8 +677,8 @@ CheckTheImage (
PopulateDescriptor(); PopulateDescriptor();
} }
if (ImageUpdateable == NULL) { if (ImageUpdatable == NULL) {
DEBUG ((DEBUG_ERROR, "FmpDxe: CheckImage() - ImageUpdateable Pointer Parameter is NULL.\n")); DEBUG ((DEBUG_ERROR, "FmpDxe: CheckImage() - ImageUpdatable Pointer Parameter is NULL.\n"));
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
goto cleanup; goto cleanup;
} }
@ -686,14 +686,14 @@ CheckTheImage (
// //
//Set to valid and then if any tests fail it will update this flag. //Set to valid and then if any tests fail it will update this flag.
// //
*ImageUpdateable = IMAGE_UPDATABLE_VALID; *ImageUpdatable = IMAGE_UPDATABLE_VALID;
if (Image == NULL) { if (Image == NULL) {
DEBUG ((DEBUG_ERROR, "FmpDxe: CheckImage() - Image Pointer Parameter is NULL.\n")); DEBUG ((DEBUG_ERROR, "FmpDxe: CheckImage() - Image Pointer Parameter is NULL.\n"));
// //
// not sure if this is needed // not sure if this is needed
// //
*ImageUpdateable = IMAGE_UPDATABLE_INVALID; *ImageUpdatable = IMAGE_UPDATABLE_INVALID;
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -767,7 +767,7 @@ CheckTheImage (
// //
if (ImageIndex != 1) { if (ImageIndex != 1) {
DEBUG ((DEBUG_ERROR, "FmpDxe: CheckImage() - Image Index Invalid.\n")); DEBUG ((DEBUG_ERROR, "FmpDxe: CheckImage() - Image Index Invalid.\n"));
*ImageUpdateable = IMAGE_UPDATABLE_INVALID_TYPE; *ImageUpdatable = IMAGE_UPDATABLE_INVALID_TYPE;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
goto cleanup; goto cleanup;
} }
@ -785,7 +785,7 @@ CheckTheImage (
Status = GetFmpPayloadHeaderVersion (FmpPayloadHeader, FmpPayloadSize, &Version); Status = GetFmpPayloadHeaderVersion (FmpPayloadHeader, FmpPayloadSize, &Version);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "FmpDxe: CheckTheImage() - GetFmpPayloadHeaderVersion failed %r.\n", Status)); DEBUG ((DEBUG_ERROR, "FmpDxe: CheckTheImage() - GetFmpPayloadHeaderVersion failed %r.\n", Status));
*ImageUpdateable = IMAGE_UPDATABLE_INVALID; *ImageUpdatable = IMAGE_UPDATABLE_INVALID;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
goto cleanup; goto cleanup;
} }
@ -799,7 +799,7 @@ CheckTheImage (
"FmpDxe: CheckTheImage() - Version Lower than lowest supported version. 0x%08X < 0x%08X\n", "FmpDxe: CheckTheImage() - Version Lower than lowest supported version. 0x%08X < 0x%08X\n",
Version, mDesc.LowestSupportedImageVersion) Version, mDesc.LowestSupportedImageVersion)
); );
*ImageUpdateable = IMAGE_UPDATABLE_INVALID_OLD; *ImageUpdatable = IMAGE_UPDATABLE_INVALID_OLD;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
goto cleanup; goto cleanup;
} }
@ -810,7 +810,7 @@ CheckTheImage (
Status = GetFmpPayloadHeaderSize (FmpPayloadHeader, FmpPayloadSize, &FmpHeaderSize); Status = GetFmpPayloadHeaderSize (FmpPayloadHeader, FmpPayloadSize, &FmpHeaderSize);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "FmpDxe: CheckTheImage() - GetFmpPayloadHeaderSize failed %r.\n", Status)); DEBUG ((DEBUG_ERROR, "FmpDxe: CheckTheImage() - GetFmpPayloadHeaderSize failed %r.\n", Status));
*ImageUpdateable = IMAGE_UPDATABLE_INVALID; *ImageUpdatable = IMAGE_UPDATABLE_INVALID;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
goto cleanup; goto cleanup;
} }
@ -830,7 +830,7 @@ CheckTheImage (
// //
// FmpDeviceLib CheckImage function to do any specific checks // FmpDeviceLib CheckImage function to do any specific checks
// //
Status = FmpDeviceCheckImage ((((UINT8 *)Image) + AllHeaderSize), RawSize, ImageUpdateable); Status = FmpDeviceCheckImage ((((UINT8 *)Image) + AllHeaderSize), RawSize, ImageUpdatable);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "FmpDxe: CheckTheImage() - FmpDeviceLib CheckImage failed. Status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "FmpDxe: CheckTheImage() - FmpDeviceLib CheckImage failed. Status = %r\n", Status));
} }
@ -909,6 +909,8 @@ SetTheImage (
EFI_STATUS GetAttributesStatus; EFI_STATUS GetAttributesStatus;
UINT64 AttributesSupported; UINT64 AttributesSupported;
UINT64 AttributesSetting; UINT64 AttributesSetting;
UINT32 Version;
UINT32 LowestSupportedVersion;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
Updateable = 0; Updateable = 0;
@ -1103,7 +1105,7 @@ SetTheImage (
// Update the version stored in variable // Update the version stored in variable
// //
if (!mRuntimeVersionSupported) { if (!mRuntimeVersionSupported) {
UINT32 Version = DEFAULT_VERSION; Version = DEFAULT_VERSION;
GetFmpPayloadHeaderVersion (FmpHeader, FmpPayloadSize, &Version); GetFmpPayloadHeaderVersion (FmpHeader, FmpPayloadSize, &Version);
SetVersionInVariable (Version); SetVersionInVariable (Version);
} }
@ -1112,9 +1114,9 @@ SetTheImage (
// Update lowest supported variable // Update lowest supported variable
// //
{ {
UINT32 Version = DEFAULT_LOWESTSUPPORTEDVERSION; LowestSupportedVersion = DEFAULT_LOWESTSUPPORTEDVERSION;
GetFmpPayloadHeaderLowestSupportedVersion (FmpHeader, FmpPayloadSize, &Version); GetFmpPayloadHeaderLowestSupportedVersion (FmpHeader, FmpPayloadSize, &LowestSupportedVersion);
SetLowestSupportedVersionInVariable (Version); SetLowestSupportedVersionInVariable (LowestSupportedVersion);
} }
LastAttemptStatus = LAST_ATTEMPT_STATUS_SUCCESS; LastAttemptStatus = LAST_ATTEMPT_STATUS_SUCCESS;

View File

@ -1,4 +1,4 @@
/** @file /** @file
UEFI variable support functions for Firmware Management Protocol based UEFI variable support functions for Firmware Management Protocol based
firmware updates. firmware updates.
@ -305,8 +305,8 @@ SetVersionInVariable (
UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpLsv" UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpLsv"
@param[in] LowestSupported The lowest supported version of the firmware image @param[in] LowestSupportedVersion The lowest supported version of the firmware image
in the firmware device. in the firmware device.
**/ **/
VOID VOID

View File

@ -1,4 +1,4 @@
/** @file /** @file
UEFI variable support functions for Firmware Management Protocol based UEFI variable support functions for Firmware Management Protocol based
firmware updates. firmware updates.
@ -128,8 +128,8 @@ SetVersionInVariable (
UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpLsv" UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpLsv"
@param[in] LowestSupported The lowest supported version of the firmware image @param[in] LowestSupportedVersion The lowest supported version of the firmware image
in the firmware device. in the firmware device.
**/ **/
VOID VOID

View File

@ -1,4 +1,4 @@
/** @file /** @file
Provides platform policy services used during a capsule update. Provides platform policy services used during a capsule update.
Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR> Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>
@ -63,7 +63,7 @@ CheckSystemPower (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
CheckSystemThermal ( CheckSystemThermal (
IN OUT BOOLEAN *Good OUT BOOLEAN *Good
); );
/** /**
@ -82,7 +82,7 @@ CheckSystemThermal (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
CheckSystemEnvironment ( CheckSystemEnvironment (
IN OUT BOOLEAN *Good OUT BOOLEAN *Good
); );
/** /**

View File

@ -1,4 +1,4 @@
/** @file /** @file
Provides firmware device specific services to support updates of a firmware Provides firmware device specific services to support updates of a firmware
image stored in a firmware device. image stored in a firmware device.
@ -147,8 +147,8 @@ FmpDeviceGetImageTypeIdGuidPtr (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FmpDeviceGetAttributes ( FmpDeviceGetAttributes (
IN OUT UINT64 *Supported, OUT UINT64 *Supported,
IN OUT UINT64 *Setting OUT UINT64 *Setting
); );
/** /**
@ -256,9 +256,9 @@ FmpDeviceGetVersion (
a copy currently stored firmware image. This can be used to support a copy currently stored firmware image. This can be used to support
features such as recovery and rollback. features such as recovery and rollback.
@param[out] Image Pointer to a caller allocated buffer where the @param[out] Image Pointer to a caller allocated buffer where the
currently stored firmware image is copied to. currently stored firmware image is copied to.
@param[in out] ImageSize Pointer the size, in bytes, of the Image buffer. @param[in, out] ImageSize Pointer the size, in bytes, of the Image buffer.
On return, points to the size, in bytes, of firmware On return, points to the size, in bytes, of firmware
image currently stored in the firmware device. image currently stored in the firmware device.
@ -282,8 +282,8 @@ FmpDeviceGetVersion (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FmpDeviceGetImage ( FmpDeviceGetImage (
IN OUT VOID *Image, OUT VOID *Image,
IN IN OUT UINTN *ImageSize IN OUT UINTN *ImageSize
); );
/** /**
@ -305,9 +305,9 @@ FmpDeviceGetImage (
@retval EFI_SUCCESS The image was successfully checked. Additional @retval EFI_SUCCESS The image was successfully checked. Additional
status information is returned in status information is returned in
ImageUpdateable. ImageUpdatable.
@retval EFI_INVALID_PARAMETER Image is NULL. @retval EFI_INVALID_PARAMETER Image is NULL.
@retval EFI_INVALID_PARAMETER ImageUpdateable is NULL. @retval EFI_INVALID_PARAMETER ImageUpdatable is NULL.
**/ **/
EFI_STATUS EFI_STATUS
@ -315,7 +315,7 @@ EFIAPI
FmpDeviceCheckImage ( FmpDeviceCheckImage (
IN CONST VOID *Image, IN CONST VOID *Image,
IN UINTN ImageSize, IN UINTN ImageSize,
OUT UINT32 *ImageUpdateable OUT UINT32 *ImageUpdatable
); );
/** /**

View File

@ -1,4 +1,4 @@
/** @file /** @file
Provides services to retrieve values from a capsule's FMP Payload Header. Provides services to retrieve values from a capsule's FMP Payload Header.
The structure is not included in the library class. Instead, services are The structure is not included in the library class. Instead, services are
provided to retrieve information from the FMP Payload Header. If information provided to retrieve information from the FMP Payload Header. If information
@ -92,9 +92,9 @@ GetFmpPayloadHeaderVersion (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
GetFmpPayloadHeaderLowestSupportedVersion ( GetFmpPayloadHeaderLowestSupportedVersion (
IN CONST VOID *Header, IN CONST VOID *Header,
IN CONST UINTN FmpPayloadSize, IN CONST UINTN FmpPayloadSize,
IN OUT UINT32 *LowestSupportedVersion OUT UINT32 *LowestSupportedVersion
); );
#endif #endif

View File

@ -1,4 +1,4 @@
/** @file /** @file
Provides platform policy services used during a capsule update. Provides platform policy services used during a capsule update.
Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR> Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>
@ -67,7 +67,7 @@ CheckSystemPower (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
CheckSystemThermal ( CheckSystemThermal (
IN OUT BOOLEAN *Good OUT BOOLEAN *Good
) )
{ {
*Good = TRUE; *Good = TRUE;
@ -90,7 +90,7 @@ CheckSystemThermal (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
CheckSystemEnvironment ( CheckSystemEnvironment (
IN OUT BOOLEAN *Good OUT BOOLEAN *Good
) )
{ {
*Good = TRUE; *Good = TRUE;

View File

@ -1,4 +1,4 @@
/** @file /** @file
Provides firmware device specific services to support updates of a firmware Provides firmware device specific services to support updates of a firmware
image stored in a firmware device. image stored in a firmware device.
@ -79,7 +79,7 @@ RegisterFmpInstaller (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FmpDeviceGetSize ( FmpDeviceGetSize (
IN UINTN *Size OUT UINTN *Size
) )
{ {
if (Size == NULL) { if (Size == NULL) {
@ -138,8 +138,8 @@ FmpDeviceGetImageTypeIdGuidPtr (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FmpDeviceGetAttributes ( FmpDeviceGetAttributes (
IN OUT UINT64 *Supported, OUT UINT64 *Supported,
IN OUT UINT64 *Setting OUT UINT64 *Setting
) )
{ {
if (Supported == NULL || Setting == NULL) { if (Supported == NULL || Setting == NULL) {
@ -268,9 +268,9 @@ FmpDeviceGetVersion (
a copy currently stored firmware image. This can be used to support a copy currently stored firmware image. This can be used to support
features such as recovery and rollback. features such as recovery and rollback.
@param[out] Image Pointer to a caller allocated buffer where the @param[out] Image Pointer to a caller allocated buffer where the
currently stored firmware image is copied to. currently stored firmware image is copied to.
@param[in out] ImageSize Pointer the size, in bytes, of the Image buffer. @param[in, out] ImageSize Pointer the size, in bytes, of the Image buffer.
On return, points to the size, in bytes, of firmware On return, points to the size, in bytes, of firmware
image currently stored in the firmware device. image currently stored in the firmware device.
@ -294,8 +294,8 @@ FmpDeviceGetVersion (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FmpDeviceGetImage ( FmpDeviceGetImage (
IN OUT VOID *Image, OUT VOID *Image,
IN IN OUT UINTN *ImageSize IN OUT UINTN *ImageSize
) )
{ {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
@ -320,9 +320,9 @@ FmpDeviceGetImage (
@retval EFI_SUCCESS The image was successfully checked. Additional @retval EFI_SUCCESS The image was successfully checked. Additional
status information is returned in status information is returned in
ImageUpdateable. ImageUpdatable.
@retval EFI_INVALID_PARAMETER Image is NULL. @retval EFI_INVALID_PARAMETER Image is NULL.
@retval EFI_INVALID_PARAMETER ImageUpdateable is NULL. @retval EFI_INVALID_PARAMETER ImageUpdatable is NULL.
**/ **/
EFI_STATUS EFI_STATUS
@ -330,7 +330,7 @@ EFIAPI
FmpDeviceCheckImage ( FmpDeviceCheckImage (
IN CONST VOID *Image, IN CONST VOID *Image,
IN UINTN ImageSize, IN UINTN ImageSize,
OUT UINT32 *ImageUpdateable OUT UINT32 *ImageUpdatable
) )
{ {
return EFI_SUCCESS; return EFI_SUCCESS;

View File

@ -1,4 +1,4 @@
/** @file /** @file
Provides services to retrieve values from Version 1 of a capsule's FMP Payload Provides services to retrieve values from Version 1 of a capsule's FMP Payload
Header. The FMP Payload Header structure is not defined in the library class. Header. The FMP Payload Header structure is not defined in the library class.
Instead, services are provided to retrieve information from the FMP Payload Instead, services are provided to retrieve information from the FMP Payload
@ -159,9 +159,9 @@ GetFmpPayloadHeaderVersion (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
GetFmpPayloadHeaderLowestSupportedVersion ( GetFmpPayloadHeaderLowestSupportedVersion (
IN CONST VOID *Header, IN CONST VOID *Header,
IN CONST UINTN FmpPayloadSize, IN CONST UINTN FmpPayloadSize,
IN OUT UINT32 *LowestSupportedVersion OUT UINT32 *LowestSupportedVersion
) )
{ {
FMP_PAYLOAD_HEADER *FmpPayloadHeader; FMP_PAYLOAD_HEADER *FmpPayloadHeader;