My personal conclusion in that thread was [1], and correspondingly,
commit 5087a0773645 ("ArmVirtPkg/FdtPL011SerialPortLib: initialize
implicitly", 2023-10-07). In the end, the only tractable solution was to
initialize the serial port (hardware, and library instance) exactly
once, in (a) the constructor, or (b) the explicit SerialPortInitialize()
call, or (c) any SerialPortLib API, whichever occurred first. (And (a)
and (b) can be coalesced, because SerialPortInitialize() can be marked
as the constructor for the lib instance.)
[1] http://mid.mail-archive.com/542db9e1-cd28-27a2-3a98-5b0c85cd7c79@redhat.com
https://edk2.groups.io/g/devel/message/109235
Laszlo
In my personal thinking, It's better to make new interface like
RETURN_STATUS
EFIAPI
SerialPortInitializeEarly (
VOID
);
to solve this problem.
Because, It makes a memory permission fault
when we call SerialPortInitialize like
ArmVirtPkg/Library/FdtPL011SerialPortLib
where try to modify global variable.
At the _ModuleEntryPoint of StandAloneMmCore which is FIRST entry from TF-A
All of Image area is mapped as RO+X, so before load StandaloneMmCore,
We couldn't write global variable.
the purposes of above interface are:
- Initalize serial port to use in early environment only (like
StandAloneMmCore Entry Point) where couldn't write global variable by
static information (FixedPcd).
- It presume that all setting configured by it will be overwritten
by SerialPortInitialize.
IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended recipient,
please notify the sender immediately and do not disclose the contents to any
other person, use it for any purpose, or store or copy the information in any
medium. Thank you.
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113534): https://edk2.groups.io/g/devel/message/113534
Mute This Topic: https://groups.io/mt/103540969/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-