From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 5F96A941445 for ; Fri, 22 Mar 2024 09:02:59 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=JDB1grylm4If9h4KEEvVC0NSiGxPZ+UYjZBeP3MeIaI=; c=relaxed/simple; d=groups.io; h=Received-SPF:From:To:CC:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20240206; t=1711098177; v=1; b=flh18adz1/RbHph6qBwqd6L1F9YFqmb3cZQ4veaQ4Pn7MvEb3FjxDnLxAZ9fHJ4YZ7HZpmf2 MJehxt2Xayjdrh/pLfWDC/wB8nz31VhlukNTuPBOY9FELqWb3JH8b7d1Wn+/tLhrz4O/EC+vOcG 34vw1qGcFkDhjSPkhon+xSyK1yT1sTqX7pG4+MpHMxUrCiGaZ/YkrKXqCyDeegYtg2+GzBhw/pZ cfHGtv40kJO/Av+HAuJt6F8UjECr1H+2twxyVnDUyV/Rv6ZbP73Cy6Rjc/W2QV0a/M8EF7zTus0 G/p28D7lif/8ebZgVc4koCPrniGonTrWiJC3ZyrWKdSLw== X-Received: by 127.0.0.2 with SMTP id tYGGYY7687511xJA6U7cJW32; Fri, 22 Mar 2024 02:02:57 -0700 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.75]) by mx.groups.io with SMTP id smtpd.web11.8640.1711098177096566387 for ; Fri, 22 Mar 2024 02:02:57 -0700 X-Received: from CH5P220CA0018.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:1ef::25) by SN7PR12MB8602.namprd12.prod.outlook.com (2603:10b6:806:26d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.34; Fri, 22 Mar 2024 09:02:54 +0000 X-Received: from DS2PEPF00003447.namprd04.prod.outlook.com (2603:10b6:610:1ef:cafe::17) by CH5P220CA0018.outlook.office365.com (2603:10b6:610:1ef::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.28 via Frontend Transport; Fri, 22 Mar 2024 09:02:54 +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 X-Received: from SATLEXMB04.amd.com (165.204.84.17) by DS2PEPF00003447.mail.protection.outlook.com (10.167.17.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Fri, 22 Mar 2024 09:02:54 +0000 X-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.2507.35; Fri, 22 Mar 2024 04:02:52 -0500 From: "Chang, Abner via groups.io" To: CC: Igor Kulchytskyy , Nickle Wang Subject: [edk2-devel] [edk2-redfish-client][PATCH V2 1/2] RedfishClientPkg: Set SettingsObject URI as the config language Date: Fri, 22 Mar 2024 17:02:25 +0800 Message-ID: <20240322090225.1698-1-abner.chang@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF00003447:EE_|SN7PR12MB8602:EE_ X-MS-Office365-Filtering-Correlation-Id: c1eb292b-562e-4831-45b9-08dc4a4edc5d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: yKvr4ZdowQ5fEF0KS5xevn77PiVgSOOziVGmvTInNUAuJneeKkxoBX9nT5ZR/UvMTTWutcbsS2gi2QFK3PLKenyUa+fDiI6UX5iZ7VUr/H5zeBA7rJmx2AZKi0vr9/HtvXaDe1WDdovgNM3SpA1vn9DXniHL6QTXhKbKea3ApWOIinC6M5tYIJO4OTyZFqI+k5AWe3BjjX3FUA65ZW2fmJkfJkb6KtGQe9vfPktWugNSaXBS+OFRACeVS6054PKGVtd2xhossQmUfOpR3wHnG2A5WKNE3sOSEhVxx2htyecjGX+gsj0LeU7J4y6cTPEhf5SxNXjzEz+alVVMJIf6JMUxRtB/O3wDXWBgV4e+w+wdZLo4rLOytYPEqgKBYlx3dBTHhBa0Lxxh+QMXDQIIfNuxxnm90vaCTuvDIFGZS8areJBsUj/psybZaQxNInlmjQwRiiAWyM0jrpB3UQaRb53czloIdNoPrg5Tq/AVgRwqr1l7aINVQsHlj81A6zB0MhhzWO73yJWXB7bHIbqAsJCSkqYuho4/FNKOKazzU9xXp2asDlInjXEFs/IL5XUvefbF1OfH4nR9lPQSyJCurenNhm9rwZH/JKQ3158QDgTOmx/JkzzokN7yy7/+T+PIWcStUSdNrrR0o4Unw0n+ku4HR+1uw8i43W1Kgkkjcp+X0V/9buStdEu1CzbMfZt77rRKooZGSP0BREg/tFgI6To4C9uHA84p3vYTPyVs3J5V1SXi53x+rHCjvGoJicUV X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2024 09:02:54.3522 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1eb292b-562e-4831-45b9-08dc4a4edc5d 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: DS2PEPF00003447.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8602 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Fri, 22 Mar 2024 02:02:57 -0700 Reply-To: devel@edk2.groups.io,abner.chang@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 2uCEirYs9trq8asJNGiJmjTXx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=flh18adz; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Abner Chang Set SettingsObject URI in @Redfish.Settings resource as the config language which is the same as the config language of parent URI that mandates @Redfish.Settings. With this, we can find the config language of the properties in SettingsObject URI. Signed-off-by: Abner Chang Cc: Igor Kulchytskyy Co-authored-by: Nickle Wang --- .../Library/RedfishFeatureUtilityLib.h | 17 ++++ .../RedfishFeatureUtilityLib.c | 86 ++++++++++++++++--- .../RedfishConfigLangMapDxe.c | 15 +++- 3 files changed, 101 insertions(+), 17 deletions(-) diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h b/= RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h index ba9ea01501..3c5f248eb7 100644 --- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h +++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h @@ -369,6 +369,23 @@ RedfishSetRedfishUri ( IN EFI_STRING Uri ); =20 +/** + + Save Redfish SettingsObject URI in database for further use. + + @param[in] ParentUri Parent URI of @Redfish.Settings property= . + @param[in] SettingObjectUri Redfish SettingsObject Uri to save. + + @retval EFI_INVALID_PARAMETER SystemId is NULL or EMPTY + @retval EFI_SUCCESS Redfish uri is saved + +**/ +EFI_STATUS +SetRedfishSettingsObjectsUri ( + IN EFI_STRING ParentUri, + IN EFI_STRING SettingObjectUri + ); + /** =20 Get the property name by given Configure Language. diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatu= reUtilityLib.c b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishF= eatureUtilityLib.c index cc2b37b796..c37bf85310 100644 --- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyLib.c +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyLib.c @@ -2082,7 +2082,6 @@ GetConfigureLang ( EFI_STRING ResultStr; EFI_STRING UnicodeUri; EFI_STATUS Status; - EFI_STRING StrFound; =20 if (IS_EMPTY_STRING (Uri)) { return NULL; @@ -2101,18 +2100,6 @@ GetConfigureLang ( } =20 ConfigLang =3D RedfishGetConfigLanguage (UnicodeUri); - if (ConfigLang =3D=3D NULL) { - // - // @Redfish.Settings share the same schema as its parent. - // Remove "Settings" and try again. - // - StrFound =3D StrStr (UnicodeUri, L"/Settings"); - if (StrFound !=3D NULL) { - StrFound[0] =3D L'\0'; - DEBUG ((REDFISH_DEBUG_TRACE, "%a: \"Settings\" found in URI, try: %s= \n", __func__, UnicodeUri)); - ConfigLang =3D RedfishGetConfigLanguage (UnicodeUri); - } - } =20 FreePool (UnicodeUri); =20 @@ -2172,6 +2159,61 @@ RedfishSetRedfishUri ( return mConfigLangMapProtocol->Set (mConfigLangMapProtocol, ConfigLang, = Uri); } =20 +/** + + Save Redfish SettingsObject URI in database for further use. + + @param[in] ParentUri Parent URI of @Redfish.Settings property= . + @param[in] SettingObjectUri Redfish SettingsObject Uri to save. + + @retval EFI_INVALID_PARAMETER ParentUri or SettingObjectUri is NULL. + @retval EFI_NOT_FOUND Config language for ParentUri is not fou= nd. + @retval EFI_SUCCESS Redfish URI is saved with corresponding + config language. + +**/ +EFI_STATUS +SetRedfishSettingsObjectsUri ( + IN EFI_STRING ParentUri, + IN EFI_STRING SettingObjectUri + ) +{ + EFI_STATUS Status; + EFI_STRING ConfigLang; + + if ((ParentUri =3D=3D NULL) || (SettingObjectUri =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + // + // Check if the SettingsObject URI already in the database. + // + ConfigLang =3D RedfishGetConfigLanguage (SettingObjectUri); + if (ConfigLang =3D=3D NULL) { + // + // No config language of SettingsObject URI is found. + // Get the config language of parent URI because the data model of + // SettingsObject URI resource is the same as the data model of parent= URI. + // + ConfigLang =3D RedfishGetConfigLanguage (ParentUri); + if (ConfigLang =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get the config language of paren= t URI that mandates SettingsObject - %s.\n", __func__, ParentUri)); + return EFI_NOT_FOUND; + } + + // Set the config language of settings URI using parent's URI config l= anguage. + Status =3D RedfishSetRedfishUri (ConfigLang, SettingObjectUri); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Fails to set the config language of Settin= gsObject - %s.\n", __func__, SettingObjectUri)); + return Status; + } + + DEBUG ((DEBUG_INFO, "%a: Set the config language of SettingsObject - %= s: SUCCESS.\n", __func__, SettingObjectUri)); + } + + return EFI_SUCCESS; +} + /** =20 Get @odata.id from give HTTP payload. It's call responsibility to releas= e returned buffer. @@ -3532,6 +3574,7 @@ CompareRedfishBooleanArrayValues ( payload and URI to pending settings. Caller has to release "SettingPaylo= ad" and "SettingUri". =20 + @param[in] RedfishService Instance of REDFISH_SERVICE @param[in] Payload Payload that may contain "@Redfish.Settings" @param[out] SettingPayload Payload keeps pending settings. @param[out] SettingUri URI to pending settings. @@ -3552,6 +3595,7 @@ GetPendingSettings ( EDKII_JSON_VALUE JsonValue; UINTN Index; EFI_STATUS Status; + EFI_STRING StrFound; =20 if ((RedfishService =3D=3D NULL) || (Payload =3D=3D NULL) || (SettingRes= ponse =3D=3D NULL) || (SettingUri =3D=3D NULL)) { return EFI_INVALID_PARAMETER; @@ -3586,6 +3630,22 @@ GetPendingSettings ( return Status; } =20 + // + // Setting URI exists, check if settings URI is valid or not. + // + StrFound =3D StrStr (*SettingUri, L"/Settings"); + if (StrFound !=3D NULL) { + DEBUG ((REDFISH_DEBUG_TRACE, "%a: \"Settings\" found in URI: %s\n", = __func__, *SettingUri)); + } else { + StrFound =3D StrStr (*SettingUri, L"/SD"); + if (StrFound !=3D NULL) { + DEBUG ((REDFISH_DEBUG_TRACE, "%a: \"SD\" found in URI: %s\n", __fu= nc__, *SettingUri)); + } else { + DEBUG ((DEBUG_ERROR, "%a: Not an valid @redfish.settings URI\n", _= _func__, *SettingUri)); + ASSERT (FALSE); + } + } + return EFI_SUCCESS; } =20 diff --git a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapD= xe.c b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c index 8c93044580..4071e30c17 100644 --- a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c +++ b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c @@ -2,6 +2,7 @@ =20 (C) Copyright 2022 Hewlett Packard Enterprise Development LP
Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights res= erved. + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -606,10 +607,16 @@ RedfishConfigLangMapSet ( Status =3D EFI_NOT_FOUND; Target =3D FindConfigLangMapRecord (&Private->ConfigLangList.ListHeader,= ConfigLang, FALSE); if (Target !=3D NULL) { - // - // Remove old one and create new one. - // - Status =3D DeleteConfigLangMapRecord (&Private->ConfigLangList, Target= ); + if (Uri !=3D NULL) { + if (StrCmp (Uri, Target->Uri) =3D=3D 0) { + return EFI_SUCCESS; + } + } else { + // + // Remove old one and create new one. + // + Status =3D DeleteConfigLangMapRecord (&Private->ConfigLangList, Targ= et); + } } =20 // --=20 2.37.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117030): https://edk2.groups.io/g/devel/message/117030 Mute This Topic: https://groups.io/mt/105081780/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-