44 DEBUG ((DEBUG_INFO,
"TcgMor: Clear MorClearMemory bit\n"));
47 DataSize =
sizeof (mMorControl);
48 Status =
gRT->SetVariable (
50 &gEfiMemoryOverwriteControlDataGuid,
55 if (EFI_ERROR (Status)) {
56 DEBUG ((DEBUG_ERROR,
"TcgMor: Clear MOR_CLEAR_MEMORY_BIT failure, Status = %r\n", Status));
107 Status = Ssp->ReceiveData (
117 if (EFI_ERROR (Status)) {
128 (Data->SupportedSecurityListLength[0] << 8) +
129 (Data->SupportedSecurityListLength[1])
137 if (Buffer ==
NULL) {
144 Status = Ssp->ReceiveData (
155 if (EFI_ERROR (Status)) {
160 Len = (Data->SupportedSecurityListLength[0] << 8) + Data->SupportedSecurityListLength[1];
166 for (Index = 0; Index < Len; Index++) {
167 if (Data->SupportedSecurityProtocol[Index] == SECURITY_PROTOCOL_TCG) {
172 DEBUG ((DEBUG_INFO,
"This device is a TCG protocol device\n"));
176 if (Data->SupportedSecurityProtocol[Index] == SECURITY_PROTOCOL_IEEE1667) {
181 DEBUG ((DEBUG_INFO,
"This device is a IEEE 1667 protocol device\n"));
186 if (!TcgFlag && !IeeeFlag) {
187 DEBUG ((DEBUG_INFO,
"Neither a TCG nor IEEE 1667 protocol device is found\n"));
196 Status = Ssp->SendData (
200 SECURITY_PROTOCOL_TCG,
206 if (!EFI_ERROR (Status)) {
207 DEBUG ((DEBUG_INFO,
"Send TPer Reset Command Successfully !\n"));
209 DEBUG ((DEBUG_INFO,
"Send TPer Reset Command Fail !\n"));
217 DEBUG ((DEBUG_INFO,
"IEEE 1667 Protocol didn't support yet!\n"));
222 if (Buffer !=
NULL) {
254 Status =
gBS->LocateHandleBuffer (
256 &gEfiStorageSecurityCommandProtocolGuid,
262 if (EFI_ERROR (Status) || (HandleCount == 0) || (HandleBuffer ==
NULL)) {
266 for (Index = 0; Index < HandleCount; Index++) {
270 Status =
gBS->HandleProtocol (
272 &gEfiStorageSecurityCommandProtocolGuid,
276 if (EFI_ERROR (Status)) {
280 Status =
gBS->HandleProtocol (
282 &gEfiBlockIoProtocolGuid,
286 if (EFI_ERROR (Status)) {
320 DataSize =
sizeof (mMorControl);
321 Status =
gRT->GetVariable (
323 &gEfiMemoryOverwriteControlDataGuid,
328 if (EFI_ERROR (Status)) {
333 Status =
gRT->SetVariable (
335 &gEfiMemoryOverwriteControlDataGuid,
340 DEBUG ((DEBUG_INFO,
"TcgMor: Create MOR variable! Status = %r\n", Status));
345 DEBUG ((DEBUG_INFO,
"TcgMor: Create ReadyToBoot Event for MorControl Bit cleaning!\n"));
352 if (EFI_ERROR (Status)) {
359 DEBUG ((DEBUG_INFO,
"TcgMor: Create EndofDxe Event for Mor TPer Reset!\n"));
360 Status =
gBS->CreateEventEx (
365 &gEfiEndOfDxeEventGroupGuid,
368 if (EFI_ERROR (Status)) {
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_RUNTIME_SERVICES * gRT
#define DEBUG(Expression)
#define MOR_CLEAR_MEMORY_VALUE(mor)
#define MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME
EFI_STATUS EFIAPI MorDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID EFIAPI OnReadyToBoot(IN EFI_EVENT Event, IN VOID *Context)
VOID InitiateTPerReset(IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *Ssp, IN UINT32 MediaId)
VOID EFIAPI TPerResetAtEndOfDxe(IN EFI_EVENT Event, IN VOID *Context)
VOID EFIAPI Exit(IN EFI_STATUS Status)
EFI_STATUS EFIAPI EfiCreateEventReadyToBootEx(IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN VOID *NotifyContext OPTIONAL, OUT EFI_EVENT *ReadyToBootEvent)
#define EFI_VARIABLE_NON_VOLATILE