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 0515C780091 for ; Thu, 21 Mar 2024 04:54:50 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=qvAd5N/pH9ONhwKWC4NFvtHKFmC91dfkr8XL+teLG+8=; 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=1710996889; v=1; b=KlQXtB8M0MCfxXaS1ybnj566tMwYCbXPANUY6CBWL3hLneDXXC3iAfzabt53SEA6XmETi0Ou PBQ5bWDNrE259pTsGZt6rV5MATT0akCbw8fnVSuIHj14TbV4vNTV6zXpINBEdI+cr2tu+vBmXr8 PHflyMpbdeD8knrAq29o9mIiBt0YBEK7w3AiTmOBLhwYu1COi4ZKos9Al2fvto89AOQFOW+wMB3 da8irNnAWPQpejTYha/wBD/vLx+Jc2Do7Du/d/Bm5tEaCxKn6rZDa2loH2k7D/PhutW3O0V1GdH 9MTaCubX6M7XIRBnr5Nq56Czvl9u7CTHdBXqKrBoWY/Mg== X-Received: by 127.0.0.2 with SMTP id OTP3YY7687511xwSLP8BHx5M; Wed, 20 Mar 2024 21:54:49 -0700 X-Received: from NAM12-BN8-obe.outbound.protection.outlook.com (NAM12-BN8-obe.outbound.protection.outlook.com [40.107.237.58]) by mx.groups.io with SMTP id smtpd.web10.2.1710996888590995862 for ; Wed, 20 Mar 2024 21:54:48 -0700 X-Received: from DM6PR02CA0058.namprd02.prod.outlook.com (2603:10b6:5:177::35) by SA3PR12MB8048.namprd12.prod.outlook.com (2603:10b6:806:31e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.15; Thu, 21 Mar 2024 04:54:46 +0000 X-Received: from DS2PEPF0000343D.namprd02.prod.outlook.com (2603:10b6:5:177:cafe::dd) by DM6PR02CA0058.outlook.office365.com (2603:10b6:5:177::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.28 via Frontend Transport; Thu, 21 Mar 2024 04:54:46 +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 DS2PEPF0000343D.mail.protection.outlook.com (10.167.18.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Thu, 21 Mar 2024 04:54:45 +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; Wed, 20 Mar 2024 23:54:44 -0500 From: "Chang, Abner via groups.io" To: CC: Igor Kulchytskyy , Nickle Wang Subject: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg: Set SettingsObject URI as the config language Date: Thu, 21 Mar 2024 12:54:21 +0800 Message-ID: <20240321045421.1087-1-abner.chang@amd.com> MIME-Version: 1.0 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: DS2PEPF0000343D:EE_|SA3PR12MB8048:EE_ X-MS-Office365-Filtering-Correlation-Id: 49f8fd32-7f5a-4f5e-8eb8-08dc496307a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: jCcb8hdeW4O0pYd68IvpA28khwwkRf7/iyMXvqWQrz1l9oNeKOZFe5sGpLthGBY/QTtfW/7KCgSPLqOpn+U9jOF2XAVIN3DVeqV7j0uej3xVUunmKb6yWiCfnYuan6HcEC6goyN8ed9oGqbX0X3iJ4BYV5IVkqKQHRw3M9BqPmHYsHCRPYumIW5mO8zqX2h94zW3hj1B/tp2UkpdwWeFEDeQjGMxOuVrsO/1m9jPVOM/bHnGrMz8vi+ndtJEYICXpqsYR0FaL3gsLD0Ax2CbwoiAKCbf4fRaWf9H0qjg4wJSfpBa5zxlBXFKS51UIU6d/qhvV6DJ7lB9ZzNUDbS1rMvS2PpQhpCgB6PW2+bta0crs2J6elQbgOulaLX6Eg+KYDyVtBc/xVtc2ouEjkmSntSd7q8cNDZEh69o3TTUx543n1mVZ7gAboV7e1u83E9iyfRwDYqge7V7sZaxUa3JuJpYQU55loN5qX+eKdoT2lPJu7caXiKvULEuCf5B0d6Tw5SDqj6KZO4izvG2lJAc4NdnpXbCxlRr/WZUWdpKDu3K6FckndYoyb08IvZm57zNScrKJBswZfyYgR4S12hfNIgQyDv8VsZxUqmvQIDj/e5PEfshLya6TXoLbix5J5B5Q/dxHbFCZzj6HGVOCWB3vXKt7vvzcpwi1KpEjO53+dGkHzTOelP5dqdTT1oMiTmqOBJifz4QfTmZCmBxwAxAve/aahmt8tMcA1afxXYEW+wLl/HwoQzfnLfUPdlF2yzm X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2024 04:54:45.7867 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 49f8fd32-7f5a-4f5e-8eb8-08dc496307a5 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: DS2PEPF0000343D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8048 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: Wed, 20 Mar 2024 21:54:48 -0700 Reply-To: devel@edk2.groups.io,abner.chang@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 9vQB5dmFj172Zjy9xqA1tCVcx7686176AA= 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=KlQXtB8M; 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 Cc: Nickle Wang --- .../RedfishFeatureUtilityLib.c | 63 +++++++++++++++---- .../RedfishConfigLangMapDxe.c | 15 +++-- 2 files changed, 61 insertions(+), 17 deletions(-) diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatu= reUtilityLib.c b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishF= eatureUtilityLib.c index cc2b37b796..74bfc611ac 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 @@ -3532,6 +3519,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 +3540,9 @@ GetPendingSettings ( EDKII_JSON_VALUE JsonValue; UINTN Index; EFI_STATUS Status; + EFI_STRING ConfigLang; + EFI_STRING StrFound; + CHAR16 TempChar; =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 +3577,52 @@ 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); + } + } + + // + // Check if the SettingsObject URI already in the database. + // + ConfigLang =3D RedfishGetConfigLanguage (*SettingUri); + 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 pare= nt URI. + // + TempChar =3D StrFound[0]; + StrFound[0] =3D L'\0'; + ConfigLang =3D RedfishGetConfigLanguage (*SettingUri); + if (ConfigLang =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get the config language of par= ent URI that mandates SettingsObject - %s.\n", __func__, *SettingUri)); + return EFI_NOT_FOUND; + } + + StrFound[0] =3D TempChar; + + // Set the config language of settings URI using parent's URI config= language. + Status =3D RedfishSetRedfishUri (ConfigLang, *SettingUri); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Fails to set the config language of Sett= ingsObject - %s.\n", __func__, *SettingUri)); + return Status; + } + + DEBUG ((DEBUG_INFO, "%a: Set the config language of SettingsObject -= %s: SUCCESS.\n", __func__, *SettingUri)); + } + 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 (#116946): https://edk2.groups.io/g/devel/message/116946 Mute This Topic: https://groups.io/mt/105059880/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-