summaryrefslogtreecommitdiff
path: root/src/security/vboot
diff options
context:
space:
mode:
authorYu-Ping Wu <yupingso@chromium.org>2023-07-07 11:30:12 +0800
committerFelix Held <felix-coreboot@felixheld.de>2023-07-12 13:41:07 +0000
commit5787bd21c7f61d983dfcd6ef90cd5c6b6f10f33a (patch)
tree023eac028ccb879ad4c1ce11f6adb0fd225fc9df /src/security/vboot
parentffe2ced6e42387d90587a058c6b2fa1a3d8551cc (diff)
security/vboot/secdata_tpm: Simplify antirollback_read_space_firmware()
The static function read_space_firmware() is used only once, so merge it into antirollback_read_space_firmware(). Also change a debug log to error. BUG=none TEST=emerge-geralt coreboot BRANCH=none Change-Id: I8abcb8b90e82c3e1b01a2144070a5fde6fe7157f Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/76330 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com> Reviewed-by: Yidi Lin <yidilin@google.com>
Diffstat (limited to 'src/security/vboot')
-rw-r--r--src/security/vboot/secdata_tpm.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/security/vboot/secdata_tpm.c b/src/security/vboot/secdata_tpm.c
index 45851a09f4..bc9d3d5070 100644
--- a/src/security/vboot/secdata_tpm.c
+++ b/src/security/vboot/secdata_tpm.c
@@ -28,14 +28,6 @@
static uint32_t safe_write(uint32_t index, const void *data, uint32_t length);
-static uint32_t read_space_firmware(struct vb2_context *ctx)
-{
- RETURN_ON_FAILURE(tlcl_read(FIRMWARE_NV_INDEX,
- ctx->secdata_firmware,
- VB2_SECDATA_FIRMWARE_SIZE));
- return TPM_SUCCESS;
-}
-
uint32_t antirollback_read_space_kernel(struct vb2_context *ctx)
{
if (!CONFIG(TPM2)) {
@@ -672,14 +664,13 @@ uint32_t antirollback_read_space_firmware(struct vb2_context *ctx)
{
uint32_t rv;
- /* Read the firmware space. */
- rv = read_space_firmware(ctx);
+ rv = tlcl_read(FIRMWARE_NV_INDEX, ctx->secdata_firmware, VB2_SECDATA_FIRMWARE_SIZE);
if (rv == TPM_E_BADINDEX) {
/* This seems the first time we've run. Initialize the TPM. */
- VBDEBUG("TPM: Not initialized yet.\n");
+ VBDEBUG("TPM: Not initialized yet\n");
RETURN_ON_FAILURE(factory_initialize_tpm(ctx));
} else if (rv != TPM_SUCCESS) {
- VBDEBUG("TPM: Firmware space in a bad state; giving up.\n");
+ printk(BIOS_ERR, "TPM: Failed to read firmware space: %#x\n", rv);
return TPM_E_CORRUPTED_STATE;
}