Revision: 17248
          http://sourceforge.net/p/edk2/code/17248
Author:   jyao1
Date:     2015-04-29 03:10:24 +0000 (Wed, 29 Apr 2015)
Log Message:
-----------
Add dual FSP binaries support.

There are two FSP images at different locations in a flash (one factory version 
is read only and other in updatable version)
TempRamInit, FspMemoryInit and TempRamExit are executed from factory version 
and FspSiliconInit/NotifyPhase will be executed from updatable version.

Also update FSP specification version to v1.1.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Ma, Maurice" <[email protected]>
Reviewed-by: "Yao, Jiewen" <[email protected]>

Modified Paths:
--------------
    trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.asm
    trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.s
    trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspHelper.asm
    trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspHelper.s
    trunk/edk2/IntelFspPkg/Include/FspApi.h
    trunk/edk2/IntelFspPkg/Include/FspInfoHeader.h
    trunk/edk2/IntelFspPkg/Include/Guid/FspHeaderFile.h
    trunk/edk2/IntelFspPkg/Include/Guid/GuidHobFspEas.h
    trunk/edk2/IntelFspPkg/Include/Library/FspCommonLib.h
    trunk/edk2/IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c
    trunk/edk2/IntelFspPkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
    trunk/edk2/IntelFspPkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s

Modified: trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.asm
===================================================================
--- trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.asm      2015-04-29 
02:44:42 UTC (rev 17247)
+++ trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.asm      2015-04-29 
03:10:24 UTC (rev 17248)
@@ -38,8 +38,9 @@
 ; Following functions will be provided in PlatformSecLib
 ;
 EXTERN   GetFspBaseAddress:PROC
+EXTERN   GetFspInfoHdr:PROC
 EXTERN   GetBootFirmwareVolumeOffset:PROC
-EXTERN   Pei2LoaderSwitchStack:PROC
+EXTERN   Loader2PeiSwitchStack:PROC
 EXTERN   LoadMicrocode(LoadMicrocodeDefault):PROC
 EXTERN   SecPlatformInit(SecPlatformInitDefault):PROC
 EXTERN   SecCarInit:PROC
@@ -370,8 +371,7 @@
   jz        NemInitExit
 
   ;
-  ; CPUID/DeviceID check
-  ; and Sec Platform Init
+  ; Sec Platform Init
   ;
   CALL_MMX  SecPlatformInit
   cmp       eax, 0
@@ -505,19 +505,29 @@
   jz     @F
   cmp    eax, 3   ; FspMemoryInit API
   jz     @F
-  jmp    Pei2LoaderSwitchStack
 
+  call   GetFspInfoHdr
+  jmp    Loader2PeiSwitchStack
+
 @@:
   ;
   ; FspInit and FspMemoryInit APIs, setup the initial stack frame
   ;
   
   ;
-  ; Store the address in FSP which will return control to the BL
+  ; Place holder to store the FspInfoHeader pointer
   ;
-  push   offset exit
+  push   eax
 
   ;
+  ; Update the FspInfoHeader pointer
+  ;
+  push   eax
+  call   GetFspInfoHdr
+  mov    [esp + 4], eax
+  pop    eax
+
+  ;
   ; Create a Task Frame in the stack for the Boot Loader
   ;
   pushfd     ; 2 pushf for 4 byte alignment
@@ -582,7 +592,7 @@
   ; Pass Control into the PEI Core
   ;
   call    SecStartup
-
+  add     esp, 4
 exit:
   ret
 

Modified: trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.s
===================================================================
--- trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.s        2015-04-29 
02:44:42 UTC (rev 17247)
+++ trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.s        2015-04-29 
03:10:24 UTC (rev 17248)
@@ -215,8 +215,10 @@
 #
 # Following functions will be provided in PlatformSecLib
 #
+ASM_GLOBAL    ASM_PFX(GetFspBaseAddress)
+ASM_GLOBAL    ASM_PFX(GetFspInfoHdr)
 ASM_GLOBAL    ASM_PFX(GetBootFirmwareVolumeOffset)
-ASM_GLOBAL    ASM_PFX(Pei2LoaderSwitchStack)
+ASM_GLOBAL    ASM_PFX(Loader2PeiSwitchStack)
 
 
 #
@@ -561,8 +563,7 @@
   jz      NemInitExit
 
   #
-  # CPUID/DeviceID check
-  # and Sec Platform Init
+  # Sec Platform Init
   #
   movl    $TempRamInitApiL1, %esi            #CALL_MMX  SecPlatformInit
   movd    %esi, %mm7
@@ -717,7 +718,8 @@
   jz      FspApiCommonL2
   cmpl    $0x03, %eax                        # FspMemoryInit API
   jz      FspApiCommonL2
-  jmp     Pei2LoaderSwitchStack
+  call    ASM_PFX(GetFspInfoHdr)
+  jmp     Loader2PeiSwitchStack
 
 FspApiCommonL2:
   #
@@ -725,11 +727,19 @@
   #  
   
   #
-  # Store the address in FSP which will return control to the BL
+  # Place holder to store the FspInfoHeader pointer
   #
-  pushl   $FspApiCommonExit
+  pushl  %eax
 
   #
+  # Update the FspInfoHeader pointer
+  #
+  pushl  %eax
+  call   ASM_PFX(GetFspInfoHdr)
+  movl   %eax, 4(%esp)
+  popl   %eax
+
+  #
   # Create a Task Frame in the stack for the Boot Loader
   #
   pushfl                                     # 2 pushf for 4 byte alignment
@@ -796,7 +806,7 @@
   # Pass Control into the PEI Core
   #
   call    ASM_PFX(SecStartup)
-
+  addl    $4, %esp
 FspApiCommonExit:
   ret
 

Modified: trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspHelper.asm
===================================================================
--- trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspHelper.asm        2015-04-29 
02:44:42 UTC (rev 17247)
+++ trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspHelper.asm        2015-04-29 
03:10:24 UTC (rev 17248)
@@ -15,7 +15,7 @@
     .model  flat,C
     .code
 
-FspInfoHeaderRelativeOff    PROC      NEAR    PRIVATE
+FspInfoHeaderRelativeOff    PROC      NEAR    PUBLIC
    ;
    ; This value will be pached by the build script
    ;
@@ -30,4 +30,10 @@
    ret
 GetFspBaseAddress           ENDP
 
+GetFspInfoHdr               PROC      NEAR    PUBLIC
+   mov   eax, GetFspBaseAddress
+   sub   eax, dword ptr [FspInfoHeaderRelativeOff]
+   ret
+GetFspInfoHdr               ENDP
+
      END
\ No newline at end of file

Modified: trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspHelper.s
===================================================================
--- trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspHelper.s  2015-04-29 02:44:42 UTC 
(rev 17247)
+++ trunk/edk2/IntelFspPkg/FspSecCore/Ia32/FspHelper.s  2015-04-29 03:10:24 UTC 
(rev 17248)
@@ -31,3 +31,8 @@
    mov    (%eax), %eax
    ret
 
+ASM_GLOBAL ASM_PFX(GetFspInfoHdr)
+ASM_PFX(GetFspInfoHdr):
+   mov    $GetFspBaseAddress, %eax
+   sub    $FspInfoHeaderRelativeOff, %eax
+   ret

Modified: trunk/edk2/IntelFspPkg/Include/FspApi.h
===================================================================
--- trunk/edk2/IntelFspPkg/Include/FspApi.h     2015-04-29 02:44:42 UTC (rev 
17247)
+++ trunk/edk2/IntelFspPkg/Include/FspApi.h     2015-04-29 03:10:24 UTC (rev 
17248)
@@ -1,6 +1,6 @@
 /** @file
   Intel FSP API definition from Intel Firmware Support Package External
-  Architecture Specification, April 2014, revision 001.
+  Architecture Specification v1.1, April 2015, revision 001.
 
   Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials

Modified: trunk/edk2/IntelFspPkg/Include/FspInfoHeader.h
===================================================================
--- trunk/edk2/IntelFspPkg/Include/FspInfoHeader.h      2015-04-29 02:44:42 UTC 
(rev 17247)
+++ trunk/edk2/IntelFspPkg/Include/FspInfoHeader.h      2015-04-29 03:10:24 UTC 
(rev 17248)
@@ -1,6 +1,6 @@
 /** @file
   Intel FSP Info Header definition from Intel Firmware Support Package External
-  Architecture Specification, April 2014, revision 001.
+  Architecture Specification v1.1, April 2015, revision 001.
 
   Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials

Modified: trunk/edk2/IntelFspPkg/Include/Guid/FspHeaderFile.h
===================================================================
--- trunk/edk2/IntelFspPkg/Include/Guid/FspHeaderFile.h 2015-04-29 02:44:42 UTC 
(rev 17247)
+++ trunk/edk2/IntelFspPkg/Include/Guid/FspHeaderFile.h 2015-04-29 03:10:24 UTC 
(rev 17248)
@@ -1,8 +1,8 @@
 /** @file
   Intel FSP Header File Guid definition from Intel Firmware Support Package 
External
-  Architecture Specification, April 2014, revision 001.
+  Architecture Specification v1.1, April 2015, revision 001.
 
-  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at

Modified: trunk/edk2/IntelFspPkg/Include/Guid/GuidHobFspEas.h
===================================================================
--- trunk/edk2/IntelFspPkg/Include/Guid/GuidHobFspEas.h 2015-04-29 02:44:42 UTC 
(rev 17247)
+++ trunk/edk2/IntelFspPkg/Include/Guid/GuidHobFspEas.h 2015-04-29 03:10:24 UTC 
(rev 17248)
@@ -1,6 +1,6 @@
 /** @file
   Intel FSP Hob Guid definition from Intel Firmware Support Package External
-  Architecture Specification, April 2014, revision 001.
+  Architecture Specification v1.1, April 2015, revision 001.
 
   Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials

Modified: trunk/edk2/IntelFspPkg/Include/Library/FspCommonLib.h
===================================================================
--- trunk/edk2/IntelFspPkg/Include/Library/FspCommonLib.h       2015-04-29 
02:44:42 UTC (rev 17247)
+++ trunk/edk2/IntelFspPkg/Include/Library/FspCommonLib.h       2015-04-29 
03:10:24 UTC (rev 17248)
@@ -182,6 +182,17 @@
   );
 
 /**
+  This function gets the FSP info header pointer from the API context.
+
+  @retval FspInfoHeader   FSP info header pointer
+**/
+FSP_INFO_HEADER *
+EFIAPI
+GetFspInfoHeaderFromApiContext (
+  VOID
+  );
+
+/**
   This function gets the VPD data pointer.
 
   @return VpdDataRgnPtr   VPD data pointer.

Modified: trunk/edk2/IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c
===================================================================
--- trunk/edk2/IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c      
2015-04-29 02:44:42 UTC (rev 17247)
+++ trunk/edk2/IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c      
2015-04-29 03:10:24 UTC (rev 17248)
@@ -27,7 +27,7 @@
 //   API Parameter                +0x34
 //   API return address           +0x30
 //
-//   push    offset exit          +0x2C
+//   push    FspInfoHeader        +0x2C
 //   pushfd                       +0x28
 //   cli
 //   pushad                       +0x24
@@ -47,7 +47,7 @@
   UINT32    Ecx;
   UINT32    Eax;
   UINT16    Flags[2];
-  UINT32    ExitOff;
+  UINT32    FspInfoHeader;
   UINT32    ApiRet;
   UINT32    ApiParam;
 } CONTEXT_STACK;
@@ -332,6 +332,23 @@
 }
 
 /**
+  This function gets the FSP info header pointer using the API stack context.
+
+  @retval FspInfoHeader   FSP info header pointer using the API stack context
+**/
+FSP_INFO_HEADER *
+EFIAPI
+GetFspInfoHeaderFromApiContext (
+  VOID
+  )
+{
+  FSP_GLOBAL_DATA  *FspData;
+
+  FspData  = GetFspGlobalDataPointer ();
+  return  (FSP_INFO_HEADER *)(*(UINT32 *)(UINTN)(FspData->CoreStack + 
CONTEXT_STACK_OFFSET(FspInfoHeader)));
+}
+
+/**
   This function gets the VPD data pointer.
 
   @return VpdDataRgnPtr   VPD data pointer.

Modified: trunk/edk2/IntelFspPkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
===================================================================
--- trunk/edk2/IntelFspPkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm 
2015-04-29 02:44:42 UTC (rev 17247)
+++ trunk/edk2/IntelFspPkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm 
2015-04-29 03:10:24 UTC (rev 17248)
@@ -1,6 +1,6 @@
 ;------------------------------------------------------------------------------
 ;
-; Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
 ; This program and the accompanying materials
 ; are licensed and made available under the terms and conditions of the BSD 
License
 ; which accompanies this distribution.  The full text of the license may be 
found at
@@ -28,7 +28,8 @@
 ;------------------------------------------------------------------------------
 EXTERNDEF  C   MeasurePoint:PROC
 Pei2LoaderSwitchStack   PROC C PUBLIC
-    jmp     Loader2PeiSwitchStack
+    xor     eax, eax
+    jmp     FspSwitchStack
 Pei2LoaderSwitchStack   ENDP
 
 ;------------------------------------------------------------------------------
@@ -38,10 +39,21 @@
 ;   VOID
 ;   )
 ;------------------------------------------------------------------------------
+Loader2PeiSwitchStack   PROC C PUBLIC
+    jmp     FspSwitchStack
+Loader2PeiSwitchStack   ENDP
+
+;------------------------------------------------------------------------------
+; UINT32
+; EFIAPI
+; FspSwitchStack (
+;   VOID
+;   )
+;------------------------------------------------------------------------------
 EXTERNDEF  C   SwapStack:PROC
-Loader2PeiSwitchStack   PROC C PUBLIC
+FspSwitchStack   PROC C PUBLIC
     ; Save current contexts
-    push    offset exit
+    push    eax
     pushfd
     cli
     pushad
@@ -58,8 +70,8 @@
     add     esp, 8
     popad
     popfd
-exit:
+    add     esp, 4
     ret
-Loader2PeiSwitchStack   ENDP
+FspSwitchStack   ENDP
 
     END

Modified: trunk/edk2/IntelFspPkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s
===================================================================
--- trunk/edk2/IntelFspPkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s   
2015-04-29 02:44:42 UTC (rev 17247)
+++ trunk/edk2/IntelFspPkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s   
2015-04-29 03:10:24 UTC (rev 17248)
@@ -25,20 +25,33 @@
 #------------------------------------------------------------------------------
 ASM_GLOBAL ASM_PFX(Pei2LoaderSwitchStack)
 ASM_PFX(Pei2LoaderSwitchStack):
-    jmp     ASM_PFX(Loader2PeiSwitchStack)
+    xorl    %eax, %eax
+    jmp     ASM_PFX(FspSwitchStack)
 
 #------------------------------------------------------------------------------
 # UINT32
 # EFIAPI
 # Loader2PeiSwitchStack (
+#   VOID
 #   )
 #------------------------------------------------------------------------------
 ASM_GLOBAL ASM_PFX(Loader2PeiSwitchStack)
 ASM_PFX(Loader2PeiSwitchStack):
+    jmp     ASM_PFX(FspSwitchStack)
+
+#------------------------------------------------------------------------------
+# UINT32
+# EFIAPI
+# FspSwitchStack (
+#   VOID
+#   )
+#------------------------------------------------------------------------------
+ASM_GLOBAL ASM_PFX(FspSwitchStack)
+ASM_PFX(FspSwitchStack):
     #
     #Save current contexts
     #
-    push    $exit
+    push    %eax
     pushf
     cli
     pusha
@@ -59,7 +72,7 @@
     add     $0x08,%esp
     popa
     popf
-exit:
+    add     $0x04,%esp
     ret
 
 


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to