MTRR: get physical address size from CPUID
[coreboot.git] / src / cpu / intel / model_67x / model_67x_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 <console/console.h>
22 #include <string.h>
23 #include <cpu/cpu.h>
24 #include <cpu/x86/mtrr.h>
25 #include <cpu/x86/lapic.h>
26 #include <cpu/intel/microcode.h>
27 #include <cpu/x86/cache.h>
28 #include <cpu/x86/msr.h>
29 #include <cpu/intel/l2_cache.h>
30
31 static const uint32_t microcode_updates[] = {
32         /* Include microcode updates here. */
33         #include "microcode-293-MU267114.h"
34         #include "microcode-530-MU16730e.h"
35         #include "microcode-531-MU26732e.h"
36         #include "microcode-539-MU167210.h"
37         #include "microcode-540-MU267238.h"
38         /* Dummy terminator */
39         0x0, 0x0, 0x0, 0x0,
40         0x0, 0x0, 0x0, 0x0,
41         0x0, 0x0, 0x0, 0x0,
42         0x0, 0x0, 0x0, 0x0,
43 };
44
45 static void model_67x_init(device_t cpu)
46 {
47         /* Update the microcode */
48         intel_update_microcode(microcode_updates);
49
50         /* Initialize L2 cache */
51         p6_configure_l2_cache();
52
53         /* Turn on caching if we haven't already */
54         x86_enable_cache();
55
56         /* Setup MTRRs */
57         x86_setup_mtrrs();
58         x86_mtrr_check();
59
60         /* Enable the local cpu apics */
61         setup_lapic();
62 }
63
64 static struct device_operations cpu_dev_ops = {
65         .init     = model_67x_init,
66 };
67
68 /*
69  * Intel Pentium III Processor Identification and Package Information
70  * http://www.intel.com/design/pentiumiii/qit/update.pdf
71  *
72  * Intel Pentium III Processor Specification Update
73  * http://download.intel.com/design/intarch/specupdt/24445358.pdf
74  */
75 static struct cpu_device_id cpu_table[] = {
76         { X86_VENDOR_INTEL, 0x0671 },
77         { X86_VENDOR_INTEL, 0x0672 }, /* PIII, kB0 */
78         { X86_VENDOR_INTEL, 0x0673 }, /* PIII, kC0 */
79
80         { 0, 0 },
81 };
82
83 static const struct cpu_driver driver __cpu_driver = {
84         .ops      = &cpu_dev_ops,
85         .id_table = cpu_table,
86 };