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 F202BD8065A for ; Mon, 11 Dec 2023 21:15:32 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=fY+5lfYjBqSMS0XB7+1OIyLcjC8pv/VzMIRMLMzLWzU=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1702329331; v=1; b=WQHTn9F4NwrYXQjWfc7AgHsW70MiMNBx7SsxCoYa3Nyml2bneonpP8UIsGHMiCZ5uHNTI0dv v/H/B8Rz4W8jMqppCcmLWOIkf6B11PwVuQFer+riX4LBSno+AQkEoKcORej3dJJIP71Cs/CJupc jkl4g2C6hMyZVUJbd9bPOclk= X-Received: by 127.0.0.2 with SMTP id LD40YY7687511xMwkgxpKqF2; Mon, 11 Dec 2023 13:15:31 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.3149.1702329330739125472 for ; Mon, 11 Dec 2023 13:15:30 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10921"; a="398559170" X-IronPort-AV: E=Sophos;i="6.04,268,1695711600"; d="scan'208";a="398559170" X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Dec 2023 13:15:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10921"; a="891310730" X-IronPort-AV: E=Sophos;i="6.04,268,1695711600"; d="scan'208";a="891310730" X-Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga002.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Dec 2023 13:15:10 -0800 X-Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Dec 2023 13:15:09 -0800 X-Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Dec 2023 13:15:09 -0800 X-Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 11 Dec 2023 13:15:09 -0800 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.168) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 11 Dec 2023 13:15:06 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AG7opcFxwMQo/W037pU7gd3tvEgEmuMmeE+wOZwjpZzCr1Q4+o/542eB+qSE+GJ1zv1wL5I00ylVZ9kjej6JVhu3vlyey4xEI3vVY8s7LE2d+BfHhYDRXm+CJop9O98Bf2nkTBgWDQKAdC+IxrEg2JRQxG/mZt3zGczVdnW90QF2X35uHHjinixnAA1oGj1Wq/I7pWCBwnaHqRU5dlpWzBb9heC7a38MwUj9H3NzeBaa1olPzA/En2buI413OKl2dRlFrID4m0Q7dX4dHP/wj5ebMaDT2O/IFo9iRVk2sLJ3LC238kprSVEIK3kRror4J+E7hbMd92lH8+VFqyayFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=81ewcCXdP6UhVGB5bgbb3My5PlqXXzBjD4fmlaBAaaw=; b=RJOD6g+cMejjFNxQ0UNjd9JNh9/ZyJgT1UXfeimmxvresyOSBmZBuUH4BMnPkYmtZ9Lcddv9LM53G1JKqHkEkqT22W8iFiry3qFY1Szh8378822jsV0Yg9/XjagoMeIT2u5SpW31kiL5AVD4LjOK7eWXviuOzeOJDVyKpnTDGBosk2PIkOKRnHw7irqw1CGXQ1MeAa+8YxoKjc0B5PeodxHUdT4D8A0gmoqKOpS73QAnZm8sWDICgD1zao6D9mx0HcMZbWBmHVmdkpsaYlrI4ysrd6icfkgwCjjcq1SvagDUMKpvbZfj+Z0QW4bwtSv3OnheDv8EwfIVPorhg8uZqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from MW4PR11MB5821.namprd11.prod.outlook.com (2603:10b6:303:184::5) by DM4PR11MB5550.namprd11.prod.outlook.com (2603:10b6:5:38b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 21:15:03 +0000 X-Received: from MW4PR11MB5821.namprd11.prod.outlook.com ([fe80::ced7:2db7:4cae:ab0]) by MW4PR11MB5821.namprd11.prod.outlook.com ([fe80::ced7:2db7:4cae:ab0%7]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 21:15:03 +0000 From: "Nate DeSimone" To: "Huang, Li-Xia" , "devel@edk2.groups.io" CC: Abner Chang Subject: Re: [edk2-devel] [PATCH v1 1/1] IpmiFeaturePkg/GenericIpmi: Sync change from SMM Thread-Topic: [PATCH v1 1/1] IpmiFeaturePkg/GenericIpmi: Sync change from SMM Thread-Index: AQHaKBHNKt2XvGrj+0yW3IWDiDHuqLCkngHw Date: Mon, 11 Dec 2023 21:15:03 +0000 Message-ID: References: <20231206065936.7518-1-lisa.huang@intel.com> In-Reply-To: <20231206065936.7518-1-lisa.huang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR11MB5821:EE_|DM4PR11MB5550:EE_ x-ms-office365-filtering-correlation-id: 2ee4640a-6ef8-4de8-b5c5-08dbfa8e3e06 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: kEQvaTtxdFhcXbWJJdQ4wSJ5+GMmj7XhqWZtbAeZQGLWotO1QoC8szq2LcTCBYuuyXFzTxEH5Lhao5RromJiGgiYI9jPjHvWMUnViFDamy6sik7kVLnpVNm0iI6Huoi/SdtQ+qMlvFuhHffypCrZO1TeCEf0LK6EAuvl9dphYr9TqnskWTbUVBCuxjammq/9rXHkczBeUrxk1BQ4I1u1w8MZgx6E4CJHjqO/pSl642G/9GMbXFDykATkTPeIYU2jHyTCMw2zXrbejbbB5adugtGYekUPqSmQ/Kd8L/La2Gyezdat+eeQqpc+8GNCfTWxGoufYtaV7tpeSH6HsvQ+FY7GUDCiAdvSCHcuwXTI+4Yzsp37HHF9Ig27ZN0RDvhYrJ1bVp1BMSnA4v24YgB1KW/UAmPwfWr7Ulw9fwRqxrsmlEtGOn0Be73VuorsKkuGD+jyiwR1o022fIs63g28R0FJQBRX7DMo/3QWmkjr2Id7nWOT3ZjU3XyRJ741Mx3cb8jD/Jsdxhg3LowBA7+CMdNbA9PoNdMRs4KFWVrWtBLkZNhoJwS7OSeawe4bWbCZeJkU/We/Oe8XjvAB7BrV+5OdccBfQDt17Mt9b2KnYO+v31xlY9mt+ziMSgb0y4V5 x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?iWKYu3/gE8RASnaXQ6DURxUcEwzaiVjNEPdCjuQ1/y+65Yuv4aoqIoEaCUhT?= =?us-ascii?Q?YH/F+RCIbD8FwIXivRCGxO6IfKKQyBEGDtnhj0uZ/U8DSe+w3uPTYWid4f9r?= =?us-ascii?Q?CQo+xCQfIXvFTArsowvC1y0W5iNE40z4e9vEJlaAsirjJFVEqrCzfO9ji5Ka?= =?us-ascii?Q?SMMPoVy56q5Aa23YJ0WUa5urHxTUqhawW+Cth/57zKgKU+KnfdKGfaJHnhAb?= =?us-ascii?Q?xnrNacFm5mlp5+q/pQu/Nzux08Ezhq+R2Sy9H+m4lCdQBBBTFFHTw73Bit6K?= =?us-ascii?Q?ZojzBXeBzOFJ6w3qI7jhrmgjzshlRjVBhj8/MY+/hyNhR/66ttYRek+h9Pw5?= =?us-ascii?Q?D1OPEMqk8WQbDFn2lve/ukaT1JKoYo3Aj5SGHpenNwEb9sibZab6orpYDpQt?= =?us-ascii?Q?vnfleQw8hfDB7iX2I44IOe3Q4QF0Y2UsxABG8XJ8lDupLHnZPZc2xuGFYtnn?= =?us-ascii?Q?vL/SVRmXDdarQA+0Neo7G6q30d+YolmVvVgLfg/rAunQWDWzJM8O0QeJmO19?= =?us-ascii?Q?xetTrdF6YU9Fzjn0doiZ3zWOIpMjbCvi7OTDX1SWSjIU/8k/lMHqDZyYh4wU?= =?us-ascii?Q?c9Yv5ZN48ULr0SE3RAsbTXeWTDpn1bsVn33FAulcRgKPr9qQoM6kl8Go9mcn?= =?us-ascii?Q?3whgwsEgAQWaRaq6NahY9q/V1R00TbOrA4oszWkjgQq36k7g5k2vLmEjrPCe?= =?us-ascii?Q?T/hyw2DuFar3nax9rugt5Iw/JYhs5bemKN17H+579FRUCCB/OUpetv86slna?= =?us-ascii?Q?zi2Xa9eIG2iDSG0H/yZOKYuxuOrYAo67n0s48uiYu26cixSP+u/IDP9sefxH?= =?us-ascii?Q?KJTiUQubcQioYRPK41A2Se2ezKJFZdo8WLDn037C0Af63LkJxBZ3sTtlR36Q?= =?us-ascii?Q?umHBs3W4GySWnUNtNYjEwiOJOLSajcN6QxzTsVQCJU/mCXq2pdYN9cKQ+Njq?= =?us-ascii?Q?+b289xT/1uzK1rFNhca5aPmKfknjwFvkbKLy7vapW8nI80D5F7//0HRTq6oN?= =?us-ascii?Q?uzV+a7pHaDRTaheo1Yd6OQXEuEzQQVDaRcHYzYAX9JnEHgWE9PeA4lv9ypC7?= =?us-ascii?Q?AFbaAeNlofEbg85b5y5gcbY4x4MauDFxI7uQ1tG5/zf9vi7PS/5S6zCPdufm?= =?us-ascii?Q?YBe1gmbAmQULJ+E+HKzfyslPEKnX+kiYuOh4pL+39HcqtbjK12gkh+Kq5ekB?= =?us-ascii?Q?wRn1JdSfIgSho3mQ8Z2CGhZfPner6GBhTGhdAdnkuZ0wqE5Gtv+jWPhZFIhI?= =?us-ascii?Q?p2Mt0us54PhdFmaB1bwEpemD5JGbXTLGlEK35z4u3tLbaObzqvDH/RNfIy68?= =?us-ascii?Q?s4avFIp8435Kxv2wz7J+1jJv1PZIVzFGakK7HDjwd4hy8JZMLvFKAQiTIYvX?= =?us-ascii?Q?UwAPp5Hp5epC41/w7RwpG9Va7RYKiI6SCtPWSIJQ1g7KW/CPd7AIY+9OUgIv?= =?us-ascii?Q?ODu3YQBre2hMsLj6/Q9Tr54P/Cqdsqn/w36wamGYmVXB6tPkQMOvVI59CFQr?= =?us-ascii?Q?pQ1tciHa40rqjfdFp/on1QJq8Qio6jLqS1x+7pCGE78B9L3rlOcvhM3GYMrl?= =?us-ascii?Q?0KmJzPOUz0QSF5QopI5DlT6OqGT3zL+9rfUJZ1CM9XUuEqM8p8vu6JOUEURE?= =?us-ascii?Q?3w=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5821.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ee4640a-6ef8-4de8-b5c5-08dbfa8e3e06 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2023 21:15:03.5766 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: g5sloJzXbM4jKiAwmH3669TGkA2vjAOLiMt6eKVRFCBrHZ1vKl+Yjq49o+SiYVakDBcB431Ukn+68nsQnq81kNAAO2x0XmLP7r9ZFee1Mco= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5550 X-OriginatorOrg: intel.com 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,nathaniel.l.desimone@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: KMJw3M1CQ7Kp7GzcgYE9Afx5x7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" 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=WQHTn9F4; 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); arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Reviewed-by: Nate DeSimone -----Original Message----- From: Huang, Li-Xia =20 Sent: Tuesday, December 5, 2023 11:00 PM To: devel@edk2.groups.io Cc: Abner Chang ; Desimone, Nathaniel L Subject: [PATCH v1 1/1] IpmiFeaturePkg/GenericIpmi: Sync change from SMM Sync change from SMM to StandaloneMm GenericIpmi driver. Update SmmIpmbInterface and SmmSsifInterface Lib to support MM_STANDALONE. = And Format code with uncrustify. Cc: Abner Chang Cc: Nate DeSimone Signed-off-by: Lixia Huang --- Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm= /StandaloneMmGenericIpmi.c | 315 +++++++++++++++++--= - Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceComm= onAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.c | 4 +- Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceComm= onAccess/SsifInterfaceLib/SmmSsifInterfaceLib.c | 64 ++-- Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm= /StandaloneMmGenericIpmi.inf | 10 + Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc = | 2 +- Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceComm= onAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.inf | 4 +- Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceComm= onAccess/SsifInterfaceLib/SmmSsifInterfaceLib.inf | 4 +- 7 files changed, 326 insertions(+), 77 deletions(-) diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= StandaloneMm/StandaloneMmGenericIpmi.c b/Features/Intel/OutOfBandManagement= /IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.c index d808e2517c99..1b9841e4b745 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Standal= oneMm/StandaloneMmGenericIpmi.c +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Stan +++ daloneMm/StandaloneMmGenericIpmi.c @@ -19,17 +19,157 @@ #include #include #include +#include #include #include "IpmiHooks.h" #include "IpmiBmcCommon.h" #include "IpmiBmc.h" =20 -IPMI_BMC_INSTANCE_DATA *mIpmiInstance; -EFI_HANDLE mHandle; +IPMI_BMC_INSTANCE_DATA *mIpmiInstance; +EFI_HANDLE mIpmiTransportHandle; +EFI_HANDLE mIpmiTransport2Handle; =20 /** + +Routine Description: + Initialize the API and parameters for IPMI Transport2 Instance + +Arguments: + IpmiInstance - Pointer to IPMI Instance. + +Returns: + VOID - Nothing. + +**/ +VOID +InitIpmiTransport2 ( + IN IPMI_BMC_INSTANCE_DATA *IpmiInstance + ) +{ + IpmiInstance->IpmiTransport2.InterfaceType =3D FixedPcdGet8 (P= cdDefaultSystemInterface); + IpmiInstance->IpmiTransport2.IpmiTransport2BmcStatus =3D BmcStatusOk; + IpmiInstance->IpmiTransport2.IpmiSubmitCommand2 =3D IpmiSendCommand= 2; + IpmiInstance->IpmiTransport2.IpmiSubmitCommand2Ex =3D IpmiSendCommand= 2Ex; + + if (FixedPcdGet8 (PcdBtInterfaceSupport) =3D=3D 1) { + InitBtInterfaceData (&IpmiInstance->IpmiTransport2); } + + if (FixedPcdGet8 (PcdSsifInterfaceSupport) =3D=3D 1) { + InitSsifInterfaceData (&IpmiInstance->IpmiTransport2); } + + if (FixedPcdGet8 (PcdIpmbInterfaceSupport) =3D=3D 1) { + InitIpmbInterfaceData (&IpmiInstance->IpmiTransport2); + } +} + +/** + +Routine Description: + Notify call back to initialize the interfaces and install SMM IPMI + protocol. + +Arguments: + Protocol - Pointer to the protocol guid. + Interface - Pointer to the protocol instance. + Handle - Handle on which the protocol is installed. + +Returns: + Status of Notify call back. + +**/ +EFI_STATUS +EFIAPI +SmmNotifyCallback ( + IN CONST EFI_GUID *Protocol, + IN VOID *Interface, + IN EFI_HANDLE Handle + ) +{ + EFI_STATUS Status; + IPMI_INTERFACE_STATE InterfaceState; + + InterfaceState =3D IpmiInterfaceNotReady; + + if (FixedPcdGet8 (PcdSsifInterfaceSupport) =3D=3D 1) { + InitSsifInterfaceData (&mIpmiInstance->IpmiTransport2); + + if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState =3D=3D= IpmiInterfaceInitialized) { + InterfaceState =3D IpmiInterfaceInitialized; + } + } + + if (FixedPcdGet8 (PcdIpmbInterfaceSupport) =3D=3D 1) { + InitIpmbInterfaceData (&mIpmiInstance->IpmiTransport2); } + + if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState =3D=3D I= pmiInterfaceInitialized) { + InterfaceState =3D IpmiInterfaceInitialized; } + + if (InterfaceState !=3D IpmiInterfaceInitialized) { + return EFI_SUCCESS; + } + + // Default Interface data should be initialized to install Ipmi Transpor= t2 Protocol. + if (InterfaceState =3D=3D IpmiInterfaceInitialized) { + mIpmiTransport2Handle =3D NULL; + Status =3D gMmst->MmInstallProtocolInterface ( + &mIpmiTransport2Handle, + &gSmmIpmiTransport2ProtocolGuid, + EFI_NATIVE_INTERFACE, + &mIpmiInstance->IpmiTransport2 + ); } + + ASSERT_EFI_ERROR (Status); + return EFI_SUCCESS; +} + +/** + +Routine Description: + Registers Protocol call back. + +Arguments: + ProtocolGuid - Pointer to Protocol GUID to register call back. + +Returns: + Status. + +**/ +EFI_STATUS +MmRegisterProtocolCallback ( + IN EFI_GUID *ProtocolGuid + ) +{ + EFI_STATUS Status; + VOID *Registration; + + if ((ProtocolGuid =3D=3D NULL) || + ((ProtocolGuid !=3D NULL) && IsZeroBuffer (ProtocolGuid, sizeof=20 + (EFI_GUID)))) { + return EFI_INVALID_PARAMETER; + } + + Status =3D gMmst->MmRegisterProtocolNotify ( + ProtocolGuid, + SmmNotifyCallback, + &Registration + ); + return Status; +} + +EFI_STATUS +SmmInitializeIpmiKcsPhysicalLayer ( + VOID + ) + +/** + Routine Description: - Setup and initialize the BMC for the SMM phase. In order to verify the = BMC is functioning + Setup and initialize the BMC for the DXE phase. In order to verify=20 + the BMC is functioning as expected, the BMC Selftest is performed. The results are then checke= d and any errors are reported to the error manager. Errors are collected throughout this rou= tine and reported just prior to installing the driver. If there are more errors than MAX_= SOFT_COUNT, then they @@ -43,25 +183,27 @@ Returns: EFI_SUCCESS - Successful driver initialization =20 **/ -EFI_STATUS -SmmInitializeIpmiKcsPhysicalLayer ( - VOID - ) { - EFI_STATUS Status; + EFI_STATUS Status; + UINT8 ErrorCount; + IPMI_INTERFACE_STATE InterfaceState; + UINT8 Index; =20 - DEBUG ((DEBUG_INFO,"SmmInitializeIpmiKcsPhysicalLayer entry \n")); + DEBUG ((DEBUG_INFO, "SmmInitializeIpmiKcsPhysicalLayer entry \n")); + ErrorCount =3D 0; + InterfaceState =3D IpmiInterfaceNotReady; =20 Status =3D gMmst->MmAllocatePool ( EfiRuntimeServicesData, sizeof (IPMI_BMC_INSTANCE_DATA), - (VOID **)&mIpmiInstance); - - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "mIpmiInstance mem alloc failed - 0x%x\n", Status= )); - return Status; + (VOID **)&mIpmiInstance + ); + ASSERT (mIpmiInstance !=3D NULL); + if (mIpmiInstance =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "ERROR!! Null Pointer returned by AllocateZeroPoo= l ()\n")); + ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); + return EFI_OUT_OF_RESOURCES; } else { - // // Initialize the KCS transaction timeout. Assume delay unit is 1000 u= s. // @@ -70,23 +212,110 @@ SmmInitializeIpmiKcsPhysicalLayer ( // // 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 // - mIpmiInstance->IpmiIoBase =3D FixedPcdGet16 (Pcd= IpmiSmmIoBaseAddress); - mIpmiInstance->Signature =3D SM_IPMI_BMC_SIGNAT= URE; - mIpmiInstance->SlaveAddress =3D BMC_SLAVE_ADDRESS; - mIpmiInstance->BmcStatus =3D BMC_NOTREADY; - mIpmiInstance->IpmiTransport.IpmiSubmitCommand =3D IpmiSendCommand; - mIpmiInstance->IpmiTransport.GetBmcStatus =3D IpmiGetBmcStatus; - - mHandle =3D NULL; - Status =3D gMmst->MmInstallProtocolInterface ( - &mHandle, - &gSmmIpmiTransportProtocolGuid, - EFI_NATIVE_INTERFACE, - &mIpmiInstance->IpmiTransport - ); - ASSERT_EFI_ERROR (Status); - - DEBUG ((DEBUG_INFO,"SmmInitializeIpmiKcsPhysicalLayer exit \n")); + mIpmiInstance->IpmiIoBase =3D FixedPcdGet16 (PcdI= pmiSmmIoBaseAddress); + mIpmiInstance->Signature =3D SM_IPMI_BMC_SIGNATU= RE; + mIpmiInstance->SlaveAddress =3D BMC_SLAVE_ADDRESS; + mIpmiInstance->BmcStatus =3D BMC_NOTREADY; + mIpmiInstance->IpmiTransport.IpmiSubmitCommand =3D IpmiSendCommand; + mIpmiInstance->IpmiTransport.GetBmcStatus =3D IpmiGetBmcStatus; + + if (FixedPcdGet8 (PcdKcsInterfaceSupport) =3D=3D 1) { + DEBUG ((DEBUG_INFO, "IPMI: Waiting for Getting BMC DID in SMM \n")); + // + // Get the Device ID and check if the system is in Force Update mode= . + // + // Just obey the Spec.. + // To improve performance, we're going to comment it. + // + + mIpmiTransportHandle =3D NULL; + Status =3D gMmst->MmInstallProtocolInterface ( + &mIpmiTransportHandle, + &gSmmIpmiTransportProtocolGuid, + EFI_NATIVE_INTERFACE, + &mIpmiInstance->IpmiTransport + ); + ASSERT_EFI_ERROR (Status); + } + + InitIpmiTransport2 (mIpmiInstance); + + // Check interface data initialized successfully else register notify = protocol. + for (Index =3D SysInterfaceKcs; Index < SysInterfaceMax; Index++) { + switch (Index) { + case SysInterfaceKcs: + if (FixedPcdGet8 (PcdKcsInterfaceSupport) =3D=3D 1) { + if ((mIpmiInstance->BmcStatus !=3D BMC_HARDFAIL) && (mIpmiInst= ance->BmcStatus !=3D BMC_UPDATE_IN_PROGRESS)) { + BMC_INTERFACE_STATUS BmcStatus; + mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = =3D IpmiInterfaceInitialized; + Status = =3D CheckSelfTestByInterfaceType ( + = &mIpmiInstance->IpmiTransport2, + = &BmcStatus, + = SysInterfaceKcs + = ); + if (!EFI_ERROR (Status) && (BmcStatus !=3D BmcStatusHardFail= )) { + InterfaceState =3D IpmiInterfaceInitialized; + } else { + mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = =3D IpmiInterfaceInitError; + } + } + } + + break; + + case SysInterfaceBt: + if (FixedPcdGet8 (PcdBtInterfaceSupport) =3D=3D 1) { + if (mIpmiInstance->IpmiTransport2.Interface.Bt.InterfaceState = =3D=3D IpmiInterfaceInitialized) { + InterfaceState =3D IpmiInterfaceInitialized; + } + } + + break; + + case SysInterfaceSsif: + if (FixedPcdGet8 (PcdSsifInterfaceSupport) =3D=3D 1) { + if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceStat= e =3D=3D IpmiInterfaceInitialized) { + InterfaceState =3D IpmiInterfaceInitialized; + } else if (mIpmiInstance->IpmiTransport2.Interface.Ssif.Interf= aceState =3D=3D IpmiInterfaceInitError) { + // Register protocol notify for SMBUS Protocol. + Status =3D MmRegisterProtocolCallback (&mIpmiInstance->IpmiT= ransport2.Interface.Ssif.SsifInterfaceApiGuid); + } + } + + break; + + case SysInterfaceIpmb: + if (FixedPcdGet8 (PcdIpmbInterfaceSupport) =3D=3D 1) { + if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceStat= e =3D=3D IpmiInterfaceInitialized) { + InterfaceState =3D IpmiInterfaceInitialized; + } else if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.Interf= aceState =3D=3D IpmiInterfaceInitError) { + // Register protocol notify for SMBUS Protocol. + Status =3D MmRegisterProtocolCallback (&mIpmiInstance->IpmiT= ransport2.Interface.Ipmb.IpmbInterfaceApiGuid); + } + } + + break; + + default: + break; + } + } + + // Default Interface data should be initialized to install Ipmi Transp= ort2 Protocol. + if (InterfaceState =3D=3D IpmiInterfaceInitialized) { + mIpmiTransport2Handle =3D NULL; + Status =3D gMmst->MmInstallProtocolInterface ( + &mIpmiTransport2Handle, + &gSmmIpmiTransport2ProtocolGuid, + EFI_NATIVE_INTERFACE, + &mIpmiInstance->IpmiTransport2 + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "IPMI Transport2 protocol install Status =3D = %r \n", Status)); + } + } + + DEBUG ((DEBUG_INFO, "SmmInitializeIpmiKcsPhysicalLayer exit \n")); =20 return EFI_SUCCESS; } @@ -104,8 +333,8 @@ SmmInitializeIpmiKcsPhysicalLayer ( **/ EFI_STATUS I= nitializeGenericIpmiStandaloneMm ( - IN EFI_HANDLE ImageHandle, - IN EFI_MM_SYSTEM_TABLE *SystemTable + IN EFI_HANDLE ImageHandle, + IN EFI_MM_SYSTEM_TABLE *SystemTable ) { SmmInitializeIpmiKcsPhysicalLayer (); @@ -124,21 +353,31 @@ InitializeGe= nericIpmiStandaloneMm ( EFI_STATUS EFIAPI GenericIpmiStandaloneMmUnload = ( - IN EFI_HANDLE ImageHandle + IN EFI_HANDLE ImageHandle ) { - EFI_STATUS Status; + EFI_STATUS Status; =20 Status =3D EFI_SUCCESS; if (mIpmiInstance !=3D NULL) { - if (mHandle !=3D NULL) { + if (mIpmiTransportHandle !=3D NULL) { Status =3D gMmst->MmUninstallProtocolInterface ( - mHandle, + mIpmiTransportHandle, &gSmmIpmiTransportProtocolGuid, &mIpmiInstance->IpmiTransport ); ASSERT_EFI_ERROR (Status); } + + if (mIpmiTransport2Handle !=3D NULL) { + Status =3D gMmst->MmUninstallProtocolInterface ( + mIpmiTransport2Handle, + &gSmmIpmiTransport2ProtocolGuid, + &mIpmiInstance->IpmiTransport2 + ); + ASSERT_EFI_ERROR (Status); + } + gMmst->MmFreePool (mIpmiInstance); } =20 diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcI= nterfaceCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.c b/Features/Inte= l/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbI= nterfaceLib/SmmIpmbInterfaceLib.c index b5d63353e403..589ea81a72c1 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfac= eCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.c +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInter +++ faceCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.c @@ -8,7 +8,7 @@ **/ =20 #include -#include +#include #include #include #include @@ -76,7 +76,7 @@ IpmiGetI2cApiPtr= ( IpmiTransport2->Interface.Ipmb.IpmbInterfaceApiGuid =3D gEfiI2cMasterPro= tocolGuid; =20 // Locate the I2C SMM Protocol for Communication. - Status =3D gSmst->SmmLocateProtocol ( + Status =3D gMmst->MmLocateProtocol ( &gEfiI2cMasterProtocolGuid, NULL, (VOID **)&I2cMasterTransmit diff --gi= t a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceC= ommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.c b/Features/Intel/OutOfBa= ndManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifInterfaceL= ib/SmmSsifInterfaceLib.c index e784631909ce..1f50977c31be 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfac= eCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.c +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInter +++ faceCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.c @@ -8,7 +8,7 @@ **/ =20 #include -#include +#include #include #include #include @@ -54,14 +54,14 @@ IpmiS= mbusSendCommand ( =20 if (EfiSmbusHcProtocol !=3D NULL) { Status =3D EfiSmbusHcProtocol->Execute ( - EfiSmbusHcProtocol, - SlaveAddress, - Command, - Operation, - PecCheck, - Length, - Buffer - ); + EfiSmbusHcProtocol, + SlaveAddress, + Command, + Operation, + PecCheck, + Length, + Buffer + ); } =20 DEBUG ((DEBUG_INFO, "%a EfiSmbusHcProtocol->Execute Status =3D %r\n", __= func__, Status)); @@ -95,13 +95,13 @@ IpmiGetSmbusApiPtr ( IpmiTransport2->Interface.Ssif.SsifInterfaceApiGuid =3D gEfiSmbusHcProto= colGuid; HandleCount =3D 0; =20 - Status =3D gSmst->SmmLocateHandle ( - ByProtocol, - &gEfiSmbusHcProtocolGuid, - NULL, - &HandleCount, - HandleBuffer - ); + Status =3D gMmst->MmLocateHandle ( + ByProtocol, + &gEfiSmbusHcProtocolGuid, + NULL, + &HandleCount, + HandleBuffer + ); if (EFI_ERROR (Status) && (Status =3D=3D EFI_BUFFER_TOO_SMALL)) { // Allocate memory for Handle buffer HandleBuffer =3D AllocateZeroPool (HandleCount); @@ -109,13 +109,13 @@= IpmiGetSmbusApiPtr ( return EFI_NOT_FOUND; } =20 - Status =3D gSmst->SmmLocateHandle ( - ByProtocol, - &gEfiSmbusHcProtocolGuid, - NULL, - &HandleCount, - HandleBuffer - ); + Status =3D gMmst->MmLocateHandle ( + ByProtocol, + &gEfiSmbusHcProtocolGuid, + NULL, + &HandleCount, + HandleBuffer + ); if (EFI_ERROR (Status)) { // Free HandleBuffer memory FreePool (HandleBuffer); @@ -124,11 +124,11 @@ IpmiGetSmbusApiPtr ( } =20 for (Index =3D 0; Index < HandleCount; Index++) { - Status =3D gSmst->SmmHandleProtocol ( - HandleBuffer[Index], - &gEfiSmbusHcProtocolGuid, - (VOID **)&EfiSmbusHcProtocol - ); + Status =3D gMmst->MmHandleProtocol ( + HandleBuffer[Index], + &gEfiSmbusHcProtocolGuid, + (VOID **)&EfiSmbusHcProtocol + ); if (EFI_ERROR (Status)) { continue; } @@ -137,10 +137,10 @@ IpmiGetSmbusApiPtr ( IpmiTransport2->Interface.Ssif.SsifInterfaceApiPtr =3D (UINTN)EfiSmbus= HcProtocol; =20 Status =3D CheckSelfTestByInterfaceType ( - IpmiTransport2, - &BmcStatus, - SysInterfaceSsif - ); + IpmiTransport2, + &BmcStatus, + SysInterfaceSsif + ); if (EFI_ERROR (Status) || (BmcStatus =3D=3D BmcStatusHardFail)) { IpmiTransport2->Interface.Ssif.InterfaceState =3D IpmiInterfaceInitE= rror; continue; diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= StandaloneMm/StandaloneMmGenericIpmi.inf b/Features/Intel/OutOfBandManageme= nt/IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.inf index 170e0a8d136b..e4abc4db29fe 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Standal= oneMm/StandaloneMmGenericIpmi.inf +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Stan +++ daloneMm/StandaloneMmGenericIpmi.inf @@ -38,14 +38,24 @@ IoLib ReportStatusCodeLib TimerLib + BmcCommonInterfaceLib + BtInterfaceLib + SsifInterfaceLib + IpmbInterfaceLib =20 [Protocols] gSmmIpmiTransportProtocolGuid # PROTOCOL ALWAYS_PROD= UCED + gSmmIpmiTransport2ProtocolGuid # PROTOCOL ALWAYS_PROD= UCED =20 [Guids] =20 [Pcd] gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiSmmIoBaseAddress + gIpmiFeaturePkgTokenSpaceGuid.PcdDefaultSystemInterface + gIpmiFeaturePkgTokenSpaceGuid.PcdBtInterfaceSupport + gIpmiFeaturePkgTokenSpaceGuid.PcdSsifInterfaceSupport + gIpmiFeaturePkgTokenSpaceGuid.PcdKcsInterfaceSupport + gIpmiFeaturePkgTokenSpaceGuid.PcdIpmbInterfaceSupport =20 [Depex] gIpmiTransportProtocolGuid diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Ipmi= Feature.dsc b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Ipm= iFeature.dsc index cfdfc916a464..c9c76565c672 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature= .dsc +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeat +++ ure.dsc @@ -57,7 +57,7 @@ SsifInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifInt= erfaceLib/DxeSsifInterfaceLib.inf IpmbInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbInt= erfaceLib/DxeIpmbInterfaceLib.inf =20 -[LibraryClasses.common.DXE_SMM_DRIVER] +[LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.MM_STANDALO +NE] IpmiBaseLib|IpmiFeaturePkg/Library/SmmIpmiBaseLib/SmmIpmiBaseLib.inf SsifInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifInt= erfaceLib/SmmSsifInterfaceLib.inf IpmbInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbInt= erfaceLib/SmmIpmbInterfaceLib.inf diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcI= nterfaceCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.inf b/Features/In= tel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/Ipm= bInterfaceLib/SmmIpmbInterfaceLib.inf index 5030d5659dc2..32e72bef9bc1 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfac= eCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.inf +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInter +++ faceCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.inf @@ -14,7 +14,7 @@ FILE_GUID =3D C39F9DC3-37C7-41C1-BE05-8C1524493947 MODULE_TYPE =3D DXE_SMM_DRIVER VERSION_STRING =3D 1.1 - LIBRARY_CLASS =3D IpmbInterfaceLib | DXE_SMM_DRIVER + LIBRARY_CLASS =3D IpmbInterfaceLib | DXE_SMM_DRIVER MM_STANDALONE =20 [Sources] SmmIpmbInterfaceLib.c @@ -27,7 +27,7 @@ [LibraryClasses] DebugLib BaseMemoryLib - SmmServicesTableLib + MmServicesTableLib BmcCommonInterfaceLib =20 [Protocols] diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcI= nterfaceCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.inf b/Features/In= tel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/Ssi= fInterfaceLib/SmmSsifInterfaceLib.inf index b1fb44241c37..8ff1a2cf927e 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfac= eCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.inf +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInter +++ faceCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.inf @@ -14,7 +14,7 @@ FILE_GUID =3D DB817B63-FA26-44FA-BF84-8D48596F982B MODULE_TYPE =3D DXE_SMM_DRIVER VERSION_STRING =3D 1.1 - LIBRARY_CLASS =3D SsifInterfaceLib | DXE_SMM_DRIVER + LIBRARY_CLASS =3D SsifInterfaceLib | DXE_SMM_DRIVER MM_STANDALONE =20 [Sources] SmmSsifInterfaceLib.c @@ -26,7 +26,7 @@ IpmiFeaturePkg/IpmiFeaturePkg.dec =20 [LibraryClasses] - SmmServicesTableLib + MmServicesTableLib MemoryAllocationLib BmcCommonInterfaceLib =20 -- 2.26.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112328): https://edk2.groups.io/g/devel/message/112328 Mute This Topic: https://groups.io/mt/103008784/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-