summaryrefslogtreecommitdiff
path: root/chip/ish/heci.c
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2019-04-09 13:26:18 -0600
committerJett Rink <jettrink@chromium.org>2019-04-24 21:06:49 +0000
commitd6cc4f14205a00b6d17d22fb7e74a0c8b063ec85 (patch)
tree5657bcfb06db820159ebee8d46abe28688e38bf9 /chip/ish/heci.c
parent0f15b8e5a3583cac214ea93b97918e25d5ff88bc (diff)
downloadchrome-ec-d6cc4f14205a00b6d17d22fb7e74a0c8b063ec85.tar.gz
mkbp: take timestamp closer to hardware interrupt
We want to ensure that the timestamp we take for last mkbp is as close to the actual hardware interrupt from EC->AP. BRANCH=none BUG=b:129159505 TEST=passing CTS sensor run (except test 133 nullptr) with this change Change-Id: I94b214f021f0b63ff2883e5fe8e32acc83ce208f Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1560390 Tested-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Enrico Granata <egranata@chromium.org> Reviewed-by: Mathew King <mathewk@chromium.org> Commit-Queue: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Diffstat (limited to 'chip/ish/heci.c')
-rw-r--r--chip/ish/heci.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/chip/ish/heci.c b/chip/ish/heci.c
index b78e522909..9d16b6a74e 100644
--- a/chip/ish/heci.c
+++ b/chip/ish/heci.c
@@ -220,7 +220,8 @@ static void heci_build_fixed_client_header(struct heci_header *hdr,
hdr->length |= (uint16_t)1 << HECI_MSG_CMPL_SHIFT;
}
-static int heci_send_heci_msg(struct heci_msg *msg)
+static int heci_send_heci_msg_timestamp(struct heci_msg *msg,
+ uint32_t *timestamp)
{
int length, written;
@@ -228,7 +229,8 @@ static int heci_send_heci_msg(struct heci_msg *msg)
return -1;
length = sizeof(msg->hdr) + HECI_MSG_LENGTH(msg->hdr.length);
- written = ipc_write(heci_bus_ctx.ipc_handle, msg, length);
+ written = ipc_write_timestamp(heci_bus_ctx.ipc_handle, msg, length,
+ timestamp);
if (written != length) {
CPRINTF("%s error : len = %d err = %d\n", __func__,
@@ -239,6 +241,11 @@ static int heci_send_heci_msg(struct heci_msg *msg)
return EC_SUCCESS;
}
+static int heci_send_heci_msg(struct heci_msg *msg)
+{
+ return heci_send_heci_msg_timestamp(msg, NULL);
+}
+
int heci_set_client_data(const heci_handle_t handle, void *data)
{
struct heci_client_context *cli_ctx;
@@ -302,8 +309,8 @@ static int wait_for_flow_ctrl_cred(struct heci_client_connect *connect)
return 1;
}
-int heci_send_msg(const heci_handle_t handle, uint8_t *buf,
- const size_t buf_size)
+int heci_send_msg_timestamp(const heci_handle_t handle, uint8_t *buf,
+ const size_t buf_size, uint32_t *timestamp)
{
int buf_offset = 0, ret = 0, remain, payload_size;
struct heci_client_connect *connect;
@@ -347,7 +354,7 @@ int heci_send_msg(const heci_handle_t handle, uint8_t *buf,
memcpy(msg.payload, buf + buf_offset, payload_size);
- heci_send_heci_msg(&msg);
+ heci_send_heci_msg_timestamp(&msg, timestamp);
remain -= payload_size;
buf_offset += payload_size;
@@ -362,6 +369,13 @@ err_locked:
return ret;
}
+int heci_send_msg(const heci_handle_t handle, uint8_t *buf,
+ const size_t buf_size)
+{
+ return heci_send_msg_timestamp(handle, buf, buf_size, NULL);
+}
+
+
int heci_send_msgs(const heci_handle_t handle,
const struct heci_msg_list *msg_list)
{