From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [62.140.7.102]) by mx.groups.io with SMTP id smtpd.web11.12125.1594110910852676500 for ; Tue, 07 Jul 2020 01:35:11 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: suse.com, ip: 62.140.7.102, mailfrom: glin@suse.com) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2109.outbound.protection.outlook.com [104.47.17.109]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-26-yBvvNSAAP_Cb9FXJGneyZQ-1; Tue, 07 Jul 2020 10:35:06 +0200 X-MC-Unique: yBvvNSAAP_Cb9FXJGneyZQ-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Co/0F95z8Jsk9KX1t4wSTgNkO07+qk3kLEe4J+w6Mtdyiz8g05rfU7Q3OP7yVuAG7Z2wxxi+Qgc0we4R0za94Z9JNY3UGQ67n1Jlg2wzCVZEIlAHxLCW0MpBQV/tRwYuREvfnInEk001t9zOISaxaK1c6nJ0pxMauLZ7l4Zhs2u4b+M3MRUm7NEl7Unui+ce36F3IBqTKNbqwVmL29KuIcZLGkNgY0Yf96+4oKapf6Gc2SKnAEhhbYod8qftiUG4l5o4aSllXqLO9o4FRThnVy6ufUldZR6OSSqioOfHFRh2ZEifk3HxTP21IDjDIIgZ20QudpCgRlDtQftlW5uOHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u8/sVW+WMwLVDTVjiDfp5uPPYxS7gYsF7BrpW8f1SuI=; b=PxZmZWySNSiJU44Pg6OHaBsyzoLRNcSrcSOljOsjILWF8ExAC7NsvmLNQaxiQCJWOB9+I6k1a2gE8dPIJwAROjZWHW8DDOdXTe7qaINK0LSHiGFkE8klFQEKyvFVzTLkvaBZNJEuAlBq2CPhryqoHZxNKE3dbFeYBH1lIeAN1U6SDrdYYSERu9qFcqVaKeHuVEj/3tTWUGV/NRUIOlah+5UoNEyvjQ/G5NJi8NpFXFRBIsvR+gYSKsZ7/twa+5lCYtXEFrodwP58mWtGIPjyaFLXU5I99wzUJyPhrzZ8/qhvMOyy3YTeyOhpyu+9/n27rPsmCyrC2VawFpIdUwDaYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=suse.com; Received: from AM0PR0402MB3809.eurprd04.prod.outlook.com (2603:10a6:208:10::30) by AM0PR0402MB3651.eurprd04.prod.outlook.com (2603:10a6:208:5::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.29; Tue, 7 Jul 2020 08:35:05 +0000 Received: from AM0PR0402MB3809.eurprd04.prod.outlook.com ([fe80::8806:715f:1409:8c6b]) by AM0PR0402MB3809.eurprd04.prod.outlook.com ([fe80::8806:715f:1409:8c6b%7]) with mapi id 15.20.3153.029; Tue, 7 Jul 2020 08:35:05 +0000 Date: Tue, 7 Jul 2020 16:34:57 +0800 From: "Gary Lin" To: Laszlo Ersek Cc: devel@edk2.groups.io, Jordan Justen , Ard Biesheuvel Subject: Re: [PATCH 02/11] OvmfPkg/LsiScsiDxe: Install the skeleton of driver binding Message-ID: <20200707083457.GM18504@GaryWorkstation> References: <20200701040448.14871-1-glin@suse.com> <20200701040448.14871-3-glin@suse.com> <5ee404db-fba8-9a86-e844-26076941bf5a@redhat.com> In-Reply-To: <5ee404db-fba8-9a86-e844-26076941bf5a@redhat.com> X-ClientProxiedBy: AM0PR10CA0049.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:150::29) To AM0PR0402MB3809.eurprd04.prod.outlook.com (2603:10a6:208:10::30) Return-Path: glin@suse.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from GaryWorkstation (60.251.47.115) by AM0PR10CA0049.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:150::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21 via Frontend Transport; Tue, 7 Jul 2020 08:35:03 +0000 X-Originating-IP: [60.251.47.115] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b1b1b22-ea7a-410e-0eda-08d82250a5d8 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3651: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-Forefront-PRVS: 0457F11EAF X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DsjBqzgT877dY8gB2MnPQxYE/lzzzBs3T5Qu8Vb+8n0cWYrPDTekKph9S4rCL3WAk8KOPvAjXSemFJZHPigxJ1SxXCmVyKziKSMJStr/5bmeWn/9Hum+J0Z/ovn8kxizpt3mE/WHU1so0W2dvznq3IQzPcxYGUTwSgMfwqQVHwMuAWpTvmOfEJDiDC+4gme3NGSdgUc7hh0i3E7GlD2wt61cE8ExAdOixCio0hcARoa2J3wdnBgtTRU5GkyHIgQwlYpm2sxtSbPc94NYYOnqRJOr6tdvDNpmrE4PDcu7Z+r1BYVf4OaWWiC3+h5EKD7hQcAjTBriajQtshk/71xBVg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR0402MB3809.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(366004)(376002)(396003)(136003)(346002)(39860400002)(1076003)(6666004)(86362001)(8676002)(5660300002)(6496006)(6916009)(55236004)(33656002)(53546011)(52116002)(66556008)(66476007)(66946007)(186003)(16526019)(478600001)(8936002)(26005)(9686003)(83380400001)(4326008)(19627235002)(54906003)(55016002)(33716001)(316002)(956004)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: x8BpUz1IchoZOOIWWzFkPQwaNubkvRM1rGuSn2ISemD8ZrYixxzB5Sg9O1QQp+VbQvjn/RS5lT1YgPx028XvB/eW7xyQKlk7TAr7dAlOpVkL945zHAkX9vDF7PupSwepp5jZgh2ItlsDpmD2pB6r9uxZdqKn9lIQAewR8Firt59HzNp5+AcuNwNUwwTooHJuWeMNZ3ypVAIL6axWElw3Vkv/Y3lMDGlzV1xD/Wgmr/rYPETZuvZ0i3MA1/txRQ5ut/n0+/BM2ptJhEmR0ucoK4FU9i1Kar4PAo0/S9JWURMbjKACVnNXzqd1oXEyBgqKktDP7AumyxB3Z3UzVaCQ2nRPx/NIQMmN7bmkX7iibiUVrJO0h3dbSLOXifToAvuAQ1J8FQWGor4X5vL0eFd6V9e1bz0SOglohNl0EU6LHfeQffCx6o+He8mv8ufiLpnI071RaCodG/9gzAictqMSyhiqJTMjLtC0nCMMfGg0KhM= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b1b1b22-ea7a-410e-0eda-08d82250a5d8 X-MS-Exchange-CrossTenant-AuthSource: AM0PR0402MB3809.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2020 08:35:04.9592 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Pr+RJm4jvg0e7hya4amLFtruvWcLUVSTVwacUqrdnXdDOADmKKCRxSx1BlPiQ7+M X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3651 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jul 07, 2020 at 10:06:59AM +0200, Laszlo Ersek wrote: > 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.) Urh, some copy-paste error when refactoring the code. Thanks for catching it. Will fix it in v2. Gary Lin > > 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 > > >