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) 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. |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <stdlib.h> |
| 18 | #include <console/console.h> |
| 19 | #include "me.h" |
| 20 | |
| 21 | #if (CONFIG_DEFAULT_CONSOLE_LOGLEVEL >= BIOS_DEBUG) |
| 22 | /* HFS1[3:0] Current Working State Values */ |
| 23 | static const char *me_cws_values[] = { |
| 24 | [ME_HFS_CWS_RESET] = "Reset", |
| 25 | [ME_HFS_CWS_INIT] = "Initializing", |
| 26 | [ME_HFS_CWS_REC] = "Recovery", |
| 27 | [ME_HFS_CWS_NORMAL] = "Normal", |
| 28 | [ME_HFS_CWS_WAIT] = "Platform Disable Wait", |
| 29 | [ME_HFS_CWS_TRANS] = "OP State Transition", |
| 30 | [ME_HFS_CWS_INVALID] = "Invalid CPU Plugged In" |
| 31 | }; |
| 32 | |
| 33 | /* HFS1[8:6] Current Operation State Values */ |
| 34 | static const char *me_opstate_values[] = { |
| 35 | [ME_HFS_STATE_PREBOOT] = "Preboot", |
| 36 | [ME_HFS_STATE_M0_UMA] = "M0 with UMA", |
| 37 | [ME_HFS_STATE_M3] = "M3 without UMA", |
| 38 | [ME_HFS_STATE_M0] = "M0 without UMA", |
| 39 | [ME_HFS_STATE_BRINGUP] = "Bring up", |
| 40 | [ME_HFS_STATE_ERROR] = "M0 without UMA but with error" |
| 41 | }; |
| 42 | |
| 43 | /* HFS[19:16] Current Operation Mode Values */ |
| 44 | static const char *me_opmode_values[] = { |
| 45 | [ME_HFS_MODE_NORMAL] = "Normal", |
| 46 | [ME_HFS_MODE_DEBUG] = "Debug", |
| 47 | [ME_HFS_MODE_DIS] = "Soft Temporary Disable", |
| 48 | [ME_HFS_MODE_OVER_JMPR] = "Security Override via Jumper", |
| 49 | [ME_HFS_MODE_OVER_MEI] = "Security Override via MEI Message" |
| 50 | }; |
| 51 | |
| 52 | /* HFS[15:12] Error Code Values */ |
| 53 | static const char *me_error_values[] = { |
| 54 | [ME_HFS_ERROR_NONE] = "No Error", |
| 55 | [ME_HFS_ERROR_UNCAT] = "Uncategorized Failure", |
| 56 | [ME_HFS_ERROR_IMAGE] = "Image Failure", |
| 57 | [ME_HFS_ERROR_DEBUG] = "Debug Failure" |
| 58 | }; |
| 59 | |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 60 | /* HFS2[31:28] ME Progress Code */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 61 | static const char *me_progress_values[] = { |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 62 | [ME_HFS2_PHASE_ROM] = "ROM Phase", |
| 63 | [ME_HFS2_PHASE_BUP] = "BUP Phase", |
| 64 | [ME_HFS2_PHASE_UKERNEL] = "uKernel Phase", |
| 65 | [ME_HFS2_PHASE_POLICY] = "Policy Module", |
| 66 | [ME_HFS2_PHASE_MODULE_LOAD] = "Module Loading", |
| 67 | [ME_HFS2_PHASE_UNKNOWN] = "Unknown", |
| 68 | [ME_HFS2_PHASE_HOST_COMM] = "Host Communication" |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 69 | }; |
| 70 | |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 71 | /* HFS2[27:24] Power Management Event */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 72 | static const char *me_pmevent_values[] = { |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 73 | [ME_HFS2_PMEVENT_CLEAN_MOFF_MX_WAKE] = "Clean Moff->Mx wake", |
| 74 | [ME_HFS2_PMEVENT_MOFF_MX_WAKE_ERROR] = "Moff->Mx wake after an error", |
| 75 | [ME_HFS2_PMEVENT_CLEAN_GLOBAL_RESET] = "Clean global reset", |
| 76 | [ME_HFS2_PMEVENT_CLEAN_GLOBAL_RESET_ERROR] = "Global reset after an error", |
| 77 | [ME_HFS2_PMEVENT_CLEAN_ME_RESET] = "Clean Intel ME reset", |
| 78 | [ME_HFS2_PMEVENT_ME_RESET_EXCEPTION] = "Intel ME reset due to exception", |
| 79 | [ME_HFS2_PMEVENT_PSEUDO_ME_RESET] = "Pseudo-global reset", |
| 80 | [ME_HFS2_PMEVENT_S0MO_SXM3] = "S0/M0->Sx/M3", |
| 81 | [ME_HFS2_PMEVENT_SXM3_S0M0] = "Sx/M3->S0/M0", |
| 82 | [ME_HFS2_PMEVENT_NON_PWR_CYCLE_RESET] = "Non-power cycle reset", |
| 83 | [ME_HFS2_PMEVENT_PWR_CYCLE_RESET_M3] = "Power cycle reset through M3", |
| 84 | [ME_HFS2_PMEVENT_PWR_CYCLE_RESET_MOFF] = "Power cycle reset through Moff", |
| 85 | [ME_HFS2_PMEVENT_SXMX_SXMOFF] = "Sx/Mx->Sx/Moff" |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 86 | }; |
| 87 | |
| 88 | /* Progress Code 0 states */ |
| 89 | static const char *me_progress_rom_values[] = { |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 90 | [ME_HFS2_STATE_ROM_BEGIN] = "BEGIN", |
| 91 | [ME_HFS2_STATE_ROM_DISABLE] = "DISABLE" |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 92 | }; |
| 93 | |
| 94 | /* Progress Code 1 states */ |
| 95 | static const char *me_progress_bup_values[] = { |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 96 | [ME_HFS2_STATE_BUP_INIT] = "Initialization starts", |
| 97 | [ME_HFS2_STATE_BUP_DIS_HOST_WAKE] = "Disable the host wake event", |
| 98 | [ME_HFS2_STATE_BUP_FLOW_DET] = "Flow determination start process", |
| 99 | [ME_HFS2_STATE_BUP_VSCC_ERR] = "Error reading/matching the VSCC table in the descriptor", |
| 100 | [ME_HFS2_STATE_BUP_CHECK_STRAP] = "Check to see if straps say ME DISABLED", |
| 101 | [ME_HFS2_STATE_BUP_PWR_OK_TIMEOUT] = "Timeout waiting for PWROK", |
| 102 | [ME_HFS2_STATE_BUP_MANUF_OVRD_STRAP] = "Possibly handle BUP manufacturing override strap", |
| 103 | [ME_HFS2_STATE_BUP_M3] = "Bringup in M3", |
| 104 | [ME_HFS2_STATE_BUP_M0] = "Bringup in M0", |
| 105 | [ME_HFS2_STATE_BUP_FLOW_DET_ERR] = "Flow detection error", |
| 106 | [ME_HFS2_STATE_BUP_M3_CLK_ERR] = "M3 clock switching error", |
Aaron Durbin | 569c653 | 2012-12-11 17:17:38 -0600 | [diff] [blame] | 107 | [ME_HFS2_STATE_BUP_CPU_RESET_DID_TIMEOUT_MEM_MISSING] = "Host error - CPU reset timeout, DID timeout, memory missing", |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 108 | [ME_HFS2_STATE_BUP_M3_KERN_LOAD] = "M3 kernel load", |
| 109 | [ME_HFS2_STATE_BUP_T32_MISSING] = "T34 missing - cannot program ICC", |
| 110 | [ME_HFS2_STATE_BUP_WAIT_DID] = "Waiting for DID BIOS message", |
| 111 | [ME_HFS2_STATE_BUP_WAIT_DID_FAIL] = "Waiting for DID BIOS message failure", |
| 112 | [ME_HFS2_STATE_BUP_DID_NO_FAIL] = "DID reported no error", |
| 113 | [ME_HFS2_STATE_BUP_ENABLE_UMA] = "Enabling UMA", |
| 114 | [ME_HFS2_STATE_BUP_ENABLE_UMA_ERR] = "Enabling UMA error", |
| 115 | [ME_HFS2_STATE_BUP_SEND_DID_ACK] = "Sending DID Ack to BIOS", |
| 116 | [ME_HFS2_STATE_BUP_SEND_DID_ACK_ERR] = "Sending DID Ack to BIOS error", |
| 117 | [ME_HFS2_STATE_BUP_M0_CLK] = "Switching clocks in M0", |
| 118 | [ME_HFS2_STATE_BUP_M0_CLK_ERR] = "Switching clocks in M0 error", |
| 119 | [ME_HFS2_STATE_BUP_TEMP_DIS] = "ME in temp disable", |
| 120 | [ME_HFS2_STATE_BUP_M0_KERN_LOAD] = "M0 kernel load", |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 121 | }; |
| 122 | |
| 123 | /* Progress Code 3 states */ |
| 124 | static const char *me_progress_policy_values[] = { |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 125 | [ME_HFS2_STATE_POLICY_ENTRY] = "Entery into Policy Module", |
| 126 | [ME_HFS2_STATE_POLICY_RCVD_S3] = "Received S3 entry", |
| 127 | [ME_HFS2_STATE_POLICY_RCVD_S4] = "Received S4 entry", |
| 128 | [ME_HFS2_STATE_POLICY_RCVD_S5] = "Received S5 entry", |
| 129 | [ME_HFS2_STATE_POLICY_RCVD_UPD] = "Received UPD entry", |
| 130 | [ME_HFS2_STATE_POLICY_RCVD_PCR] = "Received PCR entry", |
| 131 | [ME_HFS2_STATE_POLICY_RCVD_NPCR] = "Received NPCR entry", |
| 132 | [ME_HFS2_STATE_POLICY_RCVD_HOST_WAKE] = "Received host wake", |
| 133 | [ME_HFS2_STATE_POLICY_RCVD_AC_DC] = "Received AC<>DC switch", |
| 134 | [ME_HFS2_STATE_POLICY_RCVD_DID] = "Received DRAM Init Done", |
| 135 | [ME_HFS2_STATE_POLICY_VSCC_NOT_FOUND] = "VSCC Data not found for flash device", |
| 136 | [ME_HFS2_STATE_POLICY_VSCC_INVALID] = "VSCC Table is not valid", |
| 137 | [ME_HFS2_STATE_POLICY_FPB_ERR] = "Flash Partition Boundary is outside address space", |
| 138 | [ME_HFS2_STATE_POLICY_DESCRIPTOR_ERR] = "ME cannot access the chipset descriptor region", |
| 139 | [ME_HFS2_STATE_POLICY_VSCC_NO_MATCH] = "Required VSCC values for flash parts do not match", |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 140 | }; |
| 141 | #endif |
| 142 | |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 143 | void intel_me_status(struct me_hfs *hfs, struct me_hfs2 *hfs2) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 144 | { |
| 145 | #if (CONFIG_DEFAULT_CONSOLE_LOGLEVEL >= BIOS_DEBUG) |
| 146 | /* Check Current States */ |
| 147 | printk(BIOS_DEBUG, "ME: FW Partition Table : %s\n", |
| 148 | hfs->fpt_bad ? "BAD" : "OK"); |
| 149 | printk(BIOS_DEBUG, "ME: Bringup Loader Failure : %s\n", |
| 150 | hfs->ft_bup_ld_flr ? "YES" : "NO"); |
| 151 | printk(BIOS_DEBUG, "ME: Firmware Init Complete : %s\n", |
| 152 | hfs->fw_init_complete ? "YES" : "NO"); |
| 153 | printk(BIOS_DEBUG, "ME: Manufacturing Mode : %s\n", |
| 154 | hfs->mfg_mode ? "YES" : "NO"); |
| 155 | printk(BIOS_DEBUG, "ME: Boot Options Present : %s\n", |
| 156 | hfs->boot_options_present ? "YES" : "NO"); |
| 157 | printk(BIOS_DEBUG, "ME: Update In Progress : %s\n", |
| 158 | hfs->update_in_progress ? "YES" : "NO"); |
| 159 | printk(BIOS_DEBUG, "ME: Current Working State : %s\n", |
| 160 | me_cws_values[hfs->working_state]); |
| 161 | printk(BIOS_DEBUG, "ME: Current Operation State : %s\n", |
| 162 | me_opstate_values[hfs->operation_state]); |
| 163 | printk(BIOS_DEBUG, "ME: Current Operation Mode : %s\n", |
| 164 | me_opmode_values[hfs->operation_mode]); |
| 165 | printk(BIOS_DEBUG, "ME: Error Code : %s\n", |
| 166 | me_error_values[hfs->error_code]); |
| 167 | printk(BIOS_DEBUG, "ME: Progress Phase : %s\n", |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 168 | me_progress_values[hfs2->progress_code]); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 169 | printk(BIOS_DEBUG, "ME: Power Management Event : %s\n", |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 170 | me_pmevent_values[hfs2->current_pmevent]); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 171 | |
| 172 | printk(BIOS_DEBUG, "ME: Progress Phase State : "); |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 173 | switch (hfs2->progress_code) { |
| 174 | case ME_HFS2_PHASE_ROM: /* ROM Phase */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 175 | printk(BIOS_DEBUG, "%s", |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 176 | me_progress_rom_values[hfs2->current_state]); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 177 | break; |
| 178 | |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 179 | case ME_HFS2_PHASE_BUP: /* Bringup Phase */ |
| 180 | if (hfs2->current_state < ARRAY_SIZE(me_progress_bup_values) |
| 181 | && me_progress_bup_values[hfs2->current_state]) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 182 | printk(BIOS_DEBUG, "%s", |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 183 | me_progress_bup_values[hfs2->current_state]); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 184 | else |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 185 | printk(BIOS_DEBUG, "0x%02x", hfs2->current_state); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 186 | break; |
| 187 | |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 188 | case ME_HFS2_PHASE_POLICY: /* Policy Module Phase */ |
| 189 | if (hfs2->current_state < ARRAY_SIZE(me_progress_policy_values) |
| 190 | && me_progress_policy_values[hfs2->current_state]) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 191 | printk(BIOS_DEBUG, "%s", |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 192 | me_progress_policy_values[hfs2->current_state]); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 193 | else |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 194 | printk(BIOS_DEBUG, "0x%02x", hfs2->current_state); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 195 | break; |
| 196 | |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 197 | case ME_HFS2_PHASE_HOST_COMM: /* Host Communication Phase */ |
| 198 | if (!hfs2->current_state) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 199 | printk(BIOS_DEBUG, "Host communication established"); |
| 200 | else |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 201 | printk(BIOS_DEBUG, "0x%02x", hfs2->current_state); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 202 | break; |
| 203 | |
| 204 | default: |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 205 | printk(BIOS_DEBUG, "Unknown phase: 0x%02x sate: 0x%02x", |
| 206 | hfs2->progress_code, hfs2->current_state); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 207 | } |
| 208 | printk(BIOS_DEBUG, "\n"); |
| 209 | #endif |
| 210 | } |