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>
This commit is contained in:
parent
ffe2ced6e4
commit
5787bd21c7
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue