From 419b30d642264bef34f9054a4adf64bf4f9e31aa Mon Sep 17 00:00:00 2001 From: Liran Alon Date: Sat, 28 Mar 2020 23:00:46 +0300 Subject: OvmfPkg/PvScsiDxe: 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=2567 Reviewed-by: Laszlo Ersek Signed-off-by: Liran Alon Message-Id: <20200328200100.60786-4-liran.alon@oracle.com> Reviewed-by: Nikita Leshenko --- OvmfPkg/PvScsiDxe/PvScsi.c | 59 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/PvScsiDxe/PvScsi.c b/OvmfPkg/PvScsiDxe/PvScsi.c index 77b28b3267..51b03f7090 100644 --- a/OvmfPkg/PvScsiDxe/PvScsi.c +++ b/OvmfPkg/PvScsiDxe/PvScsi.c @@ -68,6 +68,61 @@ STATIC EFI_DRIVER_BINDING_PROTOCOL mPvScsiDriverBinding = { NULL // DriverBindingHandle, filled as well }; +// +// Component Name +// + +STATIC EFI_UNICODE_STRING_TABLE mDriverNameTable[] = { + { "eng;en", L"PVSCSI Host Driver" }, + { NULL, NULL } +}; + +STATIC EFI_COMPONENT_NAME_PROTOCOL mComponentName; + +STATIC +EFI_STATUS +EFIAPI +PvScsiGetDriverName ( + IN EFI_COMPONENT_NAME_PROTOCOL *This, + IN CHAR8 *Language, + OUT CHAR16 **DriverName + ) +{ + return LookupUnicodeString2 ( + Language, + This->SupportedLanguages, + mDriverNameTable, + DriverName, + (BOOLEAN)(This == &mComponentName) // Iso639Language + ); +} + +STATIC +EFI_STATUS +EFIAPI +PvScsiGetDeviceName ( + 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 = { + &PvScsiGetDriverName, + &PvScsiGetDeviceName, + "eng" // SupportedLanguages, ISO 639-2 language codes +}; + +STATIC EFI_COMPONENT_NAME2_PROTOCOL mComponentName2 = { + (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) &PvScsiGetDriverName, + (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) &PvScsiGetDeviceName, + "en" // SupportedLanguages, RFC 4646 language codes +}; + // // Entry Point // @@ -84,7 +139,7 @@ PvScsiEntryPoint ( SystemTable, &mPvScsiDriverBinding, ImageHandle, - NULL, // TODO Component name - NULL // TODO Component name + &mComponentName, + &mComponentName2 ); } -- cgit v1.2.3