From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.39741.1609114713116326055 for ; Sun, 27 Dec 2020 16:18:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=v2aKxdvT; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: jiewen.yao@intel.com) IronPort-SDR: PcKXvIgs/zi0dRPZ/W11C2JPcdGOTKtDPA72HQ1tYCUjy9y4dEaz7krmjto8Lzez8CnC8ku35u E3pC/IWY79wQ== X-IronPort-AV: E=McAfee;i="6000,8403,9847"; a="155537329" X-IronPort-AV: E=Sophos;i="5.78,453,1599548400"; d="scan'208";a="155537329" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2020 16:18:32 -0800 IronPort-SDR: LkbunktfbhWUGSYxxILfaf7bRToOqreG9HKqA9FS1b0KFtW6dCf2Fp+V89xIfQaPcg4xYE4075 d72jM8Qt4qlA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,453,1599548400"; d="scan'208";a="562654111" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by orsmga005.jf.intel.com with ESMTP; 27 Dec 2020 16:18:32 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 27 Dec 2020 16:18:32 -0800 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) 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.1713.5; Sun, 27 Dec 2020 16:18:31 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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.1713.5 via Frontend Transport; Sun, 27 Dec 2020 16:18:31 -0800 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.177) 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.1713.5; Sun, 27 Dec 2020 16:18:31 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BUGvqkwXUpANmKxgAClbHsPklePvFed6DbhtiPqvqwkrnr5DSAkaJ8cfzBGlSGaRIBCEMz0BBJAtQdk035wYmTGGlCjjMYdBenpIbkna4FP/ggBWZV/li8/tgxEekEvOjKHXKp5pJ6RQ3EK2bsXfoMgzwdHfP/UjV8k07m1Gh0/rD4zydmMGva2WFexdTHRaIdQKW1onmwDj/RH495r8Pju0ghH0d1v6LKj4vcD4C3aZBOosPAU77T8MgAKTEIM4VOAROjCv/f3jwq39XyZjUMrRVY70iVI7u8RJLoElI0jpCd0wgoVy4KVGCDaz7nzMgLi0QSWZ+AEDEZOIOtSjvQ== 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=fgETgGKxb9TxmdO7x14wmTuA/k+8Y/oKeCQL/3FBJzg=; b=a8gpOPcRFoOI7FUVXJE8KQ21PGfUbU2cF922mXR90/qeOUK/w6+mAdDHfMTnumgcChGulr7fOJDnmXEoddz5d4AOmmiThm8sFYKt9uwBzXijxcelqMJbr5V05EmLoxPRMHRzXm1FKYQyzOvQt39As63JGEljpPUgvJujEVpDQpNvf4NUOudZ+wimp4NbGlA2NRt50e4y+mvfYDaFUOlexDP33Gg/vU8CkFtVWmQzCwrs+wI1DhjkdG695xVYfevfoqCxzbjDNE1++0U1mapdChExpeXrUpKyIhF4YN7T3N9y+trBYbKwmToH1if03OkG7j4SeZGtNfrL9O/tbrrU2Q== 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=fgETgGKxb9TxmdO7x14wmTuA/k+8Y/oKeCQL/3FBJzg=; b=v2aKxdvTFYHumuiv5V44knT+LT3pVImHc62SpRGrspkFPgYMOhsgXDqRvp203KDVqWoUQhNfExUsZ9Gh06ohqtAZ7UwBr/BGZ/AW7flC+hywzpfW5uxihtXfA59Eq+aGrOclw6pD6A+hDs/FAV60Xsd+2o0Xvw/M9J0QPFFqq9A= Received: from CY4PR11MB1288.namprd11.prod.outlook.com (2603:10b6:903:23::8) by CY4PR11MB1990.namprd11.prod.outlook.com (2603:10b6:903:25::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3700.27; Mon, 28 Dec 2020 00:18:30 +0000 Received: from CY4PR11MB1288.namprd11.prod.outlook.com ([fe80::e058:fd5a:28d8:2b17]) by CY4PR11MB1288.namprd11.prod.outlook.com ([fe80::e058:fd5a:28d8:2b17%12]) with mapi id 15.20.3700.031; Mon, 28 Dec 2020 00:18:30 +0000 From: "Yao, Jiewen" To: Kun Qin , "devel@edk2.groups.io" CC: Ard Biesheuvel , Sami Mujawar , Supreeth Venkatesh Subject: Re: [PATCH v1 04/15] StandaloneMmPkg: StandaloneMmMemLib: Extends support for X64 architecture Thread-Topic: [PATCH v1 04/15] StandaloneMmPkg: StandaloneMmMemLib: Extends support for X64 architecture Thread-Index: AQHW1W60Vk5xAW1fXUeG9eUbieXuqaoLsrVw Date: Mon, 28 Dec 2020 00:18:30 +0000 Message-ID: References: <20201218185011.1366-1-kun.q@outlook.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: outlook.com; dkim=none (message not signed) header.d=none;outlook.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.37] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4bf10c75-ef67-4fae-25ee-08d8aac61adf x-ms-traffictypediagnostic: CY4PR11MB1990: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: PMd3y71JGT5efNTonB0dOOWVw6oVM3SzGnPLoORfaoVMQHnR2YWcnuaSs/g+n4ULUebQJDSxmWcHcwXxceska6LM+RL2n/a/QlWiMU0XUXcRWHHhh1Iecjh6k4G50jk2k87Qi8S5mpyRrWlQXMrO2A/7utsyRqGeiGTyNdxcDwv2WMGkZgDgpmaPXDQ0o/mX+yvxO9toLjCu3VSNcljzG6DziP7KPwzOu1l7veDLuvhWaMBQvAJX1i26chRaqc52gQkdOYWX974UmVy++YnL2N7kAAR+toblvp9tQesqcsTtISGgjI8atdoT+t5OM7c6CZ1CIu75K9IRbnlxNONGQUyksWUJPjqTO9S7Yl+ECCF0JOa7Yrpepht9U310509fN3ywrXWZLOwC92gPHhZdjw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR11MB1288.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(346002)(39860400002)(136003)(366004)(396003)(376002)(33656002)(52536014)(55016002)(71200400001)(66446008)(316002)(186003)(110136005)(9686003)(66946007)(76116006)(66476007)(66556008)(83380400001)(19627235002)(53546011)(2906002)(4326008)(8676002)(5660300002)(6506007)(64756008)(26005)(54906003)(86362001)(7696005)(478600001)(8936002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?04H7cVpG4wPpRD0ZrzcZpsokUyEHkwqDAvYE8wo0NIgIyIFih2/MTxh1Yycb?= =?us-ascii?Q?/qOmHaKDsbb3oVIycCwZY6ETw3rxrN6h4QzD2VROSi7ifmMYHvIiWKVbytEP?= =?us-ascii?Q?OQQRcirYkTkEe1O05Z1Z1vQVjRPvrZazRS6p196xSNRoKMxRn+0Q1yXOuGv4?= =?us-ascii?Q?pGDjidt2hRNhFyPu9ySpRng/phXeK0D3v4l1w5J2dh7TIkWKkyrKzZdoQ1Fh?= =?us-ascii?Q?jlyrwh8R7M6DHw1hcuCCdT/9vblV1MQgzyzoX8jtum+fu1OZ9gBAgNdA+lQn?= =?us-ascii?Q?ngbp9+3iKSezXQIIhhaJvk+p3LnwK51mfRaa6Q1zCopua9wxyOIOhPAP4ijY?= =?us-ascii?Q?YV+pDPtyX6glfm4ZhtikTSXmsLqRvemNfiZSoRkPQ0/+7SPjWKBJhInCfAz9?= =?us-ascii?Q?InPz96UYxMaPW0MyUs2IXLUPkHRtBmb6uzr7CdbZSCWlOFTUmW5EWBLQPEHe?= =?us-ascii?Q?m4uTRZwy3J+dsDUcu8q07LvW9JKqGFGaBIg+Hmw9x1tglLeghdeNHQn70io4?= =?us-ascii?Q?CYka1uwCdIxQwhdRNwehTUr1xSyNy0AgIgdNqviK2S/Yz4lvHiAeS10fsqJv?= =?us-ascii?Q?hxtbHQ9XmRSUV9PVk8BNJSIDWeun4D/CaDAbX0OcQxG3FESmxMhdUNjSXrpe?= =?us-ascii?Q?fahC5IqFxN9wpSBsvnluQF+6cLuzZ7+rPfd5VMozcgKzg1fC4S5rI6V1Bt8h?= =?us-ascii?Q?lrPWJwH1Edj0xUjjV0w+pu+jx8WNIgnBfsU45VklYlMkmz+tGGCTzYFCzn4c?= =?us-ascii?Q?BaQNUX9Yba1sc2afW7DLQSZpAbRvlDCSUmK+9NGbfmXeAJEwHI8gSiuN0zHZ?= =?us-ascii?Q?XM+4n6HAKJg3x9wN+K13K62e1SX+JSodEVWqqlY8LuXHs62xY/Cq0mYDxdBi?= =?us-ascii?Q?igpOG7AWMHh+9/CegHBF7iKPuyx12N7fC+YG0hvqU3bzFVbkvONNMTQEz6/q?= =?us-ascii?Q?vtDUbfH15WZjffdGvUHOPG4aYJu9tAzdvri0WehSRl8=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1288.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4bf10c75-ef67-4fae-25ee-08d8aac61adf X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Dec 2020 00:18:30.3203 (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: iNXPIEk5ildthN/3mNk1X4Puuvpuxo6tlwp/tyOy41iYidXhWtvIE/pFMTqI0kQfesY6d0rZ1In2rKbU2MV6rg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1990 Return-Path: jiewen.yao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable May I know where is the code to fill below? EFI_MMRAM_DESCRIPTOR *mMmMemLibInternalMmramRanges; UINTN mMmMemLibInternalMmramCount; > -----Original Message----- > From: Kun Qin > Sent: Saturday, December 19, 2020 2:50 AM > To: devel@edk2.groups.io > Cc: Ard Biesheuvel ; Sami Mujawar > ; Yao, Jiewen ; Supreeth > Venkatesh > Subject: [PATCH v1 04/15] StandaloneMmPkg: StandaloneMmMemLib: > Extends support for X64 architecture >=20 > This change extends StandaloneMmMemLib library to support X64 > architecture. The implementation is ported from > MdePkg/Library/SmmMemLib. >=20 > Cc: Ard Biesheuvel > Cc: Sami Mujawar > Cc: Jiewen Yao > Cc: Supreeth Venkatesh >=20 > Signed-off-by: Kun Qin > --- >=20 > StandaloneMmPkg/Library/StandaloneMmMemLib/X64/StandaloneMmMe > mLibInternal.c | 67 ++++++++++++++++++++ >=20 > StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib > .inf | 6 +- > 2 files changed, 72 insertions(+), 1 deletion(-) >=20 > diff --git > a/StandaloneMmPkg/Library/StandaloneMmMemLib/X64/StandaloneMm > MemLibInternal.c > b/StandaloneMmPkg/Library/StandaloneMmMemLib/X64/StandaloneMm > MemLibInternal.c > new file mode 100644 > index 000000000000..c5e21c583f44 > --- /dev/null > +++ > b/StandaloneMmPkg/Library/StandaloneMmMemLib/X64/StandaloneMm > MemLibInternal.c > @@ -0,0 +1,67 @@ > +/** @file > + Internal ARCH Specific file of MM memory check library. > + > + MM memory check library implementation. This library consumes > MM_ACCESS_PROTOCOL > + to get MMRAM information. In order to use this library instance, the > platform should produce > + all MMRAM range via MM_ACCESS_PROTOCOL, including the range for > firmware (like MM Core > + and MM driver) and/or specific dedicated hardware. > + > + Copyright (c) 2015, Intel Corporation. All rights reserved.
> + Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +#include > +#include > +#include > +#include > +// > +// Maximum support address used to check input buffer > +// > +extern EFI_PHYSICAL_ADDRESS > mMmMemLibInternalMaximumSupportAddress; > + > +/** > + Calculate and save the maximum support address. > + > +**/ > +VOID > +MmMemLibInternalCalculateMaximumSupportAddress ( > + VOID > + ) > +{ > + VOID *Hob; > + UINT32 RegEax; > + UINT8 PhysicalAddressBits; > + > + // > + // Get physical address bits supported. > + // > + Hob =3D GetFirstHob (EFI_HOB_TYPE_CPU); > + if (Hob !=3D NULL) { > + PhysicalAddressBits =3D ((EFI_HOB_CPU *) Hob)->SizeOfMemorySpace; > + } else { > + AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); > + if (RegEax >=3D 0x80000008) { > + AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); > + PhysicalAddressBits =3D (UINT8) RegEax; > + } else { > + PhysicalAddressBits =3D 36; > + } > + } > + // > + // IA-32e paging translates 48-bit linear addresses to 52-bit physical > addresses. > + // > + ASSERT (PhysicalAddressBits <=3D 52); > + if (PhysicalAddressBits > 48) { > + PhysicalAddressBits =3D 48; > + } > + > + // > + // Save the maximum support address in one global variable > + // > + mMmMemLibInternalMaximumSupportAddress =3D > (EFI_PHYSICAL_ADDRESS)(UINTN)(LShiftU64 (1, PhysicalAddressBits) - 1); > + DEBUG ((DEBUG_INFO, "mMmMemLibInternalMaximumSupportAddress > =3D 0x%lx\n", mMmMemLibInternalMaximumSupportAddress)); > +} > + > + > diff --git > a/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMem > Lib.inf > b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMem > Lib.inf > index 49da02e54e6d..65ad0a48905c 100644 > --- > a/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMem > Lib.inf > +++ > b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMem > Lib.inf > @@ -26,12 +26,15 @@ [Defines] > # > # The following information is for reference only and not required by th= e > build tools. > # > -# VALID_ARCHITECTURES =3D AARCH64 > +# VALID_ARCHITECTURES =3D X64 AARCH64 > # >=20 > [Sources.Common] > StandaloneMmMemLib.c >=20 > +[Sources.X64] > + X64/StandaloneMmMemLibInternal.c > + > [Sources.AARCH64] > AArch64/StandaloneMmMemLibInternal.c >=20 > @@ -42,3 +45,4 @@ [Packages] > [LibraryClasses] > BaseMemoryLib > DebugLib > + HobLib > -- > 2.28.0.windows.1