From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.41]) by mx.groups.io with SMTP id smtpd.web10.53668.1671551943219006113 for ; Tue, 20 Dec 2022 07:59:04 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@ami.com header.s=selector1 header.b=XrvJUYj9; spf=pass (domain: ami.com, ip: 40.107.236.41, mailfrom: igork@ami.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DfgNuOzWHXAFiNm79ejSPKQhWChSBLLVsCBKbL25UqdYUBUJatk76Imk1swsJ56S+iDssyi6pbX35mONmelTRXIjj1Hw0vx5zIy2KXwhXn/kmAS2MBEz3zxaP7/sj5PEiCQp3kObcLzryN8jAcrD8y+K15lVyDoIyGagZlnJL5HFkkj8S2odNEAKH87d+iQ2NZDy3iJA0Vo74ExVZGJkycztHhy6wfGi9Fe+CQgB7t/oUCi2tprLnn17cd5EpbDAWcM2mTjPzrEmPN4E3IPHDw4oGeZXlwSAcT7gliT1ZNPd8birOjeCtfnXsoV28f+sx/R4BnEqqj0echj08vi3+A== 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=SRFUlQgRRHSw5Qj5IAci50jAiHEJKAX0jyr0C378aPs=; b=dkOMiH6NryC8xA6SvkHtcvzrf7/xKyOZeS69FkbYWbNTPPwrIYzwMgCFd83JR5O3Qk3BoRUKq15O142HCCkCuP+bJ8WDr4Zc5zvq69cp6AU824I0rszRTltEPdpYZKrg3wbAu69ad9P0kxWuKmwQc3W/vyZxZjNrOGV8fQUwlP+udunGF3+bwO6gLHLiLmiIwlGAasUfnC9qW1MpJIH4g5TFiuXctSY2ZjCXg6kIPIyT+INoaH+t1+S7TC4+sLT6AQYo2x3o87SDzN1fRmo6v1fX1BOPRVirO9vLbjk1XQqzAZ4sbBf+c3+J9O/BC/kWW2PGlTk7Vw1EHVmudACvLg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ami.com; dmarc=pass action=none header.from=ami.com; dkim=pass header.d=ami.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ami.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SRFUlQgRRHSw5Qj5IAci50jAiHEJKAX0jyr0C378aPs=; b=XrvJUYj9mOtWSo/klhPrU6zhcOBtjWZNYO3H1R5PJs/pnvB6BdlbrH8JoHxpzQd0qIPCFPRTRtMg1nngwNJW4AElJd/xtV+HbIZk/pTbCVV0ASeiw+QgqsOuGTUiIdz4A4gvPlDkk3RjPz+OCtw6rP3mX8ZrWB8METwxc3s9dc4= Received: from BLAPR10MB5185.namprd10.prod.outlook.com (2603:10b6:208:328::16) by CY8PR10MB6612.namprd10.prod.outlook.com (2603:10b6:930:54::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 15:59:00 +0000 Received: from BLAPR10MB5185.namprd10.prod.outlook.com ([fe80::f1ea:b179:62e1:8cb8]) by BLAPR10MB5185.namprd10.prod.outlook.com ([fe80::f1ea:b179:62e1:8cb8%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 15:59:00 +0000 From: "Igor Kulchytskyy" To: "abner.chang@amd.com" , "devel@edk2.groups.io" CC: Nickle Wang Subject: Re: [PATCH 1/2] RedfishPkg/RedfishHostInterface: Platform Redfish HI notification Thread-Topic: [EXTERNAL] [PATCH 1/2] RedfishPkg/RedfishHostInterface: Platform Redfish HI notification Thread-Index: AQHZE7Sb6XDxCXwEcUS6ILwwxzrQ4q528GAg Date: Tue, 20 Dec 2022 15:59:00 +0000 Message-ID: References: <20221219141648.1620-1-abner.chang@amd.com> In-Reply-To: <20221219141648.1620-1-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=ami.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BLAPR10MB5185:EE_|CY8PR10MB6612:EE_ x-ms-office365-filtering-correlation-id: cbfd72b5-c3d7-4aec-112f-08dae2a31c4c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2w9TlA6CDGJN6tOB6YZh29cM5V5gdrU3Rq4doaGIwUDNs5JJwUMeW/CZPUaCfiVM93+ixgB9trrLHZpcX1ekB9IJ54VzAvMCxqA1f5oUnhbdw6aXGoUoaUQei9u3TfiX/XRlaezjXYW7NobEFuzORjgLmzxitna0cgPWTg6VaiMGQa1dNFMhbCOfn9WA5bqMqPsgZonFoNIqjE6faPFJg8k4InTNX+vDNIxBvORVPrSu7gjPsr92O/fJ4V1iUzl2f9pmYd4I2So41RrMgSFvgcq08SvYrcg2O2CDb/pFamyCBCbIeprRazn5VJCoPrt5wBySthi141oKkSis7GrK26SZke9u3Ni6xpqUdOVw5j0ITkRRAA5lo4mExCskNBMngUoA3YDiURolQzZlMaotp45UXAq4TXbOQMjMWU32Wv7I+Lq1rZ8gCNAKbuvqgxNow3+SKJN7BDKkXFYTVvvipwRxEEPalhr8qihzUZ1d8kpo+tpCQrDgWz4A1kldDRQONAitdLoRFEAleMX50lg7Ov/vct5NuRIjcs1nlbsJLRpHUmwplU3furiCWuvNMeosYF7Fy0J/W8GxKx16+b4Q7/Xy2S0/Mt/26X1yfNlkvAxzudd7qtkBXv1i8OrkDzI9fF1NgWo9tSkVe91KLCdriQ17QbpeTAiOO9zNT1hcCcuDm897XUXzKFZHFrAWV9VEI3Lmk1PROgkZFh/QNRSUqA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BLAPR10MB5185.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39850400004)(136003)(396003)(366004)(376002)(346002)(451199015)(66476007)(76116006)(86362001)(66946007)(66446008)(8676002)(4326008)(19627235002)(316002)(64756008)(52536014)(8936002)(5660300002)(66556008)(33656002)(40140700001)(9686003)(53546011)(6506007)(7696005)(41300700001)(71200400001)(26005)(186003)(38070700005)(83380400001)(122000001)(55016003)(38100700002)(110136005)(478600001)(2906002)(15650500001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?wY1HtpcDldo6Q4nOSaWnMwdxGpbvT1ElXCL8DaGEmKPHDg+9SZwPDIqIPP+c?= =?us-ascii?Q?/0rbQUYh09U8w01/rzqn1BZ51/yNLVMMdneSeFOicU1YSeJAIFl2vOtw6cju?= =?us-ascii?Q?mDK6745Y8CGGFdh0y5SGKj1r1cVsSy+w2UapDcBRxJbwxg5bgU4SnE2l8Irn?= =?us-ascii?Q?/3D9Cnep+IyncPZI/A2fEukXuffk3KNB1ZS5DUyZ6zfSUub3oMG1r6TXbmSK?= =?us-ascii?Q?TfixtuCwh/qckFXjRHgzyL2TCt4CN1q5W4uSPGJ5yRVGTjNECQVZQE3SNEMI?= =?us-ascii?Q?ZgGvnTAf97BQOJacZEMyI7QpVdZPZEzzBy1OXC/rbInG/lGb+y1S4KegOW1J?= =?us-ascii?Q?UVFHHECMyryIKrdkRqj7jZBZjlHvgnAVpvjg2Tm/7H9b0MRFFo+A11PPOsM5?= =?us-ascii?Q?1l3cRxEwjnAwXdKYE4MpplFGPF/1uhkqnzS3AvuNAMJuoeAitiIwA1Hxz8GS?= =?us-ascii?Q?1D12DjC4tNbEc5vd9XOZP62jkhdT13lLa/EjqQnZOnOFoNHKkN4MiGNSD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kGoz2NNO6hhH6RppKReHE8?= =?us-ascii?Q?w6BpxKSntpxYy4zou7B0rRQBN28YcP4xHMYUWylsfY9ynPKHthxcvu/Au22n?= =?us-ascii?Q?lkPb3vFZS8V9MoIT3222Dkz1GyEkOSspiyiPaPOQwAqKvx2RRnK2IBpOo7iL?= =?us-ascii?Q?6e1neI8lzQpyalWnbco=3D?= MIME-Version: 1.0 X-OriginatorOrg: ami.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5185.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cbfd72b5-c3d7-4aec-112f-08dae2a31c4c X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Dec 2022 15:59:00.8171 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 27e97857-e15f-486c-b58e-86c2b3040f93 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: agyYfsxlsvEl3yEeWmCjeTSnTbgoiDMjxu3/+WousPxawahIDu5Pgxt7BGXmrm/c X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6612 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Igor Kulchytskyy -----Original Message----- From: abner.chang@amd.com Sent: Monday, December 19, 2022 9:17 AM To: devel@edk2.groups.io Cc: Nickle Wang ; Igor Kulchytskyy Subject: [EXTERNAL] [PATCH 1/2] RedfishPkg/RedfishHostInterface: Platform R= edfish HI notification **CAUTION: The e-mail below is from an external source. Please exercise cau= tion before opening attachments, clicking links, or following guidance.** From: Abner Chang For some use cases, Redfish host interface table relies on the certain EFI = protocols installation at the driver connection. Redfish host interface DXE driver is not able to build the SMBIOS type 42h = record at driver entry point. This patch adds the mechanism in Redfish host= interface DXE driver to listen to EFI protocol installed by platform libra= ry that indicates the necessary information is ready for building SMBIOS 42= h record. Signed-off-by: Abner Chang Cc: Nickle Wang Cc: Igor Kulchytskyy --- .../Include/Library/RedfishHostInterfaceLib.h | 27 ++++++- .../PlatformHostInterfaceLibNull.c | 26 ++++++- .../RedfishHostInterfaceDxe.c | 73 ++++++++++++++++++- 3 files changed, 119 insertions(+), 7 deletions(-) diff --git a/RedfishPkg/Include/Library/RedfishHostInterfaceLib.h b/Redfish= Pkg/Include/Library/RedfishHostInterfaceLib.h index 8d8389b9647..fa9f2d64eea 100644 --- a/RedfishPkg/Include/Library/RedfishHostInterfaceLib.h +++ b/RedfishPkg/Include/Library/RedfishHostInterfaceLib.h @@ -2,6 +2,7 @@ Definitinos of RedfishHostInterfaceDxe driver. (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+ Copyright (C) 2022 Advanced Micro Devices, Inc. All rights + reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -19,7 +20,7 @@ /** Get platform Redfish host interface device descriptor. - @param[in] DeviceType Pointer to retrieve device type. + @param[out] DeviceType Pointer to retrieve device type. @param[out] DeviceDescriptor Pointer to retrieve REDFISH_INTERFACE_DATA= , caller has to free this memory using FreePool(). @retval EFI_SUCCESS Device descriptor is returned successfully in De= viceDescriptor. @@ -28,7 +29,7 @@ **/ EFI_STATUS RedfishPlatformHostInterfaceDeviceDescriptor ( - IN UINT8 *DeviceType, + OUT UINT8 *DeviceType, OUT REDFISH_INTERFACE_DATA **DeviceDescriptor ); @@ -40,7 +41,7 @@ RedfishPlatformHostInterfaceDeviceDescriptor ( @param[in, out] ProtocolRecord Pointer to retrieve the first or the nex= t protocol record. caller has to free the new protocol reco= rd returned from this function using FreePool(). - param[in] IndexOfProtocolData The index of protocol data. + @param[in] IndexOfProtocolData The index of protocol data. @retval EFI_SUCCESS Protocol records are all returned. @retval EFI_NOT_FOUND No more protocol records. @@ -52,4 +53,24 @@ RedfishPlatformHostInterfaceProtocolData ( IN UINT8 IndexOfProtocolData ); +/** + Get the EFI protocol GUID installed by platform library which + indicates the necessary information is ready for building + SMBIOS 42h record. + + @param[out] InformationReadinessGuid Pointer to retrive the protocol + GUID. + + @retval EFI_SUCCESS Notification is required for building up + SMBIOS type 42h record. + @retval EFI_UNSUPPORTED Notification is not required for building u= p + SMBIOS type 42h record. + @retval EFI_ALREADY_STARTED Platform host information is already ready. + @retval Others Other errors. +**/ + +EFI_STATUS +RedfishPlatformHostInterfaceNotification ( + OUT EFI_GUID **InformationReadinessGuid + ); #endif diff --git a/RedfishPkg/Library/PlatformHostInterfaceLibNull/PlatformHostIn= terfaceLibNull.c b/RedfishPkg/Library/PlatformHostInterfaceLibNull/Platform= HostInterfaceLibNull.c index b30f9e37a4d..f83f5418d47 100644 --- a/RedfishPkg/Library/PlatformHostInterfaceLibNull/PlatformHostInterface= LibNull.c +++ b/RedfishPkg/Library/PlatformHostInterfaceLibNull/PlatformHostInterf +++ aceLibNull.c @@ -2,6 +2,7 @@ NULL instace of RedfishPlatformHostInterfaceLib (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+ Copyright (C) 2022 Advanced Micro Devices, Inc. All rights + reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -23,7 +24,7 @@ **/ EFI_STATUS RedfishPlatformHostInterfaceDeviceDescriptor ( - IN UINT8 *DeviceType, + OUT UINT8 *DeviceType, OUT REDFISH_INTERFACE_DATA **DeviceDescriptor ) { @@ -51,3 +52,26 @@ RedfishPlatformHostInterfaceProtocolData ( { return EFI_NOT_FOUND; } + +/** + Get the EFI protocol GUID installed by platform library which + indicates the necessary information is ready for building + SMBIOS 42h record. + + @param[out] InformationReadinessGuid Pointer to retrive the protocol + GUID. + + @retval EFI_SUCCESS Notification is required for building up + SMBIOS type 42h record. + @retval EFI_UNSUPPORTED Notification is not required for building u= p + SMBIOS type 42h record. + @retval EFI_ALREADY_STARTED Platform host information is already ready. + @retval Others Other errors. +**/ +EFI_STATUS +RedfishPlatformHostInterfaceNotification ( + OUT EFI_GUID **InformationReadinessGuid + ) +{ + return EFI_UNSUPPORTED; +} diff --git a/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c b= /RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c index 623350bc261..e5b2bb225f9 100644 --- a/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c +++ b/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c @@ -6,6 +6,7 @@ Copyright (c) 2019, Intel Corporation. All rights reserved.
(C) Copyright 2020 Hewlett Packard Enterprise Development LP
+ Copyright (C) 2022 Advanced Micro Devices, Inc. All rights + reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -21,6 +22,9 @@ #include #include +static EFI_EVENT mPlatformHostInterfaceReadylEvent =3D NULL; static VOID +*mPlatformHostInterfaceReadyRegistration =3D NULL; + /** Create SMBIOS type 42 record for Redfish host interface. @@ -119,7 +123,7 @@ RedfishCreateSmbiosTable42 ( } else { NewProtocolRecords =3D ReallocatePool (CurrentProtocolsDataLength, N= ewProtocolsDataLength, (VOID *)ProtocolRecords); if (NewProtocolRecords =3D=3D NULL) { - DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for Redfish host= interface protocol data.", __FUNCTION__)); + DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for Redfish + host interface protocol data.")); FreePool (ProtocolRecords); FreePool (ProtocolRecord); return EFI_OUT_OF_RESOURCES; @@ -238,6 +242,27 @@ ON_EXIT: return Status; } +/** + Notification event of platform Redfish Host Interface readiness. + + @param[in] Event Event whose notification function is being invoked= . + @param[in] Context The pointer to the notification function's context= , + which is implementation-dependent. + +**/ +VOID +EFIAPI +PlatformHostInterfaceInformationReady ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + DEBUG ((DEBUG_INFO, "%a: Platform Redfish Host Interface informtion +is ready\n", __FUNCTION__)); + + RedfishCreateSmbiosTable42 (); + return; +} + /** Main entry for this driver. @@ -254,8 +279,50 @@ RedfishHostInterfaceDxeEntryPoint ( IN EFI_SYSTEM_TABLE *SystemTable ) { + EFI_STATUS Status; + EFI_GUID *ReadyGuid; + + DEBUG ((DEBUG_INFO, "%a: Entry\n.", __FUNCTION__)); + // - // Create SMBIOS type 42 record. + // Check if the Redfish Host Interface depends on // the specific + protocol installation. // - return RedfishCreateSmbiosTable42 (); + Status =3D RedfishPlatformHostInterfaceNotification (&ReadyGuid); if + (Status =3D=3D EFI_SUCCESS) { + DEBUG ((DEBUG_INFO, " Create protocol install notification to know= the installation of platform Redfish host interface readiness\n")); + DEBUG ((DEBUG_INFO, " Protocol GUID: %g\n", ReadyGuid)); + // + // Register event for ReadyGuid protocol installed by + // platform Redfish host interface library. + // + Status =3D gBS->CreateEvent ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + PlatformHostInterfaceInformationReady, + NULL, + &mPlatformHostInterfaceReadylEvent + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, " Fail to create event for the installation = of platform Redfish host interface readiness.\n")); + return Status; + } + + Status =3D gBS->RegisterProtocolNotify ( + ReadyGuid, + mPlatformHostInterfaceReadylEvent, + &mPlatformHostInterfaceReadyRegistration + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, " Fail to register event for the installatio= n of platform Redfish host interface readiness.\n")); + return Status; + } + return EFI_SUCCESS; + } + if (Status =3D=3D EFI_UNSUPPORTED || EFI_ALREADY_STARTED) { + Status =3D RedfishCreateSmbiosTable42 (); } + + // Return other erros. + return Status; } -- 2.37.1.windows.1 -The information contained in this message may be confidential and propriet= ary to American Megatrends (AMI). This communication is intended to be read= only by the individual or entity to whom it is addressed or by their desig= nee. If the reader of this message is not the intended recipient, you are o= n notice that any distribution of this message, in any form, is strictly pr= ohibited. Please promptly notify the sender by reply e-mail or by telephone= at 770-246-8600, and then delete or destroy all copies of the transmission= .