[edk2-devel] [PATCH v2 1/4] UefiCpuPkg/SmmCpuFeaturesLib: Move multi-instance function decl to header

Michael Kubacki posted 4 patches 4 years, 12 months ago
There is a newer version of this series
[edk2-devel] [PATCH v2 1/4] UefiCpuPkg/SmmCpuFeaturesLib: Move multi-instance function decl to header
Posted by Michael Kubacki 4 years, 12 months ago
From: Michael Kubacki <michael.kubacki@microsoft.com>

FinishSmmCpuFeaturesInitializeProcessor() is a multi-instance
internal library function that is currently not declared in a
header file but embedded in "SmmCpuFeaturesLib.c".

This change cleans up the declaration moving it to a new header
file "CpuFeaturesLib.h" and removing the local declaration in
"SmmCpuFeaturesLib.c".

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>
---
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c      | 11 +---------
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c |  1 +
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c                 |  1 +
 UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h         | 22 ++++++++++++++++++++
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf    |  1 +
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf |  1 +
 6 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
index 8fed18cf0e17..75bde752785a 100644
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
@@ -15,6 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/DebugLib.h>
 #include <Register/Intel/Cpuid.h>
 #include <Register/Intel/SmramSaveStateMap.h>
+#include "CpuFeaturesLib.h"
 
 //
 // Machine Specific Registers (MSRs)
@@ -35,16 +36,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #define SMM_FEATURES_LIB_IA32_MCA_CAP              0x17D
 #define   SMM_CODE_ACCESS_CHK_BIT                  BIT58
 
-/**
-  Internal worker function that is called to complete CPU initialization at the
-  end of SmmCpuFeaturesInitializeProcessor().
-
-**/
-VOID
-FinishSmmCpuFeaturesInitializeProcessor (
-  VOID
-  );
-
 //
 // Set default value to assume SMRR is not supported
 //
diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c
index 3e63c5e27f98..c562582ccee0 100644
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c
@@ -9,6 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include <PiSmm.h>
 #include <Library/SmmCpuFeaturesLib.h>
+#include "CpuFeaturesLib.h"
 
 /**
   Internal worker function that is called to complete CPU initialization at the
diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c
index f7f8afacffb5..b5aad41fdb64 100644
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c
@@ -21,6 +21,7 @@
 
 #include <Protocol/MpService.h>
 
+#include "CpuFeaturesLib.h"
 #include "SmmStm.h"
 
 #define TXT_EVTYPE_BASE                  0x400
diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h b/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h
new file mode 100644
index 000000000000..4645bbb066c9
--- /dev/null
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h
@@ -0,0 +1,22 @@
+/** @file
+  Internal library function definitions.
+
+  Copyright (c) Microsoft Corporation.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _CPU_FEATURES_LIB_H_
+#define _CPU_FEATURES_LIB_H_
+
+/**
+  Internal worker function that is called to complete CPU initialization at the
+  end of SmmCpuFeaturesInitializeProcessor().
+
+**/
+VOID
+FinishSmmCpuFeaturesInitializeProcessor (
+  VOID
+  );
+
+#endif
diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
index dd828baf69cb..a6d8467d26aa 100644
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
@@ -17,6 +17,7 @@ [Defines]
   CONSTRUCTOR                    = SmmCpuFeaturesLibConstructor
 
 [Sources]
+  CpuFeaturesLib.h
   SmmCpuFeaturesLib.c
   SmmCpuFeaturesLibNoStm.c
 
diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
index 50b9cc871302..89cd252ef44e 100644
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
@@ -18,6 +18,7 @@ [Defines]
   CONSTRUCTOR                    = SmmCpuFeaturesLibStmConstructor
 
 [Sources]
+  CpuFeaturesLib.h
   SmmCpuFeaturesLib.c
   SmmStm.c
   SmmStm.h
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#71657): https://edk2.groups.io/g/devel/message/71657
Mute This Topic: https://groups.io/mt/80599744/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH v2 1/4] UefiCpuPkg/SmmCpuFeaturesLib: Move multi-instance function decl to header
Posted by Laszlo Ersek 4 years, 11 months ago
On 02/13/21 01:58, mikuback@linux.microsoft.com wrote:
> From: Michael Kubacki <michael.kubacki@microsoft.com>
> 
> FinishSmmCpuFeaturesInitializeProcessor() is a multi-instance
> internal library function that is currently not declared in a
> header file but embedded in "SmmCpuFeaturesLib.c".
> 
> This change cleans up the declaration moving it to a new header
> file "CpuFeaturesLib.h" and removing the local declaration in
> "SmmCpuFeaturesLib.c".
> 
> 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>
> ---
>  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c      | 11 +---------
>  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c |  1 +
>  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c                 |  1 +
>  UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h         | 22 ++++++++++++++++++++
>  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf    |  1 +
>  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf |  1 +
>  6 files changed, 27 insertions(+), 10 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
> index 8fed18cf0e17..75bde752785a 100644
> --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
> +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
> @@ -15,6 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include <Library/DebugLib.h>
>  #include <Register/Intel/Cpuid.h>
>  #include <Register/Intel/SmramSaveStateMap.h>
> +#include "CpuFeaturesLib.h"
>  
>  //
>  // Machine Specific Registers (MSRs)
> @@ -35,16 +36,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #define SMM_FEATURES_LIB_IA32_MCA_CAP              0x17D
>  #define   SMM_CODE_ACCESS_CHK_BIT                  BIT58
>  
> -/**
> -  Internal worker function that is called to complete CPU initialization at the
> -  end of SmmCpuFeaturesInitializeProcessor().
> -
> -**/
> -VOID
> -FinishSmmCpuFeaturesInitializeProcessor (
> -  VOID
> -  );
> -
>  //
>  // Set default value to assume SMRR is not supported
>  //
> diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c
> index 3e63c5e27f98..c562582ccee0 100644
> --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c
> +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c
> @@ -9,6 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  
>  #include <PiSmm.h>
>  #include <Library/SmmCpuFeaturesLib.h>
> +#include "CpuFeaturesLib.h"
>  
>  /**
>    Internal worker function that is called to complete CPU initialization at the
> diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c
> index f7f8afacffb5..b5aad41fdb64 100644
> --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c
> +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c
> @@ -21,6 +21,7 @@
>  
>  #include <Protocol/MpService.h>
>  
> +#include "CpuFeaturesLib.h"
>  #include "SmmStm.h"
>  
>  #define TXT_EVTYPE_BASE                  0x400
> diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h b/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h
> new file mode 100644
> index 000000000000..4645bbb066c9
> --- /dev/null
> +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h
> @@ -0,0 +1,22 @@
> +/** @file
> +  Internal library function definitions.
> +
> +  Copyright (c) Microsoft Corporation.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef _CPU_FEATURES_LIB_H_
> +#define _CPU_FEATURES_LIB_H_
> +
> +/**
> +  Internal worker function that is called to complete CPU initialization at the
> +  end of SmmCpuFeaturesInitializeProcessor().
> +
> +**/
> +VOID
> +FinishSmmCpuFeaturesInitializeProcessor (
> +  VOID
> +  );
> +
> +#endif
> diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
> index dd828baf69cb..a6d8467d26aa 100644
> --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
> +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
> @@ -17,6 +17,7 @@ [Defines]
>    CONSTRUCTOR                    = SmmCpuFeaturesLibConstructor
>  
>  [Sources]
> +  CpuFeaturesLib.h
>    SmmCpuFeaturesLib.c
>    SmmCpuFeaturesLibNoStm.c
>  
> diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
> index 50b9cc871302..89cd252ef44e 100644
> --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
> +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
> @@ -18,6 +18,7 @@ [Defines]
>    CONSTRUCTOR                    = SmmCpuFeaturesLibStmConstructor
>  
>  [Sources]
> +  CpuFeaturesLib.h
>    SmmCpuFeaturesLib.c
>    SmmStm.c
>    SmmStm.h
> 

Reviewed-by: Laszlo Ersek <lersek@redhat.com>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#71681): https://edk2.groups.io/g/devel/message/71681
Mute This Topic: https://groups.io/mt/80599744/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-