coreboot/src/lib
Vadim Bendebury 021ec2819b cr50: add unmarshaling of vendor commands and process 'enable_update'
The upcoming Cr50 firmware changes will require the AP to enable the
previously downloaded Cr50 firmware update(s).

A new vendor command (TPM2_CR50_SUB_CMD_TURN_UPDATE_ON) is used for
that. The command accepts one parameter - a timeout value in range of
0 to 1000 ms.

When processing the command the Cr50 checks if the alternative RO or
RW image(s) need to be enabled, and if so - enables them and returns
to the host the number of enabled headers.

If the vendor command requested a non-zero timeout, the Cr50 starts
a timer to trigger system reboot after the requested timeout expires.

The host acts on the number of enabled headers - if the number is
nonzero, the host prepares the device to be reset and waits for the
Cr50 to reboot the device after timeout expires.

This patch also adds more formal vendor command
marshaling/unmarshaling to make future additions easier.

BRANCH=gru,reef
BUG=b:35580805
TEST=with the actual user of this code in the next patch verified that
     the cr50 update is enabled as expected.

Change-Id: Ic76d384d637c0eeaad206e0a8242cbb8e2b19b37
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://review.coreboot.org/18945
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-03-23 23:49:58 +01:00
..
gnat Hook up libhwbase in ramstage 2016-11-29 23:45:40 +01:00
b64_decode.c src/lib: Add "int" following "unsigned" 2017-03-09 17:24:17 +01:00
boot_device.c lib/boot_device: add RW boot device construct 2016-08-19 03:07:05 +02:00
bootblock.c src/lib: Move asmlinkage before type 2017-03-13 17:21:26 +01:00
bootmem.c lib/bootmem: allow architecture specific bootmem ranges 2016-04-21 20:46:45 +02:00
bootmode.c bootmode: Get rid of CONFIG_BOOTMODE_STRAPS 2016-07-28 00:36:22 +02:00
cbfs.c src/lib: Fix space between type, * and variable name 2017-03-09 17:27:02 +01:00
cbmem_common.c src/lib: Wrap lines at 80 columns 2017-03-13 17:21:02 +01:00
cbmem_console.c cbmem_console: Remove "buffer_" prefix from all structure fields 2017-02-08 20:06:41 +01:00
cbmem_stage_cache.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
compute_ip_checksum.c src/lib: Wrap lines at 80 columns 2017-03-13 17:21:02 +01:00
coreboot_table.c src/lib: Wrap lines at 80 columns 2017-03-13 17:21:02 +01:00
debug.c src/lib: Add "int" following "unsigned" 2017-03-09 17:24:17 +01:00
delay.c src/lib: Add space before ( 2017-03-09 17:30:21 +01:00
edid.c src/lib: Clean up general issues found by checkpatch.pl 2017-03-15 05:05:04 +01:00
ext_stage_cache.c soc/intel/apollolake: Implement stage cache to improve resume time 2016-10-07 18:18:14 +02:00
fallback_boot.c pc80: Move set_boot_successful() 2016-12-13 19:15:22 +01:00
fmap.c lib/fmap: provide RW region device support 2016-08-19 18:17:04 +02:00
gcc.c src/lib: Move asmlinkage before type 2017-03-13 17:21:26 +01:00
gcov-glue.c src/lib: Clean up general issues found by checkpatch.pl 2017-03-15 05:05:04 +01:00
gcov-io.c src/lib: Use tabs instead of spaces 2017-03-13 15:46:02 +01:00
gcov-io.h src/lib: Fix brace positions 2017-03-13 17:21:16 +01:00
gcov-iov.h Implement GCC code coverage analysis 2013-01-12 19:09:55 +01:00
generic_dump_spd.c src/lib: Add space before ( 2017-03-09 17:30:21 +01:00
generic_sdram.c src/lib: Wrap lines at 80 columns 2017-03-13 17:21:02 +01:00
gpio.c src/lib: Add space before ( 2017-03-09 17:30:21 +01:00
halt.c src/lib: Fix brace positions 2017-03-13 17:21:16 +01:00
hardwaremain.c src/lib: Use tabs instead of spaces 2017-03-13 15:46:02 +01:00
hexdump.c lib/hexdump: Refactor to skip lines with all ones as well 2016-01-22 14:10:28 +01:00
hexstrtobin.c hexstrtobin: Add a library function to decode ASCII hex into binary 2016-05-21 05:58:51 +02:00
hw-time-timer.adb Hook up libhwbase in ramstage 2016-11-29 23:45:40 +01:00
imd.c src/lib: Remove unnecessary code 2017-03-13 21:23:58 +01:00
imd_cbmem.c src/lib: Use tabs instead of spaces 2017-03-13 15:46:02 +01:00
jpeg.c src/lib: Move assignment out of if condition 2017-03-15 05:04:45 +01:00
jpeg.h src/lib: Wrap lines at 80 columns 2017-03-13 17:21:02 +01:00
libgcc.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
libgcov.c src/lib: Move assignment out of if condition 2017-03-15 05:04:45 +01:00
lzma.c src/lib: Wrap lines at 80 columns 2017-03-13 17:21:02 +01:00
lzmadecode.c src/lib: Remove semicolon from end of macro 2017-03-13 21:24:26 +01:00
lzmadecode.h src/lib: Wrap lines at 80 columns 2017-03-13 17:21:02 +01:00
Makefile.inc ddr3 spd: move accessor code into lib/spd_bin.c 2017-02-10 18:04:33 +01:00
malloc.c Remove leftover smi_get_tseg_base 2015-05-29 07:06:37 +02:00
memchr.c Add an implementation for the memchr library function 2012-03-09 20:00:53 +01:00
memcmp.c src/lib: Add space before ( 2017-03-09 17:30:21 +01:00
memcpy.c fix compiler warnings (trivial) 2009-01-20 21:40:16 +00:00
memmove.c src/lib: Add space before ( 2017-03-09 17:30:21 +01:00
memrange.c src/lib: Use tabs instead of spaces 2017-03-13 15:46:02 +01:00
memset.c fix compiler warnings (trivial) 2009-01-20 21:40:16 +00:00
mocked_tlcl.c src/lib: Fix brace positions 2017-03-13 17:21:16 +01:00
nhlt.c lib/nhlt: add support for setting the oem_revision 2016-12-01 08:17:42 +01:00
primitive_memtest.c src/lib: Add space before ( 2017-03-09 17:30:21 +01:00
prog_loaders.c src/lib: Remove unnecessary code 2017-03-13 21:23:58 +01:00
prog_ops.c lib/prog_loading: introduce prog_segment_loaded() 2016-04-02 03:56:37 +02:00
program.ld lib/program.ld: add .sdata sections 2016-10-31 19:33:44 +01:00
ramtest.c src/lib: Remove unnecessary code 2017-03-13 21:23:58 +01:00
reg_script.c src/lib: Clean up general issues found by checkpatch.pl 2017-03-15 05:05:04 +01:00
region_file.c lib: add region file support 2016-12-08 16:10:28 +01:00
rmodule.c src/lib: Use tabs instead of spaces 2017-03-13 15:46:02 +01:00
rmodule.ld rmodule: use program.ld for linking 2015-09-09 19:35:30 +00:00
romstage_handoff.c lib: put romstage_handoff implementation in own compilation unit 2016-12-01 08:16:47 +01:00
romstage_stack.c intel post-car: Increase stacktop alignment 2016-11-18 20:59:12 +01:00
rtc.c lib: Add real-time-clock functions 2016-06-24 20:22:05 +02:00
selfboot.c src/lib: Wrap lines at 80 columns 2017-03-13 17:21:02 +01:00
spd_bin.c src/lib: Wrap lines at 80 columns 2017-03-13 17:21:02 +01:00
stack.c src/lib: Wrap lines at 80 columns 2017-03-13 17:21:02 +01:00
thread.c src/lib: Wrap lines at 80 columns 2017-03-13 17:21:02 +01:00
timer.c src/lib: Clean up general issues found by checkpatch.pl 2017-03-15 05:05:04 +01:00
timer_queue.c src/lib: Fix spacing 2017-03-13 17:16:08 +01:00
timestamp.c src/lib: Fix space between type, * and variable name 2017-03-09 17:27:02 +01:00
tlcl.c src/lib: Clean up general issues found by checkpatch.pl 2017-03-15 05:05:04 +01:00
tlcl_internal.h src/lib: Fix brace positions 2017-03-13 17:21:16 +01:00
tlcl_structures.h src/lib: Wrap lines at 80 columns 2017-03-13 17:21:02 +01:00
tpm2_marshaling.c cr50: add unmarshaling of vendor commands and process 'enable_update' 2017-03-23 23:49:58 +01:00
tpm2_marshaling.h tpm2: avoid comparison between signed and unsigned ints 2016-07-13 23:58:32 +02:00
tpm2_tlcl.c cr50: add unmarshaling of vendor commands and process 'enable_update' 2017-03-23 23:49:58 +01:00
tpm2_tlcl_structures.h cr50: add unmarshaling of vendor commands and process 'enable_update' 2017-03-23 23:49:58 +01:00
tpm_error_messages.h src/lib: Wrap lines at 80 columns 2017-03-13 17:21:02 +01:00
trace.c src/lib: Fix checkpatch warnings 2016-09-07 22:28:00 +02:00
version.c lib/version: Correct whitespace alignment 2016-07-15 00:10:50 +02:00
wrdd.c lib: Implement framework for retrieving WiFi regulatory domain 2016-03-08 18:41:33 +01:00