From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C36FE21103DA9 for ; Tue, 28 Aug 2018 18:54:24 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Aug 2018 18:54:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,300,1531810800"; d="scan'208";a="258891731" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga006.fm.intel.com with ESMTP; 28 Aug 2018 18:54:14 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 28 Aug 2018 18:54:13 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 28 Aug 2018 18:54:13 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.143]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.240]) with mapi id 14.03.0319.002; Wed, 29 Aug 2018 09:54:11 +0800 From: "Wu, Hao A" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: Andrew Fish Thread-Topic: [PATCH 07/10] EmulatorPkg/AutoScanPei: Report the correct CPU address size Thread-Index: AQHUPdr3nry4vz2nf0Oeh08TsEs9fqTV+gGA Date: Wed, 29 Aug 2018 01:54:11 +0000 Message-ID: References: <20180827075330.269224-1-ruiyu.ni@intel.com> <20180827075330.269224-8-ruiyu.ni@intel.com> In-Reply-To: <20180827075330.269224-8-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 07/10] EmulatorPkg/AutoScanPei: Report the correct CPU address size X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2018 01:54:25 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Ni, Ruiyu > Sent: Monday, August 27, 2018 3:53 PM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A; Andrew Fish > Subject: [PATCH 07/10] EmulatorPkg/AutoScanPei: Report the correct CPU > address size >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1119 >=20 > Today's implementation unconditionally reports CPU address size > as 36 through CPU HOB. But when WinHost is running at 64bit, > the system memory might be allocated above 2^36. >=20 > It causes system asserts when DxeCore code tries to find the > corresponding GCD entry for a given valid address. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ruiyu Ni > Cc: Hao Wu > Cc: Andrew Fish > --- > EmulatorPkg/AutoScanPei/AutoScanPei.c | 17 +++++++++++++---- > 1 file changed, 13 insertions(+), 4 deletions(-) >=20 > diff --git a/EmulatorPkg/AutoScanPei/AutoScanPei.c > b/EmulatorPkg/AutoScanPei/AutoScanPei.c > index 78a40db3a2..bf9958a4a9 100644 > --- a/EmulatorPkg/AutoScanPei/AutoScanPei.c > +++ b/EmulatorPkg/AutoScanPei/AutoScanPei.c > @@ -1,6 +1,6 @@ > /*++ @file >=20 > -Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> Portions copyright (c) 2011, Apple Inc. All rights reserved. > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D > License > @@ -51,7 +51,8 @@ Returns: > EFI_PHYSICAL_ADDRESS MemoryBase; > UINTN Index; > EFI_RESOURCE_ATTRIBUTE_TYPE Attributes; > - > + UINTN HighBitSet; > + UINT8 SizeOfMemorySpace; >=20 > DEBUG ((EFI_D_ERROR, "Emu Autoscan PEIM Loaded\n")); >=20 > @@ -66,7 +67,8 @@ Returns: > ); > ASSERT_EFI_ERROR (Status); >=20 > - Index =3D 0; > + SizeOfMemorySpace =3D 0; > + Index =3D 0; > do { > Status =3D Thunk->MemoryAutoScan (Index, &MemoryBase, &MemorySize); > if (!EFI_ERROR (Status)) { > @@ -96,6 +98,12 @@ Returns: > MemoryBase, > MemorySize > ); > + HighBitSet =3D HighBitSet64 (MemoryBase + MemorySize); > + SizeOfMemorySpace =3D MAX (SizeOfMemorySpace, (UINT8)HighBitSet + = 1); > + DEBUG (( > + DEBUG_INFO, "Emu Memory Discoverred[%d]: Base =3D %016lx / Size > =3D %016x\n", > + Index, MemoryBase, MemorySize > + )); > } > Index++; > } while (!EFI_ERROR (Status)); > @@ -103,7 +111,8 @@ Returns: > // > // Build the CPU hob with 36-bit addressing and 16-bits of IO space. > // > - BuildCpuHob (36, 16); > + DEBUG ((DEBUG_INFO, "Emu SizeOfMemorySpace =3D %d\n", > SizeOfMemorySpace)); > + BuildCpuHob (SizeOfMemorySpace, 16); Hi Ray, Just a question, I saw the implementation in Nt32Pkg just hard-code the address size to 52 to support both 32-bit and 64-bit. Is there a concern for hard coding it to 52? Best Regards, Hao Wu >=20 > return Status; > } > -- > 2.16.1.windows.1