Commit graph

74641 commits

Author SHA1 Message Date
Simon Glass
4d3177d367 lib: Add tests for simple_strtoull()
Add some tests that check the behaviour of this function. These are the
same as for simple_strtoul() but with a few longer values.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-02 13:32:14 -04:00
Simon Glass
96b23440c1 lib: Drop unnecessary check for hex digit
If we see 0x then we can assume this is the start of a hex value. It
does not seem necessary to check for a hex digit after that since it will
happen when parsing the value anyway.

Drop this check to simplify the code and reduce size. Add a few more test
cases for when a 0x prefix is used.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-02 13:32:14 -04:00
Simon Glass
18546f2982 lib: Comment the base parameter with simple_strtoul/l()
This parameter is not documented properly since it does not cover the
meaning when the base is 0. Update this in both functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-02 13:32:14 -04:00
Simon Glass
0b1284eb52 global: Convert simple_strtoul() with decimal to dectoul()
It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-02 13:32:14 -04:00
Simon Glass
7e5f460ec4 global: Convert simple_strtoul() with hex to hextoul()
It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-02 13:32:14 -04:00
Simon Glass
031725f8cd hash: Ensure verification hex pairs are terminated
This function seems to assume that the chr[] variable contains zeros at
the start, which is not always true. Use strlcpy() to be safe.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-02 13:31:32 -04:00
Bin Meng
9feb5bdcc0 x86: crownbay: Use external graphics card by default
The board routes the Integrated Graphics Device (IGD) to an LVDS
panel, which is less popular than a PCIe based graphics card.

Disable the IGD so that it does not show up in the PCI configuration
space as a VGA display controller, so we can use an external PCIe
graphics card with whatever cable we have.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-08-03 00:03:14 +08:00
Bin Meng
c71d5fb717 x86: queensbay: Return directly if IGD / SDVO were already disabled
Initialize 'igd' and 'sdvo' to NULL so that we just need to test
them against NULL later, to be compatible with that case that IGD
and SDVO devices were already in disabled state.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-08-03 00:03:14 +08:00
Bin Meng
33e4ab31a9 x86: fsp: Only FSP2 has INIT_PHASE_END_FIRMWARE
For FSP1, there is no such INIT_PHASE_END_FIRMWARE.

Move board_final_cleanup() to fsp2 directory.

Fixes: 7c73cea442 ("x86: Notify the FSP of the 'end firmware' event")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on chromebook_coral, chromebook_samus, chromebook_link, minnowmax
Tested-by: Simon Glass <sjg@chromium.org>
2021-08-03 00:01:38 +08:00
Bin Meng
02541601cb x86: fsp: Don't program MTRR for DRAM for FSP1
There are several outstanding issues as to why this does not apply
to FSP1:

* For FSP1, the system memory and reserved memory used by FSP are
  already programmed in the MTRR by FSP.
* The 'mtrr_top' mistakenly includes TSEG memory range that has the
  same RES_MEM_RESERVED resource type. Its address is programmed
  and reported by FSP to be near the top of 4 GiB space, which is
  not what we want for SDRAM.
* The call to mtrr_add_request() is not guaranteed to have its size
  to be exactly the power of 2. This causes reserved bits of the
  IA32_MTRR_PHYSMASK register to be written which generates #GP.

For FSP2, it seems this is necessary as without this, U-Boot boot
process on Chromebook Coral goes very slowly.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on chromebook_coral, chromebook_samus, chromebook_link, minnowmax
Tested-by: Simon Glass <sjg@chromium.org>
2021-08-03 00:01:29 +08:00
Tom Rini
73994c452f Pull request for efi-2021-10-rc2
Documentation:
 
 * handle 'make htmldocs' warnings as errors
 * add missing board/ti/index.rst
 
 Bug fixes:
 
 * avoid buffer overrun in TrueType console
 * lib: disable CONFIG_SPL_HEXDUMP by default
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEK7wKXt3/btL6/yA+hO4vgnE3U0sFAmEHkH0ACgkQhO4vgnE3
 U0tTbg//WNWkO66IHDj8aBePNP2SKaRgXrRd/FP20flm38lokaDySu0cVQeONdwJ
 19NNz/2ScuX2EA1ZR96ozC+p2WI2HkXHVzNtXJ8u18yxxFxPAnLZHtoS6RPpp6Vd
 aWC9cDG1zPeUev+ja8g075snslcADBY3idZ+Y2u0NvHfAygutibLcvRCHaA8Guns
 R2nIZqbfGwKQ0fr1x1I7Yso9HxWMFJ2fp1srvAXDEUVumvVLRib0J49cDU2KgmhV
 MK0UXQfAYYfObklyDnsdQBf4lh30fzKuvZmoBKIDDurSxj59/c9HIG4SKhb/6V63
 qLtJ/hI+lHbQ5XmJ+CZvSszwesZG6y/s9ysZHuDR0XUtRdglW380DFQFNiyCkhPJ
 LGoNg7eSatElFtUCLshFKHfAkemol7HwXRTZd5O7wo2xZ0a87HmVQbYq6J+tSg8q
 SybuTTfitDQptDREghw58tU1HGKcBpzYVwDlQY3jUjEvQudqkwa7UsBdYWOsDlK2
 aszUA6AGu2pRAv7dOL1Hf6fULJ2YLNaMphZELSR20UPkv9HkWo+AZYVbA6g7XkdH
 UC52nqnSTbZKi9+QzwnFv/lZZ4C9mu+PnxT/nldq9ZJsIDcshdIQTlDCbxY33BFy
 E8v0KTCdJSPsZNBOD3+tygv1A0SiGmvvCYF87/HQccn5tzJhSEM=
 =1toh
 -----END PGP SIGNATURE-----

Merge tag 'efi-2021-10-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2021-10-rc2

Documentation:

* handle 'make htmldocs' warnings as errors
* add missing board/ti/index.rst

Bug fixes:

* avoid buffer overrun in TrueType console
* lib: disable CONFIG_SPL_HEXDUMP by default
2021-08-02 08:54:23 -04:00
Tom Rini
99bb5f248a Merge tag 'mmc-2021-7-30' of https://source.denx.de/u-boot/custodians/u-boot-mmc
pl180_mmci update and cleanup
fix rpmb routing memory alignment
2021-08-02 08:53:58 -04:00
Bin Meng
53094331ff x86: cmd: hob: Fix display of resource type for system memory
The resource type for system memory is currently displayed as
"unknown", which is wrong.

Fixes: 51af144eb7 ("x86: Allow showing details about a HOB entry")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on chromebook_coral, chromebook_samus, chromebook_link, minnowmax
Tested-by: Simon Glass <sjg@chromium.org>
2021-08-02 15:11:41 +08:00
Bin Meng
2ab1ffa555 x86: cmd: hob: Fix the command usage and help messages
At present the hob command usage and help messages are messed up
in a single line. They should be separated.

This was a regression introduced when [seq] and [-v] were added
to the command.

Fixes: d11544dfa9 ("x86: hob: Add way to show a single hob entry")
Fixes: 51af144eb7 ("x86: Allow showing details about a HOB entry")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on chromebook_coral, chromebook_samus, chromebook_link, minnowmax
Tested-by: Simon Glass <sjg@chromium.org>
2021-08-02 15:11:41 +08:00
Bin Meng
9a7c6fde07 x86: mtrr: Abort if requested size is not power of 2
The size parameter of mtrr_add_request() and mtrr_set_next_var()
shall be power of 2, otherwise the logic creates a mask that does
not meet the requirement of IA32_MTRR_PHYSMASK register.

Programming such a mask value to IA32_MTRR_PHYSMASK generates #GP.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on chromebook_coral, chromebook_samus, chromebook_link, minnowmax
Tested-by: Simon Glass <sjg@chromium.org>
2021-08-02 15:11:41 +08:00
Bin Meng
3bcd6cf89e x86: mtrr: Skip MSRs that were already programmed in mtrr_commit()
At present mtrr_commit() programs the MTRR MSRs starting from
index 0, which may overwrite MSRs that were already programmed
by previous boot stage or FSP.

Switch to call mtrr_set_next_var() instead.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on chromebook_coral, chromebook_samus, chromebook_link, minnowmax
Tested-by: Simon Glass <sjg@chromium.org>
2021-08-02 15:11:40 +08:00
Bin Meng
596bd0589a x86: mtrr: Do not clear the unused ones in mtrr_commit()
Current mtrr_commit() logic assumes that MTRR MSRs are programmed
consecutively from index 0 to its maximum number, and whenever it
detects an unused one, it clears all other MTRRs starting from that
one. However this may not always be the case.

In fact, the clear is not much helpful because these MTRRs come out
of reset as disabled already. Drop the clear codes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on chromebook_coral, chromebook_samus, chromebook_link, minnowmax
Tested-by: Simon Glass <sjg@chromium.org>
2021-08-02 15:11:40 +08:00
Bin Meng
c79cbb5952 x86: dts: Define a default TSC timer frequency
If for some reason, TSC timer frequency cannot be determined from
hardware, nor is it specified in the device tree, U-Boot will panic
resulting in endless reset during boot.

Let's define a default TSC timer frequency using the Kconfig value
CONFIG_X86_TSC_TIMER_FREQ (note: #include must be used instead of
/include/ otherwise the macro is not pre-processed).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-08-02 15:11:40 +08:00
Bin Meng
5824bc6d6f x86: tsc: Rename X86_TSC_TIMER_EARLY_FREQ to X86_TSC_TIMER_FREQ
Currently there are two places to specify the x86 TSC timer frequency
with one in Kconfig used for early timer and the other one in device
tree used when the frequency cannot be determined from hardware.

This may potentially create an inconsistent config where the 2 values
do not match. Let's use the one specified in Kconfig in the device
tree as well.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-08-02 15:11:40 +08:00
Bin Meng
ffaa7abfc5 x86: kconfig: Drop ROM_NEEDS_BLOBS and BUILD_ROM
These 2 options are no longer needed as now binman is used to build
u-boot.rom.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-08-02 15:11:40 +08:00
Bin Meng
e7a61c5cc0 x86: crownbay: Adjust VGA rom address
binman complains when binary blobs are present:

  Node '/binman/rom/intel-vga': Offset 0xfff90000 (4294508544) overlaps
  with previous entry '/binman/rom/u-boot-dtb-with-ucode' ending at
  0xfff9204c (4294516812)

Adjust VGA rom address to 0xfffa0000 so that u-boot.rom image can be
successfully built again.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-08-02 15:11:40 +08:00
Andy Shevchenko
46db4bbac3 x86: tangier: Fix DMA controller IRQ polarity in CSRT
IRQ polarity in CSRT has the same definition as by ACPI specification
chapter 19.6.64 "Interrupt (Interrupt Resource Descriptor Macro)", i.e.
ActiveHigh is 0, and ActiveLow is 1. On Intel Tangier the DMA controller
IRQ polarity is ActiveHigh.

Note, in DSDT (see southcluster.asl) it's described correctly.

Fixes: 5e99fde34a ("x86: tangier: Populate CSRT for shared DMA controller")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-08-02 15:11:40 +08:00
Bin Meng
bd798eed55 x86: dts: Add "m25p,fast-read" to SPI flash node
Except ICH7 SPI, all SPI flashes connected to ICH9 / Fast SPI should
have "m25p,fast-read" property present in their DT nodes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-08-02 15:11:40 +08:00
Bin Meng
5672d044a4 x86: crownbay: Disable CONFIG_SPI_FLASH_SMART_HWCAPS
Since commit 71025f013c ("mtd: spi-nor-core: Rework hwcaps selection")
SPI flash on Intel Crown Bay board does not work anymore.

Disable CONFIG_SPI_FLASH_SMART_HWCAPS until a proper fix is made to
the spi-nor core.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-08-02 15:11:40 +08:00
Bin Meng
4dc8279758 spi: ich: Limit slave->max_read_size
Since commit 43c145b8b3 ("spi: ich: Correct max-size bug in ich_spi_adjust_size()")
(in v2020.04-rc1), SPI flash read no longer works with ICH SPI controller
in software sequencer mode.

ICH controller can only transfer a small number of bytes at once.
Before commit 43c145b8b3, the logic happens to make sure data.nbytes
is limited to slave->max_write_size but after commit 43c145b8b3
data.nbytes is no longer limited because slave->max_read_size is not
initialized with a valid number.

Fixes: 43c145b8b3 ("spi: ich: Correct max-size bug in ich_spi_adjust_size()")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-08-02 15:11:40 +08:00
Heinrich Schuchardt
78e6b871fd efi_loader: typo cerificate
%s/cerificate/certificate/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-08-02 08:21:12 +02:00
Heinrich Schuchardt
c0b6f7d4b8 doc: add graphviz imagemagick as build dependencies
'make htmldocs' requires graphviz and imagemagick (at least with Sphinx
3.5.4).

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-08-01 23:31:07 +02:00
Heinrich Schuchardt
89a5fbbea1 doc: handle 'make htmldocs' warnings as errors
Parameter -W for sphinx-build turns build warnings into errors. This helps
us to avoid bad patches passing Gitlab CI.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-08-01 22:23:01 +02:00
Heinrich Schuchardt
5e1df33b68 doc: add missing board/ti/index.rst
Commit 8baeeecbe3 ("doc: board: Move j721e document to doc/board/ti/
directory") introduced 'make htmldocs' build errors due to a missing
file board/ti/index.rst.

Fixes: 8baeeecbe3 ("doc: board: Move j721e document to doc/board/ti/ directory")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-08-01 22:23:01 +02:00
Andre Przywara
845d71ce99 video: Hitachi panel: Drop bogus dependency on CONFIG_VIDEO
The Hitachi tx18d42vm LCD panel driver is really just initialising the
device, using bitbanged SPI, during operation there is nothing to do.
This makes the driver self contained, so drop the bogus dependency on
the legacy CONFIG_VIDEO.

This avoids the warning when building Chuwi_V7_CW0825_defconfig, since
we switched to DM_VIDEO recently.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2021-08-01 21:43:48 +02:00
Stephan Gerhold
21a151a79d video: Add simple driver for ST-Ericsson MCDE with pre-configured display
The U-Boot port for ST-Ericsson Ux500 is currently only used on the
"stemmy" board, where U-Boot runs after firmware that already sets up
a boot splash screen. This means that the display is already on
and we can just continue using it for U-Boot.

Add a simple driver that simplifies this by reading the display
configuration (e.g. screen size, bpp) from the hardware registers.

It also checks the configured "source synchronization" - for some
displays (usually DSI command mode displays) we need to explicitly
trigger a software sync. This is done through the video_sync()
callback that triggers the sync and wait for completion.

Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2021-08-01 21:40:51 +02:00
Tom Rini
72ffb41a87 sandbox TPM-emulator improvements
rST documentation and fixes for moveconfig
 handle empty 'ranges' property in dtoc
 patman warning for invalid tag
 clean-ups to 'fdt add' command
 -----BEGIN PGP SIGNATURE-----
 
 iQFFBAABCgAvFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAmEG4R4RHHNqZ0BjaHJv
 bWl1bS5vcmcACgkQfxc6PpAIreapJwgAtKsKWy+TReCluKdG6Rdc3vtJwE9WP0/O
 ms5JE/Rxk2wP7TMhuC6Sgl8WWhxuRpo623BfbtvbcBnxN/kugQRVNMYHiPTLzR78
 SUq/DxLbWz46MbYTPwgJxhMquJKAzgSh8YgHwgvFLB31EozQzXB8LYHorRQdW0TG
 42dKAOO3eDRMlT/DGkUcqm7dh9oG2T0rhGgJ1eQ/6vRksz8U0adunZeLA+sQQKRQ
 uwPbNbCX3mx1nVqN37bitatHYVxvJg6yVq9awcaAhk1gtlUzBvJghNFkEmLTALBd
 UFRMbWZXwf+7msffWJE5IcWrZxOAHixYgRMVv+iyFHEkyiSEKUAtZA==
 =4cKs
 -----END PGP SIGNATURE-----

Merge tag 'dm-pull-1aug21' of https://source.denx.de/u-boot/custodians/u-boot-dm

sandbox TPM-emulator improvements
rST documentation and fixes for moveconfig
handle empty 'ranges' property in dtoc
patman warning for invalid tag
clean-ups to 'fdt add' command
2021-08-01 14:41:22 -04:00
Simon Glass
eec44c7218 dtoc: Support widening a bool value
At present if we see 'ranges' property (with no value) we assume it is a
boolean, as per the devicetree spec.

But another node may define 'ranges' with a value, forcing us to widen it
to an int array. At present this is not supported and causes an error.

Fix this and add some test cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Tom Rini <trini@konsulko.com>
2021-08-01 09:05:24 -06:00
Simon Glass
ca04494d76 dtoc: Fix widening an int array to an int
An int array can hold a single int so we should not need to do anything
in the widening operation. However due to a quirk in the code, an int[3]
widened with an int produced an int[4]. Fix this and add a test.

Fix a comment typo while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Tom Rini <trini@konsulko.com>
2021-08-01 09:05:24 -06:00
Simon Glass
df82de8051 dtoc: Rename is_wider_than() to reduce confusion
The current name is confusing because the logic is actually backwards from
what you might expect. Rename it to needs_widening() and update the
comments.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01 09:05:24 -06:00
Simon Glass
cb8970092f sandbox: Reduce keyed autoboot delay
The autoboot tests are a recent addition to U-Boot, providing much-needed
coverage in this area.

A side effect of the keyed autoboot test is that this feature is enabled
in sandbox always. This changes the autoboot prompt and confuses the
pytests. Some tests become slower, for example the vboot tests take about
27s now instead of 3s.

We don't actually need this feature enabled to be able to run the tests.
Add a switch to allow sandbox to turn it on and off as needed. Use this
in the one test that needs it.

Add a command-line flag in case this is desired in normal use.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 25c8b9f298 ("test: add first autoboot unit tests")
Reviewed-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2021-08-01 09:05:24 -06:00
Simon Glass
ea40b20431 moveconfig: Update to newer kconfiglib
Some of the more advanced features of this tool don't work anymore since
kconfiglib was update. Update the code accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01 09:05:24 -06:00
Simon Glass
a8ba35bf23 doc: Fix up outdated moveconfig docs
The examples here are a bit messed up since the command does not match
the documentation. Use a different example instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01 09:05:24 -06:00
Simon Glass
5c72c0e0d2 doc: Add docs for the moveconfig tool
Move these docs into htmldocs so they can be read there.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01 09:05:24 -06:00
Simon Glass
a980e7bbde doc: Move coccinelle into its own section
This tool has nothing to do with testing. It is for refactoring code
automatically using a 'semantic patch' tool.

Create a new section for 'refactoring' and move it into there. It is
likely that other topics may fall under the same heading, such as
using moveconfig and search/replace tools.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01 09:05:24 -06:00
Simon Glass
2d754cea4c doc: Create an intro section for testing
At present this information is hidden away. Make it more visible by
putting it first, in an intro section.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-08-01 09:05:24 -06:00
Patrick Delaunay
a6123333ab patman: add warning for invalid tag
Add a error in patman tool when the commit message contents an invalid
tag "Serie-.*" instead of "Series-.*".

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-08-01 09:05:24 -06:00
Simon Glass
b29a0dbdc3 fdt: Show the type of devicetree with fdt addr
It seems useful to show whether the address of the Control or Working
devicetree is being shown. Add support for this. Drop the confusing 0x
prefix since the command itself only accepts hex.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01 09:05:24 -06:00
Simon Glass
0c929631a2 fdt: Tidy up the code a bit with fdt addr
Clean up the code a little before changing it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01 09:05:24 -06:00
Simon Glass
1c6608bd92 sandbox: tpm: Support extending a PCR multiple times
It is fairly easy to handle this case and it makes the emulator more
useful, since PCRs are commonly extended several times.

Add support for this, using U-Boot's sha256 support.

For now sandbox only supports a single PCR, but that is enough for the
tests that currently exist.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01 09:05:24 -06:00
Simon Glass
9f0b53564f sandbox: tpm: Correct handling of SANDBOX_TPM_PCR_NB
This is the number of PCRs, so the current check is off by one. Also the
map itself should not be checked, just the resulting pcr_index, to avoid
confusing people who read the code.

Fix these problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01 09:05:24 -06:00
Simon Glass
a986216e34 sandbox: tpm: Support storing device state in tpm2
At present the tpm2 emulator does not support storing the device state.
Add this so we can handle the normal vboot flow through the sandbox
executables (VPL->SPL etc.) with the TPM contents staying in place.

Note: sandbox has not yet been converted to use livetree for the state
information, since livetree does not yet support writing to the tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01 09:05:24 -06:00
Simon Glass
d8f105dd71 sandbox: tpm: Support nvdata in TPM2
Add support for this feature in the TPM2 emulator, to support Chromium OS
vboot.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01 09:05:24 -06:00
Simon Glass
0c0ddada65 sandbox: tpm: Track whether the state is valid
Add checking as to whether the current TPM state is valid, so we can
implement reading/writing the state.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01 09:05:24 -06:00
Simon Glass
46aed06cb7 sandbox: tpm: Finish comments for struct sandbox_tpm2
Tidy up the missing comments for this struct.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01 09:05:24 -06:00