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 - 2012, 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
40 if (MOR_CLEAR_MEMORY_VALUE (mMorControl
) == 0x0) {
42 // MorControl is expected, directly return to avoid unnecessary variable operation
47 // Clear MOR_CLEAR_MEMORY_BIT
49 DEBUG ((EFI_D_INFO
, "TcgMor: Clear MorClearMemory bit\n"));
52 DataSize
= sizeof (mMorControl
);
54 MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME
,
55 &gEfiMemoryOverwriteControlDataGuid
,
56 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
,
65 Entry Point for TCG MOR Control driver.
67 @param[in] ImageHandle Image handle of this driver.
68 @param[in] SystemTable A Pointer to the EFI System Table.
71 @return Others Some error occurs.
76 IN EFI_HANDLE ImageHandle
,
77 IN EFI_SYSTEM_TABLE
*SystemTable
85 /// The firmware is required to create the MemoryOverwriteRequestControl UEFI variable.
88 DataSize
= sizeof (mMorControl
);
89 Status
= gRT
->GetVariable (
90 MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME
,
91 &gEfiMemoryOverwriteControlDataGuid
,
96 if (EFI_ERROR (Status
)) {
98 // Set default value to 0
101 DEBUG ((EFI_D_INFO
, "TcgMor: Create gEfiMemoryOverwriteControlDataGuid!\n"));
102 Status
= gRT
->SetVariable (
103 MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME
,
104 &gEfiMemoryOverwriteControlDataGuid
,
105 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
,
109 ASSERT_EFI_ERROR (Status
);
113 // Create a Ready To Boot Event and Clear the MorControl bit in the call back function.
115 DEBUG ((EFI_D_INFO
, "TcgMor: Create ReadyToBoot Event for MorControl Bit cleanning!\n"));
116 Status
= EfiCreateEventReadyToBootEx (