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 3D31D7803DB for ; Tue, 12 Dec 2023 14:54:35 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=fweJA7fkuXra3DXDPl1J+a5VE4nMmYx4ApFWbMkslQc=; 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=1702392873; v=1; b=wzRWY/189nag/gb7+cUXIuDk8WM/HR6u6v45GXCfYNi7pgIpPRHqVxVLdEFPpnW7GvzQw+ur bcApiSwa+81HjOvsgVpxs4W95zCnRftTEEt8fo2o+3Hk89orso0myx9cqxurCvO6nbWlVbVDmqM SsmifFZjbpVfciBdAZ+c5Kw4= X-Received: by 127.0.0.2 with SMTP id ZFPPYY7687511xzltEGl2GXf; Tue, 12 Dec 2023 06:54:33 -0800 X-Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by mx.groups.io with SMTP id smtpd.web11.3458.1702392871990856660 for ; Tue, 12 Dec 2023 06:54:32 -0800 X-Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-50c05ea5805so6834201e87.0 for ; Tue, 12 Dec 2023 06:54:31 -0800 (PST) X-Gm-Message-State: Bclp2Y9nHjyXEsTnKSGFeom0x7686176AA= X-Google-Smtp-Source: AGHT+IGsw0rmsk9JNsNTj43KQwfUcq9UteT+ZVw+hAciTW2rCoW5XHukf9xFNK0Y6PCUCMyjWs61Iw== X-Received: by 2002:ac2:46f7:0:b0:50b:fd8c:ac4f with SMTP id q23-20020ac246f7000000b0050bfd8cac4fmr2650379lfo.32.1702392870127; Tue, 12 Dec 2023 06:54:30 -0800 (PST) X-Received: from localhost.localdomain ([79.164.221.98]) by smtp.gmail.com with ESMTPSA id m21-20020a0565120a9500b0050d1d8674d2sm952008lfu.292.2023.12.12.06.54.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Dec 2023 06:54:29 -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 6/9] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver Date: Tue, 12 Dec 2023 17:54:09 +0300 Message-Id: <20231212145412.50434-7-mike.maslenkin@gmail.com> In-Reply-To: <20231212145412.50434-1-mike.maslenkin@gmail.com> References: <20231212145412.50434-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="wzRWY/18"; 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..e85d42ebdccd --- /dev/null +++ b/RedfishPkg/RedfishConfigHandler/ComponentName.c @@ -0,0 +1,216 @@ +/** @file=0D + Implementation of EFI_COMPONENT_NAME_PROTOCOL and EFI_COMPONENT_NAME2_PR= OTOCOL protocol=0D + for EFI Refish Config Handler Protocol=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 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 tha= t 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 (#112442): https://edk2.groups.io/g/devel/message/112442 Mute This Topic: https://groups.io/mt/103130784/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-