]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFspPkg/FspSecCore/SecFsp.c
Update IntelFspPkg according to FSP1.1.
[mirror_edk2.git] / IntelFspPkg / FspSecCore / SecFsp.c
index 00eb224c6f0e553650f7d0ecb48fa0c5b07f643a..53ff8b7c0fc54ccf0cbb438c2c72ec250010d4c8 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\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
@@ -13,8 +13,6 @@
 \r
 #include "SecFsp.h"\r
 \r
-UINT32  FspImageSizeOffset = FSP_INFO_HEADER_OFF + OFFSET_IN_FSP_INFO_HEADER(ImageSize);\r
-\r
 /**\r
 \r
   Calculate the FSP IDT gate descriptor.\r
@@ -140,13 +138,15 @@ SecGetPlatformData (
   It needs to be done as soon as possible after the stack is setup.\r
 \r
   @param[in,out] PeiFspData             Pointer of the FSP global data.\r
-  @param[in]     BootFirmwareVolume     Point to the address of BootFirmwareVolume in stack.\r
+  @param[in]     BootloaderStack        Bootloader stack.\r
+  @param[in]     ApiIdx                 The index of the FSP API.\r
 \r
 **/\r
 VOID\r
 FspGlobalDataInit (\r
   IN OUT  FSP_GLOBAL_DATA    *PeiFspData,\r
-  IN      VOID              **BootFirmwareVolume\r
+  IN UINT32                   BootloaderStack,\r
+  IN UINT8                    ApiIdx\r
   )\r
 {\r
   VOID              *UpdDataRgnPtr;\r
@@ -162,7 +162,7 @@ FspGlobalDataInit (
   ZeroMem  ((VOID *)PeiFspData, sizeof(FSP_GLOBAL_DATA));\r
 \r
   PeiFspData->Signature          = FSP_GLOBAL_DATA_SIGNATURE;\r
-  PeiFspData->CoreStack          = *(UINTN *)(BootFirmwareVolume + 2);\r
+  PeiFspData->CoreStack          = BootloaderStack;\r
   PeiFspData->PerfIdx            = 2;\r
 \r
   SetFspMeasurePoint (FSP_PERF_ID_API_FSPINIT_ENTRY);\r
@@ -174,6 +174,11 @@ FspGlobalDataInit (
   PeiFspData->FspInfoHeader      = (FSP_INFO_HEADER *)(GetFspBaseAddress() + FSP_INFO_HEADER_OFF);\r
   SecGetPlatformData (PeiFspData);\r
 \r
+  //\r
+  // Set API calling mode\r
+  //\r
+  SetFspApiCallingMode (ApiIdx == 1 ? 0 : 1);\r
+\r
   //\r
   // Initialize UPD pointer.\r
   //\r
@@ -202,8 +207,13 @@ FspGlobalDataInit (
   }\r
   ImageId[Idx] = 0;\r
 \r
-  DEBUG ((DEBUG_INFO | DEBUG_INIT, "\n============= PEIM FSP  (%a 0x%08X) =============\n", \\r
-         ImageId, PeiFspData->FspInfoHeader->ImageRevision));\r
+  DEBUG ((DEBUG_INFO | DEBUG_INIT, "\n============= PEIM FSP v1.%x (%a v%x.%x.%x.%x) =============\n", \\r
+         PeiFspData->FspInfoHeader->HeaderRevision - 1, \\r
+         ImageId, \\r
+         (PeiFspData->FspInfoHeader->ImageRevision >> 24) & 0xff, \\r
+         (PeiFspData->FspInfoHeader->ImageRevision >> 16) & 0xff, \\r
+         (PeiFspData->FspInfoHeader->ImageRevision >> 8) & 0xff, \\r
+         (PeiFspData->FspInfoHeader->ImageRevision >> 0) & 0xff));\r
 \r
 }\r
 \r
@@ -260,6 +270,35 @@ FspApiCallingCheck (
         Status = EFI_UNSUPPORTED;\r
       }\r
     }\r
+  } else if (ApiIdx == 3) {\r
+    //\r
+    // FspMemoryInit check\r
+    //\r
+    if ((UINT32)FspData != 0xFFFFFFFF) {\r
+      Status = EFI_UNSUPPORTED;\r
+    }\r
+  } else if (ApiIdx == 4) {\r
+    //\r
+    // TempRamExit check\r
+    //\r
+    if ((FspData == NULL) || ((UINT32)FspData == 0xFFFFFFFF)) {\r
+      Status = EFI_UNSUPPORTED;\r
+    } else {\r
+      if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) {\r
+        Status = EFI_UNSUPPORTED;\r
+      }\r
+    }\r
+  } else if (ApiIdx == 5) {\r
+    //\r
+    // FspSiliconInit check\r
+    //\r
+    if ((FspData == NULL) || ((UINT32)FspData == 0xFFFFFFFF)) {\r
+      Status = EFI_UNSUPPORTED;\r
+    } else {\r
+      if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) {\r
+        Status = EFI_UNSUPPORTED;\r
+      }\r
+    }\r
   } else {\r
     Status = EFI_UNSUPPORTED;\r
   }\r