Merge in the pat_works work from sys/i386/i386/pmap.c - primarily to reduce
diff size.
This commit is contained in:
parent
5d7c160965
commit
a935e0180a
@ -223,6 +223,8 @@ static uma_zone_t pdptzone;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static int pat_works; /* Is page attribute table sane? */
|
||||
|
||||
/*
|
||||
* Data for the pv entry allocation mechanism
|
||||
*/
|
||||
@ -514,7 +516,8 @@ pmap_init_pat(void)
|
||||
if (!(cpu_feature & CPUID_PAT))
|
||||
return;
|
||||
|
||||
#ifdef PAT_WORKS
|
||||
if (cpu_vendor_id != CPU_VENDOR_INTEL ||
|
||||
(I386_CPU_FAMILY(cpu_id) == 6 && I386_CPU_MODEL(cpu_id) >= 0xe)) {
|
||||
/*
|
||||
* Leave the indices 0-3 at the default of WB, WT, UC, and UC-.
|
||||
* Program 4 and 5 as WP and WC.
|
||||
@ -524,7 +527,8 @@ pmap_init_pat(void)
|
||||
pat_msr &= ~(PAT_MASK(4) | PAT_MASK(5));
|
||||
pat_msr |= PAT_VALUE(4, PAT_WRITE_PROTECTED) |
|
||||
PAT_VALUE(5, PAT_WRITE_COMBINING);
|
||||
#else
|
||||
pat_works = 1;
|
||||
} else {
|
||||
/*
|
||||
* Due to some Intel errata, we can only safely use the lower 4
|
||||
* PAT entries. Thus, just replace PAT Index 2 with WC instead
|
||||
@ -540,7 +544,8 @@ pmap_init_pat(void)
|
||||
pat_msr = rdmsr(MSR_PAT);
|
||||
pat_msr &= ~PAT_MASK(2);
|
||||
pat_msr |= PAT_VALUE(2, PAT_WRITE_COMBINING);
|
||||
#endif
|
||||
pat_works = 0;
|
||||
}
|
||||
wrmsr(MSR_PAT, pat_msr);
|
||||
}
|
||||
|
||||
@ -769,8 +774,8 @@ pmap_cache_bits(int mode, boolean_t is_pde)
|
||||
}
|
||||
|
||||
/* Map the caching mode to a PAT index. */
|
||||
if (pat_works) {
|
||||
switch (mode) {
|
||||
#ifdef PAT_WORKS
|
||||
case PAT_UNCACHEABLE:
|
||||
pat_index = 3;
|
||||
break;
|
||||
@ -789,7 +794,11 @@ pmap_cache_bits(int mode, boolean_t is_pde)
|
||||
case PAT_WRITE_PROTECTED:
|
||||
pat_index = 4;
|
||||
break;
|
||||
#else
|
||||
default:
|
||||
panic("Unknown caching mode %d\n", mode);
|
||||
}
|
||||
} else {
|
||||
switch (mode) {
|
||||
case PAT_UNCACHED:
|
||||
case PAT_UNCACHEABLE:
|
||||
case PAT_WRITE_PROTECTED:
|
||||
@ -804,10 +813,10 @@ pmap_cache_bits(int mode, boolean_t is_pde)
|
||||
case PAT_WRITE_COMBINING:
|
||||
pat_index = 2;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
panic("Unknown caching mode %d\n", mode);
|
||||
}
|
||||
}
|
||||
|
||||
/* Map the 3-bit index value into the PAT, PCD, and PWT bits. */
|
||||
cache_bits = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user