From: Andrew Fish <afish@apple.com>
To: "David A. Van Arnem" <dvanarnem@cmlab.biz>
Cc: "edk2-devel@ml01.01.org" <edk2-devel@ml01.01.org>
Subject: Re: Print from DXE_DRIVER
Date: Wed, 08 Feb 2017 16:43:31 -0800 [thread overview]
Message-ID: <BCD7E096-1680-4F64-AD33-B23EBA7D4034@apple.com> (raw)
In-Reply-To: <4a3de604-5e60-7ed2-e520-29ab6b551c33@cmlab.biz>
> On Feb 8, 2017, at 2:10 PM, David A. Van Arnem <dvanarnem@cmlab.biz> wrote:
>
> Hello,
>
> I am working on a DXE_DRIVER for a custom device. I like to use Print()
> statements to trace code execution during development.
Prints are not allowed in drivers as they are likely to break the UI.
> Thus I have put
> a print statement in each of my Supported(),
Don't do that Supported gets called a lot. Well it is OK if you conditionally print.
> Start(), and Stop()
> functions for the driver binding protocol. Currently I am building the
> driver as part of the UefiCpuPkg, with no changes to the current
> UefiCpuPkg.dsc except for adding my driver under [Components]. I have
> also added the PrintLib and UefiLib to the [LibraryClasses] section in
> my driver's INF file, and included the necessary headers.
>
> When I load the driver from the shell (load <drivername>.efi), I get a
> message indicating it loaded successfully, but no output from the
> Print() messages.
You should be able to use shell commands to see if you driver is connected.
> The documentation for the shell says load should test
> both the Supported() and Start() functions, so I would expect to see the
> output, but I am not sure I am using the correct library instances to
> accomplish this. Is it possible to use Print() from a DXE_DRIVER, and
> which library instance should I use in the UefiCpuPkg.dsc file?
Print() is part of the UefiLib. The PrintLib vends sprintf kinds of things.
> If not,
> would changing it to a UEFI_DRIVER help? Any other recommendations?
>
If you are publishing driver binding protocol you should be UEFI_DRIVER, if possible.
> If there is an example in edk2 that does this that you could point me
> to, that would be sufficient as well. Thanks!
>
If you want to write directly to the UEFI Console you can try this. Place it in the entry point of your driver in case you have some bug that is preventing your from registering the Driver Binding Protocol.
gST->ConOut->OutputString (gST->ConOut, L"Hello World\n\r");
Make sure you use L"" vs "" as Print takes a CHAR16 and %s also default to CHAR16 (not ASCII)
Thanks,
Andrew Fish
> --
> Regards,
> David Van Arnem
> Development Engineer IV
> Computer Measurement Laboratory, LLC
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
next prev parent reply other threads:[~2017-02-09 0:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-08 22:10 Print from DXE_DRIVER David A. Van Arnem
2017-02-09 0:15 ` Laszlo Ersek
2017-02-09 0:41 ` David A. Van Arnem
2017-02-09 0:49 ` Andrew Fish
2017-02-09 0:43 ` Andrew Fish [this message]
2017-02-09 0:49 ` David A. Van Arnem
2017-02-09 1:04 ` Andrew Fish
2017-02-09 2:16 ` Gao, Liming
2017-02-09 2:55 ` Rebecca Cran
2017-02-09 2:59 ` Tim Lewis
2017-02-09 20:38 ` David A. Van Arnem
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=BCD7E096-1680-4F64-AD33-B23EBA7D4034@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