From 0ff799bb75c3bd6b310166b05bc48536f0b6c06d Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Fri, 7 Oct 2016 16:39:56 -0700 Subject: [PATCH] cr50: add reset extension command While USB updates have a mechanism to trigger the target reset, SPI updates do not have it. This patch adds an extension command to cause the device reset. BRANCH=none BUG=chrome-os-partner:58226 TEST=with the rest of the patches applied verified that the system gets reset and the new image version kicks in on both gru (over SPI) and reef (over USB). Change-Id: I498538670e2c43d17b13510288eb9ae75eb7b761 Signed-off-by: Vadim Bendebury Reviewed-on: https://chromium-review.googlesource.com/395628 Reviewed-by: Bill Richardson --- board/cr50/build.mk | 1 + board/cr50/tpm2/post_reset.c | 20 ++++++++++++++++++++ include/extension.h | 1 + 3 files changed, 22 insertions(+) create mode 100644 board/cr50/tpm2/post_reset.c diff --git a/board/cr50/build.mk b/board/cr50/build.mk index 6028e34de2..379e5e26de 100644 --- a/board/cr50/build.mk +++ b/board/cr50/build.mk @@ -42,6 +42,7 @@ board-y += tpm2/hash_data.o board-y += tpm2/hkdf.o board-y += tpm2/manufacture.o board-y += tpm2/platform.o +board-y += tpm2/post_reset.o board-y += tpm2/rsa.o board-y += tpm2/stubs.o board-y += tpm2/trng.o diff --git a/board/cr50/tpm2/post_reset.c b/board/cr50/tpm2/post_reset.c new file mode 100644 index 0000000000..549eaec4f8 --- /dev/null +++ b/board/cr50/tpm2/post_reset.c @@ -0,0 +1,20 @@ +/* Copyright 2016 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + + +#include "config.h" +#include "board.h" +#include "extension.h" + +void post_reset_command_handler(void *body, + size_t cmd_size, + size_t *response_size) +{ + *response_size = 1; + ((uint8_t *)body)[0] = 0; + post_reboot_request(); +} + +DECLARE_EXTENSION_COMMAND(EXTENSION_POST_RESET, post_reset_command_handler); diff --git a/include/extension.h b/include/extension.h index 92a8c28ab7..d3001934da 100644 --- a/include/extension.h +++ b/include/extension.h @@ -53,6 +53,7 @@ enum { EXTENSION_FW_UPGRADE = 4, EXTENSION_HKDF = 5, EXTENSION_ECIES = 6, + EXTENSION_POST_RESET = 7, };