summaryrefslogtreecommitdiff
path: root/src/soc/intel
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2018-11-30 18:32:46 -0800
committerPatrick Georgi <pgeorgi@google.com>2018-12-03 13:26:39 +0000
commitde60e5b84f4f6a960d713a416fa07d0431804c5e (patch)
tree1d5628ffec7cebf1dbdab9dcdfd6a829a3164cc2 /src/soc/intel
parent34fb497383789ed33e546fd643e9b9809f2905f3 (diff)
soc/intel/apollolake: Add support to print ME version
This change adds support to print ME version if UART_DEBUG is enabled. Check for UART_DEBUG is necessary because talking to ME to get the firmware version adds ~0.6 seconds to boot time. TEST=Verified on octopus that ME version printed is correct. Change-Id: I41217371558da1af694a2705e005429155d62838 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/c/29989 Reviewed-by: Justin TerAvest <teravest@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel')
-rw-r--r--src/soc/intel/apollolake/cse.c84
1 files changed, 73 insertions, 11 deletions
diff --git a/src/soc/intel/apollolake/cse.c b/src/soc/intel/apollolake/cse.c
index cfb3b8a841..26249bc9aa 100644
--- a/src/soc/intel/apollolake/cse.c
+++ b/src/soc/intel/apollolake/cse.c
@@ -42,6 +42,9 @@
#define READ_FILE_FLAG_EMULATED (1 << 2)
#define READ_FILE_FLAG_HW (1 << 3)
+#define MKHI_GROUP_ID_GEN 0xff
+#define GET_FW_VERSION 0x02
+
#define MCA_MAX_FILE_PATH_SIZE 64
#define FUSE_LOCK_FILE "/fpf/intel/SocCfgLock"
@@ -55,6 +58,17 @@ static enum fuse_flash_state {
#define FPF_STATUS_FMAP "FPF_STATUS"
+union mkhi_header {
+ uint32_t data;
+ struct {
+ uint32_t group_id: 8;
+ uint32_t command: 7;
+ uint32_t is_response: 1;
+ uint32_t reserved: 8;
+ uint32_t result: 8;
+ } __packed fields;
+};
+
/*
* Read file from CSE internal filesystem.
* size is maximum length of provided buffer buff, which is updated with actual
@@ -67,17 +81,6 @@ static int read_cse_file(const char *path, void *buff, size_t *size,
int res;
size_t reply_size;
- union mkhi_header {
- uint32_t data;
- struct {
- uint32_t group_id: 8;
- uint32_t command: 7;
- uint32_t is_response: 1;
- uint32_t reserved: 8;
- uint32_t result: 8;
- } __packed fields;
- };
-
struct mca_command {
union mkhi_header mkhi_hdr;
char file_name[MCA_MAX_FILE_PATH_SIZE];
@@ -192,6 +195,63 @@ static uint32_t dump_status(int index, int reg_addr)
return reg;
}
+static void dump_cse_version(void)
+{
+ int res;
+ size_t reply_size;
+
+ struct fw_version_cmd {
+ union mkhi_header mkhi_hdr;
+ } __packed msg;
+
+ struct version {
+ uint16_t minor;
+ uint16_t major;
+ uint16_t build;
+ uint16_t hotfix;
+ } __packed;
+
+ struct fw_version_response {
+ union mkhi_header mkhi_hdr;
+ struct version code;
+ struct version nftp;
+ struct version fitc;
+ } __packed rsp;
+
+ /*
+ * Print ME version only if UART debugging is enabled. Else, it takes
+ * ~0.6 second to talk to ME and get this information.
+ */
+ if (!IS_ENABLED(CONFIG_UART_DEBUG))
+ return;
+
+ msg.mkhi_hdr.fields.group_id = MKHI_GROUP_ID_GEN;
+ msg.mkhi_hdr.fields.command = GET_FW_VERSION;
+
+ res = heci_send(&msg, sizeof(msg), BIOS_HOST_ADDR, HECI_MKHI_ADDR);
+
+ if (!res) {
+ printk(BIOS_ERR, "Failed to send HECI message.\n");
+ return;
+ }
+
+ reply_size = sizeof(rsp);
+ res = heci_receive(&rsp, &reply_size);
+
+ if (!res) {
+ printk(BIOS_ERR, "Failed to receive HECI reply.\n");
+ return;
+ }
+
+ if (rsp.mkhi_hdr.fields.result != 0) {
+ printk(BIOS_ERR, "Failed to get ME version.\n");
+ return;
+ }
+
+ printk(BIOS_DEBUG, "ME: Version: %d.%d.%d.%d\n", rsp.code.major,
+ rsp.code.minor, rsp.code.hotfix, rsp.code.build);
+}
+
static void dump_cse_state(void)
{
uint32_t fwsts1;
@@ -222,6 +282,8 @@ static void dump_cse_state(void)
printk(BIOS_DEBUG, "unknown");
}
printk(BIOS_DEBUG, "\n");
+
+ dump_cse_version();
}
#define PCR_PSFX_T0_SHDW_PCIEN 0x1C