REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4522
"if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {" will not be executed in current code, put it within "case SysInterfaceKcs:" to avoid this issue. M: Isaac Oram <isaac.w.o...@intel.com> M: Nate DeSimone <nathaniel.l.desim...@intel.com> R: Liming Gao <gaolim...@byosoft.com.cn> Signed-off-by: Yanbo Huang <yanbo.hu...@intel.com> --- .../IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c | 36 ++++++++---------- .../GenericIpmi/Pei/PeiGenericIpmi.c | 36 ++++++++---------- .../GenericIpmi/Smm/SmmGenericIpmi.c | 38 +++++++++---------- 3 files changed, 49 insertions(+), 61 deletions(-) diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c index 7113556df8..82f6d2a661 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c @@ -630,8 +630,8 @@ InitializeIpmiKcsPhysicalLayer ( // Check interface data initialized successfully else register notify protocol. for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) { switch (Index) { - if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) { - case SysInterfaceKcs: + case SysInterfaceKcs: + if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) { if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && (mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) { BMC_INTERFACE_STATUS BmcStatus; mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitialized; @@ -646,21 +646,19 @@ InitializeIpmiKcsPhysicalLayer ( mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitError; } } + } + break; - break; - } - - if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) { - case SysInterfaceBt: + case SysInterfaceBt: + if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) { if (mIpmiInstance->IpmiTransport2.Interface.Bt.InterfaceState == IpmiInterfaceInitialized) { InterfaceState = IpmiInterfaceInitialized; } + } + break; - break; - } - - if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) { - case SysInterfaceSsif: + case SysInterfaceSsif: + if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) { if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitialized) { InterfaceState = IpmiInterfaceInitialized; } else if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitError) { @@ -669,12 +667,11 @@ InitializeIpmiKcsPhysicalLayer ( &mIpmiInstance->IpmiTransport2.Interface.Ssif.SsifInterfaceApiGuid ); } + } + break; - break; - } - - if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) { - case SysInterfaceIpmb: + case SysInterfaceIpmb: + if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) { if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitialized) { InterfaceState = IpmiInterfaceInitialized; } else if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitError) { @@ -683,9 +680,8 @@ InitializeIpmiKcsPhysicalLayer ( &mIpmiInstance->IpmiTransport2.Interface.Ipmb.IpmbInterfaceApiGuid ); } - - break; - } + } + break; default: break; diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c index 1d8266a0b1..ebc9e7085d 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c @@ -343,8 +343,8 @@ PeiInitializeIpmiKcsPhysicalLayer ( // Check interface data initialized successfully else register notify protocol. for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) { switch (Index) { - if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) { - case SysInterfaceKcs: + case SysInterfaceKcs: + if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) { if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && (mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) { BMC_INTERFACE_STATUS BmcStatus; mIpmiInstance->IpmiTransport2Ppi.Interface.KcsInterfaceState = IpmiInterfaceInitialized; @@ -359,42 +359,38 @@ PeiInitializeIpmiKcsPhysicalLayer ( mIpmiInstance->IpmiTransport2Ppi.Interface.KcsInterfaceState = IpmiInterfaceInitError; } } + } + break; - break; - } - - if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) { - case SysInterfaceBt: + case SysInterfaceBt: + if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) { if (mIpmiInstance->IpmiTransport2Ppi.Interface.Bt.InterfaceState == IpmiInterfaceInitialized) { InterfaceState = IpmiInterfaceInitialized; } + } + break; - break; - } - - if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) { - case SysInterfaceSsif: + case SysInterfaceSsif: + if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) { if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.InterfaceState == IpmiInterfaceInitialized) { InterfaceState = IpmiInterfaceInitialized; } else if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.InterfaceState == IpmiInterfaceInitError) { // Register protocol notify for SMBUS Protocol. Status = RegisterPpiCallback (PeiServices, &mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.SsifInterfaceApiGuid); } + } + break; - break; - } - - if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) { - case SysInterfaceIpmb: + case SysInterfaceIpmb: + if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) { if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.InterfaceState == IpmiInterfaceInitialized) { InterfaceState = IpmiInterfaceInitialized; } else if (mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.InterfaceState == IpmiInterfaceInitError) { // Register protocol notify for SMBUS Protocol. Status = RegisterPpiCallback (PeiServices, &mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.IpmbInterfaceApiGuid); } - - break; - } + } + break; default: break; diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c index 350d6afef5..2349373317 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c @@ -210,7 +210,7 @@ SmmNotifyCallback ( &mIpmiInstance->IpmiTransport2 ); } - + ASSERT_EFI_ERROR (Status); return EFI_SUCCESS; } @@ -335,8 +335,8 @@ Returns: // Check interface data initialized successfully else register notify protocol. for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) { switch (Index) { - if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) { - case SysInterfaceKcs: + case SysInterfaceKcs: + if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) { if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && (mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) { BMC_INTERFACE_STATUS BmcStatus; mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitialized; @@ -351,42 +351,38 @@ Returns: mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = IpmiInterfaceInitError; } } + } + break; - break; - } - - if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) { - case SysInterfaceBt: + case SysInterfaceBt: + if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) { if (mIpmiInstance->IpmiTransport2.Interface.Bt.InterfaceState == IpmiInterfaceInitialized) { InterfaceState = IpmiInterfaceInitialized; } + } + break; - break; - } - - if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) { - case SysInterfaceSsif: + case SysInterfaceSsif: + if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) { if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitialized) { InterfaceState = IpmiInterfaceInitialized; } else if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == IpmiInterfaceInitError) { // Register protocol notify for SMBUS Protocol. Status = SmmRegisterProtocolCallback (&mIpmiInstance->IpmiTransport2.Interface.Ssif.SsifInterfaceApiGuid); } + } + break; - break; - } - - if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) { - case SysInterfaceIpmb: + case SysInterfaceIpmb: + if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) { if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitialized) { InterfaceState = IpmiInterfaceInitialized; } else if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == IpmiInterfaceInitError) { // Register protocol notify for SMBUS Protocol. Status = SmmRegisterProtocolCallback (&mIpmiInstance->IpmiTransport2.Interface.Ipmb.IpmbInterfaceApiGuid); } - - break; - } + } + break; default: break; -- 2.31.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108295): https://edk2.groups.io/g/devel/message/108295 Mute This Topic: https://groups.io/mt/101185469/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-