diff options
author | Subrata Banik <subratabanik@google.com> | 2023-04-14 00:35:38 +0530 |
---|---|---|
committer | Subrata Banik <subratabanik@google.com> | 2023-04-15 15:54:17 +0000 |
commit | 7f66adbc71e40f890d72ab2882cbb4c6968e0cac (patch) | |
tree | 0993119b35c0c90e204ba1e77bb70c5a79a085a2 /src/soc/intel | |
parent | 8e6fec441d70e164a42bccdff4ef6e6fb359bf83 (diff) |
soc/intel/cmn/cse: Move API to get FW partition info into cse_lite.c
The patch moves API that gets the CSE FW partition information into
CSE Lite specificĀ file aka cse_lite.c because the consumer of this API
is the cse_lite specific ChromeOS devices hence, it's meaningfulĀ to
move the cse lite specific implementation inside cse_lite.c file.
BUG=b:273661726
TEST=Able to build and boot google/marasov with this code change.
Signed-off-by: Subrata Banik <subratabanik@google.com>
Change-Id: I49ffaec467f6fb24327de3b2882e37bf31eeb7cf
Reviewed-on: https://review.coreboot.org/c/coreboot/+/74382
Reviewed-by: Kangheui Won <khwon@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel')
-rw-r--r-- | src/soc/intel/common/block/cse/cse.c | 57 | ||||
-rw-r--r-- | src/soc/intel/common/block/cse/cse_lite.c | 57 |
2 files changed, 57 insertions, 57 deletions
diff --git a/src/soc/intel/common/block/cse/cse.c b/src/soc/intel/common/block/cse/cse.c index 9a4cd45bc8..1aa3454f6f 100644 --- a/src/soc/intel/common/block/cse/cse.c +++ b/src/soc/intel/common/block/cse/cse.c @@ -1213,63 +1213,6 @@ void cse_enable_ptt(bool state) } } -static enum cb_err send_get_fpt_partition_info_cmd(enum fpt_partition_id id, - struct fw_version_resp *resp) -{ - enum cse_tx_rx_status ret; - struct fw_version_msg { - struct mkhi_hdr hdr; - enum fpt_partition_id partition_id; - } __packed msg = { - .hdr = { - .group_id = MKHI_GROUP_ID_GEN, - .command = GEN_GET_IMAGE_FW_VERSION, - }, - .partition_id = id, - }; - - /* - * Prerequisites: - * 1) HFSTS1 CWS is Normal - * 2) HFSTS1 COM is Normal - * 3) Only sent after DID (accomplished by compiling this into ramstage) - */ - - if (cse_is_hfs1_com_soft_temp_disable() || !cse_is_hfs1_cws_normal() || - !cse_is_hfs1_com_normal()) { - printk(BIOS_ERR, - "HECI: Prerequisites not met for Get Image Firmware Version command\n"); - return CB_ERR; - } - - size_t resp_size = sizeof(struct fw_version_resp); - ret = heci_send_receive(&msg, sizeof(msg), resp, &resp_size, HECI_MKHI_ADDR); - - if (ret || resp->hdr.result) { - printk(BIOS_ERR, "CSE: Failed to get partition information for %d: 0x%x\n", - id, resp->hdr.result); - return CB_ERR; - } - - return CB_SUCCESS; -} - -enum cb_err cse_get_fpt_partition_info(enum fpt_partition_id id, struct fw_version_resp *resp) -{ - if (vboot_recovery_mode_enabled()) { - printk(BIOS_WARNING, - "CSE: Skip sending Get Image Info command during recovery mode!\n"); - return CB_ERR; - } - - if (id == FPT_PARTITION_NAME_ISHC && !CONFIG(DRIVERS_INTEL_ISH)) { - printk(BIOS_WARNING, "CSE: Info request denied, no ISH partition\n"); - return CB_ERR; - } - - return send_get_fpt_partition_info_cmd(id, resp); -} - #if ENV_RAMSTAGE /* diff --git a/src/soc/intel/common/block/cse/cse_lite.c b/src/soc/intel/common/block/cse/cse_lite.c index 4a624e67cb..4cc9e19d7c 100644 --- a/src/soc/intel/common/block/cse/cse_lite.c +++ b/src/soc/intel/common/block/cse/cse_lite.c @@ -1152,6 +1152,63 @@ void cse_fw_sync(void) } } +static enum cb_err send_get_fpt_partition_info_cmd(enum fpt_partition_id id, + struct fw_version_resp *resp) +{ + enum cse_tx_rx_status ret; + struct fw_version_msg { + struct mkhi_hdr hdr; + enum fpt_partition_id partition_id; + } __packed msg = { + .hdr = { + .group_id = MKHI_GROUP_ID_GEN, + .command = GEN_GET_IMAGE_FW_VERSION, + }, + .partition_id = id, + }; + + /* + * Prerequisites: + * 1) HFSTS1 CWS is Normal + * 2) HFSTS1 COM is Normal + * 3) Only sent after DID (accomplished by compiling this into ramstage) + */ + + if (cse_is_hfs1_com_soft_temp_disable() || !cse_is_hfs1_cws_normal() || + !cse_is_hfs1_com_normal()) { + printk(BIOS_ERR, + "HECI: Prerequisites not met for Get Image Firmware Version command\n"); + return CB_ERR; + } + + size_t resp_size = sizeof(struct fw_version_resp); + ret = heci_send_receive(&msg, sizeof(msg), resp, &resp_size, HECI_MKHI_ADDR); + + if (ret || resp->hdr.result) { + printk(BIOS_ERR, "CSE: Failed to get partition information for %d: 0x%x\n", + id, resp->hdr.result); + return CB_ERR; + } + + return CB_SUCCESS; +} + +enum cb_err cse_get_fpt_partition_info(enum fpt_partition_id id, struct fw_version_resp *resp) +{ + if (vboot_recovery_mode_enabled()) { + printk(BIOS_WARNING, + "CSE: Skip sending Get Image Info command during recovery mode!\n"); + return CB_ERR; + } + + if (id == FPT_PARTITION_NAME_ISHC && !CONFIG(DRIVERS_INTEL_ISH)) { + printk(BIOS_WARNING, "CSE: Info request denied, no ISH partition\n"); + return CB_ERR; + } + + return send_get_fpt_partition_info_cmd(id, resp); +} + static void ramstage_cse_fw_sync(void *unused) { bool s3wake; |