diff options
author | Dinesh Gehlot <digehlot@google.com> | 2023-03-24 06:39:33 +0000 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-04-13 17:40:17 +0000 |
commit | f963febd29540c4799d15786b778daf3207741c0 (patch) | |
tree | 12d32b2acb74b87525be0d83a6dd19f13382d393 /src/soc/intel/common/block/cse | |
parent | 5ae99f8aa91322b8e83d3391af8be23af36494a2 (diff) | |
download | coreboot-f963febd29540c4799d15786b778daf3207741c0.tar.gz coreboot-f963febd29540c4799d15786b778daf3207741c0.tar.bz2 coreboot-f963febd29540c4799d15786b778daf3207741c0.zip |
soc/intel/cmd/block: Implement an API to get firmware partition details
This patch retrieves details of a specified firmware partition table.
The information retrieved includes the current firmware version and
other information about the firmware partition. The patch communicates
with the ME using the HECI command to acquire this information.
BUG=b:273661726
Test=Verified the changes for ISH partition on nissa board.
Signed-off-by: Dinesh Gehlot <digehlot@google.com>
Change-Id: I0582010bbb836bd4734f843a8c74dee49d203fd8
Reviewed-on: https://review.coreboot.org/c/coreboot/+/74005
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sridhar Siricilla <sridhar.siricilla@intel.com>
Diffstat (limited to 'src/soc/intel/common/block/cse')
-rw-r--r-- | src/soc/intel/common/block/cse/cse.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/cse/cse.c b/src/soc/intel/common/block/cse/cse.c index 1aa3454f6fd0..9a4cd45bc80a 100644 --- a/src/soc/intel/common/block/cse/cse.c +++ b/src/soc/intel/common/block/cse/cse.c @@ -1213,6 +1213,63 @@ 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 /* |