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 <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-4-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
This commit is contained in:
Liran Alon 2020-03-28 23:00:46 +03:00 committed by mergify[bot]
parent ed08c57113
commit 419b30d642
1 changed files with 57 additions and 2 deletions

View File

@ -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
);
}