Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2012 Google Inc. |
| 5 | * |
| 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. |
| 9 | * |
| 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. |
| 14 | * |
| 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 |
| 18 | */ |
| 19 | |
| 20 | #include <console/console.h> |
| 21 | #include <arch/cpu.h> |
| 22 | #include <string.h> |
| 23 | #include "southbridge/intel/lynxpoint/pch.h" |
| 24 | #include <arch/io.h> |
| 25 | #include <arch/io.h> |
| 26 | #include <cpu/x86/msr.h> |
| 27 | #include <arch/romcc_io.h> |
| 28 | #include "haswell.h" |
| 29 | |
| 30 | static void report_cpu_info(void) |
| 31 | { |
| 32 | struct cpuid_result cpuidr; |
| 33 | u32 i, index; |
| 34 | char cpu_string[50], *cpu_name = cpu_string; /* 48 bytes are reported */ |
| 35 | int vt, txt, aes; |
| 36 | msr_t microcode_ver; |
| 37 | const char *mode[] = {"NOT ", ""}; |
| 38 | |
| 39 | index = 0x80000000; |
| 40 | cpuidr = cpuid(index); |
| 41 | if (cpuidr.eax < 0x80000004) { |
| 42 | strcpy(cpu_string, "Platform info not available"); |
| 43 | } else { |
| 44 | u32 *p = (u32*) cpu_string; |
| 45 | for (i = 2; i <= 4 ; i++) { |
| 46 | cpuidr = cpuid(index + i); |
| 47 | *p++ = cpuidr.eax; |
| 48 | *p++ = cpuidr.ebx; |
| 49 | *p++ = cpuidr.ecx; |
| 50 | *p++ = cpuidr.edx; |
| 51 | } |
| 52 | } |
| 53 | /* Skip leading spaces in CPU name string */ |
| 54 | while (cpu_name[0] == ' ') |
| 55 | cpu_name++; |
| 56 | |
| 57 | microcode_ver.lo = 0; |
| 58 | microcode_ver.hi = 0; |
| 59 | wrmsr(0x8B, microcode_ver); |
| 60 | cpuidr = cpuid(1); |
| 61 | microcode_ver = rdmsr(0x8b); |
| 62 | printk(BIOS_DEBUG, "CPU id(%x) ucode:%08x %s\n", cpuidr.eax, microcode_ver.hi, cpu_name); |
| 63 | aes = (cpuidr.ecx & (1 << 25)) ? 1 : 0; |
| 64 | txt = (cpuidr.ecx & (1 << 6)) ? 1 : 0; |
| 65 | vt = (cpuidr.ecx & (1 << 5)) ? 1 : 0; |
| 66 | printk(BIOS_DEBUG, "AES %ssupported, TXT %ssupported, VT %ssupported\n", |
| 67 | mode[aes], mode[txt], mode[vt]); |
| 68 | } |
| 69 | |
| 70 | /* The PCI id name match comes from Intel document 472178 */ |
| 71 | static struct { |
| 72 | u16 dev_id; |
| 73 | const char *dev_name; |
| 74 | } pch_table [] = { |
| 75 | {0x8c41, "Mobile Engineering Sample"}, |
| 76 | {0x8c42, "Desktop Engineering Sample"}, |
| 77 | {0x8c46, "Z87"}, |
| 78 | {0x8c49, "Z85"}, |
| 79 | {0x8c4a, "HM86"}, |
| 80 | {0x8c4b, "H87"}, |
| 81 | {0x8c4c, "Q85"}, |
| 82 | {0x8c4e, "Q87"}, |
| 83 | {0x8c4f, "QM87"}, |
| 84 | {0x8c50, "B85"}, |
| 85 | {0x8c52, "C222"}, |
| 86 | {0x8c54, "C224"}, |
| 87 | {0x8c56, "C226"}, |
| 88 | {0x8c5c, "H81"}, |
Duncan Laurie | ce36b12 | 2013-01-10 13:23:48 -0800 | [diff] [blame] | 89 | {0x9c41, "LP Full Featured Engineering Sample"}, |
| 90 | {0x9c43, "LP Premium"}, |
| 91 | {0x9c45, "LP Mainstream"}, |
| 92 | {0x9c47, "LP Value"}, |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 93 | }; |
| 94 | |
| 95 | static void report_pch_info(void) |
| 96 | { |
| 97 | int i; |
| 98 | u16 dev_id = pci_read_config16(PCH_LPC_DEV, 2); |
| 99 | |
| 100 | |
| 101 | const char *pch_type = "Unknown"; |
| 102 | for (i = 0; i < ARRAY_SIZE(pch_table); i++) { |
| 103 | if (pch_table[i].dev_id == dev_id) { |
| 104 | pch_type = pch_table[i].dev_name; |
| 105 | break; |
| 106 | } |
| 107 | } |
| 108 | printk (BIOS_DEBUG, "PCH type: %s, device id: %x, rev id %x\n", |
| 109 | pch_type, dev_id, pci_read_config8(PCH_LPC_DEV, 8)); |
| 110 | } |
| 111 | |
| 112 | void report_platform_info(void) |
| 113 | { |
| 114 | report_cpu_info(); |
| 115 | report_pch_info(); |
| 116 | } |