MTRR: get physical address size from CPUID
[coreboot.git] / src / cpu / intel / model_6bx / model_6bx_init.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007-2009 coresystems GmbH
5  * Copyright (C) 2010 Joseph Smith <joe@settoplinux.org>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; version 2 of
10  * the License.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
20  * MA 02110-1301 USA
21  */
22
23 #include <console/console.h>
24 #include <device/device.h>
25 #include <device/pci.h>
26 #include <string.h>
27 #include <cpu/cpu.h>
28 #include <cpu/x86/mtrr.h>
29 #include <cpu/x86/msr.h>
30 #include <cpu/x86/lapic.h>
31 #include <cpu/intel/microcode.h>
32 #include <cpu/x86/cache.h>
33 #include <cpu/x86/name.h>
34 #include <usbdebug.h>
35
36 static const uint32_t microcode_updates[] = {
37         #include "microcode-737-MU16b11c.h"
38         #include "microcode-738-MU16b11d.h"
39         #include "microcode-875-MU16b401.h"
40         #include "microcode-885-MU16b402.h"
41         /*  Dummy terminator  */
42         0x0, 0x0, 0x0, 0x0,
43         0x0, 0x0, 0x0, 0x0,
44         0x0, 0x0, 0x0, 0x0,
45         0x0, 0x0, 0x0, 0x0,
46 };
47
48 #if CONFIG_USBDEBUG
49 static unsigned ehci_debug_addr;
50 #endif
51
52 static void model_6bx_init(device_t cpu)
53 {
54         char processor_name[49];
55
56         /* Turn on caching if we haven't already */
57         x86_enable_cache();
58
59         /* Update the microcode */
60         intel_update_microcode(microcode_updates);
61
62         /* Print processor name */
63         fill_processor_name(processor_name);
64         printk(BIOS_INFO, "CPU: %s.\n", processor_name);
65
66 #if CONFIG_USBDEBUG
67         // Is this caution really needed?
68         if(!ehci_debug_addr)
69                 ehci_debug_addr = get_ehci_debug();
70         set_ehci_debug(0);
71 #endif
72
73         /* Setup MTRRs */
74         x86_setup_mtrrs();
75         x86_mtrr_check();
76
77 #if CONFIG_USBDEBUG
78         set_ehci_debug(ehci_debug_addr);
79 #endif
80
81         /* Enable the local cpu apics */
82         setup_lapic();
83 }
84
85 static struct device_operations cpu_dev_ops = {
86         .init     = model_6bx_init,
87 };
88
89 /*
90  * Pentium III Processor Identification and Package Information.
91  * http://www.intel.com/design/pentiumiii/qit/update.pdf
92  *
93  * Intel Pentium III Processor Specification Update
94  * http://download.intel.com/design/intarch/specupdt/24445358.pdf
95  */
96 static struct cpu_device_id cpu_table[] = {
97         { X86_VENDOR_INTEL, 0x06b1 }, /* Pentium III/Celeron, tA1/A1/FPA1 */
98         { X86_VENDOR_INTEL, 0x06b4 }, /* Pentium III, tB1/FPB1 */
99         { 0, 0 },
100 };
101
102 static const struct cpu_driver driver __cpu_driver = {
103         .ops      = &cpu_dev_ops,
104         .id_table = cpu_table,
105 };
106