2 * This file is part of the coreboot project.
4 * Copyright (C) 2007 Advanced Micro Devices, Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include <console/console.h>
23 #include <device/device.h>
24 #include <device/pci.h>
27 #include <cpu/amd/microcode.h>
30 static const u8 microcode_updates[] __attribute__ ((aligned(16))) = {
34 /* From the Revision Guide :
35 * Equivalent Processor Table for AMD Family 10h Processors
37 * Installed Processor Equivalent Processor Patch Level
38 * Revision ID Revision ID
39 * 00100F00h 1000h 01000020h
40 * 00100F01h 1000h 01000020h
41 * 00100F02h 1000h 01000020h
42 * 00100F20h 1020h 01000096h
43 * 00100F21h (DR-B1) 1020h 01000096h
44 * 00100F2Ah (DR-BA) 1020h 01000096h
45 * 00100F22h (DR-B2) 1022h 01000095h
46 * 00100F23h (DR-B3) 1022h 01000095h
47 * 00100F62h (DA-C2) 1062h 0100009Fh
50 #include AMD_UCODE_PATCH_FILE
53 /* Dummy terminator */
60 static u32 get_equivalent_processor_rev_id(u32 orig_id) {
61 static unsigned id_mapping_table[] = {
78 for (i = 0; i < sizeof(id_mapping_table); i += 2 ) {
79 if(id_mapping_table[i]==orig_id) {
80 new_id = id_mapping_table[i + 1];
89 void update_microcode(u32 cpu_deviceid)
91 u32 equivalent_processor_rev_id;
93 /* Update the microcode */
94 equivalent_processor_rev_id = get_equivalent_processor_rev_id(cpu_deviceid );
95 if (equivalent_processor_rev_id != 0) {
96 amd_update_microcode((void *) microcode_updates, equivalent_processor_rev_id);
98 printk_debug("microcode: rev id not found. Skipping microcode patch!\n");