Fix slow CAR execution introduced by 7c7d87182feb78cb2bc02fb3558bef56a41682c9
[coreboot.git] / src / cpu / intel / model_106cx / cache_as_ram.inc
index 87b465e9283f25938d2338e0867ab937b24c9905..9f7ceaf247d79838d718a2995dbe79b598bac24e 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <cpu/x86/stack.h>
 #include <cpu/x86/mtrr.h>
+#include <cpu/x86/post_code.h>
 
 #define CACHE_AS_RAM_SIZE CONFIG_DCACHE_RAM_SIZE
 #define CACHE_AS_RAM_BASE CONFIG_DCACHE_RAM_BASE
@@ -101,12 +102,12 @@ clear_mtrrs:
        /* Enable cache for our code in Flash because we do XIP here */
        movl    $MTRRphysBase_MSR(1), %ecx
        xorl    %edx, %edx
-#if defined(CONFIG_TINY_BOOTBLOCK) && CONFIG_TINY_BOOTBLOCK
-#define REAL_XIP_ROM_BASE AUTO_XIP_ROM_BASE
-#else
-#define REAL_XIP_ROM_BASE CONFIG_XIP_ROM_BASE
-#endif
-       movl    $REAL_XIP_ROM_BASE, %eax
+       /*
+        * IMPORTANT: The following calculation _must_ be done at runtime. See
+        * http://www.coreboot.org/pipermail/coreboot/2010-October/060855.html
+        */
+       movl    $copy_and_run, %eax
+       andl    $(~(CONFIG_XIP_ROM_SIZE - 1)), %eax
        orl     $MTRR_TYPE_WRBACK, %eax
        wrmsr
 
@@ -122,7 +123,7 @@ clear_mtrrs:
        movl    %eax, %cr0
 
        /* Set up the stack pointer. */
-#if defined(CONFIG_USBDEBUG) && (CONFIG_USBDEBUG == 1)
+#if CONFIG_USBDEBUG
        /* Leave some space for the struct ehci_debug_info. */
        movl    $(CACHE_AS_RAM_BASE + CACHE_AS_RAM_SIZE - 4 - 128), %eax
 #else
@@ -224,7 +225,7 @@ clear_mtrrs:
        /* Clear boot_complete flag. */
        xorl    %ebp, %ebp
 __main:
-       post_code(0x11)
+       post_code(POST_PREPARE_RAMSTAGE)
        cld                     /* Clear direction flag. */
 
        movl    %ebp, %esi
@@ -235,7 +236,7 @@ __main:
        call    copy_and_run
 
 .Lhlt:
-       post_code(0xee)
+       post_code(POST_DEAD_CODE)
        hlt
        jmp     .Lhlt