From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.2568.1686616533443413079 for ; Mon, 12 Jun 2023 17:35:33 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=NvZLb5uD; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: isaac.w.oram@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686616533; x=1718152533; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=5+On8gWZzGyT79nu2rjc3bKieSEkq+qkyg6whSyCPWY=; b=NvZLb5uDQT+DiYdF49lbO1zQNa16b1pbAJcyW5iqh17fDGWTFBik/3kh im5uCTP/VrAbEk0nE/9ZOf1A9O3xWo8ChcMDYB0rM2jekdc4+zi4i3hK/ LsztHIEkfrhC0RTkogn+5cFAg4IRFMvUk5MdPyu/ARqGfYBg6idnC8FbQ iyfC4NHVjBwFqNUoIHJSpUNqyPucdRnGOIX7TJir8/8C5YljRbwuTF9GY wZk81OG7aSiyqQXnmFbCiFeONxqmZIvV1dOG+fVrrU7Z/DmMaV5/FOdkq BjvYIMO2tJImtGRJgXx8sZwLV+p+yyklydLzbw+o2eoF6Rc+7fJQQNE6q w==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="361560801" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="361560801" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 17:35:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="705591124" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="705591124" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga007.jf.intel.com with ESMTP; 12 Jun 2023 17:35:32 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) 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.23; Mon, 12 Jun 2023 17:35:32 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Mon, 12 Jun 2023 17:35:32 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.171) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Mon, 12 Jun 2023 17:35:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aeJHJLXQ0P4U51SbUEg1/sSL/qsybnvpM3+wWu+ZPSSNmOfTyMKenS2u5halQMx5piHaPm+zDDObMW8+Pilx2TFIoA+hrRsOw+NR9WIzZZgiCKHARnq/YuYesazSGVBNfKB5f69tIF5zdguPQlhf6kj/3MmQpr2Yp26qOD/8EDsZ5vNbqeSb3hDF8lHAq+R+OWdkbn7kqZLRy2LIu7l51EUcavdGC6Z/WipvizGZa46XnK0tZwAEURPvmkoPc293R6KblK7LAkqhYdldnfIfamwSP/GCb/CB+5Z20xn6A7nQQPX2p6hqBmdPWApLYtvMzTn+tHPUmlLRosRLXvFHEQ== 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=X0+pwV68ksvPcNp7+tey1fu1d27yUMWogcCtIwSvUoo=; b=W3/zTOdvXBBFqt4+15GX2kz2YrRCg48qBXB6YiNF42JIApEgA6flXICshjUZD+28LXG6qpYnPw98TG8Qx1XsiEJo1hTWLuQD5Y96yDgl+wJgHoPaWsqzJ4fB9lhdRNUg3NmHR27Iq/5t81ZQfvXJT2FhQuoZ2jxf3BCFOjQKenOIwL9vlBYDfxGg9dMmVUuMmOPwwoUaVfv43OaML6ikoITB2ErS4HlT3RrO5QCaSHS5aGyNtp6IVFqUmyhUpsvCVfprtaaRR8eDkKdTlTQ1PDQmQsxtGz3c2BVktBPRDII2hrKs26bd6cjK/IxEphgOvgRjg6TDOPNM2JbPAs/3vw== 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 Received: from SA1PR11MB5801.namprd11.prod.outlook.com (2603:10b6:806:23d::13) by CH3PR11MB8185.namprd11.prod.outlook.com (2603:10b6:610:159::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 13 Jun 2023 00:35:28 +0000 Received: from SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::6979:a90f:e224:41c5]) by SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::6979:a90f:e224:41c5%4]) with mapi id 15.20.6455.043; Tue, 13 Jun 2023 00:35:28 +0000 From: "Isaac Oram" To: Arun K , "devel@edk2.groups.io" CC: "Desimone, Nathaniel L" , "Ramkumar Krishnamoorthi" , "Gao, Liming" Subject: Re: [edk2-devel][edk2-platforms][PATCH V3-2] IpmiFeaturePkg:Provided multiple IPMI interface support in PEI Thread-Topic: [edk2-devel][edk2-platforms][PATCH V3-2] IpmiFeaturePkg:Provided multiple IPMI interface support in PEI Thread-Index: AQHZnSzYJVYKgs5XHUmlHzu5wHmCRa+H0z9Q Date: Tue, 13 Jun 2023 00:35:28 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SA1PR11MB5801:EE_|CH3PR11MB8185:EE_ x-ms-office365-filtering-correlation-id: e3e6060f-7593-4c06-b5b9-08db6ba61657 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XKaNRzNgAXNkhyd/Nb1awTakLKL3keVMycAA8h0uawAydIGZs18arYGuK6R0UVPDeAuxDhkC7rn5JE01rdseG0x5B6suBDfFMQVW57XyLo8coXGKUCCz/ur27HX4Mc/s1idvLegaOAu/1PFbAAbm8TA5PeAnz4hUbUxkAswBea/TPV5evzAcEVsqZLBpM5MziSRj0aVmAcuOPS6HJKMb+/T+ASTQ4ZM/648WtkajkaFUBODArVzfKNJ6aB8tMvGPMDlpnH1Z3mSBDMkrchl11byPl1cISl71ooxA3/C+tDv6ZKYeXudaAb/LFgn4kjLVJn8rbrt20ocztpe7hhVX2yzaeCQ+VjwX4//KZ5lIHUIfNZBt3GrI7Gn73+W/ZYRcVMhzBvBDexphH0HDlPK2lCAtpBrQUkXu15/H5hq6KWnQ+JpSzuJeZmqxunCT6oX/LIR8h8XMQ+sPxlHn92tQ5uQfT7nOccoy+nuAofNdgKmxLZASs16KB+MGfiGV24fvKI/nrmLfq1Pu06/w4vCbsglzUbsEWmWMc6goKmd6Akg1VFylkcVmCDqIIFbDB0t5VFxiPDJc/vtd9/wP2z5pF6LxqjeLFNwC4kIvOQnda3HMIBvipmj6/yCk5pKmgcGL x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR11MB5801.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(136003)(366004)(396003)(39860400002)(376002)(451199021)(7696005)(86362001)(71200400001)(9686003)(55016003)(6506007)(53546011)(26005)(83380400001)(33656002)(40140700001)(186003)(54906003)(316002)(66476007)(66946007)(19627235002)(38070700005)(66446008)(66556008)(4326008)(76116006)(5660300002)(64756008)(8936002)(8676002)(52536014)(30864003)(2906002)(122000001)(110136005)(82960400001)(41300700001)(478600001)(38100700002)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?BYjEXAx80FgjNdljQkoQVAnOquHwBeTChxWP+65zMd09VAqz6h3vhdCX7e9y?= =?us-ascii?Q?mWVmGK1xKfoPKmlP+C/CARh7Qr8r5Ks/+ldPvfWMnqst8oP0d77kDu0nTOo2?= =?us-ascii?Q?MJpib0BHVDaV2SBqe9I+fxBT/olNDYb/w0n9FIhJrRciCAG2jP6Q4S4sCdk1?= =?us-ascii?Q?WECl0rht+0IeYVumASuwVYtO+z5VG6OPmGtozpojjQFtysri9rjWdkPo+twi?= =?us-ascii?Q?oajCtGwZ++PQjHwuJnfkjR2dlRL2CiqfSToiJELVN3bsGEx50tb3EkW73xYf?= =?us-ascii?Q?VuAAEU4riaTvpRp+vVgQOk1dksI4ZHMWlQdS0M8tpBbrqne3BCBdLiC7AF5r?= =?us-ascii?Q?qLlrwtvIaOL0KKSC0JnHH/XDlIMhmSkmaGqFcPJYpq/NaZJ7fi6qYORyZ/z1?= =?us-ascii?Q?5crrc6iidai9T0oMTBVVEkI7CtXYLtxsMMtFvS8dDin1+PAEspnxqqdqETmL?= =?us-ascii?Q?jOeuESmLRJmoaa0/Z7FWCYaAzeiqctIm0h+s8ELFdaMCtQWnNGVtOVidrfZI?= =?us-ascii?Q?LnriAYHg7ZZVyC6uXQxFr4XYuDQu0/6fXOCxlPXaRHqlMb9yS/DP6YgzJ0Fa?= =?us-ascii?Q?UY3Od5enVJ+rIKVr/EYttfP55sCvpky9hB1tyIuC/Lt8j0L5kVeHDhIchcLQ?= =?us-ascii?Q?QAOpTi5r1f9fSlSzfXtEecuLSTCdt39UCtyI0azae35KNwSOvKrWbhhzxbIR?= =?us-ascii?Q?9pRdhuOkSW6hKm/Q5RbaZlnm//D8usIvyilWt0bhOuhfYwC5sZGl4NupWm7m?= =?us-ascii?Q?AlbuuIA+Yv88I24d8YTYsarDBi3zVmuNfDczqomuObBFNDBI3Zbup+FF8y85?= =?us-ascii?Q?saFO6aJU2oyYszNzpa+jcCodal3nXhGhH+FkP/EW1S6Jlk31a8jMHrxkCbe2?= =?us-ascii?Q?bwOewPAH5tmBrUWkdIdE/HSQ/+VYn3efDCaRp9TzFIseN8G02ekwLdDgILm3?= =?us-ascii?Q?TVr7xbwGme01mfi5FdPL0/A5lozaCNll8F1WBGC9chWxsrIeHefEXBg1cpZJ?= =?us-ascii?Q?cA5Vg5B/xkb7/cIEph/sAtKiegVQLT25YcmF8/UTLigjsKW6++Ljp3QfBYX1?= =?us-ascii?Q?KO/cvHyP16w3c/3L5s+GXXT86dg4bk1VNw97aDv+sVNyjBs0UIOOEuNRIgVe?= =?us-ascii?Q?eSLDgqh1ybQ1AaPbsWn19P+rDC8ugyjxENYlS0mxbtpN74llxBVRtbopeEgP?= =?us-ascii?Q?uMTgPlI+uHSg3up2ULa7rDoYwM5JmRoQcd+sH2ZB3XfyLxxotHH++rBcVjog?= =?us-ascii?Q?TJiS7QzHz/3LiOEGFgdbwu6RexGbByUa4yF44M+H8tNsoF0V3k0j1AqvZwYV?= =?us-ascii?Q?IsBSOdSHpMyVBP+GX7gZ4zjwLYMMUD+yDADGgtWsAaH6p2wIkTpVcM5blLot?= =?us-ascii?Q?plgRk3+ZMZqwTYFnYQdlWxk1+jQoe1H2dfMYJLYqa/xarJRlYGDX3p+KRkNt?= =?us-ascii?Q?kZFL0MQCSsL4VTXJXvsnskPY8+RgQABpwi1uZZXMi7WBVr/R0xL0ZZUzX8Md?= =?us-ascii?Q?BrlIlvLnBwIX9v8IuDDrQ/+J8vkRDC/PEs2EzLf7jkVnHz4awIFI+8duSs9X?= =?us-ascii?Q?uVbmxCJTdPy5cBSS5t7aySN6Qb3IOl0rdWkwEu/W?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA1PR11MB5801.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3e6060f-7593-4c06-b5b9-08db6ba61657 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jun 2023 00:35:28.6569 (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: uEKjybjLsCdCOQu2BpPgyZVkn3H2SUy/R3v2S8iw7geY4riVoGQ3WblLfRnGWHKVwMCrXZ96+FeCOl1+xP3orA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB8185 Return-Path: isaac.w.oram@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Similar issues with four space indents, lack of spaces before { and (, #if = logic. Regards, Isaac -----Original Message----- From: Arun K =20 Sent: Monday, June 12, 2023 5:53 AM To: devel@edk2.groups.io; Arun K Cc: Oram, Isaac W ; Desimone, Nathaniel L ; Ramkumar Krishnamoorthi ; Gao, = Liming Subject: [edk2-devel][edk2-platforms][PATCH V3-2] IpmiFeaturePkg:Provided m= ultiple IPMI interface support in PEI Created IpmiTransport2 PPI/Protocol to support multiple IPMI BMC Interface = support such as KCS/BT/SSIF with 2 API's IpmiSubmitCommand2 & IpmiSubmitCommand2Ex. IpmiSubmitCommand2 - This API use the default interface (PcdDefaultSystemInterface) to send IPMI command. IpmiSubmitCommand2Ex - This API use the specific interface type to send IPM= I command which is passed as an argument. Cc: Isaac Oram Cc: Nate DeSimone Cc: Liming Gao Signed-off-by: Arun K --- .../GenericIpmi/Pei/PeiGenericIpmi.c | 295 ++++++++++++++---- .../GenericIpmi/Pei/PeiGenericIpmi.h | 3 + .../GenericIpmi/Pei/PeiGenericIpmi.inf | 16 + .../GenericIpmi/Pei/PeiIpmiBmc.c | 3 +- .../GenericIpmi/Pei/PeiIpmiBmc.h | 9 + .../GenericIpmi/Pei/PeiIpmiBmcDef.h | 11 + .../IpmiFeaturePkg/Include/IpmiFeature.dsc | 15 + 7 files changed, 285 insertions(+), 67 deletions(-) diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= Pei/PeiGenericIpmi.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Ge= nericIpmi/Pei/PeiGenericIpmi.c index e8b99b6900..e0378d61d4 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/Pei= GenericIpmi.c +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/ +++ PeiGenericIpmi.c @@ -3,6 +3,7 @@ @copyright Copyright 2017 - 2021 Intel Corporation.
+ Copyright (c) 1985 - 2023, American Megatrends International LLC.=20 +
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -10,10 +11,143 @@ #include "PeiGenericIpmi.h" #include #include +#include //////////////////////////////////////////////////////////////////////////= ///// -// Function Implementations -// + +/** + Initialize the API and parameters for IPMI Transport2 Instance + + @param[in] IpmiInstance Pointer to IPMI Instance + + @return VOID + +**/ +VOID +InitIpmiTransport2 ( + IN PEI_IPMI_BMC_INSTANCE_DATA *IpmiInstance + ) +{ + IpmiInstance->IpmiTransport2Ppi.InterfaceType =3D FixedPcdGet8= (PcdDefaultSystemInterface); + IpmiInstance->IpmiTransport2Ppi.IpmiTransport2BmcStatus =3D=20 + BmcStatusOk; + IpmiInstance->IpmiTransport2Ppi.IpmiSubmitCommand2 =3D PeiIpmiSendC= ommand2; + IpmiInstance->IpmiTransport2Ppi.IpmiSubmitCommand2Ex =3D PeiIpmiSendC= ommand2Ex; + +#if BtInterfaceSupport + if (!EFI_ERROR=20 + (PlatformIpmiIoRangeSet(FixedPcdGet16(PcdBtControlPort)))) { + InitBtInterfaceData (&IpmiInstance->IpmiTransport2Ppi); + } +#endif + +#if SsifInterfaceSupport + InitSsifInterfaceData (&IpmiInstance->IpmiTransport2Ppi); +#endif + +#if IpmbInterfaceSupport + InitIpmbInterfaceData (&IpmiInstance->IpmiTransport2Ppi); +#endif +} + +/** + Notify callback function for interfaces. + + @param[in] PeiServices Describes the list of possible PEI + Services. + @param[in] NotifyDescriptor Pointer to notify descriptor. + @param[in] Ppi Pointer to Ppi. + + @return EFI_STATUS Status of Notify call back. + @retval EFI_NOT_FOUND Ipmi hob is not found. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. + @retval EFI_SUCCESS Interface is initialized and installed + Ipmi Ppi successfully. + @retval Others Error status while installing Ppi. +**/ +EFI_STATUS +EFIAPI +NotifyCallback ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, + IN VOID *Ppi + ) +{ + EFI_STATUS Status; + PEI_IPMI_BMC_INSTANCE_DATA *IpmiInstance; + PEI_IPMI_DATA_HOB *IpmiInstancePtrHob; + EFI_HOB_GUID_TYPE *GuidHob; + IPMI_INTERFACE_STATE InterfaceState; + + InterfaceState =3D IpmiInterfaceNotReady; + + GuidHob =3D GetFirstGuidHob (&gPeiIpmiHobGuid); + ASSERT (GuidHob !=3D NULL); + if (GuidHob =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + IpmiInstancePtrHob =3D (PEI_IPMI_DATA_HOB *)=20 + GET_GUID_HOB_DATA(GuidHob); + IpmiInstance =3D (PEI_IPMI_BMC_INSTANCE_DATA*) IpmiInstancePtrHob-= >IpmiInstance; + +#if SsifInterfaceSupport + InitSsifInterfaceData(&IpmiInstance->IpmiTransport2Ppi); + + if (IpmiInstance->IpmiTransport2Ppi.Interface.Ssif.InterfaceState =3D=3D= =20 + IpmiInterfaceInitialized){ + InterfaceState =3D IpmiInterfaceInitialized; + } +#endif + +#if IpmbInterfaceSupport + InitIpmbInterfaceData(&IpmiInstance->IpmiTransport2Ppi); + + if (IpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.InterfaceState =3D=3D= =20 + IpmiInterfaceInitialized){ + InterfaceState =3D IpmiInterfaceInitialized; + } +#endif + // Default Interface data should be initialized to install Ipmi Transpor= t2 Protocol. + if (InterfaceState !=3D IpmiInterfaceInitialized) { + return EFI_UNSUPPORTED; + } + + Status =3D PeiServicesInstallPpi (&IpmiInstance->PeiIpmi2BmcDataDesc); + return Status; +} + +/** + Registers callback for Ppi. + + @param[in] PeiServices Describes the list of possible PEI Services. + @param[in] PpiGuid Pointer to Ppi guid to register call back. + + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. + @retval Others Status of NotifyPpi(). +**/ +EFI_STATUS +RegisterPpiCallback ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_GUID *PpiGuid + ) +{ + EFI_STATUS Status; + EFI_PEI_NOTIFY_DESCRIPTOR *PpiNotifyDesc; + + if ((PpiGuid =3D=3D NULL) || + ((PpiGuid !=3D NULL) && IsZeroBuffer(PpiGuid, sizeof (EFI_GUID))))=20 + { + return EFI_INVALID_PARAMETER; + } + + PpiNotifyDesc =3D (EFI_PEI_NOTIFY_DESCRIPTOR*) AllocateZeroPool (sizeof= =20 + (EFI_PEI_NOTIFY_DESCRIPTOR)); + if (PpiNotifyDesc =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + PpiNotifyDesc->Flags =3D EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK |=20 + EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; + PpiNotifyDesc->Guid =3D PpiGuid; + PpiNotifyDesc->Notify =3D NotifyCallback; + + Status =3D (*PeiServices)->NotifyPpi (PeiServices, PpiNotifyDesc); + return Status; +} /*************************************************************************= **** @brief @@ -31,8 +165,12 @@ PeiInitializeIpmiKcsPhysicalLayer ( { EFI_STATUS Status; PEI_IPMI_BMC_INSTANCE_DATA *mIpmiInstance; + PEI_IPMI_DATA_HOB *IpmiInstancePtrHob; + IPMI_INTERFACE_STATE InterfaceState; + UINT8 Index; - mIpmiInstance =3D NULL; + mIpmiInstance =3D NULL; + InterfaceState =3D IpmiInterfaceNotReady; // // Send Pre-Boot signal to BMC @@ -60,6 +198,18 @@ PeiInitializeIpmiKcsPhysicalLayer ( return EFI_OUT_OF_RESOURCES; } + + // Create Guided hob to pass IPMI Instance data pointer to notify functi= ons. + IpmiInstancePtrHob =3D BuildGuidHob (&gPeiIpmiHobGuid,=20 + sizeof(PEI_IPMI_DATA_HOB)); + if (IpmiInstancePtrHob =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "Failed to create Hob guid for IPMI=20 + Instance!!!\n")); + FreePool (mIpmiInstance); + return EFI_OUT_OF_RESOURCES; + } + + IpmiInstancePtrHob->IpmiInstance =3D (UINTN)mIpmiInstance; + IpmiInstancePtrHob->PreMemIpmiDataHobPtr =3D IpmiInstancePtrHob; + // // Calibrate TSC Counter. Stall for 10ms, then multiply the resulting n= umber of // ticks in that period by 100 to get the number of ticks in a 1 second = timeout @@ -83,6 +233,7 @@ PeiInitializeIpmiKcsPhysicalLayer ( mIpmiInstance->PeiIpmiBmcDataDesc.Guid =3D &gPeiIpmiTransportPp= iGuid; mIpmiInstance->PeiIpmiBmcDataDesc.Ppi =3D &mIpmiInstance->Ipmi= TransportPpi; +#if KcsInterfaceSupport // // Get the Device ID and check if the system is in Force Update mode. // @@ -94,19 +245,85 @@ PeiInitializeIpmiKcsPhysicalLayer ( // // Do not continue initialization if the BMC is in Force Update Mode. // - if (mIpmiInstance->BmcStatus =3D=3D BMC_UPDATE_IN_PROGRESS || mIpmiInsta= nce->BmcStatus =3D=3D BMC_HARDFAIL) { - return EFI_UNSUPPORTED; + if (mIpmiInstance->BmcStatus !=3D BMC_UPDATE_IN_PROGRESS &&=20 + mIpmiInstance->BmcStatus !=3D BMC_HARDFAIL) { + Status =3D PeiServicesInstallPpi=20 + (&mIpmiInstance->PeiIpmiBmcDataDesc); + if (EFI_ERROR (Status)) { + return Status; + } + } +#endif + + InitIpmiTransport2(mIpmiInstance); + + // Check interface data initialized successfully else register notify pr= otocol. + for (Index =3D SysInterfaceKcs; Index < SysInterfaceMax; Index++) { + + switch (Index) { + +#if KcsInterfaceSupport + case SysInterfaceKcs: + if ((mIpmiInstance->BmcStatus !=3D BMC_HARDFAIL) &&=20 + (mIpmiInstance->BmcStatus !=3D BMC_UPDATE_IN_PROGRESS)) { + BMC_INTERFACE_STATUS BmcStatus; + =20 + mIpmiInstance->IpmiTransport2Ppi.Interface.KcsInterfaceState =3D=20 + IpmiInterfaceInitialized; + Status =3D CheckSelfTestByInterfaceType( + =20 + &mIpmiInstance->IpmiTransport2Ppi, + &BmcStatus, + SysInterfaceKcs); + if (!EFI_ERROR (Status) && (BmcStatus !=3D=20 + BmcStatusHardFail)) { + InterfaceState =3D IpmiInterfaceInitialized; + } else { + =20 + mIpmiInstance->IpmiTransport2Ppi.Interface.KcsInterfaceState =3D=20 + IpmiInterfaceInitError; + } + } + break; +#endif + +#if BtInterfaceSupport + case SysInterfaceBt: + if=20 + (mIpmiInstance->IpmiTransport2Ppi.Interface.Bt.InterfaceState =3D=3D=20 + IpmiInterfaceInitialized){ + InterfaceState =3D IpmiInterfaceInitialized; + } + break; +#endif + +#if SsifInterfaceSupport + case SysInterfaceSsif: + if=20 + (mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.InterfaceState =3D=3D=20 + IpmiInterfaceInitialized){ + InterfaceState =3D IpmiInterfaceInitialized; + } else if=20 + (mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.InterfaceState =3D=3D=20 + IpmiInterfaceInitError) { + // Register protocol notify for SMBUS Protocol. + Status =3D RegisterPpiCallback (PeiServices,=20 + &mIpmiInstance->IpmiTransport2Ppi.Interface.Ssif.SsifInterfaceApiGuid) + ; + } + break; +#endif + +#if IpmbInterfaceSupport + case SysInterfaceIpmb: + if=20 + (mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.InterfaceState =3D=3D=20 + IpmiInterfaceInitialized){ + InterfaceState =3D IpmiInterfaceInitialized; + } else if=20 + (mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.InterfaceState =3D=3D=20 + IpmiInterfaceInitError) { + // Register protocol notify for SMBUS Protocol. + Status =3D RegisterPpiCallback (PeiServices,=20 + &mIpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.IpmbInterfaceApiGuid) + ; + } + break; +#endif + default: + break; + } } - // - // Just produce PPI - // - Status =3D PeiServicesInstallPpi (&mIpmiInstance->PeiIpmiBmcDataDesc); - if (EFI_ERROR (Status)) { - return Status; + // Any one of the Interface data should be initialized to install Ipmi T= ransport2 Protocol. + if (InterfaceState !=3D IpmiInterfaceInitialized) { + DEBUG ((DEBUG_INFO, "Interface not ready yet. \n")); + return EFI_SUCCESS; } - return EFI_SUCCESS; + mIpmiInstance->PeiIpmi2BmcDataDesc.Flags =3D=20 + EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; + mIpmiInstance->PeiIpmi2BmcDataDesc.Guid =3D &gPeiIpmiTransport2PpiGuid= ; + mIpmiInstance->PeiIpmi2BmcDataDesc.Ppi =3D &mIpmiInstance->IpmiTransp= ort2Ppi; + + Status =3D PeiServicesInstallPpi (&mIpmiInstance->PeiIpmi2BmcDataDesc); + return Status; } /*************************************************************************= **** @@ -176,60 +393,6 @@ PeimIpmiInterfaceInit ( } // PeimIpmiInterfaceInit() -EFI_STATUS -PeiIpmiSendCommand ( - IN PEI_IPMI_TRANSPORT_PPI *This, - IN UINT8 NetFunction, - IN UINT8 Lun, - IN UINT8 Command, - IN UINT8 *CommandData, - IN UINT32 CommandDataSize, - IN OUT UINT8 *ResponseData, - IN OUT UINT32 *ResponseDataSize - ) -/*++ - -Routine Description: - - Send Ipmi Command in the right mode: HECI or KCS, to the - appropiate device, ME or BMC. - -Arguments: - - This - Pointer to IPMI protocol instance - NetFunction - Net Function of command to send - Lun - LUN of command to send - Command - IPMI command to send - CommandData - Pointer to command data buffer, if needed - CommandDataSize - Size of command data buffer - ResponseData - Pointer to response data buffer - ResponseDataSize - Pointer to response data buffer size - -Returns: - - EFI_INVALID_PARAMETER - One of the input values is bad - EFI_DEVICE_ERROR - IPMI command failed - EFI_BUFFER_TOO_SMALL - Response buffer is too small - EFI_UNSUPPORTED - Command is not supported by BMC - EFI_SUCCESS - Command completed successfully - ---*/ -{ - // - // This Will be unchanged ( BMC/KCS style ) - // - return PeiIpmiSendCommandToBmc ( - This, - NetFunction, - Lun, - Command, - CommandData, - (UINT8) CommandDataSize, - ResponseData, - (UINT8 *) ResponseDataSize, - NULL - ); -} // IpmiSendCommand() EFI_STATUS PeiGetIpmiBmcStatus ( diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= Pei/PeiGenericIpmi.h b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Ge= nericIpmi/Pei/PeiGenericIpmi.h index d31af85325..59b26b6c86 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/Pei= GenericIpmi.h +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/ +++ PeiGenericIpmi.h @@ -3,6 +3,7 @@ @copyright Copyright 2017 - 2021 Intel Corporation.
+ Copyright (c) 1985 - 2023, American Megatrends International LLC.=20 +
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -23,7 +24,9 @@ #include #include #include +#include +#include "PeiIpmiHooks.h" #include "PeiIpmiBmcDef.h" #include "PeiIpmiBmc.h" diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= Pei/PeiGenericIpmi.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/= GenericIpmi/Pei/PeiGenericIpmi.inf index a646161ce1..555b2e5e6c 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/Pei= GenericIpmi.inf +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/ +++ PeiGenericIpmi.inf @@ -3,6 +3,7 @@ # # @copyright # Copyright 2017 - 2021 Intel Corporation.
+# Copyright (c) 1985 - 2023, American Megatrends International LLC.=20 +
# SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -30,6 +31,8 @@ PeiIpmiBmcDef.h PeiGenericIpmi.c PeiGenericIpmi.h + PeiIpmiHooks.c + PeiIpmiHooks.h [Packages] MdePkg/MdePkg.dec @@ -44,17 +47,30 @@ ReportStatusCodeLib TimerLib IpmiPlatformHookLib + HobLib + BmcCommonInterfaceLib + BtInterfaceLib + SsifInterfaceLib + IpmbInterfaceLib [Guids] + gPeiIpmiHobGuid [Ppis] gPeiIpmiTransportPpiGuid #ALWAYS PRODUCE + gPeiIpmiTransport2PpiGuid [Pcd] gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiBmcReadyDelayTimer gIpmiFeaturePkgTokenSpaceGuid.PcdSioMailboxBaseAddress gIpmiFeaturePkgTokenSpaceGuid.PcdSignalPreBootToBmc + gIpmiFeaturePkgTokenSpaceGuid.PcdDefaultSystemInterface + gIpmiFeaturePkgTokenSpaceGuid.PcdBtInterfaceSupport + gIpmiFeaturePkgTokenSpaceGuid.PcdSsifInterfaceSupport + gIpmiFeaturePkgTokenSpaceGuid.PcdKcsInterfaceSupport + gIpmiFeaturePkgTokenSpaceGuid.PcdIpmbInterfaceSupport + gIpmiFeaturePkgTokenSpaceGuid.PcdBtControlPort [Depex] TRUE diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= Pei/PeiIpmiBmc.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Generi= cIpmi/Pei/PeiIpmiBmc.c index dbe25421ae..38ec98c959 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/Pei= IpmiBmc.c +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/ +++ PeiIpmiBmc.c @@ -3,6 +3,7 @@ @copyright Copyright 2016 - 2021 Intel Corporation.
+ Copyright (c) 1985 - 2023, American Megatrends International LLC.=20 +
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -235,7 +236,7 @@ Returns: EFI_STATUS -PeiIpmiBmcStatus ( +IpmiBmcStatus ( IN PEI_IPMI_TRANSPORT_PPI *This, OUT BMC_STATUS *BmcStatus, OUT SM_COM_ADDRESS *ComAddress, diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= Pei/PeiIpmiBmc.h b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Generi= cIpmi/Pei/PeiIpmiBmc.h index 40b9429e84..51ba65966a 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/Pei= IpmiBmc.h +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/ +++ PeiIpmiBmc.h @@ -3,6 +3,7 @@ @copyright Copyright 2016 - 2021 Intel Corporation.
+ Copyright (c) 1985 - 2023, American Megatrends International LLC.=20 +
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -35,4 +36,12 @@ SM_IPMI_BMC_SIGNATURE \ ) +#define INSTANCE_FROM_PEI_IPMI_TRANSPORT2_THIS(a) \ + CR ( \ + a, \ + PEI_IPMI_BMC_INSTANCE_DATA, \ + IpmiTransport2Ppi, \ + SM_IPMI_BMC_SIGNATURE \ + ) + #endif // _PEI_IPMI_BMC_H_ diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= Pei/PeiIpmiBmcDef.h b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Gen= ericIpmi/Pei/PeiIpmiBmcDef.h index fc9fbacf1a..24ef17eadb 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/Pei= IpmiBmcDef.h +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/ +++ PeiIpmiBmcDef.h @@ -3,6 +3,7 @@ @copyright Copyright 2016 - 2021 Intel Corporation.
+ Copyright (c) 1985 - 2023, American Megatrends International LLC.=20 +
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -10,6 +11,8 @@ #define _PEI_IPMI_COMMON_BMC_H_ #include +#include +#include "ServerManagement.h" #define MAX_TEMP_DATA 160 #define BMC_SLAVE_ADDRESS 0x20 @@ -54,7 +57,9 @@ typedef struct { UINT8 SoftErrorCount; UINT16 IpmiIoBase; PEI_IPMI_TRANSPORT_PPI IpmiTransportPpi; + IPMI_TRANSPORT2 IpmiTransport2Ppi; EFI_PEI_PPI_DESCRIPTOR PeiIpmiBmcDataDesc; + EFI_PEI_PPI_DESCRIPTOR PeiIpmi2BmcDataDesc; } PEI_IPMI_BMC_INSTANCE_DATA; // @@ -151,5 +156,11 @@ Returns: --*/ ; +typedef struct _PEI_IPMI_DATA_HOB PEI_IPMI_DATA_HOB; + +struct _PEI_IPMI_DATA_HOB { + UINTN IpmiInstance; /// IpmiInstance po= inter. + PEI_IPMI_DATA_HOB *PreMemIpmiDataHobPtr; ///< HOB Data point= er before Memory discovered +}; #endif //_PEI_IPMI_COMMON_BMC_H_ diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Ipmi= Feature.dsc b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Ipm= iFeature.dsc index 237a4fc006..0401974b82 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature= .dsc +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeat +++ ure.dsc @@ -7,6 +7,7 @@ # for the build infrastructure. # # Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 1985 - 2023, American Megatrends International LLC.=20 +
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -41,10 +42,24 @@ [LibraryClasses.common.PEI_CORE,LibraryClasses.common.PEIM] IpmiBaseLib|IpmiFeaturePkg/Library/PeiIpmiBaseLib/PeiIpmiBaseLib.inf + =20 + SsifInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifI + nterfaceLib/PeiSsifInterfaceLib.inf + =20 + IpmbInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbI + nterfaceLib/PeiIpmbInterfaceLib.inf [LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.UEFI_DRIVER] IpmiBaseLib|IpmiFeaturePkg/Library/IpmiBaseLib/IpmiBaseLib.inf +[LibraryClasses.common] + =20 + BmcCommonInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/ + BmcCommonInterfaceLib.inf + =20 + BtInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/BtInter + faceLib/BtInterfaceLib.inf + +[LibraryClasses.common.DXE_RUNTIME_DRIVER,=20 +LibraryClasses.common.DXE_DRIVER] + =20 + SsifInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifI + nterfaceLib/DxeSsifInterfaceLib.inf + =20 + IpmbInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbI + nterfaceLib/DxeIpmbInterfaceLib.inf + +[LibraryClasses.common.DXE_SMM_DRIVER] + =20 + SsifInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifI + nterfaceLib/SmmSsifInterfaceLib.inf + =20 + IpmbInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbI + nterfaceLib/SmmIpmbInterfaceLib.inf + ##########################################################################= ###### # # Component section - list of all components that need built for this feat= ure. -- 2.38.1.windows.1 -The information contained in this message may be confidential and propriet= ary to American Megatrends (AMI). This communication is intended to be read= only by the individual or entity to whom it is addressed or by their desig= nee. If the reader of this message is not the intended recipient, you are o= n notice that any distribution of this message, in any form, is strictly pr= ohibited. Please promptly notify the sender by reply e-mail or by telephone= at 770-246-8600, and then delete or destroy all copies of the transmission= .