summaryrefslogtreecommitdiff
path: root/src/cpu/amd/car
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@openbios.org>2005-12-01 10:54:44 +0000
committerStefan Reinauer <stepan@openbios.org>2005-12-01 10:54:44 +0000
commit806e146e754a44f96c693cde707065b14f80d8a2 (patch)
treee8e174faffc6f7674b93b5b34d17ef3fa716c32f /src/cpu/amd/car
parent70597f96c45e225a42f395cdf16b4ad62459dc3b (diff)
downloadcoreboot-806e146e754a44f96c693cde707065b14f80d8a2.tar.xz
Applying 11_26_car_tyan.diff from Yinghai Lu.
NOTE: This will break the tree so it can be fixed up later git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2115 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/cpu/amd/car')
-rw-r--r--src/cpu/amd/car/cache_as_ram.inc20
-rw-r--r--src/cpu/amd/car/post_cache_as_ram.c48
2 files changed, 43 insertions, 25 deletions
diff --git a/src/cpu/amd/car/cache_as_ram.inc b/src/cpu/amd/car/cache_as_ram.inc
index b8ec1ca407..79cee33206 100644
--- a/src/cpu/amd/car/cache_as_ram.inc
+++ b/src/cpu/amd/car/cache_as_ram.inc
@@ -9,19 +9,20 @@
/* Save the BIST result */
movl %eax, %ebp
- // for normal part %ebx already contain cpu_init_detected from fallback call
+ /*for normal part %ebx already contain cpu_init_detected from fallback call */
-CacheAsRam:
+cache_as_ram_setup:
/* hope we can skip the double set for normal part */
#if USE_FALLBACK_IMAGE == 1
+ /* check if cpu_init_detected */
movl $MTRRdefType_MSR, %ecx
rdmsr
andl $0x00000800, %eax
- movl %eax, %ebx ; // We store the status about if cpu_init_detected
+ movl %eax, %ebx /* We store the status */
/* Set MtrrFixDramModEn for clear fixed mtrr */
- xorl %eax, %eax # clear %eax and %edx
+ xorl %eax, %eax
xorl %edx, %edx
enable_fixed_mtrr_dram_modify:
@@ -97,13 +98,16 @@ clear_fixed_var_mtrr_out:
xorl %edx, %edx
movl $(((CONFIG_LB_MEM_TOPK << 10) + TOP_MEM_MASK) & ~TOP_MEM_MASK) , %eax
wrmsr
-#else
+#endif /* USE_FALLBACK_IMAGE == 1*/
+
+#if USE_FALLBACK_IMAGE == 0
+
/* disable cache */
movl %cr0, %eax
orl $(0x1<<30),%eax
movl %eax, %cr0
-#endif /* USE_FALLBACK_IMAGE == 1*/
+#endif
#if defined(XIP_ROM_SIZE) && defined(XIP_ROM_BASE)
/* enable write base caching so we can do execute in place
@@ -151,7 +155,7 @@ clear_fixed_var_mtrr_out:
movl %esp, %ebp
pushl %ebx /* init detected */
pushl %eax /* bist */
- call amd64_main
+ call cache_as_ram_main
/* We will not go back */
fixed_mtrr_msr:
@@ -169,4 +173,4 @@ var_iorr_msr:
mem_top:
.long 0xC001001A, 0xC001001D
.long 0x000 /* NULL, end of table */
-.CacheAsRam_out:
+cache_as_ram_setup_out:
diff --git a/src/cpu/amd/car/post_cache_as_ram.c b/src/cpu/amd/car/post_cache_as_ram.c
index b78ce77211..fec5905822 100644
--- a/src/cpu/amd/car/post_cache_as_ram.c
+++ b/src/cpu/amd/car/post_cache_as_ram.c
@@ -1,3 +1,19 @@
+
+#include "cpu/amd/car/disable_cache_as_ram.c"
+
+#include "cpu/amd/car/clear_1m_ram.c"
+
+static inline void print_debug_pcar(const char *strval, uint32_t val)
+{
+#if CONFIG_USE_INIT
+ printk_debug("%s%08x\r\n", strval, val);
+#else
+ print_debug(strval); print_debug_hex32(val); print_debug("\r\n");
+#endif
+}
+
+
+
static void post_cache_as_ram(unsigned cpu_reset)
{
@@ -10,19 +26,11 @@ static void post_cache_as_ram(unsigned cpu_reset)
"movl %%esp, %0\n\t"
: "=a" (v_esp)
);
-#if CONFIG_USE_INIT
- printk_debug("v_esp=%08x\r\n", v_esp);
-#else
- print_debug("v_esp="); print_debug_hex32(v_esp); print_debug("\r\n");
-#endif
+ print_debug_pcar("v_esp=", v_esp);
}
#endif
-#if CONFIG_USE_INIT
- printk_debug("cpu_reset = %08x\r\n",cpu_reset);
-#else
- print_debug("cpu_reset = "); print_debug_hex32(cpu_reset); print_debug("\r\n");
-#endif
+ print_debug_pcar("cpu_reset = ",cpu_reset);
if(cpu_reset == 0) {
print_debug("Clearing initial memory region: ");
@@ -35,12 +43,19 @@ static void post_cache_as_ram(unsigned cpu_reset)
::"a" (cpu_reset)
);
-#include "cpu/amd/car/disable_cache_as_ram.c"
+ disable_cache_as_ram();
if(cpu_reset==0) { // cpu_reset don't need to clear it
-#include "cpu/amd/car/clear_1m_ram.c"
+ clear_1m_ram();
}
+#if 0
+ int i;
+ for(i=0;i<0x800000;i++) {
+ outb(0x66, 0x80);
+ }
+#endif
+
__asm__ volatile (
/* set new esp */ /* before _RAMBASE */
"subl %0, %%ebp\n\t"
@@ -58,6 +73,7 @@ static void post_cache_as_ram(unsigned cpu_reset)
);
print_debug("Use Ram as Stack now - "); /* but We can not go back any more, we lost old stack data in cache as ram*/
+
if(new_cpu_reset==0) {
print_debug("done\r\n");
} else
@@ -65,11 +81,9 @@ static void post_cache_as_ram(unsigned cpu_reset)
print_debug("\r\n");
}
-#if CONFIG_USE_INIT
- printk_debug("new_cpu_reset = %08x\r\n", new_cpu_reset);
-#else
- print_debug("new_cpu_reset = "); print_debug_hex32(new_cpu_reset); print_debug("\r\n");
-#endif
+ print_debug_pcar("new_cpu_reset = ", new_cpu_reset);
+
+
/*copy and execute linuxbios_ram */
copy_and_run(new_cpu_reset);
/* We will not return */