]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add dual FSP binaries support.
authorMa, Maurice <maurice.ma@intel.com>
Wed, 29 Apr 2015 03:10:24 +0000 (03:10 +0000)
committerjyao1 <jyao1@Edk2>
Wed, 29 Apr 2015 03:10:24 +0000 (03:10 +0000)
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" <maurice.ma@intel.com>
Reviewed-by: "Yao, Jiewen" <Jiewen.Yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17248 6f19259b-4bc3-4df7-8a09-765794883524

12 files changed:
IntelFspPkg/FspSecCore/Ia32/FspApiEntry.asm
IntelFspPkg/FspSecCore/Ia32/FspApiEntry.s
IntelFspPkg/FspSecCore/Ia32/FspHelper.asm
IntelFspPkg/FspSecCore/Ia32/FspHelper.s
IntelFspPkg/Include/FspApi.h
IntelFspPkg/Include/FspInfoHeader.h
IntelFspPkg/Include/Guid/FspHeaderFile.h
IntelFspPkg/Include/Guid/GuidHobFspEas.h
IntelFspPkg/Include/Library/FspCommonLib.h
IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c
IntelFspPkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
IntelFspPkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s

index 01b0bfab313e694e0825c2e3ee787b93c23d1214..d736f8035895afd3042360f9043970f8873f7933 100644 (file)
@@ -38,8 +38,9 @@ EXTERN   FspApiCallingCheck:PROC
 ; Following functions will be provided in PlatformSecLib\r
 ;\r
 EXTERN   GetFspBaseAddress:PROC\r
+EXTERN   GetFspInfoHdr:PROC\r
 EXTERN   GetBootFirmwareVolumeOffset:PROC\r
-EXTERN   Pei2LoaderSwitchStack:PROC\r
+EXTERN   Loader2PeiSwitchStack:PROC\r
 EXTERN   LoadMicrocode(LoadMicrocodeDefault):PROC\r
 EXTERN   SecPlatformInit(SecPlatformInitDefault):PROC\r
 EXTERN   SecCarInit:PROC\r
@@ -370,8 +371,7 @@ TempRamInitApi   PROC    NEAR    PUBLIC
   jz        NemInitExit\r
 \r
   ;\r
-  ; CPUID/DeviceID check\r
-  ; and Sec Platform Init\r
+  ; Sec Platform Init\r
   ;\r
   CALL_MMX  SecPlatformInit\r
   cmp       eax, 0\r
@@ -505,7 +505,9 @@ FspApiCommon   PROC C PUBLIC
   jz     @F\r
   cmp    eax, 3   ; FspMemoryInit API\r
   jz     @F\r
-  jmp    Pei2LoaderSwitchStack\r
+\r
+  call   GetFspInfoHdr\r
+  jmp    Loader2PeiSwitchStack\r
 \r
 @@:\r
   ;\r
@@ -513,9 +515,17 @@ FspApiCommon   PROC C PUBLIC
   ;\r
   \r
   ;\r
-  ; Store the address in FSP which will return control to the BL\r
+  ; Place holder to store the FspInfoHeader pointer\r
   ;\r
-  push   offset exit\r
+  push   eax\r
+\r
+  ;\r
+  ; Update the FspInfoHeader pointer\r
+  ;\r
+  push   eax\r
+  call   GetFspInfoHdr\r
+  mov    [esp + 4], eax\r
+  pop    eax\r
 \r
   ;\r
   ; Create a Task Frame in the stack for the Boot Loader\r
@@ -582,7 +592,7 @@ FspApiCommon   PROC C PUBLIC
   ; Pass Control into the PEI Core\r
   ;\r
   call    SecStartup\r
-\r
+  add     esp, 4\r
 exit:\r
   ret\r
 \r
index 1d8fe0bcd299e821f9c4e289ededd349bb14d22a..d0f5b20b96dcd9b40737e3a1ea5e5a8550878724 100644 (file)
@@ -215,8 +215,10 @@ ASM_GLOBAL    ASM_PFX(FspApiCallingCheck)
 #\r
 # Following functions will be provided in PlatformSecLib\r
 #\r
+ASM_GLOBAL    ASM_PFX(GetFspBaseAddress)\r
+ASM_GLOBAL    ASM_PFX(GetFspInfoHdr)\r
 ASM_GLOBAL    ASM_PFX(GetBootFirmwareVolumeOffset)\r
-ASM_GLOBAL    ASM_PFX(Pei2LoaderSwitchStack)\r
+ASM_GLOBAL    ASM_PFX(Loader2PeiSwitchStack)\r
 \r
 \r
 #\r
@@ -561,8 +563,7 @@ ASM_PFX(TempRamInitApi):
   jz      NemInitExit\r
 \r
   #\r
-  # CPUID/DeviceID check\r
-  # and Sec Platform Init\r
+  # Sec Platform Init\r
   #\r
   movl    $TempRamInitApiL1, %esi            #CALL_MMX  SecPlatformInit\r
   movd    %esi, %mm7\r
@@ -717,7 +718,8 @@ FspApiCommonL1:
   jz      FspApiCommonL2\r
   cmpl    $0x03, %eax                        # FspMemoryInit API\r
   jz      FspApiCommonL2\r
-  jmp     Pei2LoaderSwitchStack\r
+  call    ASM_PFX(GetFspInfoHdr)\r
+  jmp     Loader2PeiSwitchStack\r
 \r
 FspApiCommonL2:\r
   #\r
@@ -725,9 +727,17 @@ FspApiCommonL2:
   #  \r
   \r
   #\r
-  # Store the address in FSP which will return control to the BL\r
+  # Place holder to store the FspInfoHeader pointer\r
   #\r
-  pushl   $FspApiCommonExit\r
+  pushl  %eax\r
+\r
+  #\r
+  # Update the FspInfoHeader pointer\r
+  #\r
+  pushl  %eax\r
+  call   ASM_PFX(GetFspInfoHdr)\r
+  movl   %eax, 4(%esp)\r
+  popl   %eax\r
 \r
   #\r
   # Create a Task Frame in the stack for the Boot Loader\r
@@ -796,7 +806,7 @@ FspApiCommonL2:
   # Pass Control into the PEI Core\r
   #\r
   call    ASM_PFX(SecStartup)\r
-\r
+  addl    $4, %esp\r
 FspApiCommonExit:\r
   ret\r
 \r
index 51fd365c95871ed183077397f18fd21f26c5dba7..655481c14f9b2d1aec59ac75429083753c8e74a7 100644 (file)
@@ -15,7 +15,7 @@
     .model  flat,C\r
     .code\r
 \r
-FspInfoHeaderRelativeOff    PROC      NEAR    PRIVATE\r
+FspInfoHeaderRelativeOff    PROC      NEAR    PUBLIC\r
    ;\r
    ; This value will be pached by the build script\r
    ;\r
@@ -30,4 +30,10 @@ GetFspBaseAddress           PROC      NEAR    PUBLIC
    ret\r
 GetFspBaseAddress           ENDP\r
 \r
+GetFspInfoHdr               PROC      NEAR    PUBLIC\r
+   mov   eax, GetFspBaseAddress\r
+   sub   eax, dword ptr [FspInfoHeaderRelativeOff]\r
+   ret\r
+GetFspInfoHdr               ENDP\r
+\r
      END
\ No newline at end of file
index 40b822ac8712dd0fe1761bcd63d678d289b03e87..5d1bf74c30f4e4c2cf93beb21d4bd14f71319aff 100644 (file)
@@ -31,3 +31,8 @@ ASM_PFX(GetFspBaseAddress):
    mov    (%eax), %eax\r
    ret\r
 \r
+ASM_GLOBAL ASM_PFX(GetFspInfoHdr)\r
+ASM_PFX(GetFspInfoHdr):\r
+   mov    $GetFspBaseAddress, %eax\r
+   sub    $FspInfoHeaderRelativeOff, %eax\r
+   ret\r
index 8fd73fb44e2dde7b898bd19ab6f3278f1089033c..5404a84a2c62e4f6bd6ef436441fa8e4f8463b63 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
   Intel FSP API definition from Intel Firmware Support Package External\r
-  Architecture Specification, April 2014, revision 001.\r
+  Architecture Specification v1.1, April 2015, revision 001.\r
 \r
   Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
index f68cdfbd5ab8fc42e4fb064394e82e59f85d5a07..079ec98f96ca5fb31db17df9545a52f8d0ff92b7 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
   Intel FSP Info Header definition from Intel Firmware Support Package External\r
-  Architecture Specification, April 2014, revision 001.\r
+  Architecture Specification v1.1, April 2015, revision 001.\r
 \r
   Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
index 99023959356311373ef6fb0d46e606713aec58ef..b2d527fff0867d78a9532aeb94e033e0624a7c87 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Intel FSP Header File Guid definition from Intel Firmware Support Package External\r
-  Architecture Specification, April 2014, revision 001.\r
+  Architecture Specification v1.1, April 2015, revision 001.\r
 \r
-  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
index 4e723af2f48d9dbaa2aa3f7fee8b16cc6a4db3c4..5821ba39e0d2a88ddfd9a69c08bec4d67f489d0b 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
   Intel FSP Hob Guid definition from Intel Firmware Support Package External\r
-  Architecture Specification, April 2014, revision 001.\r
+  Architecture Specification v1.1, April 2015, revision 001.\r
 \r
   Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
index 22db27708d8ffad9afcfbbed9c7975751ddcb6df..eddebba1ea0bb5e688accb6c7051d59d4a64aab8 100644 (file)
@@ -181,6 +181,17 @@ GetFspInfoHeader (
   VOID\r
   );\r
 \r
+/**\r
+  This function gets the FSP info header pointer from the API context.\r
+\r
+  @retval FspInfoHeader   FSP info header pointer\r
+**/\r
+FSP_INFO_HEADER *\r
+EFIAPI\r
+GetFspInfoHeaderFromApiContext (\r
+  VOID\r
+  );\r
+\r
 /**\r
   This function gets the VPD data pointer.\r
 \r
index f80dff1a56b5cf3aaede8f134af927b2b55487f6..7de84a0a7e7db9f5d296d1dfdb7c6d959635bf93 100644 (file)
@@ -27,7 +27,7 @@
 //   API Parameter                +0x34\r
 //   API return address           +0x30\r
 //\r
-//   push    offset exit          +0x2C\r
+//   push    FspInfoHeader        +0x2C\r
 //   pushfd                       +0x28\r
 //   cli\r
 //   pushad                       +0x24\r
@@ -47,7 +47,7 @@ typedef struct {
   UINT32    Ecx;\r
   UINT32    Eax;\r
   UINT16    Flags[2];\r
-  UINT32    ExitOff;\r
+  UINT32    FspInfoHeader;\r
   UINT32    ApiRet;\r
   UINT32    ApiParam;\r
 } CONTEXT_STACK;\r
@@ -331,6 +331,23 @@ GetFspInfoHeader (
   return  GetFspGlobalDataPointer()->FspInfoHeader;\r
 }\r
 \r
+/**\r
+  This function gets the FSP info header pointer using the API stack context.\r
+\r
+  @retval FspInfoHeader   FSP info header pointer using the API stack context\r
+**/\r
+FSP_INFO_HEADER *\r
+EFIAPI\r
+GetFspInfoHeaderFromApiContext (\r
+  VOID\r
+  )\r
+{\r
+  FSP_GLOBAL_DATA  *FspData;\r
+\r
+  FspData  = GetFspGlobalDataPointer ();\r
+  return  (FSP_INFO_HEADER *)(*(UINT32 *)(UINTN)(FspData->CoreStack + CONTEXT_STACK_OFFSET(FspInfoHeader)));\r
+}\r
+\r
 /**\r
   This function gets the VPD data pointer.\r
 \r
index d04f229a6b41ba733b8c2ab2b48cbf8aaf7861a9..1efab520590bfc88e653fed765b3859b9f53a7f0 100644 (file)
@@ -1,6 +1,6 @@
 ;------------------------------------------------------------------------------\r
 ;\r
-; Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r
 ; This program and the accompanying materials\r
 ; are licensed and made available under the terms and conditions of the BSD License\r
 ; which accompanies this distribution.  The full text of the license may be found at\r
@@ -28,7 +28,8 @@
 ;------------------------------------------------------------------------------\r
 EXTERNDEF  C   MeasurePoint:PROC\r
 Pei2LoaderSwitchStack   PROC C PUBLIC\r
-    jmp     Loader2PeiSwitchStack\r
+    xor     eax, eax\r
+    jmp     FspSwitchStack\r
 Pei2LoaderSwitchStack   ENDP\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -38,10 +39,21 @@ Pei2LoaderSwitchStack   ENDP
 ;   VOID\r
 ;   )\r
 ;------------------------------------------------------------------------------\r
-EXTERNDEF  C   SwapStack:PROC\r
 Loader2PeiSwitchStack   PROC C PUBLIC\r
+    jmp     FspSwitchStack\r
+Loader2PeiSwitchStack   ENDP\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT32\r
+; EFIAPI\r
+; FspSwitchStack (\r
+;   VOID\r
+;   )\r
+;------------------------------------------------------------------------------\r
+EXTERNDEF  C   SwapStack:PROC\r
+FspSwitchStack   PROC C PUBLIC\r
     ; Save current contexts\r
-    push    offset exit\r
+    push    eax\r
     pushfd\r
     cli\r
     pushad\r
@@ -58,8 +70,8 @@ Loader2PeiSwitchStack   PROC C PUBLIC
     add     esp, 8\r
     popad\r
     popfd\r
-exit:\r
+    add     esp, 4\r
     ret\r
-Loader2PeiSwitchStack   ENDP\r
+FspSwitchStack   ENDP\r
 \r
     END\r
index 4773fe94c239b5f028845651cc7d1b3414deac4e..a21a5b6c61f8928cf550c2973d77253569286d13 100644 (file)
 #------------------------------------------------------------------------------\r
 ASM_GLOBAL ASM_PFX(Pei2LoaderSwitchStack)\r
 ASM_PFX(Pei2LoaderSwitchStack):\r
-    jmp     ASM_PFX(Loader2PeiSwitchStack)\r
+    xorl    %eax, %eax\r
+    jmp     ASM_PFX(FspSwitchStack)\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT32\r
 # EFIAPI\r
 # Loader2PeiSwitchStack (\r
+#   VOID\r
 #   )\r
 #------------------------------------------------------------------------------\r
 ASM_GLOBAL ASM_PFX(Loader2PeiSwitchStack)\r
 ASM_PFX(Loader2PeiSwitchStack):\r
+    jmp     ASM_PFX(FspSwitchStack)\r
+\r
+#------------------------------------------------------------------------------\r
+# UINT32\r
+# EFIAPI\r
+# FspSwitchStack (\r
+#   VOID\r
+#   )\r
+#------------------------------------------------------------------------------\r
+ASM_GLOBAL ASM_PFX(FspSwitchStack)\r
+ASM_PFX(FspSwitchStack):\r
     #\r
     #Save current contexts\r
     #\r
-    push    $exit\r
+    push    %eax\r
     pushf\r
     cli\r
     pusha\r
@@ -59,7 +72,7 @@ ASM_PFX(Loader2PeiSwitchStack):
     add     $0x08,%esp\r
     popa\r
     popf\r
-exit:\r
+    add     $0x04,%esp\r
     ret\r
 \r
 \r