Geode LX: this patch adds configuration/status/self-test MSR definitions
[coreboot.git] / src / cpu / amd / model_lx / model_lx_init.c
1 #include <console/console.h>
2 #include <device/device.h>
3 #include <device/pci.h>
4 #include <string.h>
5 #include <cpu/cpu.h>
6 #include <cpu/x86/lapic.h>
7 #include <cpu/x86/cache.h>
8 #include <cpu/amd/lxdef.h>
9
10 static void vsm_end_post_smi(void)
11 {
12         __asm__ volatile (
13                           "push %ax\n"
14                           "mov $0x5000, %ax\n"
15                           ".byte 0x0f, 0x38\n"
16                           "pop %ax\n"
17                           );
18 }
19
20 static void model_lx_init(device_t dev)
21 {
22         
23         msr_t msr;
24         
25         printk_debug("model_lx_init\n");
26
27         /* Turn on caching if we haven't already */
28         
29         /* Instruction Memory Configuration register
30          * set EBE bit, required when L2 cache is enabled
31          */ 
32         msr = rdmsr(CPU_IM_CONFIG);
33         msr.lo |= 0x400;
34         wrmsr(CPU_IM_CONFIG, msr);
35         
36         /* Data Memory Subsystem Configuration register
37          * set EVCTONRPL bit, required when L2 cache is enabled in victim mode
38          */
39         msr = rdmsr(CPU_DM_CONFIG0);
40         msr.lo |= 0x4000;
41         wrmsr(CPU_DM_CONFIG0, msr);
42
43         /* invalidate L2 cache */
44         msr.hi = 0x00;
45         msr.lo = 0x10;
46         wrmsr(L2_CONFIG_MSR, msr);
47
48         /* Enable L2 cache */   
49         msr.hi = 0x00;
50         msr.lo = 0x0f;  
51         wrmsr(L2_CONFIG_MSR, msr);
52         
53         x86_enable_cache();
54
55         /* Enable the local cpu apics */
56         //setup_lapic();
57
58         vsm_end_post_smi();
59
60         printk_debug("model_lx_init DONE\n");
61 };
62
63 static struct device_operations cpu_dev_ops = {
64         .init   = model_lx_init,
65 };
66
67 static struct cpu_device_id cpu_table[] = {
68         { X86_VENDOR_AMD, 0x05A2 },
69         { 0, 0 },
70 };
71
72 static struct cpu_driver driver __cpu_driver = {
73         .ops      = &cpu_dev_ops,
74         .id_table = cpu_table,
75 };