From: Abner Chang <abner.ch...@amd.com> Run Uncrustify on the C source files those were modified in commit ID from 3f4c4384 to 28ff8f29.
Signed-off-by: Abner Chang <abner.ch...@amd.com> Cc: Abdul Lateef Attar <abdullateef.at...@amd.com> Cc: Nickle Wang <nick...@nvidia.com> Cc: Konstantin Aladyshev <aladyshe...@gmail.com> --- .../Include/Library/BasePldmProtocolLib.h | 6 ++--- .../PldmProtocol/Common/PldmProtocolCommon.h | 4 ++-- .../Common/KcsCommon.c | 2 +- .../PldmProtocolLibrary/Dxe/PldmProtocolLib.c | 10 ++++----- .../MctpProtocol/Common/MctpProtocolCommon.c | 22 ++++++++++++------- .../Universal/MctpProtocol/Dxe/MctpProtocol.c | 6 +++-- .../PldmProtocol/Common/PldmProtocolCommon.c | 12 +++++----- .../Universal/PldmProtocol/Dxe/PldmProtocol.c | 8 +++---- .../PldmSmbiosTransferDxe.c | 2 +- 9 files changed, 40 insertions(+), 32 deletions(-) diff --git a/Features/ManageabilityPkg/Include/Library/BasePldmProtocolLib.h b/Features/ManageabilityPkg/Include/Library/BasePldmProtocolLib.h index a698197263..404474a023 100644 --- a/Features/ManageabilityPkg/Include/Library/BasePldmProtocolLib.h +++ b/Features/ManageabilityPkg/Include/Library/BasePldmProtocolLib.h @@ -21,9 +21,9 @@ **/ EFI_STATUS PldmSetTerminus ( - IN UINT8 SourceId, - IN UINT8 DestinationId -); + IN UINT8 SourceId, + IN UINT8 DestinationId + ); /** This service enables submitting commands via EDKII PLDM protocol. diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.h b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.h index eb273c4f46..30f4d95847 100644 --- a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.h +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.h @@ -12,8 +12,8 @@ #include <IndustryStandard/Pldm.h> #include <Library/ManageabilityTransportLib.h> -#define GET_PLDM_MESSAGE_PAYLOAD_SIZE(PayloadSize) (PayloadSize - sizeof (PLDM_RESPONSE_HEADER)) -#define GET_PLDM_MESSAGE_PAYLOAD_PTR(PayloadPtr) ((UINT8 *)PayloadPtr + sizeof (PLDM_RESPONSE_HEADER)) +#define GET_PLDM_MESSAGE_PAYLOAD_SIZE(PayloadSize) (PayloadSize - sizeof (PLDM_RESPONSE_HEADER)) +#define GET_PLDM_MESSAGE_PAYLOAD_PTR(PayloadPtr) ((UINT8 *)PayloadPtr + sizeof (PLDM_RESPONSE_HEADER)) typedef struct { UINT8 PldmType; diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/KcsCommon.c b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/KcsCommon.c index 4f7e7d450f..d80267cb57 100644 --- a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/KcsCommon.c +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/KcsCommon.c @@ -496,7 +496,6 @@ KcsReadResponseHeader ( *ResponseHeader = NULL; if (CompareGuid (&gManageabilityProtocolMctpGuid, mSingleSessionToken->Token.ManageabilityProtocolSpecification)) { - // For MCTP over KCS ExpectedHeaderSize = sizeof (MANAGEABILITY_MCTP_KCS_HEADER); DEBUG (( @@ -711,6 +710,7 @@ KcsTransportSendCommand ( *ResponseDataSize = ((MANAGEABILITY_MCTP_KCS_HEADER *)RspHeader)->ByteCount; } + FreePool (RspHeader); ExpectedResponseDataSize = *ResponseDataSize; diff --git a/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.c b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.c index 37231b0756..9e1e664d6b 100644 --- a/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.c +++ b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.c @@ -29,9 +29,9 @@ UINT8 mDestinationPldmTerminusId = 0; **/ EFI_STATUS PldmSetTerminus ( - IN UINT8 SourceId, - IN UINT8 DestinationId -) + IN UINT8 SourceId, + IN UINT8 DestinationId + ) { mSourcePldmTerminusId = SourceId; mDestinationPldmTerminusId = DestinationId; @@ -111,6 +111,7 @@ PldmSubmitCommand ( return Status; } + /** Initialize mSourcePldmTerminusId and mDestinationPldmTerminusId. @@ -128,7 +129,6 @@ PldmProtocolLibConstructor ( IN EFI_SYSTEM_TABLE *SystemTable ) { - - PldmSetTerminus (PcdGet8(PcdPldmSourceTerminusId), PcdGet8(PcdPldmDestinationEndpointId)); + PldmSetTerminus (PcdGet8 (PcdPldmSourceTerminusId), PcdGet8 (PcdPldmDestinationEndpointId)); return EFI_SUCCESS; } diff --git a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCommon.c b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCommon.c index 3709ab16eb..5509ed5ada 100644 --- a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCommon.c +++ b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCommon.c @@ -129,11 +129,11 @@ SetupMctpRequestTransportPacket ( OUT UINT16 *PacketTrailerSize ) { - MANAGEABILITY_MCTP_KCS_HEADER *MctpKcsHeader; - MCTP_TRANSPORT_HEADER *MctpTransportHeader; - MCTP_MESSAGE_HEADER *MctpMessageHeader; - MANAGEABILITY_MCTP_KCS_TRAILER *MctpKcsTrailer; - UINT8 *ThisPackage; + MANAGEABILITY_MCTP_KCS_HEADER *MctpKcsHeader; + MCTP_TRANSPORT_HEADER *MctpTransportHeader; + MCTP_MESSAGE_HEADER *MctpMessageHeader; + MANAGEABILITY_MCTP_KCS_TRAILER *MctpKcsTrailer; + UINT8 *ThisPackage; if ((PacketHeader == NULL) || (PacketHeaderSize == NULL) || (PacketBody == NULL) || (PacketBodySize == NULL) || @@ -462,7 +462,7 @@ CommonMctpSubmitMessage ( ); *AdditionalTransferError = TransferToken.TransportAdditionalStatus; - Status = TransferToken.TransferStatus; + Status = TransferToken.TransferStatus; if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a: Failed to send MCTP command over %s: %r\n", __func__, mTransportName, Status)); return Status; @@ -480,6 +480,7 @@ CommonMctpSubmitMessage ( FreePool (ResponseBuffer); return EFI_DEVICE_ERROR; } + if (MctpTransportResponseHeader->Bits.MessageTag != MCTP_MESSAGE_TAG) { DEBUG (( DEBUG_ERROR, @@ -491,6 +492,7 @@ CommonMctpSubmitMessage ( FreePool (ResponseBuffer); return EFI_DEVICE_ERROR; } + if (MctpTransportResponseHeader->Bits.TagOwner != MCTP_MESSAGE_TAG_OWNER_RESPONSE) { DEBUG (( DEBUG_ERROR, @@ -502,6 +504,7 @@ CommonMctpSubmitMessage ( FreePool (ResponseBuffer); return EFI_DEVICE_ERROR; } + if (MctpTransportResponseHeader->Bits.SourceEndpointId != MctpDestinationEndpointId) { DEBUG (( DEBUG_ERROR, @@ -513,6 +516,7 @@ CommonMctpSubmitMessage ( FreePool (ResponseBuffer); return EFI_DEVICE_ERROR; } + if (MctpTransportResponseHeader->Bits.DestinationEndpointId != MctpSourceEndpointId) { DEBUG (( DEBUG_ERROR, @@ -524,9 +528,11 @@ CommonMctpSubmitMessage ( FreePool (ResponseBuffer); return EFI_DEVICE_ERROR; } + if ((MctpTransportResponseHeader->Bits.StartOfMessage != 1) || (MctpTransportResponseHeader->Bits.EndOfMessage != 1) || - (MctpTransportResponseHeader->Bits.PacketSequence != 0)) { + (MctpTransportResponseHeader->Bits.PacketSequence != 0)) + { DEBUG (( DEBUG_ERROR, "%a: Error! Multiple-packet MCTP responses are not supported by the current driver\n", @@ -561,7 +567,7 @@ CommonMctpSubmitMessage ( return EFI_DEVICE_ERROR; } - *ResponseDataSize = TransferToken.ReceivePackage.ReceiveSizeInByte - sizeof (MCTP_TRANSPORT_HEADER) - sizeof (MCTP_MESSAGE_HEADER); + *ResponseDataSize = TransferToken.ReceivePackage.ReceiveSizeInByte - sizeof (MCTP_TRANSPORT_HEADER) - sizeof (MCTP_MESSAGE_HEADER); CopyMem (ResponseData, ResponseBuffer + sizeof (MCTP_TRANSPORT_HEADER) + sizeof (MCTP_MESSAGE_HEADER), *ResponseDataSize); FreePool (ResponseBuffer); diff --git a/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c b/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c index 73445bf816..a133341906 100644 --- a/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c +++ b/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c @@ -105,14 +105,16 @@ MctpSubmitMessage ( // if ((SourceEid >= MCTP_RESERVED_ENDPOINT_START_ID) && (SourceEid <= MCTP_RESERVED_ENDPOINT_END_ID) - ) { + ) + { DEBUG ((DEBUG_ERROR, "%a: The value of MCTP source EID (%x) is reserved.\n", __func__, MctpSourceEndpointId)); return EFI_INVALID_PARAMETER; } if ((DestinationEid >= MCTP_RESERVED_ENDPOINT_START_ID) && (DestinationEid <= MCTP_RESERVED_ENDPOINT_END_ID) - ) { + ) + { DEBUG ((DEBUG_ERROR, "%a: The value of MCTP destination EID (%x) is reserved.\n", __func__, MctpDestinationEndpointId)); return EFI_INVALID_PARAMETER; } diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.c b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.c index 2f2f76603e..bb38520ec0 100644 --- a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.c +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.c @@ -231,7 +231,7 @@ CommonPldmSubmitCommand ( TransferToken.TransmitPackage.TransmitTimeoutInMillisecond = MANAGEABILITY_TRANSPORT_NO_TIMEOUT; // Set receive packet. - if (ResponseData == NULL && *ResponseDataSize == 0) { + if ((ResponseData == NULL) && (*ResponseDataSize == 0)) { FullPacketResponseDataSize = sizeof (PLDM_RESPONSE_HEADER); } else { FullPacketResponseDataSize = *ResponseDataSize + sizeof (PLDM_RESPONSE_HEADER); @@ -326,16 +326,16 @@ CommonPldmSubmitCommand ( goto ErrorExit; } - if (*ResponseDataSize < GET_PLDM_MESSAGE_PAYLOAD_SIZE(TransferToken.ReceivePackage.ReceiveSizeInByte)) { + if (*ResponseDataSize < GET_PLDM_MESSAGE_PAYLOAD_SIZE (TransferToken.ReceivePackage.ReceiveSizeInByte)) { DEBUG ((DEBUG_ERROR, " The size of response is not matched to RequestDataSize assigned by caller.\n")); DEBUG (( DEBUG_ERROR, "Caller expects %d, the response size minus PLDM_RESPONSE_HEADER size is %d, Completion Code %d.\n", *ResponseDataSize, - GET_PLDM_MESSAGE_PAYLOAD_SIZE(TransferToken.ReceivePackage.ReceiveSizeInByte), + GET_PLDM_MESSAGE_PAYLOAD_SIZE (TransferToken.ReceivePackage.ReceiveSizeInByte), ResponseHeader->PldmCompletionCode )); - HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, GET_PLDM_MESSAGE_PAYLOAD_SIZE(TransferToken.ReceivePackage.ReceiveSizeInByte), "Failed response payload\n"); + HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, GET_PLDM_MESSAGE_PAYLOAD_SIZE (TransferToken.ReceivePackage.ReceiveSizeInByte), "Failed response payload\n"); Status = EFI_DEVICE_ERROR; goto ErrorExit; } @@ -345,10 +345,10 @@ CommonPldmSubmitCommand ( // Copy response data (without header) to caller's buffer. if ((ResponseData != NULL) && (*ResponseDataSize != 0)) { - *ResponseDataSize = GET_PLDM_MESSAGE_PAYLOAD_SIZE(TransferToken.ReceivePackage.ReceiveSizeInByte); + *ResponseDataSize = GET_PLDM_MESSAGE_PAYLOAD_SIZE (TransferToken.ReceivePackage.ReceiveSizeInByte); CopyMem ( (VOID *)ResponseData, - GET_PLDM_MESSAGE_PAYLOAD_PTR(FullPacketResponseData), + GET_PLDM_MESSAGE_PAYLOAD_PTR (FullPacketResponseData), *ResponseDataSize ); } diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocol.c b/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocol.c index 058f98e677..fce8029b9c 100644 --- a/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocol.c +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocol.c @@ -63,7 +63,7 @@ PldmSubmitCommand ( // // Check the given input parameters. // - if (RequestData == NULL && RequestDataSize != 0) { + if ((RequestData == NULL) && (RequestDataSize != 0)) { DEBUG (( DEBUG_ERROR, "%a: RequestDataSize != 0, however RequestData is NULL for PLDM type: 0x%x, Command: 0x%x.\n", @@ -74,7 +74,7 @@ PldmSubmitCommand ( return EFI_INVALID_PARAMETER; } - if (RequestData != NULL && RequestDataSize == 0) { + if ((RequestData != NULL) && (RequestDataSize == 0)) { DEBUG (( DEBUG_ERROR, "%a: RequestDataSize == 0, however RequestData is not NULL for PLDM type: 0x%x, Command: 0x%x.\n", @@ -85,7 +85,7 @@ PldmSubmitCommand ( return EFI_INVALID_PARAMETER; } - if (ResponseData == NULL && *ResponseDataSize != 0) { + if ((ResponseData == NULL) && (*ResponseDataSize != 0)) { DEBUG (( DEBUG_ERROR, "%a: *ResponseDataSize != 0, however ResponseData is NULL for PLDM type: 0x%x, Command: 0x%x.\n", @@ -96,7 +96,7 @@ PldmSubmitCommand ( return EFI_INVALID_PARAMETER; } - if (ResponseData != NULL && *ResponseDataSize == 0) { + if ((ResponseData != NULL) && (*ResponseDataSize == 0)) { DEBUG (( DEBUG_ERROR, "%a: *ResponseDataSize == 0, however ResponseData is not NULL for PLDM type: 0x%x, Command: 0x%x.\n", diff --git a/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.c b/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.c index 357a7d49e4..81e9adf571 100644 --- a/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.c +++ b/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.c @@ -49,7 +49,7 @@ SetPldmSmbiosTransferTerminusId ( IN UINT8 DestinationId ) { - return PldmSetTerminus(SourceId, DestinationId); + return PldmSetTerminus (SourceId, DestinationId); } /** -- 2.37.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110079): https://edk2.groups.io/g/devel/message/110079 Mute This Topic: https://groups.io/mt/102195867/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-