diff mbox series

[edk2,edk2-staging,07/20] IntelUndiPkg/XGigUndiDxe: drop definition of gImageHandle

Message ID 20181115023353.20159-8-ard.biesheuvel@linaro.org
State New
Headers show
Series IntelUndiPkg/XGigUndiDxe: fix GCC / ARM build issues | expand

Commit Message

Ard Biesheuvel Nov. 15, 2018, 2:33 a.m. UTC
Remove duplicate definition of gImageHandle, which is emitted by
the build tools as well.

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

---
 IntelUndiPkg/XGigUndiDxe/Init.c | 2 --
 1 file changed, 2 deletions(-)

-- 
2.17.1

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

Comments

Ryszard Knop Jan. 30, 2019, 4:05 p.m. UTC | #1
Hmm, is there a list/something I can generate to see which globals
build tools emit? There are some more variables I'd happily get rid
of, eg if I could drop gSystemTable and others.

Reviewed-by: Ryszard Knop <ryszard.knop@linux.intel.com>


On Wed, 2018-11-14 at 18:33 -0800, ard.biesheuvela wrote:
> Remove duplicate definition of gImageHandle, which is emitted by

> the build tools as well.

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

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

> ---

>  IntelUndiPkg/XGigUndiDxe/Init.c | 2 --

>  1 file changed, 2 deletions(-)

> 

> diff --git a/IntelUndiPkg/XGigUndiDxe/Init.c

> b/IntelUndiPkg/XGigUndiDxe/Init.c

> index 84e06ea071c5..03e3942a1944 100644

> --- a/IntelUndiPkg/XGigUndiDxe/Init.c

> +++ b/IntelUndiPkg/XGigUndiDxe/Init.c

> @@ -47,7 +47,6 @@ UINT16             mActiveChildren    = 0;

>  EFI_EVENT          gEventNotifyExitBs;

>  EFI_EVENT          gEventNotifyVirtual;

>  

> -EFI_HANDLE        gImageHandle;

>  EFI_SYSTEM_TABLE *gSystemTable;

>  

>  EFI_GUID gEfiNiiPointerGuid = EFI_NII_POINTER_PROTOCOL_GUID;

> @@ -502,7 +501,6 @@ InitializeXGigUndiDriver (

>  {

>    EFI_STATUS                 Status;

>  

> -  gImageHandle  = ImageHandle;

>    gSystemTable  = SystemTable;

>  

>    Status = EfiLibInstallDriverBinding (ImageHandle, SystemTable,

> &gUndiDriverBinding, ImageHandle);


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Jan. 30, 2019, 4:06 p.m. UTC | #2
On Wed, 30 Jan 2019 at 17:05, Ryszard Knop <ryszard.knop@linux.intel.com> wrote:
>

> Hmm, is there a list/something I can generate to see which globals

> build tools emit? There are some more variables I'd happily get rid

> of, eg if I could drop gSystemTable and others.

>


You can look at the contents of the various AutoGen.h files in the Build/ folder


> Reviewed-by: Ryszard Knop <ryszard.knop@linux.intel.com>

>

> On Wed, 2018-11-14 at 18:33 -0800, ard.biesheuvela wrote:

> > Remove duplicate definition of gImageHandle, which is emitted by

> > the build tools as well.

> >

> > Contributed-under: TianoCore Contribution Agreement 1.1

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

> > ---

> >  IntelUndiPkg/XGigUndiDxe/Init.c | 2 --

> >  1 file changed, 2 deletions(-)

> >

> > diff --git a/IntelUndiPkg/XGigUndiDxe/Init.c

> > b/IntelUndiPkg/XGigUndiDxe/Init.c

> > index 84e06ea071c5..03e3942a1944 100644

> > --- a/IntelUndiPkg/XGigUndiDxe/Init.c

> > +++ b/IntelUndiPkg/XGigUndiDxe/Init.c

> > @@ -47,7 +47,6 @@ UINT16             mActiveChildren    = 0;

> >  EFI_EVENT          gEventNotifyExitBs;

> >  EFI_EVENT          gEventNotifyVirtual;

> >

> > -EFI_HANDLE        gImageHandle;

> >  EFI_SYSTEM_TABLE *gSystemTable;

> >

> >  EFI_GUID gEfiNiiPointerGuid = EFI_NII_POINTER_PROTOCOL_GUID;

> > @@ -502,7 +501,6 @@ InitializeXGigUndiDriver (

> >  {

> >    EFI_STATUS                 Status;

> >

> > -  gImageHandle  = ImageHandle;

> >    gSystemTable  = SystemTable;

> >

> >    Status = EfiLibInstallDriverBinding (ImageHandle, SystemTable,

> > &gUndiDriverBinding, ImageHandle);

>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ryszard Knop Jan. 30, 2019, 4:17 p.m. UTC | #3
Ah, thanks!

On Wed, 2019-01-30 at 17:06 +0100, Ard Biesheuvel wrote:
> On Wed, 30 Jan 2019 at 17:05, Ryszard Knop <

> ryszard.knop@linux.intel.com> wrote:

> > Hmm, is there a list/something I can generate to see which globals

> > build tools emit? There are some more variables I'd happily get rid

> > of, eg if I could drop gSystemTable and others.

> > 

> 

> You can look at the contents of the various AutoGen.h files in the

> Build/ folder

> 

> 

> > Reviewed-by: Ryszard Knop <ryszard.knop@linux.intel.com>

> > 

> > On Wed, 2018-11-14 at 18:33 -0800, ard.biesheuvela wrote:

> > > Remove duplicate definition of gImageHandle, which is emitted by

> > > the build tools as well.

> > > 

> > > Contributed-under: TianoCore Contribution Agreement 1.1

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

> > > ---

> > >  IntelUndiPkg/XGigUndiDxe/Init.c | 2 --

> > >  1 file changed, 2 deletions(-)

> > > 

> > > diff --git a/IntelUndiPkg/XGigUndiDxe/Init.c

> > > b/IntelUndiPkg/XGigUndiDxe/Init.c

> > > index 84e06ea071c5..03e3942a1944 100644

> > > --- a/IntelUndiPkg/XGigUndiDxe/Init.c

> > > +++ b/IntelUndiPkg/XGigUndiDxe/Init.c

> > > @@ -47,7 +47,6 @@ UINT16             mActiveChildren    = 0;

> > >  EFI_EVENT          gEventNotifyExitBs;

> > >  EFI_EVENT          gEventNotifyVirtual;

> > > 

> > > -EFI_HANDLE        gImageHandle;

> > >  EFI_SYSTEM_TABLE *gSystemTable;

> > > 

> > >  EFI_GUID gEfiNiiPointerGuid = EFI_NII_POINTER_PROTOCOL_GUID;

> > > @@ -502,7 +501,6 @@ InitializeXGigUndiDriver (

> > >  {

> > >    EFI_STATUS                 Status;

> > > 

> > > -  gImageHandle  = ImageHandle;

> > >    gSystemTable  = SystemTable;

> > > 

> > >    Status = EfiLibInstallDriverBinding (ImageHandle, SystemTable,

> > > &gUndiDriverBinding, ImageHandle);


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Andrew Fish via edk2-devel Jan. 30, 2019, 4:56 p.m. UTC | #4
> On Jan 30, 2019, at 8:05 AM, Ryszard Knop <ryszard.knop@linux.intel.com> wrote:

> 

> Hmm, is there a list/something I can generate to see which globals

> build tools emit? There are some more variables I'd happily get rid

> of, eg if I could drop gSystemTable and others.

> 


Ryszard,

You need to use libs by including the include file, and listing the lib in the INF. The library constructor initializes the globals. 

https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/DxeServicesTableLib.h <https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/DxeServicesTableLib.h>
https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/UefiBootServicesTableLib.h <https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/UefiBootServicesTableLib.h>
https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/UefiRuntimeServicesTableLib.h

For edk2 the library constructors get called prior calling your drivers entry point. 

Thanks,

Andrew Fish


> Reviewed-by: Ryszard Knop <ryszard.knop@linux.intel.com>

> 

> On Wed, 2018-11-14 at 18:33 -0800, ard.biesheuvela wrote:

>> Remove duplicate definition of gImageHandle, which is emitted by

>> the build tools as well.

>> 

>> Contributed-under: TianoCore Contribution Agreement 1.1

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

>> ---

>> IntelUndiPkg/XGigUndiDxe/Init.c | 2 --

>> 1 file changed, 2 deletions(-)

>> 

>> diff --git a/IntelUndiPkg/XGigUndiDxe/Init.c

>> b/IntelUndiPkg/XGigUndiDxe/Init.c

>> index 84e06ea071c5..03e3942a1944 100644

>> --- a/IntelUndiPkg/XGigUndiDxe/Init.c

>> +++ b/IntelUndiPkg/XGigUndiDxe/Init.c

>> @@ -47,7 +47,6 @@ UINT16             mActiveChildren    = 0;

>> EFI_EVENT          gEventNotifyExitBs;

>> EFI_EVENT          gEventNotifyVirtual;

>> 

>> -EFI_HANDLE        gImageHandle;

>> EFI_SYSTEM_TABLE *gSystemTable;

>> 

>> EFI_GUID gEfiNiiPointerGuid = EFI_NII_POINTER_PROTOCOL_GUID;

>> @@ -502,7 +501,6 @@ InitializeXGigUndiDriver (

>> {

>>   EFI_STATUS                 Status;

>> 

>> -  gImageHandle  = ImageHandle;

>>   gSystemTable  = SystemTable;

>> 

>>   Status = EfiLibInstallDriverBinding (ImageHandle, SystemTable,

>> &gUndiDriverBinding, ImageHandle);

> 

> _______________________________________________

> 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/IntelUndiPkg/XGigUndiDxe/Init.c b/IntelUndiPkg/XGigUndiDxe/Init.c
index 84e06ea071c5..03e3942a1944 100644
--- a/IntelUndiPkg/XGigUndiDxe/Init.c
+++ b/IntelUndiPkg/XGigUndiDxe/Init.c
@@ -47,7 +47,6 @@  UINT16             mActiveChildren    = 0;
 EFI_EVENT          gEventNotifyExitBs;
 EFI_EVENT          gEventNotifyVirtual;
 
-EFI_HANDLE        gImageHandle;
 EFI_SYSTEM_TABLE *gSystemTable;
 
 EFI_GUID gEfiNiiPointerGuid = EFI_NII_POINTER_PROTOCOL_GUID;
@@ -502,7 +501,6 @@  InitializeXGigUndiDriver (
 {
   EFI_STATUS                 Status;
 
-  gImageHandle  = ImageHandle;
   gSystemTable  = SystemTable;
 
   Status = EfiLibInstallDriverBinding (ImageHandle, SystemTable, &gUndiDriverBinding, ImageHandle);