public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kun Qin" <kun.q@outlook.com>
To: devel@edk2.groups.io
Cc: Eric Dong <eric.dong@intel.com>, Ray Ni <ray.ni@intel.com>,
	Laszlo Ersek <lersek@redhat.com>,
	Rahul Kumar <rahul1.kumar@intel.com>
Subject: [PATCH v3 17/18] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm
Date: Thu, 14 Jan 2021 14:36:36 -0800	[thread overview]
Message-ID: <MWHPR06MB3102EA6535A46E87F4D19553F3A80@MWHPR06MB3102.namprd06.prod.outlook.com> (raw)
In-Reply-To: <20210114223637.2737-1-kun.q@outlook.com>

This change abstracts standalone and traditional MM driver entrypoints
into separate files to match corresponding driver entrypoint interfaces.

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: Kun Qin <kun.q@outlook.com>
---

Notes:
    v3:
    - Revert file name change of "CpuIo2Smm" for review and git history
    concern [Laszlo]
    - Break driver entrypoint into separate patch [Laszlo]
    
    v2:
    - Removed "EFIAPI" for internal functions.

 UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.c                               |  9 ++----
 UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.c                      | 32 ++++++++++++++++++++
 UefiCpuPkg/CpuIo2Smm/CpuIo2TraditionalMm.c                     | 32 ++++++++++++++++++++
 UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.h                               | 12 ++++++++
 UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf                             |  3 +-
 UefiCpuPkg/CpuIo2Smm/{CpuIo2Smm.inf => CpuIo2StandaloneMm.inf} | 18 +++++------
 UefiCpuPkg/UefiCpuPkg.dsc                                      |  5 +++
 7 files changed, 93 insertions(+), 18 deletions(-)

diff --git a/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.c b/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.c
index c0a2baecee03..cc99fd59a184 100644
--- a/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.c
+++ b/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.c
@@ -371,18 +371,13 @@ CpuIoServiceWrite (
 /**
   The module Entry Point SmmCpuIoProtocol driver
 
-  @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 entry point is executed successfully.
   @retval Other        Some error occurs when executing this entry point.
 
 **/
 EFI_STATUS
-EFIAPI
-SmmCpuIo2Initialize (
-  IN EFI_HANDLE        ImageHandle,
-  IN EFI_SYSTEM_TABLE  *SystemTable
+CommonCpuIo2Initialize (
+  VOID
   )
 {
   EFI_STATUS  Status;
diff --git a/UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.c b/UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.c
new file mode 100644
index 000000000000..d6707d7bc8bc
--- /dev/null
+++ b/UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.c
@@ -0,0 +1,32 @@
+/** @file
+  Produces the SMM CPU I/O Protocol.
+
+Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiMm.h>
+
+#include "CpuIo2Smm.h"
+
+/**
+  The module Entry Point for Standalone MM CpuIoProtocol driver
+
+  @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 entry point is executed successfully.
+  @retval Other        Some error occurs when executing this entry point.
+
+**/
+EFI_STATUS
+EFIAPI
+StandaloneMmCpuIo2Initialize (
+  IN EFI_HANDLE           ImageHandle,
+  IN EFI_MM_SYSTEM_TABLE  *SystemTable
+  )
+{
+  return CommonCpuIo2Initialize ();
+}
diff --git a/UefiCpuPkg/CpuIo2Smm/CpuIo2TraditionalMm.c b/UefiCpuPkg/CpuIo2Smm/CpuIo2TraditionalMm.c
new file mode 100644
index 000000000000..5a4f41b160a4
--- /dev/null
+++ b/UefiCpuPkg/CpuIo2Smm/CpuIo2TraditionalMm.c
@@ -0,0 +1,32 @@
+/** @file
+  Produces the SMM CPU I/O Protocol.
+
+Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiSmm.h>
+
+#include "CpuIo2Smm.h"
+
+/**
+  The module Entry Point for Traditional MM CpuIoProtocol driver
+
+  @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 entry point is executed successfully.
+  @retval Other        Some error occurs when executing this entry point.
+
+**/
+EFI_STATUS
+EFIAPI
+TraditionalMmCpuIo2Initialize (
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  return CommonCpuIo2Initialize ();
+}
diff --git a/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.h b/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.h
index c80261945f71..eda9fbb090cd 100644
--- a/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.h
+++ b/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.h
@@ -153,4 +153,16 @@ CpuIoServiceWrite (
   IN VOID                            *Buffer
   );
 
+/**
+  The module Entry Point SmmCpuIoProtocol driver
+
+  @retval EFI_SUCCESS  The entry point is executed successfully.
+  @retval Other        Some error occurs when executing this entry point.
+
+**/
+EFI_STATUS
+CommonCpuIo2Initialize (
+  VOID
+  );
+
 #endif
diff --git a/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf b/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf
index b743a5e0e316..8c5d0542e3da 100644
--- a/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf
+++ b/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf
@@ -14,7 +14,7 @@ [Defines]
   MODULE_TYPE                    = DXE_SMM_DRIVER
   VERSION_STRING                 = 1.0
   PI_SPECIFICATION_VERSION       = 0x0001000A
-  ENTRY_POINT                    = SmmCpuIo2Initialize
+  ENTRY_POINT                    = TraditionalMmCpuIo2Initialize
 
 #
 # The following information is for reference only and not required by the build tools.
@@ -25,6 +25,7 @@ [Defines]
 [Sources]
   CpuIo2Smm.c
   CpuIo2Smm.h
+  CpuIo2TraditionalMm.c
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf b/UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.inf
similarity index 60%
copy from UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf
copy to UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.inf
index b743a5e0e316..c9fd3068cec4 100644
--- a/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf
+++ b/UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.inf
@@ -2,19 +2,19 @@
 #  Produces the SMM CPU I/O 2 Protocol by using the services of the I/O Library.
 #
 #  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) Microsoft Corporation.
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
 [Defines]
   INF_VERSION                    = 0x00010005
-  BASE_NAME                      = CpuIo2Smm
-  MODULE_UNI_FILE                = CpuIo2Smm.uni
-  FILE_GUID                      = A47EE2D8-F60E-42fd-8E58-7BD65EE4C29B
-  MODULE_TYPE                    = DXE_SMM_DRIVER
+  BASE_NAME                      = CpuIo2StandaloneMm
+  FILE_GUID                      = E3121A26-BB1C-4A18-8E23-2EA3F0412248
+  MODULE_TYPE                    = MM_STANDALONE
   VERSION_STRING                 = 1.0
-  PI_SPECIFICATION_VERSION       = 0x0001000A
-  ENTRY_POINT                    = SmmCpuIo2Initialize
+  PI_SPECIFICATION_VERSION       = 0x00010032
+  ENTRY_POINT                    = StandaloneMmCpuIo2Initialize
 
 #
 # The following information is for reference only and not required by the build tools.
@@ -25,12 +25,13 @@ [Defines]
 [Sources]
   CpuIo2Smm.c
   CpuIo2Smm.h
+  CpuIo2StandaloneMm.c
 
 [Packages]
   MdePkg/MdePkg.dec
 
 [LibraryClasses]
-  UefiDriverEntryPoint
+  StandaloneMmDriverEntryPoint
   BaseLib
   DebugLib
   IoLib
@@ -42,6 +43,3 @@ [Protocols]
 
 [Depex]
   TRUE
-
-[UserExtensions.TianoCore."ExtraFiles"]
-  CpuIo2SmmExtra.uni
diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index 9b56bcaabebe..4e46c600788f 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -38,6 +38,7 @@ [LibraryClasses]
   UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
   UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+  StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
   DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
   PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
   PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
@@ -94,6 +95,9 @@ [LibraryClasses.common.DXE_SMM_DRIVER]
   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
 
+[LibraryClasses.common.MM_STANDALONE]
+  MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
+
 [LibraryClasses.common.UEFI_APPLICATION]
   UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
   MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
@@ -122,6 +126,7 @@ [Components.IA32, Components.X64]
       NULL|UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf
   }
   UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf
+  UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.inf
   UefiCpuPkg/CpuMpPei/CpuMpPei.inf
   UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
   UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
-- 
2.30.0.windows.1


  parent reply	other threads:[~2021-01-14 22:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210114223637.2737-1-kun.q@outlook.com>
2021-01-14 22:36 ` [PATCH v3 06/18] MdeModulePkg: SmmLockBoxSmmLib: Support StandaloneMm for SmmLockBoxLib Kun Qin
2021-01-14 22:36 ` [PATCH v3 07/18] MdeModulePkg: SmmReportStatusCodeLib: ReportStatusCodeLib in StandaloneMm Kun Qin
2021-01-14 22:36 ` [PATCH v3 08/18] MdeModulePkg: StatusCodeHandler: StatusCodeHandler driver " Kun Qin
2021-01-14 22:36 ` [PATCH v3 09/18] MdeModulePkg: FirmwarePerformanceDataTable: Added StandaloneMm support Kun Qin
2021-01-14 22:36 ` [PATCH v3 10/18] MdeModulePkg: ReportStatusCodeRouter: Support StandaloneMm RSC Router Kun Qin
2021-01-14 22:36 ` [PATCH v3 11/18] MdePkg: UefiDevicePathLib: Support UefiDevicePathLib under StandaloneMm Kun Qin
2021-01-14 22:36 ` [PATCH v3 12/18] PcAtChipsetPkg: AcpiTimerLib: Added StandaloneMm instance of AcpiTimerLib Kun Qin
2021-01-14 22:36 ` [PATCH v3 13/18] SecurityPkg: Tcg2PhysicalPresenceLib: Introduce StandaloneMm instance Kun Qin
2021-01-14 22:36 ` [PATCH v3 14/18] SecurityPkg: Tcg2PpVendorLibNull: Added support for MM_STANDALONE type Kun Qin
2021-01-14 22:36 ` [PATCH v3 15/18] SecurityPkg: Tpm2DeviceLibDTpm: Introduce StandaloneMm instance Kun Qin
2021-01-14 22:36 ` [PATCH v3 16/18] UefiCpuPkg: CpuIo2Smm: Move CpuIo2Smm driver to consume gMmst Kun Qin
2021-01-15  7:12   ` Laszlo Ersek
2021-01-22  4:18     ` [edk2-devel] " Ni, Ray
2021-01-14 22:36 ` Kun Qin [this message]
2021-01-15  7:16   ` [PATCH v3 17/18] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm Laszlo Ersek
2021-01-22  4:17   ` [edk2-devel] " Ni, Ray
2021-01-22  4:40     ` Kun Qin
2021-01-22  6:29       ` Ni, Ray
2021-01-22  7:32         ` Kun Qin
2021-01-22 12:32       ` Laszlo Ersek
2021-01-22 18:10         ` Kun Qin
2021-01-14 22:36 ` [PATCH v3 18/18] UefiCpuPkg: SmmCpuExceptionHandlerLib: Added StandaloneMm module support Kun Qin
2021-01-22  3:51   ` Ni, Ray
     [not found] ` <165A3A3578F29D7F.16948@groups.io>
2021-01-21  1:46   ` [edk2-devel] [PATCH v3 12/18] PcAtChipsetPkg: AcpiTimerLib: Added StandaloneMm instance of AcpiTimerLib Kun Qin
2021-01-22  3:50     ` Ni, Ray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MWHPR06MB3102EA6535A46E87F4D19553F3A80@MWHPR06MB3102.namprd06.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox