From: "Ni, Ruiyu" <ruiyu.ni@intel.com>
To: "Dong, Eric" <eric.dong@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Fan, Jeff" <jeff.fan@intel.com>, "Wei, David" <david.wei@intel.com>
Subject: Re: [Patch v2] Vlv2TbltDevicePkg: Remove reference deprecated macro.
Date: Mon, 7 Aug 2017 06:00:38 +0000 [thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5B9CE220@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1501826344-13868-1-git-send-email-eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
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 <ruiyu.ni@intel.com>; Fan, Jeff <jeff.fan@intel.com>; Wei,
> David <david.wei@intel.com>
> Subject: [edk2] [Patch v2] Vlv2TbltDevicePkg: Remove reference deprecated
> macro.
>
> v2 changes include:
> 1. Use MSR data structure instead of redefin local macro.
>
> Cc: Jeff Fan <jeff.fan@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: David Wei <david.wei@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
> Vlv2TbltDevicePkg/PlatformInitPei/MemoryPeim.c | 29
> ++++++++++++++++++--------
> 1 file changed, 20 insertions(+), 9 deletions(-)
>
> 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 = 0;
> - MtrrSetting.Variables.Mtrr[0].Base = (FixedPcdGet32
> (PcdFlashAreaBaseAddress) | CacheWriteProtected);
> - MtrrSetting.Variables.Mtrr[0].Mask = ((~((UINT64)(FixedPcdGet32
> (PcdFlashAreaSize) - 1))) & ValidMtrrAddressMask) |
> MTRR_LIB_CACHE_MTRR_ENABLED;
> + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *)
> &MtrrSetting.Variables.Mtrr[0].Base)->Uint64 = FixedPcdGet32
> (PcdFlashAreaBaseAddress);
> + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *)
> &MtrrSetting.Variables.Mtrr[0].Base)->Bits.Type = CacheWriteProtected;
> + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *)
> &MtrrSetting.Variables.Mtrr[0].Mask)->Uint64 = (~((UINT64)(FixedPcdGet32
> (PcdFlashAreaSize) - 1))) & ValidMtrrAddressMask;
> + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *)
> &MtrrSetting.Variables.Mtrr[0].Mask)->Bits.V = 1;
> +
> Index ++;
>
> MemOverflow =0;
> while (MaxMemoryLength > MemOverflow){
> - MtrrSetting.Variables.Mtrr[Index].Base = (MemOverflow &
> ValidMtrrAddressMask) | CacheWriteBack;
> MemoryLength = MaxMemoryLength - MemOverflow;
> MemoryLength = GetPowerOfTwo64 (MemoryLength);
> - MtrrSetting.Variables.Mtrr[Index].Mask = ((~(MemoryLength - 1)) &
> ValidMtrrAddressMask) | MTRR_LIB_CACHE_MTRR_ENABLED;
> +
> + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *)
> &MtrrSetting.Variables.Mtrr[Index].Base)->Uint64 = MemOverflow &
> ValidMtrrAddressMask;
> + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *)
> &MtrrSetting.Variables.Mtrr[Index].Base)->Bits.Type = CacheWriteBack;
> + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *)
> &MtrrSetting.Variables.Mtrr[Index].Mask)->Uint64 = (~(MemoryLength - 1))
> & ValidMtrrAddressMask;
> + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *)
> &MtrrSetting.Variables.Mtrr[Index].Mask)->Bits.V = 1;
>
> MemOverflow += MemoryLength;
> Index++;
> @@ -216,23 +222,28 @@ SetPeiCacheMode (
> while (MaxMemoryLength != MemoryLength) {
> MemoryLengthUc = GetPowerOfTwo64 (MaxMemoryLength -
> MemoryLength);
>
> - MtrrSetting.Variables.Mtrr[Index].Base = ((MaxMemoryLength -
> MemoryLengthUc) & ValidMtrrAddressMask) | CacheUncacheable;
> - MtrrSetting.Variables.Mtrr[Index].Mask= ((~(MemoryLengthUc - 1)) &
> ValidMtrrAddressMask) | MTRR_LIB_CACHE_MTRR_ENABLED;
> + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *)
> &MtrrSetting.Variables.Mtrr[Index].Base)->Uint64 = (MaxMemoryLength -
> MemoryLengthUc) & ValidMtrrAddressMask;
> + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *)
> &MtrrSetting.Variables.Mtrr[Index].Base)->Bits.Type = CacheUncacheable;
> + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *)
> &MtrrSetting.Variables.Mtrr[Index].Mask)->Uint64 = (~(MemoryLengthUc -
> 1)) & ValidMtrrAddressMask;
> + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *)
> &MtrrSetting.Variables.Mtrr[Index].Mask)->Bits.V = 1;
> +
> MaxMemoryLength -= MemoryLengthUc;
> Index++;
> }
>
> MemOverflow =0x100000000;
> while (HighMemoryLength > 0) {
> - MtrrSetting.Variables.Mtrr[Index].Base = (MemOverflow &
> ValidMtrrAddressMask) | CacheWriteBack;
> +
> MemoryLength = HighMemoryLength;
> MemoryLength = GetPowerOfTwo64 (MemoryLength);
> -
> if (MemoryLength > MemOverflow){
> MemoryLength = MemOverflow;
> }
>
> - MtrrSetting.Variables.Mtrr[Index].Mask = ((~(MemoryLength - 1)) &
> ValidMtrrAddressMask) | MTRR_LIB_CACHE_MTRR_ENABLED;
> + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *)
> &MtrrSetting.Variables.Mtrr[Index].Base)->Uint64 = MemOverflow &
> ValidMtrrAddressMask;
> + ((MSR_IA32_MTRR_PHYSBASE_REGISTER *)
> &MtrrSetting.Variables.Mtrr[Index].Base)->Bits.Type = CacheWriteBack;
> + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *)
> &MtrrSetting.Variables.Mtrr[Index].Mask)->Uint64 = (~(MemoryLength - 1))
> & ValidMtrrAddressMask;
> + ((MSR_IA32_MTRR_PHYSMASK_REGISTER *)
> &MtrrSetting.Variables.Mtrr[Index].Mask)->Bits.V = 1;
>
> MemOverflow += MemoryLength;
> HighMemoryLength -= MemoryLength;
> --
> 2.7.0.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
prev parent reply other threads:[~2017-08-07 5:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-04 5:59 [Patch v2] Vlv2TbltDevicePkg: Remove reference deprecated macro Eric Dong
2017-08-07 6:00 ` Ni, Ruiyu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=734D49CCEBEEF84792F5B80ED585239D5B9CE220@SHSMSX104.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox