Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: firmware/lib/vboot_kernel.c

Issue 2844044: added reboot return codes to load kernel and firmware (Closed) Base URL: ssh://gitrw.chromium.org/vboot_reference.git
Patch Set: After remerge 2 Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « firmware/lib/vboot_firmware.c ('k') | firmware/version.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: firmware/lib/vboot_kernel.c
diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
index 23ea913663b5051f847f8b6241cdf4fd592f10fe..ddbceed6e39cc7b281afa57d66b0644117f23851 100644
--- a/firmware/lib/vboot_kernel.c
+++ b/firmware/lib/vboot_kernel.c
@@ -129,6 +129,7 @@ int LoadKernel(LoadKernelParams* params) {
int is_dev = (BOOT_FLAG_DEVELOPER & params->boot_flags ? 1 : 0);
int is_rec = (BOOT_FLAG_RECOVERY & params->boot_flags ? 1 : 0);
int is_normal = (!is_dev && !is_rec);
+ uint32_t status;
/* Clear output params in case we fail */
params->partition_number = 0;
@@ -147,9 +148,11 @@ int LoadKernel(LoadKernelParams* params) {
if (is_normal) {
/* Read current kernel key index from TPM. Assumes TPM is already
* initialized. */
- if (0 != RollbackKernelRead(&tpm_key_version, &tpm_kernel_version)) {
+ status = RollbackKernelRead(&tpm_key_version, &tpm_kernel_version);
+ if (0 != status) {
VBDEBUG(("Unable to get kernel versions from TPM\n"));
- return LOAD_KERNEL_RECOVERY;
+ return (status == TPM_E_MUST_REBOOT ?
+ LOAD_KERNEL_REBOOT : LOAD_KERNEL_RECOVERY);
}
} else if (is_dev && !is_rec) {
/* In developer mode, we ignore the kernel subkey, and just use
@@ -367,20 +370,25 @@ int LoadKernel(LoadKernelParams* params) {
if ((lowest_key_version > tpm_key_version) ||
(lowest_key_version == tpm_key_version &&
lowest_kernel_version > tpm_kernel_version)) {
- if (0 != RollbackKernelWrite((uint16_t)lowest_key_version,
- (uint16_t)lowest_kernel_version)) {
+
+ status = RollbackKernelWrite((uint16_t)lowest_key_version,
+ (uint16_t)lowest_kernel_version);
+ if (0 != status) {
VBDEBUG(("Error writing kernel versions to TPM.\n"));
- return LOAD_KERNEL_RECOVERY;
+ return (status == TPM_E_MUST_REBOOT ?
+ LOAD_KERNEL_REBOOT : LOAD_KERNEL_RECOVERY);
}
}
}
/* Lock the kernel versions */
- if (0 != RollbackKernelLock()) {
+ status = RollbackKernelLock();
+ if (0 != status) {
VBDEBUG(("Error locking kernel versions.\n"));
/* Don't reboot to recovery mode if we're already there */
if (!is_rec)
- return LOAD_KERNEL_RECOVERY;
+ return (status == TPM_E_MUST_REBOOT ?
+ LOAD_KERNEL_REBOOT : LOAD_KERNEL_RECOVERY);
}
/* Success! */
« no previous file with comments | « firmware/lib/vboot_firmware.c ('k') | firmware/version.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698