[PATCH 2/2] tpm: get tpm event log from bloblist
Simon Glass
sjg at chromium.org
Mon Dec 16 01:25:38 CET 2024
Hi Raymond,
On Fri, 13 Dec 2024 at 15:56, Raymond Mao <raymond.mao at linaro.org> wrote:
>
> Get tpm event log from bloblist instead of FDT when bloblist is
> enabled and valid from previous boot stage.
>
> Note:
> This patch depends on:
> [PATCH 1/2] bloblist: Introduce BLOBLIST_PRIOR_STAGE options
> https://lore.kernel.org/u-boot/20241212151142.1562825-1-trini@konsulko.com/
>
> Signed-off-by: Raymond Mao <raymond.mao at linaro.org>
> ---
> lib/tpm_tcg2.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/lib/tpm_tcg2.c b/lib/tpm_tcg2.c
> index 7f868cc883..acaf0acb88 100644
> --- a/lib/tpm_tcg2.c
> +++ b/lib/tpm_tcg2.c
> @@ -19,6 +19,7 @@
> #include <linux/unaligned/generic.h>
> #include <linux/unaligned/le_byteshift.h>
> #include "tpm-utils.h"
> +#include <bloblist.h>
>
> int tcg2_get_pcr_info(struct udevice *dev, u32 *supported_pcr, u32 *active_pcr,
> u32 *pcr_banks)
> @@ -672,6 +673,12 @@ __weak int tcg2_platform_get_log(struct udevice *dev, void **addr, u32 *size)
> *addr = NULL;
> *size = 0;
>
> + if (CONFIG_IS_ENABLED(BLOBLIST_PRIOR_STAGE) && !bloblist_maybe_init()) {
Please drop the second term...the bloblist is inited by U-Boot already.
Also please drop the first term. If you find it in the bloblist, just use it.
In other words, this code should be unconditional.
> + *addr = bloblist_get_blob(BLOBLISTT_TPM_EVLOG, size);
> + if (*addr && *size)
> + return 0;
> + }
> +
> addr_prop = dev_read_prop(dev, "tpm_event_log_addr", &asize);
> if (!addr_prop)
> addr_prop = dev_read_prop(dev, "linux,sml-base", &asize);
> --
> 2.25.1
>
Regards,
Simon
More information about the U-Boot
mailing list