• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Framework SMM Status Code Protocol on PI SMM Status Code Protocol Thunk.
3 
4   This thunk driver locates PI SMM Status Code Protocol in the SMM protocol database and
5   installs it in the UEFI protocol database.
6 
7   Note that Framework SMM Status Code Protocol and PI SMM Status Code Protocol have identical protocol
8   GUID and interface structure, but they are in different handle databases.
9 
10   Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
11   This program and the accompanying materials are licensed and made available under
12   the terms and conditions of the BSD License that accompanies this distribution.
13   The full text of the license may be found at
14   http://opensource.org/licenses/bsd-license.php.
15 
16   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 
19 **/
20 
21 #include <PiSmm.h>
22 
23 #include <Protocol/SmmStatusCode.h>
24 
25 #include <Library/DebugLib.h>
26 #include <Library/UefiDriverEntryPoint.h>
27 #include <Library/SmmServicesTableLib.h>
28 
29 /**
30   Entry point of this thunk driver.
31 
32   @param  ImageHandle       The firmware allocated handle for the EFI image.
33   @param  SystemTable       A pointer to the EFI System Table.
34 
35   @retval EFI_SUCCESS       The entry point is executed successfully.
36 
37 **/
38 EFI_STATUS
39 EFIAPI
SmmStatusCodeThunkMain(IN EFI_HANDLE ImageHandle,IN EFI_SYSTEM_TABLE * SystemTable)40 SmmStatusCodeThunkMain (
41   IN EFI_HANDLE         ImageHandle,
42   IN EFI_SYSTEM_TABLE   *SystemTable
43   )
44 {
45   EFI_STATUS                   Status;
46   EFI_HANDLE                   Handle;
47   EFI_SMM_STATUS_CODE_PROTOCOL *SmmStatusCode;
48 
49   //
50   // Locate the PI SMM Status Code Protocol in the SMM protocol database.
51   //
52   Status = gSmst->SmmLocateProtocol (
53                     &gEfiSmmStatusCodeProtocolGuid,
54                     NULL,
55                     (VOID **)&SmmStatusCode
56                     );
57   ASSERT_EFI_ERROR (Status);
58 
59   //
60   // Install the PI SMM Status Code Protocol into the UEFI protocol database.
61   //
62   Handle = NULL;
63   Status = SystemTable->BootServices->InstallProtocolInterface (
64                                         &Handle,
65                                         &gEfiSmmStatusCodeProtocolGuid,
66                                         EFI_NATIVE_INTERFACE,
67                                         SmmStatusCode
68                                         );
69   ASSERT_EFI_ERROR (Status);
70 
71   return EFI_SUCCESS;
72 }
73