From nobody Mon Feb 9 23:38:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+112559+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+112559+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1702596312; cv=none; d=zohomail.com; s=zohoarc; b=kBRuWl4NWAPTmE5cOX5tPMhcguV+d7rwNdAFy7BclS2Vk35pJCSqSeg/hNFofGG99AlG2IIri2WY/DAif/vNBNvdqnhflToOYTK1nvionWlAcyBhdeLjDJ/09ikS/lK/y9/RX7g27MbkZ/PFE1t+kefZyOy7PXnVmo5mPSANs3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1702596312; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=WH6PFrn7ByxvtcVBrhNTNK0l0tq2AbxjAw6Wmmksxw0=; b=d9PyQM417t7+8mwREjPZ1yaUTmIohQESNdenFcGwKe3KafVyJ6PIj4oHPE6SafmY8+AKZXkn/omAks26bqJcEGBL2CtJx0bA3w1+Wk8YZWbF7zsyS5yrOBYfrgGpcdvaM8BTHsOvyKxjEs1ZhgWUgOeFl+q3x4iwecHFpq/ufDw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+112559+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1702596312630761.26595869752; Thu, 14 Dec 2023 15:25:12 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=jv4yKEk5mPJRI/+7+lPL/Mq9Qhc9+2k8Ngh7Sx8qvhw=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1702596312; v=1; b=mSR8p8Uibhqv3i/tHcvo7cSMtQ2W02QPHqD/2mTQfiPXX2P5l6rel7mbpwNrjrKVPv1NqdSE l8BnskOP6te/VMDcqBtEBuQZcIcEVsyiJCdmPGhy8/2S9Do2ka35uAalK9bdlhZ1Mam81Jf7vgZ aGP9+GkvaBhJ56FalsSeAmaU= X-Received: by 127.0.0.2 with SMTP id JbHLYY1788612xtQXeYlLgGJ; Thu, 14 Dec 2023 15:25:12 -0800 X-Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by mx.groups.io with SMTP id smtpd.web11.44957.1702596311452516879 for ; Thu, 14 Dec 2023 15:25:11 -0800 X-Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-50e1d61b657so50950e87.0 for ; Thu, 14 Dec 2023 15:25:11 -0800 (PST) X-Gm-Message-State: m1HbNZy1J4aWeJefNaS95E3mx1787277AA= X-Google-Smtp-Source: AGHT+IHMHM2Gnb7VfK3PMVtliTnlj8GdNE7y/SC5e48GsoE8awbg3LdZYtF9wemhMYrcn/qysJSl/w== X-Received: by 2002:a19:5f55:0:b0:50b:f3a0:861 with SMTP id a21-20020a195f55000000b0050bf3a00861mr4574756lfj.7.1702596309431; Thu, 14 Dec 2023 15:25:09 -0800 (PST) X-Received: from localhost.localdomain ([79.164.221.98]) by smtp.gmail.com with ESMTPSA id j24-20020ac24558000000b0050bfe5815e7sm1973119lfm.165.2023.12.14.15.25.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Dec 2023 15:25:09 -0800 (PST) From: "Mike Maslenkin" To: devel@edk2.groups.io Cc: abner.chang@amd.com, nicklew@nvidia.com, igork@ami.com, Mike Maslenkin Subject: [edk2-devel] [PATCH v2 10/14] RedfishDiscoverDxe: introduce InitInformationData helper function Date: Fri, 15 Dec 2023 02:24:54 +0300 Message-Id: <20231214232458.4636-11-mike.maslenkin@gmail.com> In-Reply-To: <20231214232458.4636-1-mike.maslenkin@gmail.com> References: <20231214232458.4636-1-mike.maslenkin@gmail.com> MIME-Version: 1.0 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 Reply-To: devel@edk2.groups.io,mike.maslenkin@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1702596314274100044 Content-Type: text/plain; charset="utf-8" Cc: Abner Chang Cc: Nickle Wang Cc: Igor Kulchytskyy Signed-off-by: Mike Maslenkin --- .../RedfishDiscoverDxe/RedfishDiscoverDxe.c | 108 ++++++++++++------ 1 file changed, 74 insertions(+), 34 deletions(-) diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPk= g/RedfishDiscoverDxe/RedfishDiscoverDxe.c index e344e06d8dcc..724aa35431a8 100644 --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c @@ -711,6 +711,69 @@ DiscoverRedfishHostInterface ( return Status; } =20 +/** + The function initalizes particular strings into EFI_REDFISH_DISCOVERED_I= NFORMATION structure + + @param[in] Information EFI_REDFISH_DISCOVERED_INFORMATION + @param[in] RedfishVersion Redfish version. + @param[in] RedfishLocation Redfish location. + @param[in] Uuid Service UUID string. + @param[in] Os OS string. + @param[in] OsVer OS version string. + @param[in] Product Product string. + @param[in] ProductVer Product version string. + +**/ +STATIC +VOID +InitInformationData ( + IN EFI_REDFISH_DISCOVERED_INFORMATION *Information, + IN UINTN *RedfishVersion OPTIONAL, + IN CHAR8 *RedfishLocation OPTIONAL, + IN CHAR8 *Uuid OPTIONAL, + IN CHAR8 *Os OPTIONAL, + IN CHAR8 *OsVer OPTIONAL, + IN CHAR8 *Product OPTIONAL, + IN CHAR8 *ProductVer OPTIONAL + ) +{ + if (RedfishVersion !=3D NULL) { + Information->RedfishVersion =3D *RedfishVersion; + DEBUG ((DEBUG_MANAGEABILITY, "Redfish service version: %d.\n", Informa= tion->RedfishVersion)); + } + + if (RedfishLocation !=3D NULL) { + Information->Location =3D (CHAR16 *)AllocatePool (AsciiStrSize ((const= CHAR8 *)RedfishLocation) * sizeof (CHAR16)); + AsciiStrToUnicodeStrS ((const CHAR8 *)RedfishLocation, Information->Lo= cation, AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof (CHAR16)); + DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", Inform= ation->Location)); + } + + if (Uuid !=3D NULL) { + Information->Uuid =3D (CHAR16 *)AllocatePool (AsciiStrSize ((const CHA= R8 *)Uuid) * sizeof (CHAR16)); + AsciiStrToUnicodeStrS ((const CHAR8 *)Uuid, Information->Uuid, AsciiSt= rSize ((const CHAR8 *)Uuid) * sizeof (CHAR16)); + DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid)= ); + } + + if (Os !=3D NULL) { + Information->Os =3D (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8= *)Os) * sizeof (CHAR16)); + AsciiStrToUnicodeStrS ((const CHAR8 *)Os, Information->Os, AsciiStrSiz= e ((const CHAR8 *)Os) * sizeof (CHAR16)); + DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", = Information->Os, Information->OsVersion)); + } + + if (OsVer !=3D NULL) { + Information->OsVersion =3D (CHAR16 *)AllocatePool (AsciiStrSize ((cons= t CHAR8 *)OsVer) * sizeof (CHAR16)); + AsciiStrToUnicodeStrS ((const CHAR8 *)OsVer, Information->OsVersion, A= sciiStrSize ((const CHAR8 *)OsVer) * sizeof (CHAR16)); + } + + if ((Product !=3D NULL) && (ProductVer !=3D NULL)) { + Information->Product =3D (CHAR16 *)AllocatePool (AsciiStrSize ((const = CHAR8 *)Product) * sizeof (CHAR16)); + AsciiStrToUnicodeStrS ((const CHAR8 *)Product, Information->Product, A= sciiStrSize ((const CHAR8 *)Product) * sizeof (CHAR16)); + Information->ProductVer =3D (CHAR16 *)AllocatePool (AsciiStrSize ((con= st CHAR8 *)ProductVer) * sizeof (CHAR16)); + AsciiStrToUnicodeStrS ((const CHAR8 *)ProductVer, Information->Product= Ver, AsciiStrSize ((const CHAR8 *)ProductVer) * sizeof (CHAR16)); + DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%s.= \n", Information->Product, Information->ProductVer)); + } +} + /** The function adds a new found Redfish service to internal list and notify client. @@ -851,41 +915,17 @@ AddAndSignalNewRedfishService ( DEBUG ((DEBUG_MANAGEABILITY, "*** Redfish Service Information ***\n")); =20 DiscoveredInstance->Information.UseHttps =3D UseHttps; - if (RedfishVersion !=3D NULL) { - DiscoveredInstance->Information.RedfishVersion =3D *RedfishVersion; - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service version: %d.\n", Disco= veredInstance->Information.RedfishVersion)); - } =20 - if (RedfishLocation !=3D NULL) { - DiscoveredInstance->Information.Location =3D (CHAR16 *)AllocatePool = (AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof (CHAR16)); - AsciiStrToUnicodeStrS ((const CHAR8 *)RedfishLocation, DiscoveredIns= tance->Information.Location, AsciiStrSize ((const CHAR8 *)RedfishLocation) = * sizeof (CHAR16)); - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", Disc= overedInstance->Information.Location)); - } - - if (Uuid !=3D NULL) { - DiscoveredInstance->Information.Uuid =3D (CHAR16 *)AllocatePool (Asc= iiStrSize ((const CHAR8 *)Uuid) * sizeof (CHAR16)); - AsciiStrToUnicodeStrS ((const CHAR8 *)Uuid, DiscoveredInstance->Info= rmation.Uuid, AsciiStrSize ((const CHAR8 *)Uuid) * sizeof (CHAR16)); - DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", DiscoveredInstan= ce->Information.Uuid)); - } - - if (Os !=3D NULL) { - DiscoveredInstance->Information.Os =3D (CHAR16 *)AllocatePool (Ascii= StrSize ((const CHAR8 *)Os) * sizeof (CHAR16)); - AsciiStrToUnicodeStrS ((const CHAR8 *)Os, DiscoveredInstance->Inform= ation.Os, AsciiStrSize ((const CHAR8 *)Os) * sizeof (CHAR16)); - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n"= , DiscoveredInstance->Information.Os, DiscoveredInstance->Information.OsVer= sion)); - } - - if (OsVer !=3D NULL) { - DiscoveredInstance->Information.OsVersion =3D (CHAR16 *)AllocatePool= (AsciiStrSize ((const CHAR8 *)OsVer) * sizeof (CHAR16)); - AsciiStrToUnicodeStrS ((const CHAR8 *)OsVer, DiscoveredInstance->Inf= ormation.OsVersion, AsciiStrSize ((const CHAR8 *)OsVer) * sizeof (CHAR16)); - } - - if ((Product !=3D NULL) && (ProductVer !=3D NULL)) { - DiscoveredInstance->Information.Product =3D (CHAR16 *)AllocatePool (= AsciiStrSize ((const CHAR8 *)Product) * sizeof (CHAR16)); - AsciiStrToUnicodeStrS ((const CHAR8 *)Product, DiscoveredInstance->I= nformation.Product, AsciiStrSize ((const CHAR8 *)Product) * sizeof (CHAR16)= ); - DiscoveredInstance->Information.ProductVer =3D (CHAR16 *)AllocatePoo= l (AsciiStrSize ((const CHAR8 *)ProductVer) * sizeof (CHAR16)); - AsciiStrToUnicodeStrS ((const CHAR8 *)ProductVer, DiscoveredInstance= ->Information.ProductVer, AsciiStrSize ((const CHAR8 *)ProductVer) * sizeof= (CHAR16)); - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%= s.\n", DiscoveredInstance->Information.Product, DiscoveredInstance->Informa= tion.ProductVer)); - } + InitInformationData ( + &DiscoveredInstance->Information, + RedfishVersion, + RedfishLocation, + Uuid, + Os, + OsVer, + Product, + ProductVer + ); =20 if (RedfishLocation =3D=3D NULL) { // This is the Redfish reported from SMBIOS 42h --=20 2.32.0 (Apple Git-132) -=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 (#112559): https://edk2.groups.io/g/devel/message/112559 Mute This Topic: https://groups.io/mt/103181045/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-