Changeset 5202
- Timestamp:
- Mar 11, 2010 11:12:10 PM (3 years ago)
- Location:
- trunk/src/cpu/amd/car
- Files:
-
- 3 edited
-
cache_as_ram.inc (modified) (1 diff)
-
disable_cache_as_ram.c (modified) (1 diff)
-
post_cache_as_ram.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/cpu/amd/car/cache_as_ram.inc
r4999 r5202 271 271 #define REAL_XIP_ROM_BASE CONFIG_XIP_ROM_BASE 272 272 #endif 273 movl $REAL_XIP_ROM_BASE, %eax274 orl $MTRR_TYPE_WRBACK, %eax273 movl $REAL_XIP_ROM_BASE, %eax 274 orl $MTRR_TYPE_WRBACK, %eax 275 275 wrmsr 276 276 -
trunk/src/cpu/amd/car/disable_cache_as_ram.c
r5153 r5202 3 3 static inline __attribute__((always_inline)) void disable_cache_as_ram(void) 4 4 { 5 __asm__ __volatile__ (6 /* We don't need cache as ram for now on */7 /* disable cache */8 "movl %%cr0, %%eax\n\t"9 "orl $(0x1<<30),%%eax\n\t"10 "movl %%eax, %%cr0\n\t"5 __asm__ __volatile__ ( 6 /* We don't need cache as ram for now on */ 7 /* disable cache */ 8 "movl %%cr0, %%eax\n\t" 9 "orl $(0x1<<30),%%eax\n\t" 10 "movl %%eax, %%cr0\n\t" 11 11 12 /* clear sth */13 "movl $0x269, %%ecx\n\t" /* fix4k_c8000*/14 "xorl %%edx, %%edx\n\t"15 "xorl %%eax, %%eax\n\t"12 /* clear sth */ 13 "movl $0x269, %%ecx\n\t" /* fix4k_c8000*/ 14 "xorl %%edx, %%edx\n\t" 15 "xorl %%eax, %%eax\n\t" 16 16 "wrmsr\n\t" 17 17 #if CONFIG_DCACHE_RAM_SIZE > 0x8000 18 18 "movl $0x268, %%ecx\n\t" /* fix4k_c0000*/ 19 "wrmsr\n\t"19 "wrmsr\n\t" 20 20 #endif 21 21 22 /* disable fixed mtrr from now on, it will be enabled by coreboot_ram again*/23 "movl $0xC0010010, %%ecx\n\t"24 // "movl $SYSCFG_MSR, %ecx\n\t"25 "rdmsr\n\t"26 "andl $(~(3<<18)), %%eax\n\t"27 // "andl $(~(SYSCFG_MSR_MtrrFixDramModEn | SYSCFG_MSR_MtrrFixDramEn)), %eax\n\t"28 "wrmsr\n\t"22 /* disable fixed mtrr from now on, it will be enabled by coreboot_ram again*/ 23 "movl $0xC0010010, %%ecx\n\t" 24 // "movl $SYSCFG_MSR, %ecx\n\t" 25 "rdmsr\n\t" 26 "andl $(~(3<<18)), %%eax\n\t" 27 // "andl $(~(SYSCFG_MSR_MtrrFixDramModEn | SYSCFG_MSR_MtrrFixDramEn)), %eax\n\t" 28 "wrmsr\n\t" 29 29 30 /* Set the default memory type and disable fixed and enable variable MTRRs */31 "movl $0x2ff, %%ecx\n\t"32 // "movl $MTRRdefType_MSR, %ecx\n\t"33 "xorl %%edx, %%edx\n\t"34 /* Enable Variable and Disable Fixed MTRRs */35 "movl $0x00000800, %%eax\n\t"36 "wrmsr\n\t"30 /* Set the default memory type and disable fixed and enable variable MTRRs */ 31 "movl $0x2ff, %%ecx\n\t" 32 // "movl $MTRRdefType_MSR, %ecx\n\t" 33 "xorl %%edx, %%edx\n\t" 34 /* Enable Variable and Disable Fixed MTRRs */ 35 "movl $0x00000800, %%eax\n\t" 36 "wrmsr\n\t" 37 37 38 /* enable cache */39 "movl %%cr0, %%eax\n\t"40 "andl $0x9fffffff,%%eax\n\t"41 "movl %%eax, %%cr0\n\t"42 ::: "memory", "eax", "ecx", "edx"43 );38 /* enable cache */ 39 "movl %%cr0, %%eax\n\t" 40 "andl $0x9fffffff,%%eax\n\t" 41 "movl %%eax, %%cr0\n\t" 42 ::: "memory", "eax", "ecx", "edx" 43 ); 44 44 } 45 45 -
trunk/src/cpu/amd/car/post_cache_as_ram.c
r5201 r5202 6 6 static inline void print_debug_pcar(const char *strval, uint32_t val) 7 7 { 8 printk_debug("%s%08x\r\n", strval, val);8 printk_debug("%s%08x\r\n", strval, val); 9 9 } 10 10 … … 42 42 43 43 #if 1 44 {45 /* Check value of esp to verify if we have enough rom for stack in Cache as RAM */46 unsigned v_esp;47 __asm__ volatile (48 "movl %%esp, %0\n\t"49 : "=a" (v_esp)50 );51 print_debug_pcar("v_esp=", v_esp);52 }44 { 45 /* Check value of esp to verify if we have enough rom for stack in Cache as RAM */ 46 unsigned v_esp; 47 __asm__ volatile ( 48 "movl %%esp, %0\n\t" 49 : "=a" (v_esp) 50 ); 51 print_debug_pcar("v_esp=", v_esp); 52 } 53 53 #endif 54 54 … … 60 60 */ 61 61 #if CONFIG_RAMTOP <= 0x100000 62 #error "You need to set CONFIG_RAMTOP greater than 1M"62 #error "You need to set CONFIG_RAMTOP greater than 1M" 63 63 #endif 64 64 … … 72 72 vErrata343(); 73 73 74 memcopy((void *)((CONFIG_RAMTOP)-CONFIG_DCACHE_RAM_SIZE), (void *)CONFIG_DCACHE_RAM_BASE, CONFIG_DCACHE_RAM_SIZE); //inline75 // dump_mem((CONFIG_RAMTOP) - 0x8000, (CONFIG_RAMTOP) - 0x7c00);74 memcopy((void *)((CONFIG_RAMTOP)-CONFIG_DCACHE_RAM_SIZE), (void *)CONFIG_DCACHE_RAM_BASE, CONFIG_DCACHE_RAM_SIZE); //inline 75 // dump_mem((CONFIG_RAMTOP) - 0x8000, (CONFIG_RAMTOP) - 0x7c00); 76 76 77 __asm__ volatile (78 /* set new esp */ /* before CONFIG_RAMBASE */79 "subl %0, %%esp\n\t"80 ::"a"( (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE)- (CONFIG_RAMTOP) )77 __asm__ volatile ( 78 /* set new esp */ /* before CONFIG_RAMBASE */ 79 "subl %0, %%esp\n\t" 80 ::"a"( (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE)- (CONFIG_RAMTOP) ) 81 81 /* discard all registers (eax is used for %0), so gcc redo everything 82 82 after the stack is moved */ 83 83 : "cc", "memory", "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp" 84 );84 ); 85 85 86 86 /* We can put data to stack again */ 87 87 88 /* only global variable sysinfo in cache need to be offset */89 print_debug("Done\r\n");90 print_debug_pcar("testx = ", testx);88 /* only global variable sysinfo in cache need to be offset */ 89 print_debug("Done\r\n"); 90 print_debug_pcar("testx = ", testx); 91 91 92 92 print_debug("Disabling cache as ram now \r\n"); 93 93 disable_cache_as_ram_bsp(); 94 94 95 print_debug("Clearing initial memory region: ");95 print_debug("Clearing initial memory region: "); 96 96 #if CONFIG_HAVE_ACPI_RESUME == 1 97 97 /* clear only coreboot used region of memory. Note: this may break ECC enabled boards */ 98 98 memset((void*) CONFIG_RAMBASE, (CONFIG_RAMTOP) - CONFIG_RAMBASE - CONFIG_DCACHE_RAM_SIZE, 0); 99 99 #else 100 memset((void*)0, ((CONFIG_RAMTOP) - CONFIG_DCACHE_RAM_SIZE), 0);100 memset((void*)0, ((CONFIG_RAMTOP) - CONFIG_DCACHE_RAM_SIZE), 0); 101 101 #endif 102 print_debug("Done\r\n");102 print_debug("Done\r\n"); 103 103 104 104 // dump_mem((CONFIG_RAMTOP) - 0x8000, (CONFIG_RAMTOP) - 0x7c00); 105 105 106 set_sysinfo_in_ram(1); // So other core0 could start to train mem106 set_sysinfo_in_ram(1); // So other core0 could start to train mem 107 107 108 108 #if CONFIG_MEM_TRAIN_SEQ == 1 109 109 // struct sys_info *sysinfox = ((CONFIG_RAMTOP) - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); 110 110 111 // wait for ap memory to trained112 // wait_all_core0_mem_trained(sysinfox); // moved to lapic_init_cpus.c111 // wait for ap memory to trained 112 // wait_all_core0_mem_trained(sysinfox); // moved to lapic_init_cpus.c 113 113 #endif 114 /*copy and execute coreboot_ram */115 copy_and_run();116 /* We will not return */114 /*copy and execute coreboot_ram */ 115 copy_and_run(); 116 /* We will not return */ 117 117 118 print_debug("should not be here -\r\n"); 119 118 print_debug("should not be here -\r\n"); 120 119 } 121
Note: See TracChangeset
for help on using the changeset viewer.
