• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   DxeSmmReadyToLock Protocol on ExitPmAuth Protocol Thunk driver.
3   EDK platform uses ExitPmAuth point to lock SMRAM and SMM API.
4   But EDKII uses DxeSmmReadyToLock. We need a thunk driver to convert this event.
5 
6 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
7 
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions
10 of the BSD License which accompanies this distribution.  The
11 full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
13 
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 
17 **/
18 
19 #include  "DxeSmmReadyToLockOnExitPmAuthThunk.h"
20 
21 /**
22   ExitPmAuth Protocol notification event handler.
23 
24   @param[in] Event    Event whose notification function is being invoked.
25   @param[in] Context  Pointer to the notification function's context.
26 **/
27 VOID
28 EFIAPI
ExitPmAuthProtocolNotification(IN EFI_EVENT Event,IN VOID * Context)29 ExitPmAuthProtocolNotification (
30   IN EFI_EVENT  Event,
31   IN VOID       *Context
32   )
33 {
34   EFI_STATUS Status;
35   EFI_HANDLE ImageHandle;
36   VOID       *ExitPmAuth;
37 
38   //
39   // Add more check to locate protocol after got event, because
40   // ECP will signal this event immediately once it is register
41   // just in case it is already installed.
42   //
43   Status = gBS->LocateProtocol (
44                   &gExitPmAuthProtocolGuid,
45                   NULL,
46                   &ExitPmAuth
47                   );
48   if (EFI_ERROR (Status)) {
49     return ;
50   }
51 
52   //
53   // Install DxeSmmReadyToLock protocol to let PI SMM lock
54   //
55   ImageHandle = NULL;
56   Status = gBS->InstallProtocolInterface (
57                   &ImageHandle,
58                   &gEfiDxeSmmReadyToLockProtocolGuid,
59                   EFI_NATIVE_INTERFACE,
60                   NULL
61                   );
62   ASSERT_EFI_ERROR (Status);
63 }
64 
65 /**
66   Entry Point for DxeSmmReadyToLock Protocol on ExitPmAuth Protocol Thunk driver.
67 
68   @param[in] ImageHandle  Image handle of this driver.
69   @param[in] SystemTable  A Pointer to the EFI System Table.
70 
71   @retval EFI_SUCCESS  The entry point is executed successfully.
72 **/
73 EFI_STATUS
74 EFIAPI
DxeSmmReadyToLockMain(IN EFI_HANDLE ImageHandle,IN EFI_SYSTEM_TABLE * SystemTable)75 DxeSmmReadyToLockMain (
76   IN EFI_HANDLE        ImageHandle,
77   IN EFI_SYSTEM_TABLE  *SystemTable
78   )
79 {
80   VOID *Registration;
81 
82   //
83   // Install notifications for required protocols
84   //
85   EfiCreateProtocolNotifyEvent (
86     &gExitPmAuthProtocolGuid,
87     TPL_CALLBACK,
88     ExitPmAuthProtocolNotification,
89     NULL,
90     &Registration
91     );
92 
93   return EFI_SUCCESS;
94 }
95