From 2058df4dd5acb6b301a4bfd81a90dbb2a7af247e Mon Sep 17 00:00:00 2001 From: Li Feng Date: Thu, 2 Mar 2023 23:13:53 -0800 Subject: ish: increase HECI response buffer size HC version v1 response has 132 bytes, but ISH response buffer is smaller than this. We will get error as below: localhost ~ # ectool version --name=cros_ish EC result 14 (RESPONSE_TOO_BIG) Hence increase ISH response buffer size to 260 bytes. BUG=b:271502099 BRANCH=none TEST=on Rex platform with ISH enabled, "ectool version --name=cros_ish" will print firmware version, no error. Change-Id: I81cbea19a2b4719b88b232bfea02803b0a244b89 Signed-off-by: Li Feng Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4302834 Reviewed-by: Yuval Peress Reviewed-by: Tanu Malhotra --- chip/ish/host_command_heci.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/chip/ish/host_command_heci.c b/chip/ish/host_command_heci.c index 3981ea5c53..fe82f94bda 100644 --- a/chip/ish/host_command_heci.c +++ b/chip/ish/host_command_heci.c @@ -43,8 +43,20 @@ struct cros_ec_ishtp_msg_hdr { } __ec_align4; #define CROS_EC_ISHTP_MSG_HDR_SIZE sizeof(struct cros_ec_ishtp_msg_hdr) + +/* + * Increase response_buffer size + * some host command response messages use bigger space; so increase + * the buffer size on par with EC, which is 256 bytes in total. + * The size has to meet + * HECI_CROS_EC_RESPONSE_BUF_SIZE >= CROS_EC_ISHTP_MSG_HDR_SIZE + 256. + * Here 260 bytes is chosen. + */ +#define HECI_CROS_EC_RESPONSE_BUF_SIZE 260 #define HECI_CROS_EC_RESPONSE_MAX \ - (HECI_IPC_PAYLOAD_SIZE - CROS_EC_ISHTP_MSG_HDR_SIZE) + (HECI_CROS_EC_RESPONSE_BUF_SIZE - CROS_EC_ISHTP_MSG_HDR_SIZE) +BUILD_ASSERT(HECI_CROS_EC_RESPONSE_BUF_SIZE >= + CROS_EC_ISHTP_MSG_HDR_SIZE + 256); struct cros_ec_ishtp_msg { struct cros_ec_ishtp_msg_hdr hdr; @@ -56,7 +68,7 @@ enum heci_cros_ec_channel { CROS_MKBP_EVENT = 2, /* initiated from EC */ }; -static uint8_t response_buffer[IPC_MAX_PAYLOAD_SIZE] __aligned(4); +static uint8_t response_buffer[HECI_CROS_EC_RESPONSE_BUF_SIZE] __aligned(4); static struct host_packet heci_packet; int heci_send_mkbp_event(uint32_t *timestamp) -- cgit v1.2.1