From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=67.231.154.164; helo=dispatch1-us1.ppe-hosted.com; envelope-from=tpilar@solarflare.com; receiver=edk2-devel@lists.01.org Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 543DF21191F5E for ; Tue, 27 Nov 2018 07:29:03 -0800 (PST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 37908980066; Tue, 27 Nov 2018 15:29:02 +0000 (UTC) Received: from tp-desktop.uk.solarflarecom.com (10.17.20.51) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 27 Nov 2018 07:28:59 -0800 From: "Tomas Pilar (tpilar)" To: "Gao, Liming" , "edk2-devel@lists.01.org" References: <3d05d3db-1a45-99f7-95ac-5bc77daf0494@solarflare.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E373119@SHSMSX104.ccr.corp.intel.com> Message-ID: <5003ac72-455b-3d5f-2eea-6bc6aee928ed@solarflare.com> Date: Tue, 27 Nov 2018 15:28:57 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.17.20.51] X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24248.005 X-TM-AS-Result: No-17.999800-4.000000-10 X-TMASE-MatchedRID: 1GZI+iG+MtfuqBuVmgcCWm3NvezwBrVmMUUuEZQPwBYNcckEPxfz2Cj5 3aEB5qDL4Wdyz7gSZe0Bh7bUMmdQp1EwRhIfWnCe5gCHftmwEMKZf5btvM85ARae5J4l8aLzxsr 6m7RljBF35pRAWpykN7Pbb8G24sfCkbfFSBkmVVdqQHge19s2StZKsq3DGpal1DDyq0Szn2F2a7 kBuf9T+xH+MXG5fwuxuEu+p8BQjVcIVzx51Rv3HpVRzPxemJL0fkuZtv/FS5pgg+UjPGL1RYnV4 FKib7SLDityYk2BMDPd7pM7PCDlaS2PQJ73d0XSnVTWWiNp+v91k+gP1XamtJsoi2XrUn/JyeMt MD9QOgChMIDkR/KfwI2j49Ftap9Eymsk/wUE4hpgqOV2Er/dHndzDebrjs0olqejiDp0Hb/PxMa FkqjQgl8GKwF8knNZ X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--17.999800-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24248.005 X-MDID: 1543332542-RG1kMPQ4e8et Subject: Re: FmpDeviceLib 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: Tue, 27 Nov 2018 15:29:04 -0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Language: en-US Okay, so I just noticed that FmpDxe is full of module globals including the image descriptor, so it necessarily requires that the driver that includes it as a library can only ever control one controller. Cheers, Tom On 27/11/2018 15:23, Tomas Pilar (tpilar) wrote: > > On 27/11/2018 14:33, Gao, Liming wrote: >> Tom: >> FmpDeviceLib can use UEFI driver model/driver binding protocol so it can install FMP on its device handle during the BDS/Device connection phase. It can implement RegisterFmpInstaller() to install FMP protocol in its device handle. In this way, FmpDeviceLib is like UEFI driver with UEFI driver binding protocol. >> >> Thanks >> Liming > Hi Liming, > > Sure, so now I can install FMP onto my ControllerHandle. Say that someone gets the FMP and calls GetImageSize. The FmpDxeLib does some checks and then it calls FmpDeviceLibGetImageSize() with no context parameter. This method is supposed to be implemented by me, the driver writer, but how is the code in this method meant to know which Controller are we getting the image size from? > > So maybe I can define some module globals, declare them in a cross include file, include that in my driver and and have the driver populate the module globals during probe. This immediately limits the usefulness by requiring that each driver only ever drives one controller. > > And then you consider how to do a SetImage without being even given the Handle of the Controller. Do you stuff the controller handle into a module global parameter that gets populated during the BDS phase? > > I guess you could enumerate all FMP instances, see which one of them advertises your ImageTypeId and get the handle that the FMP is installed on that way. But that seems rather insane and would cause issues if you have two of the same device in the platform, unless you check the HardwareInstance as well? This seems insane. > > Cheers, > Tom > >>> -----Original Message----- >>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Tomas Pilar (tpilar) >>> Sent: Tuesday, November 27, 2018 9:26 PM >>> To: edk2-devel@lists.01.org >>> Subject: [edk2] FmpDeviceLib >>> >>> Hi all, >>> >>> I am looking at using FmpDxeLib so I need to implement the FmpDeviceLib. However, it seems like the library functions do not take any >>> private struct as a parameter, so I am struggling to figure out how to read information off the hardware. FmpDxe does not even pass its >>> created protocol instance when calling the library functions, leading me to believe that the only way to do this is to assign a pointer to >>> private struct during library construction, but that means that a driver that uses the code can only ever service a single controller. >>> >>> Can you offer any insights? >>> >>> Cheers, >>> Tom >>> _______________________________________________ >>> edk2-devel mailing list >>> edk2-devel@lists.01.org >>> https://lists.01.org/mailman/listinfo/edk2-devel