Lines Matching refs:Index
337 UINT32 Index;
339 for (Index = 0; Index < MTRR_NUMBER_OF_FIXED_MTRR; Index++) {
340 FixedSettings->Mtrr[Index] =
341 AsmReadMsr64 (mMtrrLibFixedMtrrTable[Index].Msr);
391 UINT32 Index;
395 for (Index = 0; Index < VariableMtrrCount; Index++) {
397 VariableSettings->Mtrr[Index].Base =
398 AsmReadMsr64 (MTRR_LIB_IA32_VARIABLE_MTRR_BASE + (Index << 1));
399 VariableSettings->Mtrr[Index].Mask =
400 AsmReadMsr64 (MTRR_LIB_IA32_VARIABLE_MTRR_BASE + (Index << 1) + 1);
402 VariableSettings->Mtrr[Index].Base = MtrrSetting->Variables.Mtrr[Index].Base;
403 VariableSettings->Mtrr[Index].Mask = MtrrSetting->Variables.Mtrr[Index].Mask;
441 @param[out] ReturnMsrNum The index of the fixed MTRR MSR to program.
553 UINTN Index;
557 for (Index = 0, UsedMtrr = 0; Index < FirmwareVariableMtrrCount; Index++) {
558 if ((VariableSettings->Mtrr[Index].Mask & MTRR_LIB_CACHE_MTRR_ENABLED) != 0) {
559 VariableMtrr[Index].Msr = (UINT32)Index;
560 VariableMtrr[Index].BaseAddress = (VariableSettings->Mtrr[Index].Base & MtrrValidAddressMask);
561 VariableMtrr[Index].Length = ((~(VariableSettings->Mtrr[Index].Mask & MtrrValidAddressMask)) & MtrrValidBitsMask) + 1;
562 VariableMtrr[Index].Type = (VariableSettings->Mtrr[Index].Base & 0x0ff);
563 VariableMtrr[Index].Valid = TRUE;
564 VariableMtrr[Index].Used = TRUE;
637 UINT32 Index;
639 for (Index = 0; Index < FirmwareVariableMtrrCount; Index++) {
641 VariableMtrr[Index].Valid &&
643 (Start > (VariableMtrr[Index].BaseAddress +
644 VariableMtrr[Index].Length - 1)
646 (End < VariableMtrr[Index].BaseAddress)
660 @param[in] Index The index of the array VariableMtrr to be invalidated
667 IN UINTN Index,
672 VariableMtrr[Index].Valid = FALSE;
706 UINT32 Index;
717 for (Index = 0; Index < FirmwareVariableMtrrCount; Index++) {
719 MtrrEnd = VariableMtrr[Index].BaseAddress + VariableMtrr[Index].Length - 1;
721 !VariableMtrr[Index].Valid ||
724 (EndAddress < VariableMtrr[Index].BaseAddress)
733 if (Attributes == VariableMtrr[Index].Type) {
738 if (VariableMtrr[Index].BaseAddress <= *Base && MtrrEnd >= EndAddress) {
746 (*Base) < VariableMtrr[Index].BaseAddress ?
748 VariableMtrr[Index].BaseAddress;
754 InvalidateShadowMtrr (Index, VariableMtrr, UsedMtrr);
764 if (VariableMtrr[Index].BaseAddress == *Base && MtrrEnd == EndAddress) {
765 InvalidateShadowMtrr (Index, VariableMtrr, UsedMtrr);
772 VariableMtrr[Index].Type == MTRR_CACHE_WRITE_BACK) ||
774 VariableMtrr[Index].Type == MTRR_CACHE_WRITE_THROUGH) ||
776 (VariableMtrr[Index].Type == MTRR_CACHE_UNCACHEABLE)
922 UINTN Index;
924 for (Index = 0; Index < VariableMtrrCount; Index++) {
925 if (!VariableMtrr[Index].Valid && VariableMtrr[Index].Used) {
926 VariableSettings->Mtrr[Index].Base = 0;
927 VariableSettings->Mtrr[Index].Mask = 0;
928 VariableMtrr[Index].Used = FALSE;
940 @param[in] MtrrNumber Index of MTRR to program.
1137 UINTN Index;
1170 for (Index = 0; Index < MTRR_NUMBER_OF_FIXED_MTRR; Index++) {
1171 if (Address >= mMtrrLibFixedMtrrTable[Index].BaseAddress &&
1173 mMtrrLibFixedMtrrTable[Index].BaseAddress +
1174 (mMtrrLibFixedMtrrTable[Index].Length * 8)
1178 ((UINTN)Address - mMtrrLibFixedMtrrTable[Index].BaseAddress) /
1179 mMtrrLibFixedMtrrTable[Index].Length;
1181 TempQword = AsmReadMsr64 (mMtrrLibFixedMtrrTable[Index].Msr);
1183 TempQword = MtrrSetting->Fixed.Mtrr[Index];
1213 for (Index = 0; Index < VariableMtrrCount; Index++) {
1214 if (VariableMtrr[Index].Valid) {
1215 if (Address >= VariableMtrr[Index].BaseAddress &&
1216 Address < VariableMtrr[Index].BaseAddress+VariableMtrr[Index].Length) {
1217 TempMtrrType = VariableMtrr[Index].Type;
1268 UINTN Index;
1299 for (Index = 0; Index < MTRR_NUMBER_OF_FIXED_MTRR; Index++) {
1300 DEBUG((DEBUG_CACHE, "Fixed MTRR[%02d] : %016lx\n", Index, Mtrrs->Fixed.Mtrr[Index]));
1304 for (Index = 0; Index < VariableMtrrCount; Index++) {
1306 Index,
1307 Mtrrs->Variables.Mtrr[Index].Base,
1308 Mtrrs->Variables.Mtrr[Index].Mask
1317 for (Index = 0; Index < MTRR_NUMBER_OF_FIXED_MTRR; Index++) {
1318 Base = mMtrrLibFixedMtrrTable[Index].BaseAddress;
1320 MemoryType = (UINTN)(RShiftU64 (Mtrrs->Fixed.Mtrr[Index], Index1 * 8) & 0xff);
1331 Base += mMtrrLibFixedMtrrTable[Index].Length;
1365 for (Index = 0, Found = FALSE; Index < VariableMtrrCount; Index++) {
1366 if ((Mtrrs->Variables.Mtrr[Index].Mask & BIT11) == 0) {
1372 MtrrBase = (Mtrrs->Variables.Mtrr[Index].Base & (~(SIZE_4KB - 1)));
1373 MtrrLimit = MtrrBase + ((~(Mtrrs->Variables.Mtrr[Index].Mask & (~(SIZE_4KB - 1)))) & Limit);
1486 UINT32 Index;
1495 for (Index = 0; Index < MTRR_NUMBER_OF_FIXED_MTRR; Index++) {
1496 FixedSettingsValid[Index] = FALSE;
1497 FixedSettingsModified[Index] = FALSE;
1760 for (Index = 0; Index < MTRR_NUMBER_OF_FIXED_MTRR; Index++) {
1761 if (FixedSettingsModified[Index]) {
1767 mMtrrLibFixedMtrrTable[Index].Msr,
1768 WorkingFixedSettings.Mtrr[Index]
1777 for (Index = 0; Index < VariableMtrrCount; Index++) {
1778 if (WorkingVariableSettings.Mtrr[Index].Base != OriginalVariableSettings.Mtrr[Index].Base ||
1779 WorkingVariableSettings.Mtrr[Index].Mask != OriginalVariableSettings.Mtrr[Index].Mask ) {
1785 MTRR_LIB_IA32_VARIABLE_MTRR_BASE + (Index << 1),
1786 WorkingVariableSettings.Mtrr[Index].Base
1789 MTRR_LIB_IA32_VARIABLE_MTRR_BASE + (Index << 1) + 1,
1790 WorkingVariableSettings.Mtrr[Index].Mask
1904 UINT32 Index;
1910 for (Index = 0; Index < VariableMtrrCount; Index++) {
1912 MTRR_LIB_IA32_VARIABLE_MTRR_BASE + (Index << 1),
1913 VariableSettings->Mtrr[Index].Base
1916 MTRR_LIB_IA32_VARIABLE_MTRR_BASE + (Index << 1) + 1,
1917 VariableSettings->Mtrr[Index].Mask
1962 UINT32 Index;
1964 for (Index = 0; Index < MTRR_NUMBER_OF_FIXED_MTRR; Index++) {
1966 mMtrrLibFixedMtrrTable[Index].Msr,
1967 FixedSettings->Mtrr[Index]