From nobody Mon May 6 23:26:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+71752+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71752+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613597601532949.5355464333898; Wed, 17 Feb 2021 13:33:21 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id TG5kYY1788612xXBTmFiHkZQ; Wed, 17 Feb 2021 13:33:21 -0800 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web08.576.1613597595772400085 for ; Wed, 17 Feb 2021 13:33:15 -0800 X-Received: from localhost.localdomain (unknown [131.107.174.202]) by linux.microsoft.com (Postfix) with ESMTPSA id EBA8C20B57A0; Wed, 17 Feb 2021 13:33:14 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EBA8C20B57A0 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Laszlo Ersek , Rahul Kumar Subject: [edk2-devel] [PATCH v3 1/5] UefiCpuPkg/SmmCpuFeaturesLib: Move multi-instance function decl to header Date: Wed, 17 Feb 2021 13:32:23 -0800 Message-Id: <20210217213227.1277-2-mikuback@linux.microsoft.com> In-Reply-To: <20210217213227.1277-1-mikuback@linux.microsoft.com> References: <20210217213227.1277-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mikuback@linux.microsoft.com X-Gm-Message-State: WdqisadLiag4khmMFUHIr5etx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613597601; bh=b0587iIZGETN8EJxq7/l27u9d0rKSHRRd+ph2+OeQ2s=; h=Cc:Date:From:Reply-To:Subject:To; b=pQD5Zl9ZfsMjZZ6w8aWtBfKK5vArWOW8z2oQzHuMtvlYldVdV5n2qPRDOEEn7xm54NK q0o/8oG5rAIXcCQUtJUaMg38GYXsa7w56WB3Uiy6ZKgNOAAlA+tdPCRIIQXPWj97fJwdm X3cKL6pBR+mAIZGET6pmp10OeWbqaCA4X6A= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Michael Kubacki 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 Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Signed-off-by: Michael Kubacki Reviewed-by: Laszlo Ersek Reviewed-by: Eric Dong for this serial. --- 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/Uef= iCpuPkg/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 #include #include +#include "CpuFeaturesLib.h" =20 // // 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 =20 -/** - Internal worker function that is called to complete CPU initialization a= t 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 =20 #include #include +#include "CpuFeaturesLib.h" =20 /** Internal worker function that is called to complete CPU initialization a= t the diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c b/UefiCpuPkg/Lib= rary/SmmCpuFeaturesLib/SmmStm.c index f7f8afacffb5..b5aad41fdb64 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c @@ -21,6 +21,7 @@ =20 #include =20 +#include "CpuFeaturesLib.h" #include "SmmStm.h" =20 #define TXT_EVTYPE_BASE 0x400 diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h b/UefiCp= uPkg/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 a= t the + end of SmmCpuFeaturesInitializeProcessor(). + +**/ +VOID +FinishSmmCpuFeaturesInitializeProcessor ( + VOID + ); + +#endif diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf b/U= efiCpuPkg/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 =3D SmmCpuFeaturesLibConstructor =20 [Sources] + CpuFeaturesLib.h SmmCpuFeaturesLib.c SmmCpuFeaturesLibNoStm.c =20 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 =3D SmmCpuFeaturesLibStmConstructor =20 [Sources] + CpuFeaturesLib.h SmmCpuFeaturesLib.c SmmStm.c SmmStm.h --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#71752): https://edk2.groups.io/g/devel/message/71752 Mute This Topic: https://groups.io/mt/80715267/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon May 6 23:26:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+71753+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71753+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1613597610; cv=none; d=zohomail.com; s=zohoarc; b=QQM6qbgj6pzvH0OB9cKVJiNizyg5fxcLv7w7vjW/f49M7JHnfygJi4osJhQGdU/ZSeC9pD7vxdKVXudRoLn/jNvOPm0DjZkcqby/a7HlZ2wsy22XwIa9/zR0ZiLP5GS42NAPoZsOU8z0vXfHvV9xCC0qzA54XMhBhgd08HKygbY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613597610; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=hv5mf4k2puuw/L9P1GGNjbVK4hKJRnB+PLISnmqwioE=; b=dUPmxkq/YrtGvDfNJkftpsTE46LQzsvsIDsiIiORroT2shkXJOcg+n3jz9NjrqCG4jFJgY+iZP7kY3Mp8pKYlmelrclVp7DwuxlG8VPKIaSOF2iHFOm8VY/9mwba1EvYloUnhD4Acz9bfVquSrjmws1CqZkInaXRbVBfQy56PxI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71753+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613597610045289.5616149504566; Wed, 17 Feb 2021 13:33:30 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id potiYY1788612xhvyc54awQy; Wed, 17 Feb 2021 13:33:29 -0800 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.597.1613597599314209835 for ; Wed, 17 Feb 2021 13:33:19 -0800 X-Received: from localhost.localdomain (unknown [131.107.174.202]) by linux.microsoft.com (Postfix) with ESMTPSA id C0B1720B57A0; Wed, 17 Feb 2021 13:33:18 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C0B1720B57A0 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Laszlo Ersek , Rahul Kumar Subject: [edk2-devel] [PATCH v3 2/5] UefiCpuPkg/SmmCpuFeaturesLib: Rename SmmCpuFeaturesLib.c Date: Wed, 17 Feb 2021 13:32:24 -0800 Message-Id: <20210217213227.1277-3-mikuback@linux.microsoft.com> In-Reply-To: <20210217213227.1277-1-mikuback@linux.microsoft.com> References: <20210217213227.1277-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mikuback@linux.microsoft.com X-Gm-Message-State: qdupy3PuM4taPUSk3nNefUdUx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613597609; bh=KW++4vYgm/glfKfNxoJhuEO3wXuLYaron4X2DeTg59Q=; h=Cc:Date:From:Reply-To:Subject:To; b=qxutTY3On5bmaa0CpymLKhg+ul81NB96qgM7Q4v/GSYjlVBntQJey7fF/OH6utGlw7k q1sVPl/oM9QhFsvVsQDCTZkWwiSmmDlqiAb9TZoBkjSP94meyVAJ2XIRL3PWqYeA+d8S/ fX27L29hKuiBYPx6UcapjEEeuR7TaqsNpbs= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Michael Kubacki This change renames SmmCpuFeaturesLib.c to SmmCpuFeaturesLibCommon.c to better convey that this file contains library implementation common to all library instances. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Signed-off-by: Michael Kubacki Reviewed-by: Eric Dong for this serial. Reviewed-by: Laszlo Ersek --- UefiCpuPkg/Library/SmmCpuFeaturesLib/{SmmCpuFeaturesLib.c =3D> SmmCpuFeatu= resLibCommon.c} | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf = | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf = | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/Uef= iCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c similarity index 96% rename from UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c rename to UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c index 75bde752785a..36c48310c31e 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c @@ -1,5 +1,5 @@ /** @file -The CPU specific programming for PiSmmCpuDxeSmm module. +Implementation shared across all library instances. =20 Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf b/U= efiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf index a6d8467d26aa..7ebb0b0ef011 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf @@ -18,7 +18,7 @@ [Defines] =20 [Sources] CpuFeaturesLib.h - SmmCpuFeaturesLib.c + SmmCpuFeaturesLibCommon.c SmmCpuFeaturesLibNoStm.c =20 [Packages] diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf = b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf index 89cd252ef44e..78f8e4b42c44 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf @@ -19,7 +19,7 @@ [Defines] =20 [Sources] CpuFeaturesLib.h - SmmCpuFeaturesLib.c + SmmCpuFeaturesLibCommon.c SmmStm.c SmmStm.h =20 --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#71753): https://edk2.groups.io/g/devel/message/71753 Mute This Topic: https://groups.io/mt/80715268/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon May 6 23:26:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+71754+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71754+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1613597609; cv=none; d=zohomail.com; s=zohoarc; b=CTtyflSzoDvPWC7qunA1m01m5w6q3A6hNAWX5TjjsbrWZjzUQFnQTD3pY1QXgmUSfZQpOs/HzjiJnLyWFiqKptqIU6sY/BYZHPo8pRhbwdt5eKGcaemlJ96+Zq9t5pygrtQtDXJZ/Hr3nRDBtlmfI8/tQzgvrACUzODkH2piGvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613597609; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=YqR6j5m3m34D+UrS/HODvZfH6SvLe4TdxGcSoqevfUQ=; b=QuYp+mTf2P4P8MVX1ZD1cllUjWkwcCDF+y21Evzs0ZN9RjBGE350snHpKK5uq4otdJr+TeaV9N3qVAWoFhByqK1oFM1b7c2ljYQReaX4L8ip62Bggg56M7GctnI6slmNz2oP7ngRT6aU8UwigM6LgjIpjDpnE+WZ84nkSbS+vCk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71754+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613597609168921.0473240526187; Wed, 17 Feb 2021 13:33:29 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id TvmNYY1788612xMO1brVqUsu; Wed, 17 Feb 2021 13:33:22 -0800 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web08.579.1613597602368339293 for ; Wed, 17 Feb 2021 13:33:22 -0800 X-Received: from localhost.localdomain (unknown [131.107.174.202]) by linux.microsoft.com (Postfix) with ESMTPSA id 0152520B57A0; Wed, 17 Feb 2021 13:33:21 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0152520B57A0 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Laszlo Ersek , Rahul Kumar Subject: [edk2-devel] [PATCH v3 3/5] UefiCpuPkg/SmmCpuFeaturesLib: Cleanup library constructors Date: Wed, 17 Feb 2021 13:32:25 -0800 Message-Id: <20210217213227.1277-4-mikuback@linux.microsoft.com> In-Reply-To: <20210217213227.1277-1-mikuback@linux.microsoft.com> References: <20210217213227.1277-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mikuback@linux.microsoft.com X-Gm-Message-State: LR6DWNI4bSsEFOeK53rpp6fux1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613597602; bh=5Ym/ICggSDA912MtNtLT7A04eYZRYQi7vdXUZ0P96Nk=; h=Cc:Date:From:Reply-To:Subject:To; b=dx0lOvcp6yuD2VGopJgdsZIfBreXmuVJ+8bB6VkjXLuxLunb6j2vWu/iO6R1/qgVvz3 Hs1vSIfCt90A+iUezaOiSXAj/bbgzTocFZnuQLho3ZMlHE0dZVMju7ThtwE5glgb7GqEh ufy2FYBbYTTZK0Pg5XPkWdg+7P/M2Eb41Vw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Michael Kubacki There's currently two library instances: 1. SmmCpuFeaturesLib 2. SmmCpuFeaturesLibStm There's two constructor functions: 1. SmmCpuFeaturesLibConstructor() 2. SmmCpuFeaturesLibStmConstructor() SmmCpuFeaturesLibConstructor() is called by SmmCpuFeaturesLibStmConstructor() since the functionality in that function is required by both library instances. The declaration for SmmCpuFeaturesLibConstructor() is embedded in "SmmStm.c" instead of being declared in a header file. Further, that constructor function is called by the STM specific constructor. This change moves the common code to a function called CpuFeaturesLibInitialization() which is declared in an internal library header file "CpuFeaturesLib.h". Each constructor simply calls this function to perform the common functionality. Additionally, SmmCpuFeaturesLibConstructor() is moved from SmmCpuFeaturesLibNoStm.c into a instance-specific file allowing SmmCpuFeaturesLibNoStm.c to contain no STM implementation agnostic to a particular library instance. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Signed-off-by: Michael Kubacki Reviewed-by: Laszlo Ersek Reviewed-by: Eric Dong for this serial. --- UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 31 ++++++= ++++++++++++++ UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c | 19 +++++-= ------ UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c | 23 ++----= --------- UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h | 12 ++++++= ++ UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf | 1 + 5 files changed, 54 insertions(+), 32 deletions(-) diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/Uef= iCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c new file mode 100644 index 000000000000..00948a191fad --- /dev/null +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c @@ -0,0 +1,31 @@ +/** @file +Implementation specific to the SmmCpuFeatureLib library instance. + +Copyright (c) Microsoft Corporation.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include "CpuFeaturesLib.h" + +/** + The constructor function for the Traditional MM library instance without= STM. + + @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 constructor always returns EFI_SUCCESS. + +**/ +EFI_STATUS +EFIAPI +SmmCpuFeaturesLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + CpuFeaturesLibInitialization (); + + return EFI_SUCCESS; +} diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c= b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c index 36c48310c31e..7a919c5ee70f 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c @@ -2,6 +2,7 @@ Implementation shared across all library instances. =20 Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -63,19 +64,15 @@ BOOLEAN mNeedConfigureMtrrs =3D TRUE; BOOLEAN *mSmrrEnabled; =20 /** - The constructor function + Performs library initialization. =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 constructor always returns EFI_SUCCESS. + This initialization function contains common functionality shared betwen= all + library instance constructors. =20 **/ -EFI_STATUS -EFIAPI -SmmCpuFeaturesLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable +VOID +CpuFeaturesLibInitialization ( + VOID ) { UINT32 RegEax; @@ -162,8 +159,6 @@ SmmCpuFeaturesLibConstructor ( // mSmrrEnabled =3D (BOOLEAN *)AllocatePool (sizeof (BOOLEAN) * PcdGet32 (P= cdCpuMaxLogicalProcessorNumber)); ASSERT (mSmrrEnabled !=3D NULL); - - return EFI_SUCCESS; } =20 /** diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c b/UefiCpuPkg/Lib= rary/SmmCpuFeaturesLib/SmmStm.c index b5aad41fdb64..dcc2e9f9a09a 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c @@ -30,22 +30,6 @@ #define RDWR_ACCS 3 #define FULL_ACCS 7 =20 -/** - The constructor function - - @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 constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -SmmCpuFeaturesLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - EFI_HANDLE mStmSmmCpuHandle =3D NULL; =20 BOOLEAN mLockLoadMonitor =3D FALSE; @@ -112,7 +96,7 @@ UINTN mMsegSize =3D 0; BOOLEAN mStmConfigurationTableInitialized =3D FALSE; =20 /** - The constructor function + The constructor function for the Traditional MM library instance with ST= M. =20 @param[in] ImageHandle The firmware allocated handle for the EFI image. @param[in] SystemTable A pointer to the EFI System Table. @@ -138,10 +122,9 @@ SmmCpuFeaturesLibStmConstructor ( SmmCpuFeaturesLibStmSmiEntryFixupAddress (); =20 // - // Call the common constructor function + // Perform library initialization common across all instances // - Status =3D SmmCpuFeaturesLibConstructor (ImageHandle, SystemTable); - ASSERT_EFI_ERROR (Status); + CpuFeaturesLibInitialization (); =20 // // Lookup the MP Services Protocol diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h b/UefiCp= uPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h index 4645bbb066c9..f9a758e82558 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h @@ -9,6 +9,18 @@ #ifndef _CPU_FEATURES_LIB_H_ #define _CPU_FEATURES_LIB_H_ =20 +/** + Performs library initialization. + + This initialization function contains common functionality shared betwen= all + library instance constructors. + +**/ +VOID +CpuFeaturesLibInitialization ( + VOID + ); + /** Internal worker function that is called to complete CPU initialization a= t the end of SmmCpuFeaturesInitializeProcessor(). diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf b/U= efiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf index 7ebb0b0ef011..ddd00eeceb84 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf @@ -18,6 +18,7 @@ [Defines] =20 [Sources] CpuFeaturesLib.h + SmmCpuFeaturesLib.c SmmCpuFeaturesLibCommon.c SmmCpuFeaturesLibNoStm.c =20 --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#71754): https://edk2.groups.io/g/devel/message/71754 Mute This Topic: https://groups.io/mt/80715269/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon May 6 23:26:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+71755+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71755+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1613597611; cv=none; d=zohomail.com; s=zohoarc; b=R7XfhpZbgbD0mLMnxTEpEpJwMZj2sTW1MvcEYvRG0L0Siwc7JjzTXvsNds71Olix7Gk16JOXBqMqgb/qknPkom91jcBfONwf2s4FZiCbRJ9iposKYA6Fb8tde3M9jSjy72cU7Xse/CYdtUFuXo7e2pSy9kLSLhnKmvnQpkibALc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613597611; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=HFWZPJi2/uOIc5000C8BWXQvmtFBsQs6I7e/lO7iTYs=; b=M+k+A15Bc9wtjSTFoT3QL2E6U6cgCXwCxyBHlyV6j/e/fSH+ON2UoJHiOX9UENmHazcXQzQsxlPN80ZAIuDjptS4K/D8XS9tpU3H2ps8TUbnVFl7IynwWIxisSCUMoWY0soYzhmy2SmJJK7Yw8LHtKxkVU6LSmc+T+1V4enL9SI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71755+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613597611267562.5152173477682; Wed, 17 Feb 2021 13:33:31 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id JsoeYY1788612x61miGhPONW; Wed, 17 Feb 2021 13:33:30 -0800 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.599.1613597605493580068 for ; Wed, 17 Feb 2021 13:33:25 -0800 X-Received: from localhost.localdomain (unknown [131.107.174.202]) by linux.microsoft.com (Postfix) with ESMTPSA id 3F92320B6C40; Wed, 17 Feb 2021 13:33:25 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3F92320B6C40 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Laszlo Ersek , Rahul Kumar Subject: [edk2-devel] [PATCH v3 4/5] UefiCpuPkg/SmmCpuFeaturesLib: Abstract PcdCpuMaxLogicalProcessorNumber Date: Wed, 17 Feb 2021 13:32:26 -0800 Message-Id: <20210217213227.1277-5-mikuback@linux.microsoft.com> In-Reply-To: <20210217213227.1277-1-mikuback@linux.microsoft.com> References: <20210217213227.1277-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mikuback@linux.microsoft.com X-Gm-Message-State: SpO6NVFEykiZ8F0Puh89QBOMx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613597610; bh=zOvipnTw9KgVicKuxJIP5uPeFXzvm0WfL+OjmJml77k=; h=Cc:Date:From:Reply-To:Subject:To; b=L0+H5jru7KvKdjZQ5tVLZTZ+r/6wv9ChyZqC9VthwZBEF5jJJyXDsHV4O6FC8S4P/MV iVV1+jcZqGjzw+3T1MuGK7GrVpy/zLQQU1CG0sLN+IEOEpcpBs5AKiRqVi4YVnvqUuEX/ tw71Q3lMrAumGCFK3U9A84wTbDX8lVAmZfw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3218 Adds a new function called GetCpuMaxLogicalProcessorNumber() to return the number of maximum CPU logical processors (currently gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber). This allows the the mechanism used to retrieve the CPU maximum logical processor number to be abstracted from the logic that needs the value. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Signed-off-by: Michael Kubacki Reviewed-by: Laszlo Ersek Reviewed-by: Eric Dong for this serial. --- UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/TraditionalMmCpuFeaturesLib.c | 28 ++= ++++++++++++++++++ UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h | 14 ++= ++++++++ UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf | 1 + UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf | 1 + 5 files changed, 45 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c= b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c index 7a919c5ee70f..50379f3aea19 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c @@ -157,7 +157,7 @@ CpuFeaturesLibInitialization ( // // Allocate array for state of SMRR enable on all CPUs // - mSmrrEnabled =3D (BOOLEAN *)AllocatePool (sizeof (BOOLEAN) * PcdGet32 (P= cdCpuMaxLogicalProcessorNumber)); + mSmrrEnabled =3D (BOOLEAN *)AllocatePool (sizeof (BOOLEAN) * GetCpuMaxLo= gicalProcessorNumber ()); ASSERT (mSmrrEnabled !=3D NULL); } =20 diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/TraditionalMmCpuFeaturesL= ib.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/TraditionalMmCpuFeaturesLib.c new file mode 100644 index 000000000000..b7a5c1926e4d --- /dev/null +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/TraditionalMmCpuFeaturesLib.c @@ -0,0 +1,28 @@ +/** @file + Traditional MM CPU specific programming. + + Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include "CpuFeaturesLib.h" + +/** + Gets the maximum number of logical processors from the PCD PcdCpuMaxLogi= calProcessorNumber. + + This access is abstracted from the PCD services to enforce that the PCD = be + FixedAtBuild in the Standalone MM build of this driver. + + @return The value of PcdCpuMaxLogicalProcessorNumber. + +**/ +UINT32 +GetCpuMaxLogicalProcessorNumber ( + VOID + ) +{ + return PcdGet32 (PcdCpuMaxLogicalProcessorNumber); +} diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h b/UefiCp= uPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h index f9a758e82558..2b6bfa899a48 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h @@ -31,4 +31,18 @@ FinishSmmCpuFeaturesInitializeProcessor ( VOID ); =20 +/** + Gets the maximum number of logical processors from the PCD PcdCpuMaxLogi= calProcessorNumber. + + This access is abstracted from the PCD services to enforce that the PCD = be + FixedAtBuild in the Standalone MM build of this driver. + + @return The value of PcdCpuMaxLogicalProcessorNumber. + +**/ +UINT32 +GetCpuMaxLogicalProcessorNumber ( + VOID + ); + #endif diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf b/U= efiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf index ddd00eeceb84..35292dac31ba 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf @@ -21,6 +21,7 @@ [Sources] SmmCpuFeaturesLib.c SmmCpuFeaturesLibCommon.c SmmCpuFeaturesLibNoStm.c + TraditionalMmCpuFeaturesLib.c =20 [Packages] MdePkg/MdePkg.dec diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf = b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf index 78f8e4b42c44..022351f59320 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf @@ -22,6 +22,7 @@ [Sources] SmmCpuFeaturesLibCommon.c SmmStm.c SmmStm.h + TraditionalMmCpuFeaturesLib.c =20 [Sources.Ia32] Ia32/SmmStmSupport.c --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#71755): https://edk2.groups.io/g/devel/message/71755 Mute This Topic: https://groups.io/mt/80715271/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon May 6 23:26:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+71756+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71756+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1613597615; cv=none; d=zohomail.com; s=zohoarc; b=PFqWP8mzjlxw9sEXetXdvVX73lCN7MKz2XYSk1FsVBO70vZdDbiJT75dxgbxuJziHgK8KzFus3Uc0cmc96MypoCHcBjqGc8hInCOto+LFamG5FIs5TdBlxdDF55oZG6ylvSajPRazWVZqDhSbniXfjN9CuNbfI5466PGzQYt4r0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613597615; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=VkhdiXIvDx9c5+OkcCiL5vPxRY1Cv98IlPD1W4RyDkk=; b=WcuKKJoGroe7zB9TYBp6uMQ4ZolJSSrRJlsBf5zZ6+sinY4kygmmeHCK9g+0SKXs8o6h/fZXTq9eFNTIgMvQr1n8wAEULIXtw4be+WgG96CiKSo+DPMIQ83L39es5MOUY1NH5pLT7bKxtYmZZc1LFh/j9r4LpneMuOdaD7doyhs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71756+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613597614997627.4721832690182; Wed, 17 Feb 2021 13:33:34 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id UqUEYY1788612xpDOah2nq66; Wed, 17 Feb 2021 13:33:34 -0800 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.600.1613597609171645908 for ; Wed, 17 Feb 2021 13:33:29 -0800 X-Received: from localhost.localdomain (unknown [131.107.174.202]) by linux.microsoft.com (Postfix) with ESMTPSA id D38E520B57A0; Wed, 17 Feb 2021 13:33:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D38E520B57A0 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Laszlo Ersek , Rahul Kumar Subject: [edk2-devel] [PATCH v3 5/5] UefiCpuPkg/SmmCpuFeaturesLib: Add Standalone MM support Date: Wed, 17 Feb 2021 13:32:27 -0800 Message-Id: <20210217213227.1277-6-mikuback@linux.microsoft.com> In-Reply-To: <20210217213227.1277-1-mikuback@linux.microsoft.com> References: <20210217213227.1277-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mikuback@linux.microsoft.com X-Gm-Message-State: jYdWWb6aBT12bU19tGFo9pt0x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613597614; bh=s8V36YnNIPU+fAowhF7mheXeNfFoLVzGadXC1PnnyyQ=; h=Cc:Date:From:Reply-To:Subject:To; b=YFqu/1Nimg++psgU/k9ho829rWgHMOwxGhXckvxDUJE9emENCf5uYOEhRi0Iky1H3DK atDOg5788kpr2n73jhLEolTXIUx9sIj44oOeY9ucSGUqW52iM9G/CxbH6vMjkS147nBEq BPDGPSbPpp8Ru4pk13gxgANhBILBHR5QB5s= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3218 Adds an INF for StandaloneMmCpuFeaturesLib, which supports building the SmmCpuFeaturesLib code for Standalone MM. Minimal code changes are made to allow reuse of existing code for Standalone MM. The original INF file names are left intact (continue to use SMM terminology) to retain backward compatibility with platforms that use those INFs. Similarly, the pre-existing C file names are unchanged to be consistent with the INF file names. Note that all references in library source files to PiSmm.h have been changed to PiMm.h for consistency. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Signed-off-by: Michael Kubacki Reviewed-by: Eric Dong for this serial. Reviewed-by: Laszlo Ersek --- UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmmStmSupport.c | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.c | 50 += +++++++++++++++++++ UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmmStmSupport.c | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf | 38 += ++++++++++++++ UefiCpuPkg/UefiCpuPkg.dsc | 1 + 9 files changed, 95 insertions(+), 6 deletions(-) diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmmStmSupport.c b/Ue= fiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmmStmSupport.c index 399ddd742dd7..24bd6d0a946d 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmmStmSupport.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmmStmSupport.c @@ -6,7 +6,7 @@ =20 **/ =20 -#include +#include #include =20 #include "SmmStm.h" diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/Uef= iCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c index 00948a191fad..29e3b650acee 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c @@ -6,7 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 -#include +#include #include "CpuFeaturesLib.h" =20 /** diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c= b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c index 50379f3aea19..fa3a866ab6f6 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c @@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 -#include +#include #include #include #include diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c = b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c index c562582ccee0..823dbe906cb8 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c @@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 -#include +#include #include #include "CpuFeaturesLib.h" =20 diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c b/UefiCpuPkg/Lib= rary/SmmCpuFeaturesLib/SmmStm.c index dcc2e9f9a09a..c92387625ddc 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c @@ -6,7 +6,7 @@ =20 **/ =20 -#include +#include #include #include #include diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLi= b.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.c new file mode 100644 index 000000000000..dec6e53e5b55 --- /dev/null +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.c @@ -0,0 +1,50 @@ +/** @file +Standalone MM CPU specific programming. + +Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) Microsoft Corporation.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include "CpuFeaturesLib.h" + +/** + Gets the maximum number of logical processors from the PCD PcdCpuMaxLogi= calProcessorNumber. + + This access is abstracted from the PCD services to enforce that the PCD = be + FixedAtBuild in the Standalone MM build of this driver. + + @return The value of PcdCpuMaxLogicalProcessorNumber. + +**/ +UINT32 +GetCpuMaxLogicalProcessorNumber ( + VOID + ) +{ + return FixedPcdGet32 (PcdCpuMaxLogicalProcessorNumber); +} + +/** + The Standalone MM library constructor. + + @param[in] ImageHandle Image handle of this driver. + @param[in] SystemTable A Pointer to the EFI System Table. + + @retval EFI_SUCCESS This constructor always returns success. + +**/ +EFI_STATUS +EFIAPI +StandaloneMmCpuFeaturesLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_MM_SYSTEM_TABLE *SystemTable + ) +{ + CpuFeaturesLibInitialization (); + + return EFI_SUCCESS; +} diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmmStmSupport.c b/Uef= iCpuPkg/Library/SmmCpuFeaturesLib/X64/SmmStmSupport.c index aacc1455a90c..c8a3f58e0ca5 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmmStmSupport.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmmStmSupport.c @@ -6,7 +6,7 @@ =20 **/ =20 -#include +#include #include =20 #include "SmmStm.h" diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLi= b.inf b/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf new file mode 100644 index 000000000000..ec97041d8b75 --- /dev/null +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf @@ -0,0 +1,38 @@ +## @file +# Standalone MM CPU specific programming. +# +# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D StandaloneMmCpuFeaturesLib + MODULE_UNI_FILE =3D SmmCpuFeaturesLib.uni + FILE_GUID =3D BB554A2D-F5DF-41D3-8C62-46476A2B2B18 + MODULE_TYPE =3D MM_STANDALONE + VERSION_STRING =3D 1.0 + PI_SPECIFICATION_VERSION =3D 0x00010032 + LIBRARY_CLASS =3D SmmCpuFeaturesLib + CONSTRUCTOR =3D StandaloneMmCpuFeaturesLibConstructor + +[Sources] + CpuFeaturesLib.h + StandaloneMmCpuFeaturesLib.c + SmmCpuFeaturesLibCommon.c + SmmCpuFeaturesLibNoStm.c + +[Packages] + MdePkg/MdePkg.dec + UefiCpuPkg/UefiCpuPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + MemoryAllocationLib + PcdLib + +[FixedPcd] + gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## SOME= TIMES_CONSUMES diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc index 9128cef076dd..7db419471deb 100644 --- a/UefiCpuPkg/UefiCpuPkg.dsc +++ b/UefiCpuPkg/UefiCpuPkg.dsc @@ -154,6 +154,7 @@ [Components.IA32, Components.X64] UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.i= nf UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf + UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm.inf --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#71756): https://edk2.groups.io/g/devel/message/71756 Mute This Topic: https://groups.io/mt/80715273/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-