]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c
Add dual FSP binaries support.
[mirror_edk2.git] / IntelFspPkg / Library / BaseFspCommonLib / FspCommonLib.c
index 958a7322a0379acbfb548362118f86b2bbe3f0dc..7de84a0a7e7db9f5d296d1dfdb7c6d959635bf93 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
@@ -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
@@ -144,7 +144,7 @@ SetFspContinuationFuncParameter (
 \r
 \r
 /**\r
-  This function changes the Bootloader return address in stack.\r
+  This function changes the BootLoader return address in stack.\r
 \r
   @param[in] ReturnAddress       Address to return.\r
 \r
@@ -162,7 +162,7 @@ SetFspApiReturnAddress (
 }\r
 \r
 /**\r
-  This function set the API status code returned to the bootloader.\r
+  This function set the API status code returned to the BootLoader.\r
 \r
   @param[in] ReturnStatus       Status code to return.\r
 \r
@@ -316,3 +316,83 @@ SetFspMeasurePoint (
 \r
   return FspData->PerfData[(FspData->PerfIdx)++];\r
 }\r
+\r
+/**\r
+  This function gets the FSP info header pointer.\r
+\r
+  @retval FspInfoHeader   FSP info header pointer\r
+**/\r
+FSP_INFO_HEADER *\r
+EFIAPI\r
+GetFspInfoHeader (\r
+  VOID\r
+  )\r
+{\r
+  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
+  @return VpdDataRgnPtr   VPD data pointer.\r
+**/\r
+VOID *\r
+EFIAPI\r
+GetFspVpdDataPointer (\r
+  VOID\r
+  )\r
+{\r
+  FSP_INFO_HEADER   *FspInfoHeader;\r
+\r
+  FspInfoHeader = GetFspInfoHeader ();\r
+  return (VOID *)(FspInfoHeader->ImageBase + FspInfoHeader->CfgRegionOffset);\r
+}\r
+\r
+/**\r
+  This function gets FSP API calling mode.\r
+\r
+  @retval API calling mode\r
+**/\r
+UINT8\r
+EFIAPI\r
+GetFspApiCallingMode (\r
+  VOID\r
+  )\r
+{\r
+  return  GetFspGlobalDataPointer()->ApiMode;\r
+}\r
+\r
+/**\r
+  This function sets FSP API calling mode.\r
+\r
+  @param[in] Mode     API calling mode\r
+**/\r
+VOID\r
+EFIAPI\r
+SetFspApiCallingMode (\r
+  UINT8  Mode\r
+  )\r
+{\r
+  FSP_GLOBAL_DATA  *FspData;\r
+\r
+  FspData  = GetFspGlobalDataPointer ();\r
+  FspData->ApiMode = Mode;\r
+}\r
+\r