From be7fcaa1c9e952aaacdcbe806933ce70a391aa78 Mon Sep 17 00:00:00 2001 From: Nikita Leshenko Date: Tue, 5 May 2020 00:05:58 +0300 Subject: 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 Reviewed-by: Laszlo Ersek Reviewed-by: Jaben Carsey Reviewed-by: Liran Alon Message-Id: <20200504210607.144434-4-nikita.leshchenko@oracle.com> --- OvmfPkg/MptScsiDxe/MptScsi.c | 61 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) (limited to 'OvmfPkg/MptScsiDxe') diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c index 581d3909b8..64949a8090 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 ); } -- cgit v1.2.3