From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web10.12028.1594109361827016096 for ; Tue, 07 Jul 2020 01:09:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f0dbnXyP; spf=pass (domain: redhat.com, ip: 207.211.31.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594109361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ULAta2J8RBkesPxETQRcazhDRECv7RAch8g2TV1+Lq8=; b=f0dbnXyPNCBzGdPPbYsrrC0vnE6bjiU1VmytD9xERTArwlBSGoFRymZlFcu0ONsElbV0Yf wfrxJ6kXFMAQNvhZK80vZVDNdwelgVyO3psbf2IZV/e67ng1FetXp9lb5nipSVrqUM2j2i js5eFEnyBgK56SNsxlcflMGgFHotuj4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-173-F2b-T57bOOORHu8XV_p8mA-1; Tue, 07 Jul 2020 04:09:19 -0400 X-MC-Unique: F2b-T57bOOORHu8XV_p8mA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 01D2F18A0760; Tue, 7 Jul 2020 08:09:18 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-114-90.ams2.redhat.com [10.36.114.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id D91CC1A7CA; Tue, 7 Jul 2020 08:09:16 +0000 (UTC) Subject: Re: [PATCH 03/11] OvmfPkg/LsiScsiDxe: Report the name of the driver To: Gary Lin , devel@edk2.groups.io Cc: Jordan Justen , Ard Biesheuvel References: <20200701040448.14871-1-glin@suse.com> <20200701040448.14871-4-glin@suse.com> From: "Laszlo Ersek" Message-ID: <78a58776-938f-f6cd-ba6b-c2237afde9bb@redhat.com> Date: Tue, 7 Jul 2020 10:09:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200701040448.14871-4-glin@suse.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 07/01/20 06:04, Gary Lin wrote: > Implement LsiScsiGetDriverName() and LsiScsiGetDeviceName() > to report the name of the driver. > > Cc: Jordan Justen > Cc: Laszlo Ersek > Cc: Ard Biesheuvel > Signed-off-by: Gary Lin > --- > 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