Please bear with me - another rename checkin. This qualifies as trivial, no
[coreboot.git] / src / cpu / amd / model_lx / model_lx_init.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2006 Indrek Kruusa <indrek.kruusa@artecdesign.ee>
5  * Copyright (C) 2006 Ronald G. Minnich <rminnich@gmail.com>
6  * Copyright (C) 2006 Stefan Reinauer <stepan@coresystems.de>
7  * Copyright (C) 2006 Andrei Birjukov <andrei.birjukov@artecdesign.ee>
8  * Copyright (C) 2007 Advanced Micro Devices, Inc.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
23  */
24
25 #include <console/console.h>
26 #include <device/device.h>
27 #include <device/pci.h>
28 #include <string.h>
29 #include <cpu/cpu.h>
30 #include <cpu/x86/lapic.h>
31 #include <cpu/x86/cache.h>
32 #include <arch/io.h>
33
34 static void vsm_end_post_smi(void)
35 {
36         __asm__ volatile ("push %ax\n"
37                           "mov $0x5000, %ax\n"
38                           ".byte 0x0f, 0x38\n" "pop %ax\n");
39 }
40
41 static void model_lx_init(device_t dev)
42 {
43         printk_debug("model_lx_init\n");
44
45         /* Turn on caching if we haven't already */
46         x86_enable_cache();
47
48         /* Enable the local cpu apics */
49         //setup_lapic();
50
51         // do VSA late init
52         vsm_end_post_smi();
53
54         // Set gate A20 (legacy vsm disables it in late init)
55         printk_debug("A20 (0x92): %d\n", inb(0x92));
56         outb(0x02, 0x92);
57         printk_debug("A20 (0x92): %d\n", inb(0x92));
58
59         printk_debug("CPU model_lx_init DONE\n");
60 };
61
62 static struct device_operations cpu_dev_ops = {
63         .init = model_lx_init,
64 };
65
66 static struct cpu_device_id cpu_table[] = {
67         {X86_VENDOR_AMD, 0x05A2},
68         {0, 0},
69 };
70
71 static const struct cpu_driver driver __cpu_driver = {
72         .ops = &cpu_dev_ops,
73         .id_table = cpu_table,
74 };