mirror of https://github.com/acidanthera/audk.git
Add Tper Reset Logic by using MOR bit.
Signed-off-by: Ouyang, Qian <Qian.Ouyang@intel.com> Reviewed-by: Tian, Feng <feng.tian@intel.com> Dong, Guo <Guo.dong@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13728 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
90398d5558
commit
504dfa9dbb
|
@ -4,7 +4,7 @@
|
||||||
This driver initilize MemoryOverwriteRequestControl variable. It
|
This driver initilize MemoryOverwriteRequestControl variable. It
|
||||||
will clear MOR_CLEAR_MEMORY_BIT bit if it is set.
|
will clear MOR_CLEAR_MEMORY_BIT bit if it is set.
|
||||||
|
|
||||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -17,6 +17,50 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
#include "TcgMor.h"
|
#include "TcgMor.h"
|
||||||
|
|
||||||
|
UINT8 mMorControl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Ready to Boot Event notification handler.
|
||||||
|
|
||||||
|
Sequence of OS boot events is measured in this event notification handler.
|
||||||
|
|
||||||
|
@param[in] Event Event whose notification function is being invoked
|
||||||
|
@param[in] Context Pointer to the notification function's context
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
OnReadyToBoot (
|
||||||
|
IN EFI_EVENT Event,
|
||||||
|
IN VOID *Context
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN DataSize;
|
||||||
|
|
||||||
|
if (MOR_CLEAR_MEMORY_VALUE (mMorControl) == 0x0) {
|
||||||
|
//
|
||||||
|
// MorControl is expected, directly return to avoid unnecessary variable operation
|
||||||
|
//
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Clear MOR_CLEAR_MEMORY_BIT
|
||||||
|
//
|
||||||
|
DEBUG ((EFI_D_INFO, "TcgMor: Clear MorClearMemory bit\n"));
|
||||||
|
mMorControl &= 0xFE;
|
||||||
|
|
||||||
|
DataSize = sizeof (mMorControl);
|
||||||
|
gRT->SetVariable (
|
||||||
|
MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
|
||||||
|
&gEfiMemoryOverwriteControlDataGuid,
|
||||||
|
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
|
DataSize,
|
||||||
|
&mMorControl
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Entry Point for TCG MOR Control driver.
|
Entry Point for TCG MOR Control driver.
|
||||||
|
|
||||||
|
@ -34,48 +78,49 @@ MorDriverEntryPoint (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT8 MorControl;
|
|
||||||
UINTN DataSize;
|
UINTN DataSize;
|
||||||
|
EFI_EVENT Event;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// The firmware is required to create the MemoryOverwriteRequestControl UEFI variable.
|
/// The firmware is required to create the MemoryOverwriteRequestControl UEFI variable.
|
||||||
///
|
///
|
||||||
|
|
||||||
DataSize = sizeof (MorControl);
|
DataSize = sizeof (mMorControl);
|
||||||
Status = gRT->GetVariable (
|
Status = gRT->GetVariable (
|
||||||
MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
|
MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
|
||||||
&gEfiMemoryOverwriteControlDataGuid,
|
&gEfiMemoryOverwriteControlDataGuid,
|
||||||
NULL,
|
NULL,
|
||||||
&DataSize,
|
&DataSize,
|
||||||
&MorControl
|
&mMorControl
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
//
|
//
|
||||||
// Set default value to 0
|
// Set default value to 0
|
||||||
//
|
//
|
||||||
MorControl = 0;
|
mMorControl = 0;
|
||||||
|
DEBUG ((EFI_D_INFO, "TcgMor: Create gEfiMemoryOverwriteControlDataGuid!\n"));
|
||||||
|
Status = gRT->SetVariable (
|
||||||
|
MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
|
||||||
|
&gEfiMemoryOverwriteControlDataGuid,
|
||||||
|
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
|
DataSize,
|
||||||
|
&mMorControl
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (MOR_CLEAR_MEMORY_VALUE (MorControl) == 0x0) {
|
|
||||||
//
|
|
||||||
// MorControl is expected, directly return to avoid unnecessary variable operation
|
|
||||||
//
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// Clear MOR_CLEAR_MEMORY_BIT
|
// Create a Ready To Boot Event and Clear the MorControl bit in the call back function.
|
||||||
//
|
//
|
||||||
DEBUG ((EFI_D_INFO, "TcgMor: Clear MorClearMemory bit\n"));
|
DEBUG ((EFI_D_INFO, "TcgMor: Create ReadyToBoot Event for MorControl Bit cleanning!\n"));
|
||||||
MorControl &= 0xFE;
|
Status = EfiCreateEventReadyToBootEx (
|
||||||
|
TPL_CALLBACK,
|
||||||
|
OnReadyToBoot,
|
||||||
|
NULL,
|
||||||
|
&Event
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gRT->SetVariable (
|
|
||||||
MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
|
|
||||||
&gEfiMemoryOverwriteControlDataGuid,
|
|
||||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
|
||||||
DataSize,
|
|
||||||
&MorControl
|
|
||||||
);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
The header file for TcgMor.
|
The header file for TcgMor.
|
||||||
|
|
||||||
Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -22,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#include <Library/UefiDriverEntryPoint.h>
|
#include <Library/UefiDriverEntryPoint.h>
|
||||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/UefiLib.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# Component description file for Memory Overwrite Control driver.
|
# Component description file for Memory Overwrite Control driver.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -39,6 +39,7 @@
|
||||||
UefiRuntimeServicesTableLib
|
UefiRuntimeServicesTableLib
|
||||||
ReportStatusCodeLib
|
ReportStatusCodeLib
|
||||||
DebugLib
|
DebugLib
|
||||||
|
UefiLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gEfiMemoryOverwriteControlDataGuid # GUID ALWAYS_CONSUMED
|
gEfiMemoryOverwriteControlDataGuid # GUID ALWAYS_CONSUMED
|
||||||
|
|
Loading…
Reference in New Issue