public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nickle Wang" <nicklew@nvidia.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Chang, Abner" <Abner.Chang@amd.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>,
	"Attar, AbdulLateef (Abdul Lateef)" <AbdulLateef.Attar@amd.com>,
	Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiSolStatus: IPMI Serail over Lan Driver
Date: Thu, 18 May 2023 02:50:07 +0000	[thread overview]
Message-ID: <MW4PR12MB7031E80970D8AE64CB1757A8D97F9@MW4PR12MB7031.namprd12.prod.outlook.com> (raw)
In-Reply-To: <175E54CFD537B4AA.27409@groups.io>


Reviewed-by: Nickle Wang <nicklew@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.oram@intel.com>; Attar, AbdulLateef (Abdul Lateef)
> <AbdulLateef.Attar@amd.com>; Nickle Wang <nicklew@nvidia.com>; Tinh
> Nguyen <tinhnguyen@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.chang@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.chang@amd.com>
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Cc: Abdul Lateef Attar <abdattar@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Tinh Nguyen <tinhnguyen@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
> 
> 
> 
> 
> 


       reply	other threads:[~2023-05-18  2:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <175E54CFD537B4AA.27409@groups.io>
2023-05-18  2:50 ` Nickle Wang [this message]
2023-05-12  7:29 [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiSolStatus: IPMI Serail over Lan Driver Chang, Abner
2023-05-19  3:16 ` [edk2-devel] " Isaac Oram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MW4PR12MB7031E80970D8AE64CB1757A8D97F9@MW4PR12MB7031.namprd12.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox