blob: 376e63f7d50c29c40c883daaa3418cb915c50ba1 [file] [log] [blame]
Aaron Durbin76c37002012-10-30 09:03:43 -05001/*
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.
Aaron Durbin76c37002012-10-30 09:03:43 -050014 */
15
16#include <console/console.h>
17#include <arch/cpu.h>
18#include <string.h>
Elyes HAOUAS21b71ce62018-06-16 18:43:52 +020019#include <southbridge/intel/lynxpoint/pch.h>
Aaron Durbin76c37002012-10-30 09:03:43 -050020#include <arch/io.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +020021#include <device/pci_ops.h>
Aaron Durbin76c37002012-10-30 09:03:43 -050022#include <cpu/x86/msr.h>
Aaron Durbin76c37002012-10-30 09:03:43 -050023#include "haswell.h"
24
25static void report_cpu_info(void)
26{
27 struct cpuid_result cpuidr;
Subrata Banik53b08c32018-12-10 14:11:35 +053028 u32 i, index, cpu_id, cpu_feature_flag;
Aaron Durbin76c37002012-10-30 09:03:43 -050029 char cpu_string[50], *cpu_name = cpu_string; /* 48 bytes are reported */
30 int vt, txt, aes;
31 msr_t microcode_ver;
32 const char *mode[] = {"NOT ", ""};
33
34 index = 0x80000000;
35 cpuidr = cpuid(index);
36 if (cpuidr.eax < 0x80000004) {
37 strcpy(cpu_string, "Platform info not available");
38 } else {
39 u32 *p = (u32*) cpu_string;
Elyes HAOUAS7db506c2016-10-02 11:56:39 +020040 for (i = 2; i <= 4; i++) {
Aaron Durbin76c37002012-10-30 09:03:43 -050041 cpuidr = cpuid(index + i);
42 *p++ = cpuidr.eax;
43 *p++ = cpuidr.ebx;
44 *p++ = cpuidr.ecx;
45 *p++ = cpuidr.edx;
46 }
47 }
48 /* Skip leading spaces in CPU name string */
49 while (cpu_name[0] == ' ')
50 cpu_name++;
51
52 microcode_ver.lo = 0;
53 microcode_ver.hi = 0;
Elyes HAOUAS603963e2018-09-28 09:06:43 +020054 wrmsr(IA32_BIOS_SIGN_ID, microcode_ver);
Subrata Banik53b08c32018-12-10 14:11:35 +053055 cpu_id = cpu_get_cpuid();
Elyes HAOUAS603963e2018-09-28 09:06:43 +020056 microcode_ver = rdmsr(IA32_BIOS_SIGN_ID);
Subrata Banik53b08c32018-12-10 14:11:35 +053057 printk(BIOS_DEBUG, "CPU id(%x) ucode:%08x %s\n", cpu_id,
58 microcode_ver.hi, cpu_name);
59
60 cpu_feature_flag = cpu_get_feature_flags_ecx();
61 aes = (cpu_feature_flag & CPUID_AES) ? 1 : 0;
62 txt = (cpu_feature_flag & CPUID_SMX) ? 1 : 0;
63 vt = (cpu_feature_flag & CPUID_VMX) ? 1 : 0;
Aaron Durbin76c37002012-10-30 09:03:43 -050064 printk(BIOS_DEBUG, "AES %ssupported, TXT %ssupported, VT %ssupported\n",
65 mode[aes], mode[txt], mode[vt]);
66}
67
68/* The PCI id name match comes from Intel document 472178 */
69static struct {
70 u16 dev_id;
71 const char *dev_name;
72} pch_table [] = {
73 {0x8c41, "Mobile Engineering Sample"},
74 {0x8c42, "Desktop Engineering Sample"},
Aaron Durbinf72ad022012-11-02 09:19:43 -050075 {0x8c44, "Z87"},
76 {0x8c46, "Z85"},
77 {0x8c49, "HM86"},
78 {0x8c4a, "H87"},
79 {0x8c4b, "HM87"},
Aaron Durbin76c37002012-10-30 09:03:43 -050080 {0x8c4c, "Q85"},
81 {0x8c4e, "Q87"},
82 {0x8c4f, "QM87"},
83 {0x8c50, "B85"},
84 {0x8c52, "C222"},
85 {0x8c54, "C224"},
86 {0x8c56, "C226"},
87 {0x8c5c, "H81"},
Duncan Lauriece36b122013-01-10 13:23:48 -080088 {0x9c41, "LP Full Featured Engineering Sample"},
89 {0x9c43, "LP Premium"},
90 {0x9c45, "LP Mainstream"},
91 {0x9c47, "LP Value"},
Aaron Durbin76c37002012-10-30 09:03:43 -050092};
93
94static void report_pch_info(void)
95{
96 int i;
97 u16 dev_id = pci_read_config16(PCH_LPC_DEV, 2);
98
99
100 const char *pch_type = "Unknown";
101 for (i = 0; i < ARRAY_SIZE(pch_table); i++) {
102 if (pch_table[i].dev_id == dev_id) {
103 pch_type = pch_table[i].dev_name;
104 break;
105 }
106 }
107 printk (BIOS_DEBUG, "PCH type: %s, device id: %x, rev id %x\n",
108 pch_type, dev_id, pci_read_config8(PCH_LPC_DEV, 8));
109}
110
111void report_platform_info(void)
112{
113 report_cpu_info();
114 report_pch_info();
115}