public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Andrew Fish" <afish@apple.com>
To: devel@edk2.groups.io, d.meneses@softi9.pt
Subject: Re: [edk2-devel] How to add a DXE driver to an OVMF image?
Date: Wed, 09 Nov 2022 12:09:59 -0800	[thread overview]
Message-ID: <ACD069A2-B7C8-421F-A4BC-D2C10F34A6BA@apple.com> (raw)
In-Reply-To: <8217.1668018556935621513@groups.io>

[-- Attachment #1: Type: text/plain, Size: 2244 bytes --]



> On Nov 9, 2022, at 10:29 AM, d.meneses via groups.io <d.meneses=softi9.pt@groups.io> wrote:
> 
> Thank you Andrew for your reply. 
> 
> Your explanation about the Driver Binding protocol cleared up some questions of mine.
> 
> Regarding the BDS, I recon I have some reading to do before I understand what you said and why it might be relevant to me.
> 

The BDS is what runs after all the discovered drivers have been dispatched. The BDS processes all those UEFI NVRAM variables I references, and sets platform defaults. 

> For now I am investigating the possibility of having a DxeDriver load an UEFI application and create an event to start it after the DXE Phase is over and the Terminal protocol is available. 
> 

That seems very Rube Goldberg. There are no threads in UEFI, just events that run at a higher TPL. It is not legal, per the UEFI specification to run applications at elevate TPL [1]. There is no way for a driver to inject its self into the main thread. So for example your App running at elevate TPL could block the lower priority events needed to read from the disk or manage the network traffic. EFI is a cooperative event model so your code running at a given event level blocks all code at that level or lower from running indefinitely. 

> I need to:
> - learn how to load and start images. To that end I have found a CoreLoadImage and CoreStartImage edk2 functions, buuut
> - I haven't figured out how to get the device path to my UEFI app
> - I was wondering if I could somehow use my app's GUID to search for it? 

If you look at the code I pointed you to in the OVMF BDS Platform lib I think you will find it writes an UEFI Boot Variable that contains a Device Path that has the FILE_GUID as the file name. 

If you want to try something quick you could replace the FILE_GUID for the UEFI Shell with the FILE_GUID for your App and it should not launch in place of the UEFI Shell. 

> - Then I'd learn how to use events and have them start the app 
> 

As I mentioned that is going to break stuff. 

[1]
https://uefi.org/specs/UEFI/2.10/07_Services_Boot_Services.html#event-timer-and-task-priority-services> I'm deeply thankful for your time, wish you luck and peace
> 


[-- Attachment #2.1: Type: text/html, Size: 5822 bytes --]

[-- Attachment #2.2: favicon.ico --]
[-- Type: image/vnd.microsoft.icon, Size: 1406 bytes --]

  reply	other threads:[~2022-11-09 20:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02 11:11 How to add a DXE driver to an OVMF image? d.meneses
2022-11-03  0:58 ` [edk2-devel] " Pedro Falcato
2022-11-03  1:07   ` Andrew Fish
2022-11-03 15:23     ` d.meneses
2022-11-03 16:51       ` Pedro Falcato
2022-11-03 19:11         ` d.meneses
2022-11-03 21:34           ` Andrew Fish
2022-11-03 22:02             ` d.meneses
2022-11-03 22:02               ` Pedro Falcato
2022-11-03 22:12                 ` d.meneses
2022-11-04 13:20                   ` d.meneses
2022-11-09 17:52                     ` Andrew Fish
2022-11-09 18:29                       ` d.meneses
2022-11-09 20:09                         ` Andrew Fish [this message]
2022-11-10  7:43                           ` d.meneses

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=ACD069A2-B7C8-421F-A4BC-D2C10F34A6BA@apple.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