--- /dev/null
+/** @file\r
+ Framework SMM Status Code Protocol on PI SMM Status Code Protocol Thunk.\r
+\r
+ This thunk driver locates PI SMM Status Code Protocol in the SMM protocol database and\r
+ installs it in the UEFI protocol database.\r
+\r
+ Note that Framework SMM Status Code Protocol and PI SMM Status Code Protocol have identical protocol\r
+ GUID and interface structure, but they are in different handle databases.\r
+\r
+ Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials are licensed and made available under \r
+ the terms and conditions of the BSD License that accompanies this distribution. \r
+ 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 <PiSmm.h>\r
+\r
+#include <Protocol/SmmStatusCode.h>\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiDriverEntryPoint.h>\r
+#include <Library/SmmServicesTableLib.h>\r
+\r
+/**\r
+ Entry point of this thunk driver.\r
+\r
+ @param ImageHandle The firmware allocated handle for the EFI image.\r
+ @param SystemTable A pointer to the EFI System Table.\r
+ \r
+ @retval EFI_SUCCESS The entry point is executed successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SmmStatusCodeThunkMain (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_HANDLE Handle;\r
+ EFI_SMM_STATUS_CODE_PROTOCOL *SmmStatusCode;\r
+\r
+ //\r
+ // Locate the PI SMM Status Code Protocol in the SMM protocol database.\r
+ //\r
+ Status = gSmst->SmmLocateProtocol (\r
+ &gEfiSmmStatusCodeProtocolGuid,\r
+ NULL,\r
+ (VOID **)&SmmStatusCode\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // Install the PI SMM Status Code Protocol into the UEFI protocol database.\r
+ //\r
+ Handle = NULL;\r
+ Status = SystemTable->BootServices->InstallProtocolInterface (\r
+ &Handle,\r
+ &gEfiSmmStatusCodeProtocolGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ SmmStatusCode\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ return EFI_SUCCESS;\r
+}\r