Changeset 5153
- Timestamp:
- Feb 23, 2010 10:43:42 PM (3 years ago)
- Location:
- trunk/src/cpu/amd/car
- Files:
-
- 2 edited
-
disable_cache_as_ram.c (modified) (2 diffs)
-
post_cache_as_ram.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/cpu/amd/car/disable_cache_as_ram.c
r4381 r5153 3 3 static inline __attribute__((always_inline)) void disable_cache_as_ram(void) 4 4 { 5 6 __asm__ volatile ( 7 5 __asm__ __volatile__ ( 8 6 /* We don't need cache as ram for now on */ 9 7 /* disable cache */ 10 "movl % cr0,%eax\n\t"11 "orl $(0x1<<30),% eax\n\t"12 "movl % eax,%cr0\n\t"8 "movl %%cr0, %%eax\n\t" 9 "orl $(0x1<<30),%%eax\n\t" 10 "movl %%eax, %%cr0\n\t" 13 11 14 12 /* clear sth */ 15 "movl $0x269, % ecx\n\t" /* fix4k_c8000*/16 "xorl % edx,%edx\n\t"17 "xorl % eax,%eax\n\t"13 "movl $0x269, %%ecx\n\t" /* fix4k_c8000*/ 14 "xorl %%edx, %%edx\n\t" 15 "xorl %%eax, %%eax\n\t" 18 16 "wrmsr\n\t" 19 17 #if CONFIG_DCACHE_RAM_SIZE > 0x8000 20 "movl $0x268, % ecx\n\t" /* fix4k_c0000*/18 "movl $0x268, %%ecx\n\t" /* fix4k_c0000*/ 21 19 "wrmsr\n\t" 22 20 #endif 23 21 24 22 /* disable fixed mtrr from now on, it will be enabled by coreboot_ram again*/ 25 "movl $0xC0010010, % ecx\n\t"23 "movl $0xC0010010, %%ecx\n\t" 26 24 // "movl $SYSCFG_MSR, %ecx\n\t" 27 25 "rdmsr\n\t" 28 "andl $(~(3<<18)), % eax\n\t"26 "andl $(~(3<<18)), %%eax\n\t" 29 27 // "andl $(~(SYSCFG_MSR_MtrrFixDramModEn | SYSCFG_MSR_MtrrFixDramEn)), %eax\n\t" 30 28 "wrmsr\n\t" 31 29 32 30 /* Set the default memory type and disable fixed and enable variable MTRRs */ 33 "movl $0x2ff, % ecx\n\t"31 "movl $0x2ff, %%ecx\n\t" 34 32 // "movl $MTRRdefType_MSR, %ecx\n\t" 35 "xorl % edx,%edx\n\t"33 "xorl %%edx, %%edx\n\t" 36 34 /* Enable Variable and Disable Fixed MTRRs */ 37 "movl $0x00000800, % eax\n\t"35 "movl $0x00000800, %%eax\n\t" 38 36 "wrmsr\n\t" 39 37 40 38 /* enable cache */ 41 "movl % cr0,%eax\n\t"42 "andl $0x9fffffff,% eax\n\t"43 "movl % eax,%cr0\n\t"44 39 "movl %%cr0, %%eax\n\t" 40 "andl $0x9fffffff,%%eax\n\t" 41 "movl %%eax, %%cr0\n\t" 42 ::: "memory", "eax", "ecx", "edx" 45 43 ); 46 44 } … … 48 46 static void disable_cache_as_ram_bsp(void) 49 47 { 50 __asm__ volatile (51 // "pushl %eax\n\t"52 "pushl %edx\n\t"53 "pushl %ecx\n\t"54 );55 56 48 disable_cache_as_ram(); 57 __asm__ volatile (58 "popl %ecx\n\t"59 "popl %edx\n\t"60 // "popl %eax\n\t"61 );62 49 } 63 50 -
trunk/src/cpu/amd/car/post_cache_as_ram.c
r4856 r5153 11 11 } 12 12 13 /* from linux kernel 2.6.32 asm/string_32.h */ 14 13 15 static void inline __attribute__((always_inline)) memcopy(void *dest, const void *src, unsigned long bytes) 14 16 { 15 __asm__ volatile( 16 "cld\n\t" 17 "rep; movsl\n\t" 18 : /* No outputs */ 19 : "S" (src), "D" (dest), "c" ((bytes)>>2) 20 ); 17 int d0, d1, d2; 18 asm volatile("cld ; rep ; movsl\n\t" 19 "movl %4,%%ecx\n\t" 20 "andl $3,%%ecx\n\t" 21 "jz 1f\n\t" 22 "rep ; movsb\n\t" 23 "1:" 24 : "=&c" (d0), "=&D" (d1), "=&S" (d2) 25 : "0" (bytes / 4), "g" (bytes), "1" ((long)dest), "2" ((long)src) 26 : "memory", "cc"); 21 27 } 22 28 /* Disable Erratum 343 Workaround, see RevGuide for Fam10h, Pub#41322 Rev 3.33 */ … … 67 73 vErrata343(); 68 74 69 #if 070 __asm__ volatile (71 "pushl %eax\n\t"72 );73 #endif74 75 75 memcopy((void *)((CONFIG_RAMTOP)-CONFIG_DCACHE_RAM_SIZE), (void *)CONFIG_DCACHE_RAM_BASE, CONFIG_DCACHE_RAM_SIZE); //inline 76 76 // dump_mem((CONFIG_RAMTOP) - 0x8000, (CONFIG_RAMTOP) - 0x7c00); … … 78 78 __asm__ volatile ( 79 79 /* set new esp */ /* before CONFIG_RAMBASE */ 80 "subl %0, %%ebp\n\t"81 80 "subl %0, %%esp\n\t" 82 81 ::"a"( (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE)- (CONFIG_RAMTOP) ) 83 ); // We need to push %eax to the stack (CAR) before copy stack and pop it later after copy stack and change esp 84 #if 0 85 __asm__ volatile ( 86 "popl %eax\n\t" 82 /* discard all registers (eax is used for %0), so gcc redo everything 83 after the stack is moved */ 84 : "cc", "memory", "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp" 87 85 ); 88 #endif89 90 86 91 87 /* We can put data to stack again */
Note: See TracChangeset
for help on using the changeset viewer.
