public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: devel@edk2.groups.io, lersek@redhat.com
Cc: Sean Brogan <spbrogan@outlook.com>, osde@linux.microsoft.com
Subject: Re: [edk2-devel] [PATCH v1 1/1] ArmVirtPkg: Enable Early Serial For DxeCore
Date: Mon, 11 Sep 2023 11:26:35 +0200	[thread overview]
Message-ID: <CAMj1kXGdBV9o1akj9AxnycpCXcjPF_4nwHVKn7OisFhro_JLNw@mail.gmail.com> (raw)
In-Reply-To: <ecb0d666-d6b1-67da-daf0-dbb48f61e1eb@redhat.com>

On Mon, 11 Sept 2023 at 07:30, Laszlo Ersek <lersek@redhat.com> wrote:
>
> On 9/8/23 01:58, Sean Brogan wrote:
> >
> > On 9/7/2023 1:54 PM, Laszlo Ersek wrote:
> >> On 9/7/23 19:50, Sean Brogan wrote:
> >>> I would argue that by declaring that your library class supports type
> >>> DXE_CORE (or any core type) that you have declared you understand the
> >>> uniqueness of the environment and have accounted for it.
> >>>
> >>> For instances that support DXE_CORE or MM_CORE module types we often use
> >>> a global variable (to the library) to determine if the init routine has
> >>> been completed.  This does require a single byte check on each serial
> >>> message write (hot path) but given all the code on that path this is not
> >>> noticeable in performance measurements.   In the case below this pattern
> >>> could be used by the FdtPL011SerialPortLib to detect if it's init
> >>> routine has been called.
> >> Good point, but then I still claim that the "init check in each API"
> >> should be done in a dedicated "DxeCoreDebugLibSerialPort" instance, and
> >> not in a SerialPortLib instance. Here's why:
> >>
> >> (1) The SerialPortLib *class* requires SerialPortInitialize() to be
> >> called before the other APIs.
> >
> > Where do you see this? Looking at the file here:
> > edk2/MdePkg/Include/Library/SerialPortLib.h at master · tianocore/edk2
> > (github.com)
> > <https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/SerialPortLib.h> I don't see that.  I don't necessarily disagree with you but I am just trying to find out where this is documented.
>
> I consider this an implicit requirement, from the first two sentences
> (and from the fact that the function is declared at the top of the
> header) -- "Initialize the serial device hardware. If no initialization
> is required, then return RETURN_SUCCESS."
>

Agreed. Even if the header file does not spell it out literally, it is
implied: SerialPortInitialize() needs to be implemented even if no
initialization is required, in which case the routine does nothing
before returning SUCCESS. So the caller cannot distinguish a library
class implementation that requires initialization from one that does
not, and it can only assume that calling SerialPortInitialize() is
needed before using any other part of the API.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108481): https://edk2.groups.io/g/devel/message/108481
Mute This Topic: https://groups.io/mt/101203427/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-09-11  9:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-06 21:49 [edk2-devel][PATCH v1 1/1] ArmVirtPkg: Enable Early Serial For DxeCore Oliver Smith-Denny
2023-09-07 10:12 ` Ard Biesheuvel
2023-09-07 13:10   ` [edk2-devel] [PATCH " Laszlo Ersek
2023-09-07 15:24     ` Oliver Smith-Denny
2023-09-07 17:50       ` Sean
2023-09-07 20:54         ` Laszlo Ersek
2023-09-07 23:58           ` Sean
2023-09-11  5:30             ` Laszlo Ersek
2023-09-11  9:26               ` Ard Biesheuvel [this message]
2023-09-30 14:43             ` Laszlo Ersek
2023-09-30 20:04               ` Laszlo Ersek

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=CAMj1kXGdBV9o1akj9AxnycpCXcjPF_4nwHVKn7OisFhro_JLNw@mail.gmail.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