From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (NAM12-BN8-obe.outbound.protection.outlook.com [40.107.237.88]) by mx.groups.io with SMTP id smtpd.web11.25792.1683615721684031254 for ; Tue, 09 May 2023 00:02:02 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=J22muYCN; 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.237.88, mailfrom: abdullateef.attar@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bpRU15F9rlYd5bWvGiajXidMOhPCiUA3EgJk+S4n4ICW0bfZj6jIWAcgf1p+hYNt8AdTLm591rzYDWem3iTS70sTJqRpmePJHbqat1AZyMVBsRP8Kx9VqYi69W8Rm6WiKW30PAOmLAPKbVuxtoMUt8o5342V+3KhBPWarbrc8PIpRUSkS+S8Azerl2zMpVyi35YPHt8bcjCAWoH79/R7cY5MBe4prrPT8oM/neWjdGmf7dTn0FbyP7mMDvpcJeFZ2rj21U9qMIgzhLMiBjDBn7AMQWvSftqNEuXkNrtj3kvqEsctgNRb0ndtDD9BP3uLkAqMBxSwvy5x+cyOWEgyFw== 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=BnpeHJQEH0kk0zeTLX+OV3Y04tZ51kyiKJVWoXXQEb0=; b=Znfiz6etUden2E7RGELMQ6DGx7yPvZzY5mAGJSMUiDLtN+OgqBz27yUvBtduBhay0woMihsScrTWm24Avc5kJpvdMqMM1s7CI/d+bTEBz+N4An2Db58wuc5zjs9Wtr1SnZVriae/D9tb3/AUjqM5VASvkq6+ZVuunEyFHmLGp58DvDZ+2uRpH2HbEDCi4hvjlXojj6uJ/C6KadZMGe0oj8ye61Oa/HnCU01MQewlBLCMZ3ynGHEsD1MZwQgl4nkrw4eih052TWRxmflb/1PVy53hE2TenpOLzGFfHFAkKykZ+JPbpV63AfdozMt8zC34DdMnVq3urWdav8MZdW8s6g== 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=BnpeHJQEH0kk0zeTLX+OV3Y04tZ51kyiKJVWoXXQEb0=; b=J22muYCNnOH09j02snIlZmplzcTuRJGeboVwDzmff7t7n3DQLCTZOpjSQWpOIfWc6qREfmHa+1+R4Y6fQM7OmoMof9Nxu+HvfakhDQ1P9wjw4eWmo1Ahk8UecikfYqyuRVDALdFn+bCy8UTlIJRj3H8PC69TChixE7Hz/UO8fJE= Received: from PH7PR12MB6466.namprd12.prod.outlook.com (2603:10b6:510:1f6::22) by DS7PR12MB5765.namprd12.prod.outlook.com (2603:10b6:8:74::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.32; Tue, 9 May 2023 07:01:56 +0000 Received: from PH7PR12MB6466.namprd12.prod.outlook.com ([fe80::9837:e9ae:f203:bb7f]) by PH7PR12MB6466.namprd12.prod.outlook.com ([fe80::9837:e9ae:f203:bb7f%7]) with mapi id 15.20.6340.030; Tue, 9 May 2023 07:01:56 +0000 From: "Attar, AbdulLateef (Abdul Lateef)" To: "Chang, Abner" , "devel@edk2.groups.io" CC: Isaac Oram , Nickle Wang , Tinh Nguyen Subject: Re: [edk2-platforms][PATCH] ManageabilityPkg/IpmiCommandLib:IPMI Command Library Thread-Topic: [edk2-platforms][PATCH] ManageabilityPkg/IpmiCommandLib:IPMI Command Library Thread-Index: AQHZfxH0qta6GFNHEU+8zB01GtW4ga9Rie7Q Date: Tue, 9 May 2023 07:01:56 +0000 Message-ID: References: <20230505052424.729-1-abner.chang@amd.com> In-Reply-To: <20230505052424.729-1-abner.chang@amd.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=a9b70952-5c7c-4d88-bfa4-37ceaabedadd;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;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_SetDate=2023-05-09T07:01:11Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; 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: PH7PR12MB6466:EE_|DS7PR12MB5765:EE_ x-ms-office365-filtering-correlation-id: 63bc6932-1fe2-4176-bc90-08db505b4714 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: jKbAgBnIFPwh3xYY9wMP4hBuqIYbcZxUJwcT5PAkcveqZZDQ7khpqUg2maRI1KJfBHRMisbrNoBpSFX9E590zuX6qkZvyj77KluvlzKcVp8oLDDqmOt15TAWCQcvVolaPbbdUowXdn50XCShwH0A+/m7puBO4MQsXSL9rahzW72gxlfxJQKTVZY1bgkNXLJmFh0WYrhsoPOKtnZpdh/FXeeirTuwCWjo0qNJ0hOzlZg8Wrb0DArqUwlzdkmqflC8jfOnsmTvK72eWtCEz5QRhRjNVGA8ojfB+xtnwbnVTrub/zM4d2xMLkN/bJdAgbOjEfvBoNV/tkOr8tUVOklX+6CQL/Du6z6/x8x6RtlI4cjM6KWS9gXwcjWbD+tdQSKnXvJ8+WKkXS/F4m1feSUtjeoOmxDicyQM4q8bg8gxcxvSWHYKfDplUMceIveYBy9sS99D6cG/o/i4kC6JUCN3Djkmfo06pukOLQhX8Qbk5y1u678rZ3mqv5KwErwkJ9wsi/KreRSHN47gV5WZGmvrLx+fI/qHEbpIEHlXXUrlcCbg/igS4eWis4w0Q4prnJqUHyqblwrLwr2UThFhhbca7YlWylOLSQET5g9BqA5vuJE9/p6VlzGW+jLhdb/4Gkvi x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR12MB6466.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(366004)(376002)(136003)(396003)(39860400002)(451199021)(83380400001)(186003)(54906003)(478600001)(7696005)(71200400001)(110136005)(4326008)(19627235002)(9686003)(53546011)(26005)(6506007)(30864003)(2906002)(38100700002)(52536014)(33656002)(64756008)(66556008)(5660300002)(122000001)(41300700001)(66476007)(66446008)(76116006)(316002)(86362001)(55016003)(38070700005)(8936002)(8676002)(66946007)(559001)(579004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?mWiy39V8veEz6KTy10Irce4YzIJUb/qOKj0jPaQmQIt4U98FC02abbzxJw5P?= =?us-ascii?Q?MxPq5D8hriWIdurR+vfM8qoECLK1MOEJUXDYxfPyWk6SweKLDxHrx4pwfsor?= =?us-ascii?Q?tEPe9VAot/AXxOt5M2kBbBW4lpO9VkNkTtznEWT2fuLKr87gu05j4HTAvyEM?= =?us-ascii?Q?w3ocsfwadeilrw7+/zrGAlnvub9xaJ8vOWEuTPZCFN3iGUpTDcp0ZQtOpOqP?= =?us-ascii?Q?HLp9Eozzq/P/A3NGIkEOSe1dhFYBU0eIpRSlwRDWSFqstub6+9t9xuy91g32?= =?us-ascii?Q?VleSJMd+KxJOB7H9yqtfiG8iDyQNk9v/SfkkAKPuStiIJbGfSoJvJXq+Yv32?= =?us-ascii?Q?GAZIwBTZGYvZiIwl8xJukIpYHZ0z9UYwI0X8fydpwWYCwriP375OO28vwgFI?= =?us-ascii?Q?QN9AVYTOD0TwW+wztNrXdPb4RbRD9yZO21z070Ec/SaaWQ5pBwVyVJBw7rRQ?= =?us-ascii?Q?e9tmlXot6OheRDV9H45k5lSVD8stIugcOlpzYo2YfLicdi6EY0mXH6chplPT?= =?us-ascii?Q?UxTenzxpd4B54d/izyEaNKxH/1yVbuT2OFKFqOsn+Ud0kFaRBn+tdXmC98Jj?= =?us-ascii?Q?Hdoed7re6kzhYydNjSlidokpAm+C0IvtLVGQPj6LeWSCjKYEjqUiR5Q2cLDx?= =?us-ascii?Q?IkHsxMRmZ/f9xZ8mTJwvyPfIIohSvwdAjHsjmUK2lsRWP9faw+bBifUNKAej?= =?us-ascii?Q?o1rbMybxPm8X/UWddFvorSBwu/IAxq1EcD57kaM1FtBn/VjDznn4vL2if300?= =?us-ascii?Q?RmalXe02CtpZVV2eT8g3i06MN5oFcBzMbyl/3mPRd93GSvvTlS7foJQvswVO?= =?us-ascii?Q?+3dRfGLsLaR6FKatJ1QtGjScb05q/Ab+zUdE7RbH6n+hFO/mMiJmEqlGH7Fk?= =?us-ascii?Q?myMTw8YMynHBpdGGpY9NjgXNpRdvh7ERVuVsTbA1MdBCeTcXt/UxdiR+H3Tp?= =?us-ascii?Q?ONeKrKZKlkdBGN7uQ1uxMKZqDugt6aFbZYScUEjqaJ7akOSY2G2i+zMGZOsV?= =?us-ascii?Q?0oqcQjJEjBjgOmO7gKx5zwDoDIFTgZYfD4YHPiHmGAIjs7mVDyMwBtVjkJY8?= =?us-ascii?Q?MxMkf3DI7pjZvMvAmfkOV5sIS/AmXGSoOd+LEKI4rQJlystDdIdTID/9ZFp3?= =?us-ascii?Q?ryZOsKtuCxhfC+Rq/Uw81bM4qI+1vc6ctAhuFxBFWl9JT0E9PM0tZn0YjGEF?= =?us-ascii?Q?GiU24RmnVZAe6j+RvSQOwWXbpkubNq0CIEZRIHjb99fk9y7ne2Iw/8mN9Llt?= =?us-ascii?Q?NRfaFoFVbIBlzpUUrJkeVepydGEtaktVZlrjvad5SJGRVgO2krp8yL/QeOnR?= =?us-ascii?Q?RSSgZNFwpimPP7RsNJs3wFVwpNKmiPR0L42NLC0PD2A39atcDY0l4JKdAaM7?= =?us-ascii?Q?mxP8j6KeTjRHxhsUpzrETk/+CVvulZk8poOrZ/3TVcHqDpgVJHAJAYjM6kmT?= =?us-ascii?Q?nQtK+lztQU95kdl3VlfLRHppDvSQzEjtM/k93Q/gGB0Q4BJ51KevHGv/eCvm?= =?us-ascii?Q?Aqo9p7QTKb6/zpivaMRD1+N0pFW+kE6zFiSkHOKD3N368eRiDiktGsjAn19M?= =?us-ascii?Q?Gq5X7a83hs2v8tXg9cI=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB6466.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 63bc6932-1fe2-4176-bc90-08db505b4714 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 May 2023 07:01:56.7282 (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: LJviBcfz+Mlp6hmPuaPZW5k+BslosKUPaB6fBKix1qumPzWPGuMkiC+8A1Gzq6aqIL6fPrA9yc+bXDi9rUHg+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5765 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] reviewed-by: Abdul Lateef Attar -----Original Message----- From: Chang, Abner Sent: 05 May 2023 10:54 To: devel@edk2.groups.io Cc: Isaac Oram ; Attar, AbdulLateef (Abdul Lateef) = ; Nickle Wang ; Tinh Nguyen = Subject: [edk2-platforms][PATCH] ManageabilityPkg/IpmiCommandLib:IPMI Comma= nd Library From: Abner Chang BZ #: 4444 IpmiCommandLib is cloned from edk2-platforms/Features/Intel/OutOfBandManagement/ IpmiFeaturePkg/Library/IpmiCommandLib in order to consolidate edk2 system manageability support in one place. Function header are added to the source files and header files. Uncustify is applied to C files and no functionalities are changed in this patch. We will still keep the one under IpmiFeaturePkg/Library/ IpmiCommandLib until the reference to this instance are removed from platforms. Signed-off-by: Abner Chang Cc: Isaac Oram Cc: Abdul Lateef Attar Cc: Nickle Wang Cc: Tinh Nguyen --- .../Library/IpmiCommandLib/IpmiCommandLib.inf | 33 + .../Include/Library/IpmiCommandLib.h | 620 ++++++++++++++++++ .../IpmiCommandLib/IpmiCommandLibNetFnApp.c | 444 +++++++++++++ .../IpmiCommandLibNetFnChassis.c | 199 ++++++ .../IpmiCommandLibNetFnStorage.c | 384 +++++++++++ .../IpmiCommandLibNetFnTransport.c | 156 +++++ 6 files changed, 1836 insertions(+) create mode 100644 Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCo= mmandLib.inf create mode 100644 Features/ManageabilityPkg/Include/Library/IpmiCommandLi= b.h create mode 100644 Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCo= mmandLibNetFnApp.c create mode 100644 Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCo= mmandLibNetFnChassis.c create mode 100644 Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCo= mmandLibNetFnStorage.c create mode 100644 Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCo= mmandLibNetFnTransport.c diff --git a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLi= b.inf b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLib.inf new file mode 100644 index 0000000000..3dc485cf38 --- /dev/null +++ b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLib.inf @@ -0,0 +1,33 @@ +### @file +# Component description file for IPMI Command Library. +# +# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D IpmiCommandLib + FILE_GUID =3D 96FC1989-CB7F-489B-9D3B-68DCA2C2DADC + MODULE_TYPE =3D UEFI_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D IpmiCommandLib + +[sources] + IpmiCommandLibNetFnApp.c + IpmiCommandLibNetFnTransport.c + IpmiCommandLibNetFnChassis.c + IpmiCommandLibNetFnStorage.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + ManageabilityPkg/ManageabilityPkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + IpmiLib diff --git a/Features/ManageabilityPkg/Include/Library/IpmiCommandLib.h b/F= eatures/ManageabilityPkg/Include/Library/IpmiCommandLib.h new file mode 100644 index 0000000000..685f6e2ea2 --- /dev/null +++ b/Features/ManageabilityPkg/Include/Library/IpmiCommandLib.h @@ -0,0 +1,620 @@ +/** @file + This library abstract how to send/receive IPMI command. + +Copyright (c) 2018-2021, Intel Corporation. All rights reserved.
+Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+ +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef IPMI_COMMAND_LIB_H_ +#define IPMI_COMMAND_LIB_H_ + +#include +#include + +/// +/// Functions for IPMI NetFnApp commands +/// + +/** + This function is used to retrieve device ID. + + @param [out] DeviceId The pointer to receive IPMI_GET_DEVICE_ID_RESPON= SE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetDeviceId ( + OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId + ); + +/** + This function returns device self test results + + @param [out] SelfTestResult The pointer to receive IPMI_SELF_TEST_RESU= LT_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelfTestResult ( + OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult + ); + +/** + This function is used for starting and restarting the Watchdog + Timer from the initial countdown value that was specified in + the Set Watchdog Timer command the watchdog timer. + + @param [out] CompletionCode IPMI completetion code, refer to Ipmi.h. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiResetWatchdogTimer ( + OUT UINT8 *CompletionCode + ); + +/** + This function is used for initializing and configuring + the watchdog timer. + + @param [in] SetWatchdogTimer Pointer to receive IPMI_SET_WATCHDOG_TIM= ER_REQUEST. + @param [out] CompletionCode IPMI completetion code, refer to Ipmi.h. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSetWatchdogTimer ( + IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer, + OUT UINT8 *CompletionCode + ); + +/** + This function retrieves the current settings and present + countdown of the watchdog timer. + + @param [out] GetWatchdogTimer Pointer to receive IPMI_GET_WATCHDOG_TIM= ER_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetWatchdogTimer ( + OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer + ); + +/** + This function enables message reception into Message Buffers, + and any interrupt associated with that buffer getting full. + + @param [in] SetBmcGlobalEnables Pointer receive to IPMI_SET_BMC_GLOBA= L_ENABLES_REQUEST. + @param [out] CompletionCode IPMI completetion code, refer to Ipmi= .h. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSetBmcGlobalEnables ( + IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables, + OUT UINT8 *CompletionCode + ); + +/** + This function retrieves the present setting of the Global Enables + + @param [out] GetBmcGlobalEnables Pointer to receive IPMI_GET_BMC_GLOBA= L_ENABLES_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetBmcGlobalEnables ( + OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables + ); + +/** + This function is used to flush unread data from the Receive + Message Queue or Event Message Buffer + + @param [in] ClearMessageFlagsRequest IPMI_CLEAR_MESSAGE_FLAGS_REQUEST + @param [out] CompletionCode IPMI completetion code, refer to = Ipmi.h. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiClearMessageFlags ( + IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest, + OUT UINT8 *CompletionCode + ); + +/** + This function is used to retrieve the present message available states. + + @param [out] GetMessageFlagsResponse Pointer to receive IPMI_GET_MESSA= GE_FLAGS_RESPONSE + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetMessageFlags ( + OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse + ); + +/** + This function is used to get data from the Receive Message Queue. + + @param [out] GetMessageResponse Pointer to receive IPMI_GET_ME= SSAGE_RESPONSE. + @param [in, out] GetMessageResponseSize When in, which is the expected= size of + response. When out, which is t= he actual + size returned. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetMessage ( + OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse, + IN OUT UINT32 *GetMessageResponseSize + ); + +/** + This function is used for bridging IPMI messages between channels, + and between the system management software (SMS) and a given channel + + @param [in] SendMessageRequest Pointer to IPMI_SEND_MESSAGE_REQU= EST. + @param [in] SendMessageRequestSize Size of entire SendMessageRequest= Size. + @param [out] SendMessageResponse Pointer to receive IPMI_SEND_MESS= AGE_RESPONSE. + @param [in] SendMessageResponseSize When in, which is the expected si= ze of + response. When out, which is the = actual + size returned. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSendMessage ( + IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest, + IN UINT32 SendMessageRequestSize, + OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse, + IN OUT UINT32 *SendMessageResponseSize + ); + +/** + This function gets the system UUID. + + @param [out] SystemGuid The pointer to retrieve system UUID. + + @retval EFI_SUCCESS UUID is returned. + @retval EFI_INVALID_PARAMETER SystemGuid is a NULL pointer. + @retval Others See return value of IpmiSubmitCommand = () function. +**/ +EFI_STATUS +EFIAPI +IpmiGetSystemUuid ( + OUT EFI_GUID *SystemGuid + ); + +/** + This function gets the channel information. + + @param [in] GetChannelInfoRequest The get channel information re= quest. + @param [out] GetChannelInfoResponse The get channel information re= sponse. + @param [out] GetChannelInfoResponseSize When input, the expected size = of response. + When output, the exact size of= the returned + response. + + @retval EFI_SUCCESS Get channel information successfully. + @retval EFI_INVALID_PARAMETER One of the given input parameters is inva= lid. + @retval Others See return value of IpmiSubmitCommand () = function. + +**/ +EFI_STATUS +EFIAPI +IpmiGetChannelInfo ( + IN IPMI_GET_CHANNEL_INFO_REQUEST *GetChannelInfoRequest, + OUT IPMI_GET_CHANNEL_INFO_RESPONSE *GetChannelInfoResponse, + OUT UINT32 *GetChannelInfoResponseSize + ); + +/// +/// Functions for IPMI NetFnTransport commands. +/// + +/** + This function sends command to BMC to notify a remote application + that a SOL payload is activating on another channel. + + @param [in] SolActivatingRequest Pointer to IPMI_SOL_ACTIVATING_REQUE= ST. + @param [out] CompletionCode IPMI completetion code, refer to Ipm= i.h. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSolActivating ( + IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest, + OUT UINT8 *CompletionCode + ); + +/** + This function is used to set parameters such as the network addressing + information required for SOL payload operation. + + @param [in] SetConfigurationParametersRequest Pointer to IPMI_SET_= SOL_CONFIGURATION_PARAMETERS_REQUEST. + @param [in] SetConfigurationParametersRequestSize Size of entire SetCo= nfigurationParametersRequestSize. + @param [out] CompletionCode IPMI completetion co= de, refer to Ipmi.h. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSetSolConfigurationParameters ( + IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationPara= metersRequest, + IN UINT32 SetConfigurationParam= etersRequestSize, + OUT UINT8 *CompletionCode + ); + +/** + This function is used to retrieve the configuration parameters from the + Set SOL Configuration Parameters. + + @param [in] GetConfigurationParametersRequest Pointer to IPM= I_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST. + @param [out] GetConfigurationParametersResponse Pointer to rec= eive IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE. + @param [in, out] GetConfigurationParametersResponseSize When in, which= is the expected size of + response. When= out, which is the actual + size returned. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSolConfigurationParameters ( + IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationPar= ametersRequest, + OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationPar= ametersResponse, + IN OUT UINT32 *GetConfigurationPar= ametersResponseSize + ); + +/** + This function gets the LAN configuration parameter. + + @param[in] GetLanConfigurationParametersRequest Request data + @param[out] GetLanConfigurationParametersResponse Response data + @param[in,out] GetLanConfigurationParametersSize When input, the e= xpected size of response data. + When out, the exa= ct size of response data. + + @retval EFI_SUCCESS Lan configuration parameter is returned i= n the response. + @retval EFI_INVALID_PARAMETER One of the given input parameters is inva= lid. + @retval Others Other errors. + +**/ +EFI_STATUS +EFIAPI +IpmiGetLanConfigurationParameters ( + IN IPMI_GET_LAN_CONFIGURATION_PARAMETERS_REQUEST *GetLanConfigurat= ionParametersRequest, + OUT IPMI_GET_LAN_CONFIGURATION_PARAMETERS_RESPONSE *GetLanConfigurat= ionParametersResponse, + IN OUT UINT32 *GetLanConfigurat= ionParametersSize + ); + +/// +/// Functions for IPMI NetFnChasis commands +/// + +/** + This function returns information about which main chassis management fu= nctions are + present and what addresses are used to access those functions. + + @param [out] GetChassisCapabilitiesResponse Pointer to IPMI_GET_CHASSI= S_CAPABILITIES_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetChassisCapabilities ( + OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesRespo= nse + ); + +/** + This function gets information regarding the high-level status of the s= ystem + chassis and main power subsystem. + + @param [out] GetChassisStatusResponse Pointer to IPMI_GET_CHASSIS_STAT= US_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetChassisStatus ( + OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse + ); + +/** + This function sends command to control power up, power down, and reset. + + @param [in] ChassisControlRequest Pointer to IPMI_CHASSIS_CONTROL_REQ= UEST. + @param [out] CompletionCode IPMI completetion code, refer to Ip= mi.h. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiChassisControl ( + IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest, + OUT UINT8 *CompletionCode + ); + +/** + This function is used to configure the power restore policy. + + @param [in] ChassisControlRequest Pointer to IPMI_SET_POWER_RESTORE_= POLICY_REQUEST. + @param [out] ChassisControlResponse Pointer to IPMI_SET_POWER_RESTORE_= POLICY_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSetPowerRestorePolicy ( + IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *ChassisControlRequest, + OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *ChassisControlResponse + ); + +/** + This function is used to set parameters that direct the system boot + following a system power up or reset. + + @param [in] BootOptionsRequest Pointer to IPMI_SET_BOOT_OPTIONS_REQU= EST. + @param [out] BootOptionsResponse Pointer to IPMI_SET_BOOT_OPTIONS_RESP= ONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSetSystemBootOptions ( + IN IPMI_SET_BOOT_OPTIONS_REQUEST *BootOptionsRequest, + OUT IPMI_SET_BOOT_OPTIONS_RESPONSE *BootOptionsResponse + ); + +/** + This function is used to retrieve the boot options set by the + Set System Boot Options command. + + @param [in] BootOptionsRequest Pointer to IPMI_GET_BOOT_OPTIONS_REQU= EST. + @param [out] BootOptionsResponse Pointer to IPMI_GET_BOOT_OPTIONS_RESP= ONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSystemBootOptions ( + IN IPMI_GET_BOOT_OPTIONS_REQUEST *BootOptionsRequest, + OUT IPMI_GET_BOOT_OPTIONS_RESPONSE *BootOptionsResponse + ); + +/// +/// Functions for IPMI NetFnStorage commands +/// + +/** + This function is used to retrieve FRU Inventory Area + + @param [in] GetFruInventoryAreaInfoRequest Pointer to IPMI_GET_FRU_I= NVENTORY_AREA_INFO_REQUEST. + @param [out] GetFruInventoryAreaInfoResponse Pointer to IPMI_GET_FRU_I= NVENTORY_AREA_INFO_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetFruInventoryAreaInfo ( + IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoR= equest, + OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInfoR= esponse + ); + +/** + This function returns specified data from the FRU Inventory Info area. + + @param [in] ReadFruDataRequest Pointer to IPMI_READ_FRU_DATA= _REQUEST. + @param [out] ReadFruDataResponse Pointer to IPMI_READ_FRU_DATA= _RESPONSE. + @param [in, out] ReadFruDataResponseSize Returns the size of ReadFruDa= taResponse. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiReadFruData ( + IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest, + OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse, + IN OUT UINT32 *ReadFruDataResponseSize + ); + +/** + This function writes specified data from the FRU Inventory Info area. + + @param [in] WriteFruDataRequest Pointer to IPMI_WRITE_FRU_DATA_RE= QUEST. + @param [in] WriteFruDataRequestSize Size of WriteFruDataRequest. + @param [out] WriteFruDataResponse Pointer to receive IPMI_WRITE_FRU= _DATA_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiWriteFruData ( + IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest, + IN UINT32 WriteFruDataRequestSize, + OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse + ); + +/** + This function returns the number of entries in the SEL + + @param [out] GetSelInfoResponse Pointer to receive IPMI_GET_SEL_INFO= _RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelInfo ( + OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse + ); + +/** + This function retrieves entries from the SEL + + @param [in] GetSelEntryRequest Pointer to IPMI_GET_SEL_ENTRY_REQ= UEST. + @param [out] GetSelEntryResponse Pointer to receive IPMI_GET_SEL_E= NTRY_RESPONSE. + @param [in] GetSelEntryResponseSize Size of entire GetSelEntryRespons= e. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelEntry ( + IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest, + OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse, + IN OUT UINT32 *GetSelEntryResponseSize + ); + +/** + This function adds an entry in the SEL + + @param [in] AddSelEntryRequest Pointer to IPMI_ADD_SEL_ENTRY_REQUEST= . + @param [out] AddSelEntryResponse Pointer to receive IPMI_ADD_SEL_ENTRY= _RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiAddSelEntry ( + IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest, + OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse + ); + +/** + This function adds SEL Entry command that allows the record to be increm= entally + added to the SEL. + + @param [in] PartialAddSelEntryRequest Pointer to IPMI_PARTIAL_ADD_= SEL_ENTRY_REQUEST. + @param [in] PartialAddSelEntryRequestSize Size of entire PartialAddSel= EntryRequest. + @param [out] PartialAddSelEntryResponse Pointer to receive IPMI_PART= IAL_ADD_SEL_ENTRY_RESPONSE. + + @retval EFI_STASTUS See return value of IpmiSubmitCommand () function. + +**/ +EFI_STATUS +EFIAPI +IpmiPartialAddSelEntry ( + IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest, + IN UINT32 PartialAddSelEntryRequestSize, + OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse + ); + +/** + This function erases all contents of the System Event Log. + + @param [in] ClearSelRequest Pointer to IPMI_CLEAR_SEL_REQUEST. + @param [out] ClearSelResponse Pointer to receive IPMI_CLEAR_SEL_RESPON= SE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiClearSel ( + IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest, + OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse + ); + +/** + This function returns the time from the SEL Device. + + @param [out] GetSelTimeResponse Pointer to IPMI_GET_SEL_TIME_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelTime ( + OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse + ); + +/** + This function set the time in the SEL Device. + + @param [in] SetSelTimeRequest Pointer to IPMI_SET_SEL_TIME_REQUEST. + @param [out] CompletionCode IPMI completetion code, refer to Ipmi.h= . + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSetSelTime ( + IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest, + OUT UINT8 *CompletionCode + ); + +/** + This function returns the SDR command version for the SDR Repository. + + @param [out] ClearSelResponse Pointer to receive IPMI_GET_SDR_REPOSITO= RY_INFO_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSdrRepositoryInfo ( + OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp + ); + +/** + This function returns the sensor record specified by Record ID. + + @param [in] GetSdrRequest Pointer to IPMI_GET_SDR_REQUEST. + @param [out] GetSdrResponse Pointer to receive IPMI_GET_SDR_RE= SPONSE. + @param [in, out] GetSdrResponseSize Size of entire GetSdrResponse. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSdr ( + IN IPMI_GET_SDR_REQUEST *GetSdrRequest, + OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse, + IN OUT UINT32 *GetSdrResponseSize + ); + +#endif // IPMI_COMMAND_LIB_H_ diff --git a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLi= bNetFnApp.c b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandL= ibNetFnApp.c new file mode 100644 index 0000000000..30c412e2f4 --- /dev/null +++ b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnA= pp.c @@ -0,0 +1,444 @@ +/** @file + IPMI Command - NetFnApp. + + Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.
+ Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include + +#include + +/** + This function is used to retrieve device ID. + + @param [out] DeviceId The pointer to receive IPMI_GET_DEVICE_ID_RESPON= SE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetDeviceId ( + OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*DeviceId); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_GET_DEVICE_ID, + NULL, + 0, + (VOID *)DeviceId, + &DataSize + ); + return Status; +} + +/** + This function returns device self test results + + @param [out] SelfTestResult The pointer to receive IPMI_SELF_TEST_RESU= LT_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelfTestResult ( + OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*SelfTestResult); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_GET_SELFTEST_RESULTS, + NULL, + 0, + (VOID *)SelfTestResult, + &DataSize + ); + return Status; +} + +/** + This function is used for starting and restarting the Watchdog + Timer from the initial countdown value that was specified in + the Set Watchdog Timer command the watchdog timer + + @param [out] CompletionCode IPMI completetion code, refer to Ipmi.h. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiResetWatchdogTimer ( + OUT UINT8 *CompletionCode + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*CompletionCode); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_RESET_WATCHDOG_TIMER, + NULL, + 0, + (VOID *)CompletionCode, + &DataSize + ); + return Status; +} + +/** + This function is used for initializing and configuring + the watchdog timer. + + @param [in] SetWatchdogTimer Pointer to receive IPMI_SET_WATCHDOG_TIM= ER_REQUEST. + @param [out] CompletionCode IPMI completetion code, refer to Ipmi.h. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSetWatchdogTimer ( + IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer, + OUT UINT8 *CompletionCode + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*CompletionCode); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_SET_WATCHDOG_TIMER, + (VOID *)SetWatchdogTimer, + sizeof (*SetWatchdogTimer), + (VOID *)CompletionCode, + &DataSize + ); + return Status; +} + +/** + This function retrieves the current settings and present + countdown of the watchdog timer. + + @param [out] GetWatchdogTimer Pointer to receive IPMI_GET_WATCHDOG_TIM= ER_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetWatchdogTimer ( + OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*GetWatchdogTimer); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_GET_WATCHDOG_TIMER, + NULL, + 0, + (VOID *)GetWatchdogTimer, + &DataSize + ); + return Status; +} + +/** + This function enables message reception into Message Buffers, + and any interrupt associated with that buffer getting full. + + @param [in] SetBmcGlobalEnables Pointer receive to IPMI_SET_BMC_GLOBA= L_ENABLES_REQUEST. + @param [out] CompletionCode IPMI completetion code refer to Ipmi.h= . + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSetBmcGlobalEnables ( + IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables, + OUT UINT8 *CompletionCode + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*CompletionCode); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_SET_BMC_GLOBAL_ENABLES, + (VOID *)SetBmcGlobalEnables, + sizeof (*SetBmcGlobalEnables), + (VOID *)CompletionCode, + &DataSize + ); + return Status; +} + +/** + This function retrieves the present setting of the Global Enables + + @param [out] GetBmcGlobalEnables Pointer to receive IPMI_GET_BMC_GLOBA= L_ENABLES_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetBmcGlobalEnables ( + OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*GetBmcGlobalEnables); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_GET_BMC_GLOBAL_ENABLES, + NULL, + 0, + (VOID *)GetBmcGlobalEnables, + &DataSize + ); + return Status; +} + +/** + This function is used to flush unread data from the Receive + Message Queue or Event Message Buffer + + @param [in] ClearMessageFlagsRequest IPMI_CLEAR_MESSAGE_FLAGS_REQUEST + @param [out] CompletionCode IPMI completetion code, refer to = Ipmi.h. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiClearMessageFlags ( + IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest, + OUT UINT8 *CompletionCode + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*CompletionCode); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_CLEAR_MESSAGE_FLAGS, + (VOID *)ClearMessageFlagsRequest, + sizeof (*ClearMessageFlagsRequest), + (VOID *)CompletionCode, + &DataSize + ); + return Status; +} + +/** + This function is used to retrieve the present message available states. + + @param [out] GetMessageFlagsResponse Pointer to receive IPMI_GET_MESS= AGE_FLAGS_RESPONSE + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetMessageFlags ( + OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*GetMessageFlagsResponse); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_GET_MESSAGE_FLAGS, + NULL, + 0, + (VOID *)GetMessageFlagsResponse, + &DataSize + ); + return Status; +} + +/** + This function is used to get data from the Receive Message Queue. + + @param [out] GetMessageResponse Pointer to receive IPMI_GET_ME= SSAGE_RESPONSE. + @param [in, out] GetMessageResponseSize When in, which is the expected= size of + response. When out, which is t= he actual + size returned. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetMessage ( + OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse, + IN OUT UINT32 *GetMessageResponseSize + ) +{ + EFI_STATUS Status; + + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_GET_MESSAGE, + NULL, + 0, + (VOID *)GetMessageResponse, + GetMessageResponseSize + ); + return Status; +} + +/** + This function is used for bridging IPMI messages between channels, + and between the system management software (SMS) and a given channel + + @param [in] SendMessageRequest Pointer to IPMI_SEND_MESSAGE_REQU= EST. + @param [in] SendMessageRequestSize Size of entire SendMessageRequest= Size. + @param [out] SendMessageResponse Pointer to receive IPMI_SEND_MESS= AGE_RESPONSE. + @param [in] SendMessageResponseSize When in, which is the expected si= ze of + response. When out, which is the = actual + size returned. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSendMessage ( + IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest, + IN UINT32 SendMessageRequestSize, + OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse, + IN OUT UINT32 *SendMessageResponseSize + ) +{ + EFI_STATUS Status; + + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_SEND_MESSAGE, + (VOID *)SendMessageRequest, + SendMessageRequestSize, + (VOID *)SendMessageResponse, + SendMessageResponseSize + ); + return Status; +} + +/** + This function gets the system UUID. + + @param[out] SystemGuid The pointer to retrieve system UUID. + + @retval EFI_SUCCESS UUID is returned. + @retval EFI_INVALID_PARAMETER SystemGuid is a NULL pointer. + @retval Others See the return values of IpmiSubmitCom= mand () function. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSystemUuid ( + OUT EFI_GUID *SystemGuid + ) +{ + EFI_STATUS Status; + UINT32 RequestSize; + UINT32 ResponseSize; + IPMI_GET_SYSTEM_UUID_RESPONSE GetSystemUuidResponse; + + if (SystemGuid =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + RequestSize =3D 0; + ResponseSize =3D sizeof (IPMI_GET_SYSTEM_UUID_RESPONSE); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_GET_SYSTEM_GUID, + (VOID *)NULL, + RequestSize, + (VOID *)&GetSystemUuidResponse, + &ResponseSize + ); + if (!EFI_ERROR (Status) && (GetSystemUuidResponse.CompletionCode =3D=3D = IPMI_COMP_CODE_NORMAL)) { + CopyMem ( + (VOID *)SystemGuid, + (VOID *)&GetSystemUuidResponse.SystemUuid, + sizeof (EFI_GUID) + ); + } + + return Status; +} + +/** + This function gets the channel information. + + @param[in] GetChannelInfoRequest The get channel information = request. + @param[out] GetChannelInfoResponse The get channel information = response. + @param[out] GetChannelInfoResponseSize When input, the expected siz= e of response. + When output, the exact size = of the returned + response. + + @retval EFI_SUCCESS Get channel information successfully. + @retval EFI_INVALID_PARAMETER One of the given input parameters is inva= lid. + @retval Others See the return values of IpmiSubmitComman= d () function. + +**/ +EFI_STATUS +EFIAPI +IpmiGetChannelInfo ( + IN IPMI_GET_CHANNEL_INFO_REQUEST *GetChannelInfoRequest, + OUT IPMI_GET_CHANNEL_INFO_RESPONSE *GetChannelInfoResponse, + OUT UINT32 *GetChannelInfoResponseSize + ) +{ + EFI_STATUS Status; + + if ((GetChannelInfoRequest =3D=3D NULL) || + (GetChannelInfoResponse =3D=3D NULL) || + (GetChannelInfoResponseSize =3D=3D NULL)) + { + return EFI_INVALID_PARAMETER; + } + + *GetChannelInfoResponseSize =3D sizeof (IPMI_GET_CHANNEL_INFO_RESPONSE); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_APP, + IPMI_APP_GET_CHANNEL_INFO, + (UINT8 *)GetChannelInfoRequest, + sizeof (IPMI_GET_CHANNEL_INFO_REQUEST), + (UINT8 *)GetChannelInfoResponse, + GetChannelInfoResponseSize + ); + return Status; +} diff --git a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLi= bNetFnChassis.c b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiComm= andLibNetFnChassis.c new file mode 100644 index 0000000000..12fd997b11 --- /dev/null +++ b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnC= hassis.c @@ -0,0 +1,199 @@ +/** @file + IPMI Command - NetFnChassis. + + Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include + +#include + +/** + This function returns information about which main chassis management fu= nctions are + present and what addresses are used to access those functions. + + @param [out] GetChassisCapabilitiesResponse Pointer to IPMI_GET_CHASSI= S_CAPABILITIES_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetChassisCapabilities ( + OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesRespo= nse + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*GetChassisCapabilitiesResponse); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_CHASSIS, + IPMI_CHASSIS_GET_CAPABILITIES, + NULL, + 0, + (VOID *)GetChassisCapabilitiesResponse, + &DataSize + ); + return Status; +} + +/** + This function gets information regarding the high-level status of the s= ystem + chassis and main power subsystem. + + @param [out] GetChassisStatusResponse Pointer to IPMI_GET_CHASSIS_STAT= US_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetChassisStatus ( + OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*GetChassisStatusResponse); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_CHASSIS, + IPMI_CHASSIS_GET_STATUS, + NULL, + 0, + (VOID *)GetChassisStatusResponse, + &DataSize + ); + return Status; +} + +/** + This function sends command to control power up, power down, and reset. + + @param [in] ChassisControlRequest Pointer to IPMI_CHASSIS_CONTROL_REQ= UEST. + @param [out] CompletionCode IPMI completetion code, refer to Ip= mi.h. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiChassisControl ( + IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest, + OUT UINT8 *CompletionCode + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*CompletionCode); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_CHASSIS, + IPMI_CHASSIS_CONTROL, + (VOID *)ChassisControlRequest, + sizeof (*ChassisControlRequest), + (VOID *)CompletionCode, + &DataSize + ); + return Status; +} + +/** + This function is used to configure the power restore policy. + + @param [in] ChassisControlRequest Pointer to IPMI_SET_POWER_RESTORE_= POLICY_REQUEST. + @param [out] ChassisControlResponse Pointer to IPMI_SET_POWER_RESTORE_= POLICY_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSetPowerRestorePolicy ( + IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *ChassisControlRequest, + OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *ChassisControlResponse + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*ChassisControlResponse); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_CHASSIS, + IPMI_CHASSIS_SET_POWER_RESTORE_POLICY, + (VOID *)ChassisControlRequest, + sizeof (*ChassisControlRequest), + (VOID *)ChassisControlResponse, + &DataSize + ); + return Status; +} + +/** + This function is used to set parameters that direct the system boot + following a system power up or reset. + + @param [in] BootOptionsRequest Pointer to IPMI_SET_BOOT_OPTIONS_REQU= EST. + @param [out] BootOptionsResponse Pointer to IPMI_SET_BOOT_OPTIONS_RESP= ONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSetSystemBootOptions ( + IN IPMI_SET_BOOT_OPTIONS_REQUEST *BootOptionsRequest, + OUT IPMI_SET_BOOT_OPTIONS_RESPONSE *BootOptionsResponse + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*BootOptionsResponse); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_CHASSIS, + IPMI_CHASSIS_SET_SYSTEM_BOOT_OPTIONS, + (VOID *)BootOptionsRequest, + sizeof (*BootOptionsRequest), + (VOID *)BootOptionsResponse, + &DataSize + ); + return Status; +} + +/** + This function is used to retrieve the boot options set by the + Set System Boot Options command. + + @param [in] BootOptionsRequest Pointer to IPMI_GET_BOOT_OPTIONS_REQU= EST. + @param [out] BootOptionsResponse Pointer to IPMI_GET_BOOT_OPTIONS_RESP= ONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSystemBootOptions ( + IN IPMI_GET_BOOT_OPTIONS_REQUEST *BootOptionsRequest, + OUT IPMI_GET_BOOT_OPTIONS_RESPONSE *BootOptionsResponse + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*BootOptionsResponse); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_CHASSIS, + IPMI_CHASSIS_GET_SYSTEM_BOOT_OPTIONS, + (VOID *)BootOptionsRequest, + sizeof (*BootOptionsRequest), + (VOID *)BootOptionsResponse, + &DataSize + ); + return Status; +} diff --git a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLi= bNetFnStorage.c b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiComm= andLibNetFnStorage.c new file mode 100644 index 0000000000..2dbb7ac9ff --- /dev/null +++ b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnS= torage.c @@ -0,0 +1,384 @@ +/** @file + IPMI Command - NetFnStorage. + + Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include + +#include + +/** + This function is used to retrieve FRU Inventory Area + + @param [in] GetFruInventoryAreaInfoRequest Pointer to IPMI_GET_FRU_IN= VENTORY_AREA_INFO_REQUEST. + @param [out] GetFruInventoryAreaInfoResponse Pointer to IPMI_GET_FRU_IN= VENTORY_AREA_INFO_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetFruInventoryAreaInfo ( + IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoR= equest, + OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInfoR= esponse + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*GetFruInventoryAreaInfoResponse); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_STORAGE, + IPMI_STORAGE_GET_FRU_INVENTORY_AREAINFO, + (VOID *)GetFruInventoryAreaInfoRequest, + sizeof (*GetFruInventoryAreaInfoRequest), + (VOID *)GetFruInventoryAreaInfoResponse, + &DataSize + ); + return Status; +} + +/** + This function returns specified data from the FRU Inventory Info area. + + @param [in] ReadFruDataRequest Pointer to IPMI_READ_FRU_DATA_REQU= EST. + @param [in] ReadFruDataResponse Pointer to IPMI_READ_FRU_DATA_RESP= ONSE. + @param [in, out] ReadFruDataResponseSize Returns the size of ReadFruDat= aResponse. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiReadFruData ( + IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest, + OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse, + IN OUT UINT32 *ReadFruDataResponseSize + ) +{ + EFI_STATUS Status; + + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_STORAGE, + IPMI_STORAGE_READ_FRU_DATA, + (VOID *)ReadFruDataRequest, + sizeof (*ReadFruDataRequest), + (VOID *)ReadFruDataResponse, + ReadFruDataResponseSize + ); + return Status; +} + +/** + This function writes specified data from the FRU Inventory Info area. + + @param [in] WriteFruDataRequest Pointer to IPMI_WRITE_FRU_DATA_REQ= UEST. + @param [in] WriteFruDataRequestSize Size of WriteFruDataRequest. + @param [out] WriteFruDataResponse Pointer to receive IPMI_WRITE_FRU_= DATA_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiWriteFruData ( + IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest, + IN UINT32 WriteFruDataRequestSize, + OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*WriteFruDataResponse); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_STORAGE, + IPMI_STORAGE_WRITE_FRU_DATA, + (VOID *)WriteFruDataRequest, + WriteFruDataRequestSize, + (VOID *)WriteFruDataResponse, + &DataSize + ); + return Status; +} + +/** + This function returns the number of entries in the SEL + + @param [out] GetSelInfoResponse Pointer to receive IPMI_GET_SEL_INFO= _RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelInfo ( + OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*GetSelInfoResponse); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_STORAGE, + IPMI_STORAGE_GET_SEL_INFO, + NULL, + 0, + (VOID *)GetSelInfoResponse, + &DataSize + ); + return Status; +} + +/** + This function retrieves entries from the SEL + + @param [in] GetSelEntryRequest Pointer to IPMI_GET_SEL_ENTRY_REQU= EST. + @param [out] GetSelEntryResponse Pointer to receive IPMI_GET_SEL_EN= TRY_RESPONSE. + @param [in, out] GetSelEntryResponseSize Size of entire GetSelEntryRes= ponse. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelEntry ( + IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest, + OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse, + IN OUT UINT32 *GetSelEntryResponseSize + ) +{ + EFI_STATUS Status; + + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_STORAGE, + IPMI_STORAGE_GET_SEL_ENTRY, + (VOID *)GetSelEntryRequest, + sizeof (*GetSelEntryRequest), + (VOID *)GetSelEntryResponse, + GetSelEntryResponseSize + ); + return Status; +} + +/** + This function adds an entry in the SEL + + @param [in] AddSelEntryRequest Pointer to IPMI_ADD_SEL_ENTRY_REQU= EST. + @param [out] AddSelEntryResponse Pointer to receive IPMI_ADD_SEL_EN= TRY_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiAddSelEntry ( + IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest, + OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*AddSelEntryResponse); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_STORAGE, + IPMI_STORAGE_ADD_SEL_ENTRY, + (VOID *)AddSelEntryRequest, + sizeof (*AddSelEntryRequest), + (VOID *)AddSelEntryResponse, + &DataSize + ); + return Status; +} + +/** + This function adds SEL Entry command that allows the record to be increm= entally + added to the SEL. + + @param [in] PartialAddSelEntryRequest Pointer to IPMI_PARTIAL_ADD= _SEL_ENTRY_REQUEST. + @param [in] PartialAddSelEntryRequestSize Size of entire PartialAddSe= lEntryRequest. + @param [out] PartialAddSelEntryResponse Pointer to receive IPMI_PAR= TIAL_ADD_SEL_ENTRY_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiPartialAddSelEntry ( + IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest, + IN UINT32 PartialAddSelEntryRequestSize, + OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*PartialAddSelEntryResponse); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_STORAGE, + IPMI_STORAGE_PARTIAL_ADD_SEL_ENTRY, + (VOID *)PartialAddSelEntryRequest, + PartialAddSelEntryRequestSize, + (VOID *)PartialAddSelEntryResponse, + &DataSize + ); + return Status; +} + +/** + This function erases all contents of the System Event Log. + + @param [in] ClearSelRequest Pointer to IPMI_CLEAR_SEL_REQUEST. + @param [out] ClearSelResponse Pointer to receive IPMI_CLEAR_SEL_RES= PONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiClearSel ( + IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest, + OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*ClearSelResponse); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_STORAGE, + IPMI_STORAGE_CLEAR_SEL, + (VOID *)ClearSelRequest, + sizeof (*ClearSelRequest), + (VOID *)ClearSelResponse, + &DataSize + ); + return Status; +} + +/** + This function returns the time from the SEL Device. + + @param [out] GetSelTimeResponse Pointer to IPMI_GET_SEL_TIME_RESP= ONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelTime ( + OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*GetSelTimeResponse); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_STORAGE, + IPMI_STORAGE_GET_SEL_TIME, + NULL, + 0, + (VOID *)GetSelTimeResponse, + &DataSize + ); + return Status; +} + +/** + This function set the time in the SEL Device. + + @param [in] SetSelTimeRequest Pointer to IPMI_SET_SEL_TIME_REQUES= T. + @param [out] CompletionCode IPMI completetion code, refer to Ipm= i.h. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSetSelTime ( + IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest, + OUT UINT8 *CompletionCode + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*CompletionCode); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_STORAGE, + IPMI_STORAGE_SET_SEL_TIME, + (VOID *)SetSelTimeRequest, + sizeof (*SetSelTimeRequest), + (VOID *)CompletionCode, + &DataSize + ); + return Status; +} + +/** + This function returns the SDR command version for the SDR Repository + + @param [out] ClearSelResponse Pointer to receive IPMI_GET_SDR_REPOS= ITORY_INFO_RESPONSE. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSdrRepositoryInfo ( + OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*GetSdrRepositoryInfoResp); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_STORAGE, + IPMI_STORAGE_GET_SDR_REPOSITORY_INFO, + NULL, + 0, + (VOID *)GetSdrRepositoryInfoResp, + &DataSize + ); + return Status; +} + +/** + This function returns the sensor record specified by Record ID. + + @param [in] GetSdrRequest Pointer to IPMI_GET_SDR_REQUEST. + @param [out] GetSdrResponse Pointer to receive IPMI_GET_SDR_RESPONS= E. + @param [in, out] GetSdrResponseSize Size of entire GetSdrResponse. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSdr ( + IN IPMI_GET_SDR_REQUEST *GetSdrRequest, + OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse, + IN OUT UINT32 *GetSdrResponseSize + ) +{ + EFI_STATUS Status; + + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_STORAGE, + IPMI_STORAGE_GET_SDR, + (VOID *)GetSdrRequest, + sizeof (*GetSdrRequest), + (VOID *)GetSdrResponse, + GetSdrResponseSize + ); + return Status; +} diff --git a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLi= bNetFnTransport.c b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCo= mmandLibNetFnTransport.c new file mode 100644 index 0000000000..a93f7406f1 --- /dev/null +++ b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnT= ransport.c @@ -0,0 +1,156 @@ +/** @file + IPMI Command - NetFnTransport. + + Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.
+ Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include + +#include + +/** + This function sends command to BMC to notify a remote application + that a SOL payload is activating on another channel. + + @param [in] SolActivatingRequest The get channel information request. + @param [out] CompletionCode IPMI completetion code, refer to Ipm= i.h. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSolActivating ( + IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest, + OUT UINT8 *CompletionCode + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*CompletionCode); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_TRANSPORT, + IPMI_TRANSPORT_SOL_ACTIVATING, + (VOID *)SolActivatingRequest, + sizeof (*SolActivatingRequest), + (VOID *)CompletionCode, + &DataSize + ); + return Status; +} + +/** + This function is used to set parameters such as the network addressing + information required for SOL payload operation. + + @param [in] SetConfigurationParametersRequest Pointer to IPMI_SET= _SOL_CONFIGURATION_PARAMETERS_REQUEST. + @param [in] SetConfigurationParametersRequestSize Size of entire SetC= onfigurationParametersRequestSize. + @param [out] CompletionCode IPMI completetion c= ode, refer to Ipmi.h. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiSetSolConfigurationParameters ( + IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationPara= metersRequest, + IN UINT32 SetConfigurationParam= etersRequestSize, + OUT UINT8 *CompletionCode + ) +{ + EFI_STATUS Status; + UINT32 DataSize; + + DataSize =3D sizeof (*CompletionCode); + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_TRANSPORT, + IPMI_TRANSPORT_SET_SOL_CONFIG_PARAM, + (VOID *)SetConfigurationParametersRequest, + SetConfigurationParametersRequestSize, + (VOID *)CompletionCode, + &DataSize + ); + return Status; +} + +/** + This function is used to retrieve the configuration parameters from the + Set SOL Configuration Parameters. + + @param [in] GetConfigurationParametersRequest Pointer to IPM= I_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST. + @param [out] GetConfigurationParametersResponse Pointer to rec= eive IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE + @param [in, out] GetConfigurationParametersResponseSize When in, which= is the expected size of + response. When= out, which is the actual + size returned. + + @retval EFI_STASTUS See the return values of IpmiSubmitCommand () func= tion. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSolConfigurationParameters ( + IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationPar= ametersRequest, + OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationPar= ametersResponse, + IN OUT UINT32 *GetConfigurationPar= ametersResponseSize + ) +{ + EFI_STATUS Status; + + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_TRANSPORT, + IPMI_TRANSPORT_GET_SOL_CONFIG_PARAM, + (VOID *)GetConfigurationParametersRequest, + sizeof (*GetConfigurationParametersRequest), + (VOID *)GetConfigurationParametersResponse, + GetConfigurationParametersResponseSize + ); + return Status; +} + +/** + This function gets the LAN configuration parameter. + + @param[in] GetLanConfigurationParametersRequest Request data + @param[out] GetLanConfigurationParametersResponse Response data + @param[in,out] GetLanConfigurationParametersSize When input, the e= xpected size of response data. + When out, the exa= ct size of response data. + + @retval EFI_SUCCESS Lan configuration parameter is returned i= n the response. + @retval EFI_INVALID_PARAMETER One of the given input parameters is inva= lid. + @retval Others Other errors. + +**/ +EFI_STATUS +EFIAPI +IpmiGetLanConfigurationParameters ( + IN IPMI_GET_LAN_CONFIGURATION_PARAMETERS_REQUEST *GetLanConfigurat= ionParametersRequest, + OUT IPMI_GET_LAN_CONFIGURATION_PARAMETERS_RESPONSE *GetLanConfigurat= ionParametersResponse, + IN OUT UINT32 *GetLanConfigurat= ionParametersSize + ) +{ + EFI_STATUS Status; + + if ((GetLanConfigurationParametersRequest =3D=3D NULL) || + (GetLanConfigurationParametersResponse =3D=3D NULL) || + (GetLanConfigurationParametersSize =3D=3D NULL)) + { + return EFI_INVALID_PARAMETER; + } + + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_TRANSPORT, + IPMI_TRANSPORT_GET_LAN_CONFIG_PARAMETERS, + (UINT8 *)GetLanConfigurationParametersRequest, + sizeof (*GetLanConfigurationParametersRequest), + (UINT8 *)GetLanConfigurationParametersResponse, + GetLanConfigurationParametersSize + ); + return Status; +} -- 2.37.1.windows.1