Allow building images with different prefixes (ie. normal/romstage,
[coreboot.git] / src / cpu / amd / model_lx / cache_as_ram.inc
index ee4902a269305e4e09d1f2ccb98bac388c59407c..659e0141a83f7fc66e6f779951e57c87c27a401d 100644 (file)
@@ -178,31 +178,28 @@ DCacheSetupGood:
        call    cache_as_ram_main
 done_cache_as_ram_main:
 
-       /* If you wanted to maintain the stack in memory you would need to set the tags as dirty
-         so the wbinvd would push out the old stack contents to memory */
-       /* Clear the cache, the following code from crt0.S.lb will setup a new stack*/
+        /* We now run over the stack-in-cache, copying it back to itself to invalidate the cache */
+
+        push   %edi
+        mov    $(CONFIG_DCACHE_RAM_SIZE/4),%ecx
+        push   %esi
+        mov    $(CONFIG_DCACHE_RAM_BASE),%edi
+        mov    %edi,%esi
+        cld
+        rep movsl %ds:(%esi),%es:(%edi)
+        pop    %esi
+        pop    %edi
+
+       /* Clear the cache out to ram */
        wbinvd
-
-/* the following code is from crt0.S.lb */
-/* This takes the place of the post-CAR funtions that the K8 uses to setup the stack and copy LB low.*/
-
-#ifndef CONSOLE_DEBUG_TX_STRING
-       /* uses:         esp, ebx, ax, dx */
-# define __CRT_CONSOLE_TX_STRING(string) \
-       mov     string, %ebx    ; \
-       CALLSP(crt_console_tx_string)
-
-# if defined(CONFIG_TTYS0_BASE) && (ASM_CONSOLE_LOGLEVEL > BIOS_DEBUG)
-#  define CONSOLE_DEBUG_TX_STRING(string)        __CRT_CONSOLE_TX_STRING(string)
-# else
-#  define CONSOLE_DEBUG_TX_STRING(string)
-# endif
-#endif
+        /* re-enable the cache */
+        movl    %cr0, %eax
+        xorl             $(CR0_CD + CR0_NW), %eax        /* clear  the CD and NW bits */
+        movl    %eax, %cr0
 
        /* clear boot_complete flag */
        xorl    %ebp, %ebp
 __main:
-       CONSOLE_DEBUG_TX_STRING($str_copying_to_ram)
 
        /*
         *      Copy data into RAM and clear the BSS. Since these segments
@@ -218,9 +215,6 @@ __main:
         * Normally this is copying from FLASH ROM to RAM.
         */
        movl    %ebp, %esi
-       /* FIXME: look for a proper place for the stack */
-       movl    $0x4000000, %esp
-       movl    %esp, %ebp
        pushl   %esi
        pushl $str_coreboot_ram_name
        call cbfs_and_run_core
@@ -284,8 +278,5 @@ str_pre_main:        .string "Jumping to coreboot.\r\n"
 .previous
 
 #endif /* ASM_CONSOLE_LOGLEVEL > BIOS_DEBUG */
-#if CONFIG_USE_FALLBACK_IMAGE == 1
-str_coreboot_ram_name: .string "fallback/coreboot_ram"
-#else
-str_coreboot_ram_name: .string "normal/coreboot_ram"
-#endif
+str_coreboot_ram_name: .ascii CONFIG_CBFS_PREFIX
+                       .string "/coreboot_ram"