Honor both fake_dev and virtual dev switch

BUG=chrome-os-partner:9706
TEST=none

No test yet. The entire boot/dev-mode/recovery flow depends on this working.
This is only part of the process, which will eventually be tested through
FAFT.

Change-Id: Iea6eaf59d4f349590cf9b920e4effb6a2641b2dc
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/23657
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Bill Richardson
2012-05-24 12:15:30 -07:00
committed by Gerrit
parent 201fe0bb55
commit 6f4cc56359
2 changed files with 13 additions and 13 deletions

View File

@@ -364,8 +364,7 @@ uint32_t SetupTPM(int recovery_mode, int developer_mode,
rsf->struct_version, rsf->flags, rsf->fw_versions)); rsf->struct_version, rsf->flags, rsf->fw_versions));
/* The developer_mode value that's passed in is only set by a hardware /* The developer_mode value that's passed in is only set by a hardware
* dev-switch. We should OR it with any enabled virtual switch, since it * dev-switch. We should OR it with any enabled virtual switch. */
* can only be set by doing the keyboard-based dev-mode dance. */
if (rsf->flags & FLAG_VIRTUAL_DEV_MODE_ON) if (rsf->flags & FLAG_VIRTUAL_DEV_MODE_ON)
developer_mode = 1; developer_mode = 1;
@@ -474,8 +473,8 @@ uint32_t RollbackFirmwareSetup(int recovery_mode, int hw_dev_sw,
RETURN_ON_FAILURE(SetupTPM(recovery_mode, *dev_mode_ptr, &rsf)); RETURN_ON_FAILURE(SetupTPM(recovery_mode, *dev_mode_ptr, &rsf));
*version = rsf.fw_versions; *version = rsf.fw_versions;
if (!hw_dev_sw) if (!hw_dev_sw && (rsf.flags & FLAG_VIRTUAL_DEV_MODE_ON))
*dev_mode_ptr = rsf.flags & FLAG_VIRTUAL_DEV_MODE_ON ? 1 : 0; *dev_mode_ptr = 1; /* OR with the TPM's value */
VBDEBUG(("TPM: RollbackFirmwareSetup %x\n", (int)rsf.fw_versions)); VBDEBUG(("TPM: RollbackFirmwareSetup %x\n", (int)rsf.fw_versions));
return TPM_SUCCESS; return TPM_SUCCESS;
} }

View File

@@ -113,19 +113,22 @@ VbError_t VbInit(VbCommonParams* cparams, VbInitParams* iparams) {
} }
} else { } else {
/* We need to know about dev mode now */ /* We need to know about dev mode now. */
if (iparams->flags & VB_INIT_FLAG_VIRTUAL_DEV_SWITCH) if (iparams->flags & VB_INIT_FLAG_VIRTUAL_DEV_SWITCH)
hw_dev_sw = 0; hw_dev_sw = 0;
else if (iparams->flags & VB_INIT_FLAG_DEV_SWITCH_ON) if (iparams->flags & VB_INIT_FLAG_DEV_SWITCH_ON)
is_dev = 1; is_dev = 1;
/* FIXME: How about a GBB flag to force dev-switch on? */
VBPERFSTART("VB_TPMI"); VBPERFSTART("VB_TPMI");
/* Initialize the TPM. *is_dev is both an input and output. The only time /* Initialize the TPM. *is_dev is both an input and output. The only time
* it should be 1 on input is when we have a hardware dev-switch and it's * it should be 1 on input is when the hardware dev-switch is enabled
* enabled. The only time it's promoted from 0 to 1 on return is when we * (which includes the fake_dev switch from the EC). The only time
* have a virtual dev-switch and the TPM has a valid rollback space with * it's promoted from 0 to 1 on return is when we have a virtual dev-switch
* the virtual switch already enabled. If the TPM space is initialized by * and the TPM has a valid rollback space with the virtual switch already
* this call, its virtual dev-switch will be disabled by default. */ * enabled (if the TPM space is initialized by this call, its virtual
* dev-switch will be disabled by default). The TPM just uses the input
* value to clear ownership if the dev state has changed. */
tpm_status = RollbackFirmwareSetup(recovery, hw_dev_sw, tpm_status = RollbackFirmwareSetup(recovery, hw_dev_sw,
&is_dev, &tpm_version); &is_dev, &tpm_version);
VBPERFEND("VB_TPMI"); VBPERFEND("VB_TPMI");
@@ -160,8 +163,6 @@ VbError_t VbInit(VbCommonParams* cparams, VbInitParams* iparams) {
shared->flags |= VBSD_BOOT_DEV_SWITCH_ON; shared->flags |= VBSD_BOOT_DEV_SWITCH_ON;
} }
/* FIXME: May need a GBB flag for initial value of virtual dev-switch */
/* Allow BIOS to load arbitrary option ROMs? */ /* Allow BIOS to load arbitrary option ROMs? */
if (gbb->flags & GBB_FLAG_LOAD_OPTION_ROMS) if (gbb->flags & GBB_FLAG_LOAD_OPTION_ROMS)
iparams->out_flags |= VB_INIT_OUT_ENABLE_OPROM; iparams->out_flags |= VB_INIT_OUT_ENABLE_OPROM;