From nobody Mon Feb 9 19:06:51 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+112869+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+112869+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1703458783; cv=none; d=zohomail.com; s=zohoarc; b=JHQz3GpUKVFT+6ssllBU6aztn7UNlOlQsTPcB1Hq9Ro4pVM6MDsEzRLqe+2o86mN8y4SqR8/vyTcR3+5ehBZu8TSLmgBoZgbp3cKhCJI2ggFsMIUWMrc9Aasg1aE9h0X6xutneu5OlrcuvViurChKrYfhqE7Xchbsd2RvC9lk9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1703458783; 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=ciysS2L0F2x+IctLCVtwwDPFruAQI+pZaCOrrc/gXvw=; b=YjAU2UNB7+/1rsK6bhjgUkCIPQZYHaQajZT5C9a0N1FeRt+hynsh0bPF1s2AMKlTCpi+iPEamzP7WsW+nuWmz5AAlC+kKnLzOy1ORUGGAFRuwQXLGGks7x+ZPG5QtgStvrbUVqByf2rqvVASI+M5/3yGIUiscnrwNPFTSFg6/1w= 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+112869+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 1703458783270359.1047673033838; Sun, 24 Dec 2023 14:59:43 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=QW+xVaKlpZbO/zfQC3CvSuKmNULiINP8iB77VZwzouA=; 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=1703458782; v=1; b=HcrKl9jyNVpHVZRE31jwpBof5xJckkwYQtjVD/gzhCxCG0FJgB8GyA4lcvTPaqpvg2DovfF5 giaDr93QTzM054PuzU8rEfiwaCpwQ2qcSVMdSSepBelLaHnKnJ8Q8k3Lh2FQumv3fl1/JVzlffm t/5MI7wpGmqKYsAQojFffwcg= X-Received: by 127.0.0.2 with SMTP id Ua5qYY1788612xq27OMcUZed; Sun, 24 Dec 2023 14:59:42 -0800 X-Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) by mx.groups.io with SMTP id smtpd.web10.35945.1703458781315449108 for ; Sun, 24 Dec 2023 14:59:41 -0800 X-Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-50e7abe4be4so297859e87.2 for ; Sun, 24 Dec 2023 14:59:41 -0800 (PST) X-Gm-Message-State: m9ltR8CL3Pu7pH3de53Ns6fex1787277AA= X-Google-Smtp-Source: AGHT+IEhztO5M6jhwHo+kTT0+ySSLO8ydM9z/FfNsaD6a+OZHS5bP4TKyp57VTTcdbc0R4nVpK29JA== X-Received: by 2002:ac2:46ef:0:b0:50e:59a4:86b6 with SMTP id q15-20020ac246ef000000b0050e59a486b6mr1804701lfo.44.1703458779384; Sun, 24 Dec 2023 14:59:39 -0800 (PST) X-Received: from localhost.localdomain ([79.164.221.98]) by smtp.gmail.com with ESMTPSA id be44-20020a056512252c00b0050e78f5178asm326596lfb.262.2023.12.24.14.59.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 24 Dec 2023 14:59:39 -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 v3 10/16] RedfishDiscoverDxe: introduce InitInformationData helper function Date: Mon, 25 Dec 2023 01:59:21 +0300 Message-Id: <20231224225927.9119-11-mike.maslenkin@gmail.com> In-Reply-To: <20231224225927.9119-1-mike.maslenkin@gmail.com> References: <20231224225927.9119-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: 1703458784630100039 Content-Type: text/plain; charset="utf-8" Cc: Abner Chang Cc: Nickle Wang Cc: Igor Kulchytskyy Signed-off-by: Mike Maslenkin Reviewed-by: Abner Chang --- .../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..7aa68b54a61b 100644 --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c @@ -6,6 +6,7 @@ Copyright (c) 2022, AMD Incorporated. All rights reserved. Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
+ Copyright (c) 2023, Mike Maslenkin
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -711,6 +712,69 @@ DiscoverRedfishHostInterface ( return Status; } =20 +/** + The function initializes particular strings into the structure instance. + + @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 (#112869): https://edk2.groups.io/g/devel/message/112869 Mute This Topic: https://groups.io/mt/103354129/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-