From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6FA092194D3B8 for ; Fri, 1 Feb 2019 02:21:05 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 05DE9C058CB1; Fri, 1 Feb 2019 10:21:05 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-49.rdu2.redhat.com [10.10.120.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB65A61520; Fri, 1 Feb 2019 10:21:03 +0000 (UTC) To: Nikita Leshenko , edk2-devel@lists.01.org Cc: liran.alon@oracle.com References: <20190131100724.20907-1-nikita.leshchenko@oracle.com> <20190131100724.20907-3-nikita.leshchenko@oracle.com> From: Laszlo Ersek Message-ID: <5c4523c4-a2ec-c63b-af36-eb3c89002c95@redhat.com> Date: Fri, 1 Feb 2019 11:21:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190131100724.20907-3-nikita.leshchenko@oracle.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 01 Feb 2019 10:21:05 +0000 (UTC) Subject: Re: [PATCH 02/14] OvmfPkg/MptScsiDxe: Install DriverBinding Protocol X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 10:21:05 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 01/31/19 11:07, Nikita Leshenko wrote: > In order to probe and connect to the MptScsi device we need this > protocol. Currently it does nothing. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Nikita Leshenko > Reviewed-by: Konrad Rzeszutek Wilk > Reviewed-by: Aaron Young > Reviewed-by: Liran Alon > --- > OvmfPkg/MptScsiDxe/MptScsi.c | 65 ++++++++++++++++++++++++++++++- > OvmfPkg/MptScsiDxe/MptScsiDxe.inf | 1 + > 2 files changed, 65 insertions(+), 1 deletion(-) > > diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c > index 73a693741d..4dcb1b1ae5 100644 > --- a/OvmfPkg/MptScsiDxe/MptScsi.c > +++ b/OvmfPkg/MptScsiDxe/MptScsi.c > @@ -15,6 +15,62 @@ > > **/ > > +#include > + > +// > +// Driver Binding > +// > + > +STATIC > +EFI_STATUS > +EFIAPI > +MptScsiControllerSupported ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL > + ) > +{ > + return EFI_UNSUPPORTED; > +} > + > +STATIC > +EFI_STATUS > +EFIAPI > +MptScsiControllerStart ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL > + ) > +{ > + return EFI_UNSUPPORTED; > +} > + > +STATIC > +EFI_STATUS > +EFIAPI > +MptScsiControllerStop ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN UINTN NumberOfChildren, > + IN EFI_HANDLE *ChildHandleBuffer > + ) > +{ > + return EFI_UNSUPPORTED; > +} > + > +// Higher versions will be used before lower, 0x10-0xffffffef is the version > +// range for IVH (Indie Hardware Vendors) > +#define MPT_SCSI_BINDING_VERSION 0x10 If we'd like to use a macro + a comment for this, then: (1) I suggest moving them near the top of the file (just below the #include(s)) (2) The comment should be formatted as // // Higher versions... // ... // I.e., add an empty "//" comment line, both before and after. > +STATIC > +EFI_DRIVER_BINDING_PROTOCOL gMptScsiDriverBinding = { (3) Please replace the "g" prefix with "m". This object is not firmware-"g"lobal but specific to the "m"odule. (Yes, I agree we used it inconsistently in OvmfPkg in the past.) > + &MptScsiControllerSupported, > + &MptScsiControllerStart, > + &MptScsiControllerStop, > + MPT_SCSI_BINDING_VERSION, > + NULL, // ImageHandle filled by EfiLibInstallDriverBindingComponentName2 > + NULL, // DriverBindingHandle filled by EfiLibInstallDriverBindingComponentName2 (4) This line is too long (81 chars). Please make sure that no new line added in this series exceeds 80 characters in length. > +}; > + > // > // Entry Point > // > @@ -26,5 +82,12 @@ MptScsiEntryPoint ( > IN EFI_SYSTEM_TABLE *SystemTable > ) > { > - return EFI_UNSUPPORTED; > + return EfiLibInstallDriverBindingComponentName2 ( > + ImageHandle, > + SystemTable, > + &gMptScsiDriverBinding, > + ImageHandle, // The handle to install onto > + NULL, // TODO Component name > + NULL // TODO Component name > + ); (5) The indentation of the arguments is not idiomatic; it should be two spaces relative to the first letter ("E") in "EfiLibInstallDriverBindingComponentName2". > } > diff --git a/OvmfPkg/MptScsiDxe/MptScsiDxe.inf b/OvmfPkg/MptScsiDxe/MptScsiDxe.inf > index c558d78034..8a780a661e 100644 > --- a/OvmfPkg/MptScsiDxe/MptScsiDxe.inf > +++ b/OvmfPkg/MptScsiDxe/MptScsiDxe.inf > @@ -31,3 +31,4 @@ > > [LibraryClasses] > UefiDriverEntryPoint > + UefiLib > Thanks Laszlo