Following patch adds resume (exit from self refresh) support for AMD K8 revF
[coreboot.git] / src / northbridge / amd / amdk8 / raminit_f.c
index b24ef82b7f5bf5f23390bec5fb71037e1ccc553b..097e3b53a53c24369c165439c66379460587861d 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdlib.h>
 #include "raminit.h"
 #include "amdk8_f.h"
-#include "spd_ddr2.h"
+#include <spd_ddr2.h>
 
 #ifndef QRANK_DIMM_SUPPORT
 #define QRANK_DIMM_SUPPORT 0
@@ -2071,7 +2071,8 @@ static int update_dimm_TT_1_4(const struct mem_controller *ctrl, const struct me
        }
        
        if (clocks > TT_MAX) {
-               return 0;
+               printk_info("warning spd byte : %x = %x > TT_MAX: %x, setting TT_MAX", SPD_TT, value, TT_MAX);
+               clocks = TT_MAX;
        }
 
        dtl = pci_read_config32(ctrl->f2, TT_REG);
@@ -3008,12 +3009,18 @@ static void set_hw_mem_hole(int controllers, const struct mem_controller *ctrl)
 }
 #endif
 
+#include "exit_from_self.c"
 
 static void sdram_enable(int controllers, const struct mem_controller *ctrl,
                          struct sys_info *sysinfo)
 {
        int i;
-
+#ifdef ACPI_IS_WAKEUP_EARLY
+       int suspend = acpi_is_wakeup_early();
+#else
+       int suspend = 0;
+#endif
 #if K8_REV_F_SUPPORT_F0_F1_WORKAROUND == 1
         unsigned cpu_f0_f1[8];
        /* FIXME: How about 32 node machine later? */
@@ -3059,6 +3066,14 @@ static void sdram_enable(int controllers, const struct mem_controller *ctrl,
        printk_debug("\n");
 #endif
 
+       /* lets override the rest of the routine */
+       if (suspend) {
+               printk_debug("Wakeup!\n");
+               exit_from_self(controllers, ctrl, sysinfo);
+               printk_debug("Mem running !\n");
+               return;
+       }
+
        for (i = 0; i < controllers; i++) {
                uint32_t dcl, dch;
                if (!sysinfo->ctrl_present[ i ])