From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.40]) by mx.groups.io with SMTP id smtpd.web10.54063.1686558456506537372 for ; Mon, 12 Jun 2023 01:27:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ami.com header.s=selector1 header.b=MTfo/2Im; spf=pass (domain: ami.com, ip: 40.107.236.40, mailfrom: arunk@ami.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YQF7cUVghRmad5//g4oWF7npniFGNxVIkGdVckkpzL/P+tHurEAZBBk1oWzIZP5zynxJRx8rMdUyrvRXTIxyhCJI44Zzz2i3Gx3fNW1FZu8PTxhgp9U3vIao49BRWQXh9fk2d8tivZ940XAVa/2gImhD+jPSOlCDJokD0oB+HcCppPsRuEY+GOCUfuOELqP0S2u1OrIomo3qQeCZmFLEBTDWaV73Zj2ITHBPPtAdZZwaBhQNYUC6Q3EowfX+HbuQOTUwnIxRk2rU7hNCQ3Um7clE3O9A9w6Mnetg4w78pkjAXZ3s9+ljlIbIbdwq0rJJawhQyahrh+pU7tHPvGnbrw== 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=m191scEFNRyLmBTuWK5/FyHjy0mqehAQ/X/FbvJTJ50=; b=aDnlo+oY6NmZW1tIxSH2WmqX0hwPFCl2eRihPjHbMgoKhGBPwtT9kK5e4E31gmqpbdfsXNLO7ueeUHM0ZX59Ne4zFr0wqU2Pmx77w9DEsEWAtO5tYid8E51X6+I21bY/XMlHB+obuo4O6XJ5gzajEKVDFNRnUxh8iSsv+rFMqpOacvX8rVP+vOkKNtQT7RoT0clicXkdPa5vMvOom8m4J5QXuHQtjSl56WXIPERwNg5LrbP+ZjlVCC4/LmDSFENdSDm5vldNMolaJvZ0OR7DuN73dYl2qJ/p1FV+knNdfXPJwOJ6ol8iKqUlF+H6ElrZTBRTkvcJ7wrk+qUkcPAyOw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ami.com; dmarc=pass action=none header.from=ami.com; dkim=pass header.d=ami.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ami.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m191scEFNRyLmBTuWK5/FyHjy0mqehAQ/X/FbvJTJ50=; b=MTfo/2ImKZ21fYnSKTyvqCnFuJL9yEwRnzib1PXcKHnH3CKoIQEaTfVNxOQpvSnw0qj8II1mPv5v9g4dll6VgM3H3lmuXu1wpnOzd41K3dnUzjxz/dTuvmf5uVbtOaED1XmU7lmAvpXDep6/OPXDd03unbv2DtXD/COeSFuB9K4= Received: from PH0PR10MB5403.namprd10.prod.outlook.com (2603:10b6:510:e3::17) by CH3PR10MB7833.namprd10.prod.outlook.com (2603:10b6:610:1ad::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.44; Mon, 12 Jun 2023 08:27:29 +0000 Received: from PH0PR10MB5403.namprd10.prod.outlook.com ([fe80::720f:ab76:4f7d:a185]) by PH0PR10MB5403.namprd10.prod.outlook.com ([fe80::720f:ab76:4f7d:a185%5]) with mapi id 15.20.6455.030; Mon, 12 Jun 2023 08:27:29 +0000 From: "Arun K" To: "devel@edk2.groups.io" , Arun K CC: "isaac.w.oram@intel.com" , "nathaniel.l.desimone@intel.com" , Ramkumar Krishnamoorthi , Liming Gao Subject: [edk2-devel][edk2-platforms][PATCH V2-1] IpmiFeaturePkg:Provided multiple IPMI interface support in DXE and SMM Thread-Topic: [edk2-devel][edk2-platforms][PATCH V2-1] IpmiFeaturePkg:Provided multiple IPMI interface support in DXE and SMM Thread-Index: AQHZnQe5fJjOTTmD5EGoeEc/lopHrg== Date: Mon, 12 Jun 2023 08:27:29 +0000 Message-ID: Accept-Language: en-GB, 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=ami.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR10MB5403:EE_|CH3PR10MB7833:EE_ x-ms-office365-filtering-correlation-id: 6b3e95dd-bc12-4e21-8393-08db6b1edc39 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: yjCRJLbUMMooOdYJzUMZSR+uEUTIWZHgpopFY06CwmTwegUo1nksf4tYq+J0t+n3g88tI1cda2GEVdhUQlQLhPfbRCQnts2l7ioRTiy2o0upcEEp7y2ulPmKr68RjInKiyHK67HHoNHfGXnDnikNxV0rmMi4ak3WnovxF5slajQVyikHc+pn4ACyRjyuIMp1OcEQQsw3ro+jb8lu6LadADGZTGcRZ57x3Cd5ZIHvc0etDHxJIgVxPpyIxaOefXtyaFeXx7F4NrYix/5A1cpXJdAEvDaHDyvD/2FJod1vJmqkYfS9KsUQS+xpS3ITsA3dNgojQ/HbPrwlKmQtF2gU0wWEHX7q4HsiQyVMHkweAmjFoiw9FlDTgqwin9ZksVUTH52Ni1tiZCPDUsamRTP+ev3RbilHEay93iZwuKGaD+cZNqRDhPP6qdPRHZSPsx6g0X7afQsXYf73E+Ci/j8z9zXRXjfASgnoXyRtN9xUdMq+E/dOZSLxjc71zntEOJZTjrxyiHgEU6wbIVkxygEn3qEH54JNf79ePWuao4pJOpK91tG+0B0rSoBvf8YAuPkOmrOtXCb66aqmBUBpR4WlGiDSLBxXL6ZplXJAKzGA2oDkwOWSiQZzGArh62WQpKR5 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5403.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(376002)(39850400004)(366004)(346002)(451199021)(110136005)(54906003)(91956017)(122000001)(71200400001)(19627235002)(478600001)(76116006)(41300700001)(8676002)(8936002)(4326008)(66946007)(66556008)(66476007)(66446008)(64756008)(316002)(38100700002)(5660300002)(2616005)(186003)(83380400001)(6486002)(6512007)(6506007)(26005)(86362001)(40140700001)(2906002)(30864003)(38070700005)(36756003)(7049001)(559001)(579004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?ipYiLOlVTBSE7PN6tTjfDE0mwID4f/dtO8UsxpWrm9FmIu3/Yb5TFXsSdC?= =?iso-8859-1?Q?AGVkAWEPftK96iBNLRLEkxlcxhIhLgG7dM2badJGW+wfd5KQycFBu4/eZr?= =?iso-8859-1?Q?FD1QOdaDMcD59GOmgYHqbNP1mqeS63gGbiM1bwWZ7m8MgWEa3zbjRDUIl9?= =?iso-8859-1?Q?b/aYPYAtMsN9LaHYsnJ7kv8t9Ipoy69JMKQv3sml09QOSytn/WEXFAhyHX?= =?iso-8859-1?Q?RvgYguzBy/zjuqyhrvoaSncJOr+EC69ME7g4HWoi5/GOvq1rErBii2hOzV?= =?iso-8859-1?Q?eeOrsYMRLelEE39sZzAkopkPkwtZqD58lU5+sdjqTxIrPzNT7SmWWAscUr?= =?iso-8859-1?Q?xFJA7T5djZbCMlj6MhDXDJiD8D+xvFyaTpv6BQ0/IMYwJRO07ugFxU9jN9?= =?iso-8859-1?Q?VW8FLNcA+zveWOmfuEm8dQPCYeDB03sfFRK3kybF0xzZ4pwskxSIDjTPav?= =?iso-8859-1?Q?Gf7vqW6EWD66AJxuDGaQdTX3tSmOsYDVabb9WcEhEzcvdeTRVQjoSgKUtZ?= =?iso-8859-1?Q?1E35K+2+Ea6WErz+KMB2UPGnljDkYmrMtSsvMSysYa5uBdau9JY2Wl+p26?= =?iso-8859-1?Q?t1n45Xtv/as6kqhBxfPsrOcqMatzdisY4pfhKE++upLo4K9enkswpgrSEK?= =?iso-8859-1?Q?/OOCmYMAdh3ZiJuopqd9K1bOs4UuaqvPxALccKNNQxOFl9FEbLPJi1vt3s?= =?iso-8859-1?Q?GUhaUvtYRk2kDnPNaPLAwheeFqd0F7/LTZQtOepmNJF0OKHNwgGkrlHKEX?= =?iso-8859-1?Q?Gp2o6V0jGQtAM3X8SGlW2ZBE7SUUo5PisgoO8C/3peo4PJljsEPd8Q29Tz?= =?iso-8859-1?Q?7CfPZhA36KIHdmG37y0Rb8ZiCeQb2kkjegQw06vsv7Cj5MtXoSFu21Xd34?= =?iso-8859-1?Q?4rD1WzeuGMAG04zHrfUNH+RkKCSA9CMVR83TEte//B5mzN6V7V/Au2w2eF?= =?iso-8859-1?Q?HpuBVHCbsaUAxprMTZWq+Y/iS8bV1Z6TxTyg4Hgp8wmvRgSLHumTCQIFPI?= =?iso-8859-1?Q?jRX+NoSQJ/j2URAMHBNfc/A5ikX5Ueho9TKCg2qmdXmJ9wg6H9pBQNfqY6?= =?iso-8859-1?Q?SbCjhyKX94EQjno43xJ0HQSyRW9xhLel7+iIvd4IV8Hw4WHxhQahCSd9JH?= =?iso-8859-1?Q?D1eGO0incmR8P8XLpjH/O0lR5ZRLVW/ZepWh4VAkjWsMTzQY+UBaB5D24d?= =?iso-8859-1?Q?XV/3yd07UYqiW/2+Gn0dSU2DSq3x1dSjC6cXf/f8KlzvOHNluITBucEPjd?= =?iso-8859-1?Q?eXO+K8HLRzhNasDMS0v5A2C7l4LxpLc80ByZtQNUI+8AmynIkRdpvKQhDT?= =?iso-8859-1?Q?91qSokqJuakn5Tt2BMF+KAXR0s/4czTcT52P1gcSDdTdQrAXolKH1n7Knm?= =?iso-8859-1?Q?UDyBQZO9rwRZM+RdZYrliU5Il7lOwgbwX8uAy9iD8WFk9lZiPNzAxkh20P?= =?iso-8859-1?Q?zwplBms0Bu6oWe8PCRO5WP6pZLjWW9hXyIy3hmVKEfc8Gmz41pOeMeza1H?= =?iso-8859-1?Q?CNuqxu35v9vnoNLNlsQ3xMic54AAO9JhWXfO8WiaPEh8yuzcyqcK/dDDTU?= =?iso-8859-1?Q?qOd8EZwZpw1B1I06zDiX139AMmUyqf0os9DgIYoCN3QdZkJk4BuhjhQN4k?= =?iso-8859-1?Q?Sq/yQ8mz9vCm+oyRiSx+RptY0A2dfz3Ohu?= MIME-Version: 1.0 X-OriginatorOrg: ami.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5403.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b3e95dd-bc12-4e21-8393-08db6b1edc39 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jun 2023 08:27:29.0863 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 27e97857-e15f-486c-b58e-86c2b3040f93 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: gsazh4HvsXqspF89Fe/nt7HHpC/fRReAGFDpiXeHy/V36BOklRlkLami6OfIRBNt X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7833 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 IPMI command which is passed as an argument. Cc: Isaac Oram Cc: Nate DeSimone Cc: Liming Gao Signed-off-by: Arun K --- .../GenericIpmi/Common/IpmiBmc.h | 10 + .../GenericIpmi/Common/IpmiBmcCommon.h | 2 + .../GenericIpmi/Common/IpmiHooks.c | 256 ++++++++++++++++++ .../GenericIpmi/Common/IpmiHooks.h | 93 ++++++- .../GenericIpmi/Dxe/GenericIpmi.inf | 14 +- .../IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c | 205 ++++++++++++++ .../GenericIpmi/Smm/SmmGenericIpmi.c | 200 +++++++++++++- .../GenericIpmi/Smm/SmmGenericIpmi.inf | 12 + .../IpmiFeaturePkg/IpmiFeaturePkg.dec | 45 +++ 9 files changed, 832 insertions(+), 5 deletions(-) diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= Common/IpmiBmc.h b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Generi= cIpmi/Common/IpmiBmc.h index d306a085e5..19fb2a26a3 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/= IpmiBmc.h +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/= IpmiBmc.h @@ -3,6 +3,7 @@ @copyright Copyright 1999 - 2021 Intel Corporation.
+ Copyright (c) 1985 - 2023, American Megatrends International LLC.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -21,6 +22,7 @@ #include #include #include +#include #include "IpmiBmcCommon.h" #include "KcsBmc.h" @@ -41,4 +43,12 @@ SM_IPMI_BMC_SIGNATURE \ ) +#define INSTANCE_FROM_IPMI_TRANSPORT2_THIS(a) \ + CR ( \ + a, \ + IPMI_BMC_INSTANCE_DATA, \ + IpmiTransport2, \ + SM_IPMI_BMC_SIGNATURE \ + ) + #endif // _IPMI_BMC_H_ diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= Common/IpmiBmcCommon.h b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/= GenericIpmi/Common/IpmiBmcCommon.h index 06eab62aae..3b252f5f1c 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/= IpmiBmcCommon.h +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/= IpmiBmcCommon.h @@ -3,6 +3,7 @@ @copyright Copyright 1999 - 2021 Intel Corporation.
+ Copyright (c) 1985 - 2023, American Megatrends International LLC.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -55,6 +56,7 @@ typedef struct { UINT8 SoftErrorCount; UINT16 IpmiIoBase; IPMI_TRANSPORT IpmiTransport; + IPMI_TRANSPORT2 IpmiTransport2; EFI_HANDLE IpmiSmmHandle; } IPMI_BMC_INSTANCE_DATA; diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= Common/IpmiHooks.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Gene= ricIpmi/Common/IpmiHooks.c index b2788e5a4c..19e5c1c04b 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/= IpmiHooks.c +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/= IpmiHooks.c @@ -3,6 +3,7 @@ @copyright Copyright 2014 - 2021 Intel Corporation.
+ Copyright (c) 1985 - 2023, American Megatrends International LLC.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -48,6 +49,11 @@ Returns: --*/ { + + if (This =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + // // This Will be unchanged ( BMC/KCS style ) // @@ -64,6 +70,251 @@ Returns: ); } // IpmiSendCommand() +EFI_STATUS +EFIAPI +IpmiSendCommand2 ( + IN IPMI_TRANSPORT2 *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: + + This API use the default interface (PcdDefaultSystemInterface) to send I= PMI command + in the right mode 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 + +--*/ +{ + + IPMI_BMC_INSTANCE_DATA *IpmiInstance; + + if (This =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + IpmiInstance =3D INSTANCE_FROM_IPMI_TRANSPORT2_THIS(This); + +#if KcsInterfaceSupport + if ((IpmiInstance->IpmiTransport2.InterfaceType =3D=3D SysInterfaceKcs) = && + (IpmiInstance->IpmiTransport2.Interface.KcsInterfaceState =3D=3D Ipm= iInterfaceInitialized)) { + + return IpmiSendCommand ( + &IpmiInstance->IpmiTransport, + NetFunction, + Lun, + Command, + CommandData, + CommandDataSize, + ResponseData, + ResponseDataSize + ); + } +#endif + +#if BtInterfaceSupport + if ((IpmiInstance->IpmiTransport2.InterfaceType =3D=3D SysInterfaceBt) &= & + (IpmiInstance->IpmiTransport2.Interface.Bt.InterfaceState =3D=3D Ipm= iInterfaceInitialized)) { + + return IpmiBtSendCommandToBmc ( + &IpmiInstance->IpmiTransport2, + NetFunction, + Lun, + Command, + CommandData, + (UINT8) CommandDataSize, + ResponseData, + (UINT8*) ResponseDataSize, + NULL + ); + } +#endif + +#if SsifInterfaceSupport + if ((IpmiInstance->IpmiTransport2.InterfaceType =3D=3D SysInterfaceSsif)= && + (IpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState =3D=3D I= pmiInterfaceInitialized)) { + + return IpmiSsifSendCommandToBmc ( + &IpmiInstance->IpmiTransport2, + NetFunction, + Lun, + Command, + CommandData, + (UINT8) CommandDataSize, + ResponseData, + (UINT8*) ResponseDataSize, + NULL + ); + } +#endif + +#if IpmbInterfaceSupport + if ((IpmiInstance->IpmiTransport2.InterfaceType =3D=3D SysInterfaceIpmb)= && + (IpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState =3D=3D I= pmiInterfaceInitialized)) { + + return IpmiIpmbSendCommandToBmc ( + &IpmiInstance->IpmiTransport2, + NetFunction, + Lun, + Command, + CommandData, + (UINT8) CommandDataSize, + ResponseData, + (UINT8*) ResponseDataSize, + NULL + ); + } +#endif + return EFI_UNSUPPORTED; +} // IpmiSendCommand2() + +EFI_STATUS +EFIAPI +IpmiSendCommand2Ex ( + IN IPMI_TRANSPORT2 *This, + IN UINT8 NetFunction, + IN UINT8 Lun, + IN UINT8 Command, + IN UINT8 *CommandData, + IN UINT32 CommandDataSize, + IN OUT UINT8 *ResponseData, + IN OUT UINT32 *ResponseDataSize, + IN SYSTEM_INTERFACE_TYPE InterfaceType + ) +{ +/*++ +Routine Description: + + This API use the specific interface type to send IPMI command + in the right mode 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 + InterfaceType - BMC Interface type. + +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 + +--*/ + + IPMI_BMC_INSTANCE_DATA *IpmiInstance; + + if (This =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + IpmiInstance =3D INSTANCE_FROM_IPMI_TRANSPORT2_THIS(This); + +#if KcsInterfaceSupport + if ((InterfaceType =3D=3D SysInterfaceKcs) && + (IpmiInstance->IpmiTransport2.Interface.KcsInterfaceState =3D=3D Ipm= iInterfaceInitialized)) { + + return IpmiSendCommand ( + &IpmiInstance->IpmiTransport, + NetFunction, + Lun, + Command, + CommandData, + CommandDataSize, + ResponseData, + ResponseDataSize + ); + } +#endif + +#if BtInterfaceSupport + if ((InterfaceType =3D=3D SysInterfaceBt) && + (IpmiInstance->IpmiTransport2.Interface.Bt.InterfaceState =3D=3D Ipm= iInterfaceInitialized)) { + + return IpmiBtSendCommandToBmc ( + &IpmiInstance->IpmiTransport2, + NetFunction, + Lun, + Command, + CommandData, + (UINT8) CommandDataSize, + ResponseData, + (UINT8*) ResponseDataSize, + NULL + ); + } +#endif + +#if SsifInterfaceSupport + if ((InterfaceType =3D=3D SysInterfaceSsif) && + (IpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState =3D=3D I= pmiInterfaceInitialized)) { + + return IpmiSsifSendCommandToBmc ( + &IpmiInstance->IpmiTransport2, + NetFunction, + Lun, + Command, + CommandData, + (UINT8) CommandDataSize, + ResponseData, + (UINT8*) ResponseDataSize, + NULL + ); + } +#endif + +#if IpmbInterfaceSupport + if ((InterfaceType =3D=3D SysInterfaceIpmb) && + (IpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState =3D=3D I= pmiInterfaceInitialized)) { + + return IpmiIpmbSendCommandToBmc ( + &IpmiInstance->IpmiTransport2, + NetFunction, + Lun, + Command, + CommandData, + (UINT8) CommandDataSize, + ResponseData, + (UINT8*) ResponseDataSize, + NULL + ); + } +#endif + return EFI_UNSUPPORTED; +} + EFI_STATUS EFIAPI IpmiGetBmcStatus ( @@ -89,6 +340,11 @@ Returns: --*/ { + + if ((This =3D=3D NULL) || (BmcStatus =3D=3D NULL) || (ComAddress =3D=3D = NULL)) { + return EFI_INVALID_PARAMETER; + } + return IpmiBmcStatus ( This, BmcStatus, diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= Common/IpmiHooks.h b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Gene= ricIpmi/Common/IpmiHooks.h index 823cc08c61..3933e07443 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/= IpmiHooks.h +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/= IpmiHooks.h @@ -3,13 +3,21 @@ @copyright Copyright 2014 - 2021 Intel Corporation.
+ Copyright (c) 1985 - 2023, American Megatrends International LLC.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef _IPMI_HOOKS_H #define _IPMI_HOOKS_H -#include "IpmiBmc.h" +#include +#include +#include +#include +#include +#include +#include +#include // // Internal(hook) function list @@ -54,6 +62,89 @@ Returns: --*/ ; +EFI_STATUS +EFIAPI +IpmiSendCommand2 ( + IN IPMI_TRANSPORT2 *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: + + This API use the default interface (PcdDefaultSystemInterface) to send I= PMI command + in the right mode 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 + +--*/ +; + +EFI_STATUS +EFIAPI +IpmiSendCommand2Ex ( + IN IPMI_TRANSPORT2 *This, + IN UINT8 NetFunction, + IN UINT8 Lun, + IN UINT8 Command, + IN UINT8 *CommandData, + IN UINT32 CommandDataSize, + IN OUT UINT8 *ResponseData, + IN OUT UINT32 *ResponseDataSize, + IN SYSTEM_INTERFACE_TYPE InterfaceType + ) +/*++ +Routine Description: + + This API use the specific interface type to send IPMI command + in the right mode 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 + InterfaceType - BMC Interface type. + +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 + +--*/ +; + EFI_STATUS EFIAPI IpmiGetBmcStatus ( diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= Dxe/GenericIpmi.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Gen= ericIpmi/Dxe/GenericIpmi.inf index 8d80aeb6b5..1564ceb08a 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/Gen= ericIpmi.inf +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/Gen= ericIpmi.inf @@ -3,6 +3,7 @@ # # @copyright # Copyright 2010 - 2021 Intel Corporation.
+# Copyright (c) 1985 - 2023, American Megatrends International LLC.
# SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -49,16 +50,25 @@ IoLib ReportStatusCodeLib TimerLib + BmcCommonInterfaceLib + BtInterfaceLib + SsifInterfaceLib + IpmbInterfaceLib [Protocols] gIpmiTransportProtocolGuid # PROTOCOL ALWAYS_PRODUCED gEfiVideoPrintProtocolGuid - -[Guids] + gIpmiTransport2ProtocolGuid [Pcd] gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiBmcReadyDelayTimer + gIpmiFeaturePkgTokenSpaceGuid.PcdDefaultSystemInterface + gIpmiFeaturePkgTokenSpaceGuid.PcdBtInterfaceSupport + gIpmiFeaturePkgTokenSpaceGuid.PcdSsifInterfaceSupport + gIpmiFeaturePkgTokenSpaceGuid.PcdIpmbInterfaceSupport + gIpmiFeaturePkgTokenSpaceGuid.PcdKcsInterfaceSupport + gIpmiFeaturePkgTokenSpaceGuid.PcdBtControlPort [Depex] gEfiRuntimeArchProtocolGuid AND diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= Dxe/IpmiInit.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericI= pmi/Dxe/IpmiInit.c index c333ca2e06..74d96f8684 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/Ipm= iInit.c +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/Ipm= iInit.c @@ -3,6 +3,7 @@ @copyright Copyright 1999 - 2021 Intel Corporation.
+ Copyright (c) 1985 - 2023, American Megatrends International LLC.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -13,6 +14,7 @@ #include "IpmiBmc.h" #include "IpmiPhysicalLayer.h" #include +#include #ifdef FAST_VIDEO_SUPPORT #include #endif @@ -351,6 +353,130 @@ Returns: return Status; } // GetDeviceId() +/** + Initialize the API and parameters for IPMI Transport2 Instance + + @param[in] IpmiInstance Pointer to IPMI Instance + + @return VOID Nothing. + +**/ +VOID +InitIpmiTransport2 ( + IN IPMI_BMC_INSTANCE_DATA *IpmiInstance + ) +{ + + IpmiInstance->IpmiTransport2.InterfaceType =3D FixedPcdGet8 (= PcdDefaultSystemInterface); + IpmiInstance->IpmiTransport2.IpmiTransport2BmcStatus =3D BmcStatusOk; + IpmiInstance->IpmiTransport2.IpmiSubmitCommand2 =3D IpmiSendComman= d2; + IpmiInstance->IpmiTransport2.IpmiSubmitCommand2Ex =3D IpmiSendComman= d2Ex; + +#if BtInterfaceSupport + InitBtInterfaceData(&IpmiInstance->IpmiTransport2); +#endif + +#if SsifInterfaceSupport + InitSsifInterfaceData(&IpmiInstance->IpmiTransport2); +#endif + +#if IpmbInterfaceSupport + InitIpmbInterfaceData(&IpmiInstance->IpmiTransport2); +#endif +} + +/** + Notify call back function. + + @param[in] Event Event which caused this handler. + @param[in] Context Context passed during Event Handler registration. + + @return VOID Nothing. + +**/ +VOID +EFIAPI +DxeNotifyCallback ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + IPMI_INTERFACE_STATE InterfaceState; + EFI_HANDLE Handle; + + InterfaceState =3D IpmiInterfaceNotReady; + +#if SsifInterfaceSupport + InitSsifInterfaceData(&mIpmiInstance->IpmiTransport2); + + if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState =3D=3D I= pmiInterfaceInitialized) { + InterfaceState =3D IpmiInterfaceInitialized; + } +#endif + +#if IpmbInterfaceSupport + InitIpmbInterfaceData(&mIpmiInstance->IpmiTransport2); + + if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState =3D=3D I= pmiInterfaceInitialized) { + InterfaceState =3D IpmiInterfaceInitialized; + } +#endif + // Default Interface data should be initialized to install Ipmi Transpor= t2 Protocol. + if (InterfaceState !=3D IpmiInterfaceInitialized) { + return; + } + + Handle =3D NULL; + Status =3D gBS->InstallProtocolInterface ( + &Handle, + &gIpmiTransport2ProtocolGuid, + EFI_NATIVE_INTERFACE, + &mIpmiInstance->IpmiTransport2 + ); + ASSERT_EFI_ERROR (Status); +} + +/** + Registers protocol notify call back. + + @param[in] ProtocolGuid Pointer to Protocol Guid to register + call back. + + @retval EFI_INVALID_PARAMETER If the ProtocolGuid is 0 or NULL. + @retval Others Status of call back registration. + +**/ +EFI_STATUS +DxeRegisterProtocolCallback ( + IN EFI_GUID *ProtocolGuid + ) +{ + EFI_STATUS Status; + EFI_EVENT NotifyEvent; + VOID *Registration; + + if ((ProtocolGuid =3D=3D NULL) || + ((ProtocolGuid !=3D NULL) && IsZeroBuffer (ProtocolGuid, sizeof (EFI= _GUID)))) { + return EFI_INVALID_PARAMETER; + } + + Status =3D gBS->CreateEvent ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + DxeNotifyCallback, + NULL, + &NotifyEvent); + + if (!EFI_ERROR (Status)) { + Status =3D gBS->RegisterProtocolNotify ( + ProtocolGuid, + NotifyEvent, + &Registration); + } + + return Status; +} /** This function initializes KCS interface to BMC. @@ -376,7 +502,10 @@ InitializeIpmiKcsPhysicalLayer ( UINT8 ErrorCount; EFI_HANDLE Handle; UINT8 Index; + IPMI_INTERFACE_STATE InterfaceState =3D IpmiInterfaceNotReady; +#if KcsInterfaceSupport EFI_STATUS_CODE_VALUE StatusCodeValue[MAX_SOFT_COUNT]; +#endif ErrorCount =3D 0; mImageHandle =3D ImageHandle; @@ -405,6 +534,8 @@ InitializeIpmiKcsPhysicalLayer ( mIpmiInstance->Signature =3D SM_IPMI_BMC_SIGNAT= URE; mIpmiInstance->SlaveAddress =3D BMC_SLAVE_ADDRESS; mIpmiInstance->BmcStatus =3D BMC_NOTREADY; + +#if KcsInterfaceSupport mIpmiInstance->IpmiTransport.IpmiSubmitCommand =3D IpmiSendCommand; mIpmiInstance->IpmiTransport.GetBmcStatus =3D IpmiGetBmcStatus; @@ -454,7 +585,81 @@ InitializeIpmiKcsPhysicalLayer ( ); ASSERT_EFI_ERROR (Status); } +#endif + + // Initialise the IPMI transport2 + InitIpmiTransport2(mIpmiInstance); + + // Check interface data initialized successfully else register notify = protocol. + for (Index =3D SysInterfaceKcs; Index < SysInterfaceMax; Index++) { + + switch (Index) { +#if KcsInterfaceSupport + case SysInterfaceKcs: + if ((mIpmiInstance->BmcStatus !=3D BMC_HARDFAIL) && (mIpmi= Instance->BmcStatus !=3D BMC_UPDATE_IN_PROGRESS)) { + BMC_INTERFACE_STATUS BmcStatus; + mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceSt= ate =3D IpmiInterfaceInitialized; + Status =3D CheckSelfTestByInterfaceType( + &mIpmiInstance->IpmiTransport2, + &BmcStatus, + SysInterfaceKcs); + if (!EFI_ERROR (Status) && (BmcStatus !=3D BmcStatusHa= rdFail)) { + InterfaceState =3D IpmiInterfaceInitialized; + } else { + mIpmiInstance->IpmiTransport2.Interface.KcsInterfa= ceState =3D IpmiInterfaceInitError; + } + } + break; +#endif + +#if BtInterfaceSupport + case SysInterfaceBt: + if (mIpmiInstance->IpmiTransport2.Interface.Bt.InterfaceSt= ate =3D=3D IpmiInterfaceInitialized){ + InterfaceState =3D IpmiInterfaceInitialized; + } + break; +#endif + +#if SsifInterfaceSupport + case SysInterfaceSsif: + if (mIpmiInstance->IpmiTransport2.Interface.Ssif.Interface= State =3D=3D IpmiInterfaceInitialized) { + InterfaceState =3D IpmiInterfaceInitialized; + } else if (mIpmiInstance->IpmiTransport2.Interface.Ssif.In= terfaceState =3D=3D IpmiInterfaceInitError) { + // Register protocol notify for SMBUS Protocol. + Status =3D DxeRegisterProtocolCallback ( + &mIpmiInstance->IpmiTransport2.Interface.S= sif.SsifInterfaceApiGuid); + } + break; +#endif +#if IpmbInterfaceSupport + case SysInterfaceIpmb: + if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.Interface= State =3D=3D IpmiInterfaceInitialized) { + InterfaceState =3D IpmiInterfaceInitialized; + } else if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.In= terfaceState =3D=3D IpmiInterfaceInitError) { + // Register Protocol notify for I2C Protocol. + Status =3D DxeRegisterProtocolCallback ( + &mIpmiInstance->IpmiTransport2.Interface.I= pmb.IpmbInterfaceApiGuid); + } + break; +#endif + default: + break; + } + } + + // Any one of the Interface data should be initialized to install IPMI= Transport2 Protocol. + if (InterfaceState !=3D IpmiInterfaceInitialized) { + return EFI_SUCCESS; + } + Handle =3D NULL; + Status =3D gBS->InstallProtocolInterface ( + &Handle, + &gIpmiTransport2ProtocolGuid, + EFI_NATIVE_INTERFACE, + &mIpmiInstance->IpmiTransport2 + ); + ASSERT_EFI_ERROR (Status); return EFI_SUCCESS; } } // InitializeIpmiKcsPhysicalLayer() diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= Smm/SmmGenericIpmi.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Ge= nericIpmi/Smm/SmmGenericIpmi.c index 1af2d18f79..adf59374b3 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/Smm= GenericIpmi.c +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/Smm= GenericIpmi.c @@ -3,6 +3,7 @@ @copyright Copyright 1999 - 2021 Intel Corporation.
+ Copyright (c) 1985 - 2023, American Megatrends International LLC.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -24,6 +25,7 @@ #include "IpmiBmcCommon.h" #include "IpmiBmc.h" #include +#include IPMI_BMC_INSTANCE_DATA *mIpmiInstance; EFI_HANDLE mImageHandle; @@ -115,6 +117,123 @@ Returns: return Status; } +/** + Initialize the API and parameters for IPMI Transport2 Instance + + @param[in] IpmiInstance Pointer to IPMI Instance + + @return 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 BtInterfaceSupport + InitBtInterfaceData (&IpmiInstance->IpmiTransport2); +#endif + +#if SsifInterfaceSupport + InitSsifInterfaceData (&IpmiInstance->IpmiTransport2); +#endif + +#if IpmbInterfaceSupport + InitIpmbInterfaceData (&IpmiInstance->IpmiTransport2); +#endif +} + +/** + Notify call back to initialize the interfaces and install Smm Ipmi + protocol. + + @param[in] Protocol Pointer to the protocol guid. + @param[in] Interface Pointer to the protocol instance. + @param[in] Handle Handle on which the protocol is installed. + + @return EFI_STATUS 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 SsifInterfaceSupport + InitSsifInterfaceData(&mIpmiInstance->IpmiTransport2); + + if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState =3D=3D I= pmiInterfaceInitialized){ + InterfaceState =3D IpmiInterfaceInitialized; + } +#endif + +#if IpmbInterfaceSupport + InitIpmbInterfaceData(&mIpmiInstance->IpmiTransport2); +#endif + + 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) { + Handle =3D NULL; + Status =3D gSmst->SmmInstallProtocolInterface ( + &Handle, + &gSmmIpmiTransport2ProtocolGuid, + EFI_NATIVE_INTERFACE, + &mIpmiInstance->IpmiTransport2 + ); + } + return EFI_SUCCESS; +} + +/** + Registers Protocol call back + + @param ProtocolGuid Pointer to Protocol GUID to register call ba= ck + + @retval EFI_INVALID_PARAMETER If the ProtocolGuid is 0 or NULL. + @retval Others Status of Notify registration. +**/ +EFI_STATUS +SmmRegisterProtocolCallback ( + IN EFI_GUID *ProtocolGuid +) +{ + EFI_STATUS Status; + VOID *Registration; + + if ((ProtocolGuid =3D=3D NULL) || + ((ProtocolGuid !=3D NULL) && IsZeroBuffer (ProtocolGuid, sizeof (E= FI_GUID)))) { + return EFI_INVALID_PARAMETER; + } + + Status =3D gSmst->SmmRegisterProtocolNotify ( + ProtocolGuid, + SmmNotifyCallback, + &Registration ); + return Status; +} + EFI_STATUS SmmInitializeIpmiKcsPhysicalLayer ( IN EFI_HANDLE ImageHandle, @@ -142,10 +261,13 @@ Returns: UINT8 ErrorCount; EFI_HANDLE Handle; EFI_STATUS_CODE_VALUE StatusCodeValue[MAX_SOFT_COUNT]; + IPMI_INTERFACE_STATE InterfaceState; + UINT8 Index; DEBUG ((DEBUG_INFO,"SmmInitializeIpmiKcsPhysicalLayer entry \n")); - ErrorCount =3D 0; - mImageHandle =3D ImageHandle; + ErrorCount =3D 0; + mImageHandle =3D ImageHandle; + InterfaceState =3D IpmiInterfaceNotReady; mIpmiInstance =3D AllocateZeroPool (sizeof (IPMI_BMC_INSTANCE_DATA)); ASSERT (mIpmiInstance !=3D NULL); @@ -170,6 +292,7 @@ Returns: mIpmiInstance->IpmiTransport.IpmiSubmitCommand =3D IpmiSendCommand; mIpmiInstance->IpmiTransport.GetBmcStatus =3D IpmiGetBmcStatus; +#if KcsInterfaceSupport 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. @@ -191,6 +314,79 @@ Returns: &mIpmiInstance->IpmiTransport ); ASSERT_EFI_ERROR (Status); +#endif + + InitIpmiTransport2(mIpmiInstance); + + // Check interface data initialized successfully else register notify = protocol. + for (Index =3D SysInterfaceKcs; Index < SysInterfaceMax; Index++) { + + switch (Index) { +#if KcsInterfaceSupport + case SysInterfaceKcs: + if ((mIpmiInstance->BmcStatus !=3D BMC_HARDFAIL) && (mIpmi= Instance->BmcStatus !=3D BMC_UPDATE_IN_PROGRESS)) { + BMC_INTERFACE_STATUS BmcStatus; + mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceSt= ate =3D IpmiInterfaceInitialized; + Status =3D CheckSelfTestByInterfaceType( + &mIpmiInstance->IpmiTranspo= rt2, + &BmcStatus, + SysInterfaceKcs); + if (!EFI_ERROR (Status) && (BmcStatus !=3D BmcStatusHa= rdFail)) { + InterfaceState =3D IpmiInterfaceInitialized; + } else { + mIpmiInstance->IpmiTransport2.Interface.KcsInterfa= ceState =3D IpmiInterfaceInitError; + } + } + break; +#endif + +#if BtInterfaceSupport + case SysInterfaceBt: + if (mIpmiInstance->IpmiTransport2.Interface.Bt.InterfaceSt= ate =3D=3D IpmiInterfaceInitialized){ + InterfaceState =3D IpmiInterfaceInitialized; + } + break; +#endif + +#if SsifInterfaceSupport + case SysInterfaceSsif: + if (mIpmiInstance->IpmiTransport2.Interface.Ssif.Interface= State =3D=3D IpmiInterfaceInitialized){ + InterfaceState =3D IpmiInterfaceInitialized; + } else if (mIpmiInstance->IpmiTransport2.Interface.Ssif.In= terfaceState =3D=3D IpmiInterfaceInitError) { + // Register protocol notify for SMBUS Protocol. + Status =3D SmmRegisterProtocolCallback (&mIpmiInstance= ->IpmiTransport2.Interface.Ssif.SsifInterfaceApiGuid); + } + break; +#endif + +#if IpmbInterfaceSupport + case SysInterfaceIpmb: + if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.Interface= State =3D=3D IpmiInterfaceInitialized){ + InterfaceState =3D IpmiInterfaceInitialized; + } else if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.In= terfaceState =3D=3D IpmiInterfaceInitError) { + // Register protocol notify for SMBUS Protocol. + Status =3D SmmRegisterProtocolCallback (&mIpmiInstance= ->IpmiTransport2.Interface.Ipmb.IpmbInterfaceApiGuid); + } + break; +#endif + default: + break; + } + } + + // Default Interface data should be initialized to install Ipmi Transp= ort2 Protocol. + if (InterfaceState =3D=3D IpmiInterfaceInitialized) { + Handle =3D NULL; + Status =3D gSmst->SmmInstallProtocolInterface ( + &Handle, + &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")); diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/= Smm/SmmGenericIpmi.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/= GenericIpmi/Smm/SmmGenericIpmi.inf index f430195d1e..12dc17ae84 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/Smm= GenericIpmi.inf +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/Smm= GenericIpmi.inf @@ -3,6 +3,7 @@ # # @copyright # Copyright 2010 - 2021 Intel Corporation.
+# Copyright (c) 1985 - 2023, American Megatrends International LLC.
# SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -39,15 +40,26 @@ IoLib ReportStatusCodeLib TimerLib + BmcCommonInterfaceLib + BtInterfaceLib + SsifInterfaceLib + IpmbInterfaceLib [Protocols] gSmmIpmiTransportProtocolGuid # PROTOCOL ALWAYS_PROD= UCED + gSmmIpmiTransport2ProtocolGuid # PROTOCOL ALWAYS_PROD= UCED [Guids] [Pcd] gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiSmmIoBaseAddress gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiBmcReadyDelayTimer + gIpmiFeaturePkgTokenSpaceGuid.PcdDefaultSystemInterface + gIpmiFeaturePkgTokenSpaceGuid.PcdBtControlPort + gIpmiFeaturePkgTokenSpaceGuid.PcdBtInterfaceSupport + gIpmiFeaturePkgTokenSpaceGuid.PcdSsifInterfaceSupport + gIpmiFeaturePkgTokenSpaceGuid.PcdKcsInterfaceSupport + gIpmiFeaturePkgTokenSpaceGuid.PcdIpmbInterfaceSupport [Depex] gIpmiTransportProtocolGuid diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeatureP= kg.dec b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.d= ec index 8c1b902446..2131ec475b 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec @@ -9,6 +9,7 @@ # # Copyright (c) 2019-2021, Intel Corporation. All rights reserved.
# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+# Copyright (c) 1985 - 2023, American Megatrends International LLC.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -43,16 +44,26 @@ # IpmiBaseLib|Include/Library/IpmiBaseLib.h + ## @libraryclass Provides generic functions among all interfaces. + BmcCommonInterfaceLib|Include/Library/BmcCommonInterfaceLib.h + BtInterfaceLib|Include/Library/BtInterfaceLib.h + SsifInterfaceLib|Include/Library/SsifInterfaceLib.h + IpmbInterfaceLib|Include/Library/IpmbInterfaceLib.h + [Guids] gIpmiFeaturePkgTokenSpaceGuid =3D {0xc05283f6, 0xd6a8, 0x48f3, {0x9b, = 0x59, 0xfb, 0xca, 0x71, 0x32, 0x0f, 0x12}} + gPeiIpmiHobGuid =3D {0xcb4d3e13, 0x1e34, 0x4373, {0x8a, 0= x81, 0xe9, 0x0, 0x10, 0xf1, 0xdb, 0xa4}} [Ppis] gPeiIpmiTransportPpiGuid =3D {0x7bf5fecc, 0xc5b5, 0x4b25, {0x81, 0x1b, 0= xb4, 0xb5, 0xb, 0x28, 0x79, 0xf7}} + gPeiIpmiTransport2PpiGuid =3D {0x8122CEBD, 0xF4FD, 0x4EA8, { 0x97, 0x6C,= 0xF0, 0x30, 0xAD, 0xDC, 0x4C, 0xB4 }} [Protocols] gIpmiTransportProtocolGuid =3D {0x6bb945e8, 0x3743, 0x433e, {0xb9, 0x0e= , 0x29, 0xb3, 0x0d, 0x5d, 0xc6, 0x30}} gSmmIpmiTransportProtocolGuid =3D {0x8bb070f1, 0xa8f3, 0x471d, {0x86, 0= x16, 0x77, 0x4b, 0xa3, 0xf4, 0x30, 0xa0}} gEfiVideoPrintProtocolGuid =3D {0x3dbf3e06, 0x9d0c, 0x40d3, {0xb2, 0= x17, 0x45, 0x5f, 0x33, 0x9e, 0x29, 0x09}} + gIpmiTransport2ProtocolGuid =3D { 0x4A1D0E66, 0x5271, 0x4E22, { 0x83, 0x= FE, 0x90, 0x92, 0x1B, 0x74, 0x82, 0x13 }} + gSmmIpmiTransport2ProtocolGuid =3D { 0x1DBD1503, 0x0A60, 0x4230, { 0xAA,= 0xA3, 0x80, 0x16, 0xD8, 0xC3, 0xDE, 0x2F }} [PcdsFeatureFlag] gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable|FALSE|BOOLEAN|0xA0000= 001 @@ -61,6 +72,40 @@ gIpmiFeaturePkgTokenSpaceGuid.PcdMaxSOLChannels|3|UINT8|0xF0000001 #When True, BIOS will send a Pre-Boot signal to BMC gIpmiFeaturePkgTokenSpaceGuid.PcdSignalPreBootToBmc|FALSE|BOOLEAN|0xF000= 0002 + # typedef enum { + # SysInterfaceUnknown, // Unknown interface type. + # SysInterfaceKcs, // Kcs interface =3D 1. + # SysInterfaceSmic, // Smic interface =3D 2. + # SysInterfaceBt, // Bt interface =3D 3. + # SysInterfaceSsif, // Ssif interface =3D 4. + # SysInterfaceMax // Maximum interface type. + # } SYSTEM_INTERFACE_TYPE; + gIpmiFeaturePkgTokenSpaceGuid.PcdDefaultSystemInterface|1|UINT8|0xF00000= 03 + + #BT Base address, retry counter and delay parameters + gIpmiFeaturePkgTokenSpaceGuid.PcdBtCommandRetryCounter|0x0004E400|UINT32= |0xF0000004 + gIpmiFeaturePkgTokenSpaceGuid.PcdBtControlPort|0xE4|UINT16|0xF0000005 + gIpmiFeaturePkgTokenSpaceGuid.PcdBtBufferPort|0xE5|UINT16|0xF0000006 + gIpmiFeaturePkgTokenSpaceGuid.PcdBtDelayPerRetry|15|UINT32|0xF0000007 + gIpmiFeaturePkgTokenSpaceGuid.PcdBtInterruptMaskPort|0xE6|UINT16|0xF0000= 008 + gIpmiFeaturePkgTokenSpaceGuid.PcdBtBufferSize|0x40|UINT8|0xF0000009 + + #SSIF slave address, retry counter and delay parameters + gIpmiFeaturePkgTokenSpaceGuid.PcdSsifSlaveAddress|0x10|UINT16|0xF000000A + gIpmiFeaturePkgTokenSpaceGuid.PcdSsifRequestRetriesDelay|0xCB20|UINT32|0= xF000000B + gIpmiFeaturePkgTokenSpaceGuid.PcdSsifCommandtRetryCounter|0x5|UINT16|0xF= 000000C + + #Interface access type for BMC communication. 0-MMIO, 1-IO + gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiDefaultAccessType|1|UINT8|0xF000000= D + gIpmiFeaturePkgTokenSpaceGuid.PcdMmioBaseAddress|0x0|UINT32|0xF000000E + gIpmiFeaturePkgTokenSpaceGuid.PcdBaseAddressRange|0x0|UINT32|0xF000000F + + gIpmiFeaturePkgTokenSpaceGuid.PcdBmcSlaveAddress|0x20|UINT32|0xF0000010 + + gIpmiFeaturePkgTokenSpaceGuid.PcdKcsInterfaceSupport|1|UINT8|0xF0000011 + gIpmiFeaturePkgTokenSpaceGuid.PcdBtInterfaceSupport|1|UINT8|0xF0000012 + gIpmiFeaturePkgTokenSpaceGuid.PcdSsifInterfaceSupport|1|UINT8|0xF0000013 + gIpmiFeaturePkgTokenSpaceGuid.PcdIpmbInterfaceSupport|1|UINT8|0xF0000014 [PcdsDynamic, PcdsDynamicEx] gIpmiFeaturePkgTokenSpaceGuid.PcdFRB2EnabledFlag|TRUE|BOOLEAN|0xD0000001 -- 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= .