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.87]) by mx.groups.io with SMTP id smtpd.web10.44655.1671518527255921993 for ; Mon, 19 Dec 2022 22:42:07 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=FPaDFowG; 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.87, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QeCVsY61PQa5a1zAbc6D/GcenAbCwByBghyHIH7YVsgApMM6mogR4XkuLPuvHWfnwqHS6krsQyOwoNzCI2iObVFIqvBXUQYjdqrb5Znjv++HVf0930hi1Mtq7rVODlb4JpI44zs/aOvjyBSkaiLeT7vmsYwYNvJ9wUAKKtB4QHw2O0QjKt3EfO4VN6UIT8RBtH43ueiLhJJ1KcpoIB7l9//rD9k6UT+iD6ho7FfAQrX1xuQNrdh/D0+QkyFgCtGUX8VJH7rsTmOXxtcRXvJBCUJK2bKx51oTZgPTbKPMR5TtrgW3Ie9YPm5mnxxpTyIoewIMayycZLVQXXhmxdHdVw== 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=HlAStkaIUMJqAur3IyXIcQ5o2WFD5mT0HY+kMlXyC/A=; b=Ivi+yzXGrFHPkFxnvv8KiTazqmS5vCYhdWLuRbHvYgLx2Y80XMVsGfUXIVCsQtu4YrxSnZbBtIzgme6T4g7pHpCX292BLCgiiScsKhKJAtDHEO49Sg+Bn5PX3Fay6Hv5TkBT1IKIzMR9nkiZTikLlBYtNRQ4KBOeOcAV7Ne1TtR5Y7iaw0nWUX4dzZh89kGAdgX1g/l77Eo8PWtG6boPJ03HO8cA2dkGvfijOSrnr96RKKJ/FfpySYeexbMytIb8MTpRTa8kr8D3WbfCeSN31k6VHVBFCCCdjzVydJwer2oTSk1OWA5ligKusNJ8aCH10MHcfDRiOKaRM9kXlC4cMQ== 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=HlAStkaIUMJqAur3IyXIcQ5o2WFD5mT0HY+kMlXyC/A=; b=FPaDFowGbUmoo5HzzwKuIm3fCOS2RdqHKBXyqeu+jujZxDPZblYhDnQKRZmjx0YZJVwNVgJyKIrXtOsJVhRaZy8ZpoeRsg9RUqIg/astBTRLLdIVxIoBBE4hjkAsoYGDqEH4jaXmme5NqDoaOObO/KDaYCfcIGgZktPpj1OHo+Y= Received: from BL1P221CA0006.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::22) by PH7PR12MB6490.namprd12.prod.outlook.com (2603:10b6:510:1f5::6) 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 06:42:04 +0000 Received: from BL02EPF0000EE3C.namprd05.prod.outlook.com (2603:10b6:208:2c5:cafe::66) by BL1P221CA0006.outlook.office365.com (2603:10b6:208:2c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Tue, 20 Dec 2022 06:42:03 +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 BL02EPF0000EE3C.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.10 via Frontend Transport; Tue, 20 Dec 2022 06:42:03 +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; Tue, 20 Dec 2022 00:41:59 -0600 From: "Chang, Abner" To: CC: Nickle Wang , Igor Kulchytskyy Subject: [PATCH V3 1/2] RedfishPkg/RedfishHostInterface: Platform Redfish HI notification Date: Tue, 20 Dec 2022 14:41:22 +0800 Message-ID: <20221220064123.352-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: BL02EPF0000EE3C:EE_|PH7PR12MB6490:EE_ X-MS-Office365-Filtering-Correlation-Id: 65008f5c-cb0e-4d57-b13c-08dae2554ddc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z0vKkahZWUtOnptTreraTX69EV86BtKnrST44gJusTfgexonrU/dsr30DxZGugEIH8jnvGMucQRtEjdP5b0C7JPo2kVJsdMKo6HVYnP/hTWQgIZxnG70dRvsqill6OnefuKnZfiP4zaTyXbMVLwCEldvWRQqhFgeVuXxwGQjkD+YfsTFxPWRdswQEFWXoJPH3/ikJU6LaxvOyf2jPAwWBmtUFaXLGBdaYrbL8Xj04LvXXT9JigksW8GnxgThDb8BXTA+W4Bgnounzs+xZV9+c3EeCIwlLf5LR0B9+9yFuDTnW7BG2qFchavLHEUjavxd8iOkyrzgXGUJKFifY3GtSEmHrOa1PoRolg1+FdX6J1EPQrhwZV91bISc32QsydGlCyP5pc/rswyS97sRO6LKom7jDm2C3IoziYBboZJ8l46TXJ8PAglJGQFKua74IeP9xxrSmNI7aViEqFjph0id87/nYwmW7N1K7sOFEd9zy58z1ZfZxbFpubJOnnMU64XTULtRY/Rqgk2w0Syyd/9G5FYLoiY3sHamc1r5xbpPtGOcOVmYbmx41RvzspUbEQWumsnNtkgNM2YI9i94IHWT0M0uaLaS4z+S+ZgeRKehME2GyYTJWBSvhyi1yL1ePNpiILrETE71V9rVt9zfffQhVocH4TITS/EMW20Zu9LrdR+yX77HQmnN6BHFOHE4xvCt3qFhiloaMnEplsRladTarcjwdInSLgpMDxYZX966bjg= 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)(376002)(39860400002)(136003)(451199015)(36840700001)(40470700004)(46966006)(6666004)(47076005)(426003)(8936002)(40480700001)(5660300002)(83380400001)(186003)(16526019)(41300700001)(26005)(15650500001)(2876002)(336012)(2906002)(40460700003)(316002)(36860700001)(478600001)(82740400003)(19627235002)(54906003)(7696005)(6916009)(36756003)(86362001)(356005)(2616005)(1076003)(70586007)(82310400005)(70206006)(81166007)(4326008)(8676002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 06:42:03.2284 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 65008f5c-cb0e-4d57-b13c-08dae2554ddc 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: BL02EPF0000EE3C.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6490 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 Reviewed-by: Nickle Wang --- .../Include/Library/RedfishHostInterfaceLib.h | 28 ++++++- .../PlatformHostInterfaceLibNull.c | 26 ++++++- .../RedfishHostInterfaceDxe.c | 73 ++++++++++++++++++- 3 files changed, 121 insertions(+), 6 deletions(-) diff --git a/RedfishPkg/Include/Library/RedfishHostInterfaceLib.h b/Redfish= Pkg/Include/Library/RedfishHostInterfaceLib.h index 8d8389b9647..22a8f9283cb 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,25 @@ 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..40642469c9a 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..3e12e0c8b9a 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,52 @@ 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) || (Status =3D=3D EFI_ALREADY_STARTE= D)) { + Status =3D RedfishCreateSmbiosTable42 (); + } + + // Return other erros. + return Status; } --=20 2.37.1.windows.1