[edk2-devel] [PATCH] IntelFsp2Pkg: FSP should support input UPD as NULL.

Chiu, Chasel posted 1 patch 1 year, 6 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
IntelFsp2Pkg/FspSecCore/SecFspApiChk.c         | 11 +++++++++--
IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm |  8 --------
IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm  |  7 -------
3 files changed, 9 insertions(+), 17 deletions(-)
[edk2-devel] [PATCH] IntelFsp2Pkg: FSP should support input UPD as NULL.
Posted by Chiu, Chasel 1 year, 6 months ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4114
FSP specification supports input UPD as NULL cases which FSP will
use built-in UPD region instead.
FSP should not return INVALID_PARAMETER in such cases.

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/FspSecCore/SecFspApiChk.c         | 11 +++++++++--
 IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm |  8 --------
 IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm  |  7 -------
 3 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c b/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c
index a44fbf2a50..bfbdf70083 100644
--- a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c
+++ b/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c
@@ -44,6 +44,8 @@ FspApiCallingCheck (
     //
     if (((UINTN)FspData != MAX_ADDRESS) && ((UINTN)FspData != MAX_UINT32)) {
       Status = EFI_UNSUPPORTED;
+    } else if (ApiParam == NULL) {
+      Status = EFI_SUCCESS;
     } else if (EFI_ERROR (FspUpdSignatureCheck (ApiIdx, ApiParam))) {
       Status = EFI_INVALID_PARAMETER;
     }
@@ -67,9 +69,12 @@ FspApiCallingCheck (
     } else {
       if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) {
         Status = EFI_UNSUPPORTED;
-      } else if (EFI_ERROR (FspUpdSignatureCheck (FspSiliconInitApiIndex, ApiParam))) {
-        Status = EFI_INVALID_PARAMETER;
       } else if (ApiIdx == FspSiliconInitApiIndex) {
+        if (ApiParam == NULL) {
+          Status = EFI_SUCCESS;
+        } else if (EFI_ERROR (FspUpdSignatureCheck (FspSiliconInitApiIndex, ApiParam))) {
+          Status = EFI_INVALID_PARAMETER;
+        }
         //
         // Reset MultiPhase NumberOfPhases to zero
         //
@@ -89,6 +94,8 @@ FspApiCallingCheck (
     } else {
       if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) {
         Status = EFI_UNSUPPORTED;
+      } else if (ApiParam == NULL) {
+        Status = EFI_SUCCESS;
       } else if (EFI_ERROR (FspUpdSignatureCheck (FspSmmInitApiIndex, ApiParam))) {
         Status = EFI_INVALID_PARAMETER;
       }
diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
index 61030a843b..52e1ff6f1f 100644
--- a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
+++ b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
@@ -555,14 +555,6 @@ ASM_PFX(TempRamInitApi):
   SAVE_EAX
   SAVE_EDX
 
-  ;
-  ; Check Parameter
-  ;
-  mov       eax, dword [esp + 4]
-  cmp       eax, 0
-  mov       eax, 80000002h
-  jz        TempRamInitExit
-
   ;
   ; Sec Platform Init
   ;
diff --git a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm
index 7dd89c531a..23bb2b0481 100644
--- a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm
+++ b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm
@@ -441,13 +441,6 @@ ASM_PFX(TempRamInitApi):
   or        rax, rdx
   SAVE_TS   rax
 
-  ;
-  ; Check Parameter
-  ;
-  cmp       rcx, 0
-  mov       rcx, 08000000000000002h
-  jz        TempRamInitExit
-
   ;
   ; Sec Platform Init
   ;
-- 
2.35.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95489): https://edk2.groups.io/g/devel/message/95489
Mute This Topic: https://groups.io/mt/94527493/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] IntelFsp2Pkg: FSP should support input UPD as NULL.
Posted by Nate DeSimone 1 year, 6 months ago
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

-----Original Message-----
From: Chiu, Chasel <chasel.chiu@intel.com> 
Sent: Sunday, October 23, 2022 9:05 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: [PATCH] IntelFsp2Pkg: FSP should support input UPD as NULL.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4114
FSP specification supports input UPD as NULL cases which FSP will use built-in UPD region instead.
FSP should not return INVALID_PARAMETER in such cases.

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/FspSecCore/SecFspApiChk.c         | 11 +++++++++--
 IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm |  8 --------  IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm  |  7 -------
 3 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c b/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c
index a44fbf2a50..bfbdf70083 100644
--- a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c
+++ b/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c
@@ -44,6 +44,8 @@ FspApiCallingCheck (
     //     if (((UINTN)FspData != MAX_ADDRESS) && ((UINTN)FspData != MAX_UINT32)) {       Status = EFI_UNSUPPORTED;+    } else if (ApiParam == NULL) {+      Status = EFI_SUCCESS;     } else if (EFI_ERROR (FspUpdSignatureCheck (ApiIdx, ApiParam))) {       Status = EFI_INVALID_PARAMETER;     }@@ -67,9 +69,12 @@ FspApiCallingCheck (
     } else {       if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) {         Status = EFI_UNSUPPORTED;-      } else if (EFI_ERROR (FspUpdSignatureCheck (FspSiliconInitApiIndex, ApiParam))) {-        Status = EFI_INVALID_PARAMETER;       } else if (ApiIdx == FspSiliconInitApiIndex) {+        if (ApiParam == NULL) {+          Status = EFI_SUCCESS;+        } else if (EFI_ERROR (FspUpdSignatureCheck (FspSiliconInitApiIndex, ApiParam))) {+          Status = EFI_INVALID_PARAMETER;+        }         //         // Reset MultiPhase NumberOfPhases to zero         //@@ -89,6 +94,8 @@ FspApiCallingCheck (
     } else {       if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) {         Status = EFI_UNSUPPORTED;+      } else if (ApiParam == NULL) {+        Status = EFI_SUCCESS;       } else if (EFI_ERROR (FspUpdSignatureCheck (FspSmmInitApiIndex, ApiParam))) {         Status = EFI_INVALID_PARAMETER;       }diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
index 61030a843b..52e1ff6f1f 100644
--- a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
+++ b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
@@ -555,14 +555,6 @@ ASM_PFX(TempRamInitApi):
   SAVE_EAX   SAVE_EDX -  ;-  ; Check Parameter-  ;-  mov       eax, dword [esp + 4]-  cmp       eax, 0-  mov       eax, 80000002h-  jz        TempRamInitExit-   ;   ; Sec Platform Init   ;diff --git a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm
index 7dd89c531a..23bb2b0481 100644
--- a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm
+++ b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm
@@ -441,13 +441,6 @@ ASM_PFX(TempRamInitApi):
   or        rax, rdx   SAVE_TS   rax -  ;-  ; Check Parameter-  ;-  cmp       rcx, 0-  mov       rcx, 08000000000000002h-  jz        TempRamInitExit-   ;   ; Sec Platform Init   ;-- 
2.35.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95540): https://edk2.groups.io/g/devel/message/95540
Mute This Topic: https://groups.io/mt/94527493/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-