From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (NAM02-SN1-obe.outbound.protection.outlook.com [40.107.96.42]) by mx.groups.io with SMTP id smtpd.web10.23759.1671461501420434968 for ; Mon, 19 Dec 2022 06:51:41 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=VCyRR4rz; 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.96.42, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cUhZUDU0mUP7H/ipG2k5Eo0jwLGusTNKIZQKbEuycvOV7KcUDjH5biJAXIykSRqWw6C2Zk8ixU01UJOo/prUQhxtD5TIbEuLWxR1x0LSktLB2YbpFTzlUYGnlHo3R5lY8G9ukN0XmLFQy46GtsuAkqWvBon+xruBUXx7AgzREip+5HmMJR/SKPyT3z4IL2E41sypH1ySMFM4Vlst6AKXAon5QUJv7nZ/IygiCFb6AkR9q4ZfoaJmX7dxfGpOWOD6cnjP6CbIMOTQobm3A/jQublCnbcVx5sfh3JxDLmyk1PNsodpj1TX2xWZoTJZLliWM1gNE27JLlgciwXktlhSPg== 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=B37M4ZBsxJ5Fj1GfT5Rf6ZoNzIuEFNM1oKibXsk9sOU=; b=P+iQ16WloVI2Fz7U2toSwYCApRt+mvnJ184UVYh/yplLHo8VI81+x9YFyOF6sg7GgC4UhbLvTfySN36KJRqlHZVjVrr9JF6Dkt2k6roapdC9bnowyJtAe10UN52bVmC465H2Xkmaerh8VqMivS9pgzHP4JBBxy5GpRDhzrTCMGuH9AgXJs/dOrpgXuO4sW4NdVR0W0yzDYDwHrZLJAwTfg3gXEjrRUc9hkVZe7TJR1rV3f0r8x3CZP80L1ml5pNKeyOMsx/Nv2T2VSky/kW2dIGkj7S3aRCoK4Vqxq6c9NKKMuSrWF/E/Af1ckK/vxhGbKtKt59dksEpXU/VdwCSPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=B37M4ZBsxJ5Fj1GfT5Rf6ZoNzIuEFNM1oKibXsk9sOU=; b=VCyRR4rzefDb2C0WfsjhKpvGCwDa5v5n/mNLAxLeL2QtLOyGmsLBQCg75GHPuFt5b7ifUFiEJbmCvuSEBVkQNMAPlgy/SCadS+wzudmlreyPEbq3U1tehqOnCGNSINVMxrZLN68mXrhKtep7tnxo+1d+iTymTBxZpdjKtrXEUwA= Received: from BN0PR07CA0004.namprd07.prod.outlook.com (2603:10b6:408:141::22) by SJ1PR12MB6268.namprd12.prod.outlook.com (2603:10b6:a03:455::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.12; Mon, 19 Dec 2022 14:51:39 +0000 Received: from BL02EPF00010206.namprd05.prod.outlook.com (2603:10b6:408:141:cafe::ac) by BN0PR07CA0004.outlook.office365.com (2603:10b6:408:141::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.11 via Frontend Transport; Mon, 19 Dec 2022 14:51:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010206.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Mon, 19 Dec 2022 14:51:39 +0000 Received: from TPE-L1-ABNCHANG.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 19 Dec 2022 08:51:36 -0600 From: "Chang, Abner" To: CC: Nickle Wang , Igor Kulchytskyy Subject: [PATCH V2 1/2] RedfishPkg/RedfishHostInterface: Platform Redfish HI notification Date: Mon, 19 Dec 2022 22:51:15 +0800 Message-ID: <20221219145115.1163-1-abner.chang@amd.com> X-Mailer: git-send-email 2.37.1.windows.1 MIME-Version: 1.0 Return-Path: Abner.Chang@amd.com X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010206:EE_|SJ1PR12MB6268:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e18cf27-2a80-4718-68e7-08dae1d088d8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iTfi9YPfn0DJLkA9Re1/zgkPz5JV6qI3ABkrGEQGkdt8F8+XTFM0g3udOt61HGL9smivbmKjs2dr//Yjb8Vn+P3MMncV/iFM8RbMV5P9WiA2Q2I6rgzbjlYfb/Et76kGzDuqx6EnmEPeFpfM3xCA0rQtuUpLrFq+ZiM3niSj9n1tIhnutul6f6lNYwr7n72qnyjzG+KwUEY+ObJDS1wT8ZCr8MaMUdOtdWkUUlVyzK3PgpW98zs0nehYP/IiDDrG/hVOdPWIyfF/WzMWmKYwLu6h//lsoPA8hoZ8fHMJPN/9U6g0UEGCqgbhcmtr+MF2FkmUlC320S00GQ/W3eTpyATjlxOFHgpqgdf8fGNmr5XXkR3d0jPSXnNvGgkfPXYvAMh+KPtPHNVkoTcpnRvEkE2Ca2EU0Oka+r+xt0ieOoeva13JyNY/hwfI9NQNvovGqbAC/tQKFurNhHhUsZXQ1etA+xkGW17cipG3EZVE6PZZajWqL1g5mSMSZjOqTCyISZ6t568ahy2wUvkOo+da16t+aP+/jK2B+me0VRCjXAD3Zew/f+NuwrMXqz3zXj+sk+uO9BrrCDmnn3mTlPHFgZRrjALNwNSeAe3QNuC0++CXMn6m9cBnGCdD7VrcFd9JCvrkIZafOgpEs8FhoMNfuauVgu1i4730eBrJJa5eQzP+ZFcLERjPTF59gG4ixQwPtci/JfXl+2vvlecMVqq6Dz5F2o6dL/bIxdJ5QMdT7SU= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(396003)(346002)(136003)(39860400002)(376002)(451199015)(40470700004)(46966006)(36840700001)(356005)(36756003)(40480700001)(82310400005)(81166007)(82740400003)(40460700003)(86362001)(336012)(1076003)(54906003)(47076005)(7696005)(426003)(6666004)(186003)(16526019)(26005)(316002)(2616005)(478600001)(6916009)(19627235002)(15650500001)(4326008)(8936002)(36860700001)(2876002)(8676002)(70206006)(2906002)(5660300002)(83380400001)(70586007)(41300700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 14:51:39.1365 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e18cf27-2a80-4718-68e7-08dae1d088d8 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010206.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6268 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain 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 library that indicates the necessary information is ready for building SMBIOS 42h record. Signed-off-by: Abner Chang Cc: Nickle Wang Cc: Igor Kulchytskyy --- .../Include/Library/RedfishHostInterfaceLib.h | 27 ++++++- .../PlatformHostInterfaceLibNull.c | 26 ++++++- .../RedfishHostInterfaceDxe.c | 71 ++++++++++++++++++- 3 files changed, 118 insertions(+), 6 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. =20 (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+ Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -19,7 +20,7 @@ /** Get platform Redfish host interface device descriptor. =20 - @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 ); =20 @@ -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. =20 @retval EFI_SUCCESS Protocol records are all returned. @retval EFI_NOT_FOUND No more protocol records. @@ -52,4 +53,24 @@ RedfishPlatformHostInterfaceProtocolData ( IN UINT8 IndexOfProtocolData ); =20 +/** + 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/PlatformHostInterface= LibNull.c @@ -2,6 +2,7 @@ NULL instace of RedfishPlatformHostInterfaceLib =20 (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+ Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -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..621b89fb847 100644 --- a/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c +++ b/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c @@ -6,6 +6,7 @@ =20 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.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -21,6 +22,9 @@ #include #include =20 +static EFI_EVENT mPlatformHostInterfaceReadylEvent =3D NULL; +static VOID *mPlatformHostInterfaceReadyRegistration =3D NULL; + /** Create SMBIOS type 42 record for Redfish host interface. =20 @@ -238,6 +242,27 @@ ON_EXIT: return Status; } =20 +/** + 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 r= eady\n", __FUNCTION__)); + + RedfishCreateSmbiosTable42 (); + return; +} + /** Main entry for this driver. =20 @@ -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; } --=20 2.37.1.windows.1