--- /dev/null
+/** @file\r
+ Execute 32-bit code in Protected Mode.\r
+\r
+ Copyright (c) 2014 - 2016, 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
+ http://opensource.org/licenses/bsd-license.php.\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <Uefi.h>\r
+#include <FspEas.h>\r
+\r
+/**\r
+ FSP API functions.\r
+\r
+ @param[in] Param1 The first parameter to pass to 32bit code.\r
+ @param[in] Param2 The second parameter to pass to 32bit code.\r
+\r
+ @return EFI_STATUS.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *FSP_FUNCTION) (\r
+ IN VOID *Param1,\r
+ IN VOID *Param2\r
+ );\r
+\r
+/**\r
+ Wrapper for a thunk to transition from long mode to compatibility mode to execute 32-bit code and then transit back to\r
+ long mode.\r
+\r
+ @param[in] Function The 32bit code entry to be executed.\r
+ @param[in] Param1 The first parameter to pass to 32bit code.\r
+ @param[in] Param2 The second parameter to pass to 32bit code.\r
+\r
+ @return EFI_STATUS.\r
+**/\r
+EFI_STATUS\r
+Execute32BitCode (\r
+ IN UINT64 Function,\r
+ IN UINT64 Param1,\r
+ IN UINT64 Param2\r
+ )\r
+{\r
+ FSP_FUNCTION EntryFunc;\r
+ EFI_STATUS Status;\r
+\r
+ EntryFunc = (FSP_FUNCTION) (UINTN) (Function);\r
+ Status = EntryFunc ((VOID *)(UINTN)Param1, (VOID *)(UINTN)Param2);\r
+\r
+ return Status;\r
+}\r
+\r