2 TCG MOR (Memory Overwrite Request) Control Driver.
4 This driver initilize MemoryOverwriteRequestControl variable. It
5 will clear MOR_CLEAR_MEMORY_BIT bit if it is set.
7 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23 Ready to Boot Event notification handler.
25 Sequence of OS boot events is measured in this event notification handler.
27 @param[in] Event Event whose notification function is being invoked
28 @param[in] Context Pointer to the notification function's context
41 if (MOR_CLEAR_MEMORY_VALUE (mMorControl
) == 0x0) {
43 // MorControl is expected, directly return to avoid unnecessary variable operation
48 // Clear MOR_CLEAR_MEMORY_BIT
50 DEBUG ((EFI_D_INFO
, "TcgMor: Clear MorClearMemory bit\n"));
53 DataSize
= sizeof (mMorControl
);
54 Status
= gRT
->SetVariable (
55 MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME
,
56 &gEfiMemoryOverwriteControlDataGuid
,
57 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
,
61 if (EFI_ERROR (Status
)) {
62 DEBUG ((EFI_D_ERROR
, "TcgMor: Clear MOR_CLEAR_MEMORY_BIT failure, Status = %r\n"));
68 Entry Point for TCG MOR Control driver.
70 @param[in] ImageHandle Image handle of this driver.
71 @param[in] SystemTable A Pointer to the EFI System Table.
74 @return Others Some error occurs.
79 IN EFI_HANDLE ImageHandle
,
80 IN EFI_SYSTEM_TABLE
*SystemTable
88 /// The firmware is required to create the MemoryOverwriteRequestControl UEFI variable.
91 DataSize
= sizeof (mMorControl
);
92 Status
= gRT
->GetVariable (
93 MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME
,
94 &gEfiMemoryOverwriteControlDataGuid
,
99 if (EFI_ERROR (Status
)) {
101 // Set default value to 0
104 Status
= gRT
->SetVariable (
105 MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME
,
106 &gEfiMemoryOverwriteControlDataGuid
,
107 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
,
111 DEBUG ((EFI_D_INFO
, "TcgMor: Create MOR variable! Status = %r\n", Status
));
114 // Create a Ready To Boot Event and Clear the MorControl bit in the call back function.
116 DEBUG ((EFI_D_INFO
, "TcgMor: Create ReadyToBoot Event for MorControl Bit cleanning!\n"));
117 Status
= EfiCreateEventReadyToBootEx (