summaryrefslogtreecommitdiff
path: root/board/cr50
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2016-11-21 11:08:02 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-11-21 16:07:24 -0800
commit94843eca31c85ceaf4b8f9da127216ef45f278eb (patch)
tree7d178641bb4c5921405686589269329f7a387ebe /board/cr50
parent2228b76f740dc7eeca43c446d0bd19882e819f9c (diff)
downloadchrome-ec-94843eca31c85ceaf4b8f9da127216ef45f278eb.tar.gz
Cr50: Add sysinfo vendor command
This returns the system information that is needed to determine the correct signing keys for firmware updates. BUG=chrome-os-partner:59747 BUG=chrome-os-partner:59705 BRANCH=none TEST=make buildall; test on Reef Run the "sysinfo" command on the Cr50 console: > sysinfo Reset flags: 0x00000800 (hard) Chip: g cr50 B2 RO keyid: 0x3716ee6b(dev) RW keyid: 0xb93d6539(dev) DEV_ID: 0x017950ab 0x04656742 > Send the raw command bytes from the Reef AP, observe the result: # /tmp/trunks_send --raw 80 01 00 00 00 0C 20 00 00 00 00 12 80010000001C0000000000123716EE6BB93D6539017950AB04656742 # The result contains the same information from the console command: 8001 TPM_ST_NO_SESSIONS 0000001C responseSize (28 bytes) 00000000 RC_SUCCESS 0012 vendor-specific subcommand 3716EE6B RO keyid B93D6539 RW keyid 017950AB DEV_ID0 04656742 DEV_ID1 Change-Id: I82de3ebfb3e9be3b707583bc825d2efbcf851c5c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/413106 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'board/cr50')
-rw-r--r--board/cr50/board.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/board/cr50/board.c b/board/cr50/board.c
index 7ce2633e76..37f2f4dc9e 100644
--- a/board/cr50/board.c
+++ b/board/cr50/board.c
@@ -3,12 +3,15 @@
* found in the LICENSE file.
*/
+#include <endian.h>
+
#include "clock.h"
#include "common.h"
#include "console.h"
#include "dcrypto/dcrypto.h"
#include "device_state.h"
#include "ec_version.h"
+#include "extension.h"
#include "flash_config.h"
#include "gpio.h"
#include "hooks.h"
@@ -754,3 +757,43 @@ static int command_sysinfo(int argc, char **argv)
DECLARE_SAFE_CONSOLE_COMMAND(sysinfo, command_sysinfo,
NULL,
"Print system info");
+
+/*
+ * SysInfo command:
+ * There are no input args.
+ * Output is this struct, all fields in network order.
+ */
+struct sysinfo_s {
+ uint32_t ro_keyid;
+ uint32_t rw_keyid;
+ uint32_t dev_id0;
+ uint32_t dev_id1;
+} __packed;
+
+static enum vendor_cmd_rc vc_sysinfo(enum vendor_cmd_cc code,
+ void *buf,
+ size_t input_size,
+ size_t *response_size)
+{
+ enum system_image_copy_t active;
+ uintptr_t vaddr;
+ const struct SignedHeader *h;
+ struct sysinfo_s *sysinfo = buf;
+
+ active = system_get_ro_image_copy();
+ vaddr = get_program_memory_addr(active);
+ h = (const struct SignedHeader *)vaddr;
+ sysinfo->ro_keyid = htobe32(h->keyid);
+
+ active = system_get_image_copy();
+ vaddr = get_program_memory_addr(active);
+ h = (const struct SignedHeader *)vaddr;
+ sysinfo->rw_keyid = htobe32(h->keyid);
+
+ sysinfo->dev_id0 = htobe32(GREG32(FUSE, DEV_ID0));
+ sysinfo->dev_id1 = htobe32(GREG32(FUSE, DEV_ID1));
+
+ *response_size = sizeof(*sysinfo);
+ return VENDOR_RC_SUCCESS;
+}
+DECLARE_VENDOR_COMMAND(VENDOR_CC_SYSINFO, vc_sysinfo);