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