diff mbox series

[edk2,6/7] ArmPlatformPkg/PrePi; call all constructors by hand

Message ID 20171130152453.19205-7-ard.biesheuvel@linaro.org
State New
Headers show
Series ArmPlatformPkg/PrePi: stop exposing internal code via HOBs | expand

Commit Message

Ard Biesheuvel Nov. 30, 2017, 3:24 p.m. UTC
Call ProcessLibraryConstructorList () to invoke all library constructors
by hand rather than calling only some of them explicitly.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 ArmPlatformPkg/PrePi/PrePi.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

-- 
2.11.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Leif Lindholm Nov. 30, 2017, 4:31 p.m. UTC | #1
On Thu, Nov 30, 2017 at 03:24:52PM +0000, Ard Biesheuvel wrote:
> Call ProcessLibraryConstructorList () to invoke all library constructors

> by hand rather than calling only some of them explicitly.

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---

>  ArmPlatformPkg/PrePi/PrePi.c | 13 +++----------

>  1 file changed, 3 insertions(+), 10 deletions(-)

> 

> diff --git a/ArmPlatformPkg/PrePi/PrePi.c b/ArmPlatformPkg/PrePi/PrePi.c

> index a60cafdce45e..76a53bc871d2 100644

> --- a/ArmPlatformPkg/PrePi/PrePi.c

> +++ b/ArmPlatformPkg/PrePi/PrePi.c

> @@ -33,15 +33,9 @@

>  UINT64 mSystemMemoryEnd = FixedPcdGet64(PcdSystemMemoryBase) +

>                            FixedPcdGet64(PcdSystemMemorySize) - 1;

>  

> -EFI_STATUS

> -EFIAPI

> -ExtractGuidedSectionLibConstructor (

> -  VOID

> -  );

> -

> -EFI_STATUS

> +VOID

>  EFIAPI

> -LzmaDecompressLibConstructor (

> +ProcessLibraryConstructorList (

>    VOID

>    );


Hmm ...
Do we need this local declaration?
Is there some header we could use?
If not - could we move it out to PrePi.h?

> @@ -162,8 +156,7 @@ PrePiMain (

>    PERF_START (NULL, "PEI", NULL, StartTimeStamp);

>  

>    // SEC phase needs to run library constructors by hand.

> -  ExtractGuidedSectionLibConstructor ();

> -  LzmaDecompressLibConstructor ();

> +  ProcessLibraryConstructorList ();

>  

>    // Assume the FV that contains the SEC (our code) also contains a compressed FV.

>    Status = DecompressFirstFv ();

> -- 

> 2.11.0

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Nov. 30, 2017, 4:35 p.m. UTC | #2
On 30 November 2017 at 16:31, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> On Thu, Nov 30, 2017 at 03:24:52PM +0000, Ard Biesheuvel wrote:

>> Call ProcessLibraryConstructorList () to invoke all library constructors

>> by hand rather than calling only some of them explicitly.

>>

>> Contributed-under: TianoCore Contribution Agreement 1.1

>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>> ---

>>  ArmPlatformPkg/PrePi/PrePi.c | 13 +++----------

>>  1 file changed, 3 insertions(+), 10 deletions(-)

>>

>> diff --git a/ArmPlatformPkg/PrePi/PrePi.c b/ArmPlatformPkg/PrePi/PrePi.c

>> index a60cafdce45e..76a53bc871d2 100644

>> --- a/ArmPlatformPkg/PrePi/PrePi.c

>> +++ b/ArmPlatformPkg/PrePi/PrePi.c

>> @@ -33,15 +33,9 @@

>>  UINT64 mSystemMemoryEnd = FixedPcdGet64(PcdSystemMemoryBase) +

>>                            FixedPcdGet64(PcdSystemMemorySize) - 1;

>>

>> -EFI_STATUS

>> -EFIAPI

>> -ExtractGuidedSectionLibConstructor (

>> -  VOID

>> -  );

>> -

>> -EFI_STATUS

>> +VOID

>>  EFIAPI

>> -LzmaDecompressLibConstructor (

>> +ProcessLibraryConstructorList (

>>    VOID

>>    );

>

> Hmm ...

> Do we need this local declaration?

> Is there some header we could use?


That doesn't appear to be the case, no

> If not - could we move it out to PrePi.h?

>


Yes, that works for me.


>> @@ -162,8 +156,7 @@ PrePiMain (

>>    PERF_START (NULL, "PEI", NULL, StartTimeStamp);

>>

>>    // SEC phase needs to run library constructors by hand.

>> -  ExtractGuidedSectionLibConstructor ();

>> -  LzmaDecompressLibConstructor ();

>> +  ProcessLibraryConstructorList ();

>>

>>    // Assume the FV that contains the SEC (our code) also contains a compressed FV.

>>    Status = DecompressFirstFv ();

>> --

>> 2.11.0

>>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Leif Lindholm Nov. 30, 2017, 4:45 p.m. UTC | #3
On Thu, Nov 30, 2017 at 04:35:41PM +0000, Ard Biesheuvel wrote:
> On 30 November 2017 at 16:31, Leif Lindholm <leif.lindholm@linaro.org> wrote:

> > On Thu, Nov 30, 2017 at 03:24:52PM +0000, Ard Biesheuvel wrote:

> >> Call ProcessLibraryConstructorList () to invoke all library constructors

> >> by hand rather than calling only some of them explicitly.

> >>

> >> Contributed-under: TianoCore Contribution Agreement 1.1

> >> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> >> ---

> >>  ArmPlatformPkg/PrePi/PrePi.c | 13 +++----------

> >>  1 file changed, 3 insertions(+), 10 deletions(-)

> >>

> >> diff --git a/ArmPlatformPkg/PrePi/PrePi.c b/ArmPlatformPkg/PrePi/PrePi.c

> >> index a60cafdce45e..76a53bc871d2 100644

> >> --- a/ArmPlatformPkg/PrePi/PrePi.c

> >> +++ b/ArmPlatformPkg/PrePi/PrePi.c

> >> @@ -33,15 +33,9 @@

> >>  UINT64 mSystemMemoryEnd = FixedPcdGet64(PcdSystemMemoryBase) +

> >>                            FixedPcdGet64(PcdSystemMemorySize) - 1;

> >>

> >> -EFI_STATUS

> >> -EFIAPI

> >> -ExtractGuidedSectionLibConstructor (

> >> -  VOID

> >> -  );

> >> -

> >> -EFI_STATUS

> >> +VOID

> >>  EFIAPI

> >> -LzmaDecompressLibConstructor (

> >> +ProcessLibraryConstructorList (

> >>    VOID

> >>    );

> >

> > Hmm ...

> > Do we need this local declaration?

> > Is there some header we could use?

> 

> That doesn't appear to be the case, no


Seems like a future opportunity.

> > If not - could we move it out to PrePi.h?

> 

> Yes, that works for me.


OK, if you fold that in, for the series:
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>


> >> @@ -162,8 +156,7 @@ PrePiMain (

> >>    PERF_START (NULL, "PEI", NULL, StartTimeStamp);

> >>

> >>    // SEC phase needs to run library constructors by hand.

> >> -  ExtractGuidedSectionLibConstructor ();

> >> -  LzmaDecompressLibConstructor ();

> >> +  ProcessLibraryConstructorList ();

> >>

> >>    // Assume the FV that contains the SEC (our code) also contains a compressed FV.

> >>    Status = DecompressFirstFv ();

> >> --

> >> 2.11.0

> >>

> _______________________________________________

> 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
Ard Biesheuvel Nov. 30, 2017, 5:12 p.m. UTC | #4
On 30 November 2017 at 16:45, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> On Thu, Nov 30, 2017 at 04:35:41PM +0000, Ard Biesheuvel wrote:

>> On 30 November 2017 at 16:31, Leif Lindholm <leif.lindholm@linaro.org> wrote:

>> > On Thu, Nov 30, 2017 at 03:24:52PM +0000, Ard Biesheuvel wrote:

>> >> Call ProcessLibraryConstructorList () to invoke all library constructors

>> >> by hand rather than calling only some of them explicitly.

>> >>

>> >> Contributed-under: TianoCore Contribution Agreement 1.1

>> >> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>> >> ---

>> >>  ArmPlatformPkg/PrePi/PrePi.c | 13 +++----------

>> >>  1 file changed, 3 insertions(+), 10 deletions(-)

>> >>

>> >> diff --git a/ArmPlatformPkg/PrePi/PrePi.c b/ArmPlatformPkg/PrePi/PrePi.c

>> >> index a60cafdce45e..76a53bc871d2 100644

>> >> --- a/ArmPlatformPkg/PrePi/PrePi.c

>> >> +++ b/ArmPlatformPkg/PrePi/PrePi.c

>> >> @@ -33,15 +33,9 @@

>> >>  UINT64 mSystemMemoryEnd = FixedPcdGet64(PcdSystemMemoryBase) +

>> >>                            FixedPcdGet64(PcdSystemMemorySize) - 1;

>> >>

>> >> -EFI_STATUS

>> >> -EFIAPI

>> >> -ExtractGuidedSectionLibConstructor (

>> >> -  VOID

>> >> -  );

>> >> -

>> >> -EFI_STATUS

>> >> +VOID

>> >>  EFIAPI

>> >> -LzmaDecompressLibConstructor (

>> >> +ProcessLibraryConstructorList (

>> >>    VOID

>> >>    );

>> >

>> > Hmm ...

>> > Do we need this local declaration?

>> > Is there some header we could use?

>>

>> That doesn't appear to be the case, no

>

> Seems like a future opportunity.

>

>> > If not - could we move it out to PrePi.h?

>>

>> Yes, that works for me.

>

> OK, if you fold that in, for the series:

> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

>


Thanks. Pushed as c6e51751e026..73fcbb48665e

I have taken the liberty of reordering this patch with the one that
clones PrePi for Beagle, so this fix is applied to the clone as well.


>> >> @@ -162,8 +156,7 @@ PrePiMain (

>> >>    PERF_START (NULL, "PEI", NULL, StartTimeStamp);

>> >>

>> >>    // SEC phase needs to run library constructors by hand.

>> >> -  ExtractGuidedSectionLibConstructor ();

>> >> -  LzmaDecompressLibConstructor ();

>> >> +  ProcessLibraryConstructorList ();

>> >>

>> >>    // Assume the FV that contains the SEC (our code) also contains a compressed FV.

>> >>    Status = DecompressFirstFv ();

>> >> --

>> >> 2.11.0

>> >>

>> _______________________________________________

>> 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
diff mbox series

Patch

diff --git a/ArmPlatformPkg/PrePi/PrePi.c b/ArmPlatformPkg/PrePi/PrePi.c
index a60cafdce45e..76a53bc871d2 100644
--- a/ArmPlatformPkg/PrePi/PrePi.c
+++ b/ArmPlatformPkg/PrePi/PrePi.c
@@ -33,15 +33,9 @@ 
 UINT64 mSystemMemoryEnd = FixedPcdGet64(PcdSystemMemoryBase) +
                           FixedPcdGet64(PcdSystemMemorySize) - 1;
 
-EFI_STATUS
-EFIAPI
-ExtractGuidedSectionLibConstructor (
-  VOID
-  );
-
-EFI_STATUS
+VOID
 EFIAPI
-LzmaDecompressLibConstructor (
+ProcessLibraryConstructorList (
   VOID
   );
 
@@ -162,8 +156,7 @@  PrePiMain (
   PERF_START (NULL, "PEI", NULL, StartTimeStamp);
 
   // SEC phase needs to run library constructors by hand.
-  ExtractGuidedSectionLibConstructor ();
-  LzmaDecompressLibConstructor ();
+  ProcessLibraryConstructorList ();
 
   // Assume the FV that contains the SEC (our code) also contains a compressed FV.
   Status = DecompressFirstFv ();