public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Nikita Leshenko <nikita.leshchenko@oracle.com>, edk2-devel@lists.01.org
Cc: liran.alon@oracle.com
Subject: Re: [PATCH 02/14] OvmfPkg/MptScsiDxe: Install DriverBinding Protocol
Date: Fri, 1 Feb 2019 11:21:02 +0100	[thread overview]
Message-ID: <5c4523c4-a2ec-c63b-af36-eb3c89002c95@redhat.com> (raw)
In-Reply-To: <20190131100724.20907-3-nikita.leshchenko@oracle.com>

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 <nikita.leshchenko@oracle.com>
> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Reviewed-by: Aaron Young <aaron.young@oracle.com>
> Reviewed-by: Liran Alon <liran.alon@oracle.com>
> ---
>  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 <Library/UefiLib.h>
> +
> +//
> +// 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


  reply	other threads:[~2019-02-01 10:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-31 10:07 OvmfPkg: Support booting from Fusion-MPT SCSI controllers Nikita Leshenko
2019-01-31 10:07 ` [PATCH 01/14] OvmfPkg/MptScsiDxe: Create empty driver Nikita Leshenko
2019-02-01  2:16   ` Bi, Dandan
2019-02-01 10:07     ` Laszlo Ersek
2019-02-01  9:57   ` Laszlo Ersek
2019-01-31 10:07 ` [PATCH 02/14] OvmfPkg/MptScsiDxe: Install DriverBinding Protocol Nikita Leshenko
2019-02-01 10:21   ` Laszlo Ersek [this message]
2019-01-31 10:07 ` [PATCH 03/14] OvmfPkg/MptScsiDxe: Report name of driver Nikita Leshenko
2019-02-01 10:25   ` Laszlo Ersek
2019-02-01 15:13     ` Carsey, Jaben
2019-01-31 10:07 ` [PATCH 04/14] OvmfPkg/MptScsiDxe: Probe PCI devices and look for MptScsi Nikita Leshenko
2019-02-01 11:48   ` Laszlo Ersek
2019-01-31 10:07 ` [PATCH 05/14] OvmfPkg/MptScsiDxe: Install stubbed EXT_SCSI_PASS_THRU Nikita Leshenko
2019-01-31 10:07 ` [PATCH 06/14] OvmfPkg/MptScsiDxe: Report one Target and one LUN Nikita Leshenko
2019-01-31 10:07 ` [PATCH 07/14] OvmfPkg/MptScsiDxe: Build DevicePath for discovered devices Nikita Leshenko
2019-01-31 10:07 ` [PATCH 08/14] OvmfPkg/MptScsiDxe: Implement GetTargetLun Nikita Leshenko
2019-01-31 10:07 ` [PATCH 09/14] OvmfPkg/MptScsiDxe: Open PciIo protocol for later use Nikita Leshenko
2019-01-31 10:07 ` [PATCH 10/14] OvmfPkg/MptScsiDxe: Set and restore PCI attributes Nikita Leshenko
2019-01-31 10:07 ` [PATCH 11/14] OvmfPkg/MptScsiDxe: Initialize hardware Nikita Leshenko
2019-02-01 12:14   ` Laszlo Ersek
2019-01-31 10:07 ` [PATCH 12/14] OvmfPkg/MptScsiDxe: Implement the PassThru method Nikita Leshenko
2019-02-01 12:55   ` Laszlo Ersek
2019-01-31 10:07 ` [PATCH 13/14] OvmfPkg/MptScsiDxe: Report multiple targets Nikita Leshenko
2019-01-31 10:07 ` [PATCH 14/14] OvmfPkg/MptScsiDxe: Support packets with pointers above 4G Nikita Leshenko
2019-02-01  9:48 ` OvmfPkg: Support booting from Fusion-MPT SCSI controllers Laszlo Ersek
2019-02-01 10:43 ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c4523c4-a2ec-c63b-af36-eb3c89002c95@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox