Install Component Name protocols to have a nice display name for the
driver in places such as UEFI shell.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390
Signed-off-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Liran Alon <liran.alon@oracle.com>
---
OvmfPkg/MptScsiDxe/MptScsi.c | 61 ++++++++++++++++++++++++++++++++++--
1 file changed, 59 insertions(+), 2 deletions(-)
diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
index 581d3909b84d..64949a809022 100644
--- a/OvmfPkg/MptScsiDxe/MptScsi.c
+++ b/OvmfPkg/MptScsiDxe/MptScsi.c
@@ -69,6 +69,63 @@ EFI_DRIVER_BINDING_PROTOCOL mMptScsiDriverBinding = {
NULL, // DriverBindingHandle, filled as well
};
+//
+// Component Name
+//
+
+STATIC
+EFI_UNICODE_STRING_TABLE mDriverNameTable[] = {
+ { "eng;en", L"LSI Fusion MPT SCSI Driver" },
+ { NULL, NULL }
+};
+
+STATIC
+EFI_COMPONENT_NAME_PROTOCOL mComponentName;
+
+EFI_STATUS
+EFIAPI
+MptScsiGetDriverName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
+ )
+{
+ return LookupUnicodeString2 (
+ Language,
+ This->SupportedLanguages,
+ mDriverNameTable,
+ DriverName,
+ (BOOLEAN)(This == &mComponentName) // Iso639Language
+ );
+}
+
+EFI_STATUS
+EFIAPI
+MptScsiGetDeviceName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE DeviceHandle,
+ IN EFI_HANDLE ChildHandle,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+STATIC
+EFI_COMPONENT_NAME_PROTOCOL mComponentName = {
+ &MptScsiGetDriverName,
+ &MptScsiGetDeviceName,
+ "eng" // SupportedLanguages, ISO 639-2 language codes
+};
+
+STATIC
+EFI_COMPONENT_NAME2_PROTOCOL mComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) &MptScsiGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) &MptScsiGetDeviceName,
+ "en" // SupportedLanguages, RFC 4646 language codes
+};
+
//
// Entry Point
//
@@ -85,7 +142,7 @@ MptScsiEntryPoint (
SystemTable,
&mMptScsiDriverBinding,
ImageHandle, // The handle to install onto
- NULL, // TODO Component name
- NULL // TODO Component name
+ &mComponentName,
+ &mComponentName2
);
}
--
2.20.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#58081): https://edk2.groups.io/g/devel/message/58081
Mute This Topic: https://groups.io/mt/73247263/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
I don't remember reviewing this previously (not recently at least), maybe the RB should be CC?
One comment inline below.
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Nikita
> Leshenko
> Sent: Friday, April 24, 2020 10:59 AM
> To: devel@edk2.groups.io
> Cc: Nikita Leshenko <nikita.leshchenko@oracle.com>;
> liran.alon@oracle.com; aaron.young@oracle.com; Justen, Jordan L
> <jordan.l.justen@intel.com>; Laszlo Ersek <lersek@redhat.com>; Ard
> Biesheuvel <ard.biesheuvel@arm.com>; Carsey, Jaben
> <jaben.carsey@intel.com>
> Subject: [edk2-devel] [PATCH v5 03/12] OvmfPkg/MptScsiDxe: Report name
> of driver
>
> Install Component Name protocols to have a nice display name for the driver
> in places such as UEFI shell.
>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390
> Signed-off-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
> Reviewed-by: Liran Alon <liran.alon@oracle.com>
> ---
> OvmfPkg/MptScsiDxe/MptScsi.c | 61
> ++++++++++++++++++++++++++++++++++--
> 1 file changed, 59 insertions(+), 2 deletions(-)
>
> diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
> index 581d3909b84d..64949a809022 100644
> --- a/OvmfPkg/MptScsiDxe/MptScsi.c
> +++ b/OvmfPkg/MptScsiDxe/MptScsi.c
> @@ -69,6 +69,63 @@ EFI_DRIVER_BINDING_PROTOCOL
> mMptScsiDriverBinding = {
> NULL, // DriverBindingHandle, filled as well };
>
> +//
> +// Component Name
> +//
> +
> +STATIC
> +EFI_UNICODE_STRING_TABLE mDriverNameTable[] = {
> + { "eng;en", L"LSI Fusion MPT SCSI Driver" },
> + { NULL, NULL }
> +};
> +
> +STATIC
> +EFI_COMPONENT_NAME_PROTOCOL mComponentName;
> +
> +EFI_STATUS
> +EFIAPI
> +MptScsiGetDriverName (
> + IN EFI_COMPONENT_NAME_PROTOCOL *This,
> + IN CHAR8 *Language,
> + OUT CHAR16 **DriverName
> + )
> +{
> + return LookupUnicodeString2 (
> + Language,
> + This->SupportedLanguages,
> + mDriverNameTable,
> + DriverName,
> + (BOOLEAN)(This == &mComponentName) // Iso639Language
> + );
> +}
> +
> +EFI_STATUS
> +EFIAPI
> +MptScsiGetDeviceName (
> + IN EFI_COMPONENT_NAME_PROTOCOL *This,
> + IN EFI_HANDLE DeviceHandle,
> + IN EFI_HANDLE ChildHandle,
> + IN CHAR8 *Language,
> + OUT CHAR16 **ControllerName
> + )
> +{
> + return EFI_UNSUPPORTED;
> +}
> +
> +STATIC
> +EFI_COMPONENT_NAME_PROTOCOL mComponentName = {
> + &MptScsiGetDriverName,
> + &MptScsiGetDeviceName,
> + "eng" // SupportedLanguages, ISO 639-2 language codes };
> +
> +STATIC
> +EFI_COMPONENT_NAME2_PROTOCOL mComponentName2 = {
> + (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)
> &MptScsiGetDriverName,
> + (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)
> &MptScsiGetDeviceName,
> + "en" // SupportedLanguages, RFC 4646 language codes };
I think that the }; needs to be outside of the comment for both of these structures.
> +
> //
> // Entry Point
> //
> @@ -85,7 +142,7 @@ MptScsiEntryPoint (
> SystemTable,
> &mMptScsiDriverBinding,
> ImageHandle, // The handle to install onto
> - NULL, // TODO Component name
> - NULL // TODO Component name
> + &mComponentName,
> + &mComponentName2
> );
> }
> --
> 2.20.1
>
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#58094): https://edk2.groups.io/g/devel/message/58094
Mute This Topic: https://groups.io/mt/73247263/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
> On 24 Apr 2020, at 21:02, Carsey, Jaben <jaben.carsey@intel.com> wrote:
>
> I don't remember reviewing this previously (not recently at least), maybe the RB should be CC?
The version that you reviewed was submitted more than a year ago, indeed
a long time ago: https://edk2.groups.io/g/devel/message/36232
>
> One comment inline below.
>
>> -----Original Message-----
>> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Nikita
>> Leshenko
>> Sent: Friday, April 24, 2020 10:59 AM
>> To: devel@edk2.groups.io
>> Cc: Nikita Leshenko <nikita.leshchenko@oracle.com>;
>> liran.alon@oracle.com; aaron.young@oracle.com; Justen, Jordan L
>> <jordan.l.justen@intel.com>; Laszlo Ersek <lersek@redhat.com>; Ard
>> Biesheuvel <ard.biesheuvel@arm.com>; Carsey, Jaben
>> <jaben.carsey@intel.com>
>> Subject: [edk2-devel] [PATCH v5 03/12] OvmfPkg/MptScsiDxe: Report name
>> of driver
>>
>> [...]
>> +EFI_STATUS
>> +EFIAPI
>> +MptScsiGetDeviceName (
>> + IN EFI_COMPONENT_NAME_PROTOCOL *This,
>> + IN EFI_HANDLE DeviceHandle,
>> + IN EFI_HANDLE ChildHandle,
>> + IN CHAR8 *Language,
>> + OUT CHAR16 **ControllerName
>> + )
>> +{
>> + return EFI_UNSUPPORTED;
>> +}
>> +
>> +STATIC
>> +EFI_COMPONENT_NAME_PROTOCOL mComponentName = {
>> + &MptScsiGetDriverName,
>> + &MptScsiGetDeviceName,
>> + "eng" // SupportedLanguages, ISO 639-2 language codes };
>> +
>> +STATIC
>> +EFI_COMPONENT_NAME2_PROTOCOL mComponentName2 = {
>> + (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)
>> &MptScsiGetDriverName,
>> + (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)
>> &MptScsiGetDeviceName,
>> + "en" // SupportedLanguages, RFC 4646 language codes };
>
> I think that the }; needs to be outside of the comment for both of these structures.
I don't know why your copy of the mail doesn't have a newline, but that wasn't
my intention. (And my copy of the mail seems to have it, strange...)
The patch looks like intended on the mailing list archive and of Github:
Here is this patch on the mailing list archive:
https://www.mail-archive.com/devel@edk2.groups.io/msg18861.html
And here is this patch on Github:
https://github.com/nikital/edk2/commit/41855cc48125321fce3323473379edcf098c3c01
Thanks,
Nikita
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#58128): https://edk2.groups.io/g/devel/message/58128
Mute This Topic: https://groups.io/mt/73247263/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.