Reviewed-by: Nickle Wang <nick...@nvidia.com>
Regards, Nickle > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chang, Abner > via groups.io > Sent: Friday, May 12, 2023 3:29 PM > To: devel@edk2.groups.io > Cc: Isaac Oram <isaac.w.o...@intel.com>; Attar, AbdulLateef (Abdul Lateef) > <abdullateef.at...@amd.com>; Nickle Wang <nick...@nvidia.com>; Tinh > Nguyen <tinhngu...@os.amperecomputing.com> > Subject: [edk2-devel] [edk2-platforms][PATCH 1/2] > ManageabilityPkg/IpmiSolStatus: IPMI Serail over Lan Driver > > Caution: This message originated from an External Source. Use proper caution > when opening attachments, clicking links, or responding. > > > From: Abner Chang <abner.ch...@amd.com> > > IpmiSolStatus is cloned from > edk2-platforms/Features/Intel/OutOfBandManagement/ > IpmiFeaturePkg/SolStatus in order to consolidate > edk2 system manageability support in one place. > Uncustify is applied to C files and no functionalities are changed in this > patch. > > We will still keep the one under IpmiFeaturePkg/SolStatus until the reference > to > this instance are removed from platforms. > > 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: Tinh Nguyen <tinhngu...@os.amperecomputing.com> > --- > .../ManageabilityPkg/ManageabilityPkg.dec | 4 + > .../Universal/IpmiSolStatus/SolStatus.inf | 37 ++++ > .../Universal/IpmiSolStatus/SolStatus.c | 164 ++++++++++++++++++ > 3 files changed, 205 insertions(+) > create mode 100644 > Features/ManageabilityPkg/Universal/IpmiSolStatus/SolStatus.inf > create mode 100644 > Features/ManageabilityPkg/Universal/IpmiSolStatus/SolStatus.c > > diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec > b/Features/ManageabilityPkg/ManageabilityPkg.dec > index 38813c5f48..c11bf5d0df 100644 > --- a/Features/ManageabilityPkg/ManageabilityPkg.dec > +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec > @@ -72,6 +72,10 @@ > # @Prompt MCTP KCS (Memory mapped) I/O base address > > gManageabilityPkgTokenSpaceGuid.PcdMctpKcsBaseAddress|0xca2|UINT32|0x0 > 0000004 > > + ## This is the value of SOL channels supported on platform. > + # @Prompt SOL channel number > + > gManageabilityPkgTokenSpaceGuid.PcdMaxSolChannels|3|UINT8|0x00000100 > + > [PcdsFeatureFlag] > > gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiEnable|FALSE|BOO > LEAN|0x10000001 > > gManageabilityPkgTokenSpaceGuid.PcdManageabilitySmmIpmiEnable|FALSE|BO > OLEAN|0x10000002 > diff --git a/Features/ManageabilityPkg/Universal/IpmiSolStatus/SolStatus.inf > b/Features/ManageabilityPkg/Universal/IpmiSolStatus/SolStatus.inf > new file mode 100644 > index 0000000000..1d7cbf1a08 > --- /dev/null > +++ b/Features/ManageabilityPkg/Universal/IpmiSolStatus/SolStatus.inf > @@ -0,0 +1,37 @@ > +### @file > +# Component description file for IPMI Serial Over LAN (SOL) driver. > +# > +# Copyright (c) 2018 - 2019, Intel Corporation. All rights > +reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # ### > + > +[Defines] > + INF_VERSION = 0x00010005 > + BASE_NAME = SolStatus > + FILE_GUID = 1AF7E6C4-7678-4A6D-9240-E8BA17C3B772 > + MODULE_TYPE = DXE_DRIVER > + PI_SPECIFICATION_VERSION = 0x0001000A > + VERSION_STRING = 1.0 > + ENTRY_POINT = SolStatusEntryPoint > + > +[Sources] > + SolStatus.c > + > +[Packages] > + ManageabilityPkg/ManageabilityPkg.dec > + MdePkg/MdePkg.dec > + > +[Pcd] > + gManageabilityPkgTokenSpaceGuid.PcdMaxSolChannels > + > +[LibraryClasses] > + DebugLib > + IpmiCommandLib > + PcdLib > + UefiBootServicesTableLib > + UefiDriverEntryPoint > + > +[Depex] > + TRUE > diff --git a/Features/ManageabilityPkg/Universal/IpmiSolStatus/SolStatus.c > b/Features/ManageabilityPkg/Universal/IpmiSolStatus/SolStatus.c > new file mode 100644 > index 0000000000..996386372e > --- /dev/null > +++ b/Features/ManageabilityPkg/Universal/IpmiSolStatus/SolStatus.c > @@ -0,0 +1,164 @@ > +/** @file > + IPMI Serial Over Lan Driver. > + > +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR> > +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include <Uefi.h> > +#include <Library/BaseLib.h> > +#include <Library/DebugLib.h> > +#include <Library/BaseMemoryLib.h> > +#include <Library/MemoryAllocationLib.h> #include > +<Library/UefiBootServicesTableLib.h> > +#include <Library/UefiRuntimeServicesTableLib.h> > +#include <Library/IpmiCommandLib.h> > +#include <IndustryStandard/Ipmi.h> > + > +#define SOL_CMD_RETRY_COUNT 10 > + > +/*++ > + > +Routine Description: > + > + This routine gets the SOL payload status or settings for a specific > channel. > + > +Arguments: > + Channel - LAN channel naumber. > + ParamSel - Configuration parameter selection. > + Data - Information returned from BMC. > +Returns: > + EFI_SUCCESS - SOL configuration parameters are successfully read from > BMC. > + Others - SOL configuration parameters could not be read from > BMC. > + > +--*/ > +EFI_STATUS > +GetSolStatus ( > + IN UINT8 Channel, > + IN UINT8 ParamSel, > + IN OUT UINT8 *Data > + ) > +{ > + EFI_STATUS Status = EFI_SUCCESS; > + IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST > GetConfigurationParametersRequest; > + IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE > GetConfigurationParametersResponse; > + UINT32 DataSize; > + UINT8 RetryCount; > + > + for (RetryCount = 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) { > + ZeroMem (&GetConfigurationParametersRequest, sizeof > (GetConfigurationParametersRequest)); > + GetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber = > Channel; > + GetConfigurationParametersRequest.ParameterSelector = > ParamSel; > + > + ZeroMem (&GetConfigurationParametersResponse, sizeof > + (GetConfigurationParametersResponse)); > + > + DataSize = sizeof (GetConfigurationParametersResponse); > + Status = IpmiGetSolConfigurationParameters ( > + &GetConfigurationParametersRequest, > + &GetConfigurationParametersResponse, > + &DataSize > + ); > + > + if (Status == EFI_SUCCESS) { > + break; > + } else { > + gBS->Stall (100000); > + } > + } > + > + if (Status == EFI_SUCCESS) { > + *Data = GetConfigurationParametersResponse.ParameterData[0]; > + } > + > + return Status; > +} > + > +/*++ > + > +Routine Description: > + > + This routine sets the SOL payload configuration parameters for a specific > channel. > + > +Arguments: > + Channel - LAN channel naumber. > + ParamSel - Configuration parameter selection. > + Data - Configuration parameter values. > +Returns: > + EFI_SUCCESS - SOL configuration parameters are sent to BMC. > + Others - SOL configuration parameters could not be sent to BMC. > + > +--*/ > +EFI_STATUS > +SetSolParams ( > + IN UINT8 Channel, > + IN UINT8 ParamSel, > + IN UINT8 Data > + ) > +{ > + EFI_STATUS Status = EFI_SUCCESS; > + IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST > SetConfigurationParametersRequest; > + UINT8 CompletionCode; > + UINT8 RetryCount; > + > + for (RetryCount = 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) { > + ZeroMem (&SetConfigurationParametersRequest, sizeof > (SetConfigurationParametersRequest)); > + SetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber = > Channel; > + SetConfigurationParametersRequest.ParameterSelector = > ParamSel; > + SetConfigurationParametersRequest.ParameterData[0] = > Data; > + > + CompletionCode = 0; > + > + Status = IpmiSetSolConfigurationParameters ( > + &SetConfigurationParametersRequest, > + sizeof (SetConfigurationParametersRequest), > + &CompletionCode > + ); > + > + if (Status == EFI_SUCCESS) { > + break; > + } else { > + gBS->Stall (100000); > + } > + } > + > + return Status; > +} > + > +/*++ > + > + Routine Description: > + This is the standard EFI driver point. This function initializes > + the private data required for creating SOL Status Driver. > + > + Arguments: > + ImageHandle - Handle for the image of this driver > + SystemTable - Pointer to the EFI System Table > + > + Returns: > + EFI_SUCCESS - Protocol successfully installed > + EFI_UNSUPPORTED - Protocol can't be installed. > + > +--*/ > +EFI_STATUS > +EFIAPI > +SolStatusEntryPoint ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status = EFI_SUCCESS; > + UINT8 Channel; > + BOOLEAN SolEnabled = FALSE; > + > + for (Channel = 1; Channel <= PcdGet8 (PcdMaxSolChannels); Channel++) { > + Status = GetSolStatus (Channel, > IPMI_SOL_CONFIGURATION_PARAMETER_SOL_ENABLE, &SolEnabled); > + if (Status == EFI_SUCCESS) { > + DEBUG ((DEBUG_ERROR, "SOL enabling status for channel %x is %x\n", > Channel, SolEnabled)); > + } else { > + DEBUG ((DEBUG_ERROR, "Failed to get channel %x SOL status from BMC!, > status is %x\n", Channel, Status)); > + } > + } > + > + return Status; > +} > -- > 2.37.1.windows.1 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#105002): https://edk2.groups.io/g/devel/message/105002 Mute This Topic: https://groups.io/mt/98844864/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-