mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/MtrrLib: Remove the loop of calculating byte offset in MSR
Calculate byte offset in MSR directly and removing the loop. Cc: Feng Tian <feng.tian@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
This commit is contained in:
parent
0f35412232
commit
aaa1e579a5
|
@ -486,18 +486,10 @@ ProgramFixedMtrr (
|
|||
//
|
||||
// We found the fixed MTRR to be programmed
|
||||
//
|
||||
for (ByteShift = 0; ByteShift < 8; ByteShift++) {
|
||||
if (*Base ==
|
||||
(
|
||||
mMtrrLibFixedMtrrTable[MsrNum].BaseAddress +
|
||||
(ByteShift * mMtrrLibFixedMtrrTable[MsrNum].Length)
|
||||
)
|
||||
) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
ByteShift = ((UINT32)*Base - mMtrrLibFixedMtrrTable[MsrNum].BaseAddress)
|
||||
/ mMtrrLibFixedMtrrTable[MsrNum].Length;
|
||||
|
||||
if (ByteShift == 8) {
|
||||
if (ByteShift >= 8) {
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue