From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-in5.apple.com (mail-out5.apple.com [17.151.62.27]) (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 6F55A21A16EFD for ; Wed, 17 May 2017 23:56:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=apple.com; s=mailout2048s; c=relaxed/simple; q=dns/txt; i=@apple.com; t=1495090565; h=From:Sender:Reply-To:Subject:Date:Message-id:To:Cc:MIME-version:Content-type: Content-transfer-encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-reply-to:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7hjBO8d2za5cNhzooGPtwlELQQ/eTFaWfvZsVRYFf3s=; b=NO2z0NwVxapkBoLoec2fXKHc2xuIThKe6rZw7k3CP6nKVuhAqPdxZU3bopcFAnUQ gHEZ5m1m157aRDpgKpEmV4aeCan4+xfkuVGoltiQfTmFmPUnndZQ0Yl19rvOepfC mVfqPNbWssM8QWziQP5ZeRiG/0elJ54JJ1+QqEBsUSTghVzaoZ1XrRpLum76CRQF azb1+oJNbepsJhbR+ZwGXgkzdvXWFg7sKgPvudhslEnxp74rFMPxveuX4jVpoTud skOOZv+NkmI3EW1CikusT0dATNcZp1JUuSfbnq1zn1crPk8XmvSSlFjQjfcZYHjR c09PZhvMKFuKMtEME6P+Yg==; Received: from relay7.apple.com (relay7.apple.com [17.128.113.101]) (using TLS with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail-in5.apple.com (Apple Secure Mail Relay) with SMTP id 2C.69.25795.2854D195; Wed, 17 May 2017 23:56:04 -0700 (PDT) X-AuditID: 11973e13-fcffb700000064c3-f0-591d458235cc Received: from nwk-mmpp-sz13.apple.com (nwk-mmpp-sz13.apple.com [17.128.115.216]) by relay7.apple.com (Apple SCV relay) with SMTP id 2B.C9.18088.2854D195; Wed, 17 May 2017 23:56:02 -0700 (PDT) MIME-version: 1.0 Received: from [17.153.32.91] by nwk-mmpp-sz13.apple.com (Oracle Communications Messaging Server 8.0.1.2.20170210 64bit (built Feb 10 2017)) with ESMTPSA id <0OQ4004PXZ9DVR30@nwk-mmpp-sz13.apple.com>; Wed, 17 May 2017 23:56:02 -0700 (PDT) Sender: afish@apple.com From: Andrew Fish In-reply-to: Date: Wed, 17 May 2017 23:56:01 -0700 Cc: Michael Zimmermann , Mike Kinney , edk2-devel-01 , "Dong, Eric" , "Zeng, Star" Message-id: <5412C2B8-7C27-403B-AA70-2096D8DAD466@apple.com> References: <98D24FD3-B4DD-4132-BFA3-7D3887CA250D@apple.com> <37A305D9-9DD3-4D55-9E72-33219ABD8046@apple.com> To: "peter.kirmeier@ts.fujitsu.com" X-Mailer: Apple Mail (2.3273) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRmVeSWpSXmKPExsUi2FCYqtviKhtpcPaRhcWeQ0eZLTa/CLbo 6PjHZPFzz1l2i7lTn7Ja7Ou1dmDz2DnrLrvH4j0vmTy6Z/9j8Zh/5Ap7AEsUl01Kak5mWWqR vl0CV8anH7dYCpZEVKz6spKpgbHNo4uRk0NCwETixc7VLF2MXBxCAmuYJE5O2sEOk5g39zAj ROIQo8ThO9sZQRK8AoISPybfA+rg4GAWkJc4eF4WJMwsoCXx/VEr1KAvjBKNfd9YQBLCAuIS 785sYoawdSSmLjwHtoBNQFlixfwPYDanQIDE2RdbwOpZBFQlWiZ/ZwUZxCxwiVFi1fVnYMt4 BWwkZu9zhViwh0Wi690SNpC4iICzxOQ3aRBHy0rcmn2JGaRGQuA6m0TX7ynMExiFZyG5exbC 3bOQ3L2AkXkVo1BuYmaObmaeqV5iQUFOql5yfu4mRlBMTLcT3sF4epXVIUYBDkYlHt4NQTKR QqyJZcWVuYcYpTlYlMR50zcDhQTSE0tSs1NTC1KL4otKc1KLDzEycXBKNTBWdux2ufPwHYPU KjG15iafmm36LRqeP+2zFpi0rz2YExrfFHHoytLFigqtGdd42T6e//KgMfdomd3cglW2GzPr 6y6dLexNeC8RMn3BZP7Fs7rrZe6FfbSQlXq431n+78abIoc33alPeuez+UbYdt1g2WLuBH1v aVetg9vfyT/dcFOx48XV1LdKLMUZiYZazEXFiQAI/sQ9agIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJIsWRmVeSWpSXmKPExsUi2FB8Q7fJVTbSYM8uEYs9h44yW2x+EWzR 0fGPyeLnnrPsFnOnPmW12Ndr7cDmsXPWXXaPxXteMnl0z/7H4jH/yBX2AJYoLpuU1JzMstQi fbsEroxPP26xFCyJqFj1ZSVTA2ObRxcjJ4eEgInEvLmHGbsYuTiEBA4xShy+s50RJMErICjx Y/I9li5GDg5mAXmJg+dlQcLMAloS3x+1skDUf2GUaOz7xgKSEBYQl3h3ZhMzhK0jMXXhOXYQ m01AWWLF/A9gNqdAgMTZF1vA6lkEVCVaJn9nBRnELHCJUWLV9Wdgy3gFbCRm73OFWLCHRaLr 3RI2kLiIgLPE5DdpEEfLStyafYl5AqPALCSnzkI4dRaSUxcwMq9iFChKzUmsNNdLLCjISdVL zs/dxAgO4cLUHYyNy60OMQpwMCrx8G4IkokUYk0sK67MBYYFB7OSCO90C9lIId6UxMqq1KL8 +KLSnNTiQ4xVQPdPZJYSTc4HxldeSbyhiYmBibGxmbGxuYk5VYSVxHmfiANtFkhPLEnNTk0t SC2CWc7EwSnVwJgvylRV+MukY3Ho9qg1nl5SMy97HrC+v8hx3tRV71Z+n3DtYX+buT3znLfz c1SLD26NjTvKz373wTyryWG295OP+3r6JD2anh374NUhrgR1QbkMMWW3KcK9LT/Fem7L9gby xCdN/HNida9mR8/ZzEsHO9ONb+9c67p3wleX67HFgZF6F41M9yqxFGckGmoxFxUnAgBf7Lx4 vAIAAA== Subject: Re: UEFI_DRIVER dependencies X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 May 2017 06:56:05 -0000 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII > On May 17, 2017, at 11:44 PM, peter.kirmeier@ts.fujitsu.com wrote: > > Hello, > > just a short question here: Isn't the Supported() method of the Driver Binding Protocol the place where one have to check the availabilities and dependencies? > As long the dependencies are not fulfilled the respective error code is returned until some other driver's Start() installed the required protocols and the own Support() method can then return success (and actually get Start()ed) ? > Peter, You are correct. I think Michael's UEFI Drivers do more than an EFI Driver Model driver, and that is the issue. As Mike pointed out for EFI Driver Model drivers the load sequence does not matter as the 1st connect happens after all the initial driver dispatch has completed. If a new FV is discovered the BDS would need to try and do more connects. In a pure EFI Driver Model world the Start() function would optionally grab a protocol GET_PROTOCOL. I guess you could even gate the Start function on the existence of the protocol. The thing about the EFI Driver Model is it requires a protocol on handle to exist to do the 1st connect. Thus the parent handle is always produced by the DXE Driver. I have to admit I've written a UEF_DRIVER that installs a protocol, and then produces an EFI Driver Model driver (DriverBinding) that will later get connected on those handles. Thanks, Andrew Fish > Best Regards, > Peter > > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Andrew Fish > Sent: Thursday, May 18, 2017 8:33 AM > To: Michael Zimmermann > Cc: Mike Kinney; edk2-devel-01; Dong, Eric; Zeng, Star > Subject: Re: [edk2] UEFI_DRIVER dependencies > > >> On May 17, 2017, at 11:25 PM, Michael Zimmermann wrote: >> >> Andrew, doesn't that only address the case where an UEFI_DRIVER has dependencies on certain dxe drivers?(which, as you said will always be available). >> It's still unclear to me how an UEFI_DRIVER can depend on another UEFI_DRIVER this way without relying on the fdf-order or using the device binding mechanism. >> >> My usecase is that I want to install a protocol from within a uefi driver which then can be used by other uefi drivers. It's a pure protocol and thus doesn't use the binding mechanism to bind to a device. >> > > Micheal, > > To get a little pedantic a UEFI driver could run on a system that did not support PI and thus no dispatcher. The early Itanium systems worked this way for example. > > So if you are really a UEFI driver then you have to gBS->RegisterProtocolNotify() to deal with sequence of protocols that don't follow the EFI Driver Model. > > If you want to have a DEPEX then you are really a DXE_DRIVER (UEFI + PI). I guess you could take a UEFI_DRIVER rename it a DXE_DRIVER and add my example Depex and it would work the same way as a UEFI_DRIVER. You could then add your extra Depex. > > Thanks, > > Andrew Fish > >> Thanks, >> Michael >> >> On Thu, May 18, 2017 at 8:16 AM, Andrew Fish > wrote: >> Michael, >> >> I forgot to mention If the DXE phase does not produce all the protocols required to dispatch UEFI_DRIVERs you get a lot of DEBUG prints and an ASSERTs out of the DXE Core. >> >> https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Dx >> eMain/DxeMain.c#L480 >> > xeMain/DxeMain.c#L480> >> >> // >> // Display Architectural protocols that were not loaded if this is DEBUG build >> // >> DEBUG_CODE_BEGIN (); >> CoreDisplayMissingArchProtocols (); >> DEBUG_CODE_END (); >> >> // >> // Display any drivers that were not dispatched because dependency expression >> // evaluated to false if this is a debug build >> // >> DEBUG_CODE_BEGIN (); >> CoreDisplayDiscoveredNotDispatched (); >> DEBUG_CODE_END (); >> >> // >> // Assert if the Architectural Protocols are not present. >> // >> Status = CoreAllEfiServicesAvailable (); >> if (EFI_ERROR(Status)) { >> // >> // Report Status code that some Architectural Protocols are not present. >> // >> REPORT_STATUS_CODE ( >> EFI_ERROR_CODE | EFI_ERROR_MAJOR, >> (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_EC_NO_ARCH) >> ); >> } >> ASSERT_EFI_ERROR (Status); >> >> >>> On May 17, 2017, at 11:09 PM, Andrew Fish > wrote: >>> >>>> >>>> On May 17, 2017, at 10:42 PM, Michael Zimmermann > wrote: >>>> >>>> Michael, that's a good point but it only works for drivers which >>>> bind to a device. If you're just installing a protocol e.g. for >>>> virtual devices or special services which you don't want to turn >>>> into libraries then this doesn't work. >>>> >>>> Haojian, that's what I was thinking, I just wasn't sure if the order >>>> is reliable. >>>> >>> >>> Micheal, >>> >>> From a PI/UEFI architectural perspective the contract is the depex are honored. If multiple drivers are TRUE at the same time the order they execute is not defined. Basically it is implementation choice and you should not write code that depends on this. This is why the A priori file exists, it is the only architectural way to force order of dispatch. Well DXE has BEFORE and AFTER. >>> >>> When I wrote the original dispatcher I ended up adding new drivers to the tail of the list vs. the head. Both would have been legal from a spec point of view. So by observing the current behavior you are conflating my implementation choice with the contract provided by specification. >>> >>> >>>> Andrew, your description sounds like its about DXE_DRIVERs and their >>>> Depex sections, does this apply to UEFI_DRIVERs too when they're >>>> auto-loaded from the fdf(since they don't support the Depex section)? >>>> >>> >>> No Depex section for UEFI_DRIVERS implies this Depex: >>> >>> [Depex] >>> gEfiSecurityArchProtocolGuid AND >>> gEfiCpuArchProtocolGuid AND >>> gEfiMetronomeArchProtocolGuid AND >>> gEfiTimerArchProtocolGuid AND >>> gEfiBdsArchProtocolGuid AND >>> gEfiWatchdogTimerArchProtocolGuid AND >>> gEfiRuntimeArchProtocolGuid AND >>> gEfiVariableArchProtocolGuid AND >>> gEfiVariableWriteArchProtocolGuid AND >>> gEfiCapsuleArchProtocolGuid AND >>> gEfiMonotonicCounterArchProtocolGuid AND >>> gEfiResetArchProtocolGuid AND >>> gEfiRealTimeClockArchProtocolGuid >>> >>> This is how we glued PI (DXE_DRIVERS) and UEFI (UEFI_DRIVER) together. EFI predates the concept of DXE in PI. >>> >>> The primary job of DXE_DRIVERS is to configure all the hardware required to provide all the EFI Boot and Runtime Services. The above protocols are what the DXE Core requires to produce all the EFI Boot and Runtime services. >>> >>> Thanks, >>> >>> Andrew Fish >>> >>>> Thanks for all your answers, >>>> Michael >>>> >>>> On Thu, May 18, 2017 at 7:21 AM, Andrew Fish > wrote: >>>>> >>>>>> On May 17, 2017, at 10:00 PM, Kinney, Michael D > wrote: >>>>>> >>>>>> Michael, >>>>>> >>>>>> The UEFI Driver Model and the Driver Binding Protocol provide >>>>>> support for this case. The idea is that a driver is loaded and >>>>>> started, but when a UEFI Driver is started, it only registers a >>>>>> Driver Binding Protocol. Then in the BDS phase, the devices >>>>>> required to boot are started using the UEFI Boot Service >>>>>> ConnectController() and >>>>>> ConnectController() calls the Driver Binding Protocol(s). >>>>>> >>>>>> The dependencies between UEFI Drivers are in their Driver Binding >>>>>> Protocols which are not used until after all of the UEFI Drivers >>>>>> are loaded and started. >>>>>> >>>>> >>>>> Micheal, >>>>> >>>>> 1st off no dependency is really a dependency on all the architecture protocols, which is a fancy way of saying all the EFI Boot and Runtime Services are available. >>>>> >>>>> Lets say you have a driver that depends on DiskIo. The DiskIo driver depends on BlockIo. Now what happens when a disk driver is connected and produces a BlockIO is the DiskIo driver can know get connected. The DXE Core knows a protocol was added to the handle so it will keep trying to connect drivers to that handle as long as new protocols get added. So this is how the DriverBinding Support() is used to resolve the sequence issues. >>>>> >>>>> Thanks, >>>>> >>>>> Andrew Fish >>>>> >>>>>> Mike >>>>>> >>>>>>> -----Original Message----- >>>>>>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org >>>>>>> ] On Behalf Of Michael >>>>>>> Zimmermann >>>>>>> Sent: Wednesday, May 17, 2017 9:43 PM >>>>>>> To: edk2-devel-01 >>>>>> >; Zeng, Star >>>>>>> >; Dong, Eric >>>>>>> > >>>>>>> Subject: [edk2] UEFI_DRIVER dependencies >>>>>>> >>>>>>> I know that UEFI_DRIVERs don't need or support Depex sections, >>>>>>> but what if an UEFI_DRIVER depends on a protocol provided by >>>>>>> another UEFI_DRIVER? >>>>>>> Since they get loaded automatically because I put them in my >>>>>>> platform's fdf, it raises the question of the loading order. >>>>>>> >>>>>>> Will they get loaded in the order they're defined? How often will >>>>>>> the core retry if one of the drivers returns EFI_NOT_READY? >>>>>>> >>>>>>> Thanks, >>>>>>> Michael >>>>>>> _______________________________________________ >>>>>>> edk2-devel mailing list >>>>>>> edk2-devel@lists.01.org >>>>>>> https://lists.01.org/mailman/listinfo/edk2-devel >>>>>>> >>>>>> _______________________________________________ >>>>>> edk2-devel mailing list >>>>>> edk2-devel@lists.01.org >>>>>> https://lists.01.org/mailman/listinfo/edk2-devel >>>>>> >>>>> >>>> _______________________________________________ >>>> edk2-devel mailing list >>>> edk2-devel@lists.01.org >>>> https://lists.01.org/mailman/listinfo/edk2-devel >>>> >>> >>> _______________________________________________ >>> edk2-devel mailing list >>> edk2-devel@lists.01.org >>> https://lists.01.org/mailman/listinfo/edk2-devel >>> >> > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel