amdk8: This patch fixes ram init problems when using the 9W Sempron part.
[coreboot.git] / src / northbridge / amd / amdk8 / raminit_f.c
index a883fa401d54b56b0b8c1e2768af82c497b53c6e..0dcb0f6821cf2f0b6e67057939b5f5acedfa99f2 100644 (file)
@@ -1656,14 +1656,28 @@ static uint8_t get_exact_divisor(int i, uint8_t divisor)
          /*15*/   200, 160, 120, 100,
        };
 
-       unsigned fid_cur;
+       
        int index;
-
        msr_t msr;
-       msr = rdmsr(0xc0010042);
-       fid_cur = msr.lo & 0x3f;
 
-       index = fid_cur>>1;
+       /* Check for FID control support */
+       struct cpuid_result cpuid1;
+       cpuid1 = cpuid(0x8000007);
+       if( cpuid1.edx & 0x02 ) {
+               /* Use current FID */
+               unsigned fid_cur;
+               msr = rdmsr(0xc0010042);
+               fid_cur = msr.lo & 0x3f;
+
+               index = fid_cur>>1;
+       } else {
+               /* Use startup FID */
+               unsigned fid_start;
+               msr = rdmsr(0xc0010015);
+               fid_start = (msr.lo & (0x3f << 24));
+               
+               index = fid_start>>25;
+       }
 
        if (index>12) return divisor;