MTRR: get physical address size from CPUID
[coreboot.git] / src / cpu / intel / model_65x / model_65x_init.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007-2009 coresystems GmbH
5  * Copyright (C) 2010 Keith Hui <buurin@gmail.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; version 2 of the License.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #include <stdint.h>
22 #include <device/device.h>
23 #include <device/pci.h>
24 #include <cpu/cpu.h>
25 #include <cpu/x86/mtrr.h>
26 #include <cpu/x86/msr.h>
27 #include <cpu/x86/lapic.h>
28 #include <cpu/intel/microcode.h>
29 #include <cpu/x86/cache.h>
30 #include <cpu/intel/l2_cache.h>
31
32 static u32 microcode_updates[] = {
33         #include "microcode-410-MU16522d.h"
34         #include "microcode-422-MU26530b.h"
35         #include "microcode-412-MU16530d.h"
36         #include "microcode-423-MU26522b.h"
37         #include "microcode-407-MU16522a.h"
38         #include "microcode-146-MU16502e.h"
39         #include "microcode-409-MU16522c.h"
40         #include "microcode-147-MU16502f.h"
41         #include "microcode-94-MU265019.h"
42         #include "microcode-430-MU165041.h"
43         #include "microcode-452-MU165310.h"
44         #include "microcode-434-MU165140.h"
45         #include "microcode-435-MU165141.h"
46         #include "microcode-433-MU165045.h"
47         #include "microcode-429-MU165040.h"
48         #include "microcode-436-MU165142.h"
49         #include "microcode-411-MU16530c.h"
50
51         /* Dummy terminator */
52         0x0, 0x0, 0x0, 0x0,
53         0x0, 0x0, 0x0, 0x0,
54         0x0, 0x0, 0x0, 0x0,
55         0x0, 0x0, 0x0, 0x0,
56 };
57
58 static void model_65x_init(device_t dev)
59 {
60         /* Update the microcode */
61         intel_update_microcode(microcode_updates);
62
63         /* Initialize L2 cache */
64         p6_configure_l2_cache();
65
66         /* Turn on caching if we haven't already */
67         x86_enable_cache();
68         x86_setup_mtrrs();
69         x86_mtrr_check();
70
71         /* Enable the local cpu apics */
72         setup_lapic();
73 };
74
75 static struct device_operations cpu_dev_ops = {
76         .init     = model_65x_init,
77 };
78
79 /*
80  * Intel Pentium II Processor Specification Update
81  * http://download.intel.com/design/PentiumII/specupdt/24333749.pdf
82  *
83  * Mobile Intel Pentium II Processor Specification Update
84  * http://download.intel.com/design/intarch/specupdt/24388757.pdf
85  *
86  * Intel Pentium II Xeon Processor Specification Update
87  * http://download.intel.com/support/processors/pentiumii/xeon/24377632.pdf
88  */
89 static struct cpu_device_id cpu_table[] = {
90         { X86_VENDOR_INTEL, 0x0650 }, /* PII/Celeron, dA0/mdA0/A0 */
91         { X86_VENDOR_INTEL, 0x0651 }, /* PII/Celeron, dA1/A1 */
92         { X86_VENDOR_INTEL, 0x0652 }, /* PII/Celeron/Xeon, dB0/mdB0/B0 */
93         { X86_VENDOR_INTEL, 0x0653 }, /* PII/Xeon, dB1/B1 */
94         { 0, 0 },
95 };
96
97 static const struct cpu_driver driver __cpu_driver = {
98         .ops      = &cpu_dev_ops,
99         .id_table = cpu_table,
100 };