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>
33 #include <usbdebug_direct.h>
35 static const uint32_t microcode_updates[] = {
36 #include "microcode-737-MU16b11c.h"
37 #include "microcode-738-MU16b11d.h"
38 #include "microcode-875-MU16b401.h"
39 #include "microcode-885-MU16b402.h"
40 /* Dummy terminator */
47 static inline void strcpy(char *dst, char *src)
49 while (*src) *dst++ = *src++;
52 static void fill_processor_name(char *processor_name)
54 struct cpuid_result regs;
55 char temp_processor_name[49];
56 char *processor_name_start;
57 unsigned int *name_as_ints = (unsigned int *)temp_processor_name;
61 regs = cpuid(0x80000002 + i);
62 name_as_ints[i*4 + 0] = regs.eax;
63 name_as_ints[i*4 + 1] = regs.ebx;
64 name_as_ints[i*4 + 2] = regs.ecx;
65 name_as_ints[i*4 + 3] = regs.edx;
68 temp_processor_name[48] = 0;
70 /* Skip leading spaces */
71 processor_name_start = temp_processor_name;
72 while (*processor_name_start == ' ')
73 processor_name_start++;
75 memset(processor_name, 0, 49);
76 strcpy(processor_name, processor_name_start);
79 #if CONFIG_USBDEBUG_DIRECT
80 static unsigned ehci_debug_addr;
83 static void model_6bx_init(device_t cpu)
85 char processor_name[49];
87 /* Turn on caching if we haven't already */
90 /* Update the microcode */
91 intel_update_microcode(microcode_updates);
93 /* Print processor name */
94 fill_processor_name(processor_name);
95 printk(BIOS_INFO, "CPU: %s.\n", processor_name);
97 #if CONFIG_USBDEBUG_DIRECT
98 // Is this caution really needed?
100 ehci_debug_addr = get_ehci_debug();
108 #if CONFIG_USBDEBUG_DIRECT
109 set_ehci_debug(ehci_debug_addr);
112 /* Enable the local cpu apics */
116 static struct device_operations cpu_dev_ops = {
117 .init = model_6bx_init,
120 static struct cpu_device_id cpu_table[] = {
121 { X86_VENDOR_INTEL, 0x06B1 },
122 { X86_VENDOR_INTEL, 0x06B4 }, /* Low Voltage PIII Micro-FCBGA Socket 479 */
126 static const struct cpu_driver driver __cpu_driver = {
128 .id_table = cpu_table,