From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web08.1400.1617842259474244042 for ; Wed, 07 Apr 2021 17:37:39 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=iMtZOYX0; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: ray.ni@intel.com) IronPort-SDR: iooYMyrVz9IKD2ZQxf6/XxaSgs9xiBDvNj6J8HMNfxsZKT0S4VyB9oqxR7VYSJDWKWr6bdVwg2 BFOzyCQVLa8Q== X-IronPort-AV: E=McAfee;i="6000,8403,9947"; a="190222387" X-IronPort-AV: E=Sophos;i="5.82,204,1613462400"; d="scan'208";a="190222387" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2021 17:37:38 -0700 IronPort-SDR: UMGzQ1aaq4ZFCBx+a+ehfQZGjlW9hMNPU2xq6RlKeKsEksxD2ojmom7HO/GlflFWJLwPlYUJZR uJe2nyWyVIFA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,204,1613462400"; d="scan'208";a="441527186" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga004.fm.intel.com with ESMTP; 07 Apr 2021 17:37:38 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Wed, 7 Apr 2021 17:37:38 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Wed, 7 Apr 2021 17:37:37 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Wed, 7 Apr 2021 17:37:37 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.48) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Wed, 7 Apr 2021 17:36:50 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xs6HwQcHzFNAPRLH6lvCjW7l17z7P4NmAu1cgSgvGc43GVbLTGIFWqqq8jKwj5PsAjpfjdc9qwA75xztQ6xKQqw2qC93RU+Sbw0JjsXUXLW83iV885NWyRatnBH55qaxfp1uti8bZAy8wI1LsTpg0gKFwHgqgIhuxUuvmQZ6rAkCIdNcNerVq5dm0xI1pmpQ3XLwpo1CuBXZF/NfzhvGkpWmJJV2tyAOr08aQlx+eJ7eCvWX8U68nHiNi+TTm7Hhk3VTfRHiwueYTysl3ln/6FC1bPJ9ankku8ANVMAC98ZPvSFWAuEo7IxYjs3PBWJ8krVcfiG6xDouc2lTHs81tA== 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=yIseo2LxZTq0nvpQ+ZA8zMnLFB71LB7mKU5Hj6PsqxY=; b=Nx/R2ua6A7GbqPLQS7Yji12Oz+BM8wIfGQEJGOFGBHzs0XmfqaQKZEjgq4Ygf7AhrRXsrDMoXxRcn59OUbBQc+ClYGnDqf9lcbHTqb3p9YrQ1roxkPYI1bS6aUAablherNYbjHDJbO0sfLI5gOTs03BDVGQwSV8H29ooR5Ygj6XBW2jY/h0z6NUGL7deGmj0LFfP2sWy2AW37WSiSi0QzE6qn9fGXq+J6S0D7mV3THJQvFDULunBj/ikvfQWpATbKvWVtqWYf/+pji05Xdyxbw1VS1QPCKoIm5xPbTiof0my47gfsUdcTQJIQsLOG+SjHMl+R4cUJc3Ee2X4wvggIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yIseo2LxZTq0nvpQ+ZA8zMnLFB71LB7mKU5Hj6PsqxY=; b=iMtZOYX09RYrTQcVZtjPY0zpM2uxiiHmkx1KgfZHRGfDglZh6k3Tx2G0EGX8lXJg2w34Tfax4azk8pBbKUw4gSTx2HcTG5IUOBo6socLiRoFttLZXLm/a/zYOMHW1Tmth4QZhS3QBVt5tFYYlFXUMPT88txP1gxQhp8yUHbq9bM= Received: from CO1PR11MB4930.namprd11.prod.outlook.com (2603:10b6:303:9b::11) by CO1PR11MB4882.namprd11.prod.outlook.com (2603:10b6:303:97::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Thu, 8 Apr 2021 00:36:50 +0000 Received: from CO1PR11MB4930.namprd11.prod.outlook.com ([fe80::59d6:8b94:55bf:36e7]) by CO1PR11MB4930.namprd11.prod.outlook.com ([fe80::59d6:8b94:55bf:36e7%5]) with mapi id 15.20.4020.018; Thu, 8 Apr 2021 00:36:49 +0000 From: "Ni, Ray" To: "Lou, Yun" , "devel@edk2.groups.io" CC: "Dong, Eric" , Laszlo Ersek , "Kumar, Rahul1" Subject: Re: [PATCH v2] UefiCpuPkg: Remove PEI/DXE instances of CpuTimerLib. Thread-Topic: [PATCH v2] UefiCpuPkg: Remove PEI/DXE instances of CpuTimerLib. Thread-Index: AQHXK4ZVaUnVC5iDpEeX8ulMdHzonqqpx0ug Date: Thu, 8 Apr 2021 00:36:49 +0000 Message-ID: References: <20210407081625.14254-1-yun.lou@intel.com> In-Reply-To: <20210407081625.14254-1-yun.lou@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [124.77.195.36] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7d3e83e3-1463-4d29-7c35-08d8fa2665fd x-ms-traffictypediagnostic: CO1PR11MB4882: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2043; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ROnECg/cbUUUkiYx+RosWdIYOoZKsCdHi3RPI9mPy4s0CMqASCXFdkgJgDsIMwxvD636OfY3cyTvEfIBipimNDut8Ys+OwvFWzP4ImHUqrFxUkSy5URIZ4cWAGICVioAZBlHz51SmZkfFRN4fDoezT3Sdg15c114yMXK3UoK8Y56iOLRAlrnEEpND8a9GZTkiH5x8gZzjhANizzttS8baebTPnrTzfAkBuGja0mzD+jlTUQlfprOIA+yzdd9cRZzHUCbJ68ZwNY2P1nuZujYLWyPxuTsVtE9BAoNtgvyLjnxp43p86Kx4dd8dxEho8UhGP7SiaVN9b79bzAdaTumBxIesoVqx6gT6c1/hsjBGbIZ8WCki7GfgsQk4jScFwerkDJ424hWRv5TqlBTiMaBp1/FmRUHw4vvfvj0EDB2Rb+UYsTK2+UzPJRKLGOc2I+3nh9P04B6ft7YJySakifBH22fopJQ+AJmWMN2JwMhiShvqU9UYfdCKz/hYr9HvCIizJp7zss+kdkViVXeTnDXSzzNWBbpLfENMc4Jw1yMqbSwciQ4NgMqaeShz4N/z3c5P6yrYPdMuJXkQuxVzHnrK2HLYb/tq3UW5TarnVW8bPa330fI5jfz58TVglXaj7hlrDKlaj3gvpAczCNL/yMoueqXuwTgladHKKnlVCR4ou9sy9gMAdjf3opSQ/tAdsoxMqULo5xJ8GmxPnUk0QLBuWagQ4AOYQTkX2+8/A7gXaRS5MLN3dKBngaawqTFfsX6 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB4930.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(136003)(346002)(376002)(39860400002)(366004)(396003)(76116006)(8936002)(54906003)(7696005)(30864003)(966005)(5660300002)(71200400001)(2906002)(66946007)(478600001)(316002)(8676002)(110136005)(38100700001)(33656002)(83380400001)(86362001)(186003)(64756008)(66556008)(66446008)(55016002)(52536014)(107886003)(6506007)(53546011)(4326008)(26005)(9686003)(66476007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?fkj4xipSJFaFAf3iMwyPxJ2JD0JFP2smFPaxlOEzlsRN2H51XcuuC716jTi8?= =?us-ascii?Q?0MtA8PXEqrabo0Td7qF6iQMxTwSzFwnZfZKIYGpm9jU/lmSnFXcIvAfHe1jP?= =?us-ascii?Q?tJpPxTMqTTQEdA6brvAKR+XQhx5R+QIqBTeQgZ6U6ctXpkZNH4rmPx+f13tS?= =?us-ascii?Q?sIg8CxyDnkZKy8+eWsS6WqsdiFkNtY4gfkm3XDL3fTTqr6/W5bLMyJO7gVg/?= =?us-ascii?Q?O3JSJpvOSze7VDGOf5ZG0WeYu9ynXoDIgBrPCRtIP3nT6gaPEw9ONqzIs2Ul?= =?us-ascii?Q?ny115tLZpskf3dK+zQBbumpcJkV7vKg7l8R9JnCeohEN3PuxoVnpYWZuqOmK?= =?us-ascii?Q?clWPZ5kF2dSfaUp8jhwQcsTzbRR+nIFX+q9v37mYm52C35TeYqvzTGUS/mjK?= =?us-ascii?Q?/VKiOJ8akpOsF1ky9bOZoF0gdcAqQV0jZu2NtoZTqV9A/sDo+hFnaAi2eNsQ?= =?us-ascii?Q?z4WHWBgmlG9uJa9gFJdqJQRQnYxa18n0mZqOoNG3RSuFBqc6qIZZlHQoZ1Yc?= =?us-ascii?Q?4uhusYZEOxjcAk9/6vhmfjqXPfV5Trq1zt5ROm5bAarqqWSb3RkcM0cuGyGd?= =?us-ascii?Q?wDBQdcKJqrbzc/+tsdsiAsjzYjCa2XOZKB/4leFCIO8NbwZZNsvXo3dYMM58?= =?us-ascii?Q?Uv+MX8jEiFGKZU7FRxGgj3RUxNyGhizuBPeVfyp1Vy8PLcY0mJ/XON9gbGey?= =?us-ascii?Q?2V/6K6+gEfsZrN7dl7ulbu6BvH6JZzX0u/Aora5Nd1bO2TfdbEuOm/x7s1cC?= =?us-ascii?Q?wEO9zJ+Uwuxh4/UBicLY2FAvrFPKXEOdv96m+HrK4f/HE9xdp9YBTlZkcBOl?= =?us-ascii?Q?f8Qx+meb9bE5/bmqwkRMEu8/ZJsy+S2e5M2sKrH8Crue/EIl3bLnklCm3NPX?= =?us-ascii?Q?7zJapYQI2pD1XGEF7txJeeAQwF4vIyMBydbE7luuz4JhzIiDCHUYGpLy53VT?= =?us-ascii?Q?oTAG1CFuJ4EOcUYSOuJxFfxlbO1tElsWaEFOb5Yy2DMfmG9AIqO0ctdTdrEN?= =?us-ascii?Q?KRSHca+Pqw/r5N+4DGXPtYJezmNfmwsq+fj5OwMtNODVbm3CIZ2f1Ofp11UK?= =?us-ascii?Q?8IQfJktpX6ANcYiy0GVCZl3SBIW83qmn+lKrluamNel8xEtWvBNynmst9xQ0?= =?us-ascii?Q?ssl3Ot/J7ar02t/xUC6ucGzEoLjDK7/2uVn0QPfoxx6KAuGlWRpu6U8qVlLi?= =?us-ascii?Q?QTuXWI6NAqNE3vQWSOlyiSVTRIMGuYdzpYxPAO8mPFTTUWqtUlrX6RtehT3L?= =?us-ascii?Q?z/kR9h3+zkJrbxEEGbpJZkiDD4MS+bCMOidiQ4zt+iNVUukDrWXTWAVWRVev?= =?us-ascii?Q?s/pSGoxbxYcETjJTft//+jT2?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4930.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d3e83e3-1463-4d29-7c35-08d8fa2665fd X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Apr 2021 00:36:49.7756 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: HsOU/UikQYhMqJz3ZN1mMo2F2HHAkETzOe4uinuKx8b5pFqh52Yw4ComPVn+/ELxj4l8V56N7ztyG4hMxRKK/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB4882 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks for providing the detailed commit messages. Reviewed-by: Ray Ni > -----Original Message----- > From: Lou, Yun > Sent: Wednesday, April 7, 2021 4:16 PM > To: devel@edk2.groups.io > Cc: Lou, Yun ; Ni, Ray ; Dong, Eric = ; Laszlo Ersek > ; Kumar, Rahul1 > Subject: [PATCH v2] UefiCpuPkg: Remove PEI/DXE instances of CpuTimerLib. >=20 > From: Jason Lou >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2832 >=20 > 1. Remove PEI instance(PeiCpuTimerLib). > PeiCpuTimerLib is currently designed to save time by getting CPU TSC > frequency from Hob. BaseCpuTimerLib is designed to calculate TSC frequenc= y > by using CPUID[15h] each time. > The time it takes to find CpuCrystalFrequencyHob (about 2000ns) is much > longer than it takes to calculate TSC frequency with CPUID[15h] (about > 450ns), which means using BaseCpuTimerLib to trigger a delay is more > accurate than using PeiCpuTimerLib, recommend to use BaseCpuTimerLib > instead of PeiCpuTimerLib. >=20 > 2. Remove DXE instance(DxeCpuTimerLib). > DxeCpuTimerLib is designed to calculate TSC frequency with CPUID[15h] in > its constructor function, then save it in a global variable. For this > design, once the driver containing this instance is running, this > constructor function is called, it will take extra time to calculate TSC > frequency. > The time it takes to get TSC frequency from global variable is shorter > than it takes to calculate TSC frequency with CPUID[15h], but 450ns is a > short time, the impact on the platform is very limited. > In addition, in order to simplify the code, recommend to use > BaseCpuTimerLib instead of DxeCpuTimerLib. >=20 > I did some experiments on one server platform and collected following dat= a: > 1. Average time required to find CpuCrystalFrequencyHob: about 2000 ns. > 2. Average time required to find the last Hob: about 2700 ns. > 2. Average time required to calculate TSC frequency: about 450 ns. >=20 > Reference code: > // > // Calculate average time required to find Hob. > // > DEBUG((DEBUG_ERROR, "[PeiCpuTimerLib] GetPerformanceCounterFrequency = - GetFirstGuidHob (1000 cycles)\n")); > Ticks1 =3D AsmReadTsc(); > for (i =3D 0; i < 1000; i++) { > GuidHob =3D GetFirstGuidHob (&mCpuCrystalFrequencyHobGuid); > } > Ticks2 =3D AsmReadTsc(); >=20 > if (GuidHob =3D=3D NULL) { > DEBUG((DEBUG_ERROR, "[PeiCpuTimerLib] - CpuCrystalFrequencyHob can= not be found!\n")); > } else { > DEBUG((DEBUG_ERROR, "[PeiCpuTimerLib] - Average time required to f= ind Hob =3D %d ns\n", \ > DivU64x32(DivU64x64Remainder(MultU64x32((Ticks2 - Ticks1), 1000= 000000), *CpuCrystalCounterFrequency, NULL), > 1000))); > } >=20 > // > // Calculate average time required to calculate CPU frequency. > // > DEBUG((DEBUG_ERROR, "[PeiCpuTimerLib] GetPerformanceCounterFrequency = - CpuidCoreClockCalculateTscFrequency (1000 > cycles)\n")); > Ticks1 =3D AsmReadTsc(); > for (i =3D 0; i < 1000; i++) { > Freq =3D CpuidCoreClockCalculateTscFrequency (); > } > Ticks2 =3D AsmReadTsc(); > DEBUG((DEBUG_ERROR, "[PeiCpuTimerLib] - Average time required to cal= culate TSC frequency =3D %d ns\n", \ > DivU64x32(DivU64x64Remainder(MultU64x32((Ticks2 - Ticks1), 100000= 0000), *CpuCrystalCounterFrequency, NULL), 1000))); >=20 > Signed-off-by: Jason Lou > Cc: Ray Ni > Cc: Eric Dong > Cc: Laszlo Ersek > Cc: Rahul Kumar > --- > UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.c | 85 -----------------= --- > UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.c | 58 ------------- > UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.inf | 37 --------- > UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.uni | 17 ---- > UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.inf | 36 --------- > UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.uni | 17 ---- > UefiCpuPkg/UefiCpuPkg.dsc | 2 - > 7 files changed, 252 deletions(-) >=20 > diff --git a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.c b/UefiCpuPkg= /Library/CpuTimerLib/DxeCpuTimerLib.c > deleted file mode 100644 > index 269e5a3e83..0000000000 > --- a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.c > +++ /dev/null > @@ -1,85 +0,0 @@ > -/** @file >=20 > - CPUID Leaf 0x15 for Core Crystal Clock frequency instance of Timer Lib= rary. >=20 > - >=20 > - Copyright (c) 2019 Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -extern GUID mCpuCrystalFrequencyHobGuid; >=20 > - >=20 > -/** >=20 > - CPUID Leaf 0x15 for Core Crystal Clock Frequency. >=20 > - >=20 > - The TSC counting frequency is determined by using CPUID leaf 0x15. Fre= quency in MHz =3D Core XTAL frequency * EBX/EAX. >=20 > - In newer flavors of the CPU, core xtal frequency is returned in ECX or= 0 if not supported. >=20 > - @return The number of TSC counts per second. >=20 > - >=20 > -**/ >=20 > -UINT64 >=20 > -CpuidCoreClockCalculateTscFrequency ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -// >=20 > -// Cached CPU Crystal counter frequency >=20 > -// >=20 > -UINT64 mCpuCrystalCounterFrequency =3D 0; >=20 > - >=20 > - >=20 > -/** >=20 > - Internal function to retrieves the 64-bit frequency in Hz. >=20 > - >=20 > - Internal function to retrieves the 64-bit frequency in Hz. >=20 > - >=20 > - @return The frequency in Hz. >=20 > - >=20 > -**/ >=20 > -UINT64 >=20 > -InternalGetPerformanceCounterFrequency ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - return mCpuCrystalCounterFrequency; >=20 > -} >=20 > - >=20 > -/** >=20 > - The constructor function is to initialize CpuCrystalCounterFrequency. >=20 > - >=20 > - @param ImageHandle The firmware allocated handle for the EFI image. >=20 > - @param SystemTable A pointer to the EFI System Table. >=20 > - >=20 > - @retval EFI_SUCCESS The constructor always returns RETURN_SUCCESS. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -DxeCpuTimerLibConstructor ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -{ >=20 > - EFI_HOB_GUID_TYPE *GuidHob; >=20 > - >=20 > - // >=20 > - // Initialize CpuCrystalCounterFrequency >=20 > - // >=20 > - GuidHob =3D GetFirstGuidHob (&mCpuCrystalFrequencyHobGuid); >=20 > - if (GuidHob !=3D NULL) { >=20 > - mCpuCrystalCounterFrequency =3D *(UINT64*)GET_GUID_HOB_DATA (GuidHob= ); >=20 > - } else { >=20 > - mCpuCrystalCounterFrequency =3D CpuidCoreClockCalculateTscFrequency = (); >=20 > - } >=20 > - >=20 > - if (mCpuCrystalCounterFrequency =3D=3D 0) { >=20 > - return EFI_UNSUPPORTED; >=20 > - } >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > diff --git a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.c b/UefiCpuPkg= /Library/CpuTimerLib/PeiCpuTimerLib.c > deleted file mode 100644 > index 91a7212056..0000000000 > --- a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.c > +++ /dev/null > @@ -1,58 +0,0 @@ > -/** @file >=20 > - CPUID Leaf 0x15 for Core Crystal Clock frequency instance as PEI Timer= Library. >=20 > - >=20 > - Copyright (c) 2019 Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -extern GUID mCpuCrystalFrequencyHobGuid; >=20 > - >=20 > -/** >=20 > - CPUID Leaf 0x15 for Core Crystal Clock Frequency. >=20 > - >=20 > - The TSC counting frequency is determined by using CPUID leaf 0x15. Fre= quency in MHz =3D Core XTAL frequency * EBX/EAX. >=20 > - In newer flavors of the CPU, core xtal frequency is returned in ECX or= 0 if not supported. >=20 > - @return The number of TSC counts per second. >=20 > - >=20 > -**/ >=20 > -UINT64 >=20 > -CpuidCoreClockCalculateTscFrequency ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -/** >=20 > - Internal function to retrieves the 64-bit frequency in Hz. >=20 > - >=20 > - Internal function to retrieves the 64-bit frequency in Hz. >=20 > - >=20 > - @return The frequency in Hz. >=20 > - >=20 > -**/ >=20 > -UINT64 >=20 > -InternalGetPerformanceCounterFrequency ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - UINT64 *CpuCrystalCounterFrequency; >=20 > - EFI_HOB_GUID_TYPE *GuidHob; >=20 > - >=20 > - CpuCrystalCounterFrequency =3D NULL; >=20 > - GuidHob =3D GetFirstGuidHob (&mCpuCrystalFrequencyHobGuid); >=20 > - if (GuidHob =3D=3D NULL) { >=20 > - CpuCrystalCounterFrequency =3D (UINT64*)BuildGuidHob(&mCpuCrystalFr= equencyHobGuid, sizeof > (*CpuCrystalCounterFrequency)); >=20 > - ASSERT (CpuCrystalCounterFrequency !=3D NULL); >=20 > - *CpuCrystalCounterFrequency =3D CpuidCoreClockCalculateTscFrequency = (); >=20 > - } else { >=20 > - CpuCrystalCounterFrequency =3D (UINT64*)GET_GUID_HOB_DATA (GuidHob); >=20 > - } >=20 > - >=20 > - return *CpuCrystalCounterFrequency; >=20 > -} >=20 > - >=20 > diff --git a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.inf b/UefiCpuP= kg/Library/CpuTimerLib/DxeCpuTimerLib.inf > deleted file mode 100644 > index 6c83549c87..0000000000 > --- a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.inf > +++ /dev/null > @@ -1,37 +0,0 @@ > -## @file >=20 > -# DXE CPU Timer Library >=20 > -# >=20 > -# Provides basic timer support using CPUID Leaf 0x15 XTAL frequency. Th= e performance >=20 > -# counter features are provided by the processors time stamp counter. >=20 > -# >=20 > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D DxeCpuTimerLib >=20 > - FILE_GUID =3D F22CC0DA-E7DB-4E4D-ABE2-A608188233A= 2 >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - LIBRARY_CLASS =3D TimerLib|DXE_CORE DXE_DRIVER DXE_RU= NTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION > UEFI_DRIVER SMM_CORE >=20 > - CONSTRUCTOR =3D DxeCpuTimerLibConstructor >=20 > - MODULE_UNI_FILE =3D DxeCpuTimerLib.uni >=20 > - >=20 > -[Sources] >=20 > - CpuTimerLib.c >=20 > - DxeCpuTimerLib.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - UefiCpuPkg/UefiCpuPkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - BaseLib >=20 > - PcdLib >=20 > - DebugLib >=20 > - HobLib >=20 > - >=20 > -[Pcd] >=20 > - gUefiCpuPkgTokenSpaceGuid.PcdCpuCoreCrystalClockFrequency ## CONSUMES >=20 > diff --git a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.uni b/UefiCpuP= kg/Library/CpuTimerLib/DxeCpuTimerLib.uni > deleted file mode 100644 > index f55b92abac..0000000000 > --- a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.uni > +++ /dev/null > @@ -1,17 +0,0 @@ > -// /** @file >=20 > -// DXE CPU Timer Library >=20 > -// >=20 > -// Provides basic timer support using CPUID Leaf 0x15 XTAL frequency. T= he performance >=20 > -// counter features are provided by the processors time stamp counter. >=20 > -// >=20 > -// Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -// >=20 > -// SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -// >=20 > -// **/ >=20 > - >=20 > - >=20 > -#string STR_MODULE_ABSTRACT #language en-US "CPU Timer Libra= ry" >=20 > - >=20 > -#string STR_MODULE_DESCRIPTION #language en-US "Provides basic = timer support using CPUID Leaf 0x15 XTAL > frequency." >=20 > - >=20 > diff --git a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.inf b/UefiCpuP= kg/Library/CpuTimerLib/PeiCpuTimerLib.inf > deleted file mode 100644 > index 7af0fc44a6..0000000000 > --- a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.inf > +++ /dev/null > @@ -1,36 +0,0 @@ > -## @file >=20 > -# PEI CPU Timer Library >=20 > -# >=20 > -# Provides basic timer support using CPUID Leaf 0x15 XTAL frequency. Th= e performance >=20 > -# counter features are provided by the processors time stamp counter. >=20 > -# >=20 > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D PeiCpuTimerLib >=20 > - FILE_GUID =3D 2B13DE00-1A5F-4DD7-A298-01B08AF1015= A >=20 > - MODULE_TYPE =3D BASE >=20 > - VERSION_STRING =3D 1.0 >=20 > - LIBRARY_CLASS =3D TimerLib|PEI_CORE PEIM >=20 > - MODULE_UNI_FILE =3D PeiCpuTimerLib.uni >=20 > - >=20 > -[Sources] >=20 > - CpuTimerLib.c >=20 > - PeiCpuTimerLib.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - UefiCpuPkg/UefiCpuPkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - BaseLib >=20 > - PcdLib >=20 > - DebugLib >=20 > - HobLib >=20 > - >=20 > -[Pcd] >=20 > - gUefiCpuPkgTokenSpaceGuid.PcdCpuCoreCrystalClockFrequency ## CONSUMES >=20 > diff --git a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.uni b/UefiCpuP= kg/Library/CpuTimerLib/PeiCpuTimerLib.uni > deleted file mode 100644 > index 49beb44908..0000000000 > --- a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.uni > +++ /dev/null > @@ -1,17 +0,0 @@ > -// /** @file >=20 > -// PEI CPU Timer Library >=20 > -// >=20 > -// Provides basic timer support using CPUID Leaf 0x15 XTAL frequency. T= he performance >=20 > -// counter features are provided by the processors time stamp counter. >=20 > -// >=20 > -// Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -// >=20 > -// SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -// >=20 > -// **/ >=20 > - >=20 > - >=20 > -#string STR_MODULE_ABSTRACT #language en-US "CPU Timer Libra= ry" >=20 > - >=20 > -#string STR_MODULE_DESCRIPTION #language en-US "Provides basic = timer support using CPUID Leaf 0x15 XTAL > frequency." >=20 > - >=20 > diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc > index 98c4c53465..c16cf8d1b9 100644 > --- a/UefiCpuPkg/UefiCpuPkg.dsc > +++ b/UefiCpuPkg/UefiCpuPkg.dsc > @@ -116,8 +116,6 @@ > UefiCpuPkg/Library/SecPeiDxeTimerLibUefiCpu/SecPeiDxeTimerLibUefiCpu.i= nf >=20 > UefiCpuPkg/Application/Cpuid/Cpuid.inf >=20 > UefiCpuPkg/Library/CpuTimerLib/BaseCpuTimerLib.inf >=20 > - UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.inf >=20 > - UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.inf >=20 > UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf >=20 > UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf >=20 >=20 >=20 > -- > 2.28.0.windows.1