public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Tomas Pilar (tpilar)" <tpilar@solarflare.com>
To: "Gao, Liming" <liming.gao@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: FmpDeviceLib
Date: Tue, 27 Nov 2018 15:28:57 +0000	[thread overview]
Message-ID: <5003ac72-455b-3d5f-2eea-6bc6aee928ed@solarflare.com> (raw)
In-Reply-To: <f72df0c6-b8c3-c1b2-a1d3-47d7c9e994b2@solarflare.com>

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



  reply	other threads:[~2018-11-27 15:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27 13:25 FmpDeviceLib Tomas Pilar (tpilar)
2018-11-27 14:33 ` FmpDeviceLib Gao, Liming
2018-11-27 15:23   ` FmpDeviceLib Tomas Pilar (tpilar)
2018-11-27 15:28     ` Tomas Pilar (tpilar) [this message]
2018-11-28  1:15       ` FmpDeviceLib Kinney, Michael D
2018-11-28 10:43         ` FmpDeviceLib Tomas Pilar (tpilar)

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=5003ac72-455b-3d5f-2eea-6bc6aee928ed@solarflare.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