Hi Ard :)

So now we will always initialize the serial port in the entrypoint
only because DebugLib might use it later with doing the
initialization.

That doesn't sound quite correct to me.

Could you explain why we cannot rely on DebugLib to call the
initializer / constructor at the right time?
Because, DebugLib constructor which use serial port is called in
StandAloneMmMain function.
But, this constrcutor is in _ModuleEntryPoint in StandAloneMmCoreEntry.

That means all DEBUG used in _ModuleEntryPoint can use uninitialized
serial port.
one of typical example is GetSpmVersion function.

    _ModuleEntryPoint (in StandAloneMmCoreEntry)

     // Hazard Area start
        GetSpmVersion
            DEBUG (DEBUG_INFO, xxx)  // It could be use uninitalized
Serial port.

        ...
    //  Hazard Area end
        ProcessModuleEntryPointList (StandAloneMmMain)
            ProcessLibraryConstructorList // Here. call DebugLib
constructor with SerialPortIntialize

When you see above, I would be clear. between Hazard Area Start to
Hazard Area End.
DEBUG macro would use uninitailized Serial port if that's not
initialized by TF-A.

So, It should be call SerialPortInitialized at the _ModuleEntryPoint.








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 (#113313): https://edk2.groups.io/g/devel/message/113313
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]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to