From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web10.585.1676512074495992255 for ; Wed, 15 Feb 2023 17:47:56 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=MWAz6XJe; spf=pass (domain: intel.com, ip: 192.55.52.151, 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=1676512075; x=1708048075; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=xp9xDuzU32mp+asBoltNL4PPJvI0IUTMQcWAn8TZdhE=; b=MWAz6XJecNl/P27bTFEPaqZwAP21qsEUdgCM3/4L5LNSebI5RAIy/Y7B TB0P1o/x5gkoh2Txgzx99IdbnwF27IGvwlYPMzG8fQI5rWPuOsAq+OGYH 4tS31lUIJt26mg6yOj96bm3deIJHpF+jZ9dkay41GMP6Bh9DaxiU1Pmis /rbL4C4LbvZpM6xSFXROd82gwmxBl9jxarawtFrW2VWfIJywNdE6V7RvH ypvZpn37NFb9AF11VlKjTUUFrhqaLs66GCvtMmeJNQ/+FTGWLPdaS0Nbc gJk03aO8FzGaCClAM91LRpINBiHPo4PSbK+xBKezpiBrcxNSmjKiTSNoW w==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="311963000" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="311963000" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2023 17:47:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="738662605" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="738662605" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga004.fm.intel.com with ESMTP; 15 Feb 2023 17:47:52 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 15 Feb 2023 17:47:50 -0800 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 15 Feb 2023 17:47:49 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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.16 via Frontend Transport; Wed, 15 Feb 2023 17:47:49 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Wed, 15 Feb 2023 17:47:49 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fLRG8hHA++mmxNz5KSw5SA3PQySh5h5WzETgf5AyqsZasj4XN5CN5I32q4yoEBL0K2q+8tByMlrDQsvaNLumhoYCw/2MlTCWDywfE1xEtYSZQlOXVc58SnfYufCFcW9r6I8UToMHG19rdexEGaRYsLbpyF96yEW+tZ0vKb7w56laRcobtgHM25+it89nlPjI9I+5mSU8zMXm6Y7CquEgifI6pymXWdUS2aMIvHJWbVJRDWOmqJQErJlHiFY9v3UMJ5NxxIlMemYquw5fytFPbHdBQtX8IM5lEtb+daongjLyDRtJCFN6GD46UhJfOqHVDJlcsmv/zgXtA+BJ7ocpWA== 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=WXvt3jFka+DJv0vafpgVOxAhN2GjF1C4hRllnJoGdas=; b=LG1hbkBXrZ321AJTcXqSB7tRhqnFAiN4vUHX3j4uPZQkrALIms1WvOt7/9Im7JwKf5REow3g1w+oh20A446CiFCsXqG9aer/pyhM9HzGx6SDiE5QqdqKf9S/cx69Qp8KJDkSXt40GrhKqtSYUeUjrsAlt4grpS53gI7m0t4VW/gGfVOLUe6e6o8Oj6RpT/4c1E2fmlie9ZdS292OFUYa0+gv0meUr8BrA72jK/tNGO7HCy3IoGBFkefxEp4b3S3ZtmJvk87q1b4aXGnQAQvjEBetB53pozLjdjQ/njQbruHCGsZbE77bGopxO0FiYgStDktphCC5777LTsXU0humLg== 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 DS7PR11MB7690.namprd11.prod.outlook.com (2603:10b6:8:e6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 01:47:46 +0000 Received: from SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::7623:38f5:ab31:61a5]) by SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::7623:38f5:ab31:61a5%7]) with mapi id 15.20.6086.024; Thu, 16 Feb 2023 01:47:46 +0000 From: "Isaac Oram" To: "abner.chang@amd.com" , "devel@edk2.groups.io" CC: "Gao, Liming" , "Desimone, Nathaniel L" , Abdul Lateef Attar , 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: AQHZOxCFJ7DO74EARkyKozFzdywpc67QzyBQ Date: Thu, 16 Feb 2023 01:47:46 +0000 Message-ID: References: <20230207162236.1406-1-abner.chang@amd.com> <20230207162236.1406-6-abner.chang@amd.com> In-Reply-To: <20230207162236.1406-6-abner.chang@amd.com> 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_|DS7PR11MB7690:EE_ x-ms-office365-filtering-correlation-id: edc79e77-f649-45b9-a30c-08db0fbfcd5d 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: JFpTxtJiVDcG8mDzqOe5HS1qJN/Ilh8JM0bAxxRTFsh8lbczimC10WvlbvDyukcH8AqUMK4jZqFH1Iu6GH8xOKQy5QCZdaDL2m1ocC5UkRJLoD1HP6jvvaGgdgSlCYxk2W9zjYkB7TSmL2Dl4PW/V7Jj/kep0E1qG7gHzMtb7nvtfo3xAcqjz6+xYdCUkxHBkmNpRUp//vGDCL2Do0QykoLsLd3BI0LrJGZAD9mRjATfgmISGX1kdL1vMK8SMWgOgeVfy23hBX+9bGRIPOUDzE6vLrtbz3ljmTme2aLQ0wYiPXnzq8O+hDZ82y8TDVjKPMIckRL1jp9rjKlpZ/GTC0k5JFkIL9lJTZ221v1IA8iySAy4giY9trYhbCByDUNPCuqXc/cxLlB9YNUmbH8c29NIKAN1cSPmSq43nmXKYZdXz72rmmxV1F0Pq0bmhkbbqSopkh9tpqJDyoppmKTSi5wchd+pt4AuLmy/HssnTx0b6uIRfif1p9cOEwHN4dhEkhAZGc6zzT4+bI3Quw5jKSuoMjr8DEcXtvrklzDFekQ1WHyoKoXfPtZbl6LjLMZJAXLNMVkjqecB3znVCC4oRwqcG0ca4zpJFllW6LXtcSQ1EYY0lWB0STEvCZ5MDxXgACqXZ4k/Xt6rRKR0kkzFHaZ7n9sn+Sh8jrDy3Yeu+RyhXnYo1O9ptD081w/qai8GmufqgaK0HvW6yqU1NrNwcA== 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:(13230025)(366004)(136003)(39860400002)(376002)(346002)(396003)(451199018)(66556008)(316002)(66476007)(66446008)(41300700001)(54906003)(52536014)(8936002)(5660300002)(110136005)(8676002)(30864003)(71200400001)(4326008)(2906002)(64756008)(76116006)(66946007)(7696005)(55016003)(478600001)(26005)(186003)(6506007)(9686003)(53546011)(83380400001)(33656002)(38100700002)(122000001)(38070700005)(82960400001)(86362001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Thk7SqO2yZ+TTLcHyVzW1TRWn3SNxwC2SJImCMuvuNTK6T/fWAzgyCs8Bb9T?= =?us-ascii?Q?Q87v1zB1bPtMIJEcaF6d49ZqLu6N+Gn03Qnh+0+8M/sie/MSTkUbnALXdRJj?= =?us-ascii?Q?zOLjQadq2udz/m+OoizK6HvA2pXRiSq9vdHLIc3CF7OEHq+EnrqH/MlEf6RK?= =?us-ascii?Q?xBD6BtVkYt1ditj9CFO+af5OrgtDIH0DaqCTMY7NK1oJDwUYwWGF3hE3oiRg?= =?us-ascii?Q?auXp7boHdOR3eao8yKAzK707n5QhPmfJSMi1gVISHZqqLLRNsDXhckMTxdO8?= =?us-ascii?Q?RStpVUwK8t+vtwMDncoeQDAKG3cgn9J6BU4gZzqkq2ubgyQjJwg1Lk08GJbV?= =?us-ascii?Q?2vSc48Hx0ZRIdNnXJyTEwJPAI6YnVcCSHiVFgNVUzY1Iz+XiL9CGkvHUggOn?= =?us-ascii?Q?vmHRbSKYkWyxPBk82sPQ/w6cGUA8P6MjNXZSHmuDkewn38aIARgWNoI9GXAI?= =?us-ascii?Q?1awkhIygb1emCc5w1dRd/wr/7OPgzgMul6kJHh/aKinERXcebWXIrkyH2U3p?= =?us-ascii?Q?hIHSYaxPd8PzFMQNyKJUR9OapRImEzMjjTZp5Pzm3uy6Eb2EYv2bIYg6LWnL?= =?us-ascii?Q?cJ/V+iYiSBZ+XdIObwwgQM1PEflT5IT07wh5iXcOO3BiMtCBh9CypYmzE0gd?= =?us-ascii?Q?fyhstObrbmG5MvBG6ExoNB5VOwftVqPaeW0Zefd7KNcV7WZqcjQSvstY9shA?= =?us-ascii?Q?MlVTBYVN3HNmPtWfvVwvXQ3X6wCpn1ISjBpiSYxaGGf8Gy4Tbj3ti7dn7I84?= =?us-ascii?Q?CmzN+1iCVG3JP8Xpo6Eb1zqYFRWi139a6vYHjWmocQfSrgZFcSHBCYJxH1Mm?= =?us-ascii?Q?embf+kC4ed917YCH7dc8TFkbEMqhDrEKgD2J/k6hhBTfXrfa5a1c/pn67/6Q?= =?us-ascii?Q?4s3CzQ34svIpLygYUXxAz97dFH792HsXNu6asdntM0uNLsAzy+Ec3uXkKE5m?= =?us-ascii?Q?qFKSUQVSW+KzlCTo4YbBlrzqQMaG1n3GquW875OGvHCQQz10cOSCP4wXHmsx?= =?us-ascii?Q?F4PgeYQHegp/6CbBNMFruFSWwNGH59jcuHeFoV9X9//1xDJTy0GaktvApKgg?= =?us-ascii?Q?PkJpJAigDeggRQOWuFhdfoExw6soWtf2rjDESVDkQK87XyfG2JNhs1RgnVq7?= =?us-ascii?Q?bVBCVAzSKDhjJvVTASqNeGn1eJWLzvElZPp8UKamG+9pl0xLb445s/uASxxK?= =?us-ascii?Q?KNX96zOeFeQHUPdus6Msvo1HNSqoX2XzeIij5hax567lYBRr48npEODxAofk?= =?us-ascii?Q?3/GKAO5T3z2+RXxpnsplZ/UafZx7qbVsSFHRCnxcQrZFYPnRa5tk4F4+hoCQ?= =?us-ascii?Q?Rbry7TjWsDjc5eq2OcZ3OAzGgY9ae4S9vaVeGvckEyTLv7D9MX8dznr0QgdS?= =?us-ascii?Q?TgCZht+CgrjtUMFT2zTHFpqTbz1LyECegAgGLxyxFbdSSnANXjmLMeSDfCKF?= =?us-ascii?Q?85fShktoos1EMfiY+Ly2DeWI3Amqc/Kb9cmbSRZY9E2yznDsK8nf3rJEbrkv?= =?us-ascii?Q?VLDHdeZzuA7SbRXh0MjIFNz+yItGYy/E9DigHvL+U7xK09ZSrIL3wuvnJilU?= =?us-ascii?Q?41LiUgjqFHHV63LmDySVml6Z6+4Sy/6QMKqa2e9c?= 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: edc79e77-f649-45b9-a30c-08db0fbfcd5d X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Feb 2023 01:47:46.1224 (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: URo30baKzc/kF+oI5AhC2ER8d1GP1GInDsKi4WN9hUZpxoCCFaBbI6VxeC6eKLoiwwZhunZ1iQcEx+6NS15iIA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR11MB7690 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 I find the code to be misleading because source code looks like it is using= the edk2 API but it actually invokes the IpmiFeaturePkg implementations of= the IpmiTransport* API. we end up with things like a depex that says TRUE= , but really includes a library that carries a dependency on a different pr= otocol than the one in the INF. It includes IpmiProtocol.h, but actually i= nvokes a library that locates and uses IpmiTransportProtocol.h. I think that we should have these implement IpmiPpi.h and IpmiProtocol.h in= stead of chaining them into the old implementation. =20 If we don't want to implement them directly, I would prefer to obviously ha= ve the IpmiPpi and IpmiProtocol implementations look up and invoke IpmiTran= sportPpi and IpmiTransportProtocol directly so that the code is obvious abo= ut what it is doing. It seems that IpmiBaseLib only abstracts the phase fo= r calling code. Is there any other value for phase specific code to obfusc= ate what is really happening by adding the library layer? If the library i= s there to avoid source code collisions, then I guess detailed commenting a= t all the misleading places is probably the only answer besides implementin= g directly. Regards, Isaac -----Original Message----- From: abner.chang@amd.com =20 Sent: Tuesday, February 7, 2023 8:23 AM To: devel@edk2.groups.io Cc: Gao, Liming ; Oram, Isaac W ; Desimone, Nathaniel L ; Abdul Late= ef Attar ; Nickle Wang ; Igor Kulchyt= skyy Subject: [edk2-platforms][PATCH 5/7] ManageabilityPkg: Implement Ipmi Proto= col/Ppi From: Abner Chang Add Ipmi Protocol/Ppi implementation. The underlying implementation is prov= ided by IpmiBaseLib. 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/Ip= miProtocolDxe.inf create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/Ip= miPpiPei.inf create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/Ip= miProtocolSmm.inf create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/Ip= miProtocol.c create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Pei/Ip= miPpi.c create mode 100644 Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/Ip= miProtocol.c diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProto= colDxe.inf b/Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProto= colDxe.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=20 +reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent ## + +[Defines] + INF_VERSION =3D 0x0001001d + BASE_NAME =3D IpmiDxe + FILE_GUID =3D BC41B0C2-9D8A-42B5-A28F-02CE0D4A6C28 + 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/IpmiPpiPe= i.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=20 +reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent ## + +[Defines] + INF_VERSION =3D 0x0001001d + BASE_NAME =3D IpmiPei + FILE_GUID =3D 7832F989-CB72-4715-ADCA-35C0B031856C + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D IpmiEntry + +# +# The following information is for reference only and not required by the = 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/IpmiProto= colSmm.inf b/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProto= colSmm.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=20 +reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent ## + +# +# The following information is for reference only and not required by the = 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-DCC66156= 1BB4 + 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/IpmiProto= col.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=20 +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 struct= ure. + @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 completi= on 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 successfully = submit to the device and a response was successfully received. + @retval EFI_NOT_FOUND The command was not successfully sent to = the device or a response was not successfully received from the device. + @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command= 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 to = 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 -=20 + %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]=20 + 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",=20 + __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=20 + 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 structu= re. + @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 completi= on 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 successfully = submit to the device and a response was successfully received. + @retval EFI_NOT_FOUND The command was not successfully sent to = the device or a response was not successfully received from the device. + @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command= 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 to = 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-=20 + %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 succe= ssfully. + @retval Others Indicates that Ipmi initialization could not compl= ete 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=20 + (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to install IPMI PPI - %r\n",=20 + __FUNCTION__, Status)); } + + return Status; +} diff --git a/Features/ManageabilityPkg/Universal/IpmiProtocol/Smm/IpmiProto= col.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=20 +reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent **/ + +#include +#include +#include +#include #include=20 + #include + +/** + This service enables submitting commands via Ipmi. + + @param[in] This This point for IPMI_PROTOCOL struct= ure. + @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 completi= on 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 successfully = submit to the device and a response was successfully received. + @retval EFI_NOT_FOUND The command was not successfully sent to = the device or a response was not successfully received from the device. + @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command= 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 to = 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 -=20 + %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]=20 + 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 -=20 + %r\n", __FUNCTION__, Status)); } + + return Status; +} -- 2.37.1.windows.1