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

Side by Side Diff: firmware/lib/vboot_kernel.c

Issue 6670040: Fix LoadKernel() not returning LOAD_KERNEL_RECOVERY (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 * 4 *
5 * Functions for loading a kernel from disk. 5 * Functions for loading a kernel from disk.
6 * (Firmware portion) 6 * (Firmware portion)
7 */ 7 */
8 8
9 #include "vboot_kernel.h" 9 #include "vboot_kernel.h"
10 10
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 int found_partitions = 0; 132 int found_partitions = 0;
133 int good_partition = -1; 133 int good_partition = -1;
134 int good_partition_key_block_valid = 0; 134 int good_partition_key_block_valid = 0;
135 uint32_t tpm_version = 0; 135 uint32_t tpm_version = 0;
136 uint64_t lowest_version = LOWEST_TPM_VERSION; 136 uint64_t lowest_version = LOWEST_TPM_VERSION;
137 int rec_switch, dev_switch; 137 int rec_switch, dev_switch;
138 BootMode boot_mode; 138 BootMode boot_mode;
139 uint32_t test_err = 0; 139 uint32_t test_err = 0;
140 uint32_t status; 140 uint32_t status;
141 141
142 /* TODO: differentiate between finding an invalid kernel (found_partitions>0) 142 int retval = LOAD_KERNEL_RECOVERY;
143 * and not finding one at all. Right now we treat them the same, and return
144 * LOAD_KERNEL_INVALID for both. */
145 int retval = LOAD_KERNEL_INVALID;
146 int recovery = VBNV_RECOVERY_RO_UNSPECIFIED; 143 int recovery = VBNV_RECOVERY_RO_UNSPECIFIED;
147 144
148 /* Setup NV storage */ 145 /* Setup NV storage */
149 VbNvSetup(vnc); 146 VbNvSetup(vnc);
150 147
151 /* Sanity Checks */ 148 /* Sanity Checks */
152 if (!params || 149 if (!params ||
153 !params->bytes_per_lba || 150 !params->bytes_per_lba ||
154 !params->ending_lba || 151 !params->ending_lba ||
155 !params->kernel_buffer || 152 !params->kernel_buffer ||
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 if (status == TPM_E_MUST_REBOOT) 532 if (status == TPM_E_MUST_REBOOT)
536 retval = LOAD_KERNEL_REBOOT; 533 retval = LOAD_KERNEL_REBOOT;
537 else 534 else
538 recovery = VBNV_RECOVERY_RW_TPM_ERROR; 535 recovery = VBNV_RECOVERY_RW_TPM_ERROR;
539 goto LoadKernelExit; 536 goto LoadKernelExit;
540 } 537 }
541 } 538 }
542 539
543 /* Success! */ 540 /* Success! */
544 retval = LOAD_KERNEL_SUCCESS; 541 retval = LOAD_KERNEL_SUCCESS;
542 } else {
543 /* TODO: differentiate between finding an invalid kernel
544 * (found_partitions>0) and not finding one at all. Right now we
545 * treat them the same, and return LOAD_KERNEL_INVALID for both. */
546 retval = LOAD_KERNEL_INVALID;
545 } 547 }
546 548
547 LoadKernelExit: 549 LoadKernelExit:
548 550
549 /* Save whether the good partition's key block was fully verified */ 551 /* Save whether the good partition's key block was fully verified */
550 VbNvSet(vnc, VBNV_FW_VERIFIED_KERNEL_KEY, good_partition_key_block_valid); 552 VbNvSet(vnc, VBNV_FW_VERIFIED_KERNEL_KEY, good_partition_key_block_valid);
551 553
552 /* Store recovery request, if any, then tear down non-volatile storage */ 554 /* Store recovery request, if any, then tear down non-volatile storage */
553 VbNvSet(vnc, VBNV_RECOVERY_REQUEST, LOAD_KERNEL_RECOVERY == retval ? 555 VbNvSet(vnc, VBNV_RECOVERY_REQUEST, LOAD_KERNEL_RECOVERY == retval ?
554 recovery : VBNV_RECOVERY_NOT_REQUESTED); 556 recovery : VBNV_RECOVERY_NOT_REQUESTED);
555 VbNvTeardown(vnc); 557 VbNvTeardown(vnc);
556 558
557 /* Store how much shared data we used, if any */ 559 /* Store how much shared data we used, if any */
558 if (shared) 560 if (shared)
559 params->shared_data_size = shared->data_used; 561 params->shared_data_size = shared->data_used;
560 562
561 return retval; 563 return retval;
562 } 564 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698