From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.47]) by mx.groups.io with SMTP id smtpd.web10.2042.1676619000760334356 for ; Thu, 16 Feb 2023 23:30:01 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=v+wVpquB; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.92.47, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F+Y593qWVSMSMzP3AdTxl4UQslbhSGaMCYwbCsp0o/qPLte8WgIJnw5WsycUCY5dirKfS+9zxatU3rvgtdMztoYnDWw9WCFMAU/M+KtTAlnPKwoBblemVsQNIXgC9ti+bN2W4RyzIQ6HhK5DDqt1Vk/hlDd2PvSJM5y5OSH0c8UOVlKCpwyphXaHUq9OS9oovttGnuY3oiLM/XKpdUoc7rNXuM3TUUiQCJcB5Va/UzXUXDEFIi+dGSSqqccgJHm+G584IzlFCO5pkhA6SNTppJXZPR9DT0MTslQXsx868H6B57pYlYsBm+37y1QQV0MJTK3GjmDS9UAsxoUG7mJ4rw== 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=HR7y7oVTU6qF0aR8G4CSYsDcDpNak8HJ4XDUBvPJyEU=; b=jNEGapc25HTdUjlPOBGn/y5svUzokLO90YO/SFIbMi7rWnk2bhVK2glsOOn6QELyM10B69Q4AvIFLclGQaRUuWPVuIyN1eBXRBpajdXjXWAF/MkZhK4phu3SkfDu1CLT5Dt+3gpyJjHHSnFCR4kqT2wvNBBkb234H9ji+lnFyj94sAEgKqv4Chxf4Z1hupk1n8DRJPPTAFEqbR2QEjV3z/KECJspuUP+VfX/E0RCkpdFKW3RjwxHSPlrEeQ8WBuEFYG9jPTUBqm16jVdGsXIzlJemg8q/WV2O8Dgq5Wqc+vVxGLDvoqEQnKDeJluLKmZxKlrF2mSaAd7vxeNyolHXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HR7y7oVTU6qF0aR8G4CSYsDcDpNak8HJ4XDUBvPJyEU=; b=v+wVpquB8DIH+cTWZpDMgA+KpfHjSf8C5ljbzjTSuqT/uq6cfzSeYO4j8kZVdumi8FOLbRo+6w0Dq7j844Tp6cuVzrXiMGWXRpu16GcjgbVI9dcx4jUv5SpKf7rNPIvNzGb4TpKO+53pUcMPqIW5lRMnZf2Qhe8ZSTu+eOgY3v8= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by CH3PR12MB8235.namprd12.prod.outlook.com (2603:10b6:610:120::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Fri, 17 Feb 2023 07:29:58 +0000 Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::d606:ab63:cf3:5d36]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::d606:ab63:cf3:5d36%5]) with mapi id 15.20.6086.024; Fri, 17 Feb 2023 07:29:58 +0000 From: "Chang, Abner" To: "Oram, Isaac W" , "devel@edk2.groups.io" CC: "Gao, Liming" , "Desimone, Nathaniel L" , "Attar, AbdulLateef (Abdul Lateef)" , Nickle Wang , Igor Kulchytskyy Subject: Re: [edk2-platforms][PATCH 5/7] ManageabilityPkg: Implement Ipmi Protocol/Ppi Thread-Topic: [edk2-platforms][PATCH 5/7] ManageabilityPkg: Implement Ipmi Protocol/Ppi Thread-Index: AQHZOxCFJ7DO74EARkyKozFzdywpc67QzyBQgAH3E+A= Date: Fri, 17 Feb 2023 07:29:58 +0000 Message-ID: References: <20230207162236.1406-1-abner.chang@amd.com> <20230207162236.1406-6-abner.chang@amd.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-02-17T07:29:56Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=46a904a9-af88-4688-849c-360d28e2aac0; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3966:EE_|CH3PR12MB8235:EE_ x-ms-office365-filtering-correlation-id: 725dcfa6-483f-4f5a-37ce-08db10b8c5e4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ccsqBSgR69BE9fseJDZj2B8jyfhUpKKr+gy0xWt0kyC8lmLkbTrDuV+D4O7nis79aOKArCk7JlE85MXmedWdZrV2vmWq3YbS376cTmWjPjA6TL6LKl5rqLe1b6zC9Uub9s21wl0/VtNhyCXDO4Q2Dcz45zgeuWHGsHzMTSnWG7vlH34dDkmKHBwYD8lZKfX50tIFanZiccDURFPg/Ie6mWGVdX2wCNkq6PO2/sR7cMUIuhM2v/0Jpb93kY9Y0TIpbLZ/Dcd+0h/ETvUY2mU+SELtDZhqLDn2FzVFHhex/madzt4P9V4G0KA+xII7sd4tAn/oqXwl006FrLt54bD91QbQDZ9+jmJq9IDTkNm7RZiI4s4kSbX73eiYOkeRfB++WxqLuO20zxiGIMaEWhPPIC1M+iLPJ1FZzMjs5s1zQE6La+u0qvRmc/K5nRb1gFKUXC808bDN9ffC48ihfdcCuLFa7kgrI18jX1sQ+hQljLyLEbx1bu4gNGKLTkhcSIjDUv3kEDZ9K3l8K162FuNBx+QqsenPn+vlzKh4nAbuB3nHOiqBM6CVU2w4JxGj4n24jFfCdNCWuKYegPnql8sxptGbf14ZfU9E06NlZ1nMrac68oMtSVhkEqRXYB9uIxpSDsPsVOMTiJ851EQtzo5slcTW0tjnEohZTHesfthxmEnH9WKUCpxNpRwjKtvrUUi/QIwTqeKkM3WcRNQ1sQfQRQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3966.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(39860400002)(136003)(396003)(376002)(366004)(451199018)(478600001)(2906002)(6506007)(26005)(9686003)(53546011)(186003)(7696005)(52536014)(30864003)(38100700002)(71200400001)(86362001)(8936002)(41300700001)(122000001)(5660300002)(33656002)(38070700005)(54906003)(316002)(110136005)(83380400001)(55016003)(66556008)(66946007)(8676002)(76116006)(64756008)(66476007)(66446008)(4326008)(579004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?tkCBKSjCx13gDPqWDhd8xo81XB0FlF3sOAqGd7synfJbOYecCqR47hoWZlsu?= =?us-ascii?Q?WEv2eQNGkBN8KnKXxhyTHoSuY6N17nPcxx+MTmeGlhkk2voiJqcR/cGxKEfo?= =?us-ascii?Q?3hLLYJ253Hqxvjdi26CS8HufRo2wLddr7uSQmjwPC4Ky30E5rard2CKn9iBU?= =?us-ascii?Q?FvDLrqWqyY8bGnEvXRGrcwRggX8CtXFATaOvhAL/XY+bPd02uyDQWhW/P/rm?= =?us-ascii?Q?o9u5lWE+FfCGd61U5nvUirawLZHwwPvA2r1YNcaVak5BpN3nhiug95oEheVK?= =?us-ascii?Q?6O/u27jSu6vRvD7rl27XIgQuud8xmi7vUtfoHyVXooOR4ZdVHi3Mk/3Ag4C3?= =?us-ascii?Q?+tSI43vuah4mxaOEgyd/MMWs+GqsyPIdErzocuUL5QOniw1fm3faoh6YTUkq?= =?us-ascii?Q?mD4wfKY+QXO3/Oa4AsMjfSBLcyiijM/ULWLbIkN1mBRc0yVVJPCrpuvxzDlX?= =?us-ascii?Q?feQ+b94HeIJpco9ijBPcTwW2VyaPeoBmrxRREIi0bnvh2X45KkrFFWPXBMrZ?= =?us-ascii?Q?JG/Bdn41aaQf+1slspkrnDqbtiY2eorE5lGAh+cWdomX+x9VGO1Ti9JR2ss4?= =?us-ascii?Q?0tCrfBhSOzgg0paFnyFrflG0i+jJxAueK41wTzFNIa4lS1R0kLrhQoIaAYmY?= =?us-ascii?Q?k9XBL+jAX76x7xS9fw9OOHrIj03pQpPNv2ZcYGL+TV0e3S6QQIr2fREo5vvB?= =?us-ascii?Q?iZm9BOn3Rgls9SDoQL7a1bJ+IIqPw3n3Av4bqmm2DOI5aX60s+g7FmQLhBq3?= =?us-ascii?Q?q9u3wuBfA7m9JY3DtE6ZpJh/F3bY2gauXsmnAhwflkye6FiGSrfhlRsJ8AeF?= =?us-ascii?Q?yy3d41OBt9ckDmbqX8BtEFVrKTWyQatyZLRzag9XFSk1oWEBhB8DS9kMkZRA?= =?us-ascii?Q?dHPwbt11Z2MQajO6o0IQScNSAdL6txhPX3hq+erX0tKqa0xvNAl8P5bBYztJ?= =?us-ascii?Q?gU58DZuqJigM+O+v9igxIiI2KOdmlGlO8T8KQrOyRuxFETkkErOJpASBkxys?= =?us-ascii?Q?LuXp9LFgrWntBmw49tcXXpTJXNrrPIwfGQRsH1KH1PHsXHCsam9K/KZKpToF?= =?us-ascii?Q?sa+GkKMb1LUIxKBIKCFR0llHqWkCmAfk6OlByL7rsVMtpcix+wSV9pNJuFTw?= =?us-ascii?Q?hfeN3Jn0uWCW41+K7XFp78PiuGO8tkICH6KpfuzVhr6o5rY7wpSuwaKz/Btt?= =?us-ascii?Q?EPZaaPQaXSquiG94grOpDB337K//i9W5uyGJxrgJR/u+VspAjIir2vwXikPJ?= =?us-ascii?Q?PNLBJBZKlZVnlTnFQJQaPvz2yd08hwmqSkvXRX3aZHVMQHLPZT63fwWOjT0m?= =?us-ascii?Q?m5oJgbuh1nEk8jd1yCl1yIu3HhMKAxfA/6hgwiu5hxwabPVxBPTybxFl0oF0?= =?us-ascii?Q?30Lh0E7mhQYTUvS1aCdqnjzNasP7uMFT5s3gc+W42wvbdJBqBKDOIeMCt6q8?= =?us-ascii?Q?b4/LyozdD6qHZhx0ukHjPiIrdABErXftg67ly+H0EjNlUePOkaRURqfDKkAD?= =?us-ascii?Q?1pa6On+JaZSp4CE3/LRBBdoyXhk7S7TwLo5sVjIE5vnUujAJHnvcw6ZySq/l?= =?us-ascii?Q?ZJZOUHqA8RHY+HksWAjeU5L7gjzVoE+LpnhakJNs?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3966.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 725dcfa6-483f-4f5a-37ce-08db10b8c5e4 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Feb 2023 07:29:58.2683 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: tQ3YqMd1cqSplZ09C0bAeCpV9wpHn/kvrqO2NW78nw/VVW07ud9WSRCZFOqCcQnzdVPOgw8ZwCnNZX+AQT16aw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8235 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] > -----Original Message----- > From: Oram, Isaac W > Sent: Thursday, February 16, 2023 9:48 AM > To: Chang, Abner ; devel@edk2.groups.io > Cc: Gao, Liming ; Desimone, Nathaniel L > ; Attar, AbdulLateef (Abdul Lateef) > ; Nickle Wang ; Igor > Kulchytskyy > Subject: RE: [edk2-platforms][PATCH 5/7] ManageabilityPkg: Implement Ipmi > Protocol/Ppi >=20 > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. >=20 >=20 > I find the code to be misleading because source code looks like it is usi= ng the > edk2 API but it actually invokes the IpmiFeaturePkg implementations of th= e > IpmiTransport* API. we end up with things like a depex that says TRUE, b= ut > really includes a library that carries a dependency on a different protoc= ol than > the one in the INF. It includes IpmiProtocol.h, but actually invokes a l= ibrary > that locates and uses IpmiTransportProtocol.h. >=20 > I think that we should have these implement IpmiPpi.h and IpmiProtocol.h > instead of chaining them into the old implementation. Agree as my feedback given to patch 1/7. Abner >=20 > If we don't want to implement them directly, I would prefer to obviously > have the IpmiPpi and IpmiProtocol implementations look up and invoke > IpmiTransportPpi and IpmiTransportProtocol directly so that the code is > obvious about what it is doing. It seems that IpmiBaseLib only abstracts= the > phase for calling code. Is there any other value for phase specific code= to > obfuscate what is really happening by adding the library layer? If the l= ibrary is > there to avoid source code collisions, then I guess detailed commenting a= t all > the misleading places is probably the only answer besides implementing > directly. >=20 > Regards, > Isaac >=20 > -----Original Message----- > From: abner.chang@amd.com > Sent: Tuesday, February 7, 2023 8:23 AM > To: devel@edk2.groups.io > Cc: Gao, Liming ; Oram, Isaac W > ; Desimone, Nathaniel L > ; Abdul Lateef Attar > ; Nickle Wang ; Igor Kulchytskyy > > Subject: [edk2-platforms][PATCH 5/7] ManageabilityPkg: Implement Ipmi > Protocol/Ppi >=20 > From: Abner Chang >=20 > Add Ipmi Protocol/Ppi implementation. The underlying implementation is > provided by IpmiBaseLib. >=20 > Signed-off-by: Abner Chang > Cc: Liming Gao > Cc: Isaac Oram > Cc: Nate DeSimone > Cc: Abdul Lateef Attar > Cc: Nickle Wang > Cc: Igor Kulchytskyy > --- > .../IpmiProtocol/Dxe/IpmiProtocolDxe.inf | 37 +++++++ > .../Universal/IpmiProtocol/Pei/IpmiPpiPei.inf | 38 +++++++ > .../IpmiProtocol/Smm/IpmiProtocolSmm.inf | 40 +++++++ > .../Universal/IpmiProtocol/Dxe/IpmiProtocol.c | 97 +++++++++++++++++ > .../Universal/IpmiProtocol/Pei/IpmiPpi.c | 102 ++++++++++++++++++ > .../Universal/IpmiProtocol/Smm/IpmiProtocol.c | 98 +++++++++++++++++ > 6 files changed, 412 insertions(+) > create mode 100644 > Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.in > f > create mode 100644 > Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf > create mode 100644 > Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSmm > .inf > create mode 100644 > Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c > create mode 100644 > Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c > create mode 100644 > Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c >=20 > diff --git > a/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe. > inf > b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe > .inf > new file mode 100644 > index 0000000000..0737a5ad8f > --- /dev/null > +++ > b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolD > +++ xe.inf > @@ -0,0 +1,37 @@ > +## @file > +# IPMI Protocol DXE Driver. > +# > +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights > +reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent ## > + > +[Defines] > + INF_VERSION =3D 0x0001001d > + BASE_NAME =3D IpmiDxe > + FILE_GUID =3D BC41B0C2-9D8A-42B5-A28F-02CE0D4A6C2= 8 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D IpmiEntry > + > +# > +# VALID_ARCHITECTURES =3D IA32 X64 ARM AARCH64 > +# > + > +[Sources] > + IpmiProtocol.c > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + IpmiFeaturePkg/IpmiFeaturePkg.dec > + > +[LibraryClasses] > + IpmiBaseLib > + UefiDriverEntryPoint > + UefiBootServicesTableLib > + > +[Protocols] > + gIpmiProtocolGuid # PROTOCOL ALWAYS_PRODUCED > + > +[Depex] > + TRUE > diff --git > a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf > b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.inf > new file mode 100644 > index 0000000000..7ba8584f84 > --- /dev/null > +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpiPei.in > +++ f > @@ -0,0 +1,38 @@ > +## @file > +# IPMI Protocol PEI Driver. > +# > +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights > +reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent ## > + > +[Defines] > + INF_VERSION =3D 0x0001001d > + BASE_NAME =3D IpmiPei > + FILE_GUID =3D 7832F989-CB72-4715-ADCA-35C0B031856= C > + MODULE_TYPE =3D PEIM > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D IpmiEntry > + > +# > +# The following information is for reference only and not required by th= e > build tools. > +# > +# VALID_ARCHITECTURES =3D IA32 X64 ARM AARCH64 > +# > + > +[Sources] > + IpmiPpi.c > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + IpmiFeaturePkg/IpmiFeaturePkg.dec > + > +[LibraryClasses] > + IpmiBaseLib > + PeimEntryPoint > + > +[Ppis] > + gPeiIpmiPpiGuid # PPI ALWAYS PRODUCED > + > +[Depex] > + TRUE > diff --git > a/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSm > m.inf > b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolSm > m.inf > new file mode 100644 > index 0000000000..25a5771cb3 > --- /dev/null > +++ > b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocolS > +++ mm.inf > @@ -0,0 +1,40 @@ > +## @file > +# IPMI Protocol SMM Driver. > +# > +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights > +reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent ## > + > +# > +# The following information is for reference only and not required by th= e > build tools. > +# > +# VALID_ARCHITECTURES =3D IA32 X64 ARM AARCH64 > +# > +[Defines] > + INF_VERSION =3D 0x0001001d > + BASE_NAME =3D IpmiSmm > + FILE_GUID =3D CDD5D1DE-E3D3-4B1F-8689-DCC661= 561BB4 > + MODULE_TYPE =3D DXE_SMM_DRIVER > + PI_SPECIFICATION_VERSION =3D 0x0001000A > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D IpmiEntry > + > +[Sources] > + IpmiProtocol.c > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + IpmiFeaturePkg/IpmiFeaturePkg.dec > + > +[LibraryClasses] > + IpmiBaseLib > + UefiDriverEntryPoint > + UefiBootServicesTableLib > + SmmServicesTableLib > + > +[Protocols] > + gSmmIpmiProtocolGuid # PROTOCOL ALWAYS_PRODUCED > + > +[Depex] > + TRUE > diff --git > a/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c > b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol.c > new file mode 100644 > index 0000000000..1f0b88052e > --- /dev/null > +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocol. > +++ c > @@ -0,0 +1,97 @@ > +/** @file > + This file provides IPMI Protocol implementation. > + > + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights > +reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent **/ > + > +#include > +#include > +#include > +#include > +#include > + > +/** > + This service enables submitting commands via Ipmi. > + > + @param[in] This This point for IPMI_PROTOCOL stru= cture. > + @param[in] NetFunction Net function of the command. > + @param[in] Command IPMI Command. > + @param[in] RequestData Command Request Data. > + @param[in] RequestDataSize Size of Command Request Data. > + @param[out] ResponseData Command Response Data. The > completion code is the first byte of response data. > + @param[in, out] ResponseDataSize Size of Command Response Data. > + > + @retval EFI_SUCCESS The command byte stream was successfull= y > submit to the device and a response was successfully received. > + @retval EFI_NOT_FOUND The command was not successfully sent t= o > the device or a response was not successfully received from the device. > + @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi comma= nd > access. > + @retval EFI_DEVICE_ERROR Ipmi Device hardware error. > + @retval EFI_TIMEOUT The command time out. > + @retval EFI_UNSUPPORTED The command was not successfully sent t= o > the device. > + @retval EFI_OUT_OF_RESOURCES The resource allcation is out of > resource or data size error. > +**/ > +EFI_STATUS > +EFIAPI > +IpmiSubmitCommand ( > + IN IPMI_PROTOCOL *This, > + IN UINT8 NetFunction, > + IN UINT8 Command, > + IN UINT8 *RequestData, > + IN UINT32 RequestDataSize, > + OUT UINT8 *ResponseData, > + IN OUT UINT32 *ResponseDataSize > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D IpmiSendCommand ( > + NetFunction, > + Command, > + RequestData, > + RequestDataSize, > + ResponseData, > + ResponseDataSize > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Failed to send IPMI command in DXE - > + %r\n", __FUNCTION__, Status)); } > + > + return Status; > +} > + > +static IPMI_PROTOCOL mIpmiProtocol =3D { > + IpmiSubmitCommand > +}; > + > +/** > + The entry point of the Ipmi DXE driver. > + > + @param[in] ImageHandle - Handle of this driver image @param[in] > + SystemTable - Table containing standard EFI services > + > + @retval EFI_SUCCESS - IPMI Protocol is installed successfully. > + @retval Otherwise - Other errors. > +**/ > +EFI_STATUS > +EFIAPI > +IpmiEntry ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + EFI_HANDLE Handle; > + > + Handle =3D NULL; > + Status =3D gBS->InstallProtocolInterface ( > + &Handle, > + &gIpmiProtocolGuid, > + EFI_NATIVE_INTERFACE, > + (VOID **)&mIpmiProtocol > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Failed to install IPMI protocol - %r\n", > + __FUNCTION__, Status)); } > + > + return Status; > +} > diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi= .c > b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c > new file mode 100644 > index 0000000000..913a9b0811 > --- /dev/null > +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/IpmiPpi.c > @@ -0,0 +1,102 @@ > +/** @file > + This file provides IPMI PPI implementation. > + > + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights > + reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > +#include > + > +/** > + This service enables submitting commands via Ipmi. > + > + @param[in] This This point for PEI_IPMI_PPI struc= ture. > + @param[in] NetFunction Net function of the command. > + @param[in] Command IPMI Command. > + @param[in] RequestData Command Request Data. > + @param[in] RequestDataSize Size of Command Request Data. > + @param[out] ResponseData Command Response Data. The > completion code is the first byte of response data. > + @param[in, out] ResponseDataSize Size of Command Response Data. > + > + @retval EFI_SUCCESS The command byte stream was successfull= y > submit to the device and a response was successfully received. > + @retval EFI_NOT_FOUND The command was not successfully sent t= o > the device or a response was not successfully received from the device. > + @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi comma= nd > access. > + @retval EFI_DEVICE_ERROR Ipmi Device hardware error. > + @retval EFI_TIMEOUT The command time out. > + @retval EFI_UNSUPPORTED The command was not successfully sent t= o > the device. > + @retval EFI_OUT_OF_RESOURCES The resource allcation is out of > resource or data size error. > +**/ > +EFI_STATUS > +EFIAPI > +IpmiSubmitCommand ( > + IN PEI_IPMI_PPI *This, > + IN UINT8 NetFunction, > + IN UINT8 Command, > + IN UINT8 *RequestData, > + IN UINT32 RequestDataSize, > + OUT UINT8 *ResponseData, > + IN OUT UINT32 *ResponseDataSize > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D IpmiSendCommand ( > + NetFunction, > + Command, > + RequestData, > + RequestDataSize, > + ResponseData, > + ResponseDataSize > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Failed to send IPMI command in PEI- > + %r\n", __FUNCTION__, Status)); } > + > + return Status; > +} > + > +static PEI_IPMI_PPI mPeiIpmiPpi =3D { > + IpmiSubmitCommand > +}; > + > +static EFI_PEI_PPI_DESCRIPTOR mIpmiPpiList[] =3D { > + { > + (EFI_PEI_PPI_DESCRIPTOR_PPI | > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), > + &gPeiIpmiPpiGuid, > + &mPeiIpmiPpi > + } > +}; > + > +/** > + The entry point of the Ipmi PPI PEIM. > + > + @param FileHandle Handle of the file being invoked. > + @param PeiServices Describes the list of possible PEI Services. > + > + @retval EFI_SUCCESS Indicates that Ipmi initialization completed > successfully. > + @retval Others Indicates that Ipmi initialization could not com= plete > successfully. > +**/ > +EFI_STATUS > +EFIAPI > +IpmiEntry ( > + IN EFI_PEI_FILE_HANDLE FileHandle, > + IN CONST EFI_PEI_SERVICES **PeiServices > + ) > +{ > + EFI_STATUS Status; > + > + // > + // Install IPMI PPI. > + // > + Status =3D PeiServicesInstallPpi (&mIpmiPpiList[0]); if (EFI_ERROR > + (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Failed to install IPMI PPI - %r\n", > + __FUNCTION__, Status)); } > + > + return Status; > +} > diff --git > a/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c > b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol.c > new file mode 100644 > index 0000000000..ed14f9fbd1 > --- /dev/null > +++ > b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProtocol. > +++ c > @@ -0,0 +1,98 @@ > +/** @file > + This file provides IPMI SMM Protocol implementation. > + > + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights > +reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent **/ > + > +#include > +#include > +#include > +#include #include > + #include > + > +/** > + This service enables submitting commands via Ipmi. > + > + @param[in] This This point for IPMI_PROTOCOL stru= cture. > + @param[in] NetFunction Net function of the command. > + @param[in] Command IPMI Command. > + @param[in] RequestData Command Request Data. > + @param[in] RequestDataSize Size of Command Request Data. > + @param[out] ResponseData Command Response Data. The > completion code is the first byte of response data. > + @param[in, out] ResponseDataSize Size of Command Response Data. > + > + @retval EFI_SUCCESS The command byte stream was successfull= y > submit to the device and a response was successfully received. > + @retval EFI_NOT_FOUND The command was not successfully sent t= o > the device or a response was not successfully received from the device. > + @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi comma= nd > access. > + @retval EFI_DEVICE_ERROR Ipmi Device hardware error. > + @retval EFI_TIMEOUT The command time out. > + @retval EFI_UNSUPPORTED The command was not successfully sent t= o > the device. > + @retval EFI_OUT_OF_RESOURCES The resource allcation is out of > resource or data size error. > +**/ > +EFI_STATUS > +EFIAPI > +IpmiSubmitCommand ( > + IN IPMI_PROTOCOL *This, > + IN UINT8 NetFunction, > + IN UINT8 Command, > + IN UINT8 *RequestData, > + IN UINT32 RequestDataSize, > + OUT UINT8 *ResponseData, > + IN OUT UINT32 *ResponseDataSize > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D IpmiSendCommand ( > + NetFunction, > + Command, > + RequestData, > + RequestDataSize, > + ResponseData, > + ResponseDataSize > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Failed to send IPMI command in DXE - > + %r\n", __FUNCTION__, Status)); } > + > + return Status; > +} > + > +static IPMI_PROTOCOL mIpmiProtocol =3D { > + IpmiSubmitCommand > +}; > + > +/** > + The entry point of the Ipmi DXE driver. > + > + @param[in] ImageHandle - Handle of this driver image @param[in] > + SystemTable - Table containing standard EFI services > + > + @retval EFI_SUCCESS - IPMI Protocol is installed successfully. > + @retval Otherwise - Other errors. > +**/ > +EFI_STATUS > +EFIAPI > +IpmiEntry ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + EFI_HANDLE Handle; > + > + Handle =3D NULL; > + Status =3D gSmst->SmmInstallProtocolInterface ( > + &Handle, > + &gSmmIpmiProtocolGuid, > + EFI_NATIVE_INTERFACE, > + (VOID **)&mIpmiProtocol > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Failed to install IPMI SMM protocol - > + %r\n", __FUNCTION__, Status)); } > + > + return Status; > +} > -- > 2.37.1.windows.1