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." Laszlo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108475): https://edk2.groups.io/g/devel/message/108475 Mute This Topic: https://groups.io/mt/101203427/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-