> That info is now out as part of the K8 docs. Those docs are not NDA. If that is the case, this patch should speed things up a bit. You would have to put "USE_AMD_MSR=1" in the linuxbios config in order to enable the amd's msr code. Hope this help.
-Andrew -- Andrew Ip Email: [EMAIL PROTECTED] Tel: (852) 2542 2046 Fax: (852) 2542 2046 Mobile: (852) 9201 9866 Cwlinux Limited 18B Tower 1 Tern Centre, 237 Queen's Road Central, Hong Kong. For my public pgp key, please obtain it from http://www.keyserver.net/en.
diff -Nur freebios/src/cpu/k7/cpufixup.c freebios.amd_msr/src/cpu/k7/cpufixup.c
--- freebios/src/cpu/k7/cpufixup.c Sat Nov 3 04:15:29 2001
+++ freebios.amd_msr/src/cpu/k7/cpufixup.c Fri Mar 22 16:58:55 2002
@@ -3,11 +3,51 @@
#include <cpu/p6/msr.h>
#include <cpu/cpufixup.h>
+#ifdef USE_AMD_MSR
+#define TOP_MEM 0xc001001a
+#define TOP_MEM2 0xc001001d
+#define IORR_FIRST 0xC0010016
+#define IORR_LAST 0xC0010019
+#define SYSCFG 0xc0010010
+
+#define MTRRVARDRAMEN (1 << 20)
+#endif
void
k7_cpufixup(unsigned long ram_kilobytes)
{
-#if 0
+#ifdef USE_AMD_MSR
+ unsigned long lo = 0, hi = 0, i;
+ unsigned long ram_megabytes = ram_kilobytes * 1024;
+
+ // 8 MB alignment please
+ ram_megabytes += 0x7fffff;
+ ram_megabytes &= (~0x7fffff);
+
+ // set top_mem registers to ram size
+ printk_spew("Setting top_mem to 0x%x\n", ram_megabytes);
+ rdmsr(TOP_MEM, lo, hi);
+ printk_spew("TOPMEM was 0x%02x:0x%02x\n", hi, lo);
+ hi = 0;
+ lo = ram_megabytes;
+ wrmsr(TOP_MEM, lo, hi);
+
+ // I am setting this even though I won't enable it
+ wrmsr(TOP_MEM2, lo, hi);
+
+ /* zero the IORR's before we enable to prevent
+ * undefined side effects
+ */
+ lo = hi = 0;
+ for(i = IORR_FIRST; i <= IORR_LAST; i++)
+ wrmsr(i, lo, hi);
+ rdmsr(SYSCFG, lo, hi);
+ printk_spew("SYSCFG was 0x%x:0x%x\n", hi, lo);
+ lo |= MTRRVARDRAMEN;
+ wrmsr(SYSCFG, lo, hi);
+ rdmsr(SYSCFG, lo, hi);
+ printk_spew("SYSCFG IS NOW 0x%x:0x%x\n", hi, lo);
+#else
printk_err("WARNING: you are running the busted version of linuxbios\n");
printk_err("for K7. It will really run slow\n");
#endif
diff -Nur freebios/src/mainboard/elitegroup/k7sem/mainboard.c
freebios.amd_msr/src/mainboard/elitegroup/k7sem/mainboard.c
--- freebios/src/mainboard/elitegroup/k7sem/mainboard.c Tue Jan 22 10:26:45 2002
+++ freebios.amd_msr/src/mainboard/elitegroup/k7sem/mainboard.c Fri Mar 22 16:56:10
+2002
@@ -12,6 +12,9 @@
unsigned long dimm2sizeK);
void final_southbridge_fixup(void);
void final_superio_fixup(void);
+#ifdef USE_AMD_MSR
+ void k7_cpufixup(unsigned long ramsizeK);
+#endif
extern unsigned long slotsizeM[];
printk_info("elitegroup k7sem (and similar)...");
@@ -28,6 +31,9 @@
pcibios_read_config_byte(0, 0x8, 0x7c));
#endif
+#ifdef USE_AMD_MSR
+ k7_cpufixup(slotsizeM[0] + slotsizeM[1]);
+#else
// we need to fix up the K7 MSRs.
// to do this, we get the DIMM sizes in slot1 and 2, and
// call fixk7msr_2dimms
@@ -36,6 +42,7 @@
printk_err("Fixing mainboard for dimms %dK + %dK\n",
slotsizeM[0], slotsizeM[1]);
fixk7msr_2dimms(slotsizeM[0], slotsizeM[1]);
+#endif
final_southbridge_fixup();
#ifndef USE_NEW_SUPERIO_INTERFACE
final_superio_fixup();
diff -Nur freebios/src/mainboard/pcchips/m810lmr/mainboard.c
freebios.amd_msr/src/mainboard/pcchips/m810lmr/mainboard.c
--- freebios/src/mainboard/pcchips/m810lmr/mainboard.c Sat Nov 3 04:14:26 2001
+++ freebios.amd_msr/src/mainboard/pcchips/m810lmr/mainboard.c Fri Mar 22 16:55:05
+2002
@@ -12,9 +12,15 @@
unsigned long dimm2sizeK);
void final_southbridge_fixup(void);
void final_superio_fixup(void);
+#ifdef USE_AMD_MSR
+ void k7_cpufixup(unsigned long ramsizeK);
+#endif
extern unsigned long slotsizeM[];
printk_info("PCCHIPS M810LMR (and similar)...");
+#ifdef USE_AMD_MSR
+ k7_cpufixup(slotsizeM[0] + slotsizeM[1]);
+#else
// we need to fix up the K7 MSRs.
// to do this, we get the DIMM sizes in slot1 and 2, and
// call fixk7msr_2dimms
@@ -23,6 +29,7 @@
printk_err("Fixing mainboard for dimms %dK + %dK\n",
slotsizeM[0], slotsizeM[1]);
fixk7msr_2dimms(slotsizeM[0], slotsizeM[1]);
+#endif
final_southbridge_fixup();
#ifndef USE_NEW_SUPERIO_INTERFACE
final_superio_fixup();
msg05460/pgp00000.pgp
Description: PGP signature
