]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformMemory.c
Fsp1.1 update.
[mirror_edk2.git] / IntelFspPkg / Library / BaseFspPlatformLib / FspPlatformMemory.c
index 2f1c0b14e53b588c45e914fd44782b05de07f71d..241cd284fbf9ff0bed2f15410839e44ee83a5c5d 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
@@ -14,6 +14,7 @@
 #include <PiPei.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/HobLib.h>\r
@@ -76,17 +77,20 @@ FspMigrateTemporaryMemory (
   VOID\r
  )\r
 {\r
-  FSP_INIT_RT_COMMON_BUFFER  *FspInitRtBuffer;\r
-  UINT32             BootLoaderTempRamStart;\r
-  UINT32             BootLoaderTempRamEnd;\r
-  UINT32             BootLoaderTempRamSize;\r
-  UINT32             OffsetGap;\r
-  UINT32             FspParamPtr;\r
-  FSP_INIT_PARAMS   *FspInitParams;\r
-  UINT32            *NewStackTop;\r
-  VOID              *BootLoaderTempRamHob;\r
-  VOID              *UpdDataRgnPtr;\r
-  VOID              *PlatformDataPtr;\r
+  FSP_INIT_RT_COMMON_BUFFER *FspInitRtBuffer;\r
+  UINT32                    BootLoaderTempRamStart;\r
+  UINT32                    BootLoaderTempRamEnd;\r
+  UINT32                    BootLoaderTempRamSize;\r
+  UINT32                    OffsetGap;\r
+  UINT32                    FspParamPtr;\r
+  FSP_INIT_PARAMS           *FspInitParams;\r
+  UINT32                    *NewStackTop;\r
+  VOID                      *BootLoaderTempRamHob;\r
+  VOID                      *UpdDataRgnPtr;\r
+  VOID                      *PlatformDataPtr;\r
+  UINT8                      ApiMode;\r
+    \r
+  ApiMode = GetFspApiCallingMode ();\r
 \r
   //\r
   // Get the temporary memory range used by the bootloader\r
@@ -98,17 +102,25 @@ FspMigrateTemporaryMemory (
   //\r
   // Build a Boot Loader Temporary Memory GUID HOB\r
   //\r
-  BootLoaderTempRamHob = BuildGuidHob (&gFspBootLoaderTemporaryMemoryGuid, BootLoaderTempRamSize);\r
+  if (ApiMode == 0) {\r
+    BootLoaderTempRamHob = BuildGuidHob (&gFspBootLoaderTemporaryMemoryGuid, BootLoaderTempRamSize);\r
+  } else {\r
+    BootLoaderTempRamHob = (VOID *)AllocatePool (BootLoaderTempRamSize);\r
+  }\r
+  ASSERT(BootLoaderTempRamHob != NULL);\r
+\r
   CopyMem (BootLoaderTempRamHob, (VOID *)BootLoaderTempRamStart, BootLoaderTempRamSize);\r
   OffsetGap = (UINT32)BootLoaderTempRamHob - BootLoaderTempRamStart;\r
 \r
   //\r
   // Set a new stack frame for the continuation function\r
   //\r
-  FspInitParams   = (FSP_INIT_PARAMS *)GetFspApiParameter ();\r
-  FspInitRtBuffer = (FSP_INIT_RT_COMMON_BUFFER *)FspInitParams->RtBufferPtr;\r
-  NewStackTop     = (UINT32 *)FspInitRtBuffer->StackTop - 1;\r
-  SetFspCoreStackPointer (NewStackTop);\r
+  if (ApiMode == 0) {\r
+    FspInitParams   = (FSP_INIT_PARAMS *)GetFspApiParameter ();\r
+    FspInitRtBuffer = (FSP_INIT_RT_COMMON_BUFFER *)FspInitParams->RtBufferPtr;\r
+    NewStackTop     = (UINT32 *)FspInitRtBuffer->StackTop - 1;\r
+    SetFspCoreStackPointer (NewStackTop);\r
+  }\r
 \r
   //\r
   // Fix the FspInit Parameter Pointers to the new location.\r
@@ -151,5 +163,4 @@ FspMigrateTemporaryMemory (
       ((UINT32)PlatformDataPtr <  BootLoaderTempRamEnd)) {\r
     SetFspPlatformDataPointer ((UINT8 *)PlatformDataPtr + OffsetGap);\r
   }\r
-\r
 }\r