2 * This file is part of the coreboot project.
4 * Copyright (C) 2007-2009 coresystems GmbH
5 * Copyright (C) 2010 Joseph Smith <joe@settoplinux.org>
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
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.
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,
23 #include <console/console.h>
24 #include <device/device.h>
25 #include <device/pci.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>
35 static const uint32_t microcode_updates[] = {
36 #include "microcode-534-MU16810d.h"
37 #include "microcode-535-MU16810e.h"
38 #include "microcode-536-MU16810f.h"
39 #include "microcode-537-MU268110.h"
40 #include "microcode-538-MU168111.h"
41 #include "microcode-550-MU168307.h"
42 #include "microcode-551-MU168308.h"
43 #include "microcode-727-MU168313.h"
44 #include "microcode-728-MU168314.h"
45 #include "microcode-729-MU268310.h"
46 #include "microcode-611-MU168607.h"
47 #include "microcode-612-MU168608.h"
48 #include "microcode-615-MU16860a.h"
49 #include "microcode-617-MU16860c.h"
50 #include "microcode-618-MU268602.h"
51 #include "microcode-662-MU168a01.h"
52 #include "microcode-691-MU168a04.h"
53 #include "microcode-692-MU168a05.h"
54 /* Dummy terminator */
61 static inline void strcpy(char *dst, char *src)
63 while (*src) *dst++ = *src++;
66 static void fill_processor_name(char *processor_name)
68 struct cpuid_result regs;
69 char temp_processor_name[49];
70 char *processor_name_start;
71 unsigned int *name_as_ints = (unsigned int *)temp_processor_name;
75 regs = cpuid(0x80000002 + i);
76 name_as_ints[i*4 + 0] = regs.eax;
77 name_as_ints[i*4 + 1] = regs.ebx;
78 name_as_ints[i*4 + 2] = regs.ecx;
79 name_as_ints[i*4 + 3] = regs.edx;
82 temp_processor_name[48] = 0;
84 /* Skip leading spaces */
85 processor_name_start = temp_processor_name;
86 while (*processor_name_start == ' ')
87 processor_name_start++;
89 memset(processor_name, 0, 49);
90 strcpy(processor_name, processor_name_start);
94 static unsigned ehci_debug_addr;
97 static void model_68x_init(device_t cpu)
99 char processor_name[49];
101 /* Turn on caching if we haven't already */
104 /* Update the microcode */
105 intel_update_microcode(microcode_updates);
107 /* Print processor name */
108 fill_processor_name(processor_name);
109 printk(BIOS_INFO, "CPU: %s.\n", processor_name);
112 // Is this caution really needed?
114 ehci_debug_addr = get_ehci_debug();
123 set_ehci_debug(ehci_debug_addr);
126 /* Enable the local cpu apics */
130 static struct device_operations cpu_dev_ops = {
131 .init = model_68x_init,
134 static struct cpu_device_id cpu_table[] = {
135 { X86_VENDOR_INTEL, 0x0680 },
139 static const struct cpu_driver driver __cpu_driver = {
141 .id_table = cpu_table,