From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web10.11995.1594109225887936617 for ; Tue, 07 Jul 2020 01:07:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ifdvOcxR; spf=pass (domain: redhat.com, ip: 205.139.110.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594109225; 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=ir7yUgMoSIvMdJ73luAeZBPX1nDSK8EU1e9WdXkk73g=; b=ifdvOcxRAMY5uUPU8HBRekrgIXbFeg4Nbav8L9jWflGNfjCBgTDSu9TD+zbW/I11rQsOR2 wiE3yNXX4Zljw2g39S2LUOscjCvZvJ5KvY4XW+DoZ9wmTO+hPEZD5HvIsqqOVZNNHwIm8f Tfxe4F6NfUNl2JWtkiGbCmAusV73aSg= 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-140-D3OPxZoOPoOHAkx34I1ftQ-1; Tue, 07 Jul 2020 04:07:03 -0400 X-MC-Unique: D3OPxZoOPoOHAkx34I1ftQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D50B118FF660; Tue, 7 Jul 2020 08:07:01 +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 B8F085D9F3; Tue, 7 Jul 2020 08:07:00 +0000 (UTC) Subject: Re: [PATCH 02/11] OvmfPkg/LsiScsiDxe: Install the skeleton of driver binding To: Gary Lin , devel@edk2.groups.io Cc: Jordan Justen , Ard Biesheuvel References: <20200701040448.14871-1-glin@suse.com> <20200701040448.14871-3-glin@suse.com> From: "Laszlo Ersek" Message-ID: <5ee404db-fba8-9a86-e844-26076941bf5a@redhat.com> Date: Tue, 7 Jul 2020 10:06:59 +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-3-glin@suse.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 the dummy functions for EFI Driver Binding protocol. > > Cc: Jordan Justen > Cc: Laszlo Ersek > Cc: Ard Biesheuvel > Signed-off-by: Gary Lin > --- > OvmfPkg/LsiScsiDxe/LsiScsi.c | 72 ++++++++++++++++++++++++++++++- > OvmfPkg/LsiScsiDxe/LsiScsi.h | 50 +++++++++++++++++++++ > OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf | 2 + > 3 files changed, 123 insertions(+), 1 deletion(-) > create mode 100644 OvmfPkg/LsiScsiDxe/LsiScsi.h > > diff --git a/OvmfPkg/LsiScsiDxe/LsiScsi.c b/OvmfPkg/LsiScsiDxe/LsiScsi.c > index 9c90941688ed..79a2af4fee73 100644 > --- a/OvmfPkg/LsiScsiDxe/LsiScsi.c > +++ b/OvmfPkg/LsiScsiDxe/LsiScsi.c > @@ -9,8 +9,71 @@ > > **/ > > +#include > #include > > +#include "LsiScsi.h" > + > +// > +// Probe, start and stop functions of this driver, called by the DXE core for > +// specific devices. > +// > +// The following specifications document these interfaces: > +// - Driver Writer's Guide for UEFI 2.3.1 v1.01, 9 Driver Binding Protocol > +// - UEFI Spec 2.3.1 + Errata C, 10.1 EFI Driver Binding Protocol > +// > + > +EFI_STATUS > +EFIAPI > +LsiScsiControllerSupported ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL > + ) > +{ > + return EFI_UNSUPPORTED; > +} > + > +EFI_STATUS > +EFIAPI > +LsiScsiControllerStart ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL > + ) > +{ > + return EFI_SUCCESS; > +} > + > +EFI_STATUS > +EFIAPI > +LsiScsiControllerStop ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN UINTN NumberOfChildren, > + IN EFI_HANDLE *ChildHandleBuffer > + ) > +{ > + return EFI_SUCCESS; > +} > + > +// > +// The static object that groups the Supported() (ie. probe), Start() and > +// Stop() functions of the driver together. Refer to UEFI Spec 2.3.1 + Errata > +// C, 10.1 EFI Driver Binding Protocol. > +// > +STATIC > +EFI_DRIVER_BINDING_PROTOCOL gDriverBinding = { > + &LsiScsiControllerSupported, > + &LsiScsiControllerStart, > + &LsiScsiControllerStop, > + 0x10, // Version, must be in [0x10 .. 0xFFFFFFEF] for IHV-developed drivers > + NULL, // ImageHandle, to be overwritten by > + // EfiLibInstallDriverBindingComponentName2() in LsiScsiEntryPoint() > + NULL // DriverBindingHandle, ditto > +}; > + > + > // > // Entry point of this driver > // > @@ -21,5 +84,12 @@ LsiScsiEntryPoint ( > IN EFI_SYSTEM_TABLE *SystemTable > ) > { > - return EFI_UNSUPPORTED; > + return EfiLibInstallDriverBindingComponentName2 ( > + ImageHandle, > + SystemTable, > + &gDriverBinding, > + ImageHandle, // The handle to install onto > + NULL, // TODO Component name > + NULL // TODO Component name > + ); > } > diff --git a/OvmfPkg/LsiScsiDxe/LsiScsi.h b/OvmfPkg/LsiScsiDxe/LsiScsi.h > new file mode 100644 > index 000000000000..17738442fd5f > --- /dev/null > +++ b/OvmfPkg/LsiScsiDxe/LsiScsi.h > @@ -0,0 +1,50 @@ > +/** @file > + > + Internal definitions for the LSI 53C895A SCSI driver, which produces > + Extended SCSI Pass Thru Protocol instances for LSI 53C895A SCSI devices. > + > + Copyright (C) 2020, SUSE LLC. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef _LSI_SCSI_DXE_H_ > +#define _LSI_SCSI_DXE_H_ > + > +// > +// Probe, start and stop functions of this driver, called by the DXE core for > +// specific devices. > +// > +// The following specifications document these interfaces: > +// - Driver Writer's Guide for UEFI 2.3.1 v1.01, 9 Driver Binding Protocol > +// - UEFI Spec 2.3.1 + Errata C, 10.1 EFI Driver Binding Protocol > +// > + > +STATIC > +EFI_STATUS > +EFIAPI > +LsiScsiControllerSupported ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL > + ); (1) Please drop "STATIC", to be consistent with the definition of LsiScsiControllerSupported(), in the .c file. (I think the patch is not invalid C as-is, but it's confusing for the reader.) With that fixed Reviewed-by: Laszlo Ersek Thanks Laszlo > + > +EFI_STATUS > +EFIAPI > +LsiScsiControllerStart ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL > + ); > + > +EFI_STATUS > +EFIAPI > +LsiScsiControllerStop ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN UINTN NumberOfChildren, > + IN EFI_HANDLE *ChildHandleBuffer > + ); > + > +#endif // _LSI_SCSI_DXE_H_ > diff --git a/OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf b/OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf > index 55b483c2fa20..444ceb78e9ca 100644 > --- a/OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf > +++ b/OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf > @@ -18,9 +18,11 @@ [Defines] > > [Sources] > LsiScsi.c > + LsiScsi.h > > [Packages] > MdePkg/MdePkg.dec > > [LibraryClasses] > UefiDriverEntryPoint > + UefiLib >