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 D7E1DAC1C44 for ; Thu, 14 Dec 2023 23:25:11 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=81x81UbWfyFfScs7yFY/fmhHy1aHu6alk5QsOsweZUM=; 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=1702596310; v=1; b=mtpk1swv/1rZLiSnHw+AUcklJQhBjKdGz2vR+7xaNG4/tZrICKs3H/P9O5qoAeu3UFmErD8Q LYTqsTDBidjofswTswXqCed/TcUJKa8te5Fk0YgYZozDZeIinVXlSnSUacKFaNdWZpGIFsIPUso UBM8v0GmaAZB17kWHUWiMmJ0= X-Received: by 127.0.0.2 with SMTP id uILoYY7687511xQWhvLo7gz2; Thu, 14 Dec 2023 15:25:10 -0800 X-Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) by mx.groups.io with SMTP id smtpd.web11.44953.1702596308168509694 for ; Thu, 14 Dec 2023 15:25:08 -0800 X-Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2ca1e6a94a4so762831fa.0 for ; Thu, 14 Dec 2023 15:25:07 -0800 (PST) X-Gm-Message-State: bmkHF4xyGiBAaYansA34uEQKx7686176AA= X-Google-Smtp-Source: AGHT+IHtkVDiOJIAKJWVIxg9OUiTxrrx+v9T/U4p93Eu7kunzat59Wa1qsW3/ZD/5VeMgMEg+jHdSA== X-Received: by 2002:a19:7005:0:b0:50b:f130:52f6 with SMTP id h5-20020a197005000000b0050bf13052f6mr4513778lfc.70.1702596306288; Thu, 14 Dec 2023 15:25:06 -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.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Dec 2023 15:25:06 -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 06/14] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver Date: Fri, 15 Dec 2023 02:24:50 +0300 Message-Id: <20231214232458.4636-7-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-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=mtpk1swv; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Currently there is no description for RedfishConfigHandler driver. This leads to in the "DRIVER NAME" column of a `drivers` command for example. Cc: Abner Chang Cc: Nickle Wang Cc: Igor Kulchytskyy Signed-off-by: Mike Maslenkin --- .../RedfishConfigHandler/ComponentName.c | 216 ++++++++++++++++++ .../RedfishConfigHandlerDriver.c | 10 +- .../RedfishConfigHandlerDriver.h | 4 +- .../RedfishConfigHandlerDriver.inf | 1 + 4 files changed, 228 insertions(+), 3 deletions(-) create mode 100644 RedfishPkg/RedfishConfigHandler/ComponentName.c diff --git a/RedfishPkg/RedfishConfigHandler/ComponentName.c b/RedfishPkg/R= edfishConfigHandler/ComponentName.c new file mode 100644 index 000000000000..c6b8b189f3e1 --- /dev/null +++ b/RedfishPkg/RedfishConfigHandler/ComponentName.c @@ -0,0 +1,218 @@ +/** @file=0D + Implementation of EFI_COMPONENT_NAME_PROTOCOL and EFI_COMPONENT_NAME2_PR= OTOCOL protocol=0D + for EFI Refish Config Handler Protocol=0D +=0D + Copyright (c) 2023, Mike Maslenkin =0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include "RedfishConfigHandlerCommon.h"=0D +=0D +//=0D +// EFI Component Name Functions=0D +//=0D +=0D +/**=0D + Retrieves a Unicode string that is the user-readable name of the EFI Dri= ver.=0D +=0D + @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL inst= ance.=0D + @param[in] Language A pointer to a three-character ISO 639-2 language= identifier.=0D + This is the language of the driver name that the = caller=0D + is requesting, and it must match one of the langu= ages specified=0D + in SupportedLanguages. The number of languages s= upported by a=0D + driver is up to the driver writer.=0D + @param[out] DriverName A pointer to the Unicode string to return. This = Unicode string=0D + is the name of the driver specified by This in th= e language=0D + specified by Language.=0D +=0D + @retval EFI_SUCCESS The Unicode string for the Driver specifie= d by This=0D + and the language specified by Language was= returned=0D + in DriverName.=0D + @retval EFI_INVALID_PARAMETER Language is NULL.=0D + @retval EFI_INVALID_PARAMETER DriverName is NULL.=0D + @retval EFI_UNSUPPORTED The driver specified by This does not supp= ort the=0D + language specified by Language.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +RedfishConfigHandlerComponentNameGetDriverName (=0D + IN EFI_COMPONENT_NAME_PROTOCOL *This,=0D + IN CHAR8 *Language,=0D + OUT CHAR16 **DriverName=0D + );=0D +=0D +/**=0D + Retrieves a Unicode string that is the user readable name of the control= ler=0D + that is being managed by an EFI Driver.=0D +=0D + @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCO= L instance.=0D + @param[in] ControllerHandle The handle of a controller that the driver = specified by=0D + This is managing. This handle specifies th= e controller=0D + whose name is to be returned.=0D + @param[in] ChildHandle The handle of the child controller to retri= eve the name=0D + of. This is an optional parameter that may= be NULL. It=0D + will be NULL for device drivers. It will a= lso be NULL=0D + for a bus drivers that wish to retrieve the= name of the=0D + bus controller. It will not be NULL for a = bus driver=0D + that wishes to retrieve the name of a child= controller.=0D + @param[in] Language A pointer to a three character ISO 639-2 la= nguage=0D + identifier. This is the language of the co= ntroller name=0D + that the caller is requesting, and it must = match one=0D + of the languages specified in SupportedLang= uages. The=0D + number of languages supported by a driver i= s up to the=0D + driver writer.=0D + @param[out] ControllerName A pointer to the Unicode string to return. = This Unicode=0D + string is the name of the controller specif= ied by=0D + ControllerHandle and ChildHandle in the lan= guage specified=0D + by Language, from the point of view of the = driver specified=0D + by This.=0D +=0D + @retval EFI_SUCCESS The Unicode string for the user-readable n= ame in the=0D + language specified by Language for the dri= ver=0D + specified by This was returned in DriverNa= me.=0D + @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.=0D + @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a va= lid EFI_HANDLE.=0D + @retval EFI_INVALID_PARAMETER Language is NULL.=0D + @retval EFI_INVALID_PARAMETER ControllerName is NULL.=0D + @retval EFI_UNSUPPORTED The driver specified by This is not curren= tly managing=0D + the controller specified by ControllerHand= le and=0D + ChildHandle.=0D + @retval EFI_UNSUPPORTED The driver specified by This does not supp= ort the=0D + language specified by Language.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +RedfishConfigHandlerComponentNameGetControllerName (=0D + IN EFI_COMPONENT_NAME_PROTOCOL *This,=0D + IN EFI_HANDLE ControllerHandle,=0D + IN EFI_HANDLE ChildHandle OPTIONAL,=0D + IN CHAR8 *Language,=0D + OUT CHAR16 **ControllerName=0D + );=0D +=0D +///=0D +/// Component Name Protocol instance=0D +///=0D +GLOBAL_REMOVE_IF_UNREFERENCED=0D +EFI_COMPONENT_NAME_PROTOCOL gRedfishConfigHandlerComponentName =3D {=0D + RedfishConfigHandlerComponentNameGetDriverName,=0D + RedfishConfigHandlerComponentNameGetControllerName,=0D + "eng"=0D +};=0D +=0D +///=0D +/// Component Name 2 Protocol instance=0D +///=0D +GLOBAL_REMOVE_IF_UNREFERENCED=0D +EFI_COMPONENT_NAME2_PROTOCOL gRedfishConfigHandlerComponentName2 =3D {=0D + (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)RedfishConfigHandlerComponentNameGe= tDriverName,=0D + (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)RedfishConfigHandlerComponentNa= meGetControllerName,=0D + "en"=0D +};=0D +=0D +///=0D +/// Table of driver names=0D +///=0D +GLOBAL_REMOVE_IF_UNREFERENCED=0D +EFI_UNICODE_STRING_TABLE mRedfishConfigHandlerDriverNameTable[] =3D {=0D + { "eng;en", (CHAR16 *)L"Redfish Configuration UEFI Driver" },=0D + { NULL, NULL }=0D +};=0D +=0D +GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gRedfishConfigHan= dlerControllerNameTable =3D NULL;=0D +=0D +/**=0D + Retrieves a Unicode string that is the user-readable name of the EFI Dri= ver.=0D +=0D + @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL ins= tance.=0D + @param[in] Language A pointer to a three-character ISO 639-2 languag= e identifier.=0D + This is the language of the driver name that the= caller=0D + is requesting, and it must match one of the lang= uages specified=0D + in SupportedLanguages. The number of languages = supported by a=0D + driver is up to the driver writer.=0D + @param[out] DriverName A pointer to the Unicode string to return. This= Unicode string=0D + is the name of the driver specified by This in t= he language=0D + specified by Language.=0D +=0D + @retval EFI_SUCCESS The Unicode string for the Driver specifie= d by This=0D + and the language specified by Language was= returned=0D + in DriverName.=0D + @retval EFI_INVALID_PARAMETER Language is NULL.=0D + @retval EFI_INVALID_PARAMETER DriverName is NULL.=0D + @retval EFI_UNSUPPORTED The driver specified by This does not supp= ort the=0D + language specified by Language.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +RedfishConfigHandlerComponentNameGetDriverName (=0D + IN EFI_COMPONENT_NAME_PROTOCOL *This,=0D + IN CHAR8 *Language,=0D + OUT CHAR16 **DriverName=0D + )=0D +{=0D + return LookupUnicodeString2 (=0D + Language,=0D + This->SupportedLanguages,=0D + mRedfishConfigHandlerDriverNameTable,=0D + DriverName,=0D + (BOOLEAN)(This =3D=3D &gRedfishConfigHandlerComponentName)=0D + );=0D +}=0D +=0D +/**=0D + Retrieves a Unicode string that is the user readable name of the control= ler=0D + that is being managed by an EFI Driver.=0D +=0D + @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCO= L instance.=0D + @param[in] ControllerHandle The handle of a controller that the driver = specified by=0D + This is managing. This handle specifies th= e controller=0D + whose name is to be returned.=0D + @param[in] ChildHandle The handle of the child controller to retri= eve the name=0D + of. This is an optional parameter that may= be NULL. It=0D + will be NULL for device drivers. It will a= lso be NULL=0D + for a bus drivers that wish to retrieve the= name of the=0D + bus controller. It will not be NULL for a = bus driver=0D + that wishes to retrieve the name of a child= controller.=0D + @param[in] Language A pointer to a three character ISO 639-2 la= nguage=0D + identifier. This is the language of the co= ntroller name=0D + that the caller is requesting, and it must = match one=0D + of the languages specified in SupportedLang= uages. The=0D + number of languages supported by a driver i= s up to the=0D + driver writer.=0D + @param[out] ControllerName A pointer to the Unicode string to return. = This Unicode=0D + string is the name of the controller specif= ied by=0D + ControllerHandle and ChildHandle in the lan= guage specified=0D + by Language, from the point of view of the = driver specified=0D + by This.=0D +=0D + @retval EFI_SUCCESS The Unicode string for the user-readable n= ame in the=0D + language specified by Language for the dri= ver=0D + specified by This was returned in DriverNa= me.=0D + @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.=0D + @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a va= lid EFI_HANDLE.=0D + @retval EFI_INVALID_PARAMETER Language is NULL.=0D + @retval EFI_INVALID_PARAMETER ControllerName is NULL.=0D + @retval EFI_UNSUPPORTED The driver specified by This is not curren= tly managing=0D + the controller specified by ControllerHand= le and=0D + ChildHandle.=0D + @retval EFI_UNSUPPORTED The driver specified by This does not supp= ort the=0D + language specified by Language.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +RedfishConfigHandlerComponentNameGetControllerName (=0D + IN EFI_COMPONENT_NAME_PROTOCOL *This,=0D + IN EFI_HANDLE ControllerHandle,=0D + IN EFI_HANDLE ChildHandle OPTIONAL,=0D + IN CHAR8 *Language,=0D + OUT CHAR16 **ControllerName=0D + )=0D +{=0D + return EFI_UNSUPPORTED;=0D +}=0D diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c b= /RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c index 2d0170d88614..5e03132695d6 100644 --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c @@ -601,11 +601,17 @@ RedfishConfigHandlerDriverEntryPoint ( //=0D // Install UEFI Driver Model protocol(s).=0D //=0D - Status =3D EfiLibInstallDriverBinding (=0D + Status =3D EfiLibInstallAllDriverProtocols2 (=0D ImageHandle,=0D SystemTable,=0D &gRedfishConfigDriverBinding,=0D - ImageHandle=0D + ImageHandle,=0D + &gRedfishConfigHandlerComponentName,=0D + &gRedfishConfigHandlerComponentName2,=0D + NULL,=0D + NULL,=0D + NULL,=0D + NULL=0D );=0D if (EFI_ERROR (Status)) {=0D gBS->CloseEvent (gEndOfDxeEvent);=0D diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h b= /RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h index 07214875bd5a..51701c05c697 100644 --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h @@ -24,7 +24,9 @@ //=0D // Protocol instances=0D //=0D -extern EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding;=0D +extern EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding;=0D +extern EFI_COMPONENT_NAME_PROTOCOL gRedfishConfigHandlerComponentName;=0D +extern EFI_COMPONENT_NAME2_PROTOCOL gRedfishConfigHandlerComponentName2;= =0D =0D extern REDFISH_CONFIG_DRIVER_DATA gRedfishConfigData;=0D extern EDKII_REDFISH_CREDENTIAL_PROTOCOL *gCredential;=0D diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf= b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf index aed93f570cf9..40ce0561379f 100644 --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf @@ -30,6 +30,7 @@ RedfishPkg/RedfishPkg.dec=0D =0D [Sources]=0D + ComponentName.c=0D RedfishConfigHandlerDriver.h=0D RedfishConfigHandlerDriver.c=0D RedfishConfigHandlerCommon.h=0D --=20 2.32.0 (Apple Git-132) -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112555): https://edk2.groups.io/g/devel/message/112555 Mute This Topic: https://groups.io/mt/103181041/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-