blob: 37fcf57677a59873811b0cbaf82b12f92b18acee [file] [log] [blame]
Marc Jones5a4554a2015-09-15 12:44:37 -06001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 The Chromium OS Authors. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
9 * the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc.
19 */
20
21#include <stdlib.h>
22#include <console/console.h>
23#include "me.h"
24
25#if (CONFIG_DEFAULT_CONSOLE_LOGLEVEL >= BIOS_DEBUG)
26/* HFS1[3:0] Current Working State Values */
27static const char *me_cws_values[] = {
28 [ME_HFS_CWS_RESET] = "Reset",
29 [ME_HFS_CWS_INIT] = "Initializing",
30 [ME_HFS_CWS_REC] = "Recovery",
31 [ME_HFS_CWS_NORMAL] = "Normal",
32 [ME_HFS_CWS_WAIT] = "Platform Disable Wait",
33 [ME_HFS_CWS_TRANS] = "OP State Transition",
34 [ME_HFS_CWS_INVALID] = "Invalid CPU Plugged In"
35};
36
37/* HFS1[8:6] Current Operation State Values */
38static const char *me_opstate_values[] = {
39 [ME_HFS_STATE_PREBOOT] = "Preboot",
40 [ME_HFS_STATE_M0_UMA] = "M0 with UMA",
41 [ME_HFS_STATE_M3] = "M3 without UMA",
42 [ME_HFS_STATE_M0] = "M0 without UMA",
43 [ME_HFS_STATE_BRINGUP] = "Bring up",
44 [ME_HFS_STATE_ERROR] = "M0 without UMA but with error"
45};
46
47/* HFS[19:16] Current Operation Mode Values */
48static const char *me_opmode_values[] = {
49 [ME_HFS_MODE_NORMAL] = "Normal",
50 [ME_HFS_MODE_DEBUG] = "Debug",
51 [ME_HFS_MODE_DIS] = "Soft Temporary Disable",
52 [ME_HFS_MODE_OVER_JMPR] = "Security Override via Jumper",
53 [ME_HFS_MODE_OVER_MEI] = "Security Override via MEI Message"
54};
55
56/* HFS[15:12] Error Code Values */
57static const char *me_error_values[] = {
58 [ME_HFS_ERROR_NONE] = "No Error",
59 [ME_HFS_ERROR_UNCAT] = "Uncategorized Failure",
60 [ME_HFS_ERROR_IMAGE] = "Image Failure",
61 [ME_HFS_ERROR_DEBUG] = "Debug Failure"
62};
63
64/* GMES[31:28] ME Progress Code */
65static const char *me_progress_values[] = {
66 [ME_GMES_PHASE_ROM] = "ROM Phase",
67 [ME_GMES_PHASE_BUP] = "BUP Phase",
68 [ME_GMES_PHASE_UKERNEL] = "uKernel Phase",
69 [ME_GMES_PHASE_POLICY] = "Policy Module",
70 [ME_GMES_PHASE_MODULE] = "Module Loading",
71 [ME_GMES_PHASE_UNKNOWN] = "Unknown",
72 [ME_GMES_PHASE_HOST] = "Host Communication"
73};
74
75/* GMES[27:24] Power Management Event */
76static const char *me_pmevent_values[] = {
77 [0x00] = "Clean Moff->Mx wake",
78 [0x01] = "Moff->Mx wake after an error",
79 [0x02] = "Clean global reset",
80 [0x03] = "Global reset after an error",
81 [0x04] = "Clean Intel ME reset",
82 [0x05] = "Intel ME reset due to exception",
83 [0x06] = "Pseudo-global reset",
84 [0x07] = "S0/M0->Sx/M3",
85 [0x08] = "Sx/M3->S0/M0",
86 [0x09] = "Non-power cycle reset",
87 [0x0a] = "Power cycle reset through M3",
88 [0x0b] = "Power cycle reset through Moff",
89 [0x0c] = "Sx/Mx->Sx/Moff"
90};
91
92/* Progress Code 0 states */
93static const char *me_progress_rom_values[] = {
94 [0x00] = "BEGIN",
95 [0x06] = "DISABLE"
96};
97
98/* Progress Code 1 states */
99static const char *me_progress_bup_values[] = {
100 [0x00] = "Initialization starts",
101 [0x01] = "Disable the host wake event",
102 [0x04] = "Flow determination start process",
103 [0x08] = "Error reading/matching the VSCC table in the descriptor",
104 [0x0a] = "Check to see if straps say ME DISABLED",
105 [0x0b] = "Timeout waiting for PWROK",
106 [0x0d] = "Possibly handle BUP manufacturing override strap",
107 [0x11] = "Bringup in M3",
108 [0x12] = "Bringup in M0",
109 [0x13] = "Flow detection error",
110 [0x15] = "M3 clock switching error",
111 [0x18] = "M3 kernel load",
112 [0x1c] = "T34 missing - cannot program ICC",
113 [0x1f] = "Waiting for DID BIOS message",
114 [0x20] = "Waiting for DID BIOS message failure",
115 [0x21] = "DID reported an error",
116 [0x22] = "Enabling UMA",
117 [0x23] = "Enabling UMA error",
118 [0x24] = "Sending DID Ack to BIOS",
119 [0x25] = "Sending DID Ack to BIOS error",
120 [0x26] = "Switching clocks in M0",
121 [0x27] = "Switching clocks in M0 error",
122 [0x28] = "ME in temp disable",
123 [0x32] = "M0 kernel load",
124};
125
126/* Progress Code 3 states */
127static const char *me_progress_policy_values[] = {
128 [0x00] = "Entery into Policy Module",
129 [0x03] = "Received S3 entry",
130 [0x04] = "Received S4 entry",
131 [0x05] = "Received S5 entry",
132 [0x06] = "Received UPD entry",
133 [0x07] = "Received PCR entry",
134 [0x08] = "Received NPCR entry",
135 [0x09] = "Received host wake",
136 [0x0a] = "Received AC<>DC switch",
137 [0x0b] = "Received DRAM Init Done",
138 [0x0c] = "VSCC Data not found for flash device",
139 [0x0d] = "VSCC Table is not valid",
140 [0x0e] = "Flash Partition Boundary is outside address space",
141 [0x0f] = "ME cannot access the chipset descriptor region",
142 [0x10] = "Required VSCC values for flash parts do not match",
143};
144#endif
145
146void intel_me_status(struct me_hfs *hfs, struct me_gmes *gmes)
147{
148#if (CONFIG_DEFAULT_CONSOLE_LOGLEVEL >= BIOS_DEBUG)
149 /* Check Current States */
150 printk(BIOS_DEBUG, "ME: FW Partition Table : %s\n",
151 hfs->fpt_bad ? "BAD" : "OK");
152 printk(BIOS_DEBUG, "ME: Bringup Loader Failure : %s\n",
153 hfs->ft_bup_ld_flr ? "YES" : "NO");
154 printk(BIOS_DEBUG, "ME: Firmware Init Complete : %s\n",
155 hfs->fw_init_complete ? "YES" : "NO");
156 printk(BIOS_DEBUG, "ME: Manufacturing Mode : %s\n",
157 hfs->mfg_mode ? "YES" : "NO");
158 printk(BIOS_DEBUG, "ME: Boot Options Present : %s\n",
159 hfs->boot_options_present ? "YES" : "NO");
160 printk(BIOS_DEBUG, "ME: Update In Progress : %s\n",
161 hfs->update_in_progress ? "YES" : "NO");
162 printk(BIOS_DEBUG, "ME: Current Working State : %s\n",
163 me_cws_values[hfs->working_state]);
164 printk(BIOS_DEBUG, "ME: Current Operation State : %s\n",
165 me_opstate_values[hfs->operation_state]);
166 printk(BIOS_DEBUG, "ME: Current Operation Mode : %s\n",
167 me_opmode_values[hfs->operation_mode]);
168 printk(BIOS_DEBUG, "ME: Error Code : %s\n",
169 me_error_values[hfs->error_code]);
170 printk(BIOS_DEBUG, "ME: Progress Phase : %s\n",
171 me_progress_values[gmes->progress_code]);
172 printk(BIOS_DEBUG, "ME: Power Management Event : %s\n",
173 me_pmevent_values[gmes->current_pmevent]);
174
175 printk(BIOS_DEBUG, "ME: Progress Phase State : ");
176 switch (gmes->progress_code) {
177 case ME_GMES_PHASE_ROM: /* ROM Phase */
178 printk(BIOS_DEBUG, "%s",
179 me_progress_rom_values[gmes->current_state]);
180 break;
181
182 case ME_GMES_PHASE_BUP: /* Bringup Phase */
183 if (gmes->current_state < ARRAY_SIZE(me_progress_bup_values)
184 && me_progress_bup_values[gmes->current_state])
185 printk(BIOS_DEBUG, "%s",
186 me_progress_bup_values[gmes->current_state]);
187 else
188 printk(BIOS_DEBUG, "0x%02x", gmes->current_state);
189 break;
190
191 case ME_GMES_PHASE_POLICY: /* Policy Module Phase */
192 if (gmes->current_state < ARRAY_SIZE(me_progress_policy_values)
193 && me_progress_policy_values[gmes->current_state])
194 printk(BIOS_DEBUG, "%s",
195 me_progress_policy_values[gmes->current_state]);
196 else
197 printk(BIOS_DEBUG, "0x%02x", gmes->current_state);
198 break;
199
200 case ME_GMES_PHASE_HOST: /* Host Communication Phase */
201 if (!gmes->current_state)
202 printk(BIOS_DEBUG, "Host communication established");
203 else
204 printk(BIOS_DEBUG, "0x%02x", gmes->current_state);
205 break;
206
207 default:
208 printk(BIOS_DEBUG, "Unknown 0x%02x", gmes->current_state);
209 }
210 printk(BIOS_DEBUG, "\n");
211#endif
212}