UefiCpuPkg/MtrrLib: Fix a MTRR calculation bug
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 9 Jan 2018 08:46:40 +0000 (16:46 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Thu, 11 Jan 2018 02:37:54 +0000 (10:37 +0800)
commit579510336e2ccbb22fa706c49baa07969e3d60f6
treef2afb6e6543015df838b36e34f378a9adbd73403
parent479a3b6053bb4c508d7397c65f482e0a8f3c9719
UefiCpuPkg/MtrrLib: Fix a MTRR calculation bug

80                   A8   B0   B8   C0
+----------WB--------+-UC-+-WT-+-WB-+

For above memory settings, current code caused the final MTRR
settings miss [A8, B0, UC] when default memory type is UC.

The root cause is the code only checks the mandatory weight
between A8 to B0, but skips to check the optional weight.
The patch fixes this issue.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
UefiCpuPkg/Library/MtrrLib/MtrrLib.c