2011-08-30 00:17:27 +02:00
|
|
|
## @file
|
2012-10-31 04:31:08 +01:00
|
|
|
# DXE S3 boot script Library.
|
2011-08-30 00:17:27 +02:00
|
|
|
#
|
2015-09-15 09:49:12 +02:00
|
|
|
# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
2011-08-30 00:17:27 +02:00
|
|
|
#
|
|
|
|
# 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
|
2014-08-28 08:34:06 +02:00
|
|
|
MODULE_UNI_FILE = DxeS3BootScriptLib.uni
|
2011-08-30 00:17:27 +02:00
|
|
|
FILE_GUID = 57F9967B-26CD-4262-837A-55B8AA158254
|
|
|
|
MODULE_TYPE = DXE_DRIVER
|
|
|
|
VERSION_STRING = 1.0
|
2012-10-31 04:31:08 +01:00
|
|
|
LIBRARY_CLASS = S3BootScriptLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
|
2011-08-30 00:17:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
CONSTRUCTOR = S3BootScriptLibInitialize
|
|
|
|
|
|
|
|
#
|
|
|
|
# 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
|
2014-08-28 08:34:06 +02:00
|
|
|
|
2011-08-30 00:17:27 +02:00
|
|
|
[Protocols]
|
2014-08-28 08:34:06 +02:00
|
|
|
gEfiSmmBase2ProtocolGuid ## SOMETIMES_CONSUMES
|
|
|
|
gEfiDxeSmmReadyToLockProtocolGuid ## NOTIFY
|
|
|
|
gEfiSmmReadyToLockProtocolGuid ## NOTIFY
|
2015-09-15 09:49:12 +02:00
|
|
|
gEdkiiSmmExitBootServicesProtocolGuid ## NOTIFY
|
|
|
|
gEdkiiSmmLegacyBootProtocolGuid ## NOTIFY
|
2014-08-28 08:34:06 +02:00
|
|
|
|
2011-08-30 00:17:27 +02:00
|
|
|
[Pcd]
|
2014-08-28 08:34:06 +02:00
|
|
|
## CONSUMES
|
|
|
|
## SOMETIMES_PRODUCES
|
|
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptTablePrivateDataPtr
|
|
|
|
## CONSUMES
|
|
|
|
## SOMETIMES_PRODUCES
|
|
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptTablePrivateSmmDataPtr
|
|
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptRuntimeTableReservePageNumber ## CONSUMES
|
MdeModulePkg: PiDxeS3BootScriptLib: honor PcdAcpiS3Enable
In the edk2 tree, there are currently four drivers that consume
PcdAcpiS3Enable:
IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.inf
From these, AcpiS3SaveDxe is the only one that isn't also a client of the
S3BootScriptLib class; all the others (BootScriptExecutorDxe,
S3SaveStateDxe, SmmS3SaveState) are clients of the S3BootScriptLib class.
In turn, the edk2 tree contains only one non-Null instance of the
S3BootScriptLib class:
MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
Therefore we can safely state that BootScriptExecutorDxe, S3SaveStateDxe,
and SmmS3SaveState are all linked against PiDxeS3BootScriptLib.
Now, if PcdAcpiS3Enable is FALSE when either of BootScriptExecutorDxe,
SmmS3SaveState, or SmmS3SaveState is dispatched, then the following
happens:
- The constructor of PiDxeS3BootScriptLib, function
S3BootScriptLibInitialize(), registers a protocol installation callback
for gEfiDxeSmmReadyToLockProtocolGuid. Namely, the function
S3BootScriptEventCallBack().
- The driver immediately exits with EFI_UNSUPPORTED from its entry point
function, upon seeing PcdAcpiS3Enable == FALSE. (See commits
800c02fbe2da6, 125e093876414, and d2d38610603f6.)
- This leaves a dangling callback pointer in the DXE core.
- When Platform BDS installs gEfiDxeSmmReadyToLockProtocolGuid (which is a
valid thing to do for locking down SMM, even in the absence of S3
support!), things blow up.
Fix this issue by returning immediately from S3BootScriptLibInitialize()
if PcdAcpiS3Enable is FALSE -- it is useless to initialize the library
instance if the containing driver module exits first thing in its entry
point.
Cc: Feng Tian <feng.tian@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2016-04-27 19:28:44 +02:00
|
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable ## CONSUMES
|
2014-08-28 08:34:06 +02:00
|
|
|
|