From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 8C44C9410DF for ; Wed, 25 Oct 2023 08:08:24 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=w53fX0UBII5nOnQqIfQGDSLCWxkoWQKh5O1N+jqpK2I=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1698221303; v=1; b=kNENzbPk2DhJjhIzaKBbnqIEhvlpu2wxw1Fu+dMOO/noB4G+kts6p2LvLdf/+QV2eMBZRHvg 0/kR5EZonlpOcppic/F/wzUKSvv9AnoAj7t8zUnBG3hv87U3gIF1KXG12sLsMYy/aJAtuSpbqRJ AxSwrbvw08y9Kh6/zo79YLlA= X-Received: by 127.0.0.2 with SMTP id 4qyeYY7687511x6cM59G8n3o; Wed, 25 Oct 2023 01:08:23 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by mx.groups.io with SMTP id smtpd.web11.38909.1698221300500414046 for ; Wed, 25 Oct 2023 01:08:22 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10873"; a="17591" X-IronPort-AV: E=Sophos;i="6.03,250,1694761200"; d="scan'208";a="17591" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2023 01:08:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10873"; a="882375513" X-IronPort-AV: E=Sophos;i="6.03,250,1694761200"; d="scan'208";a="882375513" X-Received: from lixiahua-desk2.ccr.corp.intel.com ([10.239.55.96]) by orsmga004.jf.intel.com with ESMTP; 25 Oct 2023 01:08:18 -0700 From: "Huang, Li-Xia" To: devel@edk2.groups.io Cc: Abner Chang , Nate DeSimone Subject: [edk2-devel] [PATCH v2 1/1] IpmiFeaturePkg/GenericIpmi: Support Standalone MM Date: Wed, 25 Oct 2023 16:08:17 +0800 Message-Id: <20231025080817.8906-1-lisa.huang@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lisa.huang@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: R4g7jQT06eDRcJLmlD5G4FHxx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=kNENzbPk; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Add Standalone Mm Generic Impi driver. And add type 'PcdsFixedAtBuild' for PcdIpmiSmmIoBaseAddress to access in StandaloneMm driver Cc: Abner Chang Cc: Nate DeSimone Signed-off-by: Lixia Huang --- Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm= /StandaloneMmGenericIpmi.c | 148 ++++++++++++++++++++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm= /StandaloneMmGenericIpmi.inf | 52 +++++++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec = | 2 + 3 files changed, 202 insertions(+) diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= StandaloneMm/StandaloneMmGenericIpmi.c b/Features/Intel/OutOfBandManagement= /IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.c new file mode 100644 index 000000000000..a8751f5b1a1d --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Standal= oneMm/StandaloneMmGenericIpmi.c @@ -0,0 +1,148 @@ +/** @file=0D + Generic StandaloneMm IPMI stack driver=0D +=0D + @copyright=0D + Copyright 2023 Intel Corporation.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +=0D +//=0D +// Statements that include other files=0D +//=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include "IpmiHooks.h"=0D +#include "IpmiBmcCommon.h"=0D +#include "IpmiBmc.h"=0D +#include =0D +=0D +IPMI_BMC_INSTANCE_DATA *mIpmiInstance;=0D +EFI_HANDLE mHandle;=0D +=0D +EFI_STATUS=0D +SmmInitializeIpmiKcsPhysicalLayer (=0D + VOID=0D + )=0D +/*++=0D +=0D +Routine Description:=0D + Setup and initialize the BMC for the SMM phase. In order to verify the = BMC is functioning=0D + as expected, the BMC Selftest is performed. The results are then checke= d and any errors are=0D + reported to the error manager. Errors are collected throughout this rou= tine and reported=0D + just prior to installing the driver. If there are more errors than MAX_= SOFT_COUNT, then they=0D + will be ignored.=0D +=0D +Arguments:=0D + ImageHandle - Handle of this driver image=0D + SystemTable - Table containing standard EFI services=0D +=0D +Returns:=0D + EFI_SUCCESS - Successful driver initialization=0D +=0D +--*/=0D +{=0D + EFI_STATUS Status;=0D +=0D + DEBUG ((DEBUG_INFO,"SmmInitializeIpmiKcsPhysicalLayer entry \n"));=0D +=0D + Status =3D gMmst->MmAllocatePool (=0D + EfiRuntimeServicesData,=0D + sizeof (IPMI_BMC_INSTANCE_DATA),=0D + (VOID **)&mIpmiInstance);=0D +=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "mIpmiInstance mem alloc failed - 0x%x\n", Status= ));=0D + return Status;=0D + } else {=0D +=0D + //=0D + // Initialize the KCS transaction timeout. Assume delay unit is 1000 u= s.=0D + //=0D + mIpmiInstance->KcsTimeoutPeriod =3D (BMC_KCS_TIMEOUT * 1000*1000) / KC= S_DELAY_UNIT;=0D +=0D + //=0D + // Initialize IPMI IO Base, we still use SMS IO base to get device ID = and Seltest result since SMM IF may have different cmds supported=0D + //=0D + mIpmiInstance->IpmiIoBase =3D FixedPcdGet16 (Pcd= IpmiSmmIoBaseAddress);=0D + mIpmiInstance->Signature =3D SM_IPMI_BMC_SIGNAT= URE;=0D + mIpmiInstance->SlaveAddress =3D BMC_SLAVE_ADDRESS;= =0D + mIpmiInstance->BmcStatus =3D BMC_NOTREADY;=0D + mIpmiInstance->IpmiTransport.IpmiSubmitCommand =3D IpmiSendCommand;=0D + mIpmiInstance->IpmiTransport.GetBmcStatus =3D IpmiGetBmcStatus;= =0D +=0D + mHandle =3D NULL;=0D + Status =3D gMmst->MmInstallProtocolInterface (=0D + &mHandle,=0D + &gSmmIpmiTransportProtocolGuid,=0D + EFI_NATIVE_INTERFACE,=0D + &mIpmiInstance->IpmiTransport=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + DEBUG ((DEBUG_INFO,"SmmInitializeIpmiKcsPhysicalLayer exit \n"));=0D +=0D + return EFI_SUCCESS;=0D + }=0D +}=0D +=0D +/**=0D + The module Entry Point of driver.=0D +=0D + @param ImageHandle The firmware allocated handle for the EFI image.= =0D + @param SystemTable A pointer to the MM System Table.=0D +=0D + @retval EFI_SUCCESS The entry point is executed successfully.=0D + @retval Other Some error occurs when executing this entry point= .=0D +=0D +**/=0D +EFI_STATUS=0D +InitializeGenericIpmiStandaloneMm (=0D + IN EFI_HANDLE ImageHandle,=0D + IN EFI_MM_SYSTEM_TABLE *SystemTable=0D + )=0D +{=0D + SmmInitializeIpmiKcsPhysicalLayer ();=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + Unloads an image.=0D +=0D + @param[in] ImageHandle Handle that identifies the image to be unl= oaded.=0D +=0D + @retval EFI_SUCCESS The image has been unloaded.=0D + @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +GenericIpmiStandaloneMmUnload (=0D + IN EFI_HANDLE ImageHandle=0D + )=0D +{=0D + EFI_STATUS Status;=0D +=0D + Status =3D EFI_SUCCESS;=0D + if (mIpmiInstance !=3D NULL) {=0D + if (mHandle !=3D NULL) {=0D + Status =3D gMmst->MmUninstallProtocolInterface (=0D + mHandle,=0D + &gSmmIpmiTransportProtocolGuid,=0D + &mIpmiInstance->IpmiTransport=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D + }=0D + gMmst->MmFreePool (mIpmiInstance);=0D + }=0D +=0D + return Status;=0D +}=0D diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= StandaloneMm/StandaloneMmGenericIpmi.inf b/Features/Intel/OutOfBandManageme= nt/IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.inf new file mode 100644 index 000000000000..336e28368ed6 --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Standal= oneMm/StandaloneMmGenericIpmi.inf @@ -0,0 +1,52 @@ +## @file=0D +# StandaloneMm Generic IPMI SMM Driver.=0D +#=0D +# @copyright=0D +# Copyright 2023 Intel Corporation.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010017=0D + BASE_NAME =3D StandaloneMmGenericIpmi=0D + FILE_GUID =3D 6899c3ea-0920-414f-9555-ad2f00f8= 1060=0D + MODULE_TYPE =3D MM_STANDALONE=0D + VERSION_STRING =3D 1.0=0D + PI_SPECIFICATION_VERSION =3D 0x00010032=0D + ENTRY_POINT =3D InitializeGenericIpmiStandaloneM= m=0D + UNLOAD_IMAGE =3D GenericIpmiStandaloneMmUnload=0D +=0D +[Sources]=0D + ../Common/IpmiHooks.h=0D + ../Common/IpmiHooks.c=0D + ../Common/IpmiBmcCommon.h=0D + ../Common/KcsBmc.c=0D + ../Common/KcsBmc.h=0D + ../Common/IpmiBmc.c=0D + ../Common/IpmiBmc.h=0D + StandaloneMmGenericIpmi.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + IpmiFeaturePkg/IpmiFeaturePkg.dec=0D +=0D +[LibraryClasses]=0D + MemoryAllocationLib=0D + BaseLib=0D + MmServicesTableLib=0D + DebugLib=0D + StandaloneMmDriverEntryPoint=0D + IoLib=0D + ReportStatusCodeLib=0D + TimerLib=0D +=0D +[Protocols]=0D + gSmmIpmiTransportProtocolGuid # PROTOCOL ALWAYS_PROD= UCED=0D +=0D +[Guids]=0D +=0D +[Pcd]=0D + gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiSmmIoBaseAddress=0D +=0D +[Depex]=0D + gIpmiTransportProtocolGuid=0D diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeatureP= kg.dec b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.d= ec index 5df71300cbd1..73dca30caae9 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec @@ -129,4 +129,6 @@ gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress|0xCA2|UINT16|0xD00000= 03=0D gIpmiFeaturePkgTokenSpaceGuid.PcdSioMailboxBaseAddress|0x600|UINT32|0xD0= 000004=0D gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiBmcReadyDelayTimer|120|UINT8|0xD000= 0005=0D +=0D +[PcdsFixedAtBuild, PcdsDynamic, PcdsDynamicEx]=0D gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiSmmIoBaseAddress|0xCA2|UINT16|0xD00= 00006=0D --=20 2.26.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110021): https://edk2.groups.io/g/devel/message/110021 Mute This Topic: https://groups.io/mt/102174067/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-