public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to FspGlobalData.
@ 2020-05-20  3:33 Chiu, Chasel
  2020-05-20  4:12 ` Nate DeSimone
  0 siblings, 1 reply; 6+ messages in thread
From: Chiu, Chasel @ 2020-05-20  3:33 UTC (permalink / raw)
  To: devel; +Cc: Maurice Ma, Nate DeSimone, Star Zeng

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2726

When FSP switching stack and calling bootloader functions,
the function parameter in stack may not be accessible easily.
We can store the function parameter pointer to FspGlobalData
and retrieve it after stack switched.

Also need to add Loader2PeiSwitchStack () to header file
as public function for platform FSP code to consume.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
---
 IntelFsp2Pkg/Include/FspGlobalData.h             | 12 ++++++++++--
 IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h | 18 +++++++++++++++++-
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/IntelFsp2Pkg/Include/FspGlobalData.h b/IntelFsp2Pkg/Include/FspGlobalData.h
index 5bde316893..dba9b48e1a 100644
--- a/IntelFsp2Pkg/Include/FspGlobalData.h
+++ b/IntelFsp2Pkg/Include/FspGlobalData.h
@@ -52,12 +52,20 @@ typedef struct  {
    VOID               *MemoryInitUpdPtr;
    VOID               *SiliconInitUpdPtr;
    UINT8              ApiIdx;
-   UINT8              FspMode; // 0: FSP in API mode; 1: FSP in DISPATCH mode
+   ///
+   /// 0: FSP in API mode; 1: FSP in DISPATCH mode
+   ///
+   UINT8              FspMode;
    UINT8              OnSeparateStack;
    UINT8              Reserved3;
    UINT32             NumberOfPhases;
    UINT32             PhasesExecuted;
-   UINT8              Reserved4[20];
+   ///
+   /// To store function parameters pointer
+   /// so it can be retrieved after stack switched.
+   ///
+   VOID               *FunctionParameterPtr;
+   UINT8              Reserved4[16];
    UINT32             PerfSig;
    UINT16             PerfLen;
    UINT16             Reserved5;
diff --git a/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h b/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
index 0c76e9f022..bed2a5d677 100644
--- a/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
+++ b/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -36,4 +36,20 @@ Pei2LoaderSwitchStack (
   VOID
   );
 
+/**
+
+  This function is equilivant to Pei2LoaderSwitchStack () but just indicates
+  the stack after switched is FSP stack.
+
+  @return ReturnKey          After switching to the saved stack,
+                             this value will be saved in eax before returning.
+
+
+**/
+UINT32
+EFIAPI
+Loader2PeiSwitchStack (
+  VOID
+  );
+
 #endif
-- 
2.13.3.windows.1


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

* Re: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to FspGlobalData.
  2020-05-20  3:33 [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to FspGlobalData Chiu, Chasel
@ 2020-05-20  4:12 ` Nate DeSimone
  2020-05-20  4:20   ` Zeng, Star
  0 siblings, 1 reply; 6+ messages in thread
From: Nate DeSimone @ 2020-05-20  4:12 UTC (permalink / raw)
  To: Chiu, Chasel, devel@edk2.groups.io; +Cc: Ma, Maurice, Zeng, Star

Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

> -----Original Message-----
> From: Chiu, Chasel <chasel.chiu@intel.com>
> Sent: Tuesday, May 19, 2020 8:34 PM
> To: devel@edk2.groups.io
> Cc: Ma, Maurice <maurice.ma@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Zeng, Star <star.zeng@intel.com>
> Subject: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to FspGlobalData.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2726
> 
> When FSP switching stack and calling bootloader functions, the function
> parameter in stack may not be accessible easily.
> We can store the function parameter pointer to FspGlobalData and retrieve it
> after stack switched.
> 
> Also need to add Loader2PeiSwitchStack () to header file as public function
> for platform FSP code to consume.
> 
> Cc: Maurice Ma <maurice.ma@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
> ---
>  IntelFsp2Pkg/Include/FspGlobalData.h             | 12 ++++++++++--
>  IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h | 18
> +++++++++++++++++-
>  2 files changed, 27 insertions(+), 3 deletions(-)
> 
> diff --git a/IntelFsp2Pkg/Include/FspGlobalData.h
> b/IntelFsp2Pkg/Include/FspGlobalData.h
> index 5bde316893..dba9b48e1a 100644
> --- a/IntelFsp2Pkg/Include/FspGlobalData.h
> +++ b/IntelFsp2Pkg/Include/FspGlobalData.h
> @@ -52,12 +52,20 @@ typedef struct  {
>     VOID               *MemoryInitUpdPtr;
>     VOID               *SiliconInitUpdPtr;
>     UINT8              ApiIdx;
> -   UINT8              FspMode; // 0: FSP in API mode; 1: FSP in DISPATCH mode
> +   ///
> +   /// 0: FSP in API mode; 1: FSP in DISPATCH mode
> +   ///
> +   UINT8              FspMode;
>     UINT8              OnSeparateStack;
>     UINT8              Reserved3;
>     UINT32             NumberOfPhases;
>     UINT32             PhasesExecuted;
> -   UINT8              Reserved4[20];
> +   ///
> +   /// To store function parameters pointer
> +   /// so it can be retrieved after stack switched.
> +   ///
> +   VOID               *FunctionParameterPtr;
> +   UINT8              Reserved4[16];
>     UINT32             PerfSig;
>     UINT16             PerfLen;
>     UINT16             Reserved5;
> diff --git a/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> b/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> index 0c76e9f022..bed2a5d677 100644
> --- a/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> +++ b/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> @@ -1,6 +1,6 @@
>  /** @file
> 
> -  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2014 - 2020, Intel Corporation. All rights
> + reserved.<BR>
>    SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -36,4 +36,20 @@ Pei2LoaderSwitchStack (
>    VOID
>    );
> 
> +/**
> +
> +  This function is equilivant to Pei2LoaderSwitchStack () but just
> + indicates  the stack after switched is FSP stack.
> +
> +  @return ReturnKey          After switching to the saved stack,
> +                             this value will be saved in eax before returning.
> +
> +
> +**/
> +UINT32
> +EFIAPI
> +Loader2PeiSwitchStack (
> +  VOID
> +  );
> +
>  #endif
> --
> 2.13.3.windows.1


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

* Re: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to FspGlobalData.
  2020-05-20  4:12 ` Nate DeSimone
@ 2020-05-20  4:20   ` Zeng, Star
  2020-05-20  4:25     ` Chiu, Chasel
  0 siblings, 1 reply; 6+ messages in thread
From: Zeng, Star @ 2020-05-20  4:20 UTC (permalink / raw)
  To: Desimone, Nathaniel L, Chiu, Chasel, devel@edk2.groups.io
  Cc: Ma, Maurice, Zeng, Star

equilivant is a typo?

> -----Original Message-----
> From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
> Sent: Wednesday, May 20, 2020 12:12 PM
> To: Chiu, Chasel <chasel.chiu@intel.com>; devel@edk2.groups.io
> Cc: Ma, Maurice <maurice.ma@intel.com>; Zeng, Star <star.zeng@intel.com>
> Subject: RE: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to
> FspGlobalData.
> 
> Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
> 
> > -----Original Message-----
> > From: Chiu, Chasel <chasel.chiu@intel.com>
> > Sent: Tuesday, May 19, 2020 8:34 PM
> > To: devel@edk2.groups.io
> > Cc: Ma, Maurice <maurice.ma@intel.com>; Desimone, Nathaniel L
> > <nathaniel.l.desimone@intel.com>; Zeng, Star <star.zeng@intel.com>
> > Subject: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to FspGlobalData.
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2726
> >
> > When FSP switching stack and calling bootloader functions, the
> > function parameter in stack may not be accessible easily.
> > We can store the function parameter pointer to FspGlobalData and
> > retrieve it after stack switched.
> >
> > Also need to add Loader2PeiSwitchStack () to header file as public
> > function for platform FSP code to consume.
> >
> > Cc: Maurice Ma <maurice.ma@intel.com>
> > Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> > Cc: Star Zeng <star.zeng@intel.com>
> > Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
> > ---
> >  IntelFsp2Pkg/Include/FspGlobalData.h             | 12 ++++++++++--
> >  IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h | 18
> > +++++++++++++++++-
> >  2 files changed, 27 insertions(+), 3 deletions(-)
> >
> > diff --git a/IntelFsp2Pkg/Include/FspGlobalData.h
> > b/IntelFsp2Pkg/Include/FspGlobalData.h
> > index 5bde316893..dba9b48e1a 100644
> > --- a/IntelFsp2Pkg/Include/FspGlobalData.h
> > +++ b/IntelFsp2Pkg/Include/FspGlobalData.h
> > @@ -52,12 +52,20 @@ typedef struct  {
> >     VOID               *MemoryInitUpdPtr;
> >     VOID               *SiliconInitUpdPtr;
> >     UINT8              ApiIdx;
> > -   UINT8              FspMode; // 0: FSP in API mode; 1: FSP in
> DISPATCH mode
> > +   ///
> > +   /// 0: FSP in API mode; 1: FSP in DISPATCH mode
> > +   ///
> > +   UINT8              FspMode;
> >     UINT8              OnSeparateStack;
> >     UINT8              Reserved3;
> >     UINT32             NumberOfPhases;
> >     UINT32             PhasesExecuted;
> > -   UINT8              Reserved4[20];
> > +   ///
> > +   /// To store function parameters pointer
> > +   /// so it can be retrieved after stack switched.
> > +   ///
> > +   VOID               *FunctionParameterPtr;
> > +   UINT8              Reserved4[16];
> >     UINT32             PerfSig;
> >     UINT16             PerfLen;
> >     UINT16             Reserved5;
> > diff --git a/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > b/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > index 0c76e9f022..bed2a5d677 100644
> > --- a/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > +++ b/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > @@ -1,6 +1,6 @@
> >  /** @file
> >
> > -  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
> > +  Copyright (c) 2014 - 2020, Intel Corporation. All rights
> > + reserved.<BR>
> >    SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >  **/
> > @@ -36,4 +36,20 @@ Pei2LoaderSwitchStack (
> >    VOID
> >    );
> >
> > +/**
> > +
> > +  This function is equilivant to Pei2LoaderSwitchStack () but just
> > + indicates  the stack after switched is FSP stack.
> > +
> > +  @return ReturnKey          After switching to the saved stack,
> > +                             this value will be saved in eax before
> returning.
> > +
> > +
> > +**/
> > +UINT32
> > +EFIAPI
> > +Loader2PeiSwitchStack (
> > +  VOID
> > +  );
> > +
> >  #endif
> > --
> > 2.13.3.windows.1


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

* Re: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to FspGlobalData.
  2020-05-20  4:20   ` Zeng, Star
@ 2020-05-20  4:25     ` Chiu, Chasel
  2020-05-20  4:33       ` Zeng, Star
  0 siblings, 1 reply; 6+ messages in thread
From: Chiu, Chasel @ 2020-05-20  4:25 UTC (permalink / raw)
  To: Zeng, Star, Desimone, Nathaniel L, devel@edk2.groups.io; +Cc: Ma, Maurice


Yes, thanks for good catch! I will correct it.

> -----Original Message-----
> From: Zeng, Star <star.zeng@intel.com>
> Sent: Wednesday, May 20, 2020 12:21 PM
> To: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Chiu, Chasel
> <chasel.chiu@intel.com>; devel@edk2.groups.io
> Cc: Ma, Maurice <maurice.ma@intel.com>; Zeng, Star <star.zeng@intel.com>
> Subject: RE: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to
> FspGlobalData.
> 
> equilivant is a typo?
> 
> > -----Original Message-----
> > From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
> > Sent: Wednesday, May 20, 2020 12:12 PM
> > To: Chiu, Chasel <chasel.chiu@intel.com>; devel@edk2.groups.io
> > Cc: Ma, Maurice <maurice.ma@intel.com>; Zeng, Star
> > <star.zeng@intel.com>
> > Subject: RE: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to
> > FspGlobalData.
> >
> > Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
> >
> > > -----Original Message-----
> > > From: Chiu, Chasel <chasel.chiu@intel.com>
> > > Sent: Tuesday, May 19, 2020 8:34 PM
> > > To: devel@edk2.groups.io
> > > Cc: Ma, Maurice <maurice.ma@intel.com>; Desimone, Nathaniel L
> > > <nathaniel.l.desimone@intel.com>; Zeng, Star <star.zeng@intel.com>
> > > Subject: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to
> FspGlobalData.
> > >
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2726
> > >
> > > When FSP switching stack and calling bootloader functions, the
> > > function parameter in stack may not be accessible easily.
> > > We can store the function parameter pointer to FspGlobalData and
> > > retrieve it after stack switched.
> > >
> > > Also need to add Loader2PeiSwitchStack () to header file as public
> > > function for platform FSP code to consume.
> > >
> > > Cc: Maurice Ma <maurice.ma@intel.com>
> > > Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> > > Cc: Star Zeng <star.zeng@intel.com>
> > > Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
> > > ---
> > >  IntelFsp2Pkg/Include/FspGlobalData.h             | 12
> ++++++++++--
> > >  IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h | 18
> > > +++++++++++++++++-
> > >  2 files changed, 27 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/IntelFsp2Pkg/Include/FspGlobalData.h
> > > b/IntelFsp2Pkg/Include/FspGlobalData.h
> > > index 5bde316893..dba9b48e1a 100644
> > > --- a/IntelFsp2Pkg/Include/FspGlobalData.h
> > > +++ b/IntelFsp2Pkg/Include/FspGlobalData.h
> > > @@ -52,12 +52,20 @@ typedef struct  {
> > >     VOID               *MemoryInitUpdPtr;
> > >     VOID               *SiliconInitUpdPtr;
> > >     UINT8              ApiIdx;
> > > -   UINT8              FspMode; // 0: FSP in API mode; 1: FSP in
> > DISPATCH mode
> > > +   ///
> > > +   /// 0: FSP in API mode; 1: FSP in DISPATCH mode
> > > +   ///
> > > +   UINT8              FspMode;
> > >     UINT8              OnSeparateStack;
> > >     UINT8              Reserved3;
> > >     UINT32             NumberOfPhases;
> > >     UINT32             PhasesExecuted;
> > > -   UINT8              Reserved4[20];
> > > +   ///
> > > +   /// To store function parameters pointer
> > > +   /// so it can be retrieved after stack switched.
> > > +   ///
> > > +   VOID               *FunctionParameterPtr;
> > > +   UINT8              Reserved4[16];
> > >     UINT32             PerfSig;
> > >     UINT16             PerfLen;
> > >     UINT16             Reserved5;
> > > diff --git a/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > > b/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > > index 0c76e9f022..bed2a5d677 100644
> > > --- a/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > > +++ b/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > > @@ -1,6 +1,6 @@
> > >  /** @file
> > >
> > > -  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
> > > +  Copyright (c) 2014 - 2020, Intel Corporation. All rights
> > > + reserved.<BR>
> > >    SPDX-License-Identifier: BSD-2-Clause-Patent
> > >
> > >  **/
> > > @@ -36,4 +36,20 @@ Pei2LoaderSwitchStack (
> > >    VOID
> > >    );
> > >
> > > +/**
> > > +
> > > +  This function is equilivant to Pei2LoaderSwitchStack () but just
> > > + indicates  the stack after switched is FSP stack.
> > > +
> > > +  @return ReturnKey          After switching to the saved stack,
> > > +                             this value will be saved in eax before
> > returning.
> > > +
> > > +
> > > +**/
> > > +UINT32
> > > +EFIAPI
> > > +Loader2PeiSwitchStack (
> > > +  VOID
> > > +  );
> > > +
> > >  #endif
> > > --
> > > 2.13.3.windows.1


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

* Re: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to FspGlobalData.
  2020-05-20  4:25     ` Chiu, Chasel
@ 2020-05-20  4:33       ` Zeng, Star
  2020-05-20  7:03         ` Chiu, Chasel
  0 siblings, 1 reply; 6+ messages in thread
From: Zeng, Star @ 2020-05-20  4:33 UTC (permalink / raw)
  To: Chiu, Chasel, Desimone, Nathaniel L, devel@edk2.groups.io
  Cc: Ma, Maurice, Zeng, Star

No need to resend new patch, you can go ahead with Nate's review after the correction.

> -----Original Message-----
> From: Chiu, Chasel <chasel.chiu@intel.com>
> Sent: Wednesday, May 20, 2020 12:25 PM
> To: Zeng, Star <star.zeng@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; devel@edk2.groups.io
> Cc: Ma, Maurice <maurice.ma@intel.com>
> Subject: RE: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to
> FspGlobalData.
> 
> 
> Yes, thanks for good catch! I will correct it.
> 
> > -----Original Message-----
> > From: Zeng, Star <star.zeng@intel.com>
> > Sent: Wednesday, May 20, 2020 12:21 PM
> > To: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Chiu,
> > Chasel <chasel.chiu@intel.com>; devel@edk2.groups.io
> > Cc: Ma, Maurice <maurice.ma@intel.com>; Zeng, Star
> > <star.zeng@intel.com>
> > Subject: RE: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to
> > FspGlobalData.
> >
> > equilivant is a typo?
> >
> > > -----Original Message-----
> > > From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
> > > Sent: Wednesday, May 20, 2020 12:12 PM
> > > To: Chiu, Chasel <chasel.chiu@intel.com>; devel@edk2.groups.io
> > > Cc: Ma, Maurice <maurice.ma@intel.com>; Zeng, Star
> > > <star.zeng@intel.com>
> > > Subject: RE: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to
> > > FspGlobalData.
> > >
> > > Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
> > >
> > > > -----Original Message-----
> > > > From: Chiu, Chasel <chasel.chiu@intel.com>
> > > > Sent: Tuesday, May 19, 2020 8:34 PM
> > > > To: devel@edk2.groups.io
> > > > Cc: Ma, Maurice <maurice.ma@intel.com>; Desimone, Nathaniel L
> > > > <nathaniel.l.desimone@intel.com>; Zeng, Star <star.zeng@intel.com>
> > > > Subject: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to
> > FspGlobalData.
> > > >
> > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2726
> > > >
> > > > When FSP switching stack and calling bootloader functions, the
> > > > function parameter in stack may not be accessible easily.
> > > > We can store the function parameter pointer to FspGlobalData and
> > > > retrieve it after stack switched.
> > > >
> > > > Also need to add Loader2PeiSwitchStack () to header file as public
> > > > function for platform FSP code to consume.
> > > >
> > > > Cc: Maurice Ma <maurice.ma@intel.com>
> > > > Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> > > > Cc: Star Zeng <star.zeng@intel.com>
> > > > Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
> > > > ---
> > > >  IntelFsp2Pkg/Include/FspGlobalData.h             | 12
> > ++++++++++--
> > > >  IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h | 18
> > > > +++++++++++++++++-
> > > >  2 files changed, 27 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/IntelFsp2Pkg/Include/FspGlobalData.h
> > > > b/IntelFsp2Pkg/Include/FspGlobalData.h
> > > > index 5bde316893..dba9b48e1a 100644
> > > > --- a/IntelFsp2Pkg/Include/FspGlobalData.h
> > > > +++ b/IntelFsp2Pkg/Include/FspGlobalData.h
> > > > @@ -52,12 +52,20 @@ typedef struct  {
> > > >     VOID               *MemoryInitUpdPtr;
> > > >     VOID               *SiliconInitUpdPtr;
> > > >     UINT8              ApiIdx;
> > > > -   UINT8              FspMode; // 0: FSP in API mode; 1: FSP in
> > > DISPATCH mode
> > > > +   ///
> > > > +   /// 0: FSP in API mode; 1: FSP in DISPATCH mode
> > > > +   ///
> > > > +   UINT8              FspMode;
> > > >     UINT8              OnSeparateStack;
> > > >     UINT8              Reserved3;
> > > >     UINT32             NumberOfPhases;
> > > >     UINT32             PhasesExecuted;
> > > > -   UINT8              Reserved4[20];
> > > > +   ///
> > > > +   /// To store function parameters pointer
> > > > +   /// so it can be retrieved after stack switched.
> > > > +   ///
> > > > +   VOID               *FunctionParameterPtr;
> > > > +   UINT8              Reserved4[16];
> > > >     UINT32             PerfSig;
> > > >     UINT16             PerfLen;
> > > >     UINT16             Reserved5;
> > > > diff --git a/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > > > b/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > > > index 0c76e9f022..bed2a5d677 100644
> > > > --- a/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > > > +++ b/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > > > @@ -1,6 +1,6 @@
> > > >  /** @file
> > > >
> > > > -  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
> > > > +  Copyright (c) 2014 - 2020, Intel Corporation. All rights
> > > > + reserved.<BR>
> > > >    SPDX-License-Identifier: BSD-2-Clause-Patent
> > > >
> > > >  **/
> > > > @@ -36,4 +36,20 @@ Pei2LoaderSwitchStack (
> > > >    VOID
> > > >    );
> > > >
> > > > +/**
> > > > +
> > > > +  This function is equilivant to Pei2LoaderSwitchStack () but
> > > > + just indicates  the stack after switched is FSP stack.
> > > > +
> > > > +  @return ReturnKey          After switching to the saved stack,
> > > > +                             this value will be saved in eax
> > > > + before
> > > returning.
> > > > +
> > > > +
> > > > +**/
> > > > +UINT32
> > > > +EFIAPI
> > > > +Loader2PeiSwitchStack (
> > > > +  VOID
> > > > +  );
> > > > +
> > > >  #endif
> > > > --
> > > > 2.13.3.windows.1


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

* Re: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to FspGlobalData.
  2020-05-20  4:33       ` Zeng, Star
@ 2020-05-20  7:03         ` Chiu, Chasel
  0 siblings, 0 replies; 6+ messages in thread
From: Chiu, Chasel @ 2020-05-20  7:03 UTC (permalink / raw)
  To: Zeng, Star, Desimone, Nathaniel L, devel@edk2.groups.io; +Cc: Ma, Maurice


Thanks!

> -----Original Message-----
> From: Zeng, Star <star.zeng@intel.com>
> Sent: Wednesday, May 20, 2020 12:34 PM
> To: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; devel@edk2.groups.io
> Cc: Ma, Maurice <maurice.ma@intel.com>; Zeng, Star <star.zeng@intel.com>
> Subject: RE: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to
> FspGlobalData.
> 
> No need to resend new patch, you can go ahead with Nate's review after the
> correction.
> 
> > -----Original Message-----
> > From: Chiu, Chasel <chasel.chiu@intel.com>
> > Sent: Wednesday, May 20, 2020 12:25 PM
> > To: Zeng, Star <star.zeng@intel.com>; Desimone, Nathaniel L
> > <nathaniel.l.desimone@intel.com>; devel@edk2.groups.io
> > Cc: Ma, Maurice <maurice.ma@intel.com>
> > Subject: RE: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to
> > FspGlobalData.
> >
> >
> > Yes, thanks for good catch! I will correct it.
> >
> > > -----Original Message-----
> > > From: Zeng, Star <star.zeng@intel.com>
> > > Sent: Wednesday, May 20, 2020 12:21 PM
> > > To: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Chiu,
> > > Chasel <chasel.chiu@intel.com>; devel@edk2.groups.io
> > > Cc: Ma, Maurice <maurice.ma@intel.com>; Zeng, Star
> > > <star.zeng@intel.com>
> > > Subject: RE: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to
> > > FspGlobalData.
> > >
> > > equilivant is a typo?
> > >
> > > > -----Original Message-----
> > > > From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
> > > > Sent: Wednesday, May 20, 2020 12:12 PM
> > > > To: Chiu, Chasel <chasel.chiu@intel.com>; devel@edk2.groups.io
> > > > Cc: Ma, Maurice <maurice.ma@intel.com>; Zeng, Star
> > > > <star.zeng@intel.com>
> > > > Subject: RE: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to
> > > > FspGlobalData.
> > > >
> > > > Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
> > > >
> > > > > -----Original Message-----
> > > > > From: Chiu, Chasel <chasel.chiu@intel.com>
> > > > > Sent: Tuesday, May 19, 2020 8:34 PM
> > > > > To: devel@edk2.groups.io
> > > > > Cc: Ma, Maurice <maurice.ma@intel.com>; Desimone, Nathaniel L
> > > > > <nathaniel.l.desimone@intel.com>; Zeng, Star
> > > > > <star.zeng@intel.com>
> > > > > Subject: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to
> > > FspGlobalData.
> > > > >
> > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2726
> > > > >
> > > > > When FSP switching stack and calling bootloader functions, the
> > > > > function parameter in stack may not be accessible easily.
> > > > > We can store the function parameter pointer to FspGlobalData and
> > > > > retrieve it after stack switched.
> > > > >
> > > > > Also need to add Loader2PeiSwitchStack () to header file as
> > > > > public function for platform FSP code to consume.
> > > > >
> > > > > Cc: Maurice Ma <maurice.ma@intel.com>
> > > > > Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> > > > > Cc: Star Zeng <star.zeng@intel.com>
> > > > > Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
> > > > > ---
> > > > >  IntelFsp2Pkg/Include/FspGlobalData.h             | 12
> > > ++++++++++--
> > > > >  IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h | 18
> > > > > +++++++++++++++++-
> > > > >  2 files changed, 27 insertions(+), 3 deletions(-)
> > > > >
> > > > > diff --git a/IntelFsp2Pkg/Include/FspGlobalData.h
> > > > > b/IntelFsp2Pkg/Include/FspGlobalData.h
> > > > > index 5bde316893..dba9b48e1a 100644
> > > > > --- a/IntelFsp2Pkg/Include/FspGlobalData.h
> > > > > +++ b/IntelFsp2Pkg/Include/FspGlobalData.h
> > > > > @@ -52,12 +52,20 @@ typedef struct  {
> > > > >     VOID               *MemoryInitUpdPtr;
> > > > >     VOID               *SiliconInitUpdPtr;
> > > > >     UINT8              ApiIdx;
> > > > > -   UINT8              FspMode; // 0: FSP in API mode; 1: FSP in
> > > > DISPATCH mode
> > > > > +   ///
> > > > > +   /// 0: FSP in API mode; 1: FSP in DISPATCH mode
> > > > > +   ///
> > > > > +   UINT8              FspMode;
> > > > >     UINT8              OnSeparateStack;
> > > > >     UINT8              Reserved3;
> > > > >     UINT32             NumberOfPhases;
> > > > >     UINT32             PhasesExecuted;
> > > > > -   UINT8              Reserved4[20];
> > > > > +   ///
> > > > > +   /// To store function parameters pointer
> > > > > +   /// so it can be retrieved after stack switched.
> > > > > +   ///
> > > > > +   VOID               *FunctionParameterPtr;
> > > > > +   UINT8              Reserved4[16];
> > > > >     UINT32             PerfSig;
> > > > >     UINT16             PerfLen;
> > > > >     UINT16             Reserved5;
> > > > > diff --git a/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > > > > b/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > > > > index 0c76e9f022..bed2a5d677 100644
> > > > > --- a/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > > > > +++ b/IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h
> > > > > @@ -1,6 +1,6 @@
> > > > >  /** @file
> > > > >
> > > > > -  Copyright (c) 2014, Intel Corporation. All rights
> > > > > reserved.<BR>
> > > > > +  Copyright (c) 2014 - 2020, Intel Corporation. All rights
> > > > > + reserved.<BR>
> > > > >    SPDX-License-Identifier: BSD-2-Clause-Patent
> > > > >
> > > > >  **/
> > > > > @@ -36,4 +36,20 @@ Pei2LoaderSwitchStack (
> > > > >    VOID
> > > > >    );
> > > > >
> > > > > +/**
> > > > > +
> > > > > +  This function is equilivant to Pei2LoaderSwitchStack () but
> > > > > + just indicates  the stack after switched is FSP stack.
> > > > > +
> > > > > +  @return ReturnKey          After switching to the saved stack,
> > > > > +                             this value will be saved in eax
> > > > > + before
> > > > returning.
> > > > > +
> > > > > +
> > > > > +**/
> > > > > +UINT32
> > > > > +EFIAPI
> > > > > +Loader2PeiSwitchStack (
> > > > > +  VOID
> > > > > +  );
> > > > > +
> > > > >  #endif
> > > > > --
> > > > > 2.13.3.windows.1


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

end of thread, other threads:[~2020-05-20  7:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-20  3:33 [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to FspGlobalData Chiu, Chasel
2020-05-20  4:12 ` Nate DeSimone
2020-05-20  4:20   ` Zeng, Star
2020-05-20  4:25     ` Chiu, Chasel
2020-05-20  4:33       ` Zeng, Star
2020-05-20  7:03         ` Chiu, Chasel

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