From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 847F521E1DAC7 for ; Sun, 6 Aug 2017 22:58:25 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Aug 2017 23:00:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,336,1498546800"; d="scan'208";a="134398497" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 06 Aug 2017 23:00:40 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 6 Aug 2017 23:00:40 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.151]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.188]) with mapi id 14.03.0319.002; Mon, 7 Aug 2017 14:00:38 +0800 From: "Ni, Ruiyu" To: "Dong, Eric" , "edk2-devel@lists.01.org" CC: "Fan, Jeff" , "Wei, David" Thread-Topic: [edk2] [Patch v2] Vlv2TbltDevicePkg: Remove reference deprecated macro. Thread-Index: AQHTDObQu1QqTbHwMUeukawPtzicIaJ4ar5w Date: Mon, 7 Aug 2017 06:00:38 +0000 Deferred-Delivery: Mon, 7 Aug 2017 06:00:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5B9CE220@SHSMSX104.ccr.corp.intel.com> References: <1501826344-13868-1-git-send-email-eric.dong@intel.com> In-Reply-To: <1501826344-13868-1-git-send-email-eric.dong@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch v2] Vlv2TbltDevicePkg: Remove reference deprecated macro. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 05:58:25 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ruiyu Ni Thanks/Ray > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Eric Dong > Sent: Friday, August 4, 2017 1:59 PM > To: edk2-devel@lists.01.org > Cc: Ni, Ruiyu ; Fan, Jeff ; Wei, > David > Subject: [edk2] [Patch v2] Vlv2TbltDevicePkg: Remove reference deprecated > macro. >=20 > v2 changes include: > 1. Use MSR data structure instead of redefin local macro. >=20 > Cc: Jeff Fan > Cc: Ruiyu Ni > Cc: David Wei > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Eric Dong > --- > Vlv2TbltDevicePkg/PlatformInitPei/MemoryPeim.c | 29 > ++++++++++++++++++-------- > 1 file changed, 20 insertions(+), 9 deletions(-) >=20 > diff --git a/Vlv2TbltDevicePkg/PlatformInitPei/MemoryPeim.c > b/Vlv2TbltDevicePkg/PlatformInitPei/MemoryPeim.c > index 5a18a3f..6f37e3b 100644 > --- a/Vlv2TbltDevicePkg/PlatformInitPei/MemoryPeim.c > +++ b/Vlv2TbltDevicePkg/PlatformInitPei/MemoryPeim.c > @@ -196,16 +196,22 @@ SetPeiCacheMode ( > // Cache the flash area to improve the boot performance in PEI phase > // > Index =3D 0; > - MtrrSetting.Variables.Mtrr[0].Base =3D (FixedPcdGet32 > (PcdFlashAreaBaseAddress) | CacheWriteProtected); > - MtrrSetting.Variables.Mtrr[0].Mask =3D ((~((UINT64)(FixedPcdGet32 > (PcdFlashAreaSize) - 1))) & ValidMtrrAddressMask) | > MTRR_LIB_CACHE_MTRR_ENABLED; > + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *) > &MtrrSetting.Variables.Mtrr[0].Base)->Uint64 =3D FixedPcdGet32 > (PcdFlashAreaBaseAddress); > + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *) > &MtrrSetting.Variables.Mtrr[0].Base)->Bits.Type =3D CacheWriteProtected; > + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *) > &MtrrSetting.Variables.Mtrr[0].Mask)->Uint64 =3D (~((UINT64)(FixedPcdGet3= 2 > (PcdFlashAreaSize) - 1))) & ValidMtrrAddressMask; > + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *) > &MtrrSetting.Variables.Mtrr[0].Mask)->Bits.V =3D 1; > + > Index ++; >=20 > MemOverflow =3D0; > while (MaxMemoryLength > MemOverflow){ > - MtrrSetting.Variables.Mtrr[Index].Base =3D (MemOverflow & > ValidMtrrAddressMask) | CacheWriteBack; > MemoryLength =3D MaxMemoryLength - MemOverflow; > MemoryLength =3D GetPowerOfTwo64 (MemoryLength); > - MtrrSetting.Variables.Mtrr[Index].Mask =3D ((~(MemoryLength - 1)) & > ValidMtrrAddressMask) | MTRR_LIB_CACHE_MTRR_ENABLED; > + > + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *) > &MtrrSetting.Variables.Mtrr[Index].Base)->Uint64 =3D MemOverflow & > ValidMtrrAddressMask; > + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *) > &MtrrSetting.Variables.Mtrr[Index].Base)->Bits.Type =3D CacheWriteBack; > + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *) > &MtrrSetting.Variables.Mtrr[Index].Mask)->Uint64 =3D (~(MemoryLength - 1)= ) > & ValidMtrrAddressMask; > + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *) > &MtrrSetting.Variables.Mtrr[Index].Mask)->Bits.V =3D 1; >=20 > MemOverflow +=3D MemoryLength; > Index++; > @@ -216,23 +222,28 @@ SetPeiCacheMode ( > while (MaxMemoryLength !=3D MemoryLength) { > MemoryLengthUc =3D GetPowerOfTwo64 (MaxMemoryLength - > MemoryLength); >=20 > - MtrrSetting.Variables.Mtrr[Index].Base =3D ((MaxMemoryLength - > MemoryLengthUc) & ValidMtrrAddressMask) | CacheUncacheable; > - MtrrSetting.Variables.Mtrr[Index].Mask=3D ((~(MemoryLengthUc - 1))= & > ValidMtrrAddressMask) | MTRR_LIB_CACHE_MTRR_ENABLED; > + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *) > &MtrrSetting.Variables.Mtrr[Index].Base)->Uint64 =3D (MaxMemoryLength - > MemoryLengthUc) & ValidMtrrAddressMask; > + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *) > &MtrrSetting.Variables.Mtrr[Index].Base)->Bits.Type =3D CacheUncacheable; > + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *) > &MtrrSetting.Variables.Mtrr[Index].Mask)->Uint64 =3D (~(MemoryLengthUc = - > 1)) & ValidMtrrAddressMask; > + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *) > &MtrrSetting.Variables.Mtrr[Index].Mask)->Bits.V =3D 1; > + > MaxMemoryLength -=3D MemoryLengthUc; > Index++; > } >=20 > MemOverflow =3D0x100000000; > while (HighMemoryLength > 0) { > - MtrrSetting.Variables.Mtrr[Index].Base =3D (MemOverflow & > ValidMtrrAddressMask) | CacheWriteBack; > + > MemoryLength =3D HighMemoryLength; > MemoryLength =3D GetPowerOfTwo64 (MemoryLength); > - > if (MemoryLength > MemOverflow){ > MemoryLength =3D MemOverflow; > } >=20 > - MtrrSetting.Variables.Mtrr[Index].Mask =3D ((~(MemoryLength - 1)) & > ValidMtrrAddressMask) | MTRR_LIB_CACHE_MTRR_ENABLED; > + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *) > &MtrrSetting.Variables.Mtrr[Index].Base)->Uint64 =3D MemOverflow & > ValidMtrrAddressMask; > + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *) > &MtrrSetting.Variables.Mtrr[Index].Base)->Bits.Type =3D CacheWriteBack; > + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *) > &MtrrSetting.Variables.Mtrr[Index].Mask)->Uint64 =3D (~(MemoryLength - 1)= ) > & ValidMtrrAddressMask; > + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *) > &MtrrSetting.Variables.Mtrr[Index].Mask)->Bits.V =3D 1; >=20 > MemOverflow +=3D MemoryLength; > HighMemoryLength -=3D MemoryLength; > -- > 2.7.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel