public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Help on AutoGen Files
@ 2018-07-19  7:32 Udit Kumar
  2018-07-19 18:14 ` Marvin H?user
  0 siblings, 1 reply; 4+ messages in thread
From: Udit Kumar @ 2018-07-19  7:32 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Hi Experts,
How I can change the order of initialization in Constructor list of autogen file.
In my build system, if I look at
MdeModulePkg/Universal/PCD/Pei/Pcd/DEBUG/AutoGen.c
Below is function of Library Constructor List

VOID
EFIAPI
ProcessLibraryConstructorList (
  IN       EFI_PEI_FILE_HANDLE       FileHandle,
  IN CONST EFI_PEI_SERVICES          **PeiServices
  )
{
  EFI_STATUS  Status;

  Status = BaseDebugLibSerialPortConstructor ();
  ASSERT_EFI_ERROR (Status);

  Status = PeiServicesTablePointerLibConstructor (FileHandle, PeiServices);
  ASSERT_EFI_ERROR (Status);

  Status = TimerConstructor ();
  ASSERT_EFI_ERROR (Status);

  Status = FpgaInterfaceInit ();
  ASSERT_EFI_ERROR (Status);

}


My problem is SerialPortConstructor needs frequency, which can be retrieved after  FpgaInterfaceInit()
Therefore, my preferred way for this constructor list will be
FpgaInterfaceInit() followed by  BaseDebugLibSerialPortConstructor()

how I can achieve this.


Many Thanks
Udit


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Help on AutoGen Files
  2018-07-19  7:32 Help on AutoGen Files Udit Kumar
@ 2018-07-19 18:14 ` Marvin H?user
  2018-07-19 18:25   ` Andrew Fish
  0 siblings, 1 reply; 4+ messages in thread
From: Marvin H?user @ 2018-07-19 18:14 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Hey Udit,

You cannot explicitly influence the order of the calls, but implicitly via the dependency tree, which means you need to make SerialPortLib depend on your LibraryClass instance.
You did not mention which SerialPortLib instance you use, but probably you need to execute FpgaInterfaceInit() earlier in platform code or fork SerialPortLib for now.

Regards,
Marvin

> -----Original Message-----
> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Udit
> Kumar
> Sent: Thursday, July 19, 2018 9:33 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] Help on AutoGen Files
> 
> Hi Experts,
> How I can change the order of initialization in Constructor list of autogen file.
> In my build system, if I look at
> MdeModulePkg/Universal/PCD/Pei/Pcd/DEBUG/AutoGen.c
> Below is function of Library Constructor List
> 
> VOID
> EFIAPI
> ProcessLibraryConstructorList (
>   IN       EFI_PEI_FILE_HANDLE       FileHandle,
>   IN CONST EFI_PEI_SERVICES          **PeiServices
>   )
> {
>   EFI_STATUS  Status;
> 
>   Status = BaseDebugLibSerialPortConstructor ();
>   ASSERT_EFI_ERROR (Status);
> 
>   Status = PeiServicesTablePointerLibConstructor (FileHandle, PeiServices);
>   ASSERT_EFI_ERROR (Status);
> 
>   Status = TimerConstructor ();
>   ASSERT_EFI_ERROR (Status);
> 
>   Status = FpgaInterfaceInit ();
>   ASSERT_EFI_ERROR (Status);
> 
> }
> 
> 
> My problem is SerialPortConstructor needs frequency, which can be
> retrieved after  FpgaInterfaceInit() Therefore, my preferred way for this
> constructor list will be
> FpgaInterfaceInit() followed by  BaseDebugLibSerialPortConstructor()
> 
> how I can achieve this.
> 
> 
> Many Thanks
> Udit
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Help on AutoGen Files
  2018-07-19 18:14 ` Marvin H?user
@ 2018-07-19 18:25   ` Andrew Fish
  2018-07-20  4:07     ` Udit Kumar
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Fish @ 2018-07-19 18:25 UTC (permalink / raw)
  To: Marvin H?user; +Cc: edk2-devel@lists.01.org

Udit,

As Marvin points out the [LibraryClasses] section of the INF file are going to imply the order of the library constructor calls in the AutoGen

Worst case you can demote FpgaInterfaceInit () from being a constructor to just being a public library function that the other lib can call explicitly from its constructor. Maybe that is too drastic and you could must move a function out of FpgaInterfaceInit () and make that function part of the Public library interface?

Thanks,

Andrew Fish

> On Jul 19, 2018, at 11:14 AM, Marvin H?user <Marvin.Haeuser@outlook.com> wrote:
> 
> Hey Udit,
> 
> You cannot explicitly influence the order of the calls, but implicitly via the dependency tree, which means you need to make SerialPortLib depend on your LibraryClass instance.
> You did not mention which SerialPortLib instance you use, but probably you need to execute FpgaInterfaceInit() earlier in platform code or fork SerialPortLib for now.
> 
> Regards,
> Marvin
> 
>> -----Original Message-----
>> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Udit
>> Kumar
>> Sent: Thursday, July 19, 2018 9:33 AM
>> To: edk2-devel@lists.01.org
>> Subject: [edk2] Help on AutoGen Files
>> 
>> Hi Experts,
>> How I can change the order of initialization in Constructor list of autogen file.
>> In my build system, if I look at
>> MdeModulePkg/Universal/PCD/Pei/Pcd/DEBUG/AutoGen.c
>> Below is function of Library Constructor List
>> 
>> VOID
>> EFIAPI
>> ProcessLibraryConstructorList (
>>  IN       EFI_PEI_FILE_HANDLE       FileHandle,
>>  IN CONST EFI_PEI_SERVICES          **PeiServices
>>  )
>> {
>>  EFI_STATUS  Status;
>> 
>>  Status = BaseDebugLibSerialPortConstructor ();
>>  ASSERT_EFI_ERROR (Status);
>> 
>>  Status = PeiServicesTablePointerLibConstructor (FileHandle, PeiServices);
>>  ASSERT_EFI_ERROR (Status);
>> 
>>  Status = TimerConstructor ();
>>  ASSERT_EFI_ERROR (Status);
>> 
>>  Status = FpgaInterfaceInit ();
>>  ASSERT_EFI_ERROR (Status);
>> 
>> }
>> 
>> 
>> My problem is SerialPortConstructor needs frequency, which can be
>> retrieved after  FpgaInterfaceInit() Therefore, my preferred way for this
>> constructor list will be
>> FpgaInterfaceInit() followed by  BaseDebugLibSerialPortConstructor()
>> 
>> how I can achieve this.
>> 
>> 
>> Many Thanks
>> Udit
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Help on AutoGen Files
  2018-07-19 18:25   ` Andrew Fish
@ 2018-07-20  4:07     ` Udit Kumar
  0 siblings, 0 replies; 4+ messages in thread
From: Udit Kumar @ 2018-07-20  4:07 UTC (permalink / raw)
  To: Andrew Fish, Marvin H?user; +Cc: edk2-devel@lists.01.org

Thanks Andrew and Marvin,

> You cannot explicitly influence the order of the calls, but implicitly via the
> dependency tree, which means you need to make SerialPortLib depend on your
> LibraryClass instance.

Looks this is difficult that I can force order on already available code. 

> Worst case you can demote FpgaInterfaceInit () from being a constructor to just

Currently I am forcing the clock lib to call FpgaInterfaceInit first, this clock lib 
gives input clock to PL011 serial driver. 

Regards
Udit

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Andrew Fish
> Sent: Thursday, July 19, 2018 11:56 PM
> To: Marvin H?user <Marvin.Haeuser@outlook.com>
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] Help on AutoGen Files
> 
> Udit,
> 
> As Marvin points out the [LibraryClasses] section of the INF file are going to
> imply the order of the library constructor calls in the AutoGen
> 
> Worst case you can demote FpgaInterfaceInit () from being a constructor to just
> being a public library function that the other lib can call explicitly from its
> constructor. Maybe that is too drastic and you could must move a function out
> of FpgaInterfaceInit () and make that function part of the Public library
> interface?
> 
> Thanks,
> 
> Andrew Fish
> 
> > On Jul 19, 2018, at 11:14 AM, Marvin H?user <Marvin.Haeuser@outlook.com>
> wrote:
> >
> > Hey Udit,
> >
> > You cannot explicitly influence the order of the calls, but implicitly via the
> dependency tree, which means you need to make SerialPortLib depend on your
> LibraryClass instance.
> > You did not mention which SerialPortLib instance you use, but probably you
> need to execute FpgaInterfaceInit() earlier in platform code or fork SerialPortLib
> for now.
> >
> > Regards,
> > Marvin
> >
> >> -----Original Message-----
> >> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Udit
> >> Kumar
> >> Sent: Thursday, July 19, 2018 9:33 AM
> >> To: edk2-devel@lists.01.org
> >> Subject: [edk2] Help on AutoGen Files
> >>
> >> Hi Experts,
> >> How I can change the order of initialization in Constructor list of autogen file.
> >> In my build system, if I look at
> >> MdeModulePkg/Universal/PCD/Pei/Pcd/DEBUG/AutoGen.c
> >> Below is function of Library Constructor List
> >>
> >> VOID
> >> EFIAPI
> >> ProcessLibraryConstructorList (
> >>  IN       EFI_PEI_FILE_HANDLE       FileHandle,
> >>  IN CONST EFI_PEI_SERVICES          **PeiServices
> >>  )
> >> {
> >>  EFI_STATUS  Status;
> >>
> >>  Status = BaseDebugLibSerialPortConstructor ();  ASSERT_EFI_ERROR
> >> (Status);
> >>
> >>  Status = PeiServicesTablePointerLibConstructor (FileHandle,
> >> PeiServices);  ASSERT_EFI_ERROR (Status);
> >>
> >>  Status = TimerConstructor ();
> >>  ASSERT_EFI_ERROR (Status);
> >>
> >>  Status = FpgaInterfaceInit ();
> >>  ASSERT_EFI_ERROR (Status);
> >>
> >> }
> >>
> >>
> >> My problem is SerialPortConstructor needs frequency, which can be
> >> retrieved after  FpgaInterfaceInit() Therefore, my preferred way for
> >> this constructor list will be
> >> FpgaInterfaceInit() followed by  BaseDebugLibSerialPortConstructor()
> >>
> >> how I can achieve this.
> >>
> >>
> >> Many Thanks
> >> Udit
> >> _______________________________________________
> >> edk2-devel mailing list
> >> edk2-devel@lists.01.org
> >> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fli
> >> sts.01.org%2Fmailman%2Flistinfo%2Fedk2-
> devel&amp;data=02%7C01%7Cudit.
> >>
> kumar%40nxp.com%7C5df5baccbdde4daa481808d5eda51660%7C686ea1d3bc2
> b4c6f
> >>
> a92cd99c5c301635%7C0%7C0%7C636676215665542230&amp;sdata=6CnFNG5
> t05yH%
> >> 2FOSYpcbp%2F1gWQenUyWcJ%2Fb7C0Yt1n5Y%3D&amp;reserved=0
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
> > ts.01.org%2Fmailman%2Flistinfo%2Fedk2-
> devel&amp;data=02%7C01%7Cudit.ku
> >
> mar%40nxp.com%7C5df5baccbdde4daa481808d5eda51660%7C686ea1d3bc2b4
> c6fa92
> >
> cd99c5c301635%7C0%7C0%7C636676215665542230&amp;sdata=6CnFNG5t05y
> H%2FOS
> > Ypcbp%2F1gWQenUyWcJ%2Fb7C0Yt1n5Y%3D&amp;reserved=0
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01
> .org%2Fmailman%2Flistinfo%2Fedk2-
> devel&amp;data=02%7C01%7Cudit.kumar%40nxp.com%7C5df5baccbdde4daa4
> 81808d5eda51660%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636
> 676215665542230&amp;sdata=6CnFNG5t05yH%2FOSYpcbp%2F1gWQenUyWcJ
> %2Fb7C0Yt1n5Y%3D&amp;reserved=0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-20  4:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-19  7:32 Help on AutoGen Files Udit Kumar
2018-07-19 18:14 ` Marvin H?user
2018-07-19 18:25   ` Andrew Fish
2018-07-20  4:07     ` Udit Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox