From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (NAM02-BL2-obe.outbound.protection.outlook.com [40.92.3.54]) by mx.groups.io with SMTP id smtpd.web09.1132.1610663820654244244 for ; Thu, 14 Jan 2021 14:37:00 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=HX+niVde; spf=pass (domain: outlook.com, ip: 40.92.3.54, mailfrom: kun.q@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J27HT/9H8NuEhYZN9EO7gjlPu2B7ZbecI8vDs1Poj4XvEAQo/xkPBBMGz0k/HgSJ6elnaPHeRWr21zRVXSAzA9U6y0uV1LVYAhLfjV1jn1MdgJY5LKK8njHUJAtZjxiWPoz682e6rMAz4Fp0dUnLeYEUbzfHEOYXoVJhbeLDwjhvJnaSyq0jpEFi9mAwUVBPu9XbAVSjx8pjuatbOuwRPHVDKrsvI7IskA9lTd4tDF9M7cwLhJEHJ1bQ82avp4OCiGRG2iBnJnndwPV3DTl24FWubQVvBhOkbiWBSG9XItKxc73xEnbvI0XZCVi0iGl8D7dB8Hu1LTcVxOCVuiXV1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DaX8eY+j0qgJIOfvwnfPKmqs9D9g3/e6IQZZBS+gDq8=; b=krD8nrO/ZfQBoMZvzPMekaOUAVeMi9Rqm8fR8/mmO3cfcDwPB/ZLpElvnXM9eYhfu2ICvQo3eNQ/D2v5H2CNMTm4GUPUFsAgCSJMKtheYF1OF+NJPEegqpgTZV92bhfCjnLCICxfZ1o6SSML9/EOM+Tj21GaUaWrZumiefUl8eOGOPwNLiKMHjw/Eg5sK+97Pm0LIbCR9j4TBBw86hdlG9xhdxykehIEgrayfrh+Uuc6Nsb/RlJ924Zr9WmZGy5hK+TjUBTquaR8SMn/hk2k5kH9grTJG+SfuJ1YrxmOKRV0tPo0oqNgzSat0fobH/LqfA1EpknplgqEcjVAlhYc2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DaX8eY+j0qgJIOfvwnfPKmqs9D9g3/e6IQZZBS+gDq8=; b=HX+niVde+rBkSBYznDfmHyT/qF80Q3+H/nljYyoa406to0fQlR9Fdni44zYfvU/SY5PWBwxQ0ZLN2xxGeulv29sb3IIMBT924/9ichYTwTHNBLwkcxxoxzD4J9vQRiS+fTVkEjbpfmqVyWirWVz6LfTWWIGAyVepif5s4/iYnyP2zS7IrHOaY1cdROaXKZ/GhmsRymLox1M8Hz+HrkcPQd3YiWA96oujiNZQLDidOL/Qh6uGRgTfieyxdgIKJ/PP8NevwOZUm75oMlbfjeNkSWEOb9GuomvdtkT9U/c5NkzD3rsRpxG7V5oMZInbZp/y/UD9EomPAIujhAL7Enny9g== Received: from CY1NAM02FT023.eop-nam02.prod.protection.outlook.com (10.152.74.60) by CY1NAM02HT055.eop-nam02.prod.protection.outlook.com (10.152.74.179) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10; Thu, 14 Jan 2021 22:36:59 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com (2a01:111:e400:7e45::41) by CY1NAM02FT023.mail.protection.outlook.com (2a01:111:e400:7e45::237) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Thu, 14 Jan 2021 22:36:59 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:856D4A70840FB614122F7B57760814BC72AA28E0E4FD6F2352E6D36284A46D58;UpperCasedChecksum:B28EF1155A975159446FE359831A91B63706B31DA3F449C72F2059D26D1576B3;SizeAsReceived:7473;Count:47 Received: from MWHPR06MB3102.namprd06.prod.outlook.com ([fe80::acb3:ab69:563d:b0d6]) by MWHPR06MB3102.namprd06.prod.outlook.com ([fe80::acb3:ab69:563d:b0d6%5]) with mapi id 15.20.3742.012; Thu, 14 Jan 2021 22:36:59 +0000 From: "Kun Qin" To: devel@edk2.groups.io CC: Eric Dong , Ray Ni , Laszlo Ersek , Rahul Kumar Subject: [PATCH v3 17/18] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm Date: Thu, 14 Jan 2021 14:36:36 -0800 Message-ID: X-Mailer: git-send-email 2.30.0.windows.1 In-Reply-To: <20210114223637.2737-1-kun.q@outlook.com> References: <20210114223637.2737-1-kun.q@outlook.com> X-TMN: [eOun75EkQgrM5Lmo0ZulHLrbfN4ro5Bk] X-ClientProxiedBy: MW4PR04CA0389.namprd04.prod.outlook.com (2603:10b6:303:81::34) To MWHPR06MB3102.namprd06.prod.outlook.com (2603:10b6:301:3e::35) Return-Path: kun.q@outlook.com X-Microsoft-Original-Message-ID: <20210114223637.2737-13-kun.q@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (50.35.88.161) by MW4PR04CA0389.namprd04.prod.outlook.com (2603:10b6:303:81::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10 via Frontend Transport; Thu, 14 Jan 2021 22:36:58 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 437ef013-ace6-45dc-6abf-08d8b8dce793 X-MS-TrafficTypeDiagnostic: CY1NAM02HT055: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NjTWbzpxSITDu4xMmcgRMA5311yuf5RztgvZA9AJ/c5bQx2bxTbjUIM9t8RooGRDON1v7i8h+5C/vwAShl/0emn1u3LVtaAwTXJeZQzLxTFTNV71kclI2cY7e8z2qhuUkiawWm3TCpY0skBRkeW+SRMmh71qHOyBJKcV1iKglSfA9ThSLTUWFAQMcMXRVC7sXdHJySZlUpgsXRQRTbLkUvInFZ7syIQC8Xm8arFKrv0unFQURmcTVEgishCVtrMa X-MS-Exchange-AntiSpam-MessageData: a4+M/x9DVZNDVFreBGzffbqqdndpRdpkO9a5x4saiqChF2XQA7LkV/liP/kWG/dR2n2s4S28pd6oQvwXge9Ofmuxb+BuUgS459ocn7KXczpiSxrPYBdKHoWONQeT79+PjeHzNHpfLf85AULrCmtedA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jan 2021 22:36:58.9669 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-Network-Message-Id: 437ef013-ace6-45dc-6abf-08d8b8dce793 X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT023.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1NAM02HT055 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain This change abstracts standalone and traditional MM driver entrypoints into separate files to match corresponding driver entrypoint interfaces. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Signed-off-by: Kun Qin --- Notes: v3: - Revert file name change of "CpuIo2Smm" for review and git history concern [Laszlo] - Break driver entrypoint into separate patch [Laszlo] =20 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 =3D> CpuIo2StandaloneMm.inf} | 18 ++++= +------ UefiCpuPkg/UefiCpuPkg.dsc | 5 +++ 7 files changed, 93 insertions(+), 18 deletions(-) diff --git a/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.c b/UefiCpuPkg/CpuIo2Smm/CpuIo2= Smm.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 =20 - @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. =20 **/ 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/CpuIo2S= mm/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.
+Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#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/CpuIo2= Smm/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.
+Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#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/CpuIo2= Smm.h index c80261945f71..eda9fbb090cd 100644 --- a/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.h +++ b/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.h @@ -153,4 +153,16 @@ CpuIoServiceWrite ( IN VOID *Buffer ); =20 +/** + 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/CpuI= o2Smm.inf index b743a5e0e316..8c5d0542e3da 100644 --- a/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf +++ b/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf @@ -14,7 +14,7 @@ [Defines] MODULE_TYPE =3D DXE_SMM_DRIVER VERSION_STRING =3D 1.0 PI_SPECIFICATION_VERSION =3D 0x0001000A - ENTRY_POINT =3D SmmCpuIo2Initialize + ENTRY_POINT =3D TraditionalMmCpuIo2Initialize =20 # # 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 =20 [Packages] MdePkg/MdePkg.dec diff --git a/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf b/UefiCpuPkg/CpuIo2Smm/CpuI= o2StandaloneMm.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 Li= brary. # # Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: BSD-2-Clause-Patent # ## =20 [Defines] INF_VERSION =3D 0x00010005 - BASE_NAME =3D CpuIo2Smm - MODULE_UNI_FILE =3D CpuIo2Smm.uni - FILE_GUID =3D A47EE2D8-F60E-42fd-8E58-7BD65EE4C29B - MODULE_TYPE =3D DXE_SMM_DRIVER + BASE_NAME =3D CpuIo2StandaloneMm + FILE_GUID =3D E3121A26-BB1C-4A18-8E23-2EA3F0412248 + MODULE_TYPE =3D MM_STANDALONE VERSION_STRING =3D 1.0 - PI_SPECIFICATION_VERSION =3D 0x0001000A - ENTRY_POINT =3D SmmCpuIo2Initialize + PI_SPECIFICATION_VERSION =3D 0x00010032 + ENTRY_POINT =3D StandaloneMmCpuIo2Initialize =20 # # 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 =20 [Packages] MdePkg/MdePkg.dec =20 [LibraryClasses] - UefiDriverEntryPoint + StandaloneMmDriverEntryPoint BaseLib DebugLib IoLib @@ -42,6 +43,3 @@ [Protocols] =20 [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/U= efiRuntimeServicesTableLib.inf UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBoo= tServicesTableLib.inf UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf + StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint= /StandaloneMmDriverEntryPoint.inf DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableL= ib.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/SmmCpuE= xceptionHandlerLib.inf =20 +[LibraryClasses.common.MM_STANDALONE] + MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/Standalon= eMmServicesTableLib.inf + [LibraryClasses.common.UEFI_APPLICATION] UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiA= pplicationEntryPoint.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf @@ -122,6 +126,7 @@ [Components.IA32, Components.X64] NULL|UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.in= f } UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf + UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.inf UefiCpuPkg/CpuMpPei/CpuMpPei.inf UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf --=20 2.30.0.windows.1