[edk2] [Patch 1/7] QuarkSocPkg MtrrLib: Enhance get mtrr mask logic.

Eric Dong posted 7 patches 7 years, 4 months ago
[edk2] [Patch 1/7] QuarkSocPkg MtrrLib: Enhance get mtrr mask logic.
Posted by Eric Dong 7 years, 4 months ago
In order to not use the deprecated macro, refine
get mtrr mask value logic.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
 QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.c b/QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.c
index 58d8c0d..2760427 100644
--- a/QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.c
+++ b/QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.c
@@ -1036,13 +1036,12 @@ MtrrLibInitializeMtrrMask (
     AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);
 
     PhysicalAddressBits = (UINT8) RegEax;
-
-    *MtrrValidBitsMask    = LShiftU64 (1, PhysicalAddressBits) - 1;
-    *MtrrValidAddressMask = *MtrrValidBitsMask & 0xfffffffffffff000ULL;
   } else {
-    *MtrrValidBitsMask    = MTRR_LIB_MSR_VALID_MASK;
-    *MtrrValidAddressMask = MTRR_LIB_CACHE_VALID_ADDRESS;
+    PhysicalAddressBits = 36;
   }
+
+  *MtrrValidBitsMask    = LShiftU64 (1, PhysicalAddressBits) - 1;
+  *MtrrValidAddressMask = *MtrrValidBitsMask & 0xfffffffffffff000ULL;
 }
 
 
-- 
2.7.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch 1/7] QuarkSocPkg MtrrLib: Enhance get mtrr mask logic.
Posted by Ni, Ruiyu 7 years, 4 months ago
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: Thursday, August 3, 2017 5:32 PM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Fan, Jeff <jeff.fan@intel.com>
> Subject: [edk2] [Patch 1/7] QuarkSocPkg MtrrLib: Enhance get mtrr mask
> logic.
> 
> In order to not use the deprecated macro, refine get mtrr mask value logic.
> 
> Cc: Jeff Fan <jeff.fan@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
>  QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.c
> b/QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.c
> index 58d8c0d..2760427 100644
> --- a/QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.c
> +++ b/QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.c
> @@ -1036,13 +1036,12 @@ MtrrLibInitializeMtrrMask (
>      AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);
> 
>      PhysicalAddressBits = (UINT8) RegEax;
> -
> -    *MtrrValidBitsMask    = LShiftU64 (1, PhysicalAddressBits) - 1;
> -    *MtrrValidAddressMask = *MtrrValidBitsMask & 0xfffffffffffff000ULL;
>    } else {
> -    *MtrrValidBitsMask    = MTRR_LIB_MSR_VALID_MASK;
> -    *MtrrValidAddressMask = MTRR_LIB_CACHE_VALID_ADDRESS;
> +    PhysicalAddressBits = 36;
>    }
> +
> +  *MtrrValidBitsMask    = LShiftU64 (1, PhysicalAddressBits) - 1;
> +  *MtrrValidAddressMask = *MtrrValidBitsMask & 0xfffffffffffff000ULL;
>  }
> 
> 
> --
> 2.7.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel