summaryrefslogtreecommitdiff
path: root/firmware/lib/vboot_firmware.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2011-03-15 15:28:31 -0700
committerRandall Spangler <rspangler@chromium.org>2011-03-15 15:28:31 -0700
commit99ca3466ba097cceacaff0129e9060578a8fcb20 (patch)
treef6f60435a4db154e11a802b5b21a1920b53abcfa /firmware/lib/vboot_firmware.c
parentbc7a84d9a1bef3fb8c1e2709033f6c9777599fe9 (diff)
downloadvboot-99ca3466ba097cceacaff0129e9060578a8fcb20.tar.gz
LoadFirmware() and LoadKernel() handling for test errors
Change-Id: Icecfcab8f5cc30e80da7a2d77a1b1729f5094fee R=wfrichar@chromium.org BUG=13107 TEST=make && make runtests Review URL: http://codereview.chromium.org/6673048
Diffstat (limited to 'firmware/lib/vboot_firmware.c')
-rw-r--r--firmware/lib/vboot_firmware.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/firmware/lib/vboot_firmware.c b/firmware/lib/vboot_firmware.c
index 2f358522..bfe91866 100644
--- a/firmware/lib/vboot_firmware.c
+++ b/firmware/lib/vboot_firmware.c
@@ -34,6 +34,7 @@ void UpdateFirmwareBodyHash(LoadFirmwareParams* params,
int LoadFirmwareSetup(void) {
+ /* TODO: handle test errors (requires passing in VbNvContext) */
/* TODO: start initializing the TPM */
return LOAD_FIRMWARE_SUCCESS;
}
@@ -50,6 +51,7 @@ int LoadFirmware(LoadFirmwareParams* params) {
uint32_t tpm_version = 0;
uint64_t lowest_version = 0xFFFFFFFF;
uint32_t status;
+ uint32_t test_err = 0;
int good_index = -1;
int is_dev;
int index;
@@ -73,6 +75,27 @@ int LoadFirmware(LoadFirmwareParams* params) {
goto LoadFirmwareExit;
}
+ /* Handle test errors */
+ VbNvGet(vnc, VBNV_TEST_ERROR_FUNC, &test_err);
+ if (VBNV_TEST_ERROR_LOAD_FIRMWARE == test_err) {
+ /* Get error code */
+ VbNvGet(vnc, VBNV_TEST_ERROR_NUM, &test_err);
+ /* Clear test params so we don't repeat the error */
+ VbNvSet(vnc, VBNV_TEST_ERROR_FUNC, 0);
+ VbNvSet(vnc, VBNV_TEST_ERROR_NUM, 0);
+ /* Handle error codes */
+ switch (test_err) {
+ case LOAD_FIRMWARE_RECOVERY:
+ recovery = VBNV_RECOVERY_RO_TEST_LF;
+ goto LoadFirmwareExit;
+ case LOAD_FIRMWARE_REBOOT:
+ retval = test_err;
+ goto LoadFirmwareExit;
+ default:
+ break;
+ }
+ }
+
/* Must have a root key from the GBB */
if (!gbb) {
VBDEBUG(("No GBB\n"));
@@ -320,6 +343,9 @@ LoadFirmwareExit:
int S3Resume(void) {
+
+ /* TODO: handle test errors (requires passing in VbNvContext) */
+
/* Resume the TPM */
uint32_t status = RollbackS3Resume();