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 3AAE6D80A14 for ; Fri, 20 Oct 2023 06:46:21 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Mj7Db6wNfBKDD9mduXJSwYELyk1+GftjxaEmc0MLtIs=; 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=1697784379; v=1; b=lWWqaqCjGk9x5B3WDmt0hYVDhDGTVRoR3SphXlve61tKtTARj5+uk0TvH7zcpuzGA9MkZQzr OMKF6PwosXSehvxedCSfc7ybIPLAlkaCBOiLyjoGfkXz0KBlAdR9Gp3UerBt2RN8EvD9U9Zlylb gGrmR5H1Z1vRPU7tAlLQLEcE= X-Received: by 127.0.0.2 with SMTP id t6qdYY7687511xFu6y3QdNgN; Thu, 19 Oct 2023 23:46:19 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.49006.1697784378979588707 for ; Thu, 19 Oct 2023 23:46:19 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10868"; a="390325420" X-IronPort-AV: E=Sophos;i="6.03,238,1694761200"; d="scan'208";a="390325420" X-Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2023 23:46:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10868"; a="750818756" X-IronPort-AV: E=Sophos;i="6.03,238,1694761200"; d="scan'208";a="750818756" X-Received: from lixiahua-desk2.ccr.corp.intel.com ([10.239.55.96]) by orsmga007.jf.intel.com with ESMTP; 19 Oct 2023 23:46:16 -0700 From: "Huang, Li-Xia" To: devel@edk2.groups.io Cc: Isaac Oram , Nate DeSimone Subject: [edk2-devel] [PATCH v1 1/1] IpmiFeaturePkg/GenericIpmi: Support Standalone MM Date: Fri, 20 Oct 2023 14:46:16 +0800 Message-Id: <20231020064616.6637-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: XgjdmnWxb4qfQ4BYsaDOrDlHx7686176AA= 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=lWWqaqCj; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none) Add Standalone Mm Generic Impi driver. And add type 'PcdsFixedAtBuild' for PcdIpmiSmmIoBaseAddress to access in StandaloneMm driver Cc: Isaac Oram 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..52d8d2abdd0d --- /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 +} \ No newline at end of file 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 (#109823): https://edk2.groups.io/g/devel/message/109823 Mute This Topic: https://groups.io/mt/102076516/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-