On Thu, Apr 23, 2020 at 13:41:14 +0000, Pankaj Bansal (OSS) wrote:
> > > > > > The intended usage model for IoAccessLib is to retrieve the function
> > > > > > pointer struct once and then always refer to it. Since this is a
> > > > > > library, we could have a CONSTRUCTOR function (specified in the
> > > > > > .inf)
> > > > >
> > > > > I had thought of this, but decided against it because of this reason:
> > > > > The order of Library constructor call for a module cannot be
> > > > > guaranteed.
> > > > > https://edk2.groups.io/g/devel/message/57254 is an good example
> > > > > of
> > this.
> > > > > BaseDebugLibSerialPortConstructor would need to depend on
> > > > ChassisLibConstructor,
> > > > > to retrieve the UART clock frequency. If the constructor calls
> > > > > are not
> > > > guaranteed, BaseDebugLibSerialPortConstructor
> > > > > would fail and it would cause ASSERT due to ASSERT_RETURN_ERROR
> > > > (Status)
> > > >
> > > > If this is a problem (and I recall Ard pointing out some shortcomings
> > > > in the dependency handling in the past), we can solve this with an
> > > > explicit initialisation call in the SoC or platform init code.
> > >
> > > You mean put ChassisLibConstructor() call in SerialPortInitialize () ?
> >
> > Or before the call to SerialPortInitialize in ChassisInit.
>
> But SerialPortInitialize would be called from each module.
Why would multiple modules need to initialize the serial port?
> 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.
/
Leif
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#57971): https://edk2.groups.io/g/devel/message/57971
Mute This Topic: https://groups.io/mt/73008827/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-