UefiCpuPkg/SmmCpuFeaturesLib: Cleanup library constructors
There's currently two library instances: 1. SmmCpuFeaturesLib 2. SmmCpuFeaturesLibStm There's two constructor functions: 1. SmmCpuFeaturesLibConstructor() 2. SmmCpuFeaturesLibStmConstructor() SmmCpuFeaturesLibConstructor() is called by SmmCpuFeaturesLibStmConstructor() since the functionality in that function is required by both library instances. The declaration for SmmCpuFeaturesLibConstructor() is embedded in "SmmStm.c" instead of being declared in a header file. Further, that constructor function is called by the STM specific constructor. This change moves the common code to a function called CpuFeaturesLibInitialization() which is declared in an internal library header file "CpuFeaturesLib.h". Each constructor simply calls this function to perform the common functionality. Additionally, SmmCpuFeaturesLibConstructor() is moved from SmmCpuFeaturesLibNoStm.c into a instance-specific file allowing SmmCpuFeaturesLibNoStm.c to contain no STM implementation agnostic to a particular library instance. Cc: Eric Dong <eric.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20210217213227.1277-4-mikuback@linux.microsoft.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
61dc3b3399
commit
2002e950ea
@ -30,22 +30,6 @@
|
||||
#define RDWR_ACCS 3
|
||||
#define FULL_ACCS 7
|
||||
|
||||
/**
|
||||
The constructor function
|
||||
|
||||
@param[in] ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param[in] SystemTable A pointer to the EFI System Table.
|
||||
|
||||
@retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SmmCpuFeaturesLibConstructor (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
EFI_HANDLE mStmSmmCpuHandle = NULL;
|
||||
|
||||
BOOLEAN mLockLoadMonitor = FALSE;
|
||||
@ -112,7 +96,7 @@ UINTN mMsegSize = 0;
|
||||
BOOLEAN mStmConfigurationTableInitialized = FALSE;
|
||||
|
||||
/**
|
||||
The constructor function
|
||||
The constructor function for the Traditional MM library instance with STM.
|
||||
|
||||
@param[in] ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param[in] SystemTable A pointer to the EFI System Table.
|
||||
@ -138,10 +122,9 @@ SmmCpuFeaturesLibStmConstructor (
|
||||
SmmCpuFeaturesLibStmSmiEntryFixupAddress ();
|
||||
|
||||
//
|
||||
// Call the common constructor function
|
||||
// Perform library initialization common across all instances
|
||||
//
|
||||
Status = SmmCpuFeaturesLibConstructor (ImageHandle, SystemTable);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
CpuFeaturesLibInitialization ();
|
||||
|
||||
//
|
||||
// Lookup the MP Services Protocol
|
||||
|
Reference in New Issue
Block a user