summaryrefslogtreecommitdiff
path: root/src/cpu/p6/mtrr.c
diff options
context:
space:
mode:
authorRonald G. Minnich <rminnich@gmail.com>2003-10-20 19:57:35 +0000
committerRonald G. Minnich <rminnich@gmail.com>2003-10-20 19:57:35 +0000
commit4398d1e5a9e2d2d384bd917cf679d17d43cd6c57 (patch)
tree529e83f85c21372a4e61be20515f309c7ec18783 /src/cpu/p6/mtrr.c
parent472e74177c3f25b263ab312f9285dd41da1fe11e (diff)
early mtrr for the p6
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1223 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/cpu/p6/mtrr.c')
-rw-r--r--src/cpu/p6/mtrr.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/cpu/p6/mtrr.c b/src/cpu/p6/mtrr.c
index 1225fafe08..77218e91da 100644
--- a/src/cpu/p6/mtrr.c
+++ b/src/cpu/p6/mtrr.c
@@ -31,6 +31,14 @@
#define arraysize(x) (sizeof(x)/sizeof((x)[0]))
+#ifdef k8
+# define ADDRESS_BITS 40
+#else
+# define ADDRESS_BITS 36
+#endif
+#define ADDRESS_BITS_HIGH (ADDRESS_BITS - 32)
+#define ADDRESS_MASK_HIGH ((1u << ADDRESS_BITS_HIGH) - 1)
+
static unsigned int mtrr_msr[] = {
MTRRfix64K_00000_MSR, MTRRfix16K_80000_MSR, MTRRfix16K_A0000_MSR,
MTRRfix4K_C0000_MSR, MTRRfix4K_C8000_MSR, MTRRfix4K_D0000_MSR, MTRRfix4K_D8000_MSR,
@@ -91,12 +99,14 @@ static void intel_set_var_mtrr(unsigned int reg, unsigned long basek, unsigned l
base.hi = basek >> 22;
base.lo = basek << 10;
+ //printk_debug("ADDRESS_MASK_HIGH=%#x\n", ADDRESS_MASK_HIGH);
+
if (sizek < 4*1024*1024) {
- mask.hi = 0x0FF;
+ mask.hi = ADDRESS_MASK_HIGH;
mask.lo = ~((sizek << 10) -1);
}
else {
- mask.hi = 0x0F & (~((sizek >> 22) -1));
+ mask.hi = ADDRESS_MASK_HIGH & (~((sizek >> 22) -1));
mask.lo = 0;
}