audk/MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf

75 lines
2.3 KiB
INI
Raw Normal View History

## @file
# DXE S3 boot script Library.
#
# Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials 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
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
##
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = DxeS3BootScriptLib
MODULE_UNI_FILE = DxeS3BootScriptLib.uni
FILE_GUID = 57F9967B-26CD-4262-837A-55B8AA158254
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = S3BootScriptLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
CONSTRUCTOR = S3BootScriptLibInitialize
DESTRUCTOR = S3BootScriptLibDeinitialize
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources]
BootScriptSave.c
BootScriptExecute.c
InternalBootScriptLib.h
BootScriptInternalFormat.h
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
UefiBootServicesTableLib
BaseLib
BaseMemoryLib
TimerLib
DebugLib
PcdLib
UefiLib
SmbusLib
PciLib
IoLib
LockBoxLib
[Protocols]
gEfiSmmBase2ProtocolGuid ## SOMETIMES_CONSUMES
gEfiDxeSmmReadyToLockProtocolGuid ## NOTIFY
gEfiSmmReadyToLockProtocolGuid ## NOTIFY
MdeModulePkg PiDxeS3BootScriptLib: Remove a hidden assumption. What to do: 1. Remove a hidden assumption "No SMM driver writes BootScript between SmmReadyToLock and S3SleepEntryCallback". 1.1. Use SmmExitBootServices and SmmLegacyBoot notification to record AtRuntime flag. 1.2. Use mBootScriptDataBootTimeGuid LockBox to save boot time boot script data to handle potential INSERT boot script at runtime in SMM. 2. Do not depend on OS to help restore ACPINvs data and use EfiReservedMemoryType instead of EfiACPIMemoryNVS. 2.1. Use mBootScriptSmmPrivateDataGuid LockBox to save boot script SMM private data with BackFromS3 = TRUE at runtime. S3 resume will help restore it to tell the Library the system is back from S3. Why to do: 1. The hidden assumption "No SMM driver writes BootScript between SmmReadyToLock and S3SleepEntryCallback" will cause confusion to the library's consumer and block the usage of "SMM driver writes BootScript after SmmReadyToLock". So Remove the assumption. 2. In original code, there might be a corner case that malicious code patch ACPINvs boot TableLength field same as SMM boot script. So that it can skip the table restore. The impact is that BootScript in SMM may be overridden by malicious code. -------------------- CopyMem ((VOID*)&TableHeader, (VOID*)mS3BootScriptTablePtr->TableBase, sizeof(EFI_BOOT_SCRIPT_TABLE_HEADER)); if (mS3BootScriptTablePtr->TableLength + sizeof(EFI_BOOT_SCRIPT_TERMINATE) != TableHeader.TableLength) { // TableLength is in NVS ...... // // NOTE: We should NOT use TableHeader.TableLength, because it is already updated to be whole length. // mS3BootScriptTablePtr->TableLength = (UINT32)(mLockBoxLength - sizeof(EFI_BOOT_SCRIPT_TERMINATE)); ? This line can be skipped. -------------------- So use EfiReservedMemoryType instead of EfiACPIMemoryNVS as the code has been updated to not depend on OS to help restore ACPINvs data. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18467 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-15 09:49:12 +02:00
gEdkiiSmmExitBootServicesProtocolGuid ## NOTIFY
gEdkiiSmmLegacyBootProtocolGuid ## NOTIFY
[Pcd]
## CONSUMES
## SOMETIMES_PRODUCES
gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptTablePrivateDataPtr
## CONSUMES
## SOMETIMES_PRODUCES
gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptTablePrivateSmmDataPtr
gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptRuntimeTableReservePageNumber ## CONSUMES