This patch unifies the use of config options in v2 to all start with CONFIG_
[coreboot.git] / src / mainboard / amd / dbm690t / cache_as_ram_auto.c
index b691223b6da46c39acf8984a0b0df3f58eed6dae..75ff96c338db5257d232307fb7cc171e6ba9d1d3 100644 (file)
@@ -37,6 +37,7 @@
 #define SMBUS_HUB 0x71
 
 #include <stdint.h>
+#include <string.h>
 #include <device/pci_def.h>
 #include <arch/io.h>
 #include <device/pnp_def.h>
 #include "cpu/amd/model_fxx/apic_timer.c"
 #include "lib/delay.c"
 
-#if CONFIG_USE_INIT == 0
-#include "lib/memcpy.c"
-#endif
-
 #include "cpu/x86/lapic/boot_cpu.c"
 #include "northbridge/amd/amdk8/reset_test.c"
 #include "northbridge/amd/amdk8/debug.c"
@@ -89,7 +86,7 @@ static inline int spd_read_byte(u32 device, u32 address)
 
 #include "northbridge/amd/amdk8/amdk8.h"
 #include "northbridge/amd/amdk8/incoherent_ht.c"
-#include "northbridge/amd/amdk8/raminit.c"
+#include "northbridge/amd/amdk8/raminit_f.c"
 #include "northbridge/amd/amdk8/coherent_ht.c"
 #include "sdram/generic_sdram.c"
 #include "resourcemap.c"
@@ -103,7 +100,7 @@ static inline int spd_read_byte(u32 device, u32 address)
 
 #include "cpu/amd/model_fxx/fidvid.c"
 
-#if USE_FALLBACK_IMAGE == 1
+#if CONFIG_USE_FALLBACK_IMAGE == 1
 
 #include "northbridge/amd/amdk8/early_ht.c"
 
@@ -142,14 +139,14 @@ normal_image:
 fallback_image:
        post_code(0x25);
 }
-#endif                         /* USE_FALLBACK_IMAGE == 1 */
+#endif                         /* CONFIG_USE_FALLBACK_IMAGE == 1 */
 
 void real_main(unsigned long bist, unsigned long cpu_init_detectedx);
 
 void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
 {
 
-#if USE_FALLBACK_IMAGE == 1
+#if CONFIG_USE_FALLBACK_IMAGE == 1
        failover_process(bist, cpu_init_detectedx);
 #endif
        real_main(bist, cpu_init_detectedx);
@@ -161,7 +158,8 @@ void real_main(unsigned long bist, unsigned long cpu_init_detectedx)
        int needs_reset = 0;
        u32 bsp_apicid = 0;
        msr_t msr;
-       struct sys_info *sysinfo = (struct sys_info *)(DCACHE_RAM_BASE + DCACHE_RAM_SIZE - DCACHE_RAM_GLOBAL_VAR_SIZE);
+       struct cpuid_result cpuid1;
+       struct sys_info *sysinfo = (struct sys_info *)(CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE);
 
 
        if (bist == 0) {
@@ -172,7 +170,7 @@ void real_main(unsigned long bist, unsigned long cpu_init_detectedx)
        sb600_lpc_init();
 
        /* it8712f_enable_serial does not use its 1st parameter. */
-       it8712f_enable_serial(0, TTYS0_BASE);
+       it8712f_enable_serial(0, CONFIG_TTYS0_BASE);
        uart_init();
        console_init();
 
@@ -197,19 +195,30 @@ void real_main(unsigned long bist, unsigned long cpu_init_detectedx)
        rs690_early_setup();
        sb600_early_setup();
 
-       msr=rdmsr(0xc0010042);
-       printk_debug("begin msr fid, vid: hi=0x%x, lo=0x%x\n", msr.hi, msr.lo);
+       /* Check to see if processor is capable of changing FIDVID  */
+       /* otherwise it will throw a GP# when reading FIDVID_STATUS */
+       cpuid1 = cpuid(0x80000007);
+       if( (cpuid1.edx & 0x6) == 0x6 ) {
+
+               /* Read FIDVID_STATUS */
+               msr=rdmsr(0xc0010042);
+               printk_debug("begin msr fid, vid: hi=0x%x, lo=0x%x\n", msr.hi, msr.lo);
 
-       enable_fid_change();
-       enable_fid_change_on_sb(sysinfo->sbbusn, sysinfo->sbdn);
-       init_fidvid_bsp(bsp_apicid);
+               enable_fid_change();
+               enable_fid_change_on_sb(sysinfo->sbbusn, sysinfo->sbdn);
+               init_fidvid_bsp(bsp_apicid);
 
-       /* show final fid and vid */
-       msr=rdmsr(0xc0010042);
-       printk_debug("end msr fid, vid: hi=0x%x, lo=0x%x\n", msr.hi, msr.lo);
+               /* show final fid and vid */
+               msr=rdmsr(0xc0010042);
+               printk_debug("end msr fid, vid: hi=0x%x, lo=0x%x\n", msr.hi, msr.lo);
+
+       } else {
+               printk_debug("Changing FIDVID not supported\n");
+       }
 
        needs_reset = optimize_link_coherent_ht();
        needs_reset |= optimize_link_incoherent_ht(sysinfo);
+       rs690_htinit();
        printk_debug("needs_reset=0x%x\n", needs_reset);