diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2015-07-24 17:20:13 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-08-14 21:04:38 +0000 |
commit | 6386c37379284390ed53a7146116947b49576fac (patch) | |
tree | 46014a5345b8310b79f338737aa09628cadb4e02 /common/tpm_registers.c | |
parent | 73a8098d79d84292ff56674f843f73753520fcbd (diff) | |
download | chrome-ec-6386c37379284390ed53a7146116947b49576fac.tar.gz |
cr50: introduce tpm task skeleton
TPM command processing should not be happening on the interrupt
context.
This patch adds a skeleton of the task which handles TPM functions. It
initializes the TPM and then enters endless loop waiting for an event
trigger from interrupt, which happens when a valid FIFO message is
received.
BRANCH=none
BUG=chrome-os-partner:43025
TEST=none yet
Change-Id: I63dce2762cc07370a05bf00bdf144c5d9eb6019b
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/289332
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'common/tpm_registers.c')
-rw-r--r-- | common/tpm_registers.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/common/tpm_registers.c b/common/tpm_registers.c index ba6b4f7492..f4babe8d5f 100644 --- a/common/tpm_registers.c +++ b/common/tpm_registers.c @@ -12,6 +12,7 @@ #include "common.h" #include "console.h" #include "hooks.h" +#include "task.h" #include "tpm_registers.h" #include "util.h" @@ -198,9 +199,11 @@ static void sts_reg_write_tg(void) case tpm_state_ready: break; /* Ignore setting this bit in these states. */ case tpm_state_receiving_cmd: - if (!(tpm_.state & expect)) + if (!(tpm_.state & expect)) { /* This should trigger actual command execution. */ tpm_.state = tpm_state_executing_cmd; + task_set_event(TASK_ID_TPM, TASK_EVENT_WAKE, 0); + } break; } } @@ -312,8 +315,6 @@ static void fifo_reg_write(const uint8_t *data, uint32_t data_size) /* All data has been receved, Ready for the 'go' command. */ tpm_.regs.sts &= ~expect; - CPRINTF("%s: received fifo command 0x%04x\n", - __func__, be32_to_cpu(tpm_.regs.data_fifo + 6)); } void tpm_register_put(uint32_t regaddr, const uint8_t *data, uint32_t data_size) @@ -373,4 +374,16 @@ static void tpm_init(void) (64 << burst_count_shift); } -DECLARE_HOOK(HOOK_INIT, tpm_init, HOOK_PRIO_DEFAULT); +void tpm_task(void) +{ + tpm_init(); + sps_tpm_enable(); + while (1) { + /* Wait for the next command event */ + task_wait_event(-1); + CPRINTF("%s: received fifo command 0x%04x\n", + __func__, be32_to_cpu(tpm_.regs.data_fifo + 6)); + + } +} + |