Clone the Null instance of SmmCpuPlatformHookLib from UefiCpuPkg to
OvmfPkg. In this patch, customize the lib instance only with the following
no-op steps:
- Replace Null/NULL references in filenames and comments with Qemu/QEMU
references.
- Update copyright notices.
- Clean up and rewrap comment blocks.
- Update INF_VERSION to the latest INF spec version (1.29).
- Update FILE_GUID.
- Drop the UNI file.
This patch is best reviewed with:
$ git show --find-copies=43 --find-copies-harder
Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>
Cc: Igor Mammedov <imamm...@redhat.com>
Cc: Jiewen Yao <jiewen....@intel.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Michael Kinney <michael.d.kin...@intel.com>
Cc: Philippe Mathieu-Daudé <phi...@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1512
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheu...@linaro.org>
---
Notes:
v2:
- Pick up Ard's Acked-by, which is conditional on approval from Intel
reviewers on Cc. (I'd like to save Ard the churn of re-acking
unmodified patches.)
OvmfPkg/OvmfPkgIa32.dsc
| 2 +-
OvmfPkg/OvmfPkgIa32X64.dsc
| 2 +-
OvmfPkg/OvmfPkgX64.dsc
| 2 +-
UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.inf =>
OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu.inf | 21
+++++-------
UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.c =>
OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu.c | 36
++++++++++++--------
5 files changed, 32 insertions(+), 31 deletions(-)
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 19728f20b34e..813995fefad8 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -858,45 +858,45 @@ [Components]
UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
#
# SMM Initial Program Load (a DXE_RUNTIME_DRIVER)
#
MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
#
# SMM_CORE
#
MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
#
# Privileged drivers (DXE_SMM_DRIVER modules)
#
UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf
MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf {
<LibraryClasses>
LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf
}
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf {
<LibraryClasses>
-
SmmCpuPlatformHookLib|UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.inf
+
SmmCpuPlatformHookLib|OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu.inf
SmmCpuFeaturesLib|OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
}
#
# Variable driver stack (SMM)
#
OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
}
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
!else
#
# Variable driver stack (non-SMM)
#
OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf {
<LibraryClasses>
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 3c0c229e3a72..a256c7084a7e 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -872,45 +872,45 @@ [Components.X64]
UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
#
# SMM Initial Program Load (a DXE_RUNTIME_DRIVER)
#
MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
#
# SMM_CORE
#
MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
#
# Privileged drivers (DXE_SMM_DRIVER modules)
#
UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf
MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf {
<LibraryClasses>
LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf
}
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf {
<LibraryClasses>
-
SmmCpuPlatformHookLib|UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.inf
+
SmmCpuPlatformHookLib|OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu.inf
SmmCpuFeaturesLib|OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
}
#
# Variable driver stack (SMM)
#
OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
}
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
!else
#
# Variable driver stack (non-SMM)
#
OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf {
<LibraryClasses>
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index f6c1d8d228c6..78079b9f8e13 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -870,45 +870,45 @@ [Components]
UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
#
# SMM Initial Program Load (a DXE_RUNTIME_DRIVER)
#
MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
#
# SMM_CORE
#
MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
#
# Privileged drivers (DXE_SMM_DRIVER modules)
#
UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf
MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf {
<LibraryClasses>
LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf
}
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf {
<LibraryClasses>
-
SmmCpuPlatformHookLib|UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.inf
+
SmmCpuPlatformHookLib|OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu.inf
SmmCpuFeaturesLib|OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
}
#
# Variable driver stack (SMM)
#
OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
}
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
!else
#
# Variable driver stack (non-SMM)
#
OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf {
<LibraryClasses>
diff --git
a/UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.inf
b/OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu.inf
similarity index 43%
copy from
UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.inf
copy to OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu.inf
index fab6b30b7a3f..82edeca3d12d 100644
--- a/UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.inf
+++ b/OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu.inf
@@ -1,34 +1,29 @@
## @file
-# SMM CPU Platform Hook NULL library instance.
+# SMM CPU Platform Hook library instance for QEMU.
#
+# Copyright (c) 2020, Red Hat, Inc.
# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
##
-################################################################################
-#
-# Defines Section - statements that will be processed to create a Makefile.
-#
-################################################################################
[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = SmmCpuPlatformHookLibNull
- MODULE_UNI_FILE = SmmCpuPlatformHookLibNull.uni
- FILE_GUID = D6494E1B-E06F-4ab5-B64D-48B25AA9EB33
+ INF_VERSION = 1.29
+ BASE_NAME = SmmCpuPlatformHookLibQemu
+ FILE_GUID = 154D6D26-54B8-45BC-BA3A-CBAA20C02A6A
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = SmmCpuPlatformHookLib
#
-# The following information is for reference only and not required by the
build tools.
+# The following information is for reference only and not required by the build
+# tools.
#
# VALID_ARCHITECTURES = IA32 X64
#
[Sources]
- SmmCpuPlatformHookLibNull.c
+ SmmCpuPlatformHookLibQemu.c
[Packages]
MdePkg/MdePkg.dec
UefiCpuPkg/UefiCpuPkg.dec
diff --git
a/UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.c
b/OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu.c
similarity index 67%
copy from
UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.c
copy to OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu.c
index 6c2010dc0a67..257e1d399cc6 100644
--- a/UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.c
+++ b/OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLibQemu.c
@@ -1,102 +1,108 @@
/** @file
-SMM CPU Platform Hook NULL library instance.
+SMM CPU Platform Hook library instance for QEMU.
+Copyright (c) 2020, Red Hat, Inc.
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <PiSmm.h>
#include <Library/SmmCpuPlatformHookLib.h>
/**
Checks if platform produces a valid SMI.
This function checks if platform produces a valid SMI. This function is
called at SMM entry to detect if this is a spurious SMI. This function
must be implemented in an MP safe way because it is called by multiple CPU
threads.
@retval TRUE There is a valid SMI
@retval FALSE There is no valid SMI
**/
BOOLEAN
EFIAPI
PlatformValidSmi (
VOID
)
{
return TRUE;
}
/**
Clears platform top level SMI status bit.
This function clears platform top level SMI status bit.
@retval TRUE The platform top level SMI status is cleared.
- @retval FALSE The platform top level SMI status cannot be
cleared.
+ @retval FALSE The platform top level SMI status cannot be
+ cleared.
**/
BOOLEAN
EFIAPI
ClearTopLevelSmiStatus (
VOID
)
{
return TRUE;
}
/**
Performs platform specific way of SMM BSP election.
This function performs platform specific way of SMM BSP election.
- @param IsBsp Output parameter. TRUE: the CPU this function executes
- on is elected to be the SMM BSP. FALSE: the CPU
this
- function executes on is to be SMM AP.
+ @param IsBsp Output parameter. TRUE: the CPU this function
+ executes on is elected to be the SMM BSP. FALSE:
+ the CPU this function executes on is to be SMM AP.
@retval EFI_SUCCESS The function executes successfully.
- @retval EFI_NOT_READY The function does not determine whether this CPU
should be
- BSP or AP. This may occur if hardware init
sequence to
- enable the determination is yet to be done, or the
function
- chooses not to do BSP election and will let SMM
CPU driver to
- use its default BSP election process.
- @retval EFI_DEVICE_ERROR The function cannot determine whether this CPU
should be
- BSP or AP due to hardware error.
+ @retval EFI_NOT_READY The function does not determine whether this CPU
+ should be BSP or AP. This may occur if hardware
+ init sequence to enable the determination is yet to
+ be done, or the function chooses not to do BSP
+ election and will let SMM CPU driver to use its
+ default BSP election process.
+ @retval EFI_DEVICE_ERROR The function cannot determine whether this CPU
+ should be BSP or AP due to hardware error.
**/
EFI_STATUS
EFIAPI
PlatformSmmBspElection (
OUT BOOLEAN *IsBsp
)
{
return EFI_NOT_READY;
}
/**
Get platform page table attribute.
This function gets page table attribute of platform.
- @param Address Input parameter. Obtain the page table entries attribute on this address.
+ @param Address Input parameter. Obtain the page table entries
+ attribute on this address.
@param PageSize Output parameter. The size of the page.
@param NumOfPages Output parameter. Number of page.
@param PageAttribute Output parameter. Paging Attributes (WB, UC, etc).
- @retval EFI_SUCCESS The platform page table attribute from the address is determined.
- @retval EFI_UNSUPPORTED The platform does not support getting page table
attribute for the address.
+ @retval EFI_SUCCESS The platform page table attribute from the address
+ is determined.
+ @retval EFI_UNSUPPORTED The platform does not support getting page table
+ attribute for the address.
**/
EFI_STATUS
EFIAPI
GetPlatformPageTableAttribute (
IN UINT64 Address,
IN OUT SMM_PAGE_SIZE_TYPE *PageSize,
IN OUT UINTN *NumOfPages,
IN OUT UINTN *PageAttribute
)
{
return EFI_UNSUPPORTED;
}