From: Abner Chang <abner.ch...@amd.com> Fix Uncrustify errors of IPMI protocol and KCS manageability transport library.
Signed-off-by: Abner Chang <abner.ch...@amd.com> Cc: Isaac Oram <isaac.w.o...@intel.com> Cc: Abdul Lateef Attar <abdat...@amd.com> Cc: Nickle Wang <nick...@nvidia.com> Cc: Igor Kulchytskyy <ig...@ami.com> --- .../Library/ManageabilityTransportLib.h | 8 ++-- .../IpmiProtocol/Pei/IpmiPpiInternal.h | 10 ++--- .../Dxe/ManageabilityTransportKcs.c | 6 ++- .../Universal/IpmiProtocol/Dxe/IpmiProtocol.c | 4 +- .../Universal/IpmiProtocol/Pei/IpmiPpi.c | 40 ++++++++++--------- .../Universal/IpmiProtocol/Smm/IpmiProtocol.c | 7 ++-- 6 files changed, 41 insertions(+), 34 deletions(-) diff --git a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h index ad6cd1a464..d86d0d87d5 100644 --- a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h @@ -74,13 +74,13 @@ typedef UINT32 MANAGEABILITY_TRANSPORT_CAPABILITY; /// Bit 0 #define MANAGEABILITY_TRANSPORT_CAPABILITY_MULTIPLE_TRANSFER_TOKENS 0x00000001 /// Bit 1 -#define MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER 0x00000002 +#define MANAGEABILITY_TRANSPORT_CAPABILITY_ASYNCHRONOUS_TRANSFER 0x00000002 /// Bit 2 - Reserved /// Bit 7:3 - Transport interface maximum payload size, which is (2 ^ bit[7:3] - 1) /// bit[7:3] means no maximum payload. -#define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_MASK 0x000000f8 -#define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_BIT_POSITION 3 - #define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE 0x00 +#define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_MASK 0x000000f8 +#define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_BIT_POSITION 3 +#define MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE 0x00 /// Bit 8:31 - Reserved /// diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.h b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.h index 7b6ab0f529..4b6bdc97a9 100644 --- a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.h +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiInternal.h @@ -17,11 +17,11 @@ #define MANAGEABILITY_IPMI_PPI_INTERNAL_FROM_LINK(a) CR (a, PEI_IPMI_PPI_INTERNAL, PeiIpmiPpi, MANAGEABILITY_IPMI_PPI_INTERNAL_SIGNATURE) typedef struct { - UINT32 Signature; - MANAGEABILITY_TRANSPORT_TOKEN *TransportToken; - MANAGEABILITY_TRANSPORT_CAPABILITY TransportCapability; - UINT32 TransportMaximumPayload; - PEI_IPMI_PPI PeiIpmiPpi; + UINT32 Signature; + MANAGEABILITY_TRANSPORT_TOKEN *TransportToken; + MANAGEABILITY_TRANSPORT_CAPABILITY TransportCapability; + UINT32 TransportMaximumPayload; + PEI_IPMI_PPI PeiIpmiPpi; } PEI_IPMI_PPI_INTERNAL; #endif // MANAGEABILITY_IPMI_PPI_INTERNAL_H_ diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c index 25d6e49886..91d3517bdb 100644 --- a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c @@ -221,7 +221,7 @@ KcsTransportTransmitReceive ( EFI_STATUS Status; MANAGEABILITY_IPMI_TRANSPORT_HEADER *TransmitHeader; - if (TransportToken == NULL || TransferToken == NULL) { + if ((TransportToken == NULL) || (TransferToken == NULL)) { DEBUG ((DEBUG_ERROR, "%a: Invalid transport token or transfer token.\n", __FUNCTION__)); return; } @@ -298,6 +298,7 @@ AcquireTransportSession ( DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for MANAGEABILITY_TRANSPORT_KCS\n", __FUNCTION__)); return EFI_OUT_OF_RESOURCES; } + KcsTransportToken->Token.Transport = AllocateZeroPool (sizeof (MANAGEABILITY_TRANSPORT)); if (KcsTransportToken->Token.Transport == NULL) { FreePool (KcsTransportToken); @@ -346,9 +347,10 @@ GetTransportCapability ( OUT MANAGEABILITY_TRANSPORT_CAPABILITY *TransportCapability ) { - if (TransportToken == NULL || TransportCapability == NULL) { + if ((TransportToken == NULL) || (TransportCapability == NULL)) { return EFI_INVALID_PARAMETER; } + *TransportCapability = 0; return EFI_SUCCESS; } diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c index c30132419d..40587a07af 100644 --- a/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c @@ -100,12 +100,14 @@ DxeIpmiEntry ( DEBUG ((DEBUG_ERROR, "%a: Failed to acquire transport interface for IPMI protocol - %r\n", __FUNCTION__, Status)); return Status; } + Status = GetTransportCapability (mTransportToken, &TransportCapability); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a: Failed to GetTransportCapability().\n", __FUNCTION__)); return Status; } - TransportMaximumPayload = MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY(TransportCapability); + + TransportMaximumPayload = MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY (TransportCapability); if (TransportMaximumPayload == (1 << MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE)) { DEBUG ((DEBUG_INFO, "%a: Transport interface maximum payload is undefined.\n", __FUNCTION__)); } else { diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c index 0dda6d2d47..0a914e513c 100644 --- a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c @@ -51,19 +51,19 @@ PeiIpmiSubmitCommand ( IN OUT UINT32 *ResponseDataSize ) { - EFI_STATUS Status; - PEI_IPMI_PPI_INTERNAL *PeiIpmiPpiinternal; - - PeiIpmiPpiinternal = MANAGEABILITY_IPMI_PPI_INTERNAL_FROM_LINK(This); - Status = CommonIpmiSubmitCommand ( - PeiIpmiPpiinternal->TransportToken, - NetFunction, - Command, - RequestData, - RequestDataSize, - ResponseData, - ResponseDataSize - ); + EFI_STATUS Status; + PEI_IPMI_PPI_INTERNAL *PeiIpmiPpiinternal; + + PeiIpmiPpiinternal = MANAGEABILITY_IPMI_PPI_INTERNAL_FROM_LINK (This); + Status = CommonIpmiSubmitCommand ( + PeiIpmiPpiinternal->TransportToken, + NetFunction, + Command, + RequestData, + RequestDataSize, + ResponseData, + ResponseDataSize + ); return Status; } @@ -90,18 +90,19 @@ PeiIpmiEntry ( MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS TransportAdditionalStatus; MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION HardwareInformation; - PeiIpmiPpiinternal = (PEI_IPMI_PPI_INTERNAL *)AllocateZeroPool (sizeof(PEI_IPMI_PPI_INTERNAL)); + PeiIpmiPpiinternal = (PEI_IPMI_PPI_INTERNAL *)AllocateZeroPool (sizeof (PEI_IPMI_PPI_INTERNAL)); if (PeiIpmiPpiinternal == NULL) { DEBUG ((DEBUG_ERROR, "%a: Not enough memory for PEI_IPMI_PPI_INTERNAL.\n", __FUNCTION__)); return EFI_OUT_OF_RESOURCES; } - PpiDescriptor = (EFI_PEI_PPI_DESCRIPTOR *)AllocateZeroPool (sizeof(EFI_PEI_PPI_DESCRIPTOR)); + + PpiDescriptor = (EFI_PEI_PPI_DESCRIPTOR *)AllocateZeroPool (sizeof (EFI_PEI_PPI_DESCRIPTOR)); if (PpiDescriptor == NULL) { DEBUG ((DEBUG_ERROR, "%a: Not enough memory for EFI_PEI_PPI_DESCRIPTOR.\n", __FUNCTION__)); return EFI_OUT_OF_RESOURCES; } - PeiIpmiPpiinternal->Signature = MANAGEABILITY_IPMI_PPI_INTERNAL_SIGNATURE; + PeiIpmiPpiinternal->Signature = MANAGEABILITY_IPMI_PPI_INTERNAL_SIGNATURE; PeiIpmiPpiinternal->PeiIpmiPpi.IpmiSubmitCommand = PeiIpmiSubmitCommand; PpiDescriptor->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; @@ -116,18 +117,19 @@ PeiIpmiEntry ( DEBUG ((DEBUG_ERROR, "%a: Failed to acquire transport interface for IPMI protocol - %r\n", __FUNCTION__, Status)); return Status; } + Status = GetTransportCapability (PeiIpmiPpiinternal->TransportToken, &PeiIpmiPpiinternal->TransportCapability); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a: Failed to GetTransportCapability().\n", __FUNCTION__)); return Status; } - PeiIpmiPpiinternal->TransportMaximumPayload = MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY(PeiIpmiPpiinternal->TransportCapability); + PeiIpmiPpiinternal->TransportMaximumPayload = MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY (PeiIpmiPpiinternal->TransportCapability); if (PeiIpmiPpiinternal->TransportMaximumPayload == (1 << MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE)) { - DEBUG((DEBUG_INFO, "%a: Transport interface maximum payload is undefined.\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a: Transport interface maximum payload is undefined.\n", __FUNCTION__)); } else { PeiIpmiPpiinternal->TransportMaximumPayload -= 1; - DEBUG((DEBUG_INFO, "%a: Transport interface for IPMI protocol has maximum payload 0x%x.\n", __FUNCTION__, PeiIpmiPpiinternal->TransportMaximumPayload)); + DEBUG ((DEBUG_INFO, "%a: Transport interface for IPMI protocol has maximum payload 0x%x.\n", __FUNCTION__, PeiIpmiPpiinternal->TransportMaximumPayload)); } TransportName = HelperManageabilitySpecName (PeiIpmiPpiinternal->TransportToken->Transport->ManageabilityTransportSpecification); diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c index 86dee2fa24..41b9a10453 100644 --- a/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c @@ -107,12 +107,13 @@ SmmIpmiEntry ( DEBUG ((DEBUG_ERROR, "%a: Failed to GetTransportCapability().\n", __FUNCTION__)); return Status; } - TransportMaximumPayload = MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY(TransportCapability); + + TransportMaximumPayload = MANAGEABILITY_TRANSPORT_PAYLOAD_SIZE_FROM_CAPABILITY (TransportCapability); if (TransportMaximumPayload == (1 << MANAGEABILITY_TRANSPORT_CAPABILITY_MAXIMUM_PAYLOAD_NOT_AVAILABLE)) { - DEBUG((DEBUG_INFO, "%a: Transport interface maximum payload is undefined.\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a: Transport interface maximum payload is undefined.\n", __FUNCTION__)); } else { TransportMaximumPayload -= 1; - DEBUG((DEBUG_INFO, "%a: Transport interface for IPMI protocol has maximum payload 0x%x.\n", __FUNCTION__, TransportMaximumPayload)); + DEBUG ((DEBUG_INFO, "%a: Transport interface for IPMI protocol has maximum payload 0x%x.\n", __FUNCTION__, TransportMaximumPayload)); } mTransportName = HelperManageabilitySpecName (mTransportToken->Transport->ManageabilityTransportSpecification); -- 2.37.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#102417): https://edk2.groups.io/g/devel/message/102417 Mute This Topic: https://groups.io/mt/98037367/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-