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 EAEEE740038 for ; Sun, 24 Dec 2023 22:59:40 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Oil29iIilUvU6FpaBEGlbChrfpFfTpMBNUoT/wULxKA=; 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=1703458779; v=1; b=JR/vv9zl3kM7iwqGNonnGrbTAfxAIjB7ASQlnjr8DDBvW1esuc8tw5YqYEuW/87TevVu2KTo YVNoVCQG7RJ+Y1ibH6TfhGxD9F3uw+IGbA0Lz8JgGB/o9h1JJOyooc0gMjagYB0O2pCkWNyrUZN h6WEO3NQyqcqQy85XmZ9GIAU= X-Received: by 127.0.0.2 with SMTP id 32iPYY7687511x5dj114XJYy; Sun, 24 Dec 2023 14:59:39 -0800 X-Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by mx.groups.io with SMTP id smtpd.web11.35798.1703458777958794266 for ; Sun, 24 Dec 2023 14:59:38 -0800 X-Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-50e6ee8e911so1365336e87.1 for ; Sun, 24 Dec 2023 14:59:37 -0800 (PST) X-Gm-Message-State: N0vkwXUsvAUkEO02waNq0JAyx7686176AA= X-Google-Smtp-Source: AGHT+IF9tev4aZm5PinMdEn4ZPklFc4puLf+DRo9NGJiSUC2YUeJf63sf3nEfHqSuC9bmVXkWUnZaw== X-Received: by 2002:a05:6512:2827:b0:50e:7569:de13 with SMTP id cf39-20020a056512282700b0050e7569de13mr605848lfb.31.1703458775979; Sun, 24 Dec 2023 14:59:35 -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.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 24 Dec 2023 14:59:35 -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 06/16] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver Date: Mon, 25 Dec 2023 01:59:17 +0300 Message-Id: <20231224225927.9119-7-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-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="JR/vv9zl"; 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 | 218 ++++++++++++++++++ .../RedfishConfigHandlerDriver.c | 10 +- .../RedfishConfigHandlerDriver.h | 4 +- .../RedfishConfigHandlerDriver.inf | 1 + 4 files changed, 230 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..8e19fdb2cde5 --- /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 (#112865): https://edk2.groups.io/g/devel/message/112865 Mute This Topic: https://groups.io/mt/103354125/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-