]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | TCG MOR (Memory Overwrite Request) Lock Control support (DXE version).\r | |
3 | \r | |
4 | This module clears MemoryOverwriteRequestControlLock variable to indicate\r | |
5 | MOR lock control unsupported.\r | |
6 | \r | |
7 | Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r | |
8 | This program and the accompanying materials\r | |
9 | are licensed and made available under the terms and conditions of the BSD License\r | |
10 | which accompanies this distribution. The full text of the license may be found at\r | |
11 | http://opensource.org/licenses/bsd-license.php\r | |
12 | \r | |
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
15 | \r | |
16 | **/\r | |
17 | \r | |
18 | #include <PiDxe.h>\r | |
19 | #include <Guid/MemoryOverwriteControl.h>\r | |
20 | #include <IndustryStandard/MemoryOverwriteRequestControlLock.h>\r | |
21 | #include <Library/DebugLib.h>\r | |
22 | #include <Library/BaseLib.h>\r | |
23 | #include <Library/BaseMemoryLib.h>\r | |
24 | #include "Variable.h"\r | |
25 | \r | |
26 | extern EDKII_VARIABLE_LOCK_PROTOCOL mVariableLock;\r | |
27 | \r | |
28 | /**\r | |
29 | This service is an MOR/MorLock checker handler for the SetVariable().\r | |
30 | \r | |
31 | @param VariableName the name of the vendor's variable, as a\r | |
32 | Null-Terminated Unicode String\r | |
33 | @param VendorGuid Unify identifier for vendor.\r | |
34 | @param Attributes Point to memory location to return the attributes of variable. If the point\r | |
35 | is NULL, the parameter would be ignored.\r | |
36 | @param DataSize The size in bytes of Data-Buffer.\r | |
37 | @param Data Point to the content of the variable.\r | |
38 | \r | |
39 | @retval EFI_SUCCESS The MOR/MorLock check pass, and Variable driver can store the variable data.\r | |
40 | @retval EFI_INVALID_PARAMETER The MOR/MorLock data or data size or attributes is not allowed for MOR variable.\r | |
41 | @retval EFI_ACCESS_DENIED The MOR/MorLock is locked.\r | |
42 | @retval EFI_ALREADY_STARTED The MorLock variable is handled inside this function.\r | |
43 | Variable driver can just return EFI_SUCCESS.\r | |
44 | **/\r | |
45 | EFI_STATUS\r | |
46 | SetVariableCheckHandlerMor (\r | |
47 | IN CHAR16 *VariableName,\r | |
48 | IN EFI_GUID *VendorGuid,\r | |
49 | IN UINT32 Attributes,\r | |
50 | IN UINTN DataSize,\r | |
51 | IN VOID *Data\r | |
52 | )\r | |
53 | {\r | |
54 | //\r | |
55 | // Just let it pass. No need provide protection for DXE version.\r | |
56 | //\r | |
57 | return EFI_SUCCESS;\r | |
58 | }\r | |
59 | \r | |
60 | /**\r | |
61 | Initialization for MOR Lock Control.\r | |
62 | \r | |
63 | @retval EFI_SUCEESS MorLock initialization success.\r | |
64 | @return Others Some error occurs.\r | |
65 | **/\r | |
66 | EFI_STATUS\r | |
67 | MorLockInit (\r | |
68 | VOID\r | |
69 | )\r | |
70 | {\r | |
71 | //\r | |
72 | // Always clear variable to report unsupported to OS.\r | |
73 | // The reason is that the DXE version is not proper to provide *protection*.\r | |
74 | // BIOS should use SMM version variable driver to provide such capability.\r | |
75 | //\r | |
76 | VariableServiceSetVariable (\r | |
77 | MEMORY_OVERWRITE_REQUEST_CONTROL_LOCK_NAME,\r | |
78 | &gEfiMemoryOverwriteRequestControlLockGuid,\r | |
79 | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r | |
80 | 0,\r | |
81 | NULL\r | |
82 | );\r | |
83 | \r | |
84 | //\r | |
85 | // Need set this variable to be read-only to prevent other module set it.\r | |
86 | //\r | |
87 | VariableLockRequestToLock (&mVariableLock, MEMORY_OVERWRITE_REQUEST_CONTROL_LOCK_NAME, &gEfiMemoryOverwriteRequestControlLockGuid);\r | |
88 | return EFI_SUCCESS;\r | |
89 | }\r |