From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.2686.1617929108219518022 for ; Thu, 08 Apr 2021 17:45:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=fBr6sTGm; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: ray.ni@intel.com) IronPort-SDR: V7PtwEXMciY+Upuaoaz2mDD13noggw28wX3dsddquDu6Xg5WXjJyZH9JEjFbPNUOdsQeeHHNcQ 1eGa+HIK5fnQ== X-IronPort-AV: E=McAfee;i="6000,8403,9948"; a="193206285" X-IronPort-AV: E=Sophos;i="5.82,208,1613462400"; d="scan'208";a="193206285" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2021 17:45:07 -0700 IronPort-SDR: /viXLQ0fywLc8h2p+Be48jg0y34Ql5v3XiqZY37GBE+WdS/7+JnMN/+uZ10gjraCbY+lZbUMWq a3ixCCey++xQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,208,1613462400"; d="scan'208";a="397295975" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga002.jf.intel.com with ESMTP; 08 Apr 2021 17:45:06 -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; Thu, 8 Apr 2021 17:45:05 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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 via Frontend Transport; Thu, 8 Apr 2021 17:45:05 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.40) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Thu, 8 Apr 2021 17:45:05 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y5HdgbSX7Tcu9OHt7Tzao+gz2xpzEnLRhpMBuf2H7P+SfYK6JAH1kM5Qp25r3mhVYEJMro4KFGjvR2j05iPc9S0aGMwIgNc6faLBmh9RdxP2QlOhEAjb3vx/kPPxaDGzpvM2mLeCUVFC8nE46MJKjJVJPfF0XLuaFkfBaDhZqFTT8LYZtxgOiFNY4W6MafmuqygZXfO+6ttSJPZ/En5t7RkTzn/85ocb8VM0cqItdDBXntgx3qh5/17rQxKwVJZPOXTHIfW0tO3FHS9iUvmgW/0/439vgY1tewCwbgTdVv/Huqh++fde/3SfKibTjZFyyXSeqW5wjduq2xUyOAlGHQ== 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=5Lf2bJSXFW2C+JUvCZw+9zMuw8vbwVgAmFBBEtM18L4=; b=mulHGQlS0fUac8YNr8B12nEQJVur9fOLV2WrIjxFzFlJFV1Tyghxv9fFKqeksrfSrQaFtBjkw4xQLa4oHY6tIfrXg4yhOU8jMLd/Um54rl9W2tv+A57TdEPLRFCsvgZmYo02oAOA6em2LkUCaiqzelaqQE1PG9kvca96N0ykl7eAriKeZt9kbHenyQQayiCCAMXDhTu361c8hASPkkm/p3y+7tEpA3/aK4pNK1yKliN0Iv4NP7STzBeINLXsoRi2wmfzSmHSgD+CqunGENFIFPwBHSetQpmkTBK1dnFiftcS5zFaMNRyF4xr/nAhMCjPeh0OMgmojEe7Gxz9cMOvnA== 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=5Lf2bJSXFW2C+JUvCZw+9zMuw8vbwVgAmFBBEtM18L4=; b=fBr6sTGm7+YAiUijqujWA7eep8zzY2Sr4+0uE6F09wSZvM4eF679iLamPJoXkGUqM+cekwd2Gl9bvfaCrhwIkFoAarcN994Xn32Q0ugIIHjk3EJysJzQfYD/5ritJX1m8FZrZnYjbvevGljItlNUSNIGtClFYfnollpVUJ83vsg= Received: from CO1PR11MB4930.namprd11.prod.outlook.com (2603:10b6:303:9b::11) by MW3PR11MB4649.namprd11.prod.outlook.com (2603:10b6:303:5b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.20; Fri, 9 Apr 2021 00:45:04 +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; Fri, 9 Apr 2021 00:45:04 +0000 From: "Ni, Ray" To: "devel@edk2.groups.io" , "Ni, Ray" , "Lou, Yun" CC: "Dong, Eric" , Laszlo Ersek , "Kumar, Rahul1" Subject: Re: [edk2-devel] [PATCH v2] UefiCpuPkg: Remove PEI/DXE instances of CpuTimerLib. Thread-Topic: [edk2-devel] [PATCH v2] UefiCpuPkg: Remove PEI/DXE instances of CpuTimerLib. Thread-Index: AQHXK4ZVaUnVC5iDpEeX8ulMdHzonqqpx0uggAGUgjA= Date: Fri, 9 Apr 2021 00:45:04 +0000 Message-ID: References: <20210407081625.14254-1-yun.lou@intel.com> <1673BAF6BEAFB94F.26818@groups.io> In-Reply-To: <1673BAF6BEAFB94F.26818@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.194] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 93140b8c-28d2-4cbb-321f-08d8faf0b714 x-ms-traffictypediagnostic: MW3PR11MB4649: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:595; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ++cGVJ/MvRSAvSLCjLSyMNatMOgcuGz6zCDb9GA4YSrnCD56VcOJVcSxtuPWq7Up6OjgSIpVWVVIILjSQjUc5aYLBEF/RFOf9euzwxvv9YeFR1Lxyv9aIUfFhUGjdnpF/clOMNsu96NXOfDAdkfEmE4sWHB7OUwxpotgceCnK4QMNfjL6S/HPFuhh8DLZj3bAg5j84TBBKUKvQrS2D7dBwiOXc7+uRIr3M4+Eur6P7cw+XxGSPb80pOjiFrmMvub+YOyEWOM1DYmA9DC/CO6XUzjw1MunMrNtHaUqI7r2+3l+BXl5E/MFdHCGT6OufLqkHl+mgQBldPY9sYhbuGIgOOvSXG0Ol9dkvdGdKL5TwlS+vEv1Riz8mkQjRY1UtfJQIKNTTcL+OzIhJ+lQH0vMLeBqwEl/20MqFw9H7qC9QAdSX5BYKteBjsUdyWLW8GjI9qKixBRHWvt9/gBHB4QM+YT7uTe3voOZvD/VmzTqa7gg8qB0PZ40PzjNPHGnAVq6BzroLwPaFqnA9Q5BC9zRKTdZgZiiblZpTTuwk1Ffva7ntcEUOn8XOlN8mbjDQwDs+JKngbMZxRrrFHbFVhM+xiaILdiWZA88w5RfIpkAhkqscmOKIDcsEQAm4WjwFsE9rxmuRSxIqm+POlBsjj/74UXEwG7NpaWL1ykzqAMBnD7S/WD/8DADLNHlH26TL0igvyDTkzFXPvUWus5Kv+c4P6RYarzrcm/hfM7oEvtcwGPiXAUpgYav114wz7NcswW 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)(396003)(346002)(376002)(39860400002)(366004)(8676002)(6636002)(83380400001)(316002)(55016002)(33656002)(86362001)(38100700001)(54906003)(7696005)(110136005)(30864003)(9686003)(107886003)(4326008)(71200400001)(186003)(8936002)(53546011)(66946007)(66446008)(76116006)(6506007)(26005)(478600001)(2906002)(52536014)(966005)(5660300002)(66476007)(66556008)(64756008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?ZAiJNhLywSaEevvSt3Ycj1tS3rrDy5OhnY4JZ2qpGx4xvyeh7J2TUKSd6NhJ?= =?us-ascii?Q?XdQQjjq85+ObF13nuRaVnQgSjVciqRjHEuLYnkJJRbxVT1WkaIjH6BFS4z1v?= =?us-ascii?Q?AR8bFKP27PB7wFwWcLA2i/8SfrT6fzj6fHbCaPf6Aj7yJCSRrE11DH91PYTw?= =?us-ascii?Q?ecaZ1aDhxdoXWs6Tb2XDML9uZLAnJcziMbu0Fn68zyl1eIV7ELqf0nRMn1A1?= =?us-ascii?Q?R+Zk1koXIaAuppsTyEWF5i9JmvB5Bj7W7zgaFbLDJJtoXjIT0U5mSgwVJTyn?= =?us-ascii?Q?wOCdWLNEPxxz/8OpusLSGepnMngV6+ydkjNhZQRfla6ggNPvdukZTsIrdZ6d?= =?us-ascii?Q?YF6bwmxYAb6nIlyc0AMwKo9JtC/kxiq2aXfhVtISi7IJIGy69Ndostw2dV1R?= =?us-ascii?Q?eCqlQgCncl/zqV/ZZQjvXJOCbloxSiKG+IFdP6JJDmfzJzncCoiNxynzgvCt?= =?us-ascii?Q?eq1iL7r5a4PG+rC8BvQofqyjEYo851J5mnx5btaxOaioFl+2fBAq2eh6vsJg?= =?us-ascii?Q?GGkESHWBO0kpdUwT7WEulhmny4NZbwI2hkUQQjNY7JZG22M4qDu7i0Cr0RrZ?= =?us-ascii?Q?o/JB7dOhjJMhXkG3ZjYEs8JWz7w/1hKXOGcHBE0m+dWidCek5JVzlF+zXllT?= =?us-ascii?Q?RdP9DrVOgocGwNDFvWlUNzGdPP/1RRhpQswVJ+K65HP9cXpFIdKq3pTmFx00?= =?us-ascii?Q?0BumdFGKsJA1aGvjFnJPwMpN1j1TKrIfrGaDf6FAM8YgettTKkUkKYk6pbew?= =?us-ascii?Q?5obcdMEBl1BhRUDV/5KG+xYE8e/2WCifiCxdIp3IeXF6pNXZAC9oSuzX7IGK?= =?us-ascii?Q?0NTjrNNgOb6YEPd/wkBqMKqZa+4GZmmagiqoiq2YEwaYwZ4Ic6WHodgetNeq?= =?us-ascii?Q?zvoaibx4XwIgJxLNtDVV8B7iVyrggvZqiXAgdBZJYsSVvbopGeFEbFLOqJ/z?= =?us-ascii?Q?hRmQinz8OXyXLvfrccsTfKDo+Zdv7byPGUdLgWDgQ33msZrgUFEFVhCw33LP?= =?us-ascii?Q?iUFU6AGxTsXDR5P85Xqdu45ZTejAq10zQMFrO/L3+y2FIXmNZr6XRK/rgsQW?= =?us-ascii?Q?yk4cOI6LWuPJCRS5LpxzjNXa3Pc8Eg5Dv/JqVfeMLzc6JwFXCU8AZpajDVQq?= =?us-ascii?Q?5UScQAw3xu+e+eQXGabDhj0Xnps345v7sWRkWhfkKWz7N1i6eUFojT+2VI5l?= =?us-ascii?Q?HQomw5YlFyfVHO0K78dIH+ddjVoJeoUNji2nXgtwLxO50Ji2zB+oFU6b2DBH?= =?us-ascii?Q?8ndCugWf/7bxOd69H+m6jYaVAQ5+anSsLPQmtLHUMlqt3h2q4Y84WElTxHbG?= =?us-ascii?Q?F9cPZmCV17Q3FWEK0fMZbi5H?= 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: 93140b8c-28d2-4cbb-321f-08d8faf0b714 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2021 00:45:04.2200 (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: cZiDwFheySFINQcofPRDqiRfmeQVLlGGQcDFvH8zBxzYFVs636mxHuHDlkfCTTzhcZThnQJPIE0bJACgZbSy4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4649 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 Laszlo, OVMF isn't using this timerlib so I will assume you doesn't care about thi= s change. Thanks, Ray > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Ni, Ray > Sent: Thursday, April 8, 2021 8:37 AM > To: Lou, Yun ; devel@edk2.groups.io > Cc: Dong, Eric ; Laszlo Ersek ; > Kumar, Rahul1 > Subject: Re: [edk2-devel] [PATCH v2] UefiCpuPkg: Remove PEI/DXE > instances of CpuTimerLib. >=20 > Thanks for providing the detailed commit messages. > Reviewed-by: Ray Ni >=20 >=20 > > -----Original Message----- > > From: Lou, Yun > > Sent: Wednesday, April 7, 2021 4:16 PM > > To: devel@edk2.groups.io > > Cc: Lou, Yun ; Ni, Ray ; Dong, Er= ic > ; Laszlo Ersek > > ; Kumar, Rahul1 > > Subject: [PATCH v2] UefiCpuPkg: Remove PEI/DXE instances of > CpuTimerLib. > > > > From: Jason Lou > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2832 > > > > 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 > frequency > > by using CPUID[15h] each time. > > The time it takes to find CpuCrystalFrequencyHob (about 2000ns) is muc= h > > 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. > > > > 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 T= SC > > 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. > > > > I did some experiments on one server platform and collected following > data: > > 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. > > > > 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(); > > > > if (GuidHob =3D=3D NULL) { > > DEBUG((DEBUG_ERROR, "[PeiCpuTimerLib] - CpuCrystalFrequencyHob > can not be found!\n")); > > } else { > > DEBUG((DEBUG_ERROR, "[PeiCpuTimerLib] - Average time required t= o > find Hob =3D %d ns\n", \ > > DivU64x32(DivU64x64Remainder(MultU64x32((Ticks2 - Ticks1), > 1000000000), *CpuCrystalCounterFrequency, NULL), > > 1000))); > > } > > > > // > > // 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 > calculate TSC frequency =3D %d ns\n", \ > > DivU64x32(DivU64x64Remainder(MultU64x32((Ticks2 - Ticks1), > 1000000000), *CpuCrystalCounterFrequency, NULL), 1000))); > > > > 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(-) > > > > 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 > > > > - CPUID Leaf 0x15 for Core Crystal Clock frequency instance of Timer > Library. > > > > - > > > > - Copyright (c) 2019 Intel Corporation. All rights reserved.
> > > > - SPDX-License-Identifier: BSD-2-Clause-Patent > > > > - > > > > -**/ > > > > - > > > > -#include > > > > -#include > > > > -#include > > > > -#include > > > > - > > > > -extern GUID mCpuCrystalFrequencyHobGuid; > > > > - > > > > -/** > > > > - CPUID Leaf 0x15 for Core Crystal Clock Frequency. > > > > - > > > > - The TSC counting frequency is determined by using CPUID leaf 0x15. > Frequency in MHz =3D Core XTAL frequency * EBX/EAX. > > > > - In newer flavors of the CPU, core xtal frequency is returned in ECX= or 0 if > not supported. > > > > - @return The number of TSC counts per second. > > > > - > > > > -**/ > > > > -UINT64 > > > > -CpuidCoreClockCalculateTscFrequency ( > > > > - VOID > > > > - ); > > > > - > > > > -// > > > > -// Cached CPU Crystal counter frequency > > > > -// > > > > -UINT64 mCpuCrystalCounterFrequency =3D 0; > > > > - > > > > - > > > > -/** > > > > - Internal function to retrieves the 64-bit frequency in Hz. > > > > - > > > > - Internal function to retrieves the 64-bit frequency in Hz. > > > > - > > > > - @return The frequency in Hz. > > > > - > > > > -**/ > > > > -UINT64 > > > > -InternalGetPerformanceCounterFrequency ( > > > > - VOID > > > > - ) > > > > -{ > > > > - return mCpuCrystalCounterFrequency; > > > > -} > > > > - > > > > -/** > > > > - The constructor function is to initialize CpuCrystalCounterFrequenc= y. > > > > - > > > > - @param ImageHandle The firmware allocated handle for the EFI ima= ge. > > > > - @param SystemTable A pointer to the EFI System Table. > > > > - > > > > - @retval EFI_SUCCESS The constructor always returns RETURN_SUCCESS= . > > > > - > > > > -**/ > > > > -EFI_STATUS > > > > -EFIAPI > > > > -DxeCpuTimerLibConstructor ( > > > > - IN EFI_HANDLE ImageHandle, > > > > - IN EFI_SYSTEM_TABLE *SystemTable > > > > - ) > > > > -{ > > > > - EFI_HOB_GUID_TYPE *GuidHob; > > > > - > > > > - // > > > > - // Initialize CpuCrystalCounterFrequency > > > > - // > > > > - GuidHob =3D GetFirstGuidHob (&mCpuCrystalFrequencyHobGuid); > > > > - if (GuidHob !=3D NULL) { > > > > - mCpuCrystalCounterFrequency =3D *(UINT64*)GET_GUID_HOB_DATA > (GuidHob); > > > > - } else { > > > > - mCpuCrystalCounterFrequency =3D CpuidCoreClockCalculateTscFrequen= cy > (); > > > > - } > > > > - > > > > - if (mCpuCrystalCounterFrequency =3D=3D 0) { > > > > - return EFI_UNSUPPORTED; > > > > - } > > > > - > > > > - return EFI_SUCCESS; > > > > -} > > > > - > > > > 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 > > > > - CPUID Leaf 0x15 for Core Crystal Clock frequency instance as PEI Ti= mer > Library. > > > > - > > > > - Copyright (c) 2019 Intel Corporation. All rights reserved.
> > > > - SPDX-License-Identifier: BSD-2-Clause-Patent > > > > - > > > > -**/ > > > > - > > > > -#include > > > > -#include > > > > -#include > > > > -#include > > > > -#include > > > > - > > > > -extern GUID mCpuCrystalFrequencyHobGuid; > > > > - > > > > -/** > > > > - CPUID Leaf 0x15 for Core Crystal Clock Frequency. > > > > - > > > > - The TSC counting frequency is determined by using CPUID leaf 0x15. > Frequency in MHz =3D Core XTAL frequency * EBX/EAX. > > > > - In newer flavors of the CPU, core xtal frequency is returned in ECX= or 0 if > not supported. > > > > - @return The number of TSC counts per second. > > > > - > > > > -**/ > > > > -UINT64 > > > > -CpuidCoreClockCalculateTscFrequency ( > > > > - VOID > > > > - ); > > > > - > > > > -/** > > > > - Internal function to retrieves the 64-bit frequency in Hz. > > > > - > > > > - Internal function to retrieves the 64-bit frequency in Hz. > > > > - > > > > - @return The frequency in Hz. > > > > - > > > > -**/ > > > > -UINT64 > > > > -InternalGetPerformanceCounterFrequency ( > > > > - VOID > > > > - ) > > > > -{ > > > > - UINT64 *CpuCrystalCounterFrequency; > > > > - EFI_HOB_GUID_TYPE *GuidHob; > > > > - > > > > - CpuCrystalCounterFrequency =3D NULL; > > > > - GuidHob =3D GetFirstGuidHob (&mCpuCrystalFrequencyHobGuid); > > > > - if (GuidHob =3D=3D NULL) { > > > > - CpuCrystalCounterFrequency =3D > (UINT64*)BuildGuidHob(&mCpuCrystalFrequencyHobGuid, sizeof > > (*CpuCrystalCounterFrequency)); > > > > - ASSERT (CpuCrystalCounterFrequency !=3D NULL); > > > > - *CpuCrystalCounterFrequency =3D CpuidCoreClockCalculateTscFrequen= cy > (); > > > > - } else { > > > > - CpuCrystalCounterFrequency =3D (UINT64*)GET_GUID_HOB_DATA > (GuidHob); > > > > - } > > > > - > > > > - return *CpuCrystalCounterFrequency; > > > > -} > > > > - > > > > diff --git a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.inf > b/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.inf > > deleted file mode 100644 > > index 6c83549c87..0000000000 > > --- a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.inf > > +++ /dev/null > > @@ -1,37 +0,0 @@ > > -## @file > > > > -# DXE CPU Timer Library > > > > -# > > > > -# Provides basic timer support using CPUID Leaf 0x15 XTAL frequency.= The > performance > > > > -# counter features are provided by the processors time stamp counter= . > > > > -# > > > > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
> > > > -# SPDX-License-Identifier: BSD-2-Clause-Patent > > > > -# > > > > -## > > > > - > > > > -[Defines] > > > > - INF_VERSION =3D 0x00010005 > > > > - BASE_NAME =3D DxeCpuTimerLib > > > > - FILE_GUID =3D F22CC0DA-E7DB-4E4D-ABE2-A6081882= 33A2 > > > > - MODULE_TYPE =3D DXE_DRIVER > > > > - VERSION_STRING =3D 1.0 > > > > - LIBRARY_CLASS =3D TimerLib|DXE_CORE DXE_DRIVER > DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION > > UEFI_DRIVER SMM_CORE > > > > - CONSTRUCTOR =3D DxeCpuTimerLibConstructor > > > > - MODULE_UNI_FILE =3D DxeCpuTimerLib.uni > > > > - > > > > -[Sources] > > > > - CpuTimerLib.c > > > > - DxeCpuTimerLib.c > > > > - > > > > -[Packages] > > > > - MdePkg/MdePkg.dec > > > > - UefiCpuPkg/UefiCpuPkg.dec > > > > - > > > > -[LibraryClasses] > > > > - BaseLib > > > > - PcdLib > > > > - DebugLib > > > > - HobLib > > > > - > > > > -[Pcd] > > > > - gUefiCpuPkgTokenSpaceGuid.PcdCpuCoreCrystalClockFrequency ## > CONSUMES > > > > diff --git a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.uni > b/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.uni > > deleted file mode 100644 > > index f55b92abac..0000000000 > > --- a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.uni > > +++ /dev/null > > @@ -1,17 +0,0 @@ > > -// /** @file > > > > -// DXE CPU Timer Library > > > > -// > > > > -// Provides basic timer support using CPUID Leaf 0x15 XTAL frequency. > The performance > > > > -// counter features are provided by the processors time stamp counter= . > > > > -// > > > > -// Copyright (c) 2019, Intel Corporation. All rights reserved.
> > > > -// > > > > -// SPDX-License-Identifier: BSD-2-Clause-Patent > > > > -// > > > > -// **/ > > > > - > > > > - > > > > -#string STR_MODULE_ABSTRACT #language en-US "CPU Timer > Library" > > > > - > > > > -#string STR_MODULE_DESCRIPTION #language en-US "Provides bas= ic > timer support using CPUID Leaf 0x15 XTAL > > frequency." > > > > - > > > > diff --git a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.inf > b/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.inf > > deleted file mode 100644 > > index 7af0fc44a6..0000000000 > > --- a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.inf > > +++ /dev/null > > @@ -1,36 +0,0 @@ > > -## @file > > > > -# PEI CPU Timer Library > > > > -# > > > > -# Provides basic timer support using CPUID Leaf 0x15 XTAL frequency.= The > performance > > > > -# counter features are provided by the processors time stamp counter= . > > > > -# > > > > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
> > > > -# SPDX-License-Identifier: BSD-2-Clause-Patent > > > > -# > > > > -## > > > > - > > > > -[Defines] > > > > - INF_VERSION =3D 0x00010005 > > > > - BASE_NAME =3D PeiCpuTimerLib > > > > - FILE_GUID =3D 2B13DE00-1A5F-4DD7-A298-01B08AF1= 015A > > > > - MODULE_TYPE =3D BASE > > > > - VERSION_STRING =3D 1.0 > > > > - LIBRARY_CLASS =3D TimerLib|PEI_CORE PEIM > > > > - MODULE_UNI_FILE =3D PeiCpuTimerLib.uni > > > > - > > > > -[Sources] > > > > - CpuTimerLib.c > > > > - PeiCpuTimerLib.c > > > > - > > > > -[Packages] > > > > - MdePkg/MdePkg.dec > > > > - UefiCpuPkg/UefiCpuPkg.dec > > > > - > > > > -[LibraryClasses] > > > > - BaseLib > > > > - PcdLib > > > > - DebugLib > > > > - HobLib > > > > - > > > > -[Pcd] > > > > - gUefiCpuPkgTokenSpaceGuid.PcdCpuCoreCrystalClockFrequency ## > CONSUMES > > > > diff --git a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.uni > b/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.uni > > deleted file mode 100644 > > index 49beb44908..0000000000 > > --- a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.uni > > +++ /dev/null > > @@ -1,17 +0,0 @@ > > -// /** @file > > > > -// PEI CPU Timer Library > > > > -// > > > > -// Provides basic timer support using CPUID Leaf 0x15 XTAL frequency. > The performance > > > > -// counter features are provided by the processors time stamp counter= . > > > > -// > > > > -// Copyright (c) 2019, Intel Corporation. All rights reserved.
> > > > -// > > > > -// SPDX-License-Identifier: BSD-2-Clause-Patent > > > > -// > > > > -// **/ > > > > - > > > > - > > > > -#string STR_MODULE_ABSTRACT #language en-US "CPU Timer > Library" > > > > - > > > > -#string STR_MODULE_DESCRIPTION #language en-US "Provides bas= ic > timer support using CPUID Leaf 0x15 XTAL > > frequency." > > > > - > > > > 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 > > > > UefiCpuPkg/Application/Cpuid/Cpuid.inf > > > > UefiCpuPkg/Library/CpuTimerLib/BaseCpuTimerLib.inf > > > > - UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.inf > > > > - UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.inf > > > > UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf > > > > UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf > > > > > > > > -- > > 2.28.0.windows.1 >=20 >=20 >=20 >=20 >=20