mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 07:34:06 +02:00
UefiCpuPkg/MtrrLib: Avoid running unnecessary code
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
This commit is contained in:
parent
17c3dc1939
commit
c9b4492133
@ -1536,6 +1536,7 @@ MtrrLibAddVariableMtrr (
|
|||||||
|
|
||||||
MTRR_LIB_ASSERT_ALIGNED (BaseAddress, Length);
|
MTRR_LIB_ASSERT_ALIGNED (BaseAddress, Length);
|
||||||
if (Type == CacheInvalid) {
|
if (Type == CacheInvalid) {
|
||||||
|
ASSERT (Ranges != NULL);
|
||||||
for (Index = 0; Index < RangeCount; Index++) {
|
for (Index = 0; Index < RangeCount; Index++) {
|
||||||
if (Ranges[Index].BaseAddress <= BaseAddress && BaseAddress < Ranges[Index].BaseAddress + Ranges[Index].Length) {
|
if (Ranges[Index].BaseAddress <= BaseAddress && BaseAddress < Ranges[Index].BaseAddress + Ranges[Index].Length) {
|
||||||
|
|
||||||
@ -2027,8 +2028,9 @@ MtrrSetMemoryAttributeWorker (
|
|||||||
ASSERT (OriginalVariableMtrrCount - FreeVariableMtrrCount <= FirmwareVariableMtrrCount);
|
ASSERT (OriginalVariableMtrrCount - FreeVariableMtrrCount <= FirmwareVariableMtrrCount);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Move MTRRs after the FirmwraeVariableMtrrCount position to beginning
|
// Move MTRRs after the FirmwareVariableMtrrCount position to beginning
|
||||||
//
|
//
|
||||||
|
if (FirmwareVariableMtrrCount < OriginalVariableMtrrCount) {
|
||||||
WorkingIndex = FirmwareVariableMtrrCount;
|
WorkingIndex = FirmwareVariableMtrrCount;
|
||||||
for (Index = 0; Index < FirmwareVariableMtrrCount; Index++) {
|
for (Index = 0; Index < FirmwareVariableMtrrCount; Index++) {
|
||||||
if (!OriginalVariableMtrr[Index].Valid) {
|
if (!OriginalVariableMtrr[Index].Valid) {
|
||||||
@ -2049,6 +2051,7 @@ MtrrSetMemoryAttributeWorker (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert OriginalVariableMtrr to VariableSettings
|
// Convert OriginalVariableMtrr to VariableSettings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user