On 07/01/20 06:04, Gary Lin wrote:
> Implement LsiScsiGetDriverName() and LsiScsiGetDeviceName()
> to report the name of the driver.
> 
> Cc: Jordan Justen <jordan.l.jus...@intel.com>
> Cc: Laszlo Ersek <ler...@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheu...@arm.com>
> Signed-off-by: Gary Lin <g...@suse.com>
> ---
>  OvmfPkg/LsiScsiDxe/LsiScsi.c | 69 ++++++++++++++++++++++++++++++++++--
>  OvmfPkg/LsiScsiDxe/LsiScsi.h | 31 ++++++++++++++++
>  2 files changed, 98 insertions(+), 2 deletions(-)
> 
> diff --git a/OvmfPkg/LsiScsiDxe/LsiScsi.c b/OvmfPkg/LsiScsiDxe/LsiScsi.c
> index 79a2af4fee73..62daa3ab99bf 100644
> --- a/OvmfPkg/LsiScsiDxe/LsiScsi.c
> +++ b/OvmfPkg/LsiScsiDxe/LsiScsi.c
> @@ -74,6 +74,71 @@ EFI_DRIVER_BINDING_PROTOCOL gDriverBinding = {
>  };
>  
>  
> +//
> +// The purpose of the following scaffolding (EFI_COMPONENT_NAME_PROTOCOL and
> +// EFI_COMPONENT_NAME2_PROTOCOL implementation) is to format the driver's 
> name
> +// in English, for display on standard console devices. This is recommended 
> for
> +// UEFI drivers that follow the UEFI Driver Model. Refer to the Driver 
> Writer's
> +// Guide for UEFI 2.3.1 v1.01, 11 UEFI Driver and Controller Names.
> +//
> +// Device type names ("LSI 53C895A SCSI Controller") are not formatted 
> because
> +// the driver supports only that device type. Therefore the driver name
> +// suffices for unambiguous identification.
> +//
> +
> +STATIC
> +EFI_UNICODE_STRING_TABLE mDriverNameTable[] = {
> +  { "eng;en", L"LSI 53C895A SCSI Controller Driver" },
> +  { NULL,     NULL                                  }
> +};
> +
> +STATIC
> +EFI_COMPONENT_NAME_PROTOCOL gComponentName;
> +
> +EFI_STATUS
> +EFIAPI
> +LsiScsiGetDriverName (
> +  IN  EFI_COMPONENT_NAME_PROTOCOL *This,
> +  IN  CHAR8                       *Language,
> +  OUT CHAR16                      **DriverName
> +  )
> +{
> +  return LookupUnicodeString2 (
> +           Language,
> +           This->SupportedLanguages,
> +           mDriverNameTable,
> +           DriverName,
> +           (BOOLEAN)(This == &gComponentName) // Iso639Language
> +           );
> +}
> +
> +EFI_STATUS
> +EFIAPI
> +LsiScsiGetDeviceName (
> +  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 gComponentName = {
> +  &LsiScsiGetDriverName,
> +  &LsiScsiGetDeviceName,
> +  "eng" // SupportedLanguages, ISO 639-2 language codes
> +};
> +
> +STATIC
> +EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 = {
> +  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)     &LsiScsiGetDriverName,
> +  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) &LsiScsiGetDeviceName,
> +  "en" // SupportedLanguages, RFC 4646 language codes
> +};
> +
>  //
>  // Entry point of this driver
>  //
> @@ -89,7 +154,7 @@ LsiScsiEntryPoint (
>             SystemTable,
>             &gDriverBinding,
>             ImageHandle, // The handle to install onto
> -           NULL, // TODO Component name
> -           NULL  // TODO Component name
> +           &gComponentName,
> +           &gComponentName2
>             );
>  }
> diff --git a/OvmfPkg/LsiScsiDxe/LsiScsi.h b/OvmfPkg/LsiScsiDxe/LsiScsi.h
> index 17738442fd5f..00db9ada12d2 100644
> --- a/OvmfPkg/LsiScsiDxe/LsiScsi.h
> +++ b/OvmfPkg/LsiScsiDxe/LsiScsi.h
> @@ -47,4 +47,35 @@ LsiScsiControllerStop (
>    IN EFI_HANDLE                  *ChildHandleBuffer
>    );
>  
> +
> +//
> +// The purpose of the following scaffolding (EFI_COMPONENT_NAME_PROTOCOL and
> +// EFI_COMPONENT_NAME2_PROTOCOL implementation) is to format the driver's 
> name
> +// in English, for display on standard console devices. This is recommended 
> for
> +// UEFI drivers that follow the UEFI Driver Model. Refer to the Driver 
> Writer's
> +// Guide for UEFI 2.3.1 v1.01, 11 UEFI Driver and Controller Names.
> +//
> +// Device type names ("LSI 53C895A SCSI Controller") are not formatted 
> because
> +// the driver supports only that device type. Therefore the driver name
> +// suffices for unambiguous identification.
> +//
> +
> +EFI_STATUS
> +EFIAPI
> +LsiScsiGetDriverName (
> +  IN  EFI_COMPONENT_NAME_PROTOCOL *This,
> +  IN  CHAR8                       *Language,
> +  OUT CHAR16                      **DriverName
> +  );
> +
> +EFI_STATUS
> +EFIAPI
> +LsiScsiGetDeviceName (
> +  IN  EFI_COMPONENT_NAME_PROTOCOL *This,
> +  IN  EFI_HANDLE                  DeviceHandle,
> +  IN  EFI_HANDLE                  ChildHandle,
> +  IN  CHAR8                       *Language,
> +  OUT CHAR16                      **ControllerName
> +  );
> +
>  #endif // _LSI_SCSI_DXE_H_
> 

Reviewed-by: Laszlo Ersek <ler...@redhat.com>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62121): https://edk2.groups.io/g/devel/message/62121
Mute This Topic: https://groups.io/mt/75228759/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to