Re: [edk2-devel] [PATCH v2 2/4] IntelFsp2WrapperPkg: Add FSP 2.4 MultiPhase interface.

2022-08-30 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

> -Original Message-
> From: Chiu, Chasel 
> Sent: Tuesday, August 9, 2022 5:48 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> ; Zeng, Star 
> Subject: [PATCH v2 2/4] IntelFsp2WrapperPkg: Add FSP 2.4 MultiPhase
> interface.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3916
> 
> Provide FSP 2.4 MultiPhase wrapper support library.
> 
> Cc: Nate DeSimone 
> Cc: Star Zeng 
> Signed-off-by: Chasel Chiu 
> ---
> 
> IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformMultiPhaseLibSampl
> e/FspWrapperPlatformMultiPhaseLibSample.c   |  49
> +
> 
> IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWra
> pperMultiPhaseProcessLib.c  | 355
> ++
> ++
> ++
> ++
> ++
> ++
> +++
>  IntelFsp2WrapperPkg/Include/Library/FspWrapperMultiPhaseProcessLib.h
> |  62
> ++
> 
>  IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec
> |  10 +-
>  IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
> |   6 +-
> 
> IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformMultiPhaseLibSampl
> e/BaseFspWrapperPlatformMultiPhaseLibSample.inf |  37
> +
> 
> IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/FspWrappe
> rMultiPhaseProcessLib.inf   |  48
> 
>  7 files changed, 565 insertions(+), 2 deletions(-)
> 
> diff --git
> a/IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformMultiPhaseLibSam
> ple/FspWrapperPlatformMultiPhaseLibSample.c
> b/IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformMultiPhaseLibSam
> ple/FspWrapperPlatformMultiPhaseLibSample.c
> new file mode 100644
> index 00..ef8819203d
> --- /dev/null
> +++
> b/IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformMultiPhaseLibSam
> ple/FspWrapperPlatformMultiPhaseLibSample.c
> @@ -0,0 +1,49 @@
> +/** @file
> 
> +  Support FSP MultiPhase process.
> 
> +
> 
> +  Copyright (c) 2022, Intel Corporation. All rights reserved.
> 
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +
> 
> +**/
> 
> +
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +
> 
> +/**
> 
> +  FSP Wrapper Platform MultiPhase Handler
> 
> +
> 
> +  @param[in] FspHobListPtr- Pointer to FSP HobList (valid after FSP-M
> completed)
> 
> +  @param[in] ComponentIndex   - FSP Component which executing
> MultiPhase initialization.
> 
> +  @param[in] PhaseIndex   - Indicates current execution phase of FSP
> MultiPhase initialization.
> 
> +
> 
> +  @retval EFI_STATUSAlways return EFI_SUCCESS
> 
> +
> 
> +**/
> 
> +VOID
> 
> +EFIAPI
> 
> +FspWrapperPlatformMultiPhaseHandler (
> 
> +  IN OUT VOID  **FspHobListPtr,
> 
> +  IN UINT8 ComponentIndex,
> 
> +  IN UINT32PhaseIndex
> 
> +  )
> 
> +{
> 
> +  /* Example platform actions as below
> 
> +  switch (ComponentIndex) {
> 
> +  case FspMultiPhaseMemInitApiIndex:
> 
> +switch (PhaseIndex) {
> 
> +  case 1:
> 
> +PlatformAction1 ();
> 
> +  break;
> 
> +}
> 
> +break;
> 
> +  case FspMultiPhaseSiInitApiIndex:
> 
> +switch (PhaseIndex) {
> 
> +  case 1:
> 
> +PlatformAction2 ();
> 
> +  break;
> 
> +}
> 
> +break;
> 
> +  }
> 
> +  */
> 
> +}
> 
> diff --git
> a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWr
> apperMultiPhaseProcessLib.c
> b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspW
> rapperMultiPhaseProcessLib.c
> new file mode 100644
> index 00..c29a8277df
> --- /dev/null
> +++
> b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspW
> rapperMultiPhaseProcessLib.c
> @@ -0,0 +1,355 @@
> +/** @file
> 
> +  Support FSP MultiPhase process.
> 
> +
> 
> +  Copyright (c) 2022, Intel Corporation. All rights reserved.
> 
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +
> 
> +**/
> 
> +
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +
> 
> +/**
> 
> +  Execute 32-bit FSP API entry code.
> 
> +
> 
> +  @param[in] Function The 32bit code entry to be executed.
> 
> +  @param[in] Param1   The first parameter to pass to 32bit code.
> 
> +  @param[in] Param2   The second parameter to pass to 32bit code.
> 
> +
> 
> +  @return EFI_STATUS.
> 
> +**/
> 
> +EFI_STATUS
> 
> +Execute32BitCode (
> 
> +  IN UINT64  Function,
> 
> +  IN UINT64  Param1,
> 
> +  IN UINT64  Param2
> 
> +  );
> 
> +
> 
> +/**
> 
> +  Execute 64-bit FSP 

[edk2-devel] [PATCH v2 2/4] IntelFsp2WrapperPkg: Add FSP 2.4 MultiPhase interface.

2022-08-09 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3916

Provide FSP 2.4 MultiPhase wrapper support library.

Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Chasel Chiu 
---
 
IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformMultiPhaseLibSample/FspWrapperPlatformMultiPhaseLibSample.c
   |  49 +
 
IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
  | 355 
+++
 IntelFsp2WrapperPkg/Include/Library/FspWrapperMultiPhaseProcessLib.h   
 |  62 
++
 IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec
 |  10 +-
 IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
 |   6 +-
 
IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformMultiPhaseLibSample/BaseFspWrapperPlatformMultiPhaseLibSample.inf
 |  37 +
 
IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/FspWrapperMultiPhaseProcessLib.inf
   |  48 
 7 files changed, 565 insertions(+), 2 deletions(-)

diff --git 
a/IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformMultiPhaseLibSample/FspWrapperPlatformMultiPhaseLibSample.c
 
b/IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformMultiPhaseLibSample/FspWrapperPlatformMultiPhaseLibSample.c
new file mode 100644
index 00..ef8819203d
--- /dev/null
+++ 
b/IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformMultiPhaseLibSample/FspWrapperPlatformMultiPhaseLibSample.c
@@ -0,0 +1,49 @@
+/** @file
+  Support FSP MultiPhase process.
+
+  Copyright (c) 2022, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+
+/**
+  FSP Wrapper Platform MultiPhase Handler
+
+  @param[in] FspHobListPtr- Pointer to FSP HobList (valid after FSP-M 
completed)
+  @param[in] ComponentIndex   - FSP Component which executing MultiPhase 
initialization.
+  @param[in] PhaseIndex   - Indicates current execution phase of FSP 
MultiPhase initialization.
+
+  @retval EFI_STATUSAlways return EFI_SUCCESS
+
+**/
+VOID
+EFIAPI
+FspWrapperPlatformMultiPhaseHandler (
+  IN OUT VOID  **FspHobListPtr,
+  IN UINT8 ComponentIndex,
+  IN UINT32PhaseIndex
+  )
+{
+  /* Example platform actions as below
+  switch (ComponentIndex) {
+  case FspMultiPhaseMemInitApiIndex:
+switch (PhaseIndex) {
+  case 1:
+PlatformAction1 ();
+  break;
+}
+break;
+  case FspMultiPhaseSiInitApiIndex:
+switch (PhaseIndex) {
+  case 1:
+PlatformAction2 ();
+  break;
+}
+break;
+  }
+  */
+}
diff --git 
a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
 
b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
new file mode 100644
index 00..c29a8277df
--- /dev/null
+++ 
b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
@@ -0,0 +1,355 @@
+/** @file
+  Support FSP MultiPhase process.
+
+  Copyright (c) 2022, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+  Execute 32-bit FSP API entry code.
+
+  @param[in] Function The 32bit code entry to be executed.
+  @param[in] Param1   The first parameter to pass to 32bit code.
+  @param[in] Param2   The second parameter to pass to 32bit code.
+
+  @return EFI_STATUS.
+**/
+EFI_STATUS
+Execute32BitCode (
+  IN UINT64  Function,
+  IN UINT64  Param1,
+  IN UINT64  Param2
+  );
+
+/**
+  Execute 64-bit FSP API entry code.
+
+  @param[in] Function The 64bit code entry to be executed.
+  @param[in] Param1   The first parameter to pass to 64bit code.
+  @param[in] Param2   The second parameter to pass to 64bit code.
+
+  @return EFI_STATUS.
+**/
+EFI_STATUS
+Execute64BitCode (
+  IN UINT64  Function,
+  IN UINT64  Param1,
+  IN UINT64  Param2
+  );
+
+/**
+  Call FspsMultiPhase API.
+
+  @param[in] FspsMultiPhaseParams - Parameters for MultiPhase API.
+  @param[in] FspHobListPtr- Pointer to FSP HobList (valid after FSP-M 
completed)
+  @param[in] ComponentIndex   - FSP Component which executing MultiPhase 
initialization.
+
+