> > >
> > > Why would multiple modules need to initialize the serial port?
> >
> > That's how the DebugLib has been designed.
> > DebugLib is used by all modules to print info on console.
> > BaseDebugLibSerialPortConstructor calls SerialPortInitialize.
> > So SerialPortInitialize is called by all the modules.
> 
> Sure, but the bit where ChassisLib returns the active clock
> configuration does not need to happen for each initialization.
> That value can be cached.

The only mechanism I know for passing a cached value between different modules
is either use PCDs or use HOBs.
We have already explored both in https://edk2.groups.io/g/devel/message/57254
and https://edk2.groups.io/g/devel/message/56530 

Moreover the compiler can optimize the PcdDcfgBigEndian evaluation.
So no overhead would be observed in evaluating PcdDcfgBigEndian in every call.

> 
> > Which is the reason when I forked the BaseSerialPortLib16550,
> > I removed SerialPortInitalize functionality.
> > https://edk2.groups.io/g/devel/message/54011
> >
> > >
> > > > Each module that has SerialPort and ChassiLib linked to it would have a
> > > > local copy of mDcfgOps, which needs to be initialized.
> > >
> > > On the surface it makes more sense for the function that initializes
> > > mmio accessors for chassis to be in the chassis initialization
> > > function.
> > >
> > > In the current tree I can only see one user of SerialPortLib and one
> > > of ChassisLib - but you are suggesting there will be several per
> > > platform? If so, A better splution may ne to consider wrapping
> > > DcfgRead32/DcfgWrite32 in a protocol instead of depending on the
> > > ChassisLib.
> >
> > The protocol would not be available in SEC and PEI phase.
> 
> Fair.
> 
> /
>     Leif

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58012): https://edk2.groups.io/g/devel/message/58012
Mute This Topic: https://groups.io/mt/73008827/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to