public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Heyi Guo <guoheyi@huawei.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Hao Wu <hao.a.wu@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	Julien Grall <julien.grall@arm.com>,
	wanghaibin 00208455 <wanghaibin.wang@huawei.com>
Subject: Re: [RFC 0/3] Enable runtime serial debug for ArmVirtQemu
Date: Wed, 20 Mar 2019 18:47:28 +0100	[thread overview]
Message-ID: <e19505f1-f3d1-ced6-fd9b-62ec8757e564@redhat.com> (raw)
In-Reply-To: <1e39908c-3f26-7b87-8bd3-8ae04221cf58@huawei.com>

On 03/20/19 13:16, Heyi Guo wrote:
> 
> 
> On 2019/3/20 17:55, Laszlo Ersek wrote:

>> If we don't have to flatten a ridiculous amount of other library code
>> into the RuntimePrepare() function, I think such flattening would be a
>> viable approach. We've run into this constructor loop several times
>> before, and -- if I remember correctly anyway! -- one approach has been
>> to declare SerialPortLib the "lowest level abstraction", and make the
>> affected lib instance self-contained.

> In my RFC, we need to use gDS which is from
> DxeServicesTableLib->EfiGetSystemConfigurationTable()->UefiLib, so that
> we need to flatten EfiGetSystemConfigurationTable().

I think that's acceptable.

> And
> gDS->SetMemorySpaceAttributes() actually relies on
> gEfiCpuArchProtocolGuid or it will return EFI_NOT_AVAILABLE_YET.

This is a valid dependency (even the PI spec spells it out). The way to
deal with it is to add gEfiCpuArchProtocolGuid to the DEPEX section of
the INF file -- this is possible for INF files of library instances as
well, but you have to be careful about module types. Please see the INF
spec on that.

Once you do this, modules linked against the lib instance will inherit
the lib instance's DEPEX, and "and it" together with the rest of their
DEPEX. IOW using the library will delay the containing driver module
until the CPU Arch protocol is available in the protocol database.

Then the constructor can rely on the related DXE services.

Thanks
Laszlo


  reply	other threads:[~2019-03-20 17:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-28  8:05 [RFC 0/3] Enable runtime serial debug for ArmVirtQemu Heyi Guo
2019-02-28  8:05 ` [RFC 1/3] MdeModulePkg/StatusCode: Add PCD to enable runtime serial debug Heyi Guo
2019-02-28  8:05 ` [RFC 2/3] ArmVirtPkg: add runtime instance of FdtPL011SerialPortLib Heyi Guo
2019-02-28  8:05 ` [RFC 3/3] ArmVirtQemu: enable runtime debug by build flag Heyi Guo
2019-02-28 12:10 ` [RFC 0/3] Enable runtime serial debug for ArmVirtQemu Ard Biesheuvel
2019-03-01 15:27   ` Laszlo Ersek
2019-03-04 13:52     ` Heyi Guo
2019-03-12  6:56     ` Heyi Guo
2019-03-12 17:05       ` Laszlo Ersek
2019-03-12 17:28         ` Andrew Fish
2019-03-12 19:42           ` Laszlo Ersek
2019-03-13 20:16           ` Brian J. Johnson
2019-03-14  3:52             ` Andrew Fish
2019-03-16  9:41         ` Heyi Guo
2019-03-20  9:55           ` Laszlo Ersek
2019-03-20 12:16             ` Heyi Guo
2019-03-20 17:47               ` Laszlo Ersek [this message]
2019-03-21  3:23                 ` Heyi Guo
2019-02-28 13:39 ` Laszlo Ersek
2019-03-01 12:24   ` Heyi Guo
2019-03-01 14:59     ` Laszlo Ersek
2019-03-01 15:14       ` Ard Biesheuvel
     [not found]       ` <CAFEAcA8AQjMJytpbXbBPH_YyuVW-PawhSgGeXaZGhVzRUPh9+A@mail.gmail.com>
2019-03-01 16:14         ` 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=e19505f1-f3d1-ced6-fd9b-62ec8757e564@redhat.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