]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFspPkg/FspSecCore/SecFsp.c
Update IntelFspPkg to support FSP1.1
[mirror_edk2.git] / IntelFspPkg / FspSecCore / SecFsp.c
index 53ff8b7c0fc54ccf0cbb438c2c72ec250010d4c8..b4566045f9ba828b77fb480ce3db34a0642b6c1b 100644 (file)
@@ -97,10 +97,10 @@ SecGetPlatformData (
   TopOfCar = PcdGet32 (PcdTemporaryRamBase) + PcdGet32 (PcdTemporaryRamSize);\r
 \r
   FspPlatformData->DataPtr   = NULL;\r
-  FspPlatformData->CodeRegionSize      = 0;\r
+  FspPlatformData->MicrocodeRegionBase = 0;\r
+  FspPlatformData->MicrocodeRegionSize = 0;\r
   FspPlatformData->CodeRegionBase      = 0;\r
-  FspPlatformData->MicorcodeRegionBase = 0;\r
-  FspPlatformData->MicorcodeRegionSize = 0;\r
+  FspPlatformData->CodeRegionSize      = 0;\r
 \r
   //\r
   // Pointer to the size field\r
@@ -114,7 +114,7 @@ SecGetPlatformData (
       //\r
       DwordSize = 4;\r
       StackPtr  = StackPtr - 1 - DwordSize;\r
-      CopyMem (&(FspPlatformData->CodeRegionBase), StackPtr, (DwordSize << 2));\r
+      CopyMem (&(FspPlatformData->MicrocodeRegionBase), StackPtr, (DwordSize << 2));\r
       StackPtr--;\r
     } else if (*(StackPtr - 1) == FSP_PER0_SIGNATURE) {\r
       //\r
@@ -138,14 +138,14 @@ 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]     BootloaderStack        Bootloader 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 UINT32                   BootloaderStack,\r
+  IN UINT32                   BootLoaderStack,\r
   IN UINT8                    ApiIdx\r
   )\r
 {\r
@@ -162,7 +162,7 @@ FspGlobalDataInit (
   ZeroMem  ((VOID *)PeiFspData, sizeof(FSP_GLOBAL_DATA));\r
 \r
   PeiFspData->Signature          = FSP_GLOBAL_DATA_SIGNATURE;\r
-  PeiFspData->CoreStack          = BootloaderStack;\r
+  PeiFspData->CoreStack          = BootLoaderStack;\r
   PeiFspData->PerfIdx            = 2;\r
 \r
   SetFspMeasurePoint (FSP_PERF_ID_API_FSPINIT_ENTRY);\r
@@ -239,25 +239,34 @@ FspDataPointerFixUp (
   This function check the FSP API calling condition.\r
 \r
   @param[in]  ApiIdx           Internal index of the FSP API.\r
+  @param[in]  ApiParam         Parameter of the FSP API.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 FspApiCallingCheck (\r
-  UINT32   ApiIdx\r
+  IN UINT32   ApiIdx,\r
+  IN VOID     *ApiParam\r
   )\r
 {\r
-  EFI_STATUS       Status;\r
-  FSP_GLOBAL_DATA *FspData;\r
+  EFI_STATUS                Status;\r
+  FSP_GLOBAL_DATA           *FspData;\r
+  FSP_INIT_PARAMS           *FspInitParams;\r
+  FSP_INIT_RT_COMMON_BUFFER *FspRtBuffer;\r
+\r
+  FspInitParams = (FSP_INIT_PARAMS *) ApiParam;\r
+  FspRtBuffer = ((FSP_INIT_RT_COMMON_BUFFER *)FspInitParams->RtBufferPtr);\r
 \r
   Status = EFI_SUCCESS;\r
-  FspData  = GetFspGlobalDataPointer ();\r
+  FspData = GetFspGlobalDataPointer ();\r
   if (ApiIdx == 1) {\r
     //\r
     // FspInit check\r
     //\r
     if ((UINT32)FspData != 0xFFFFFFFF) {\r
       Status = EFI_UNSUPPORTED;\r
+    } else if ((FspRtBuffer == NULL) || ((FspRtBuffer->BootLoaderTolumSize % EFI_PAGE_SIZE) != 0)) {\r
+      Status = EFI_INVALID_PARAMETER;\r
     }\r
   } else if (ApiIdx == 2) {\r
     //\r
@@ -276,6 +285,8 @@ FspApiCallingCheck (
     //\r
     if ((UINT32)FspData != 0xFFFFFFFF) {\r
       Status = EFI_UNSUPPORTED;\r
+    } else if ((FspRtBuffer == NULL) || ((FspRtBuffer->BootLoaderTolumSize % EFI_PAGE_SIZE) != 0)) {\r
+      Status = EFI_INVALID_PARAMETER;\r
     }\r
   } else if (ApiIdx == 4) {\r
     //\r
@@ -305,3 +316,17 @@ FspApiCallingCheck (
 \r
   return Status;\r
 }\r
+\r
+/**\r
+  This function gets the boot FV offset in FSP.\r
+  @return the boot firmware volumen offset inside FSP binary\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+GetBootFirmwareVolumeOffset (\r
+  VOID\r
+  )\r
+{ \r
+  return PcdGet32 (PcdFspBootFirmwareVolumeBase) - PcdGet32 (PcdFspAreaBaseAddress);\r
+}\r