diff options
-rw-r--r-- | src/soc/intel/common/block/cse/cse.c | 57 | ||||
-rw-r--r-- | src/soc/intel/common/block/include/intelblocks/cse.h | 21 |
2 files changed, 48 insertions, 30 deletions
diff --git a/src/soc/intel/common/block/cse/cse.c b/src/soc/intel/common/block/cse/cse.c index 68a41e869c..f37ff9589e 100644 --- a/src/soc/intel/common/block/cse/cse.c +++ b/src/soc/intel/common/block/cse/cse.c @@ -813,42 +813,43 @@ int cse_hmrfpo_get_status(void) void print_me_fw_version(void *unused) { - struct version { - uint16_t minor; - uint16_t major; - uint16_t build; - uint16_t hotfix; - } __packed; + struct me_fw_ver_resp resp = {0}; - struct fw_ver_resp { - struct mkhi_hdr hdr; - struct version code; - struct version rec; - struct version fitc; - } __packed; + /* Ignore if UART debugging is disabled */ + if (!CONFIG(CONSOLE_SERIAL)) + return; + + if (get_me_fw_version(&resp) == CB_SUCCESS) { + printk(BIOS_DEBUG, "ME: Version: %d.%d.%d.%d\n", resp.code.major, + resp.code.minor, resp.code.hotfix, resp.code.build); + return; + } + printk(BIOS_DEBUG, "ME: Version: Unavailable\n"); +} +enum cb_err get_me_fw_version(struct me_fw_ver_resp *resp) +{ const struct mkhi_hdr fw_ver_msg = { .group_id = MKHI_GROUP_ID_GEN, .command = MKHI_GEN_GET_FW_VERSION, }; - struct fw_ver_resp resp; - size_t resp_size = sizeof(resp); - - /* Ignore if UART debugging is disabled */ - if (!CONFIG(CONSOLE_SERIAL)) - return; + if (resp == NULL) { + printk(BIOS_ERR, "%s failed, null pointer parameter\n", __func__); + return CB_ERR; + } + size_t resp_size = sizeof(*resp); /* Ignore if CSE is disabled */ if (!is_cse_enabled()) - return; + return CB_ERR; /* * Ignore if ME Firmware SKU type is Lite since * print_boot_partition_info() logs RO(BP1) and RW(BP2) versions. */ if (cse_is_hfs3_fw_sku_lite()) - return; + return CB_ERR; /* * Prerequisites: @@ -858,23 +859,19 @@ void print_me_fw_version(void *unused) * during ramstage */ if (!cse_is_hfs1_cws_normal() || !cse_is_hfs1_com_normal()) - goto fail; + return CB_ERR; heci_reset(); - if (!heci_send_receive(&fw_ver_msg, sizeof(fw_ver_msg), &resp, &resp_size, + if (!heci_send_receive(&fw_ver_msg, sizeof(fw_ver_msg), resp, &resp_size, HECI_MKHI_ADDR)) - goto fail; + return CB_ERR; - if (resp.hdr.result) - goto fail; + if (resp->hdr.result) + return CB_ERR; - printk(BIOS_DEBUG, "ME: Version: %d.%d.%d.%d\n", resp.code.major, - resp.code.minor, resp.code.hotfix, resp.code.build); - return; -fail: - printk(BIOS_DEBUG, "ME: Version: Unavailable\n"); + return CB_SUCCESS; } void cse_trigger_vboot_recovery(enum csme_failure_reason reason) diff --git a/src/soc/intel/common/block/include/intelblocks/cse.h b/src/soc/intel/common/block/include/intelblocks/cse.h index 80e28d5e75..7f455708e3 100644 --- a/src/soc/intel/common/block/include/intelblocks/cse.h +++ b/src/soc/intel/common/block/include/intelblocks/cse.h @@ -76,6 +76,22 @@ struct fw_version { uint16_t build; } __packed; +/* ME FW Version */ +struct me_version { + uint16_t minor; + uint16_t major; + uint16_t build; + uint16_t hotfix; +} __packed; + +/* ME FW Version response */ +struct me_fw_ver_resp { + struct mkhi_hdr hdr; + struct me_version code; + struct me_version rec; + struct me_version fitc; +} __packed; + /* CSE recovery sub-error codes */ enum csme_failure_reason { /* No error */ @@ -227,6 +243,11 @@ int cse_hmrfpo_get_status(void); void print_me_fw_version(void *unused); /* + * Queries and gets ME firmware version + */ +enum cb_err get_me_fw_version(struct me_fw_ver_resp *resp); + +/* * Checks current working operation state is normal or not. * Returns true if CSE's current working state is normal, otherwise false. */ |