audk/MdeModulePkg/Library
Laszlo Ersek 058196bbb3 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
  800c02fbe2, 125e093876, 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-28 19:34:13 +02:00
..
AuthVariableLibNull MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
BaseIpmiLibNull MdeModulePkg: Add the missing Library uni files of Ipmi instances 2015-12-24 02:28:45 +00:00
BasePlatformHookLibNull MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
BaseResetSystemLibNull MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
BaseSerialPortLib16550 MdeModulePkg BaseSerialPortLib: Fix VS2010 build error 2016-01-11 00:34:15 +00:00
BaseSortLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
BmpImageDecoderLib MdeModulePkg: Add the missing Library uni files of ImageDecode instances 2015-12-24 02:29:23 +00:00
BootLogoLib MdeModulePkg: Add the missing Library uni files of ImageDecode instances 2015-12-24 02:29:23 +00:00
BootMaintenanceManagerUiLib MdeModulePkg: BootMaintenanceManagerUiLib: remove set but unused variables 2016-03-25 10:52:28 +01:00
BootManagerUiLib MdeModulePkg:Modify relative files because of rename action 2016-01-19 03:30:02 +00:00
CpuExceptionHandlerLibNull MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
CustomizedDisplayLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DebugAgentLibNull MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DeviceManagerUiLib MdeModulePkg: DeviceManagerUiLib: remove set but unused variables 2016-03-25 10:52:29 +01:00
DxeCapsuleLibNull MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DxeCoreMemoryAllocationLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DxeCorePerformanceLib MdeModulePkg: Update PerformanceLib instances not to check Identifier. 2016-04-11 16:20:28 +08:00
DxeCrc32GuidedSectionExtractLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DxeDebugPrintErrorLevelLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DxeDpcLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DxeFileExplorerProtocol MdeModulePkg DxeFileExplorerProtocol: Change file format which has mixed file format. 2015-12-16 03:20:21 +00:00
DxeHttpLib MdeModulePkg:DxeHttpLib: Update to DxeHttpLib API 2016-04-27 10:43:08 +08:00
DxeIpIoLib MdeModulePkg: Check received packet size before use it. 2016-04-01 13:30:08 +08:00
DxeIpmiLibIpmiProtocol MdeModulePkg: Add the missing Library uni files of Ipmi instances 2015-12-24 02:28:45 +00:00
DxeNetLib MdeModulePkg: Add new macros and refine codes 2016-04-11 08:25:33 +08:00
DxePerformanceLib MdeModulePkg: Update PerformanceLib instances not to check Identifier. 2016-04-11 16:20:28 +08:00
DxePrintLibPrint2Protocol MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DxeReportStatusCodeLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DxeSecurityManagementLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DxeSmmPerformanceLib MdeModulePkg: Update PerformanceLib instances not to check Identifier. 2016-04-11 16:20:28 +08:00
DxeTcpIoLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DxeUdpIoLib MdeModulePkg: DxeUdpIoLib: fix non-empty payload path in UDP reception 2016-04-04 13:53:12 +02:00
FileExplorerLib MdeModulePkg: Add ASSERT to make sure pointers are not NULL 2016-03-02 15:18:56 +08:00
ImageDecoderLib MdeModulePkg: Add the missing Library uni files of ImageDecode instances 2015-12-24 02:29:23 +00:00
LockBoxNullLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
LzmaCustomDecompressLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
OemHookStatusCodeLibNull MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PciHostBridgeLibNull MdeModulePkg/PciHostBridgeLib: Correct the function header comments 2016-03-03 18:24:25 +01:00
PeiCrc32GuidedSectionExtractLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PeiDebugPrintHobLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PeiDxeDebugLibReportStatusCode MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PeiIpmiLibIpmiPpi MdeModulePkg: Add the missing Library uni files of Ipmi instances 2015-12-24 02:28:45 +00:00
PeiPerformanceLib MdeModulePkg: Update PerformanceLib instances not to check Identifier. 2016-04-11 16:20:28 +08:00
PeiRecoveryLibNull MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PeiReportStatusCodeLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PeiS3LibNull MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PiDxeS3BootScriptLib MdeModulePkg: PiDxeS3BootScriptLib: honor PcdAcpiS3Enable 2016-04-28 19:34:13 +02:00
PiSmmCoreMemoryAllocationLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PiSmmCoreSmmServicesTableLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PlatformBootManagerLibNull MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PlatformHookLibSerialPortPpi MdeModulePkg: Correct PlatformHookLibSerialPortPpi module type. 2016-04-25 13:17:05 +08:00
PlatformVarCleanupLib MdeModulePkg PlatformVarCleanupLib: Locate VarCheck protocol when using 2016-03-18 15:14:34 +08:00
RuntimeDxeReportStatusCodeLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
SmmCorePerformanceLib MdeModulePkg: Update PerformanceLib instances not to check Identifier. 2016-04-11 16:20:28 +08:00
SmmCorePlatformHookLibNull MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
SmmIpmiLibSmmIpmiProtocol MdeModulePkg: Add the missing Library uni files of Ipmi instances 2015-12-24 02:28:45 +00:00
SmmLockBoxLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
SmmPerformanceLib MdeModulePkg: Update PerformanceLib instances not to check Identifier. 2016-04-11 16:20:28 +08:00
SmmReportStatusCodeLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
TpmMeasurementLibNull MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
UefiBootManagerLib MdeModulePkg/UefiBootManagerLib: API BmIsValidLoadOptionVariableName 2016-04-08 12:28:02 +08:00
UefiHiiLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
UefiHiiServicesLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
UefiSortLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
VarCheckHiiLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
VarCheckLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
VarCheckPcdLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
VarCheckUefiLib MdeModulePkg: Update Guid/Protocol usages in INF files. 2016-04-13 14:52:59 +08:00